|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % M8 f: Q( c& x0 f
- [code]EDMA sample test application# v Z5 B% o, E8 v9 k |$ z* k
- /*
) r1 |, W5 [ K" B i - * edma_test.c. A) y, a t3 M" @5 k* X
- *
: s( [! N' q, I7 c5 j - * brief EDMA3 Test Application0 G- }( c3 o5 v6 m+ C+ l
- *
; Q* A% o! G4 \, J9 Z9 b - * This file contains EDMA3 Test code.$ n2 R# b: e% K# E% ^6 I% w
- *& d2 V2 f+ ]2 ?) z% e, b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 n, P, x! ]$ t7 |3 Z# R- _) n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: ]7 H! N9 ^% V/ o _2 Q7 A
- * TO CHANGE.
' r( b; r: K) Q9 \! _/ J - *
# c: N1 m" {* Y4 V$ O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. U; Y( I. O9 g( }+ G
- *" ^4 a% I4 l' `: j8 b. j+ E
- * This program is free software; you can redistribute it and/or
' M5 u( c: E( L$ O' E& G# d9 Q4 z - * modify it under the terms of the GNU General Public License as) t+ D/ q% \0 Z5 ?2 g
- * published by the Free Software Foundation version 2.
9 A& m9 ~) U6 |' _ - *( H# z1 C) I" X6 {0 `6 A/ Z$ h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- \ _) J/ p+ `; X: @
- * kind, whether express or implied; without even the implied warranty O8 J* L/ j2 m8 t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ R# U* m( L- n- d K9 q
- * GNU General Public License for more details.7 O* C" R% \: @2 b2 ^
- */
4 p* _2 {$ Q* @/ ^7 F2 t* [, s9 p
3 H) n/ L8 O. n4 d+ @- #include <linux/module.h>
0 q$ x3 @; F f1 \ i+ X: k/ A - #include <linux/init.h>
8 L9 i4 Z7 Z1 b2 n8 g - #include <linux/errno.h>( W y- H+ R! b5 Q% X
- #include <linux/types.h>
& U- G5 v; b+ |3 V6 j - #include <linux/interrupt.h>: w; b& n" [7 s- ^) o
- #include <asm/io.h>
5 G5 V6 Y7 N) ]9 u* i3 X - #include <linux/moduleparam.h>& q1 n4 R3 e' J7 |1 V
- #include <linux/sysctl.h>. w4 P* w( v8 y' u+ s* \; s) X6 j
- #include <linux/mm.h>& ^- m( w/ Q3 T! a8 ^
- #include <linux/dma-mapping.h>
1 E5 ^: o' U( S# d
2 s1 N. f2 v2 o" _5 w0 s- #include <mach/memory.h>
; \9 i# P* j5 d3 v# h - #include <mach/hardware.h> u0 D( _2 }6 G- P7 m4 a% l# Q
- #include <mach/irqs.h>) T! T6 _) E% ^3 J* g/ Z5 S
- #include <asm/hardware/edma.h>
. {" N$ p d7 w# B
* m' w6 Y; y% R: c/ p- #undef EDMA3_DEBUG9 {8 a' J P8 x6 ?0 j- ^$ x
- /*#define EDMA3_DEBUG*/
9 h, E2 A" J: `: M
. z4 Z: Y3 Q) q- #ifdef EDMA3_DEBUG9 m* N3 V& K9 a! h; X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* `9 {$ G6 B" Y- I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: ?% @% V& x% |' [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* [6 Z- X! }% r& |
- #else) ?& p9 }! `% D. X& K
- #define DMA_PRINTK( x... )
; X/ x% z6 n' W6 n. O - #define DMA_FN_IN
, z) t2 b: r; k$ t4 w& g0 w! H - #define DMA_FN_OUT
7 j% R% Q* c2 i) q* e - #endif
' F( d4 E& I/ t - : h2 E& K5 @9 ^ G+ ~; e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 \/ C+ g3 J8 z' S/ s" a& k
- #define STATIC_SHIFT 3' w/ x! b% C( U9 j/ R! p
- #define TCINTEN_SHIFT 20; _3 N: U; U+ c
- #define ITCINTEN_SHIFT 213 Q" L) I0 N2 o: [' [5 p3 e
- #define TCCHEN_SHIFT 22& _+ T/ x p; o6 s# v/ L
- #define ITCCHEN_SHIFT 23
7 n. l6 y6 @' y8 H8 l
1 v5 t4 C1 @3 M$ T- static volatile int irqraised1 = 0;
! d/ B* l0 U! K- @: d) C3 j. ~ - static volatile int irqraised2 = 0;) N$ I7 J3 t' ~; I ~
- + u9 X# T# i I x# X" n( d f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' @1 [1 m1 C5 j7 c3 y" S, i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ M1 d) F/ k3 S; N! c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ }7 I' J. }% C' v- s! E6 n% W7 u
. s0 R+ N7 l5 e' t3 \+ ^# r- dma_addr_t dmaphyssrc1 = 0;
( @: e7 _% i3 @ p1 @4 e3 h& W - dma_addr_t dmaphyssrc2 = 0;3 _5 o2 o4 {# [9 ]2 v
- dma_addr_t dmaphysdest1 = 0;
1 Y1 @- b' J# M- l s/ m - dma_addr_t dmaphysdest2 = 0;% }; O1 h* L- r# E( ?2 M
o( f9 P- j4 J& `) _9 ]+ b2 k- char *dmabufsrc1 = NULL;& g" I3 E$ X& {" q7 W1 G: G8 Q
- char *dmabufsrc2 = NULL;
n+ a: z! S8 i - char *dmabufdest1 = NULL;( ?" {/ S" K) A5 _$ f
- char *dmabufdest2 = NULL;- ?) I2 k# w9 D( L0 B# ]
- 3 ?; s7 J: J3 Q2 ]1 H8 o- B
- static int acnt = 512;
0 F/ U g, }( `' i! G; \2 e+ ^ - static int bcnt = 8;4 `. w w. C! M, d& k' Y7 i
- static int ccnt = 8;" H" q' |1 q5 \# Y
! A- B1 ]$ `5 U/ J, j4 R2 `" w- module_param(acnt, int, S_IRUGO);8 d1 L2 H; a0 ~, F
- module_param(bcnt, int, S_IRUGO);1 ]& N& }/ ]6 p/ Y' Z
- module_param(ccnt, int, S_IRUGO);
复制代码 8 _; ~8 I/ D. d( J
9 Z' D+ r* w, d1 |$ t9 y. } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ d, ~/ Q0 [- v4 z, j+ jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! t+ \ C" F$ d8 n1 U3 [9 b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 n) {5 G+ j0 I; T1 {, `+ |7 g
7 X2 `! l! b, l" f, `& U
7 |6 b5 L& Y [0 X, A* h( G5 l; }# w0 }; w4 U |
|