|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( E3 V5 ]5 m _5 C ?2 `- }% t
- [code]EDMA sample test application$ P" E* I& [4 G6 L% S( q6 Z
- /*
# E. e1 s' X6 b( \! \* G - * edma_test.c, A+ p: I4 T- t9 a
- *" B$ ]7 p2 P+ j
- * brief EDMA3 Test Application' G8 [, q& ~' @0 {
- *1 d7 M- m$ F% @' @2 m4 B: S
- * This file contains EDMA3 Test code.
1 l+ M. k! O3 Q- {" q9 N - *- O) q$ O. `1 k( ?. j( V o5 J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; Z) l) \# [' V" Z+ ~- Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 H. j w V) n# e( [% n0 D2 E! V( ]/ b
- * TO CHANGE.( c+ Q3 u+ P2 ]4 L! j
- *8 K; Q9 z" F* o. x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: j1 R8 _; Y8 x& O Z
- *
6 t5 r9 U* C& P - * This program is free software; you can redistribute it and/or& p2 F" s. a$ o1 Y) _ E% b6 A
- * modify it under the terms of the GNU General Public License as
7 f" t+ m7 l6 p5 T - * published by the Free Software Foundation version 2.
- T' }( ?1 r+ E# p7 E% }- T - */ R/ f3 B3 `; l3 b) z) Z- J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 b& O: a# X' n% o& Z/ \- i- I6 S" l - * kind, whether express or implied; without even the implied warranty: u B- R. _# D% n9 Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 a7 D% w) I3 z+ i - * GNU General Public License for more details.
) L# f8 K# i6 m$ h9 ^ - */' \- }) j% q: w+ w+ W1 D
* ^& y: ?' ^4 p8 y- #include <linux/module.h>
8 h: p. L$ W8 K+ r, \! \2 | j - #include <linux/init.h>
1 }* s& I# i3 f2 ^0 h - #include <linux/errno.h># D/ t( H+ l' m% ]! E" V7 E
- #include <linux/types.h>7 i6 ?1 P- ^. ]! @/ H: G6 B
- #include <linux/interrupt.h>) G& D/ L6 D1 k
- #include <asm/io.h>
1 j; P- D# F# v0 W: M0 y - #include <linux/moduleparam.h>
" D3 p6 @% i D; w3 ` o$ N W2 Z - #include <linux/sysctl.h>
' ~0 E! q$ D/ p* g6 U - #include <linux/mm.h>: J2 A: C9 J- e$ L
- #include <linux/dma-mapping.h>
4 F ^1 G X H, D8 _: j1 Z: E - ) F+ L9 t0 _" g: a
- #include <mach/memory.h>+ U% C% L) z# t: u+ `' v
- #include <mach/hardware.h>9 F0 @6 [$ j( Z$ {$ a& ~9 G$ V
- #include <mach/irqs.h>
+ X5 s \9 {7 _ u, X% O2 [ - #include <asm/hardware/edma.h>/ |4 F2 _/ v/ O5 ?( O4 i- l9 K
( M4 r) d; G) g/ x6 l- #undef EDMA3_DEBUG
~( {# s! M3 i( S - /*#define EDMA3_DEBUG*/- k6 [( d6 L8 c4 E0 N
- . _" u- _) g" g* w' x9 V" o3 @2 z
- #ifdef EDMA3_DEBUG
" y o4 k+ y8 h3 X0 T1 |7 g: y# b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) Y) d. n8 w/ y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 u, k% |( {- D( f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ k1 n1 I i2 g) T: \2 c6 G0 A; S - #else1 s, Z6 }$ M: `& [5 n1 k, C
- #define DMA_PRINTK( x... )* ^1 |" c' X$ U6 E' ?
- #define DMA_FN_IN( Z, c0 c0 ]7 J x# f) B
- #define DMA_FN_OUT7 H# `0 T. T4 t, R
- #endif
% X0 z j2 Q; q9 b& r/ @8 p
1 s/ f6 L- w4 e$ x, V+ S4 G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
U6 J0 M, }( Z - #define STATIC_SHIFT 3( ~; ~0 J9 f: _; w2 H+ e G# v
- #define TCINTEN_SHIFT 20
6 i( t* X2 O) }5 o% j3 O% ~ - #define ITCINTEN_SHIFT 21
! n+ _# Y( F3 Z+ e - #define TCCHEN_SHIFT 22
+ x. l* Q+ n, Q; d7 K - #define ITCCHEN_SHIFT 23+ e0 w! ?2 L. ?; Q: Y/ e5 E N9 q
- : f+ {8 B Q2 J) I& g2 B$ Y. U4 |
- static volatile int irqraised1 = 0; I: v! T% S$ B7 D
- static volatile int irqraised2 = 0;
$ T- Q) l, T* E' n7 m9 N
C* x+ w7 i4 r1 Z; I" ]8 {5 B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 V$ |1 i4 q& w: P: U) c$ ?$ O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. e8 n& }8 y; e6 R: h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ]" k$ k% z* j( O; w, K! h) X2 ]
- " M; W4 C0 V: g% m. x0 F
- dma_addr_t dmaphyssrc1 = 0;
# D1 S; R6 m1 _* _& N f" t - dma_addr_t dmaphyssrc2 = 0;" b8 I w" s$ q! _8 V
- dma_addr_t dmaphysdest1 = 0;
! C+ e# [( [$ R8 z& w. a - dma_addr_t dmaphysdest2 = 0;
$ J+ ^; n9 M" B
]/ |/ q, ^! c) q6 ^- char *dmabufsrc1 = NULL;
0 B e+ @% ]; _' p. q9 Q' H5 t - char *dmabufsrc2 = NULL;
3 r& z/ [2 A. m2 J n* V$ O - char *dmabufdest1 = NULL;
( L$ n- `8 ` q; I( p/ z) ?6 x0 o2 K - char *dmabufdest2 = NULL;
8 g- Z8 _% A: T* E - , [! `) z2 H" r2 J+ C. f* Q
- static int acnt = 512;( Y {8 @( b& }' D
- static int bcnt = 8;
: r2 G9 r. t. `( e, E% s/ A - static int ccnt = 8;# d8 T& o- f! F' N* {
- / j5 N, m+ W$ E& L# h. [7 X8 s* \
- module_param(acnt, int, S_IRUGO);
`2 X& F2 r' {6 R6 S# l - module_param(bcnt, int, S_IRUGO);
" _. W' ?6 {# o/ t - module_param(ccnt, int, S_IRUGO);
复制代码 ; G( P; f: v6 L5 b! R- j! ?
7 n8 k" |6 h( G" [ ?7 d0 V8 o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! Q# Z; d1 R% Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 z: X; |' Z/ s; }, X5 v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; m$ j/ C5 F' G( {$ T
. {/ G( Q; K' x9 Z3 L" C
% N. q C5 c/ K( B' u' T0 `" A |
|