|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! M; G. n4 t. d! w1 |- [code]EDMA sample test application, e) \% B4 H- k* q6 c, X, Y1 r1 T
- /*; f( r3 c/ t8 I# Z4 p/ o% h5 E
- * edma_test.c; { ?/ S9 H) e8 V8 t" l" _
- *7 Z- L2 D9 K+ G3 t
- * brief EDMA3 Test Application
5 Y( a1 ]: @- {# a+ S - *
6 J6 P. e: b8 D7 m* a - * This file contains EDMA3 Test code.% Y) z( A' ~4 Z" U2 _4 V3 C! o
- *6 J3 Q1 ]* e# S" U p+ e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ J k% u% g- f" ~! T; z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- j2 f! X- @0 X3 Q, Z, q
- * TO CHANGE.
- ~' F# r% r$ H* p* k1 i: q+ U - *8 y( r( P9 J2 B4 i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 H# k5 ]2 N, L& e$ k \$ J$ W
- *' l, A1 a3 W- w& \8 c
- * This program is free software; you can redistribute it and/or2 T, @6 j& `% u+ S7 O' E2 X7 ]+ ^. l
- * modify it under the terms of the GNU General Public License as# K3 `! ~0 `8 G; q
- * published by the Free Software Foundation version 2.
) }* N, p0 @( u) m8 P! g - *
' {1 H( u/ a2 \' j8 r6 x* G, d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 _# \0 x9 @0 e6 l - * kind, whether express or implied; without even the implied warranty7 p: {5 n9 `' C4 V, P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 _& w H& X8 R( \( V, |
- * GNU General Public License for more details.& j5 M! ~: ^, G0 G O
- */+ y* P5 ~1 m$ X
5 s6 G6 i( S) T. N. F; }$ ]- #include <linux/module.h># d) ~8 `' `; o, @1 M
- #include <linux/init.h>
% T4 R \, G8 d+ X& e% @ - #include <linux/errno.h>
: E3 s }2 [1 V6 x; Y - #include <linux/types.h># [3 t, r! n; c5 H
- #include <linux/interrupt.h>3 ~. ]! q4 f* W8 @
- #include <asm/io.h>
. J G( i: k+ I4 y - #include <linux/moduleparam.h>
1 L; m7 {) V9 e5 ^* z, F7 }8 u# U - #include <linux/sysctl.h>
+ k- H2 {2 L/ X3 K( X: W* T' j7 s - #include <linux/mm.h>
4 ?- i3 y8 i u! k - #include <linux/dma-mapping.h>
; G' k) R# n/ s% C, Q - 9 C/ h+ A8 g2 J1 U3 L
- #include <mach/memory.h> g% z1 E# ~0 M+ _
- #include <mach/hardware.h>3 H; t+ z5 P- U& q9 B; H1 [
- #include <mach/irqs.h># n# F6 |1 p" C- t4 b w
- #include <asm/hardware/edma.h>
; G q" M% D& `+ }; f7 F6 y9 J
% I& P& v& t3 d) |& F% u- #undef EDMA3_DEBUG* W; J- q$ A- V9 Q* G
- /*#define EDMA3_DEBUG*/
1 B4 J& w( {7 U/ m* k
2 u$ X! y' i% z2 O* ~- #ifdef EDMA3_DEBUG
, R4 N% V5 `3 k4 A& H" [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 X" a; y/ @5 b% g x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' @5 L& t, N( R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 d* f% f# C5 | - #else' ]1 S. A8 E; W( S" `6 D6 G+ B
- #define DMA_PRINTK( x... )
: N; Y9 F; w P% o: S) M - #define DMA_FN_IN& \" i3 n d" u: ^; M
- #define DMA_FN_OUT" S. j) p+ _3 @( B2 A
- #endif9 Q `; z X3 J5 w' z; t
- 1 w' x1 j1 e4 X9 N0 g- r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), s% A& r6 {; ~" `; n, F
- #define STATIC_SHIFT 32 d3 R% M' Z K: A9 q
- #define TCINTEN_SHIFT 20
2 ~+ h: x3 G2 e" W. W/ j6 c5 O, m - #define ITCINTEN_SHIFT 215 ~! T8 f7 l0 c; @7 E' `( N- _; ]
- #define TCCHEN_SHIFT 22
) I7 q& f# A" ^& \8 K - #define ITCCHEN_SHIFT 23
( q1 Y; s. R9 @- j( u+ Y - 8 K& \2 \6 h+ d/ x/ p) r
- static volatile int irqraised1 = 0;$ _# S: u7 U, U: d4 @4 n
- static volatile int irqraised2 = 0;
1 D; N7 `7 N2 G6 f+ D/ B( O
7 A! h) \+ Z/ ]2 Y! t" T; t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( f- O! C! n. P, q0 h0 {& p9 @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ u. u$ g% m. f+ X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Q- h9 y8 _( \
9 \: j. p3 _1 }& t& m8 E! y- dma_addr_t dmaphyssrc1 = 0;
' C' e R0 m f; g8 M- ?& r; A - dma_addr_t dmaphyssrc2 = 0;
$ G* n! D' C8 ] - dma_addr_t dmaphysdest1 = 0;$ ^' ^4 }; C( t8 y# f
- dma_addr_t dmaphysdest2 = 0;1 C* {2 D1 J8 c1 w
* \" n. J2 E8 X- char *dmabufsrc1 = NULL;
$ a u( H1 h6 F, N% X& o - char *dmabufsrc2 = NULL;" }1 h* f; F D
- char *dmabufdest1 = NULL;
* {* [. k/ X1 c$ Q - char *dmabufdest2 = NULL;
9 h. Q8 _5 F* m% J
5 z+ ^$ }: D$ z1 E- static int acnt = 512;
0 V2 C) @% o4 f: T: U/ u* w2 V6 A - static int bcnt = 8;- [' V$ A& {/ T% F' T6 T
- static int ccnt = 8;; v8 ?3 ]! v2 y
- ; y: u( }( H4 Z8 i
- module_param(acnt, int, S_IRUGO);
: A( x! J+ n2 C" X& M" y7 \ - module_param(bcnt, int, S_IRUGO);
2 J2 }" I, D3 o4 v, Y6 ` - module_param(ccnt, int, S_IRUGO);
复制代码
( Z/ W1 A' K9 o$ L. K
. `* W0 |& Q, d# n4 W5 Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ s: C$ l r' j5 M$ F1 U0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. s9 x* ~6 q; u! s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 P& ?$ k) a' m3 j1 \9 u# o0 Y
! ]: D' j1 b" `& D! S3 L" u
* M! ]) G+ O9 w; S7 V6 P |
|