|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ j0 D7 Z0 U9 j* Q% N, Y
- [code]EDMA sample test application
+ F4 @7 ?) R4 `# e% z1 F z - /*6 O# [/ I5 o1 V$ `# k
- * edma_test.c1 F6 \" y* h% V2 s% p5 h4 k/ k
- *
3 r' R( O# x# F! g! F( { - * brief EDMA3 Test Application1 c( f- P9 w& l
- *4 ~1 E9 w9 {- ~) {+ J1 F, {$ M g
- * This file contains EDMA3 Test code.
* I6 o: f; B A, b! i# p0 S - *& f) i# R* D' l* L* u) R/ r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' B4 w2 n$ v7 S4 o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 Z7 J5 Y2 o Z$ D$ q( ^
- * TO CHANGE.
& F. v1 a: l8 h5 S6 T- ]$ Y. ] - *
* ?: T9 I7 U4 |. | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 y, I1 D4 p- ~9 ?" i
- *
2 g1 L" M) C& C$ G$ P5 I8 l8 V - * This program is free software; you can redistribute it and/or
( z+ w2 M( b+ A6 N7 ? - * modify it under the terms of the GNU General Public License as2 ~1 T; G+ A" n7 W. J
- * published by the Free Software Foundation version 2.1 y! T8 ~, \8 y* H3 t6 d
- *' U! W) u9 X9 P Y. `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( i: ~$ w8 L1 J4 L& h) z; l
- * kind, whether express or implied; without even the implied warranty
0 E4 Q4 w" _& P( w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: }) Q" s% B% |9 c - * GNU General Public License for more details.
6 t- A( I! S) ?1 V& ^! } - */
y2 n) I) D+ k1 \
! |/ t2 T) J6 O! g# t4 _0 ]- #include <linux/module.h>
x8 Q7 R9 r! @7 D9 E - #include <linux/init.h>
0 w$ H$ g3 h! G. W - #include <linux/errno.h>) K: \: X, k% f# B
- #include <linux/types.h>! A! w$ b" U9 J7 g3 v" i
- #include <linux/interrupt.h>
6 @# k7 p/ H" s( \6 p - #include <asm/io.h>
: V0 u6 L* x: [ - #include <linux/moduleparam.h>
6 T/ R! S6 h3 n0 ?( ] - #include <linux/sysctl.h>3 H' x; y) g8 L! s" b
- #include <linux/mm.h>2 K# \' y( A! C
- #include <linux/dma-mapping.h>0 Q7 [1 H+ d( I: |4 D* X
5 F+ J0 N4 ]7 d- #include <mach/memory.h>& \" d$ g, f1 x8 x1 P: q
- #include <mach/hardware.h>
# A0 a, u& P2 w- S$ D - #include <mach/irqs.h>! H* [1 g/ M8 c7 O
- #include <asm/hardware/edma.h>1 j/ C/ g6 q7 t% I' {. ~( V
- ( m/ t3 K1 r- A) H/ t
- #undef EDMA3_DEBUG" C2 ]" I9 N+ x a( ` h
- /*#define EDMA3_DEBUG*/
: Q9 K" x- @' |3 a - ; A0 p$ X# y P' V
- #ifdef EDMA3_DEBUG
& ~8 }; O- k8 @& ~( a) D f7 B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 Z$ c L+ k8 M' H, E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# u$ L% ]- S/ x0 D: P: v. I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' w3 u( j* K% m8 P# |
- #else
9 Y3 H2 n2 y& I' t$ A - #define DMA_PRINTK( x... ), f% B t& P) K: U
- #define DMA_FN_IN
: ?! |$ M7 G8 b, v w - #define DMA_FN_OUT
0 T! b* o C! V+ j6 n+ q/ Y3 D - #endif3 n# D$ ~7 `/ R
& v% ?& v, d8 p' u, I- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ S5 f( i( Q [1 X
- #define STATIC_SHIFT 3
% V( ~7 R4 i( Y1 I% e# S - #define TCINTEN_SHIFT 20
" @7 F5 J2 d: e5 F$ q& K# U - #define ITCINTEN_SHIFT 21
7 E8 C9 o: B0 k* O - #define TCCHEN_SHIFT 220 `% `& _' Z: q
- #define ITCCHEN_SHIFT 23( H) e9 V! E% D- |9 N& Q( Q
- f; |/ t$ U; |' ]
- static volatile int irqraised1 = 0;
$ l0 `- k+ m& ~1 U2 ~& m* E - static volatile int irqraised2 = 0;
& a; T- a. O }- u) L. D
* L: Q+ m# Q. g4 r3 {( @: a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- S- |/ Z" f L4 m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 D/ \; r8 t1 a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) e2 P5 q+ i- t' z4 _; h( F
2 I, |( a) s/ @3 w _8 M; X- dma_addr_t dmaphyssrc1 = 0;
! R; H" K: ]- Y; z - dma_addr_t dmaphyssrc2 = 0;
s" a1 I/ G; w9 s5 C. ] - dma_addr_t dmaphysdest1 = 0;
) a6 \. ]9 C8 f7 P" U - dma_addr_t dmaphysdest2 = 0; S* [" N) [, C8 w
- 6 p* Y+ F& ]3 i! `$ |& Q& L
- char *dmabufsrc1 = NULL;6 T- m C$ {! n) h; D& j
- char *dmabufsrc2 = NULL;
6 E8 @0 _" H9 z) p* V+ ~ - char *dmabufdest1 = NULL;
# n5 _. |* N) |4 ?" @7 J - char *dmabufdest2 = NULL;
5 o- `- R1 x% Y7 @2 p' F& J - $ k& E r" j1 U" O3 ]
- static int acnt = 512;
7 j2 I1 {8 `3 t1 Q5 ?2 \ - static int bcnt = 8;1 U( e8 u! Q0 i* o7 v7 q, f; S
- static int ccnt = 8;* i L2 l: r; ?( m8 q0 n1 ]5 _. F0 O: U
- ! {6 k+ @0 Z* u7 h' x# z
- module_param(acnt, int, S_IRUGO);
% {$ ]" m6 \/ P: Z9 k; s5 C - module_param(bcnt, int, S_IRUGO);
3 F6 }7 W. Q, Q# V7 ^ - module_param(ccnt, int, S_IRUGO);
复制代码 4 P/ d/ g, T# i1 Q5 S
7 x. j6 i! D7 F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 L% a- r! {3 \( [5 u, k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 u. m- s& e/ ]) c9 ^- E* X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" ?& P' d: S$ e k/ S
( w9 m5 W8 W0 K) Z% f2 z- R3 n1 {5 j. B
|
|