|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' Y8 T, Q2 S: N! y- Q' u- [code]EDMA sample test application' d9 m J6 [) S5 ^7 v. \
- /*
0 A' G/ r1 [& A - * edma_test.c
$ Y7 q6 {) m. x) ~ - *8 ?2 T1 G2 A p Y
- * brief EDMA3 Test Application
! S4 [( h1 O3 S - *
! L4 @; |6 `% ` - * This file contains EDMA3 Test code.5 d7 Z' h( W$ m8 }
- *8 G, C! [; u% i9 D& Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& [1 e8 s. p2 G! X1 J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" M0 i" k/ d* _+ L# k5 R
- * TO CHANGE., Z# {$ y1 J i0 X
- *
- e7 O4 i- r! W* \; s! |- R/ N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ R: @% g) s# f - * V8 p4 w! ^$ ^5 n/ Z9 e- C
- * This program is free software; you can redistribute it and/or7 u+ b' F( W2 D% s9 F
- * modify it under the terms of the GNU General Public License as
' w% v/ y9 H& g. | - * published by the Free Software Foundation version 2.
% \: J# Q, y; d: b, Z& N' ? - *0 m/ m' d; m0 d# i5 m. \! F( m U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: I4 g7 C" }7 C0 n, @: k1 I* R! ` - * kind, whether express or implied; without even the implied warranty2 ~) [0 a/ O) s2 x D) m& p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! a& j, ~/ ]8 H+ H: x# X0 a& @ - * GNU General Public License for more details.
4 @0 h/ n9 |% O) ~6 f/ k5 [9 V; p; O. A - */
4 B3 X4 r3 y/ b' v( q5 [ - 4 e+ V9 o2 l# H) S8 ?5 A! U) Q9 J
- #include <linux/module.h>7 |7 _( K7 u1 k
- #include <linux/init.h>
2 T6 H* V" F) H8 R' v2 j - #include <linux/errno.h>
1 f4 t& N8 Y8 ? - #include <linux/types.h>
4 G- n4 }3 ~. n. m* Q - #include <linux/interrupt.h>: N: T" h' ~9 l+ z+ i& [$ E' |
- #include <asm/io.h>: E" Q! a8 U4 Q/ f
- #include <linux/moduleparam.h>- w X% E; b! [, C t6 K' e
- #include <linux/sysctl.h>5 n+ f/ Y1 P! U3 B4 V
- #include <linux/mm.h>
4 K" U- [0 L3 t# e% r7 K+ }+ _ - #include <linux/dma-mapping.h>0 d* F4 A/ T: b6 b
0 Y9 B( O( Y% M" t! j: J7 Q2 X- #include <mach/memory.h>
: u# o( ?) r& R3 i6 ~ - #include <mach/hardware.h>5 b3 w2 I& ], h) F+ U, s$ Q' k+ g% G
- #include <mach/irqs.h>) U0 }' J' g, s; w
- #include <asm/hardware/edma.h>0 K0 U, Y7 t* B% ^1 m1 o
4 D7 O! P* Y6 }- #undef EDMA3_DEBUG
1 r' E+ b. n3 g - /*#define EDMA3_DEBUG*/# x, m( z) Y# S; ^; i% H$ J3 w6 j
- ) \( W/ `$ @6 X
- #ifdef EDMA3_DEBUG6 V' }! B; X, w4 [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); O$ U' }+ H+ a/ p3 r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 P; t4 j" D; x! E J' ]# S \5 W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% d# b1 H$ R, R3 a
- #else
5 v Q4 I0 ?3 `' L/ J* ^) G- V - #define DMA_PRINTK( x... )$ \7 K& x. M: C0 {2 y5 X" x
- #define DMA_FN_IN. g. Q' t E5 F2 h# \7 r
- #define DMA_FN_OUT5 Q% K6 c1 V2 p% U* `
- #endif$ ?( ?9 w- I8 t4 J" T' G- Z
8 }$ i5 U% J) _( t y9 P3 _0 {2 T- p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: l% |4 `+ ~- r1 T - #define STATIC_SHIFT 3
. V w2 k& Q4 ^ - #define TCINTEN_SHIFT 20: r% @& d7 L, \' e+ F0 n# u
- #define ITCINTEN_SHIFT 21
" [, | q8 K$ a+ T6 { - #define TCCHEN_SHIFT 22/ R! [/ P: y! e+ Y4 ]3 s
- #define ITCCHEN_SHIFT 23
0 H& l' k: s- F; {: U5 @; \ _
( Q3 w1 O! S( d/ ?- static volatile int irqraised1 = 0;: x! E! U3 r& l# y8 J. \' ]& Z
- static volatile int irqraised2 = 0;
9 T. ?3 d& J6 r- N& I
) E, o2 w+ b7 c& Z3 w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, ~& j& @) ^' t. r4 t6 a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# ^+ r# b' q: y! Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) q8 p' ^3 Y9 K
1 K% G: a; H+ {- ]! [6 Q- dma_addr_t dmaphyssrc1 = 0;
& O; T! m1 B+ z. h- y; s- L+ r - dma_addr_t dmaphyssrc2 = 0;
2 z2 }7 c: T4 B0 T0 I5 i - dma_addr_t dmaphysdest1 = 0;1 |7 |1 ?$ M4 `7 k/ ^
- dma_addr_t dmaphysdest2 = 0;
$ F4 \ g( G3 Y9 ~/ C
& r( N; n# _' S! b3 H1 ^9 V- char *dmabufsrc1 = NULL;
. e6 v: U4 f8 u a) a& X - char *dmabufsrc2 = NULL;
# g: s, p3 H# u i) d! { - char *dmabufdest1 = NULL;
2 }- b% @$ r2 Y) a - char *dmabufdest2 = NULL;" ]1 }9 z% f; s) |+ D2 b+ f
- # X" ~! D+ u* s9 v" S
- static int acnt = 512;
- H1 k6 s9 f) @3 e4 c3 y0 [ v - static int bcnt = 8;
$ f9 r. Y" j- z" f8 C$ i - static int ccnt = 8;7 u4 w4 D0 v( e
0 Y5 S9 W& j3 X! g! R- module_param(acnt, int, S_IRUGO);' P' Q/ h$ {. x! @, |7 Q
- module_param(bcnt, int, S_IRUGO);
; n9 }3 a1 A- E7 r8 \9 g - module_param(ccnt, int, S_IRUGO);
复制代码
+ A( [/ v! O7 E( S1 A% d+ _& G1 b( f, ^8 Z3 C: f# G J. j% \8 S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 W y1 U% m. l! @ R' N% G% T$ Rarm-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 B' W% g/ c6 I& B: S1 z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ [( Z# j4 |3 j" R2 \! R( b
* P0 y$ h6 `/ [) ?' D( `( e7 R/ ~* ]4 H1 Z2 @. K
|
|