|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ Z/ l2 f+ {2 n+ A- [code]EDMA sample test application% I# G5 u) q+ {0 O3 w% h& A# {
- /*6 [/ M5 D2 d0 i! n+ ?5 e: F
- * edma_test.c
" n7 N* X2 O+ ^ - *
1 w) P7 J/ F: n5 l! ?7 b - * brief EDMA3 Test Application* Y" A" [4 ]- ]# K
- *
3 m3 ^/ M& u$ _& [0 u- Z5 l2 f2 i - * This file contains EDMA3 Test code.
5 b% J8 P) L8 n - *
5 O7 _. K# g" g7 L" o5 X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ `& E$ g s' i9 g9 J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 d f9 D& L5 j( x( \
- * TO CHANGE.
. C3 A' m4 Q& m8 d - *& t/ P. [" g9 W. J* s0 Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 j6 F* t% g) _9 x6 p7 h
- *4 K; c/ O! n0 v1 j. [8 r
- * This program is free software; you can redistribute it and/or- E A) e ^) H& ^. u& j) Q6 S
- * modify it under the terms of the GNU General Public License as; n( H) I7 Q: X9 w0 X8 ^7 X& o5 K
- * published by the Free Software Foundation version 2.
& p- H6 U' R- F' t3 U2 | - *8 v/ O' Z" N0 m @1 G% B1 X2 D E* M- e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& r# W# l) S9 d* | - * kind, whether express or implied; without even the implied warranty
* }" X' k4 c% V( F9 L) \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- o2 P1 I5 O3 T, j; j
- * GNU General Public License for more details.
! W, ]7 s1 U1 d+ ? - */
1 C- O3 C6 a& w) F& y - * U7 [* l0 k3 R7 D9 n
- #include <linux/module.h>4 Q. i( a+ A2 e& `
- #include <linux/init.h>
+ V N8 i, j" Y( n7 X - #include <linux/errno.h>7 W( o0 y: r& B- d' E8 z) D- Y
- #include <linux/types.h>
; K8 n# _4 |% i- I3 n& A - #include <linux/interrupt.h>
8 k; T ~: l8 A% M9 ] - #include <asm/io.h>
5 z0 c3 z0 H" B - #include <linux/moduleparam.h>. Y4 @' X, _7 z! S) z# L
- #include <linux/sysctl.h>
8 I1 [% A. ] }( I" M - #include <linux/mm.h>. F* v+ h0 N+ {% N$ y7 g9 B* l
- #include <linux/dma-mapping.h>9 E: R+ M0 g; \+ n9 D0 W0 \) ]0 s4 E2 O
. b8 U( J. m" P8 _4 ?$ L- #include <mach/memory.h>
+ d( d/ i* R5 d - #include <mach/hardware.h>
7 P2 C& A7 A% t. v' d' {- ] - #include <mach/irqs.h>
$ A8 l" ]1 W- s& i9 O2 C - #include <asm/hardware/edma.h> w8 f6 b) `+ w6 A3 y& z6 {
! v5 V8 b: M$ y {; N1 t+ e- #undef EDMA3_DEBUG
5 T7 H: _0 ^8 w/ y6 G: `3 X" | - /*#define EDMA3_DEBUG*/
. V7 E, ?5 o, @3 p x6 J; |6 [9 K
; S7 o* I) R/ r! \- #ifdef EDMA3_DEBUG
# {( X, _; P3 W0 B' P& q; D m: r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: h8 Q; ^0 e4 F. F6 T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 c7 n V- o9 V, c3 a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 k% K( o/ o' p% R" K, a. ]) B9 m6 o4 H/ G
- #else1 Q. {- J( `1 H2 o
- #define DMA_PRINTK( x... )- u# w0 w9 R, y+ y9 b d; Z3 Q
- #define DMA_FN_IN5 z0 N4 G- R8 H4 u
- #define DMA_FN_OUT
9 r, w, h6 a& E! t) _ - #endif% ^' N1 t5 s* m4 {
- & s" n& q8 L( I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 y0 U) A4 ~" [) F+ V# {3 x - #define STATIC_SHIFT 3- a2 u) p! W- y Q8 ^
- #define TCINTEN_SHIFT 205 s5 d* Z+ h- l' }0 w4 k7 G
- #define ITCINTEN_SHIFT 21
5 Z2 p: O; s( g9 V - #define TCCHEN_SHIFT 223 ~7 F( O1 h% c5 m9 ]/ M' q
- #define ITCCHEN_SHIFT 23: A5 ]! x. e' s( ^: ?, A
- 9 t) f5 L0 F" }8 a: `& t5 d
- static volatile int irqraised1 = 0;1 A; i) {; G" B
- static volatile int irqraised2 = 0;
( S! H" g( q8 q4 Q1 j2 x( C+ j0 z
( [( W x& |" Q4 _5 E5 j. E R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" V8 p \/ a1 E8 `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! j( A" I" q+ G) Q8 m, B$ x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ K0 _. q4 s% b7 u
2 W) `/ Z3 ^' J* U/ i; ~+ K- dma_addr_t dmaphyssrc1 = 0;
% H7 }5 c3 j7 P$ ` - dma_addr_t dmaphyssrc2 = 0;! \8 X4 \: E. T: {" K
- dma_addr_t dmaphysdest1 = 0;6 E/ j7 @8 C- @8 r( n
- dma_addr_t dmaphysdest2 = 0;
0 F+ Q# j# c7 t& T1 H# F; |4 Y
8 g: s! R+ {* {/ u: ]/ a0 S% A/ C! q9 {+ i: ?- char *dmabufsrc1 = NULL;
# R8 c2 V) ^6 [ K7 J: M P" F - char *dmabufsrc2 = NULL;5 e- y1 T4 S% ~. e& [9 _8 u$ [. u
- char *dmabufdest1 = NULL;* Z7 s- d3 i$ S( `, f; k, V* r3 E
- char *dmabufdest2 = NULL;5 u# W# J- K0 F0 w1 l
" Z2 d% [( h- G& e) a! E1 H) F- static int acnt = 512;
* A4 `! f. K1 j2 P - static int bcnt = 8;
! Y, x, G+ f5 h3 P& Q/ P - static int ccnt = 8;
. ]4 C; i2 @: J5 _# O - 2 T0 Z6 b" f+ H& k8 h9 q* S% v
- module_param(acnt, int, S_IRUGO);
; R; s$ R7 w) X - module_param(bcnt, int, S_IRUGO);
; z9 A9 S7 g' q1 ?7 j7 y) { V - module_param(ccnt, int, S_IRUGO);
复制代码 0 M5 S/ f/ F( r* e- g! w/ E Q* l
% u; K9 N* W4 z& P& X0 }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ l K B4 A6 w: p2 s" Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! O; [; t. Y! G' `8 Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 ?# v k8 i( @" l6 e# O) E7 z8 S0 }3 F( D
9 I: @) R9 T6 w2 X- \
|
|