|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* D- Q9 q7 R* j( y' q7 i" N# a; Y- [code]EDMA sample test application0 ]2 O) B# S* |/ Y9 A$ L
- /*: H& S- H8 w; I9 |5 X
- * edma_test.c
+ s+ `! A( t3 X! I6 @, f/ j( [ - * c. g$ O; \2 Q3 t
- * brief EDMA3 Test Application
% \2 W; k9 u3 q0 r - *
P3 s9 X2 }2 H - * This file contains EDMA3 Test code.
9 m: H [) y- C j( G - *. [% W8 H3 i( S5 l' o" ~% _8 T% ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& ]: }5 q0 S3 R+ \; b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 T' x. p6 V* w0 `
- * TO CHANGE.' K, u2 \2 Z; U$ r! x6 r% M: |( T* L
- *, z* e9 J$ X0 O( g# }6 B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ [8 c0 M/ s `3 P0 T/ @: f - */ B( u. J7 @+ c
- * This program is free software; you can redistribute it and/or% o' {6 @. _& h- {/ h( U' f6 ^6 U
- * modify it under the terms of the GNU General Public License as
, j" n' m5 l' ^: h; E" S" u - * published by the Free Software Foundation version 2.
# s' X. U& S! V# B' ^- b - *! [, d, S( s- \1 V6 @6 j; n7 {- k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. [5 Z/ P, f ]9 }: ^
- * kind, whether express or implied; without even the implied warranty5 N8 Y+ m. D; A; {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: e9 G; ~; Y# q2 K. x/ Y+ o
- * GNU General Public License for more details.
% T8 n6 g$ u; ` - */2 j& f) @5 U7 M+ P- O; I6 o g
- 5 @+ B6 N/ n) C7 p
- #include <linux/module.h>& U1 I* p6 m% {: N* D' o& p7 I
- #include <linux/init.h>8 ]2 n# n- \4 c% p. n( I, D
- #include <linux/errno.h>
1 L) Y0 ^ c5 O4 f) a: e! v - #include <linux/types.h>
: I4 W/ Y% L7 X, s5 E% V" Q+ q - #include <linux/interrupt.h>* X0 L5 ^/ W- x* a, p
- #include <asm/io.h>
5 G5 }- r9 }5 d% e# b/ i - #include <linux/moduleparam.h>
+ {8 w: j5 X! |! v9 u$ ]1 i2 w - #include <linux/sysctl.h>
- s# F% e* m- S( p9 b; c p - #include <linux/mm.h>) ]; x* m n- A O5 U' D9 N+ O5 v8 j
- #include <linux/dma-mapping.h>4 p$ F: Q: b+ Q8 t0 M& @
: }0 k) T( U0 d' _& h+ _; Y- #include <mach/memory.h>
* V5 z5 e* A( Q3 i9 a+ y - #include <mach/hardware.h>/ u. a2 [& I& `# I" q* V" b8 E
- #include <mach/irqs.h>
& n8 {6 }0 F, h - #include <asm/hardware/edma.h>
% \% b7 X& l! K4 i) z - " w1 ]: x0 P" G
- #undef EDMA3_DEBUG. s6 ^' E/ X) F: G W- w
- /*#define EDMA3_DEBUG*/ k/ ?9 g8 a: U# N- B0 [( N
- $ b5 C3 l- e, i) h" I5 z
- #ifdef EDMA3_DEBUG
0 h) e8 R! V6 _3 n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( e9 p1 F9 o) g% H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- R( H) r) I: D6 M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 w9 `+ D% G" c" `" S1 z" A - #else' }1 J5 W2 A! k) y0 d6 G* c9 {9 N) ?
- #define DMA_PRINTK( x... )) H, H: C$ a5 Z8 E9 |
- #define DMA_FN_IN8 d6 ~) ~$ a0 Y$ d5 {5 H
- #define DMA_FN_OUT
3 m! H" i9 ]4 c0 Y - #endif
( J3 v3 y( Z z& } - : ^! |2 j0 }1 n& e$ b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' b+ r. m5 U+ _- v9 k; \9 J
- #define STATIC_SHIFT 3
+ Z6 ?! o3 Y ]. B+ A8 W - #define TCINTEN_SHIFT 20
6 U# P7 n7 Y, z - #define ITCINTEN_SHIFT 21
6 w1 n8 Z; t0 s) t8 r - #define TCCHEN_SHIFT 22
9 m; e" Y: u8 W) X- r - #define ITCCHEN_SHIFT 23+ [1 b# V, r! D+ e* a& M5 B# K
- l* [ u* |, m: h
- static volatile int irqraised1 = 0;
( S2 H2 K/ }9 b* {" Y& l* B - static volatile int irqraised2 = 0;
" g5 ]7 s( H9 C- ^, `; z5 a
& `( s, N w6 n! A( y& E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Z! C4 B; g, O( E/ x8 g' @0 G6 \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- q( L& x# o y6 ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, H- U( D6 ^' A, R
- , p+ J( d& i& l5 ?7 G( s6 {
- dma_addr_t dmaphyssrc1 = 0;$ d. a2 q' S7 u: e
- dma_addr_t dmaphyssrc2 = 0;3 `# d+ B# P) c. t1 w2 U2 }: O+ g) V
- dma_addr_t dmaphysdest1 = 0;3 Y4 J! ^0 L/ r5 N, V
- dma_addr_t dmaphysdest2 = 0;" d6 [) i. J7 X) g* U- h# V( V' d c
9 z( V s5 q: c2 p- char *dmabufsrc1 = NULL;
# e4 E# d8 H4 v4 L: u - char *dmabufsrc2 = NULL;
; S d- o, F0 R" ]7 V - char *dmabufdest1 = NULL;
9 S+ z5 Z2 G8 L# P# N; { - char *dmabufdest2 = NULL;
3 f7 p- [1 ?! C! I) o& F - ! D! F9 _* B0 u7 ^
- static int acnt = 512;* }' z0 U! M5 z& x5 k8 t- i
- static int bcnt = 8;
) i6 X& @* i3 @; \7 [$ U( \ V - static int ccnt = 8;
. R$ L8 X# k# R$ e) y% r - 5 N7 `/ }) T3 F9 p
- module_param(acnt, int, S_IRUGO);/ w6 U. c7 R/ f0 T+ F+ k. J! ~
- module_param(bcnt, int, S_IRUGO);5 r1 q1 e1 S- ^/ W% \+ H8 q
- module_param(ccnt, int, S_IRUGO);
复制代码 ' m; U! C5 c W. {
8 L% Y' U2 v& r) Y! o1 f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 V8 {' s1 ?' M$ y5 ~* p$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: D; l+ |+ h7 \& o$ y5 ^$ q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: x9 e% A: f( @% n! `1 o
( ]! e5 U1 P0 L: p
4 |9 X V* Z- `( g' M5 r& O O& F5 @ |
|