|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, S3 b! L8 Q7 j( H! d7 }0 @- [code]EDMA sample test application' U7 w9 e& s0 \) G- y: d
- /*
- t& v1 v3 F* x: w - * edma_test.c4 _$ r7 V9 u/ q. J1 [
- *
2 M- B$ e& V1 D2 B2 A, g: V - * brief EDMA3 Test Application
6 N' M w* H5 p+ X' }; M. p - *& S; l) q: _. f: h
- * This file contains EDMA3 Test code.
! r; L) n# D* \6 H0 n! @& e& p8 B5 B - *9 @3 u4 J5 I0 J, G4 X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 Y% t) E& k3 W9 g1 N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( ?5 d) I b4 k
- * TO CHANGE.7 x ]3 M- s& }
- *
. C7 M; w S, C! J) ?2 N* |$ p: [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. b/ J3 ^! \8 u* Q8 s - *! Y8 J8 O! A* n. j% X2 E7 F
- * This program is free software; you can redistribute it and/or+ d- J: n4 b) i4 X
- * modify it under the terms of the GNU General Public License as# q! ~ {. b H' P
- * published by the Free Software Foundation version 2.
6 r, N4 t; U1 F z) H" O/ C. [ - *
6 s% o5 |- n% ?+ @# }2 z0 l3 ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 B1 r z4 [; w2 _0 d
- * kind, whether express or implied; without even the implied warranty
( G1 E% `5 [2 l n6 ]6 b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 p2 e; n3 ]2 P! l - * GNU General Public License for more details.' ~9 K: \2 O1 G) k$ ]0 y1 P
- */9 i4 O O9 m' s, Z% R) f1 u1 n
- ' E$ C; j) |8 k( J* K. |* x1 ^
- #include <linux/module.h>( ]0 H2 k7 E& ?0 D" [9 e
- #include <linux/init.h>
* s2 X1 ^ Q& r9 v. R - #include <linux/errno.h>* |$ n" z& \6 ?- U" U! y
- #include <linux/types.h>: }4 q) `: w% _, B* f6 ~: Q: c
- #include <linux/interrupt.h>
5 b/ H @2 ^5 l! d* j! u: | - #include <asm/io.h>7 A8 z* `) x. d: |; f
- #include <linux/moduleparam.h>
/ N4 G& b# ~7 L9 U$ d3 t+ k - #include <linux/sysctl.h>/ i2 q# l! D8 r9 i% s) x3 s
- #include <linux/mm.h>
7 ]" m( j. s# N, q - #include <linux/dma-mapping.h>
! g. c4 t0 o f" ?$ |% D
1 n; \; `1 ~, o7 e) I# l- #include <mach/memory.h>, X" Z' [% `# u
- #include <mach/hardware.h>6 B& T0 q5 [: w1 i' A
- #include <mach/irqs.h>" r% y- @ n% P5 j* ^+ W1 F t+ M
- #include <asm/hardware/edma.h>8 L4 ^2 i& I# ~: L$ N
- 9 f7 Y4 ?8 ~) h6 @
- #undef EDMA3_DEBUG3 j2 l2 Z H+ {+ ^8 x
- /*#define EDMA3_DEBUG*/( a* n, v1 W" Z# f+ w1 A
- " b2 j, k, W# D: V' U
- #ifdef EDMA3_DEBUG1 l1 R8 E5 W9 }6 i8 I1 X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ k+ G- e$ c5 K" e0 l& l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 y: Q g! i$ S; ^1 Z: j; l0 d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ ^3 u% }/ y- c) o' ]
- #else
8 e( D) A5 b" b2 O: D - #define DMA_PRINTK( x... )8 L9 J. Q- h2 W* ]
- #define DMA_FN_IN+ p' {; e. s5 g
- #define DMA_FN_OUT
" j. L7 `' w0 w8 m9 s% K( U - #endif" z2 Z4 `# X& F
- m. h$ l6 f& T5 {- t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 V& j# a+ R& ~' s. o4 j& f2 | - #define STATIC_SHIFT 3# m9 L1 h) O8 V6 E# u
- #define TCINTEN_SHIFT 20
2 [: K x |, k" a6 q - #define ITCINTEN_SHIFT 21
- v. U0 N. W. t$ M" F" A9 {* f - #define TCCHEN_SHIFT 22
6 f- N6 w/ j$ _3 w+ C. S V - #define ITCCHEN_SHIFT 23! i, P8 N E4 _& z. X0 H
]- m$ s: o, U; w0 h4 ?3 s+ ?' y1 n- static volatile int irqraised1 = 0;- R' G3 I+ |9 k# H% m1 h
- static volatile int irqraised2 = 0;; N: X4 \+ a" l; ~& N
6 s! M8 B P$ Q, e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 ]* }+ J3 n y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. Z; m0 z+ M. ~* F8 E0 \% |6 [4 k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 q D8 n% ~# `1 ]6 o4 @ - 1 P' b& a! m; a2 [ H
- dma_addr_t dmaphyssrc1 = 0;
* |- w9 M: h! w4 L% s& R$ `' D, i - dma_addr_t dmaphyssrc2 = 0;
2 m4 S/ w) n2 Z% l - dma_addr_t dmaphysdest1 = 0;
6 ^5 ~3 j, Y. t" U$ I7 _1 k! O - dma_addr_t dmaphysdest2 = 0;' h2 j% O: O# B( a- q
0 q5 R; J) ]9 ^. N- char *dmabufsrc1 = NULL;1 H' E0 B3 ?: c' a2 d% G
- char *dmabufsrc2 = NULL;
: Y% o+ `3 m# d! s' x - char *dmabufdest1 = NULL;
$ S8 {; G: x1 E - char *dmabufdest2 = NULL;- W1 P9 v( x- I" H
* M) y" u: E; _' |6 w! M1 r, U8 E- static int acnt = 512;: i6 k! p8 q! j& D7 p" z" O0 T
- static int bcnt = 8;
% Y+ w" E3 N6 D' b5 L' P - static int ccnt = 8;
9 B( H1 ~! B% T+ ?; Z9 ]/ l( {% _
" F' D+ n, [. \, t: V) p& `- module_param(acnt, int, S_IRUGO);
$ h7 q5 j6 m1 i4 W - module_param(bcnt, int, S_IRUGO); `0 G) y |! w. a, ?6 B/ F/ M
- module_param(ccnt, int, S_IRUGO);
复制代码
1 o+ [, t( G4 Q5 K: C& e c+ o: B% y% L9 ]* ^: \2 h) L8 s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 f( J+ _$ l" E: r6 `& k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ P. { }/ _8 ]" o( z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ P9 U0 U4 M: z( @" M. {2 w8 J5 B5 x/ z' y$ c6 R5 K5 h
$ D d6 T, G: K0 ^% l% k% _( F- n" S
|
|