|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
`$ N0 ]$ F) y3 ^) ]- [code]EDMA sample test application
: R+ d5 X" n# L0 y - /*0 F) m. R) M! h, H; o% w' Z
- * edma_test.c* ]+ z2 z2 o z Q' X* I* H; S4 \' d
- *3 I" g+ i* D- u4 s$ U V) l& {: R
- * brief EDMA3 Test Application7 v6 C5 U9 ^# X* J% s% `' I+ n
- *' M0 @6 G0 N8 m% K8 @
- * This file contains EDMA3 Test code.
: n* v6 a7 Z) k- @) K* b - *
! \2 g! o- H3 j0 f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. n' [! ^* Z& b- F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' { P* ~, h* ` w
- * TO CHANGE.4 [; T% W& k8 ^; X1 h) S
- ** N9 u5 Z) _6 Q$ k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& r5 W4 E0 K( d) |0 W5 P - *! Q+ f& C# K3 k2 R
- * This program is free software; you can redistribute it and/or
6 A7 P. A, _2 U& C: y0 {9 `0 ? - * modify it under the terms of the GNU General Public License as' [! j1 p& ~& i+ s. N' W" i1 S- |
- * published by the Free Software Foundation version 2.
9 h/ f8 C, z5 k* ` - *
1 B0 k' S( g$ i$ ~* f1 u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# i) C+ s7 o& r1 r - * kind, whether express or implied; without even the implied warranty
5 c0 o) ], S' x# c& K" ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 o. V6 J, J! m/ m, N0 D$ k9 T - * GNU General Public License for more details.
; v$ E7 y1 u# R! R - */
# i/ P% q& b3 j, T' f6 r
& [* V$ Y& u) s* c0 C1 F5 }7 |- #include <linux/module.h>
2 G9 c) q0 Z8 E) o' h$ @; _" O- x4 p: T - #include <linux/init.h>
; H, w' }4 ~9 x6 _$ D% x/ c - #include <linux/errno.h>' m" \9 l* s% o4 N
- #include <linux/types.h>* @* Y" o$ N' F9 G. f- M7 Q
- #include <linux/interrupt.h>( [9 A4 i2 M' Y
- #include <asm/io.h>
7 ^$ v7 o0 \6 a/ \ r9 r. L: o - #include <linux/moduleparam.h>
, @8 {4 t1 C4 S$ j b - #include <linux/sysctl.h>. B' x/ [# e2 v1 d! J
- #include <linux/mm.h>2 A; g. x3 |' y K
- #include <linux/dma-mapping.h>
/ V2 ] i4 D" z9 e1 m0 J( B - , R* f* M- C" a: u u0 ]
- #include <mach/memory.h>2 X3 w( B1 U0 r5 \ g
- #include <mach/hardware.h>; l9 F( G0 s; ?5 x/ }3 ?: X. Y
- #include <mach/irqs.h>) d. m0 b$ g: p
- #include <asm/hardware/edma.h>
1 h) }; q. I# ], M# o
* j& P3 x* }. c* S1 p; k1 D0 S- #undef EDMA3_DEBUG
+ y9 ^- n8 n* t$ o& i - /*#define EDMA3_DEBUG*/
: D" q; ~# i% ?9 _% W: o
. {' t' ]( S- v' V5 W6 o- #ifdef EDMA3_DEBUG" o0 i' \5 K! b4 [4 x5 _' l9 c3 O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 [ I7 z. S% m i) \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) ?9 F/ }) ^) N' M9 }' ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 x' L8 F$ M, h# V0 m: c# \& c - #else
- m" H& ^( M3 \* u% ? - #define DMA_PRINTK( x... )7 t/ S" f* g5 A
- #define DMA_FN_IN, x; X1 o% c, N6 @( J d9 o
- #define DMA_FN_OUT
& T) K6 C2 k1 W1 Y) }) j - #endif8 S9 Z9 y; E, e7 U/ t- T
- & v5 I, I7 w! v3 [ g+ a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( o5 G0 N$ ]3 n% j2 U6 E% r - #define STATIC_SHIFT 3 j0 P! u A K' H' y: k( r l7 a
- #define TCINTEN_SHIFT 204 P' C2 \ K+ l
- #define ITCINTEN_SHIFT 21: K1 Y y+ O' z4 ]- w+ b7 h
- #define TCCHEN_SHIFT 22
/ [& Y; u2 d% A - #define ITCCHEN_SHIFT 23
2 |% f) P; k4 ~8 l$ s' F) G - 9 r+ {0 D7 }# S5 q
- static volatile int irqraised1 = 0;
0 Z: L: X9 H0 ]& m* T/ X" y - static volatile int irqraised2 = 0;
9 Q; j& f6 T. w( D6 n9 S
$ [' ~$ T, I& ?3 g" O- e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 t* q' l0 w# q# X K+ `9 a0 i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% }1 h; p* @* d4 ]- m1 ~: p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
w |! T& n# c- G - 2 N$ } @' Q# K+ a" N( k
- dma_addr_t dmaphyssrc1 = 0;$ T' p @' U" y- E% i
- dma_addr_t dmaphyssrc2 = 0;* s& B3 ]2 \9 o9 k7 N( M
- dma_addr_t dmaphysdest1 = 0;! w7 a; u1 @7 V7 H5 |/ H
- dma_addr_t dmaphysdest2 = 0;
2 o9 J P% {" ^5 q: _; H" A - " f! u m1 ~" D
- char *dmabufsrc1 = NULL;
; P/ y: A! T$ s- t ~% X, }% }0 F - char *dmabufsrc2 = NULL;
. i/ g/ A9 T; F - char *dmabufdest1 = NULL;: V/ L: j9 _" X3 a/ \
- char *dmabufdest2 = NULL;
4 |- H' V+ o& m - - K& [( f4 B1 r o2 N9 n( R( g0 F
- static int acnt = 512;
* S2 v5 @' X' X& C* I7 J/ e" ^ - static int bcnt = 8;* V7 }9 S9 [4 X( B
- static int ccnt = 8;
; Y3 C& D8 W3 F) U
$ F% L" `1 [- N3 p5 y. B! m9 F( K" c$ Q* \- module_param(acnt, int, S_IRUGO);4 o: X$ E- G, y! O- \% H: d- d( n
- module_param(bcnt, int, S_IRUGO);
2 r/ L( ?( _. o5 g - module_param(ccnt, int, S_IRUGO);
复制代码 ; {- J0 _% g7 j2 J) N7 w
, }$ E* [8 c& K% D+ S$ @; z8 h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* a; X1 L9 R, l0 k1 q; darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* [5 }6 s2 W2 `; Z% L0 S0 | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- g* b1 {) s/ g5 G) L x0 E6 j; _! k- u9 l S$ W- w$ G& L' ^5 q& M1 }/ C
& d9 h9 l: _! C v( I6 }' x6 [' n
|
|