|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 b4 L5 L7 ]4 r! v% K" E
- [code]EDMA sample test application
M/ P# z0 E" I0 I - /*4 t8 C$ H7 J2 S6 a( t3 P. a
- * edma_test.c$ H1 O5 l4 t* d
- *
$ b& m" x& I/ `1 O - * brief EDMA3 Test Application
0 s0 E3 E# o$ U0 E+ @: z* Z - *
+ `# F; x; M' l - * This file contains EDMA3 Test code.
1 q- z$ O( N) f3 k0 \% B3 e - *: ]# u% m8 H& |* d P2 `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* k- n! m$ s- y/ n$ H3 @$ U( S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 s' E* l) H. a. w& P - * TO CHANGE.& J3 q. ]. H& _
- *
! p3 Y+ F5 ~, l5 h: m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 s% |9 e3 ]' I% H% t - *4 |8 {& {2 d# o! k1 I( y8 r
- * This program is free software; you can redistribute it and/or. C( n! o2 f: |! I. R- v- U" C
- * modify it under the terms of the GNU General Public License as( m" {3 M2 S+ S! O" j% _# {. a
- * published by the Free Software Foundation version 2.+ W* g! k! [- V! C9 N6 g0 C |* S
- *5 E9 |4 [9 b, l5 s% b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ l Z2 B8 {& ]% I7 b% B - * kind, whether express or implied; without even the implied warranty
3 Q4 S$ b7 ~; e9 y7 j* u9 D6 m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: A; U( S' T! u. q$ y/ v8 @/ W - * GNU General Public License for more details.3 y; Z6 y+ i: K$ o3 Z5 }
- */
5 h5 S5 _2 V7 Z1 L5 g
3 E7 Y, W) a' L, {4 v8 x- #include <linux/module.h>
% r% y, n) B- K6 W/ f! g/ g o - #include <linux/init.h>; H: G/ R9 Z4 m: m: |9 ~5 a+ G
- #include <linux/errno.h>
7 U$ G% o/ T K; z8 c4 O - #include <linux/types.h>
& Z: ]: V* ^2 _) b( M' ]: k% d - #include <linux/interrupt.h>
# Q& x8 G/ I. N5 b( r( R - #include <asm/io.h>
# r: y2 g" l$ ~" U% s! c2 `8 Z - #include <linux/moduleparam.h>
3 o# g4 ~" O9 S8 @ - #include <linux/sysctl.h>4 m; R$ l' i5 \7 D, [0 z& c3 U
- #include <linux/mm.h>7 h! G6 F, u* Y% r. ^
- #include <linux/dma-mapping.h>
5 H2 c( z$ H/ o7 n+ R* Y
$ e6 s5 Q6 K& X1 U- #include <mach/memory.h>
! K7 {# r& t3 O5 K1 ~2 x( g! w - #include <mach/hardware.h>+ @6 ]- v' a8 t. u N: s. z( p
- #include <mach/irqs.h>& |2 j X/ Q c% }( h
- #include <asm/hardware/edma.h>/ U& g h1 {9 z- K
, \+ e t* O1 ?- #undef EDMA3_DEBUG" c" O8 n: G2 D$ U
- /*#define EDMA3_DEBUG*/2 U8 x+ w% |) [0 F) f8 @; i
- 2 K& H' ~7 j7 Z4 ]& O7 C
- #ifdef EDMA3_DEBUG/ T# e$ B& B3 Y, F6 X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' Y5 s( e6 q( @0 D( E l. o* C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ S& ]7 |1 M# ~- g3 S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 P# n9 d* y$ c: _5 Q - #else: Z( j0 A- C; q0 `
- #define DMA_PRINTK( x... )) ]$ l0 F- M" B
- #define DMA_FN_IN2 z# z0 Z+ O7 w! S! w7 K8 I0 D7 I
- #define DMA_FN_OUT: g2 M) ~( U- a7 T1 | P: O3 C
- #endif
( F+ c- O i) G' ]7 e
) w, ]- i8 P: f& a1 J% M' G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" O$ \: \2 o" m( G2 j4 b - #define STATIC_SHIFT 3
# v( @; k7 ?$ a - #define TCINTEN_SHIFT 20' l3 S% q5 t4 A% M1 U( N5 Q
- #define ITCINTEN_SHIFT 21
* |5 U( \' z) A0 n$ | - #define TCCHEN_SHIFT 22
O: V6 X+ U6 ?& W) j8 }4 v - #define ITCCHEN_SHIFT 23% C' I o1 }& W3 s& h
8 } N- r) z7 _( s# c* p- static volatile int irqraised1 = 0;- M- |6 d" Z& }( H
- static volatile int irqraised2 = 0;
" q3 C" U) @: S; C - * f0 `5 w: s8 N5 N+ o9 [5 H8 r: q" W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, l4 s, w' u f- A* M O7 N3 x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 w: X& J* k; ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% F* Y2 E8 @/ l( C
" X2 l% R0 i C) Q- dma_addr_t dmaphyssrc1 = 0; T- C- U( v, G; }! Y
- dma_addr_t dmaphyssrc2 = 0;
2 d# z2 z3 {* d0 M2 a' G4 p( A - dma_addr_t dmaphysdest1 = 0;
6 n7 s% O1 ~0 e' o - dma_addr_t dmaphysdest2 = 0;
' D/ u d- u" s3 w! w+ k" E9 Y( q - % I! ^' R x+ A( n) R. m% q" P
- char *dmabufsrc1 = NULL;
( Z3 O0 ?# k) X3 i - char *dmabufsrc2 = NULL;; u3 R# G$ S& A: v o' K$ X o
- char *dmabufdest1 = NULL;5 Z. U5 E6 Z; k2 e! I) j, d
- char *dmabufdest2 = NULL;
; z C6 W% j O* v - 8 p1 U9 }5 V5 j- ]0 A. K
- static int acnt = 512;
% M! F6 L0 T B3 I* t - static int bcnt = 8;
5 G' P; w$ ? ?6 E+ f/ e - static int ccnt = 8;5 S; q3 m. b8 u" ~$ i' o8 T
. N9 N% W( @* @" w+ G- module_param(acnt, int, S_IRUGO);$ {" w5 d! j s: D0 v5 K
- module_param(bcnt, int, S_IRUGO);
* Q% k% W" v- q: e1 R: L- o - module_param(ccnt, int, S_IRUGO);
复制代码 + v: D2 z6 D, o& G
' \7 B. D6 Q* Z5 ? T+ O8 ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ [( V5 e0 L+ U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 I. a7 P% c) ]: J3 m* k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" M Q: z4 n- a8 _3 `% P
8 ~9 K, Y0 _# U" y5 j# j, r9 l4 z: C8 t" `9 h: L3 G' p9 |6 W
|
|