|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( E# z0 Q4 {6 ^4 R0 y. g0 c3 o
- [code]EDMA sample test application
* _. \+ v5 N. O- \+ Z5 A - /*5 X% D( k) W9 v; z9 g: b' G; V5 ^
- * edma_test.c
" ^# M8 o1 L9 m" s4 c' G/ @0 R - *: `, \8 k" l3 n# q# |0 s6 o* a
- * brief EDMA3 Test Application, o. G: @8 n2 z& a
- */ C% z% v2 @% N) x
- * This file contains EDMA3 Test code.
1 q2 r% P, k5 x2 ]5 ] - *
7 ]2 C/ K+ e8 o" W' G& S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( C( f, h& R3 Y, ~6 {- K1 _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 ]6 q8 \8 w+ V3 }, S8 O- ~
- * TO CHANGE.
* f2 U0 q& h- j3 H0 k; @ - *% \0 I3 w0 S8 a2 ?) |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 B. q2 h0 M$ P$ Z# |5 \
- *7 E8 w0 c5 s: j$ O, u8 @
- * This program is free software; you can redistribute it and/or: [+ y* {# `8 i& _+ i
- * modify it under the terms of the GNU General Public License as
+ r4 y9 y3 m0 Z0 Q$ S - * published by the Free Software Foundation version 2./ E5 A. W! X7 t9 E9 `( y
- */ `; h! Y- K' r& O7 {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. |7 b7 E. G$ w - * kind, whether express or implied; without even the implied warranty8 N# p4 Y6 L& Q. Q3 f' B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; @6 P2 W3 }$ c5 x
- * GNU General Public License for more details.' O, i* J( v7 Y% K& T- c
- */. U+ n% U1 E( H8 j* ]5 ~
- n* i/ \( r% V$ x. y& A m( K* I- u
- #include <linux/module.h>
# M; q0 H9 n0 L; g - #include <linux/init.h> Q9 x, V" V+ S2 w4 W! k
- #include <linux/errno.h>
" j) v( s/ |, L6 D - #include <linux/types.h>: o* B+ p' Z8 F
- #include <linux/interrupt.h>6 T% ~5 P4 P7 b# u; t1 U3 q
- #include <asm/io.h>, @% P6 o- A3 v2 v
- #include <linux/moduleparam.h>
7 y' g! w6 d9 N# j+ W, } - #include <linux/sysctl.h>
. ?3 Y* v, Z, n2 M/ D - #include <linux/mm.h>% i" H2 \2 O0 V5 x
- #include <linux/dma-mapping.h>3 v$ \7 Q' q4 U: o
- # C. I4 a! Y7 j5 N
- #include <mach/memory.h># k7 w* J% ]& ^) h4 F- f9 k
- #include <mach/hardware.h>
" L9 G" O; D7 N# G - #include <mach/irqs.h>
8 P# A' x& n/ Z! ?' h0 X/ M7 B - #include <asm/hardware/edma.h>3 H7 A# m3 R5 m F/ D
& D& M8 ] m4 N' }9 H+ e7 ^1 j. W- #undef EDMA3_DEBUG: z( l: {, O# \' |. f
- /*#define EDMA3_DEBUG*/
* N3 C3 D" s8 r- ~5 N - 9 ~' {- D( Q* M: [2 L: c& Q
- #ifdef EDMA3_DEBUG
# V5 f' V" H7 k3 A4 `) h( [' j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! ^% X, E+ c! l5 n5 O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). w/ L& z. I1 h8 l) u, E1 y* j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" Y9 D, y0 G2 V0 ^ - #else! Y. K; U7 k) C# b! D9 R( [) \+ ^
- #define DMA_PRINTK( x... )4 s1 i5 c4 o' B/ g6 L9 m% g2 n
- #define DMA_FN_IN
0 {) G+ U: s6 W; c# b! Y9 s2 R - #define DMA_FN_OUT# g8 @1 C, d1 a9 L& R" T; L
- #endif9 S& B8 y+ @1 S; B1 d
- 7 ]7 `9 w) `0 b- y* ]7 [3 z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), n" R' l& P1 b$ L' T
- #define STATIC_SHIFT 3" @- @1 k( u/ t8 s+ g2 k1 t! {
- #define TCINTEN_SHIFT 20
7 a6 L& ], {8 _ - #define ITCINTEN_SHIFT 21
7 \8 J/ F. d1 z+ b7 ~ - #define TCCHEN_SHIFT 22, w* x' e. C# Z2 Y
- #define ITCCHEN_SHIFT 23
/ O( g$ v+ N8 ^ - 6 w) h2 u# p* e4 g( T
- static volatile int irqraised1 = 0;
) H: ~& }0 H" s+ T5 z# K - static volatile int irqraised2 = 0;. R5 K0 L, d2 J9 Z2 ~2 r
0 r5 y: ~5 H2 o* K" _! p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ U4 \: u3 z' q$ }- W; M, `' X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; T0 R! K/ K3 k, w6 u' S4 m' T5 h7 L4 e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ E. m% J& U$ N1 h' c, ]/ S5 }& y9 ~- f
1 n$ ?* a6 H7 V6 h1 D- dma_addr_t dmaphyssrc1 = 0;$ q- X$ V6 L) E; n4 q
- dma_addr_t dmaphyssrc2 = 0;
& ~9 ?; @" Z8 k( { - dma_addr_t dmaphysdest1 = 0;
( p8 A; x$ Y5 c# S/ U6 l - dma_addr_t dmaphysdest2 = 0;4 H" G. P0 N$ [
- : d2 [% _( v* g+ @( l
- char *dmabufsrc1 = NULL;/ Y" W8 n) h, r5 I) J
- char *dmabufsrc2 = NULL;
' a/ p, Q$ q5 K. W0 B* O - char *dmabufdest1 = NULL;
4 R0 i. R2 a' O' L5 T5 [ - char *dmabufdest2 = NULL;
b N I3 i$ Z$ I; A! T# l - # Y5 G: j& t0 P( Y
- static int acnt = 512;
g5 R/ O# M- |& I - static int bcnt = 8;
) @' O% f4 T& A4 j: P3 n* W% { - static int ccnt = 8;% P( T5 P/ b, k, ^
& O" T3 q3 D! ]0 o1 U- module_param(acnt, int, S_IRUGO);6 M( ]# ?- N- C# |. v
- module_param(bcnt, int, S_IRUGO);
2 w6 e8 t0 [7 N" N, G$ \" O - module_param(ccnt, int, S_IRUGO);
复制代码 ' h/ Z& J4 w! R0 q
" g2 ~. P) B4 c, Z% R6 {9 t9 a: c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ J1 G3 v2 o, T: y/ C" j K4 e* g8 warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 c) Y" N: G* R: h" w8 N3 h+ |2 ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ c7 C& ^3 w% S7 g. B/ y2 D. Y
' H; k. _! O) ]) a/ B5 F
; b$ `1 c* w0 P |
|