|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- T& d% u) i, \0 ^$ T$ ]3 Q$ d- [code]EDMA sample test application
5 G. I; h. v" s! S! U8 J - /*1 X* y* j6 e7 ~" R! R, b
- * edma_test.c
( Z( t: M1 X* M, ^/ V( n - *
# _: U- f% R* \( { - * brief EDMA3 Test Application
r; P5 d& ]7 o - * v% p( @5 }5 E6 L
- * This file contains EDMA3 Test code.% X; K& A" g! }! O1 |* N; o4 G
- *
/ v J: S3 y) N+ j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 i' O+ g! f0 K7 }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 @$ m! x. F7 o8 G9 U0 } - * TO CHANGE.( \5 r p% u8 E' e
- *1 x4 F- b, f( J3 R/ ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 R4 w( D4 O( I2 ^- Q, ~ z6 p
- *4 `( k5 o) S3 t# o
- * This program is free software; you can redistribute it and/or& i6 E+ M* }7 l% Q
- * modify it under the terms of the GNU General Public License as
0 Y' K& {, F, @: z) v; L - * published by the Free Software Foundation version 2." }! e& I7 [3 O h8 c) e
- *% k* P1 I( K9 [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- f) P3 {1 i& G0 t, r/ V
- * kind, whether express or implied; without even the implied warranty* m& ]& W3 ^6 D# w1 U7 q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% F- V2 }' ^( I, l- F, w& ~ - * GNU General Public License for more details.
; B& s/ w* f' `" N - */! A5 J" i2 k: T# r0 _1 ]# P. z
2 \: f: x! A5 j* q- #include <linux/module.h>
$ a% C4 N( o( Y& Q9 J - #include <linux/init.h>
7 ]$ c! [& y' [) D5 Q! t - #include <linux/errno.h>
# g; V: n. w8 j4 R4 I; ~# b8 W - #include <linux/types.h>6 ^# m' m3 L2 R! }5 h
- #include <linux/interrupt.h>2 q& Y8 Q* x8 H( s* S; `0 Y: y
- #include <asm/io.h>
" N1 @: n1 k" a# T" ] - #include <linux/moduleparam.h>
' v) Q! [: p/ N G' C- ~ - #include <linux/sysctl.h>
. w( F4 l: [5 a$ P7 r4 F' J$ E+ h - #include <linux/mm.h>
$ N. ~' O) {- k- a - #include <linux/dma-mapping.h>7 p# V- @- X7 |0 v' V1 o3 Z
. y* {, ?# L0 R; \& `- #include <mach/memory.h>
; G3 M& e, e$ A! |" _9 G - #include <mach/hardware.h>
. q* G& L, B) l [ - #include <mach/irqs.h>' L8 c" a: ?) p# B0 I% }3 x
- #include <asm/hardware/edma.h>
# V3 r9 j% x1 m" V4 {9 w9 x9 h - ) n7 r. g! y3 j& w9 T; V
- #undef EDMA3_DEBUG8 C8 n5 b; F7 c3 E( s+ j
- /*#define EDMA3_DEBUG*/
1 i& v) ?! c. ? \* U4 ^ - 9 A3 b' h- W/ u. b0 ]$ J( E
- #ifdef EDMA3_DEBUG4 m5 @7 J: G' @- M; {! Q) ^5 T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 x7 P+ R! A$ R- L6 P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' n6 J0 \/ ]8 `# N* m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' K) {, L3 F, [) Y
- #else
* l4 x, N; w' s' |0 {5 f, m - #define DMA_PRINTK( x... )
2 \. [1 a$ g+ n/ p, R5 |+ b8 g - #define DMA_FN_IN' v% H: q+ k' A( h3 Z
- #define DMA_FN_OUT. Z! M6 m$ j9 ~
- #endif3 ] G1 d" m9 ]8 E. b; M+ Y$ _' E3 M
- ; f" |% ~, u1 _7 D: P' X* E% l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 T! Z6 W' \5 p. D1 e. \ - #define STATIC_SHIFT 3. I, |* J' J0 D# O5 V* R
- #define TCINTEN_SHIFT 204 L: p( o( m4 B/ `, @. I- W
- #define ITCINTEN_SHIFT 21! c6 P( X. q s
- #define TCCHEN_SHIFT 22, V. u' ^% _1 L# F% c
- #define ITCCHEN_SHIFT 23
. p7 Y: |7 d, z: G- B2 t2 e
; B; p: ~9 f- `2 |1 w$ v- static volatile int irqraised1 = 0;
- _( r& T5 [6 i: V& D( N4 A7 C - static volatile int irqraised2 = 0;
" f7 N' x9 y9 I2 a# ~3 `* x - # V5 z; D4 n4 x; ]4 Q& x8 [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ w# P P/ H; R" d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; n! u7 q, j2 W9 m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 r# G) N$ J, i1 g1 h% D
- + U. o% W4 b: N
- dma_addr_t dmaphyssrc1 = 0;
4 k) o; ~3 w4 ? - dma_addr_t dmaphyssrc2 = 0;! y- k1 \1 d1 f1 c \6 _( t% i
- dma_addr_t dmaphysdest1 = 0;; R/ A( d2 k* ~5 r! y
- dma_addr_t dmaphysdest2 = 0;
" k2 f8 S% ?& j: k* x - 5 V. f& k, M6 I" U
- char *dmabufsrc1 = NULL;
9 x' o- ~5 g% Q# r, o2 V - char *dmabufsrc2 = NULL;3 P3 b7 u% _# z! _) o
- char *dmabufdest1 = NULL;
3 _" k$ ]" f/ r1 s - char *dmabufdest2 = NULL;: m( k X' P6 d7 m7 `
* I- m" a1 \5 f) E- static int acnt = 512;9 @0 q; P- F X! z9 k( K
- static int bcnt = 8;$ ]& u9 P4 q+ Q5 v" G
- static int ccnt = 8;
* L( e* P* \1 ]9 j - # a; ]& C5 S: l2 s8 T6 Z
- module_param(acnt, int, S_IRUGO);
, g4 k, J' c0 X) G( e! K! q+ k# R( I - module_param(bcnt, int, S_IRUGO);
" C* Y# ~+ h0 O" P" e - module_param(ccnt, int, S_IRUGO);
复制代码 & f" W( r1 Y0 A0 q$ m
! t! |3 }8 C% s4 d' {' a" ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- V" }! K; ]; k: qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( |, y" |4 I) Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& M2 }" \. e8 f6 A. L& u8 E, `$ [7 z# c2 r* {9 q. [( {/ v9 l
! ]' p% R7 @! V1 a
|
|