|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ a1 I% \% w4 M d' `3 Q& i- }- [code]EDMA sample test application5 r) e! @( [$ W% \/ Z8 F& o
- /*
2 R* D- ]- U" o/ }4 ?' A% R - * edma_test.c. j4 v; Q/ V( h4 j% \
- *
# d; n$ J1 B2 I4 f - * brief EDMA3 Test Application1 N: C4 k2 x0 ~8 r
- *9 t, b) a+ z# u9 N
- * This file contains EDMA3 Test code.
( a, I$ w9 o' z# F7 u, a- H! o4 V - *
$ N8 H# B3 P/ E2 [! ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) F( [' {. U* l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 u! y; Q0 c$ o) s+ Z" O* R - * TO CHANGE.
7 J' C- [$ F$ b" A. w- I( a4 j/ a - *
+ p7 d6 q3 i+ i; n8 f0 [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 o. D8 a( b* |1 [2 S, k5 ? - *0 \9 K3 @5 o# N4 k
- * This program is free software; you can redistribute it and/or
$ k/ z' ~5 k' F d7 d5 m+ M - * modify it under the terms of the GNU General Public License as
* G Z) W2 E! ~ - * published by the Free Software Foundation version 2.
9 `; m2 a) r8 N" u - *
& {: ?/ ^- n. U9 V, { k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. r+ F% R% `1 v' _& e: O5 c - * kind, whether express or implied; without even the implied warranty9 i1 V9 B) ?- S e3 A0 ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& ?% N# b U! S+ Z2 B3 ~; D$ B
- * GNU General Public License for more details.
' M4 A* K8 t2 v# G3 g7 p- \ - */
' w( U* o$ Q7 I1 d" U+ R - 5 p) `( j1 d: i% k' |7 e0 X# [
- #include <linux/module.h>1 I& v/ p2 ?. e0 Z: i6 ^% C) W2 v
- #include <linux/init.h>" h0 X5 e4 S9 ?- N0 y3 S
- #include <linux/errno.h>
. [: { T$ z* \# p4 h, D( Z6 ] - #include <linux/types.h>: \/ E+ ~9 M; E; N! i# r0 n
- #include <linux/interrupt.h>
2 b3 y3 t E! y, t9 [ - #include <asm/io.h>9 Y8 P" N) l$ F1 Q/ F$ t8 Z
- #include <linux/moduleparam.h>
& P' U; R; u3 E4 \# Y# z, K. E" m - #include <linux/sysctl.h>
8 h1 A3 W7 e/ a - #include <linux/mm.h>& f1 k o0 s8 ^0 S
- #include <linux/dma-mapping.h>! k7 d i6 d+ }# x1 }# Z
& ~% A: `) Z" Z0 U, B9 K% M- #include <mach/memory.h>+ c3 @8 m7 f9 D( N
- #include <mach/hardware.h>; a1 T F8 f8 ~; W' m
- #include <mach/irqs.h>
5 ~2 R* P0 M, p4 J - #include <asm/hardware/edma.h>
! ] Y, u- R4 m5 T6 x$ R$ M3 p, e - $ H5 `6 F; w$ G
- #undef EDMA3_DEBUG
5 n$ ~) m5 Q8 ^! H* y) T F8 Q - /*#define EDMA3_DEBUG*/% B l+ t( o. s! K& ~- C) a
' w/ ?. F0 H. {/ X4 D5 n- #ifdef EDMA3_DEBUG
) C/ Q4 U8 X/ ]) n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ x" F% M, B4 H& J9 U/ l4 f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ E6 J$ B1 ?& H2 H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 S* B# M& r' M* W
- #else5 d/ X6 Z; h# {* R
- #define DMA_PRINTK( x... )
" Q6 P# U# }0 b$ A- ^& i, L - #define DMA_FN_IN
' b! V9 x$ a. J' s& ^8 X - #define DMA_FN_OUT
. e Z) K. p# J F6 q3 b - #endif6 A/ q7 M5 t8 Z x6 W
; l9 o Q; {. V, D5 Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 B! u+ Y7 j. f% ]3 t - #define STATIC_SHIFT 3$ P g9 n9 ? }1 C- F% J
- #define TCINTEN_SHIFT 20
1 x+ R4 B4 X6 A9 n - #define ITCINTEN_SHIFT 21
7 H* e( L& }& ^: E - #define TCCHEN_SHIFT 22" f7 y% l' O9 r4 `7 o
- #define ITCCHEN_SHIFT 23
7 c4 n4 V$ b% f) _% y# P
) r( y8 |1 b7 R1 v+ \$ f) w- _- static volatile int irqraised1 = 0;; K [% Q5 P+ w
- static volatile int irqraised2 = 0;/ n" `# P @) t1 t0 t
- / |2 g8 O/ U @9 p3 E2 v3 F! k) g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- A& ^- e- n+ d" l* \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 f3 Q6 h) e) I. f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ?; |0 V$ k& N5 |' K
- ) E4 e6 d- P1 z: v8 u9 u; q! h
- dma_addr_t dmaphyssrc1 = 0;
$ A7 |( j6 \2 I9 i - dma_addr_t dmaphyssrc2 = 0;+ t$ c. x# s+ @& U6 U% q; i* r& K
- dma_addr_t dmaphysdest1 = 0;
9 {) k4 z' C. J r( ? - dma_addr_t dmaphysdest2 = 0;
2 r7 ~* j0 b" s( S# [, ]* b - . p* W5 I* g$ p: n) o5 e
- char *dmabufsrc1 = NULL;- F/ p3 v1 @7 ~& q% F8 ]- W
- char *dmabufsrc2 = NULL;; k- ^0 F8 j! Y' S y
- char *dmabufdest1 = NULL;
$ h+ U8 z, j" L - char *dmabufdest2 = NULL;
2 r% [1 J. e9 H; m" Z+ {! a# Q
2 ~0 t/ K; ]. i0 R4 W- static int acnt = 512;
1 w+ N1 S& ~! ]2 E! ? A - static int bcnt = 8;; |: H7 c( c( D3 |" Y
- static int ccnt = 8;
9 V) B) u; P- p2 a6 d2 B8 w) ^
' S' f9 ?- ]; { s6 G8 ~( ?- module_param(acnt, int, S_IRUGO);5 B% n7 B0 \/ ^+ Q
- module_param(bcnt, int, S_IRUGO);
2 ^9 P8 g6 P& [ - module_param(ccnt, int, S_IRUGO);
复制代码
* P8 K: O& P0 h- P8 A' `, `+ g4 x8 T
' `' I4 l3 q& p8 n. p+ p* I& P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 f z+ d" W4 y6 T4 C9 E9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ |1 `4 Y7 j2 e+ e% t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 u) ~2 D1 U6 G& b: L" h( y9 Q
3 N) N, d' E8 r* h, i0 R9 D; n) f D; D. u, T Y1 s1 C
|
|