|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / q2 q+ e2 a+ K* O! Y0 Y
- [code]EDMA sample test application. W6 \& R5 F3 i
- /** c6 K+ \. T9 g- } P( a
- * edma_test.c
: ]4 B/ q( [* t9 M, J% c - *
K" E0 E% ]9 g# n! n" j4 V1 m - * brief EDMA3 Test Application( N- e1 x# Z! K; y2 i) z/ s, Y
- *
( s% v, `( D; S0 p2 | - * This file contains EDMA3 Test code.
9 Q2 X. r' ]% b. q M9 g - *# g, H/ B" b1 `3 O+ ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! E+ l. v3 y2 k* a2 t8 S; z' ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
h) d+ H- |% A$ _& r2 ~8 Y& e - * TO CHANGE.1 s% `* H" A# L9 S o! Q0 W
- *+ }, ~) v) K! j I5 v6 ?( Q; c% l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 h0 B v+ L$ ]2 e/ G - *
9 _- H! p' U1 D: n - * This program is free software; you can redistribute it and/or$ @% ~ z& `; [6 ^
- * modify it under the terms of the GNU General Public License as4 }# ^( t# w) a
- * published by the Free Software Foundation version 2.
4 e; M- B- {) ]2 [ - *
' J% [! B2 a2 l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 ?7 e' j; y; x2 N! p L5 z5 c
- * kind, whether express or implied; without even the implied warranty+ W% H; F1 N2 i! i1 d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 z' w2 m5 Y" K2 h6 B8 s; p+ ?" ] - * GNU General Public License for more details.
0 i3 r6 ^2 I }2 ]/ S, @! i2 M - *// q3 o9 R: \7 H' O/ V
5 S7 k4 f; W; r& O8 x- ^- #include <linux/module.h>6 b# G" |; @, Q1 y r) [5 d+ P6 l
- #include <linux/init.h>( }- | `5 U/ |2 g
- #include <linux/errno.h>
; o6 J# o2 \; b5 d6 ] - #include <linux/types.h># n) i8 k! N8 X' ^$ n+ E2 A
- #include <linux/interrupt.h>7 G1 M1 o! \5 q, R
- #include <asm/io.h>
; p7 L3 n" K! Y8 [) r! y% o: ]- } - #include <linux/moduleparam.h>8 C1 F, W) ]- y: C$ N0 C3 b
- #include <linux/sysctl.h>
6 T! `0 Z5 H/ l, g - #include <linux/mm.h>
* l- J% H+ U/ h: U( l - #include <linux/dma-mapping.h>5 }. N5 B8 B1 h' z; w0 `8 Z! l
- ( f+ D1 C' V; W P( n
- #include <mach/memory.h>( g6 h1 b5 Z6 z4 T. z' L
- #include <mach/hardware.h>
3 ]- @3 p- k. j - #include <mach/irqs.h>, l P& l/ [6 o% ]! A, x
- #include <asm/hardware/edma.h> X/ I6 P1 d& R9 s: p
6 I1 }7 L% o; s7 L- #undef EDMA3_DEBUG4 \: Z8 \" v& Y2 ?4 K: c C
- /*#define EDMA3_DEBUG*/
, n1 K% C4 J" v/ N# ]2 V& v/ r3 c
) Y: a8 x( n2 I; U5 x, W0 O- #ifdef EDMA3_DEBUG
* U& T4 e* N. g# o' }, c" \4 Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 A* @( T2 O4 s" U; j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) y+ T0 _2 O0 \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, H. Q0 Z1 Z5 ?6 n% ~3 f - #else6 T. w# ^3 u2 H7 ^0 e
- #define DMA_PRINTK( x... )* D3 U; m, E4 s" m, o5 E
- #define DMA_FN_IN9 J) E& O9 f( E4 A9 C8 t
- #define DMA_FN_OUT
) @) W5 D2 E! _, P/ Q$ K0 U - #endif
# f, Y0 [) I6 l; ?
1 F& ?% m ^3 U/ O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 O# g# z. a5 o3 E- @
- #define STATIC_SHIFT 3: h/ j: O8 T. |, [& C
- #define TCINTEN_SHIFT 20
" _0 S+ `! w* q: s& z1 Y - #define ITCINTEN_SHIFT 21
0 L8 n$ n! j/ }5 b" v2 u# ~8 r - #define TCCHEN_SHIFT 222 b9 i1 |$ U8 {5 h
- #define ITCCHEN_SHIFT 23
- @& `$ _8 Y7 b% l: O - . ?' I0 q6 Q2 c' s1 `4 N5 U
- static volatile int irqraised1 = 0;6 p7 _% r) I% s# a$ \
- static volatile int irqraised2 = 0;
2 l7 y: d. S5 H) Y0 V5 n
0 M' l0 m& p& `7 k W7 p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 {* v# S/ l5 Q! c3 G) b" L2 l( V/ |9 w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( s$ s2 B" G9 N7 N - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 E/ c( h7 o2 g5 g% t1 @
6 u: Y6 n Q, c1 ]- dma_addr_t dmaphyssrc1 = 0;
" z4 `; D/ G0 k5 B - dma_addr_t dmaphyssrc2 = 0;4 @+ ]2 ?( S8 {& ~' d
- dma_addr_t dmaphysdest1 = 0;
( i. c7 I, } J - dma_addr_t dmaphysdest2 = 0;) n" k; z; L2 ?0 J2 z, y* t @
" S: p; [, I! V% K$ d9 c- char *dmabufsrc1 = NULL;
# V7 z4 H* o5 R& V7 x, Y - char *dmabufsrc2 = NULL;" [' y# y# E5 }) }7 g
- char *dmabufdest1 = NULL;
7 x# a, p' ~ s6 r# P2 ^ - char *dmabufdest2 = NULL;
, [/ S6 a* ^0 H* _
) i, t/ l3 k: G& {- v* K/ R- static int acnt = 512;/ l+ y- V2 p" Y" U
- static int bcnt = 8;) a: a" _% V% b2 K) S9 ~* _- u
- static int ccnt = 8;* {. ~2 S+ a2 d' t
- 4 W& \- A: I( q3 B( f/ e
- module_param(acnt, int, S_IRUGO);2 y3 o* v3 h" _
- module_param(bcnt, int, S_IRUGO);
) V2 }3 I8 U( ~" Y4 s# ~8 M& U - module_param(ccnt, int, S_IRUGO);
复制代码
+ N; W: [; X- ?! q' j
2 K" u9 M! U0 d8 I, Q: i! ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* r9 g- Y4 a+ B0 A! ^arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& z' v8 p+ }! X1 w; ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 g C/ b Y$ m' G2 L* h( Z$ j8 A
1 i) u& t$ s8 y2 x, P
" l: K7 N; K! o" B& n |
|