|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 k$ z( y& y8 N: Z- [code]EDMA sample test application6 n- K) V: K+ M
- /*
" m" E. ^6 X; i; p y, F! B' P8 F - * edma_test.c
) d) f) s6 \* u; {; j% S9 N" ? - *) }4 n9 C) `1 i* y2 X+ ~6 y
- * brief EDMA3 Test Application1 ^8 v& y" u1 q! u0 k) ?. o
- *$ L6 u* @/ ?0 L# x/ g. x
- * This file contains EDMA3 Test code.
! D2 H; m" J/ }5 v0 \7 N. p' P - *
) v4 Y8 \$ {$ T( _1 X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 f$ H: V+ D! Z7 T$ ]( r* R/ M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; a: {2 w0 Z" j( ^8 e" P8 f; }6 p - * TO CHANGE. p3 Y& T5 i/ Q4 a3 m' r
- *- e5 V: I! s) A5 x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# p3 q" s2 u! B! S
- *
% l9 T3 M; T8 I& w5 A( q7 H- Q% ^# D - * This program is free software; you can redistribute it and/or8 J3 o- u# Q7 P5 J; d. ^& u
- * modify it under the terms of the GNU General Public License as
/ x7 d' O* o8 ~1 {) T9 O" ?) T - * published by the Free Software Foundation version 2.
# o+ m4 D0 V2 d8 R: f2 p7 t - *+ G" r& e0 |3 }. G' [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 o2 _' d1 m2 ]" Q }2 K5 [- Q! M" Q - * kind, whether express or implied; without even the implied warranty" [/ e1 b* | u. Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 H" b8 y" L8 s: t
- * GNU General Public License for more details.0 Z- @/ x) k: s
- */
! J2 P8 l: D( c# W* v/ b1 P
, I% G, |+ j8 A% x# B1 }- #include <linux/module.h>) y; q% j5 B2 J M1 A; t
- #include <linux/init.h>1 L, V; ^4 M4 K
- #include <linux/errno.h>1 m& D! e7 s! C7 A+ D6 c
- #include <linux/types.h>0 N' ~- S2 c; _ \5 a
- #include <linux/interrupt.h>
$ U; N1 w; [3 i - #include <asm/io.h>0 m' _5 l" P7 \/ l7 o# s
- #include <linux/moduleparam.h>0 n# w ^$ a1 m" z2 u
- #include <linux/sysctl.h>/ ]1 C2 a$ k5 F! X2 y# T6 c
- #include <linux/mm.h>
2 d8 L4 f) J. v! a$ }. Y& F3 W - #include <linux/dma-mapping.h>9 U# B4 q3 t0 y$ A2 a5 q& r! r7 \
9 M0 u! @- ]) F+ @3 s- #include <mach/memory.h>
% J4 `8 T) S) m0 E2 s; U - #include <mach/hardware.h>1 h/ T# \6 \7 Z; A2 e9 |
- #include <mach/irqs.h>: U% t3 S2 \3 \* J4 T
- #include <asm/hardware/edma.h>
1 U+ D; [% c$ X/ U, X
; _2 x% C. W# ]) I9 M- #undef EDMA3_DEBUG
/ \% I3 s0 c: K: A - /*#define EDMA3_DEBUG*/
3 `# W. f( O( a7 }7 y$ ?: J - % N+ P) T" m2 b2 U
- #ifdef EDMA3_DEBUG3 J9 f9 D O2 I/ m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): ^$ p1 K, N8 s& H( K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. l @5 m( L0 _" I: K% a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# E- w+ ~% V9 N
- #else
0 z, e2 h9 i) B1 p - #define DMA_PRINTK( x... )( ~! p* z/ @* Z4 l& D) U
- #define DMA_FN_IN, `1 n: _+ G8 S6 d& i0 W2 E4 v" X6 |2 g
- #define DMA_FN_OUT
. f9 n2 L- H) N( V) _ - #endif! r/ B" e- M5 M- o8 G7 N
6 V: g# u9 }2 b# _6 d4 [" W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' y, \% N& G+ s4 @1 Y$ }
- #define STATIC_SHIFT 3
* }- ~1 f& g( Y4 \+ y - #define TCINTEN_SHIFT 200 d2 ]- h" V) w: I! Q& T
- #define ITCINTEN_SHIFT 21. m. `) u2 ?+ K" W# Z
- #define TCCHEN_SHIFT 226 y. m% }' `$ {, H
- #define ITCCHEN_SHIFT 23
6 N% {) S L7 \3 U. B/ m - ( h) G6 j j* M' r3 M2 d
- static volatile int irqraised1 = 0;7 E7 r1 ~/ D! _8 y5 e M
- static volatile int irqraised2 = 0;
! S& R# _, J. E: E
! O9 T+ Q- h' Q. Y+ e$ ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: \/ E2 G% P# ~, e2 Y& T5 N U& ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! h( M3 l& O' M3 Q2 N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. ]9 K2 |: X" e7 ~- j1 t& Y$ h - 9 m2 ]( L; Q! O* @2 F. B
- dma_addr_t dmaphyssrc1 = 0;
3 @2 e, Y* D# w: E' X - dma_addr_t dmaphyssrc2 = 0;: _' e1 J5 p' h- L" n& |# Z9 b
- dma_addr_t dmaphysdest1 = 0;+ }& E+ x$ A1 v' m1 _2 ~
- dma_addr_t dmaphysdest2 = 0;1 O$ V- i% ] E/ k$ p6 [. i
- % t0 u5 _( {* P' F
- char *dmabufsrc1 = NULL;
S5 q+ d1 [. f( Q* F8 Y - char *dmabufsrc2 = NULL;
5 e2 B$ P/ b4 Z; ~, U) w$ o! ? - char *dmabufdest1 = NULL;
) b' w+ Y2 M3 R - char *dmabufdest2 = NULL;
7 g$ }9 W( K2 L& x& Q' R
L/ X7 D, f. C9 \2 m0 X, i- static int acnt = 512;
' C! e# m9 w9 k, I1 p& H7 V- V - static int bcnt = 8;
8 S# W3 S& e9 h - static int ccnt = 8;
$ h5 V S' U" D. @% }- Y( k1 B+ M - % T, }: ~5 }3 J' w1 s8 D
- module_param(acnt, int, S_IRUGO);3 \$ ]9 \4 a- S! m, d
- module_param(bcnt, int, S_IRUGO);) R# E4 B2 R0 f Q9 n$ v6 r& s
- module_param(ccnt, int, S_IRUGO);
复制代码
% N0 s$ t" Q+ I8 Y2 |& F7 \. A, X0 P* T/ {* h- a* ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, G! M. M! ]3 O# t/ barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 z y3 P7 `" x& V* L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" `) h* g6 z. h; _- }; Z$ w4 k% R( y/ {! @! M( b
; k2 L3 q( N' k' D* y& _1 @9 M: ~4 U |
|