|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 V* U7 S( r7 W- ]' Y; N0 h
- [code]EDMA sample test application
! l- e6 Z3 w6 G; o' T1 S A g - /*; ^( ~* u2 ~" j: @' M/ D8 ~
- * edma_test.c
' ]3 l+ w$ Z: ^) f - *' N2 R0 k' \+ |0 M
- * brief EDMA3 Test Application
6 @: k( W* n: ]3 G - *
* v B2 v* X$ s/ _, A: W1 K4 Q( @ - * This file contains EDMA3 Test code.) F y& `% U1 |3 M! E q1 N
- *( r- q" \" I9 e2 u* _; J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 j3 V, B2 U* q- |7 |9 \0 T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 x6 J# X% q" ]+ k* H ] - * TO CHANGE.
9 _9 c5 E3 k& J2 L- m3 L - *; i: M- h* O- e4 Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 l e+ g' A/ P6 K' L1 s/ p1 W - *' H" _, W8 [& Q. T6 E" f. I
- * This program is free software; you can redistribute it and/or
% o/ H+ e# E6 [) v" G) R1 S6 e - * modify it under the terms of the GNU General Public License as
, Y9 G& f) v+ W$ {: P+ m - * published by the Free Software Foundation version 2.
: Y, E4 `1 x; _# V - *6 H5 k- X& F& ^/ u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& s5 `+ ~% \. t' v" f9 V& E: S, K - * kind, whether express or implied; without even the implied warranty
$ u$ L" L( Q& Y: g0 W. ^& H$ W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. Q# _9 z L, b3 N4 M3 y
- * GNU General Public License for more details.5 u7 `4 c E% [- n" n* O! Y$ v$ c6 |! O0 y
- */
: \3 n# [# ~4 I4 B, H - & H9 _# P5 t1 d; r' B
- #include <linux/module.h># |" B6 q- K( ]/ P( _$ N
- #include <linux/init.h>0 Q0 k& P' S/ Q" T/ @/ e
- #include <linux/errno.h>
- @/ @0 s( T: C - #include <linux/types.h>8 \ I* ?* a7 i
- #include <linux/interrupt.h> k- T* ^/ w( i/ e
- #include <asm/io.h>3 o' y, o0 }6 b) A: L! c. J4 Q
- #include <linux/moduleparam.h>
3 \3 ?+ E) ?5 o8 g - #include <linux/sysctl.h>
3 m- B' x! ?: n ^ - #include <linux/mm.h>
2 h. E2 m1 C' d* V - #include <linux/dma-mapping.h>
5 l, X+ h8 e# T6 F' c/ q7 p - $ W! U6 x- |+ `& v& x4 ]
- #include <mach/memory.h>, L! p$ o4 c, L1 v0 I2 |
- #include <mach/hardware.h>6 E: J9 Y" ^$ Y9 H C5 x* ]5 D
- #include <mach/irqs.h>
" H6 B5 T J A7 |, ?$ \! W- L - #include <asm/hardware/edma.h>
5 h7 ?9 w" [& k. I8 q
2 B% z, |& b2 [( n- #undef EDMA3_DEBUG
8 [ n6 K8 X$ e6 j# C - /*#define EDMA3_DEBUG*/
$ G" | c4 M4 Q1 Z0 h1 m0 Y
/ S2 h6 |1 r. D) z6 }; Q- #ifdef EDMA3_DEBUG+ r' v1 K) S2 f5 [3 L$ U3 T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). I3 N* K9 N' L9 S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 o4 V- d" q; V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 A% n Z2 j8 p" N9 F5 M
- #else
0 q7 Z4 j1 G9 J" B+ [- k6 y - #define DMA_PRINTK( x... )
0 Q' s, ]. ~ ?0 ] - #define DMA_FN_IN% }0 N4 z: f6 v/ G
- #define DMA_FN_OUT
. z# }$ E6 F' F% E- s. v - #endif
8 {, t8 \! U( w9 J
) u& Z% g2 v; X0 N; g |: n! |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ z2 E/ i/ P: J# g/ @
- #define STATIC_SHIFT 30 Q0 Y* }' d4 a9 [# c Z
- #define TCINTEN_SHIFT 20
`1 ^' f- m' z* M4 _* ] - #define ITCINTEN_SHIFT 21
. n. ^) A) X; t& H5 s9 L+ } - #define TCCHEN_SHIFT 22
9 c. A; Y/ |6 E - #define ITCCHEN_SHIFT 23/ {6 P& `9 c# ~( [0 d
) @( v! T3 g2 Q% {: h5 W- static volatile int irqraised1 = 0;* g5 H6 \; H$ o* ^; X! p3 S6 m1 V
- static volatile int irqraised2 = 0;
+ H- X5 A9 e( v7 k - * P% {6 e9 g+ P. T3 h. P% X$ L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 G7 e# M/ ^ s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 q5 n' ?/ F- G( h( e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
t& i- E- J5 \
j% Z$ y" v! z* ]& D- dma_addr_t dmaphyssrc1 = 0;
% W, c/ s4 X2 ~: p$ t4 r' r$ q3 c - dma_addr_t dmaphyssrc2 = 0;
9 x8 u/ X) b/ g" k: @ - dma_addr_t dmaphysdest1 = 0;! s9 |2 Q; f- {$ N& y1 Y
- dma_addr_t dmaphysdest2 = 0;
' x' B$ j5 J0 _* ?* }8 x; S! L - - m$ F; C5 L% u* i: `- z. j
- char *dmabufsrc1 = NULL;0 a9 A3 o1 Q) N: T. e
- char *dmabufsrc2 = NULL;
1 Y( ` R. _; ?' F - char *dmabufdest1 = NULL;
0 A* l% D! ]4 s! ~ - char *dmabufdest2 = NULL;( a1 J% B2 f7 V; I9 Y$ b
% J: C$ _5 p3 W3 ]4 n- static int acnt = 512;
/ c0 z( N0 S* T: ?( K0 g* C - static int bcnt = 8;! }' P t6 b: @: C( R% i
- static int ccnt = 8;
) f6 _6 }% x) e; t( M) b, |; |7 P6 r5 N
& T" `" C3 v3 H: m" o2 h( L- module_param(acnt, int, S_IRUGO);+ T! h, t6 W) [$ r0 E+ l7 _
- module_param(bcnt, int, S_IRUGO);
5 m* c Z8 `1 M - module_param(ccnt, int, S_IRUGO);
复制代码 - V2 Q" u. g+ q$ Y3 u5 W u
: e( E" `3 b- Q j- G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) X7 A) C! I; g1 c1 h7 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" q: e( }' h, s2 E) [ |- e. o0 k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* h" c" x6 C. K
$ Z& _) P/ J3 s7 _, p
7 i# n \! A T' M |
|