|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ A0 T$ I8 e8 Z3 m+ ?. u5 Y- [code]EDMA sample test application$ k3 H1 Q0 [& t9 J; v% W
- /*
9 E8 M Q7 y$ C - * edma_test.c* [2 ?: O5 l4 l
- *( [9 w" C" _+ ]# G! X# ~4 c
- * brief EDMA3 Test Application
$ `$ T5 B! Z4 k5 z/ F$ t# f5 Z - *
5 z! w7 |) L. f7 t/ ` - * This file contains EDMA3 Test code.# O4 T. T7 d2 Z/ N2 s
- *. d+ ^( q* @7 o& c) g# S! T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 ~: |. v3 t2 G3 M% s5 o: f- w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- V6 j. `: w/ e5 {8 m0 V! z( ^
- * TO CHANGE.
; F5 l& g8 S/ l- e& \ J$ Z/ p - *3 m: r7 P n* }6 @* Y' }' ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 L, N4 V: N* h! \# S - *
' A& D! l6 P. |: y( @ f0 C - * This program is free software; you can redistribute it and/or4 @ J3 X F- W9 a& T# Z9 x3 I
- * modify it under the terms of the GNU General Public License as$ L! }% G# L* [1 J% r
- * published by the Free Software Foundation version 2.1 _- Q. ]" d! e% s
- *
4 k t. L4 ^: A. x8 G0 j' c# O( Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 N/ O+ T1 H/ g5 P# s
- * kind, whether express or implied; without even the implied warranty
' Y+ ~- `& v$ X7 r' S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" F+ N% Y; T+ Z9 M- T3 L+ E5 l& \
- * GNU General Public License for more details.- _, o E3 \% {# i ^4 @
- */+ J# t$ X' t6 L( p0 p
- 0 I9 ~. J/ O: u0 Z* K$ Q
- #include <linux/module.h>
9 c! L8 j: j# L% j F - #include <linux/init.h>
* v* {# z! c6 G/ ^ - #include <linux/errno.h>, i1 }+ I! [3 a* T
- #include <linux/types.h>9 |/ ?( h) t. {
- #include <linux/interrupt.h>7 D( B: h! a& v) G1 [# n- C
- #include <asm/io.h>
/ n. G) S1 h0 v2 |+ q1 g, i. o - #include <linux/moduleparam.h>
+ |, t! C% Z" U, E* @ - #include <linux/sysctl.h>
3 O7 _ G6 e" J; a% |& L; p7 D" h1 _ - #include <linux/mm.h>
: A/ f% w! C. A( V - #include <linux/dma-mapping.h>
4 R% Q8 f9 A) o7 E; }* b - k# J: ?- ?7 }! S. ?
- #include <mach/memory.h>$ A" j2 d+ k T9 c4 p
- #include <mach/hardware.h>) E) F$ k/ O1 ]* G& G+ w
- #include <mach/irqs.h>
, e( J7 h# K! c \7 w - #include <asm/hardware/edma.h>: y# V6 i5 b4 m+ D: G
' W6 c: E" b: }/ @% d- #undef EDMA3_DEBUG
$ K2 u2 D+ o+ o6 Q1 R2 U1 u - /*#define EDMA3_DEBUG*/
' ?5 F8 c: V7 O6 J8 _# w" F - # c' \6 _8 M' t+ J- J! C) f- v
- #ifdef EDMA3_DEBUG
; {5 ~% g* J. ]8 J: R) a7 e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% i: N7 q( K$ ]7 { {6 n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( @" u- }, N) H7 C) y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' `/ D3 ^9 Q; D0 z! \. M - #else
5 v8 ` |8 L2 T9 m ~9 s - #define DMA_PRINTK( x... )- C1 a2 H7 H2 L% k( Y% N4 ]9 g
- #define DMA_FN_IN
8 G8 _' |3 m1 y% ?/ `" ` - #define DMA_FN_OUT+ Q* ]+ ]# Z+ A, L- ^( M2 p" ^. y
- #endif9 T( ?; W% k( t! v) E0 s0 }+ A
- , c0 a' E' y* y+ [& I7 Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# E5 v/ n, @) C" p M - #define STATIC_SHIFT 3
3 s7 w( j7 h4 z3 h: S9 l - #define TCINTEN_SHIFT 20( B$ `4 R5 \- z
- #define ITCINTEN_SHIFT 21/ Y" D4 @( ^! i" r# ]
- #define TCCHEN_SHIFT 22
3 {0 O* m' z. U - #define ITCCHEN_SHIFT 23
; Z6 n6 q1 o$ W* V4 s
$ f+ L/ m, f7 p- static volatile int irqraised1 = 0;& D( ?+ E( T. M, H
- static volatile int irqraised2 = 0;8 v3 }& L! H# P6 C$ [* F8 l4 \* O
3 D. n( g& T+ I) Q4 [7 |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) o; \9 g$ V- V3 H. p/ w4 ?! S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 q; T; R, Z" k" S1 u
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 S# Y4 l# Q/ t. ^! V
+ U1 \) a2 Z' [. p- dma_addr_t dmaphyssrc1 = 0;
# l0 Q9 `' ~0 c' I) @! ] - dma_addr_t dmaphyssrc2 = 0;
) n& u$ Q5 k0 i0 i - dma_addr_t dmaphysdest1 = 0;0 g- m4 V5 t b; S9 Z9 O) t
- dma_addr_t dmaphysdest2 = 0;' r( J/ P6 Z+ Q+ Q& \" `& k
. O! I8 ^7 o0 Q- char *dmabufsrc1 = NULL;, `2 i2 \6 g; T/ b
- char *dmabufsrc2 = NULL;
Q6 p( x& }. X2 n, U - char *dmabufdest1 = NULL;% g1 T/ f: e- x+ R6 r8 B
- char *dmabufdest2 = NULL;3 j1 q. j9 U2 d0 e, S3 `
5 g- x, M) q. e- static int acnt = 512;, r& n* u* O6 \+ h8 M
- static int bcnt = 8;- I* o" T h2 S; L. n( H2 ~
- static int ccnt = 8;
; A! ]) A1 c* o* I
6 @2 L( x$ C' T, R' S/ L- module_param(acnt, int, S_IRUGO); C! c; \: t- D* b, N8 X
- module_param(bcnt, int, S_IRUGO);7 H! ?) D& w- y3 D, o
- module_param(ccnt, int, S_IRUGO);
复制代码 7 P% g$ A+ {' v
9 ~5 ~3 a) U1 J9 c* K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 U3 q- p+ g. z& y; j9 M, z. sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 q/ }$ }' h* P7 U0 w- B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 l: X+ ?% Y/ g$ Z/ l% k, R- U
% T' a+ L* C$ ?. G2 L7 J2 q
2 l6 M0 o! w0 l8 f8 q9 e
|
|