|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ n, a# L0 i/ `* i* ~7 q. e# N- [code]EDMA sample test application
% u$ O5 u( V$ W, P% { f - /*7 r2 p/ H: O0 a V: H: J
- * edma_test.c6 j* z9 T7 s$ E% N+ R# |, R
- *, b. b# g; F% |2 h' b
- * brief EDMA3 Test Application& t! M6 ?" Q. V% E! a6 x
- *0 A. I* Q9 R" G4 H- f! R
- * This file contains EDMA3 Test code.8 n8 e% m, m' c1 ^7 l0 [
- *+ i \9 ]8 D K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ a, p1 m/ E) c6 p0 s' v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ X. O7 O9 {7 k! i: w8 p9 S
- * TO CHANGE.
( L3 ?4 d! R1 D, B2 G, a5 W - *
2 _# f3 J) Y5 P' \- g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* u0 W; w; S1 E5 n+ q" [ - *' O' m; k, Q2 r% L; y" }
- * This program is free software; you can redistribute it and/or
) F1 T4 C4 B1 w4 E0 P# A - * modify it under the terms of the GNU General Public License as
: m. f7 Y" a+ h) I - * published by the Free Software Foundation version 2.2 \ \1 `- T+ v: \
- *' }6 V) w0 H8 [+ t* ~' y* u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, f& y4 g/ n1 ^0 b/ A1 \
- * kind, whether express or implied; without even the implied warranty
3 p3 Y1 p$ f3 ~- M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! S. ]# y2 L0 E% G/ `5 G) ]
- * GNU General Public License for more details.
7 Q. B( N3 c& A5 Y7 @3 h - */* x( d; L. s9 f. g! g
- % B" d* _; x# p3 Q7 t' U
- #include <linux/module.h>: q7 U0 ^0 ?3 b) [
- #include <linux/init.h>; k0 r/ h0 G( f% m
- #include <linux/errno.h>7 l! a4 v, R9 H( S4 x
- #include <linux/types.h>
5 _/ f* \3 x: P" b) L+ x2 v* o - #include <linux/interrupt.h>: ^& ]" @6 D5 ^( h
- #include <asm/io.h>
. M& N( G1 A! c5 U6 W# v R: v! d) _ - #include <linux/moduleparam.h>
( _1 a: L) h' \& D- f2 N - #include <linux/sysctl.h>( F5 Q, u. _# x. p* e( c
- #include <linux/mm.h>+ L8 V! w- b4 n8 S) }3 ~3 v
- #include <linux/dma-mapping.h>
# c8 o3 Z2 [5 `2 r u8 N3 o - 4 N/ j1 o5 {5 p0 y$ N
- #include <mach/memory.h>$ c1 L' i/ m$ c6 T) H8 a, k
- #include <mach/hardware.h>: `0 S; m; p: s. d3 E! h* u
- #include <mach/irqs.h>) k z5 @- H8 p7 s+ d
- #include <asm/hardware/edma.h>$ Y y' b5 J9 n8 z1 L- a* S
- * m( c% N6 U4 b* l9 e
- #undef EDMA3_DEBUG
( _2 A$ Y; k! p( _: }" i - /*#define EDMA3_DEBUG*/9 P m6 [4 p/ K. g- R/ k
( u$ b- R; D& @5 D% A+ M- #ifdef EDMA3_DEBUG. G: l9 a' L1 F' u) @' K. ~, a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ t$ |. U, K, B/ v5 [* F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# U5 M6 s H& B; @* Q& J0 j) Y& H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 \) b: r+ p) ~* `9 Z
- #else
8 S6 z, U- O6 P - #define DMA_PRINTK( x... )
3 N) x: |- |( b# g$ f - #define DMA_FN_IN; B( k0 R7 c* S2 @1 u# P9 |
- #define DMA_FN_OUT5 y3 a3 i' o4 y3 f2 y" q3 C7 Y
- #endif
6 A5 f" k v; j8 Z% T& d
8 t6 ^* Y* S, r6 U" J7 |, L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 Z) s# @! d. Q# x1 P" g - #define STATIC_SHIFT 3, |: }, a( h' m b, C* Q( V. K. d
- #define TCINTEN_SHIFT 20/ x0 T# o2 D( y" T* Q
- #define ITCINTEN_SHIFT 21
& Z& b+ F( k5 c - #define TCCHEN_SHIFT 22
4 x. K9 S4 N1 \" v$ a& N - #define ITCCHEN_SHIFT 23
5 U; _& _9 z8 s - # J2 _+ e- N0 M6 _! y3 {
- static volatile int irqraised1 = 0; J2 u3 _1 k, k: ?
- static volatile int irqraised2 = 0;8 q% b5 ?; @' {3 d2 Z, P# l9 g
5 E( m" y) e$ v, T5 j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 b7 r0 S9 E$ A# @6 Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# j/ _* A: L5 l' w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); }# C* ~* f$ H# g5 v
- # H2 H# C- x9 {# P' S$ V/ B' T
- dma_addr_t dmaphyssrc1 = 0;
+ p' w+ E! V* H8 m+ ? v8 p - dma_addr_t dmaphyssrc2 = 0;
* M, a+ x( L( D" t M' ?* A1 j1 E+ y - dma_addr_t dmaphysdest1 = 0;8 S5 @' N" K# r% c, I# \/ J% i
- dma_addr_t dmaphysdest2 = 0;, S( s# S% J1 w2 U3 N- y
- 9 ]2 M/ ~+ S; G& G* p/ q+ R
- char *dmabufsrc1 = NULL;4 W* |# V1 A* |- M3 N3 Z0 M
- char *dmabufsrc2 = NULL;4 E' G) L0 G& Y: h9 j* _
- char *dmabufdest1 = NULL;! I; H) a' l' }+ e$ s6 ?
- char *dmabufdest2 = NULL;
6 @9 w5 P+ _5 m) v5 l1 x1 _
! B+ [+ }7 \* A. x' q: h ]4 m, Y4 I" c5 g- static int acnt = 512;
" U/ w% r) J" Y$ A - static int bcnt = 8;4 ]) q. b; }) N# O: F: N* F
- static int ccnt = 8;
1 g- \! e- a$ T7 V, m* H1 G
Q( C5 f( B. R5 w$ [/ R- module_param(acnt, int, S_IRUGO);: R5 G z8 k; o0 W
- module_param(bcnt, int, S_IRUGO);
. ^0 J- g5 q. o# I x0 O - module_param(ccnt, int, S_IRUGO);
复制代码 ( T, a' d0 b! F0 u; s5 \
& x; m& ^6 Y% _, u" R+ \- f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% ]' M' }9 Z& I
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 h Z1 l9 J; c0 e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 i) }( X: l! `4 X, L7 }
$ Y% v* \7 o" Y8 B/ q3 Q3 x# ]* j" n/ W8 N6 X2 l! m3 N
|
|