|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : S. A# k8 f) z. l/ v3 J- n
- [code]EDMA sample test application$ F' F% _! W' x! j/ _
- /*' A4 v1 m7 S7 p1 V0 L4 l& l
- * edma_test.c
9 L* }* q# t; [ - *- V4 M. ~; |5 r8 o' D
- * brief EDMA3 Test Application
& R( D- k) L0 G+ V$ ^2 c+ h - *
, U9 Z1 ^0 I+ k# l2 N: l1 \ - * This file contains EDMA3 Test code.0 u7 M7 D" x' n4 S N! ^$ O
- *
( J/ c7 S% h. H% z5 t' U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! C8 V) z" n b+ R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& Q( b6 X2 l, Z! }/ Z, w - * TO CHANGE.
6 A" ~5 A% @; t9 m - */ e" T7 a+ Y! G- U3 V x0 |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 z5 X; B/ |/ T0 `
- *3 D' I2 Z* G9 R" p$ i2 [$ ^; ?9 ]
- * This program is free software; you can redistribute it and/or2 j: S, v5 n" }& k5 P8 F# D
- * modify it under the terms of the GNU General Public License as+ U, C) p4 m! ]* k5 _7 q/ n
- * published by the Free Software Foundation version 2.$ i* _8 [) `& c
- *
0 y6 d3 R, ]3 m( `: ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 P3 E+ i8 m. Q' q1 z U! d( w! o
- * kind, whether express or implied; without even the implied warranty
1 S6 k. m& Y7 d- K) Y! k+ _4 x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ L% ~2 j* q1 g. g* d
- * GNU General Public License for more details.5 m. s: ]+ M5 |& t
- */
( C6 [8 _9 C% g - ) L, I, _5 c3 K' p
- #include <linux/module.h>
2 w0 P" ]" K. S+ ~ - #include <linux/init.h>6 A- M1 u; c6 i$ L. \9 @7 E4 ?
- #include <linux/errno.h>) x3 t; w( Y g- y; n. E% e7 |
- #include <linux/types.h>0 S; I: n$ k, @$ K
- #include <linux/interrupt.h>
3 Y- e7 m; H: D" e N, o - #include <asm/io.h>3 W1 }. P8 h9 d, b
- #include <linux/moduleparam.h>
4 v8 }- G& B1 ` ~; C - #include <linux/sysctl.h> n" q6 U% N- u( B$ |
- #include <linux/mm.h>/ B1 E& ^) T" p# [/ ]; s( T' w7 b; \
- #include <linux/dma-mapping.h>
( q* t; m% n. v" m) `) B. `8 r - ( y3 f: q4 k5 m5 w
- #include <mach/memory.h>6 q6 w& Z7 d% u# w0 n
- #include <mach/hardware.h>, H7 m O* a& h+ u, H& d
- #include <mach/irqs.h>
8 f+ e& {! O7 t8 z* s" V - #include <asm/hardware/edma.h>
$ b8 O. A$ \% H- r% i9 \
. k x3 S3 Q8 F0 l- #undef EDMA3_DEBUG
* t0 ~. i' M2 p - /*#define EDMA3_DEBUG*/- @7 W" C9 i3 C& r# ~8 u
- 6 u4 c" ?2 A R3 x
- #ifdef EDMA3_DEBUG
" D1 ?' f4 l/ P2 W5 } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 ^( h# z3 _; H* c, O3 [8 O+ J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): A+ H9 R6 f+ ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 M9 S3 J! l. W8 |, \+ l% Y3 { - #else
" z2 z- \7 i4 I% X J2 W - #define DMA_PRINTK( x... )0 v- k9 H: P1 K7 c
- #define DMA_FN_IN
# q9 B/ n$ {' Q: R5 l - #define DMA_FN_OUT$ A) G% z5 t# F& K/ k p
- #endif
5 z! V4 X9 m+ R m! K5 C: n4 Z- c
( y& F: V4 ^7 s2 ?% Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ M* U. j% d% F; ^6 i
- #define STATIC_SHIFT 3* f4 t3 l r+ h3 T8 ~4 @9 ]7 g+ R( {! }
- #define TCINTEN_SHIFT 20+ z3 E# E( U: b. R% K( B
- #define ITCINTEN_SHIFT 21+ }5 P$ D1 R Z |' m# Z
- #define TCCHEN_SHIFT 22( c" X1 n" O! \* x0 e
- #define ITCCHEN_SHIFT 23
* X0 F \6 q( t) V! U$ q
/ ], {! i, r8 R+ Y5 }7 b$ r- static volatile int irqraised1 = 0;, U0 D3 ]7 w4 }$ u2 I5 i0 g
- static volatile int irqraised2 = 0;
7 p Y2 V l0 y/ }: Z( ~& A" E0 l
: p) ?) Q# `% c) v8 y9 H2 T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: t* F' |: O/ h+ F. \: m, I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' C2 [) ?5 ^+ c# B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; e' l" G* K( S5 s$ U6 A* ^ - : Z3 k, r# m! _1 Z8 J
- dma_addr_t dmaphyssrc1 = 0;
. S$ e5 s+ N5 X# r$ [ - dma_addr_t dmaphyssrc2 = 0;
: X: i/ j! K4 H2 P5 u - dma_addr_t dmaphysdest1 = 0;
9 r0 [7 S" H6 @6 { - dma_addr_t dmaphysdest2 = 0;
( R+ l0 j$ j J) ?( K - ) H9 p8 i0 N4 V! _: N r- ]
- char *dmabufsrc1 = NULL;
) p- b/ s7 o/ @ - char *dmabufsrc2 = NULL;; ` X4 e- Q. e$ I/ i% A
- char *dmabufdest1 = NULL;7 R2 _' a; v5 T* d) P# u$ w3 F. N- O
- char *dmabufdest2 = NULL;9 a3 w/ H+ W5 M: r- K5 w, ?' h
7 |2 S" }( Z9 t* r- static int acnt = 512;
; S0 ]) P( J- K4 [; R! B9 O - static int bcnt = 8;
+ S# ]0 ?, ]2 m/ j4 M' ~9 a2 J - static int ccnt = 8;+ A2 |9 q7 h1 u5 X
- : _* r; S3 m2 O: l ~0 {
- module_param(acnt, int, S_IRUGO);7 J4 C* ?, O' q
- module_param(bcnt, int, S_IRUGO);+ s+ |5 T3 K8 y- |* i
- module_param(ccnt, int, S_IRUGO);
复制代码
# r" M& y" l9 \ H9 ]0 E5 J! x! V2 {$ ]5 i0 X+ e: O( j8 @3 u, t) s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! D1 ~) p# V1 K7 C& y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) [% y& ]7 v- p6 T0 X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! p$ X2 ?3 m- ]. s& P
/ I# E3 S7 q5 I) F- I( |4 u
6 J# q5 j" n% ^( G a |
|