|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 G, m( A ~2 u3 H- D7 p- [code]EDMA sample test application% |0 u$ ]4 _; P2 Q
- /*6 D* `" ]- j/ T7 _' U
- * edma_test.c
# x% q! y5 r; l: P - *4 N! u1 X+ L/ `* Z
- * brief EDMA3 Test Application
( z9 b; K7 q6 v( o, N - *$ K4 ?6 U/ T( F7 I4 [ m* a0 t. O
- * This file contains EDMA3 Test code.
. J' }' N$ x5 h! R5 o2 H - *
Z/ O N' Q) }: f0 `% u7 u: x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ K& L! G2 N! A3 S* G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# S$ P+ A) f. |/ }4 B1 a, @ - * TO CHANGE.9 R; Z+ y$ q9 l/ \
- *! M6 @! t0 a. ?% `/ D* N/ R3 q6 Y( P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 r H4 I4 w+ F x+ y - *+ m4 X5 N6 ^- \2 o, p' ] T; h+ g
- * This program is free software; you can redistribute it and/or
# y+ ^# f# o5 h" q. U: z, {7 K3 T* s - * modify it under the terms of the GNU General Public License as
2 @' c( Y0 t! U" ~; J# w - * published by the Free Software Foundation version 2.
) ]; s! V% j9 l. h- I/ H; Q - *
# r4 B C4 Q# N. F2 K: ] L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& |: \+ G7 W: I2 s R+ _3 \' x - * kind, whether express or implied; without even the implied warranty6 h" O5 Y5 G7 Z1 D( i, ^, n2 J# g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the N2 _2 f$ x" Q( J4 \4 m
- * GNU General Public License for more details.
: ]6 g, W ` x. n' I' |8 h, p& u - */
: V/ M8 l! V$ N$ G - 8 ?# b0 U& C3 ]5 Y/ ?2 l
- #include <linux/module.h>5 i1 |, t; v) e* @
- #include <linux/init.h>0 {6 z/ m3 H) U+ Q6 G3 L! M
- #include <linux/errno.h>
+ M/ v. I F1 ?; L - #include <linux/types.h>
) b1 Q! \7 [( h7 K; c1 B W - #include <linux/interrupt.h>
) H% ?* V; E& W3 k) i( E3 c- u - #include <asm/io.h>* p1 ~" X) P3 V' x! O$ u' S
- #include <linux/moduleparam.h>
' L" }" E" }0 F4 v# L- t4 s3 _ - #include <linux/sysctl.h>
4 |, j a1 `& d$ Z/ @# t, P0 w1 Z8 X - #include <linux/mm.h>" g0 D9 a. c/ e2 l3 m% S
- #include <linux/dma-mapping.h>
+ ?- ~$ d, Y: u- q4 Q/ e: y
" [% J2 `; n1 v/ g% F) e6 @3 i- #include <mach/memory.h>. N& V) b9 h. }% v$ F" ^2 z) P
- #include <mach/hardware.h>9 j4 `1 D! `% W7 E6 r
- #include <mach/irqs.h>
9 g' q7 Y3 h, S! j9 ~* w - #include <asm/hardware/edma.h>
5 ?9 t+ o; H4 N6 X0 [: H! S9 X - l+ V1 C0 |! X4 H5 m% c
- #undef EDMA3_DEBUG7 m/ c. N) F% O
- /*#define EDMA3_DEBUG*/
. `4 U& E1 O- ^1 ]& S6 S
, A* _/ t+ `# Q+ O- #ifdef EDMA3_DEBUG
; Y* o5 _. A' z9 |/ {7 s. v7 @0 E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# U! a; G9 \& ^7 R* w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 @0 ]7 \8 j' v( O* l& l, [5 h" @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: p# c1 k U7 l( C$ A( H3 F! D' P# ~ - #else/ Z9 t( g+ ^2 A, U/ S8 s
- #define DMA_PRINTK( x... )7 Q# D& S4 `7 s
- #define DMA_FN_IN. w' J& m5 p* Z; w, }: P
- #define DMA_FN_OUT
2 i+ C( K3 }; x9 n+ K& r - #endif
: y( K$ t$ A: w& w; x
7 Z+ t& z6 C" n% x1 V" _# G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& f; |& [* Q$ v( N# D ?
- #define STATIC_SHIFT 3
4 w6 Q* Y/ P; O% k - #define TCINTEN_SHIFT 20' m- l0 O- i) N. H2 n8 j+ q
- #define ITCINTEN_SHIFT 217 a, @ F: E7 A# l" ~& B
- #define TCCHEN_SHIFT 22" K0 p! o; d1 O- m, E: K) K: T4 T
- #define ITCCHEN_SHIFT 23
[. N7 y; j* \, P; R* m/ f+ c
1 ?$ E5 l% o) W/ c# ]" J9 B, I6 u- static volatile int irqraised1 = 0;
S( z5 H# ~- a. }" E - static volatile int irqraised2 = 0;
5 d4 J |) U) K0 ]$ k4 r% o& G3 ^ - 4 ^4 p4 {5 X. ]9 _8 R! ?0 M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' W$ D" V/ m: Q3 W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. S0 v, l: }; W$ a) c1 q4 o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: r B, X. _2 Y/ d3 i
, y% V0 L. K0 ~- dma_addr_t dmaphyssrc1 = 0;
6 ~ w2 c I0 v- X0 K+ m( O - dma_addr_t dmaphyssrc2 = 0;
% z6 L* Q4 `" P# g% a& ? - dma_addr_t dmaphysdest1 = 0;5 |9 }4 k e: G. k/ w1 p! H
- dma_addr_t dmaphysdest2 = 0;
4 m' O1 y0 ]3 P6 a - 2 S5 E8 |: O4 j1 D* ~
- char *dmabufsrc1 = NULL;# b- S6 [2 f% n+ e; m' H$ f
- char *dmabufsrc2 = NULL;
% H" O S8 T7 a$ s* o) g/ T6 v% \ - char *dmabufdest1 = NULL;
3 y5 X& O! [ f2 J9 w8 M8 _5 R* I - char *dmabufdest2 = NULL;" d; i3 F# x/ v2 M
- ( e2 K# q M8 a7 J7 k: H9 p
- static int acnt = 512;" J! Z5 O8 C; r# D; l! l
- static int bcnt = 8;
0 \4 x) r' \; F2 ^; s' k - static int ccnt = 8;) W, b# W2 d4 h/ Y/ [0 ^) P
- ! n; e* H8 C5 s2 V- h
- module_param(acnt, int, S_IRUGO);
5 n6 O: T4 Z4 m( ]+ B - module_param(bcnt, int, S_IRUGO);) b, y2 c+ U6 K
- module_param(ccnt, int, S_IRUGO);
复制代码
2 X! W; d9 W0 f/ j- X, D- I* g5 j7 A+ ~ S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- W/ O+ u8 q. m/ T$ J3 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! h: j0 r" F1 U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 q* b2 X/ Q) |( y6 A
5 F4 P2 t7 q1 }2 c/ c+ D Y, X k7 ~2 B! T/ b7 }$ ^& k
|
|