|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, a/ r# Z' E) x/ i! Y" @$ |2 w% e+ Z- [code]EDMA sample test application/ ^! E- H8 ~) P) {8 a
- /*
0 S4 d; K! T" q/ { - * edma_test.c
( ~; N, F; \9 r - *
7 m) d( v' O: R, t* ~9 T - * brief EDMA3 Test Application+ j. }' L( }, x/ s
- *
# j# Z d& I8 [" q* `3 Y - * This file contains EDMA3 Test code.# ?; }8 w I O2 \1 h
- *
6 J1 F! E7 b- N! ` ]6 N! D: m: y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( `; Y! |) f7 `. y/ Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" j/ w- d7 @% s( T1 A
- * TO CHANGE.& R, _$ X. d3 J/ D% n; P
- *
) S( U4 w* `) M" M6 F" U9 J+ u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 V0 e3 Q5 Q! M3 z! R X- G _
- *
' f* h \) k1 P& K - * This program is free software; you can redistribute it and/or2 |8 y# D! k1 @7 f, b- k: s
- * modify it under the terms of the GNU General Public License as
. K" T+ E% n' b3 \2 W. L p - * published by the Free Software Foundation version 2.
e2 Y1 K, Y& ?4 u: O - *
' n' c2 r A) n# A) A5 x, K4 ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" O1 p! R- i& v
- * kind, whether express or implied; without even the implied warranty
0 n/ ?8 b$ z/ g/ d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: s8 A& U; C5 d3 Z. E
- * GNU General Public License for more details." E6 `7 k4 j6 Q
- */1 d2 G& t4 m @( N, y) G( F
) c& i5 w+ |! a# l$ C- #include <linux/module.h>: X& A/ Y; A3 \* T$ g) k6 ]
- #include <linux/init.h>
/ Z6 w8 ?3 r9 m# U3 W0 K) Q. s - #include <linux/errno.h>
% v% g( J) U7 B# ~ - #include <linux/types.h>7 s7 d- Y/ ^ v% h# g' p* s1 R) X
- #include <linux/interrupt.h>
( D E, x0 t) ^8 J! g$ a - #include <asm/io.h>$ K2 c. C6 a9 e9 a7 b& ~0 t) L
- #include <linux/moduleparam.h>/ ^* j8 p! [ q% |" {. t/ l
- #include <linux/sysctl.h>, |3 I2 l1 a* f( }
- #include <linux/mm.h>
. O) a# P" A& x( @+ ? - #include <linux/dma-mapping.h>
V$ @" `: j0 i* A8 r+ ?1 w. J - - G2 T# { i8 B/ g3 B) m
- #include <mach/memory.h>9 Y" y+ a% @) V5 I
- #include <mach/hardware.h>: T: C, n5 a0 C1 T8 Z9 E
- #include <mach/irqs.h>
+ e( {: G0 `7 T; Z1 w - #include <asm/hardware/edma.h>8 K& Y2 {) Q/ P+ Z
- ! A' E# V7 ~0 }0 ^$ i% N: Z( x4 {
- #undef EDMA3_DEBUG( v" C2 e1 C: | { J0 A
- /*#define EDMA3_DEBUG*/$ ?9 d; J! w+ i# s( K
w- L# e' I6 \* s- #ifdef EDMA3_DEBUG( z$ q( X6 Y" x6 L5 s; g0 k7 T8 N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 }0 f' P: ~2 H/ ?$ h5 S) K- ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 E: S- W) V0 @2 M" ^* k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' g& _( i5 w, X9 M. a - #else8 S p4 a7 l, [6 S6 K, b
- #define DMA_PRINTK( x... ), J2 R: c6 B( e; P$ k/ \8 }0 x' l
- #define DMA_FN_IN! ]% P/ r0 z" W
- #define DMA_FN_OUT# M6 Q, z z) C+ L0 K. d" v# P& J
- #endif/ e5 B/ u; [" G- @
$ d5 q8 ?4 Z8 X" v: L& G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, C: G7 _8 h& e) w* l( Y - #define STATIC_SHIFT 38 E0 e) Z1 G$ p
- #define TCINTEN_SHIFT 20$ S- g* q, R- P; ^
- #define ITCINTEN_SHIFT 21& |, F* ^6 Z# t5 X' \
- #define TCCHEN_SHIFT 22
0 Y" O R$ ^2 y: D }: F& C | - #define ITCCHEN_SHIFT 23- x/ r! k. Q; D$ I3 x' M2 t) Y2 h% }
; K" f) d( N* B# X3 Y% h, ^- static volatile int irqraised1 = 0;- x; @# o: m2 I4 J C" O
- static volatile int irqraised2 = 0;
0 W4 Q q, Y( ]0 c9 x - " A6 x* k# N7 X. T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% A1 A" j7 H0 t/ c7 R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 `- r, D5 L( o5 ^! Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! S2 P1 H: @9 \( E' ] k# t
- 4 v8 o# z4 n5 f
- dma_addr_t dmaphyssrc1 = 0;
4 [+ ~. M7 G4 O; I0 } - dma_addr_t dmaphyssrc2 = 0;
. ?" B* F3 W: B, Z/ }+ G, f' I: i' { - dma_addr_t dmaphysdest1 = 0;9 ~' H, g% G) p
- dma_addr_t dmaphysdest2 = 0;: ?; v0 N2 ]. Y* j) _* a
Q( x3 k$ I$ M. @% |0 U- char *dmabufsrc1 = NULL;
0 [+ h+ m* O8 h% U) H) @2 @2 m8 Y - char *dmabufsrc2 = NULL;& o1 P( p% c. Z0 A/ V
- char *dmabufdest1 = NULL;# A' d9 j X6 Y
- char *dmabufdest2 = NULL;
9 L: p* N' D1 U( O# s2 [
* v$ q) W5 l5 B) g" q- static int acnt = 512;
( H4 h+ {) a# ~3 C - static int bcnt = 8;
% L5 e2 q- }# N8 |4 Q( k - static int ccnt = 8;# z P% W: m x5 @* ^8 ]: V3 A
- , c2 u" Z7 I6 M* t( a
- module_param(acnt, int, S_IRUGO);, @* e" d# U2 k+ k7 H2 a
- module_param(bcnt, int, S_IRUGO);
- B. A9 j+ n e& \* z - module_param(ccnt, int, S_IRUGO);
复制代码 8 s5 ~3 i# S; b
/ L7 q+ n' c6 s* s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% {# d/ Y' P9 M) a0 parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 ]9 G! Z) P8 |8 D! ]/ v) s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. U4 H/ o$ O e" b
, V9 s& N) P+ F( K0 B3 z9 s6 J/ p o& K2 Q5 j. T9 L) A w
|
|