|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 o {1 t% E, y& H9 r- [code]EDMA sample test application: T0 M- M2 e6 x$ |/ G& n
- /*9 ~6 \1 B( S4 ~' a- Y
- * edma_test.c1 ?5 \2 t/ B* b8 ^2 o
- *( O1 R. D- x7 C0 e- c
- * brief EDMA3 Test Application
* A, H5 @- d" n* a& d5 {8 p - *+ a+ U" r- w( w1 A$ J- T6 _
- * This file contains EDMA3 Test code.+ q2 @2 T1 b6 g/ V3 [% Y+ C3 v3 A
- *: ^$ {9 Q. L) r2 F% s' x5 k0 d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! ]& o& m$ G( Y) f4 U. O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- W6 O& e& {1 n
- * TO CHANGE.' V7 \* q+ Z- @; T) G; x( \6 z
- *: [4 q# e2 c9 O5 A8 a- H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' ?1 F8 ^! T5 a' |/ H- M, V
- *' P2 {2 i5 y; A( a% @
- * This program is free software; you can redistribute it and/or
; x% t: C& h" y9 j4 ] - * modify it under the terms of the GNU General Public License as
# N: R" o0 ~& M& O% `" J/ L4 {5 o - * published by the Free Software Foundation version 2.6 G$ B; a! M e) g( D/ Y2 ?
- *4 u7 v# C: l, R1 c7 c6 s% h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: G: M& j# l; L1 x6 H - * kind, whether express or implied; without even the implied warranty& l9 D( ^9 N, H* {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 N4 y6 {3 e) s, P
- * GNU General Public License for more details.. T! u2 ~' h5 ~1 D9 @
- */
, b0 K. ~2 X8 T - * T0 ?2 V0 F( f9 x/ G
- #include <linux/module.h>3 k# v v/ q7 Z n; R' B/ s
- #include <linux/init.h>; @% ^) ~2 }% F" w
- #include <linux/errno.h>$ P0 d3 E0 i" Z; a4 @* b- E4 E
- #include <linux/types.h>( a( r, T n/ g" |0 o( X" A: V! c
- #include <linux/interrupt.h>
' i8 O4 B: X9 f5 Q2 c2 O - #include <asm/io.h>
+ j. I, U( v: t7 x" F - #include <linux/moduleparam.h>7 ]( x8 _4 S6 o, ~5 r6 @1 L
- #include <linux/sysctl.h> |2 S8 y7 ^2 Y# Z3 U8 w
- #include <linux/mm.h>
$ G" p* r/ x9 a2 S( ^% m. c5 U - #include <linux/dma-mapping.h>; X& y8 Z. r/ Q/ k) a
- ; K; w/ ]( W7 V. u( R0 [
- #include <mach/memory.h>
9 F; a, C0 p3 [ - #include <mach/hardware.h>
4 J: K0 j# F5 O3 T3 y8 Y! Y' a - #include <mach/irqs.h>/ N$ ~; I% M9 L$ T$ v
- #include <asm/hardware/edma.h>
, G1 N7 U* `+ y3 Q4 T' i* p9 ^ - % o3 J j0 ^) ~! l" S
- #undef EDMA3_DEBUG
( w3 a4 i6 r+ k P - /*#define EDMA3_DEBUG*/. j# K2 M( p( @' m+ S( W; {. ^/ l& h
3 k, p% [7 ~- Y {* q8 u- #ifdef EDMA3_DEBUG* A! p1 ]3 k: q7 ^4 `' V6 T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% Y6 M1 N! z/ b# z+ [& d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: Z- E2 s! R+ Z& C7 x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( ^5 _3 O) ]6 V0 [6 o; w& g - #else! C( i6 _; a: R$ G9 K8 ?/ z
- #define DMA_PRINTK( x... )
9 w: A0 I8 F3 n( u8 G1 r l - #define DMA_FN_IN
: x z/ o5 b7 ?5 D - #define DMA_FN_OUT
+ ?) v7 K3 g' H9 ?( s8 N/ }- W' C - #endif. M$ n( t5 w" U2 V, ^5 p$ H
- # [9 |, s j0 Y, O5 f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): J$ \8 C* `! t' d' R/ a
- #define STATIC_SHIFT 38 S( _# Q9 m& P- \
- #define TCINTEN_SHIFT 20
1 f& `2 ?2 D% S7 e: k' Y7 q - #define ITCINTEN_SHIFT 212 u& }6 F, o( V5 H# Z1 y3 l
- #define TCCHEN_SHIFT 22% T) y) p+ `0 B6 a
- #define ITCCHEN_SHIFT 23
% j( l. i: n# y) E3 `6 p* G! ^ - ( N' G/ G/ [0 V1 o- q$ C: a
- static volatile int irqraised1 = 0;
0 E! a a5 M2 Y! l - static volatile int irqraised2 = 0;
& k# `$ r( A2 i
7 n! k7 n1 M% G6 d& a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, a+ j( k6 H4 Y& O" e- I6 y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 a( k, }- w$ r0 P8 @% M7 D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 P! H2 X F9 I7 V2 k' f% ~
# |: `# H; j c8 L/ H- dma_addr_t dmaphyssrc1 = 0;0 J# I1 k2 b& `3 Z! Z
- dma_addr_t dmaphyssrc2 = 0;" P l/ e8 N; U" V% l# J
- dma_addr_t dmaphysdest1 = 0;/ B) S+ U5 I6 t6 z
- dma_addr_t dmaphysdest2 = 0;6 o7 Y8 B( \+ O0 w4 ?
; p7 g$ }0 J0 I; F- h1 b! W/ j- char *dmabufsrc1 = NULL;
% m/ F0 j3 _0 W) J8 @ - char *dmabufsrc2 = NULL;) R% u+ r" ~8 o3 ~* C8 ]0 D% C
- char *dmabufdest1 = NULL;
5 }7 N3 Y) E T4 u7 @. f - char *dmabufdest2 = NULL;" a6 X9 x& M0 ^- b- L" h
, x9 Z$ j; C4 s1 e) b# P% a G# @- static int acnt = 512;
0 c. S( y- R! A$ j - static int bcnt = 8;+ }2 ?" [4 P3 Q$ A3 H( l! }$ }" t
- static int ccnt = 8;
7 p5 A) Z' F- j, Y7 y - 2 {" o1 n5 m, U
- module_param(acnt, int, S_IRUGO);% _& B) V. M5 G* P4 o; D
- module_param(bcnt, int, S_IRUGO);/ H$ p% J- P" x. F* R; ~
- module_param(ccnt, int, S_IRUGO);
复制代码
8 c; c2 x- a9 a; e6 l0 \7 {3 B# u% D; s: d7 }. p {+ w; n9 x; v' v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ L6 {+ ~ _7 x4 ~, N4 b4 o. o0 o, yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 H; j2 b% A2 g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 c; Q- f B* S: y8 Q S5 j { n4 ~! s0 C& x
0 c: `; U+ Y* x1 X7 o |
|