|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# Q; w! j' C0 c- [code]EDMA sample test application
8 }' @- A: N* |, N) R ]3 R - /*9 f7 G4 z# z) |" O u
- * edma_test.c
* |1 ^- p; C u) b7 l w9 e( c - *6 M% a. [/ U3 N/ a4 y/ c
- * brief EDMA3 Test Application" {* s; E' \$ x) J/ E6 D$ s
- *
; E N+ P" k8 c; u% ]2 c6 d - * This file contains EDMA3 Test code.3 F- b) V4 t1 O. W: c7 _# |
- *! ?/ n9 @, P2 t! H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ ^7 c; S7 ^9 z& l" j5 H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; Q9 T* z+ ?( \* P
- * TO CHANGE.& F3 f/ |/ x/ Y5 `$ k$ G
- *
* v3 Q+ o1 x/ D, }- l1 i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 R% q2 V$ b: @$ }( x, Z) M
- *" L* c6 Q9 L& o
- * This program is free software; you can redistribute it and/or; _/ z5 L5 e% S& c4 F7 W
- * modify it under the terms of the GNU General Public License as4 Q& b& m8 U, I+ U
- * published by the Free Software Foundation version 2.2 |0 |& I% h" }$ V1 n. M# S
- *
7 N {# r& `4 z6 M0 }7 b/ M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any f/ k0 @- ^8 w( ^. A
- * kind, whether express or implied; without even the implied warranty
e5 q$ G& r: @& J, L: @, B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ p# I7 Q' f+ b8 b { - * GNU General Public License for more details.
' y+ v7 V* o8 y& h* f' s( n - */1 x1 k' u) } E7 G
- ]# h, U* F! [+ R) v
- #include <linux/module.h>$ |6 p: Z: t7 k9 N
- #include <linux/init.h>' R% a4 o c; s- Z7 o
- #include <linux/errno.h>
2 \- I$ m! {4 ~6 ~1 _3 Z& f - #include <linux/types.h>
& x a0 Q, _) H0 _' N3 q- q - #include <linux/interrupt.h>. A$ J9 z( A# z4 Q7 y
- #include <asm/io.h>6 W7 [$ d# ~2 T# C0 E
- #include <linux/moduleparam.h>. ]7 Y8 `" d+ q$ d# N
- #include <linux/sysctl.h>
! \8 A% s8 Y' b, P% M& P* i - #include <linux/mm.h>
, |% \ H- z4 h8 W' u. Z' ~8 a - #include <linux/dma-mapping.h>+ d" J/ U6 t% S( d
- % j9 t* G, U( V+ s8 S( @
- #include <mach/memory.h>4 D- w, U5 D4 z* a
- #include <mach/hardware.h>
8 P( i0 S# [7 r8 m - #include <mach/irqs.h>
7 c& X9 u5 _- G' X$ a% m - #include <asm/hardware/edma.h>
0 k- z) g$ M; N! ~) Y/ K* u - ; s8 d2 S4 h/ Z1 d. {
- #undef EDMA3_DEBUG7 D7 ?6 |* G. \& }/ z
- /*#define EDMA3_DEBUG*/
6 y7 m0 i* Z4 S% _' P) K# h - - g3 ?! I: J; X/ S R: E3 a
- #ifdef EDMA3_DEBUG
. |! K, k2 n0 S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 P& c" a6 l" `- P' l8 h# J* p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# m8 \* ~$ b: U6 m; L" k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* R. ~- C# d. o7 X* g$ a
- #else
7 ?* J) _# a8 @' k) L- T - #define DMA_PRINTK( x... )
. X7 R$ d3 m& j% ]- X! F0 C - #define DMA_FN_IN
7 \) s/ y2 Z* D" ?& i% w! b - #define DMA_FN_OUT
0 W/ S' T: q- F. F# F: o" I3 Y - #endif
- ^" M3 k! u* \
9 d+ Q: i+ G4 Y0 }: R1 x4 l4 ^* @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 V' n. b; m" v
- #define STATIC_SHIFT 3/ X# f% B+ l y3 o; ]9 ~0 I
- #define TCINTEN_SHIFT 20
' k' [$ a3 {/ X) \! L" K - #define ITCINTEN_SHIFT 21
! N1 C9 V( u @9 W5 e - #define TCCHEN_SHIFT 22! H T/ o4 M. z: k8 H* \2 N
- #define ITCCHEN_SHIFT 23
/ T5 f; t1 e0 I, u' p - 3 f. ^. O# C. B
- static volatile int irqraised1 = 0;
1 E" b3 J1 [# z- X a - static volatile int irqraised2 = 0;
) N% y, [9 P" ~0 A/ ~( Y/ J+ a# h* L - M/ L* f! n0 y& ]) m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: s+ q% B: Z2 P. m2 P, s9 l2 O1 }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 x5 P8 h, |% D6 }4 L) S2 m8 m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ z. i% S& G( d8 ]0 o) l9 K
" v! L9 V3 k3 y6 f$ s- dma_addr_t dmaphyssrc1 = 0;, C4 z; |" V4 F, e1 i
- dma_addr_t dmaphyssrc2 = 0;
" i0 W' B/ b6 l/ y' f - dma_addr_t dmaphysdest1 = 0;$ R! V9 l7 Z$ O6 U9 }
- dma_addr_t dmaphysdest2 = 0;7 v9 ?5 V1 S9 g& s4 R% h' ~
- 6 | r6 h8 d* z: m
- char *dmabufsrc1 = NULL;
- v0 Q# j* Z1 y - char *dmabufsrc2 = NULL;7 e4 u! ?" n' a( b0 k6 h. b+ |" w! F
- char *dmabufdest1 = NULL;
7 }7 }5 Y4 V6 d) D7 S - char *dmabufdest2 = NULL;2 I9 q+ f. H+ R0 G
- 2 ?; `) g' y5 W* A
- static int acnt = 512;
& b, j- m9 K5 U% V1 n- ?9 I. e7 h4 E - static int bcnt = 8;* u, g% H8 F' z; V# I
- static int ccnt = 8;
: l; U& M/ W+ k0 H, |% J - 7 k; E% P( M1 z: o2 \& R$ }6 s
- module_param(acnt, int, S_IRUGO);
# |5 G+ Q' h3 C) z1 f: c - module_param(bcnt, int, S_IRUGO);
1 V0 X5 s( ]0 ^+ M, L$ T# W - module_param(ccnt, int, S_IRUGO);
复制代码 5 A4 D! O0 s+ \( h% n3 g" a
) P) n' x) B7 u0 r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& w6 J4 |' w# i# ]/ _) q( F: |* X0 I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 J& G2 U+ W/ k! I8 N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 |8 W/ J+ h/ O7 \. y; B: t
# j% R# P( P0 v2 Y) ?; S2 P F; T8 {2 S+ S7 p0 I
|
|