|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# d1 _7 C7 f' ^ w- [code]EDMA sample test application8 {: x; R q1 Z8 P
- /*
. ]5 P7 B: K" G0 [9 ^ - * edma_test.c
) q+ k) `& S0 x7 Y0 z# ^% @ - *2 R! `2 r b+ `7 }0 C# ]
- * brief EDMA3 Test Application3 W& F6 {4 H, d; Y% S$ q
- *
# @& w. L& ?4 {* @( h( P' { - * This file contains EDMA3 Test code.
! i* N7 e6 X! t# A f, l - *5 ^0 l2 _7 e+ ` }6 i1 }7 D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! ]7 p% r: j# t8 |6 c1 t7 W* x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 o( j* i$ k) } A* u - * TO CHANGE.- j+ `& ]( w1 ]4 J& d
- *
8 @8 ]$ v w7 I f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; k3 M6 M* U" k$ J) U: W
- *, J4 |8 S% Z( W0 \* V% v
- * This program is free software; you can redistribute it and/or- W% i2 t1 j& w; {7 X ^
- * modify it under the terms of the GNU General Public License as
$ O# S! U+ { |9 Q6 b2 } - * published by the Free Software Foundation version 2.
9 e) Y7 K7 T) a* _6 Y5 S - *
, p0 f: r0 r. R- O0 G1 C) t9 o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ I2 I* r' H- z8 f1 I& D. l
- * kind, whether express or implied; without even the implied warranty& Z0 J. N( Z( s. \" Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 z! R- ?- J4 j' w0 {' P+ a' V - * GNU General Public License for more details.. U, q) m0 s1 d% P: H/ C9 @. q
- */
- I8 \; p' h- J6 s. m: V - # o4 r6 B% H' E; g3 K1 n6 m
- #include <linux/module.h>
' M/ |$ s1 w. x& y# m& [$ n, }7 z - #include <linux/init.h>
* p/ q; [" G8 Q, i9 g - #include <linux/errno.h>
, n+ V6 g! b$ w$ V - #include <linux/types.h>
\: X5 N" R4 ^/ P - #include <linux/interrupt.h>
: M0 c6 O. e# |! W1 Q1 U - #include <asm/io.h>
' P! V/ u5 C$ Q4 i" r9 Z. | - #include <linux/moduleparam.h>9 q$ E9 n; V" O9 A$ f. e# U, e, X
- #include <linux/sysctl.h>0 h" q3 q& d# i* |7 T) j1 A' c
- #include <linux/mm.h>7 x- A& |" `, N9 M" R( R; e1 @& R
- #include <linux/dma-mapping.h>
4 C# f5 A: e( i# R - ! E1 w/ ?; b' s9 ^ l; F& y1 j: ?
- #include <mach/memory.h>6 \; s5 }8 A1 w( c: A2 s
- #include <mach/hardware.h>- W# I- y3 `* q4 T+ R) U
- #include <mach/irqs.h>
: A. t9 \. P* U. _) ~ - #include <asm/hardware/edma.h>& e2 I) {: n ^2 l+ w5 Y, h
$ r' L% \7 J( [- #undef EDMA3_DEBUG; d' _$ }" a( {7 l7 ^( P
- /*#define EDMA3_DEBUG*/
! P) U& V1 m+ v
, d( f' I; d! p* \# p) t, ~$ G# d- #ifdef EDMA3_DEBUG! h( Q, F" D# B5 [5 H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 I7 L% x9 C9 t- ?5 Y2 ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& N1 g4 X" ~) q# [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- i" I8 ^' H2 B4 c
- #else
+ V1 ~2 J+ H3 K; u9 ^ - #define DMA_PRINTK( x... )3 L. G4 ?$ i0 E7 x* v. x
- #define DMA_FN_IN/ N) x! I3 j% p
- #define DMA_FN_OUT
# b; m* Z0 E& P. t! V6 [* ~ - #endif; w/ Q: x8 ^3 w- R/ Z
5 s% o5 x# |& d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 ~# F) D* y; Y8 i, x - #define STATIC_SHIFT 3
8 I0 Z B7 v8 H3 l - #define TCINTEN_SHIFT 201 m) S+ c$ M1 X8 J0 [( C
- #define ITCINTEN_SHIFT 216 s/ A% @; _- t b
- #define TCCHEN_SHIFT 22% w6 t3 ^0 o! n8 K" o
- #define ITCCHEN_SHIFT 23: Q' h* f! B6 J% \% S
3 W; r8 H1 t5 [( C% H& F: N) G- static volatile int irqraised1 = 0;
# D. ?( B2 M* D# a8 C1 {5 l' p - static volatile int irqraised2 = 0;
+ }, [- ] l/ s* N- G# f1 Z' q - 2 r+ ~% H" ~% a0 |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; n! @/ G9 S9 ]: r0 Z+ \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 j: c+ k5 j/ W5 W* D0 @7 j1 z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' s2 ]+ J% W' S3 C: `3 h% g6 z N
- + O! V I8 p% j* y+ I
- dma_addr_t dmaphyssrc1 = 0;. n7 {( P. V+ w2 |9 y
- dma_addr_t dmaphyssrc2 = 0;
' w: G1 @3 I8 B0 N! ~# w - dma_addr_t dmaphysdest1 = 0;$ I% v7 w& B2 h% Q, W' R8 Q2 i
- dma_addr_t dmaphysdest2 = 0;) P/ }4 y; z8 \" r
- ' K2 J# F2 u. z- _2 t# g8 M
- char *dmabufsrc1 = NULL;, X7 v; Y# d& Z3 h& H* t J
- char *dmabufsrc2 = NULL;
7 @) l1 k, W5 K" S - char *dmabufdest1 = NULL;
! e7 u. x, a( e" u - char *dmabufdest2 = NULL;* P/ @2 j! ?+ m2 Y
- 2 S: M" S0 R% \. a# i
- static int acnt = 512;
/ g& @7 T$ t) } r0 k6 B - static int bcnt = 8;6 ?* B2 I1 ^% Y2 e' ?
- static int ccnt = 8;3 b. a8 d, J# ]9 ]% B& R/ t( @
- {& R( ~, O2 I5 F- module_param(acnt, int, S_IRUGO);1 k- h! {2 W" P h, h, E" k* n. e
- module_param(bcnt, int, S_IRUGO);
* j( C" A" x9 O+ K& A! \* s - module_param(ccnt, int, S_IRUGO);
复制代码 $ b% r/ p8 z4 l9 l& H% Q
/ b! G( d; d0 ]2 m5 T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 d% ^3 I& x8 r4 J$ T% n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 Q4 F0 ^- d" f2 b/ Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( s' Z6 B& b3 k, ? W# Z. l
* t0 F* E7 w4 C0 J5 F* y/ K- i/ M
0 a7 h4 {" S! e1 p0 h/ W9 J8 n |
|