|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' H5 H. N) ?& j/ c9 c. L% z
- [code]EDMA sample test application
* a8 f5 q. V2 M" M w - /*
* |, c- j2 s) h/ v - * edma_test.c
0 d6 J# ]' e$ l8 c9 T - *6 M( [: W/ C0 g9 K6 _3 S
- * brief EDMA3 Test Application
; Q) X4 I1 R6 Y2 ` - *
' K9 J; Y. |4 g- M) l - * This file contains EDMA3 Test code.' d; O _( G! f" B
- *; z* a8 w8 @' H1 C$ P) N( [4 u! c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: j }% W: Z O6 b, r2 x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; Q: O1 m) Z( {5 A; C# t7 s - * TO CHANGE.
! _- _1 ?' h+ `0 c6 N8 c" ] - *
, r+ L9 o3 Y, C. C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ l; ^ a9 @8 K! ]7 s$ H1 } - *
" b$ Z) R6 O& m$ O+ ~. s. Z7 M5 ? - * This program is free software; you can redistribute it and/or
0 _+ c% x, t, T - * modify it under the terms of the GNU General Public License as
) e% g# K3 k+ d% [ - * published by the Free Software Foundation version 2.+ x" U' K& |# p* `5 G8 a
- *
1 y1 n5 y- \) j% H( B0 w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 n$ k/ I7 s8 P: c! s, y! k
- * kind, whether express or implied; without even the implied warranty
" b& I6 ?! L, C$ B' n( a) v" J' C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ o* D/ R' r* |8 i
- * GNU General Public License for more details.
: ~1 e3 F- a% W2 E2 V - */
9 Z- Q4 o4 t5 p- M! ` - : P9 {9 I% d1 _ P% g
- #include <linux/module.h>
( C1 G6 T2 {+ Q - #include <linux/init.h>
# e+ i& K7 v; ~6 L0 M - #include <linux/errno.h>6 @; J! \$ L9 l& {, j, ~
- #include <linux/types.h>6 ^/ g3 O. L. a W' Y
- #include <linux/interrupt.h>5 b3 D$ K0 J) N
- #include <asm/io.h>: Z7 F5 l6 A& P5 f
- #include <linux/moduleparam.h>
! W6 P( N! P1 D; Q) n - #include <linux/sysctl.h>
: r% g) g4 a0 Q* [* \$ q$ ? - #include <linux/mm.h>
$ A l9 l5 {5 r - #include <linux/dma-mapping.h>) Z, d/ p! s3 b% l! Q3 K/ S' Y
3 R3 V5 ]1 i7 X7 M- w- #include <mach/memory.h>
% ~5 v, T' w( r9 u3 i - #include <mach/hardware.h>3 |& I+ s8 {8 \7 E" O
- #include <mach/irqs.h>+ N5 z+ u$ M3 \: `3 ~6 `
- #include <asm/hardware/edma.h>- d6 A! l; \8 l3 b- ]& c" `
+ s2 B9 c- D0 G# j' }. H- #undef EDMA3_DEBUG
" i, Q* A3 @, d1 K3 I ~3 Y - /*#define EDMA3_DEBUG*/% H( t( i \5 o- q) i: t' G
- 7 ?6 B# h& T6 T4 a8 X. c& V
- #ifdef EDMA3_DEBUG
6 y1 m0 \ h7 ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 W5 }! e/ _ ]! t, D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), p( z9 [( ^1 H- Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! l9 e3 k4 D4 z6 t3 M4 p. j - #else
' p' N$ x3 j3 T3 Q* r! a - #define DMA_PRINTK( x... )
. b" Y" c! Q; e7 t - #define DMA_FN_IN
. a1 v/ q/ }, k3 I& x6 K - #define DMA_FN_OUT
3 m# w) Z- _* [+ p1 l- V. X! k - #endif
1 I! E3 H( I) T0 \2 A
x! W0 Z8 u# |& A: U/ A6 `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: |- d! A" r# h, W. p _8 V - #define STATIC_SHIFT 3
+ p( u+ c4 L4 Q: L& p( G- q% s; L - #define TCINTEN_SHIFT 20, S U$ g. J5 I
- #define ITCINTEN_SHIFT 217 R7 a+ ]. q g$ e2 l1 _" X+ i
- #define TCCHEN_SHIFT 22
. v, f' n5 s+ T" u) Z - #define ITCCHEN_SHIFT 23
2 x5 I! F) a( u5 V& D _7 R% x
; G3 T/ U& B% a" Y- static volatile int irqraised1 = 0;
1 ?9 o5 A6 Y# q - static volatile int irqraised2 = 0;) L' B; H3 L: m3 E
' H% q. M: D6 V. y4 f" a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 E4 x/ D- c2 f8 [& a" D- _! p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) a9 E3 K9 v; f( w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* n' d, r& J( Y$ |- E7 X E$ u - 7 |- t$ ~- L* v0 [, r# @2 C9 `: K
- dma_addr_t dmaphyssrc1 = 0;- d( m/ Z( f ^) w
- dma_addr_t dmaphyssrc2 = 0;
: d1 M- {1 z& f# a - dma_addr_t dmaphysdest1 = 0;% L% _# u2 y2 x; }. k0 X3 ?$ Q( Y
- dma_addr_t dmaphysdest2 = 0;
; ]) `& U1 a! s - + b' r5 ^- ?, g/ N' q$ w
- char *dmabufsrc1 = NULL;
. k! ~# M" @ L. s1 |7 |3 Y - char *dmabufsrc2 = NULL;
7 \ z; O2 T6 ]! e/ G2 d* ]. k - char *dmabufdest1 = NULL;; n0 \! o5 C' |; G8 H r
- char *dmabufdest2 = NULL;
. h) S* R" `+ L3 J
. a2 v, E, Z) K* ?+ `- static int acnt = 512;% f5 h7 W* {4 k" u, ~. v
- static int bcnt = 8;0 z* z5 r) g, k
- static int ccnt = 8;
! r5 k7 V. I$ q: ?% k* j
/ d( X) Y W, _- S- module_param(acnt, int, S_IRUGO);
) v" n: J$ t+ g+ T( b9 I - module_param(bcnt, int, S_IRUGO);
m8 ?/ w- b' U- s7 n" k - module_param(ccnt, int, S_IRUGO);
复制代码
4 r3 ]3 V* N. @1 P
; _) w. u* _" J4 O% { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% u3 O3 [: B1 u6 X# L! y- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 A7 O/ U. T$ ?7 e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* W( t! T" `# E8 P6 o0 j3 X: H7 m3 @3 h( `6 D$ j @) b% D
: ?# b: Z% M% M' M( t- k7 G P9 j
|
|