|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: \' p) m6 y& b1 c5 T- [code]EDMA sample test application
~# l' T( R. E - /*
. D$ {1 Y. G7 Q! i+ L# ] - * edma_test.c
9 _% s1 c5 s3 g, A5 z1 K - *3 Q9 } G5 b# c P& G
- * brief EDMA3 Test Application
8 R# |( X" S; y$ ~0 B - *
$ t3 h* Q! |# S - * This file contains EDMA3 Test code.& x2 N9 k& C/ e8 _" c
- *
0 y/ M$ V- b; i e. d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& W9 N2 T0 t ?7 ?5 |7 d: p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 j \& q/ c- y/ L! b" x - * TO CHANGE.
2 P5 ]+ l4 W+ K+ d' X c/ ]' k& I - *
2 q1 @3 T0 l) V* _7 G/ }+ P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% A1 ~* o; }/ r. b7 \ - *- T) t( ]) ]; d/ m* m6 u8 n
- * This program is free software; you can redistribute it and/or
0 d8 r4 P2 i. v8 S* E; H" E - * modify it under the terms of the GNU General Public License as
# S v! a) `! x/ V! E - * published by the Free Software Foundation version 2.* F9 s& w! q2 e% H
- *
' g3 H' \% S1 i" @; q! h4 Q5 Y$ x/ K* b! G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" g4 x+ q# W- a( L7 E% e" q6 T
- * kind, whether express or implied; without even the implied warranty7 A0 g; Z" z. }6 f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 {1 F/ l! O7 Y C' q, K1 m3 I
- * GNU General Public License for more details.
) X S; x$ u' j. L( V0 j" \6 a - */: F; [' s, J9 v
8 c- u0 o, ]+ D4 R5 b/ W: |- #include <linux/module.h>, ]+ t7 N( ~8 ^
- #include <linux/init.h>
0 V7 F% H# _5 E( D - #include <linux/errno.h>! \" i3 U& K) t2 u
- #include <linux/types.h>. L! z+ e7 g4 Q! C* w
- #include <linux/interrupt.h>1 w. E" g: I0 v( N8 e2 y9 B
- #include <asm/io.h>
+ f0 v2 R7 P6 {1 m6 G - #include <linux/moduleparam.h>
9 J6 n2 E1 [* F8 W4 c% x1 R% E - #include <linux/sysctl.h>
7 `' J4 V/ D. I* r& p' ~ j1 U - #include <linux/mm.h>$ B7 S; |9 {5 w) b2 W
- #include <linux/dma-mapping.h>4 _3 ~! Y( K$ b, `
& e+ I$ F7 o. ` Q% Z1 z4 t8 B- #include <mach/memory.h>
* g W0 K/ |1 p+ u$ K - #include <mach/hardware.h>& z) m- `8 h2 z) t, F
- #include <mach/irqs.h>8 ~ ]1 l: L) w4 V |/ R
- #include <asm/hardware/edma.h>7 Q3 e% }6 U- J/ _& V$ C9 J8 B
- 0 ~0 x m3 @0 ^ J
- #undef EDMA3_DEBUG
2 D. A3 [6 B2 Q* H+ M - /*#define EDMA3_DEBUG*/0 U! z. l' I* y/ |+ S
- & j8 T7 z4 ^9 L
- #ifdef EDMA3_DEBUG8 G& M5 d& h0 B3 z& V/ S2 L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 c- \0 v Q: R7 A0 H, z S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 M4 W5 ]8 }% [( _, M5 O3 l9 F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 r4 g3 R/ U7 X# Q7 C& f - #else) O/ ~4 L! B. m; ^7 O
- #define DMA_PRINTK( x... ) ?1 E `0 D9 F8 a: {5 o3 _: y
- #define DMA_FN_IN/ i+ U$ S( d2 c! e& r
- #define DMA_FN_OUT
1 _7 { g! B; o; Z - #endif
2 ~+ C/ S& ]8 b \9 @& [; H - $ |, h# w8 R- c; y% [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 _1 g$ e; R3 C- a+ J1 A" \
- #define STATIC_SHIFT 3
# {: G: v1 N# ~% \1 W0 z - #define TCINTEN_SHIFT 20
4 X& h# S& H) p" f5 G0 f! a0 f - #define ITCINTEN_SHIFT 21
" o$ c( J- d" q0 H6 ^ - #define TCCHEN_SHIFT 22/ Z. B4 @, y$ L; m) {6 P
- #define ITCCHEN_SHIFT 23% o D' |2 y. q {6 }, c% s3 O8 D
w" v( {: r6 z1 o+ c+ u- static volatile int irqraised1 = 0;
8 c6 e, ], X I% F: O: O! z - static volatile int irqraised2 = 0;
# ^9 V; \2 u' _9 F' G0 k7 A - * c4 Q# A% o9 f* z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 h* N: I5 [% a, j3 |7 ]5 `! A8 p, p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. o. m |- n8 n V4 Y! `. i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) u0 {, S8 m. g u" E# C
- ' I( |0 e" h# W: F0 w( Y
- dma_addr_t dmaphyssrc1 = 0;: h8 ~; @! u+ q
- dma_addr_t dmaphyssrc2 = 0;
4 T3 X. i. H) O$ ?: h; e - dma_addr_t dmaphysdest1 = 0; p! t8 L# p& u6 J2 \
- dma_addr_t dmaphysdest2 = 0;
) K( }% _- {" b" L - ( H7 |, s! } ~" n- L8 i
- char *dmabufsrc1 = NULL;+ v! N( |: W' @
- char *dmabufsrc2 = NULL;
6 D D9 h% R- q- | - char *dmabufdest1 = NULL;
^ n# W! f8 ]9 H' @! \1 l& u - char *dmabufdest2 = NULL;
8 F8 w; b: E" I: q; U - # Y1 k( @3 }( i9 n; d. V: |
- static int acnt = 512;
" }0 p: U* C% Q% X) v% E6 k- r" [, N" u - static int bcnt = 8;
- D/ I! a! p3 | - static int ccnt = 8;5 ^' J( s9 m( N& C& M7 { t2 c S- _. W
- & w7 m9 _$ y3 f$ l
- module_param(acnt, int, S_IRUGO);
1 ^2 L+ |$ V- I# B6 n1 { - module_param(bcnt, int, S_IRUGO);! C; w2 p, f/ h( x. \; G
- module_param(ccnt, int, S_IRUGO);
复制代码 8 r+ h7 y% v* U0 q& ?
) B+ J' \- i: v1 {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! J% z# K( z" W8 g3 @arm-none-linux-gnueabi-gcc -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 F: Z2 E/ a3 T& L0 H( [& j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! R3 @( D0 U7 c& {# o; C- t, r) ]
9 c8 r; `% A+ l4 k" m5 p! d |
|