|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + V }0 v2 @: z/ q% z
- [code]EDMA sample test application
" @ l u+ ?3 e' `1 Q - /*
" F8 c% g/ @* Z6 |/ K - * edma_test.c2 J0 J W7 O. k0 z/ X# _* ^) A
- *
; R) z2 @' P8 v - * brief EDMA3 Test Application
; k3 A, X$ R1 ^" r# y$ B - *
* j. G# s2 @) v! v0 k5 U - * This file contains EDMA3 Test code.9 V6 D+ O* V- Y' ?. G
- *
7 D" P* N2 c8 U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' |% E$ ^) @7 @$ O1 {! R, G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 r$ r1 F' u- x/ O- F
- * TO CHANGE.
/ e! F' C' Z7 Z6 x& b+ H: Z- _ - *
& U4 N8 ~5 A% o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" w& m* I: V6 F$ H# V
- *
% _7 |. B) I6 s! }$ T - * This program is free software; you can redistribute it and/or: H* M# h' }3 z) g) R) R
- * modify it under the terms of the GNU General Public License as3 U: Z0 N1 i: U. `* l$ Y: i
- * published by the Free Software Foundation version 2.
! f& {7 O" @% S; Q8 M - *
$ m0 x" |4 D3 ]& g H9 {$ v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# ?1 I7 G4 u7 c
- * kind, whether express or implied; without even the implied warranty
* |+ k0 n8 y) }" t5 v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. V. n5 r6 V+ s - * GNU General Public License for more details." L$ v: B; H" ^) x9 y) d4 m" ]
- */ W+ b/ S' b- R/ Y: J7 f9 W
- 3 l/ g' r$ P/ T2 Y+ @" p! @$ \
- #include <linux/module.h>
% o' R+ k' C4 B/ z5 R' Y - #include <linux/init.h>
4 ?% {" I/ R; n8 r) _) a - #include <linux/errno.h>; h( u0 g$ u( s5 K$ i+ E9 }
- #include <linux/types.h>' O' z/ z5 k* t( t
- #include <linux/interrupt.h>5 ]( U4 V* j5 I( ~4 q
- #include <asm/io.h>. j2 F: V0 k5 |" w$ j4 r+ e2 ?
- #include <linux/moduleparam.h>
, J7 z% w9 N# O' @% o! G6 q/ L - #include <linux/sysctl.h>
( C, B1 D/ }: H0 i - #include <linux/mm.h>
- E: ~, a h" m - #include <linux/dma-mapping.h>
8 H0 t( T- f6 y5 @# \$ F
& [: w8 O9 n) C1 Y3 w0 {- #include <mach/memory.h>
( Q3 w+ ]1 D* W7 p: k$ O$ B - #include <mach/hardware.h>: { i/ W) e, R8 j3 x; Y) A
- #include <mach/irqs.h>
2 \' N) I2 `3 l0 Q" z+ c - #include <asm/hardware/edma.h>
3 A; X' B' u5 i( L/ Y
4 `- R; d0 G9 |5 a V+ U1 }, L- #undef EDMA3_DEBUG0 o8 F8 ?* L m- I4 b
- /*#define EDMA3_DEBUG*/
( P1 c. d6 J9 R% U7 R
0 R1 q! e! E$ D- #ifdef EDMA3_DEBUG" W% J% v6 z+ L6 |- u0 t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 M% A5 p l" n: O( M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ O( _( V: Q& [& F {+ @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
y, V) H; s U - #else5 }. ]0 K( @& l
- #define DMA_PRINTK( x... )
$ w, r1 ?2 e' ^% K( o$ B1 } - #define DMA_FN_IN
+ O+ o8 c- f- d7 U( x - #define DMA_FN_OUT
; r$ r' Q6 n) O: x. O9 j, E - #endif2 y2 Q4 N. I, T m
$ p( p a9 ]( a1 |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 e/ A y! Z1 w
- #define STATIC_SHIFT 3
2 I/ ]+ \1 c& m. ^1 T3 V - #define TCINTEN_SHIFT 20
* \1 |. {" A( b& `$ L0 Q) z0 A* Z - #define ITCINTEN_SHIFT 21
# L: ^7 ]! Y( Z5 d1 z5 n- d - #define TCCHEN_SHIFT 229 K) u9 t+ K( J$ L, \1 d
- #define ITCCHEN_SHIFT 23
$ g* Q" z' B/ D+ e, u' ~3 @3 e
% {( @7 t1 s! ^- static volatile int irqraised1 = 0;- c/ ` g# `$ y
- static volatile int irqraised2 = 0;
. L0 r' h7 t. W! L3 `* ?
- U* z1 w- g6 c( s# x' |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' p- V0 `9 m1 Y* I; Q8 I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 {2 ]9 a$ M3 { m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 w0 o) k& e0 \
- 0 \* o7 D: ?0 V6 B( V0 ~3 D! a M- O
- dma_addr_t dmaphyssrc1 = 0;6 q! _) ]- i9 R; c) S6 ], ~' l
- dma_addr_t dmaphyssrc2 = 0;
" J$ l) y9 G: h5 O! } - dma_addr_t dmaphysdest1 = 0;5 f3 F/ O7 K8 u0 i# p
- dma_addr_t dmaphysdest2 = 0;* _ L2 l7 _6 S; @
! x6 L2 J7 u2 l* M- char *dmabufsrc1 = NULL;% p. g: G" d! ^$ F' E& G( f
- char *dmabufsrc2 = NULL;4 G, [9 Z: u7 |. Q1 D1 u& _
- char *dmabufdest1 = NULL;
4 I. |: q x4 c - char *dmabufdest2 = NULL;
. w0 R' Q4 u5 K3 Y7 V7 \ - 4 u- x4 f3 Y- V* U; S6 O) J) Z
- static int acnt = 512;
3 |' h8 h% ]9 r& ]6 T - static int bcnt = 8;
e0 v7 u. x& S2 q. N5 N! V - static int ccnt = 8;" D G$ m2 M# F( p9 ] g3 Z. s
- " d9 a( m7 Y d/ d7 [6 w2 J) I4 ` k5 P
- module_param(acnt, int, S_IRUGO);4 x; S: i# S; A8 `. Y
- module_param(bcnt, int, S_IRUGO);: J) Y3 S7 _7 P2 n* D- |! F
- module_param(ccnt, int, S_IRUGO);
复制代码 1 P( l, z5 z- b& \5 D$ L' `; }! s# Z
2 |5 H; H' }8 p3 L: ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( t9 S/ ~" Q/ ]/ P# x* t x0 oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" U7 I6 l3 z, J" ] m1 f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& g2 u* d5 ~9 N: X: n" q2 i8 o
& B7 L& G& b, r# F: ]2 T3 q- F5 s/ c1 j( A: s8 N3 ?
|
|