|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 {" ]+ }0 d# @
- [code]EDMA sample test application! f! R( B# b" p9 C4 ?+ k" B* ^
- /*$ T' [. v5 {; M/ S3 @, i
- * edma_test.c3 S, L- E; d9 W# ]
- *# Z9 M K' C! ]: T6 P) p/ ?
- * brief EDMA3 Test Application
y" ]: s" d0 ^- y. b/ T" P - *
4 ]# D' e( A; z% t8 S0 Y - * This file contains EDMA3 Test code.) S1 _- N$ p( Z
- *: K" x1 d" h- x* F: s3 H1 R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. b: E, g4 U; M! U" b. s% {; W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- x. o+ A/ H5 O5 c* j% J
- * TO CHANGE.
' E( h4 l! K& [* _, Q! V( ] - *
! x# A9 J+ v2 i* M- u! s8 @- w/ r8 t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! |: `# w* H0 K- E2 w; p" C/ s; o
- *6 |# }' r0 p1 }- P m6 _0 K
- * This program is free software; you can redistribute it and/or0 ?5 J" U i& C* L
- * modify it under the terms of the GNU General Public License as
- `# Q# r7 k, d - * published by the Free Software Foundation version 2.
% D* H: E* b+ F* ` - ** c+ H9 w- z" d( S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# c+ r$ f/ P# J5 C/ L: h+ i
- * kind, whether express or implied; without even the implied warranty7 a# z$ {6 P/ W+ t+ X" ^6 r+ s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 S N" |2 x* ^0 C7 m- K1 f7 A7 ~& e9 s
- * GNU General Public License for more details.
8 }9 i+ w% i0 }2 S - */
$ G0 x4 Q& Y! f9 S - ; \ x5 w8 w" J- o+ r
- #include <linux/module.h> F; B) M! q1 H2 r7 O9 W- s
- #include <linux/init.h>
* d! j& Z6 l5 D7 I# z: o - #include <linux/errno.h>
! T9 R1 q, P7 K$ M - #include <linux/types.h> Z" I. b; G3 T, Y& c. ? a8 v
- #include <linux/interrupt.h>
' E2 w" C3 ~1 g) m) t$ M - #include <asm/io.h>
& o5 w" d& ]9 k; P1 n. e- ^, {! P - #include <linux/moduleparam.h>" c: k3 y- Y! F3 V9 M2 M
- #include <linux/sysctl.h>- } s" U& t! X- \
- #include <linux/mm.h>& h0 i+ i3 [% z- Q \
- #include <linux/dma-mapping.h>8 R3 [6 y: W: `8 o# K$ y
- 0 c' h$ {" g9 f% q q- W1 U8 z
- #include <mach/memory.h>+ h8 U% l( J" ~3 r; d3 M( _
- #include <mach/hardware.h>
' q' g* x( r; V" l. w4 n - #include <mach/irqs.h>
# g" p* _# c/ z8 n: }2 L7 u - #include <asm/hardware/edma.h>: U$ \& p) P5 s; Y
; i! u! b. E0 X& K( r) w+ s3 V- #undef EDMA3_DEBUG5 a. v6 |5 m4 F# }+ i/ [9 G
- /*#define EDMA3_DEBUG*/
; g, u1 I1 n0 U9 e
+ j: i- O/ z+ c }- #ifdef EDMA3_DEBUG; X; ], a3 t" }, |& Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 J0 O* o* n$ s8 F7 Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' d& {8 @) r3 Y; [* v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 |; K6 T K# w! M* @& E) s - #else/ Q9 X; t8 l: Z6 y, V* ~+ O
- #define DMA_PRINTK( x... ): S$ v' c/ b: n1 `2 f8 b
- #define DMA_FN_IN
6 m; O0 t5 R+ H+ g# [ - #define DMA_FN_OUT
9 F3 F0 q9 l7 f8 ^& R4 Q9 x - #endif, E W9 ?& r4 L# f+ y1 `6 c& O
- 5 {# A+ r9 h# V! o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ {1 f8 p2 G8 E+ c1 J - #define STATIC_SHIFT 3" Y3 [ E9 c/ w9 S7 g
- #define TCINTEN_SHIFT 20
" N* F2 O$ k8 Q2 s1 S; S - #define ITCINTEN_SHIFT 215 |0 Q E) Z& Q
- #define TCCHEN_SHIFT 22
) D3 W( L+ B6 m( t* F - #define ITCCHEN_SHIFT 23) R6 R0 Y- q" `$ x
- 2 V0 `% h3 t9 p8 d3 q6 y
- static volatile int irqraised1 = 0;2 E3 ~: V- e0 c2 g: d* g; d( I
- static volatile int irqraised2 = 0;
) t$ `* E$ d; c2 B9 t1 v - ; f" ^' s! H. `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 y2 \* x$ [% k% g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 X& U: i) Q. K4 r% p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& B0 O6 d/ h4 F3 z! d9 S
4 N$ u, _" d+ T9 B, J8 j. ^- dma_addr_t dmaphyssrc1 = 0;
9 M! Y' m+ y' z7 S0 f - dma_addr_t dmaphyssrc2 = 0;" F8 z1 x1 F/ m; k7 ]
- dma_addr_t dmaphysdest1 = 0;$ h# w9 U% ^5 I! m
- dma_addr_t dmaphysdest2 = 0;
- l* n+ i" c1 t# r) Q4 e: W6 M
, B+ G/ n9 ~" s9 O, Z6 i, T+ n d- char *dmabufsrc1 = NULL;
- x3 O8 D9 {4 } {/ R - char *dmabufsrc2 = NULL;
( O$ ?1 v0 d, \ - char *dmabufdest1 = NULL;
$ K* \, |. y' M - char *dmabufdest2 = NULL;
1 Y- Y; G6 r! F, C* _" p" c
) M0 t$ n* `& C/ D. t& l- static int acnt = 512;3 i$ p4 n! H3 ~4 \) o
- static int bcnt = 8;
$ g' W; ~- O! S v' \ - static int ccnt = 8;
' Q0 E# t5 R" T- Z$ l - 5 R! y5 S" w, M* Z# q
- module_param(acnt, int, S_IRUGO);8 M" u" P5 y( @# E, g4 w
- module_param(bcnt, int, S_IRUGO);
$ {9 ]. d+ q: J - module_param(ccnt, int, S_IRUGO);
复制代码
# b1 g1 x, ?5 g' o4 [& Y) N. c! `/ |; t! O! _2 v8 y3 D# Y. n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* C; s; e Z, [( t N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 H" u k& h% S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ |, h9 c1 A3 [" p
2 @. s% h4 l) d2 ?1 w. Z
9 I0 ~- @( K5 | b |
|