|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) M, x6 _" j7 f6 s: F* d7 a) c
- [code]EDMA sample test application; t3 w; w! L5 ~* b; T# S
- /*
' \/ L- g* r3 @: @: _# H( F2 ~, i. ?7 m - * edma_test.c
: f' r' l! |" w* j* y, b - *7 g) N% j& T+ v+ U" `
- * brief EDMA3 Test Application% K% u& d: r1 \ a, n- Y
- *
' P/ C' r' A- l% c/ e2 n - * This file contains EDMA3 Test code.
, z9 J0 C+ p. a) x0 x - *
) v2 C( |* I( |% |. d, C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# x) j6 M2 u+ b9 w. w$ Y$ a7 M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. g' H: K4 s/ \ - * TO CHANGE./ E5 q) i% r2 D+ k9 ?' U3 M1 B& i3 w
- *
_9 m% `1 G, ^: f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! |- I7 K& e! T' m) i/ {! P' F3 ] - * G g7 U; z( `( Q# c$ `
- * This program is free software; you can redistribute it and/or5 m; o! t4 `8 w) m. R
- * modify it under the terms of the GNU General Public License as% b( y7 L1 Y5 m/ l t) u4 }
- * published by the Free Software Foundation version 2.; M& V& o& @/ \5 N9 w7 p+ ^2 \
- *
1 B3 x# u6 ]. ~2 w q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" \- b+ W' w7 U! X9 q$ r. G
- * kind, whether express or implied; without even the implied warranty
+ \3 |+ E2 d* r5 V- ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" C' l0 b3 r% W3 w; r p
- * GNU General Public License for more details.
6 K) i+ \8 j, d0 |: ~6 S - */1 G' d* P9 \3 @
. e- i9 B4 h. n' ]! P- #include <linux/module.h>
4 p% F9 c y$ g( E. X# H& c - #include <linux/init.h>
. q. t( w7 ?* K4 A9 _: G - #include <linux/errno.h>
' o+ ]1 `6 {+ e. u8 n" _ - #include <linux/types.h>
7 @) P# d+ w' H0 Z" k - #include <linux/interrupt.h>- Y0 I6 Z G$ E
- #include <asm/io.h>
5 C+ h8 U$ j# @* a - #include <linux/moduleparam.h>( A$ j: E; G: h- d% k
- #include <linux/sysctl.h>
( _! G/ c, Z# U, y% G2 c - #include <linux/mm.h>9 a" W2 R2 _6 u# X0 h. D& M! f
- #include <linux/dma-mapping.h>2 ]3 g& [! t+ K* C; \6 f
- y% `/ L6 w& @( Z
- #include <mach/memory.h>, L9 w$ r T; Q3 J" X
- #include <mach/hardware.h>
1 e$ w$ a4 a# Z+ M1 K: r - #include <mach/irqs.h>+ p/ H# g: F8 A" v
- #include <asm/hardware/edma.h>, n; S J! [4 @/ I
- * Z- h* E% r3 T6 w/ B% G
- #undef EDMA3_DEBUG; }. Q6 ~" R& ]9 j$ S7 u
- /*#define EDMA3_DEBUG*/
- `7 a+ `5 n' ]1 p; ^3 t
0 O' V9 w2 M# x' p- #ifdef EDMA3_DEBUG
/ X. h0 u" ]9 ]* `$ X0 L H1 |! f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& u$ u, @/ \) |/ u5 h% y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: U1 t% z \9 u' [# H2 m. w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ g i6 X' l" C( M ] - #else
, O- Z9 U4 X1 t$ I/ C/ i% n - #define DMA_PRINTK( x... )
2 A) M0 t, d; U0 B+ R) A - #define DMA_FN_IN
; l* F' V7 o9 I% I - #define DMA_FN_OUT
+ H9 \, j$ W/ j - #endif
8 {2 @ @: i! h% f/ ?# P2 R
+ P& z4 F# g& W$ X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 G/ F: b% c; J% T# P, K3 \. c! k
- #define STATIC_SHIFT 3
( o: [/ d1 [; e x3 ] - #define TCINTEN_SHIFT 20
) F, C, ^' ^: H# n2 ?* }5 b9 T - #define ITCINTEN_SHIFT 21
9 h4 E8 _1 m! t* D1 h Y - #define TCCHEN_SHIFT 22% f3 }; n% Z- P C
- #define ITCCHEN_SHIFT 23) u9 i, p2 l# F* }3 ]2 v
- - [5 O/ w- s+ B
- static volatile int irqraised1 = 0;# l6 x! t! T- F0 @
- static volatile int irqraised2 = 0;
! h" o6 A% x+ X4 a! x: e2 C - $ f' J' X0 c6 `: e, l: Z3 s$ @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& v3 x$ n* @4 m6 j. C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ~8 |1 j- m* |: v' B+ ?' O/ E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; W0 c; T+ Q: R7 P7 Z. Q
( J7 e5 [" H* Y$ e& E) f3 F- dma_addr_t dmaphyssrc1 = 0;
9 R+ N% @0 L1 Z& f - dma_addr_t dmaphyssrc2 = 0;
# S! E; R7 \: x. O, Q. q. i - dma_addr_t dmaphysdest1 = 0;' ~- W M, ^/ i% A; Z2 r* q, P' P
- dma_addr_t dmaphysdest2 = 0;0 V3 X) N( F* m
- 2 \$ X( m# o/ O+ f
- char *dmabufsrc1 = NULL;
4 v/ l: ~( P4 \$ V& H. s6 P0 {6 f3 | - char *dmabufsrc2 = NULL;, [6 O( Z3 d$ O; K; s& ^# s9 s
- char *dmabufdest1 = NULL;+ E( a" T! u4 ^( ^4 D N
- char *dmabufdest2 = NULL;
) F+ m8 Q: |6 h) Z0 T1 ~. i. ]4 ]
0 ~; T; E8 }/ M4 a- static int acnt = 512;
4 o* w: N+ B3 u7 j - static int bcnt = 8;
4 k; A [! D3 _0 Z - static int ccnt = 8;1 _+ B* |! O6 K7 \
- 5 F& Q+ W! _; [7 s. {
- module_param(acnt, int, S_IRUGO);
+ k* d/ j$ v* V( Z. N8 z - module_param(bcnt, int, S_IRUGO);4 d8 X4 F$ t! B8 l; `7 b
- module_param(ccnt, int, S_IRUGO);
复制代码
6 B* [5 ^; t# o& T: G9 |; C) F
- b. ]/ m2 g3 Y$ A2 l% R! K9 t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% v/ D* F" W# ]( x6 D; d: yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ C6 V- @; G- T" q, e# ~7 d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; }2 R0 K' k8 f2 ]+ x5 f0 P, Z: c2 x" N( k
t; f1 E) n1 b" f
|
|