|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - J0 v2 m4 @" @ }' A, R. m
- [code]EDMA sample test application9 f/ @$ g0 i5 L- c5 c4 ]& T
- /*0 u% r6 @5 m v" Q* I$ }
- * edma_test.c4 ~" D; ]) c0 X, P# ~
- *
) i8 q; b9 W) P9 m5 P. w; \ - * brief EDMA3 Test Application u. w/ f, ^* K/ M
- *
* d+ g) }- M' n/ `4 I+ x5 r) p; I - * This file contains EDMA3 Test code.
) u% I5 G" a" P3 `% L$ G8 s% t - *
2 q& {" G+ H& T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE t+ l4 e/ @4 `) X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, q5 H. x: ?4 A' b- v - * TO CHANGE.
: n3 J. F' \. h: Y8 a) L* B - */ v: ]& e: ?" e1 _# N' w$ N0 V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% O" {1 b2 H+ X% Q# g2 z5 T* h - *
5 |* d" K \6 ~3 L& r0 L; _ - * This program is free software; you can redistribute it and/or7 T7 q$ S0 T: T
- * modify it under the terms of the GNU General Public License as) w$ E+ ~& V* O* Y4 @
- * published by the Free Software Foundation version 2.- C6 }) y: ~6 Q/ ~
- *" P6 ^% @& G y- G9 n$ o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ w# R: o. T0 e# o0 M& M, v4 w - * kind, whether express or implied; without even the implied warranty
. Q. e% M$ p. g6 O+ @4 i+ }( ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 x$ I4 m6 Z+ r* } - * GNU General Public License for more details.
1 Q7 Y% \$ ~1 a - */
8 m) ]9 e: R% r, w, j4 t8 U h - ; V, B2 G9 c! O; e U; V
- #include <linux/module.h>
/ e. H( m5 E( h0 ? - #include <linux/init.h>: q- n+ R9 Q; ?0 \+ X* b; m
- #include <linux/errno.h>
. c1 G4 h1 P5 J2 B* J - #include <linux/types.h>5 f/ z% q) Q$ R& c% W/ K8 B
- #include <linux/interrupt.h>
( i6 c% M& [$ Q. F) n b - #include <asm/io.h>
1 l/ j* w6 n/ u$ G - #include <linux/moduleparam.h>
4 g3 u" u6 H: i/ D - #include <linux/sysctl.h>0 c& j% D$ k5 Q9 e3 E
- #include <linux/mm.h>
4 w3 P2 H/ }6 { a. [- Q) N$ i% T# M6 O - #include <linux/dma-mapping.h>
! h, @# T2 b; A" D2 l: j
9 ^3 Z% V& P9 m6 k0 M# n- #include <mach/memory.h>
6 z0 Z, _0 |( o3 u - #include <mach/hardware.h>% B3 s2 i3 G5 [: [4 p' B; Y
- #include <mach/irqs.h>
/ }6 K5 `! p5 [0 _. }! i/ ]' \8 F - #include <asm/hardware/edma.h>
' L$ K. K* Q) K+ P, w
8 ]3 X ^; ~7 k' H' K- #undef EDMA3_DEBUG
! a+ Z2 h; {) U* J8 ] - /*#define EDMA3_DEBUG*/1 F5 s! ]# i7 w
- / L3 z R K% z
- #ifdef EDMA3_DEBUG2 o; K7 B6 q3 M9 E6 `2 y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- L- C8 E$ W: d( S0 f% J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- x; i$ d) {0 O2 m9 r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 j, B* O; O; w - #else
* D* |/ @+ _+ W. V' Z( b - #define DMA_PRINTK( x... )
; E ]8 w$ \# F5 { G2 x - #define DMA_FN_IN
$ i- E, N7 I3 U7 ]/ T- ` - #define DMA_FN_OUT2 p0 m. G$ m$ E n( w& t
- #endif2 l9 p$ }) Q8 _3 W3 R% G7 R
; N- e8 P; B( x9 n6 g. a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ U& c. [# K X8 P$ @
- #define STATIC_SHIFT 3! F7 n, }6 }( y, O' ^% d
- #define TCINTEN_SHIFT 204 ]1 |0 a8 l/ t3 v; ? d0 ]
- #define ITCINTEN_SHIFT 216 ]+ c/ _5 A }- } [% {
- #define TCCHEN_SHIFT 22
" a, R" i1 y: `) B, q - #define ITCCHEN_SHIFT 23* s. }: W7 R- \) b7 P
- ' o3 m- X! b9 D
- static volatile int irqraised1 = 0;7 u- y" Q" b! _
- static volatile int irqraised2 = 0;
( \" I( q$ V2 I" c6 z
' s, b/ Y, D( V: e# Y4 m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ M% Y$ Q$ Z* n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& L! l5 s. p# o" `: b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" \( F7 G& R6 A% J7 Y0 E; o
& G' E6 A8 [4 `5 P% t2 P6 u0 l- dma_addr_t dmaphyssrc1 = 0;
5 @3 l- ^* z* w3 f5 ?, t" R" } j - dma_addr_t dmaphyssrc2 = 0;
% Z9 k& F8 x: `; b! o; [1 D$ \ - dma_addr_t dmaphysdest1 = 0;
+ z; Z& K* b! F% U - dma_addr_t dmaphysdest2 = 0;
: w" `( X: ^6 U9 C3 L0 `# n/ K
9 {" F+ K- p! y# {0 h2 G- char *dmabufsrc1 = NULL;
/ Y% e' N+ Z" f) j" W* U - char *dmabufsrc2 = NULL;
0 @9 R O; Z9 R$ m W; L& t8 o% a' ~' ]! T - char *dmabufdest1 = NULL;7 P& g+ t; B. `9 e
- char *dmabufdest2 = NULL;
8 m8 {7 q4 p. s8 y
! ~( N1 y" @' O- static int acnt = 512;
; E& a0 U7 T( n- P* v - static int bcnt = 8;" t3 y/ ?- R2 F) W4 e; m2 K
- static int ccnt = 8;9 {3 L- O, c# |+ A
4 \& S$ F. M- J1 y" v# l- module_param(acnt, int, S_IRUGO);: ?3 I: T( l; K/ Z9 m
- module_param(bcnt, int, S_IRUGO);% C3 f ^% u+ \" l
- module_param(ccnt, int, S_IRUGO);
复制代码
) M. y( A3 x( s {. g
6 {* u! U: d$ S/ e- n# @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, G: L7 T6 t& ]$ D) {6 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( W7 C2 ^& s" }9 o' B# D/ t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 A" s3 \! b6 d
* H3 l) t7 t `5 @
0 G, o( s1 n2 @$ G; [ |
|