|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ `$ T. Q( o1 N- ?6 ~# e- [code]EDMA sample test application
' l8 Z) J8 i5 v' L8 | - /*
8 K# N: |1 J1 b - * edma_test.c- Q) K' `1 M8 ^
- *4 F! M" ]6 T3 m2 g! C" D
- * brief EDMA3 Test Application
z$ u2 E$ r* \+ l6 p" m3 D. n6 c5 X7 C - *+ e$ [$ k9 |* w& Y7 c/ e
- * This file contains EDMA3 Test code.: L5 e: V% t5 g1 U h) W( A4 _
- *
6 R' }8 ]* `+ D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 e1 ^ |" [9 l& c- a: n* L0 }1 u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# }) n2 x z- i3 W# g - * TO CHANGE.) g0 k- H/ w( a7 k& r% F
- *. P9 _9 B: m9 C! \6 M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 u8 g* M% X% U6 N3 t5 X" m
- *- a) _( i3 q- C% i; L; g+ }
- * This program is free software; you can redistribute it and/or
t) n1 ~: l+ E - * modify it under the terms of the GNU General Public License as* U( K( t( F* t) L4 _8 I2 m
- * published by the Free Software Foundation version 2., E# c2 j" K+ u9 Z8 S/ p3 j
- *! [9 C9 I2 @. Z( V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* f6 F, Y7 y; I$ {0 i - * kind, whether express or implied; without even the implied warranty
4 c6 ]! b7 M5 G. o+ e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- m! g3 g# k7 }1 c9 P3 G - * GNU General Public License for more details.
# r6 i- J" @" b; p7 L - */" a# [5 G! |9 H! ]3 J" _
- 3 n% C9 Q6 n' b! @ Q
- #include <linux/module.h>
6 N" I. f. Q* r1 e4 k - #include <linux/init.h>
6 o- X$ h9 I- m" P% U6 u - #include <linux/errno.h>/ o% D& V4 ^& h8 |$ s
- #include <linux/types.h>
) d6 `1 _. m: m1 @! l: m - #include <linux/interrupt.h>* O: K3 Y' x; W
- #include <asm/io.h>; J+ H# O9 C9 v
- #include <linux/moduleparam.h>$ d6 d, X( ?& |5 i3 E& }5 _- X7 R* m
- #include <linux/sysctl.h>
1 h" l+ Y }) h- |1 A* |+ U - #include <linux/mm.h>( m! j m4 m g* e
- #include <linux/dma-mapping.h>& N& i& b& P7 b; E( ~, \3 z2 q1 }; R
- & v5 K# l' h) D
- #include <mach/memory.h>
8 L0 i3 j2 S Z( K; E$ }! e - #include <mach/hardware.h># I% \5 k% B# r+ z" _: a( L6 h
- #include <mach/irqs.h>6 i' H7 H9 U& S- @
- #include <asm/hardware/edma.h>
! _+ _; m7 g* t
. p3 w+ O6 I/ }- e( p- #undef EDMA3_DEBUG
: C! p) B) [7 t9 l7 o D* Z - /*#define EDMA3_DEBUG*/+ q5 { @/ {0 ?/ |% Z# c, f) y
8 D/ x" p3 L7 I& K, {+ E- #ifdef EDMA3_DEBUG! w4 n" }9 l; g @3 _0 o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* o2 u8 \8 L- ~: y/ B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 `( n: Z" c6 C N+ S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# {2 h2 Q* b- W( y( R* Y* v/ Q# ^
- #else
( g w0 V& k1 Y& o& U - #define DMA_PRINTK( x... )" L( E" t0 R' |. ]
- #define DMA_FN_IN$ ^" i+ |( n6 ~9 [8 C, K* M
- #define DMA_FN_OUT
+ z* d) l. }0 F) a9 }! m - #endif% a& h7 G& }$ p7 l, T8 I( X
- / @6 e2 K* h, ]. ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) k4 s! ]7 p% X6 s: C* R. g2 B1 m
- #define STATIC_SHIFT 3
" E0 B8 e1 G4 q' i8 h' U! e - #define TCINTEN_SHIFT 207 P# ?$ M# h3 {' f: L2 D
- #define ITCINTEN_SHIFT 21
/ |: B: _0 n# _3 N9 T& |0 P5 A - #define TCCHEN_SHIFT 22
5 d- h0 S& v6 f& r - #define ITCCHEN_SHIFT 235 y/ o% F) W) E7 z+ d
5 p" R5 G x0 q) Y% |( B$ t- static volatile int irqraised1 = 0;
: Y1 _9 U; @4 k1 t# ~' D2 | - static volatile int irqraised2 = 0;) I; X% N0 `- L
- 5 x7 Q2 ?; Z: s* F- b: |% a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 i: e2 Y9 @$ ~! E2 G8 r u$ I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* ]* ?* i6 E; |( L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ^+ J( X* V7 X2 i' ]
/ `; S, O5 s. o6 S+ n: b1 f- dma_addr_t dmaphyssrc1 = 0;
& G$ C$ e) _# i2 u8 m6 [9 ?' @5 c - dma_addr_t dmaphyssrc2 = 0;" S( ~" E% I4 ^+ A7 N: a
- dma_addr_t dmaphysdest1 = 0;
. n2 q7 n$ y, R9 J5 ~; t Q - dma_addr_t dmaphysdest2 = 0;' k+ \% x- e9 J, X) a
8 Y3 `) G+ j+ \. `9 `' o% o W- char *dmabufsrc1 = NULL;
9 C" l. |1 B6 F$ N# l - char *dmabufsrc2 = NULL;
2 p% n/ z2 c: L8 u t- {8 }7 ~- U3 P - char *dmabufdest1 = NULL;
8 Q: u9 @! S4 U3 |& v- @ - char *dmabufdest2 = NULL;0 d: Y9 l% t, l" j' R: [
% r" q C, h3 p( t- static int acnt = 512;# O8 r o: Q* d* ]9 ?! O
- static int bcnt = 8;8 o g" k) F5 N7 a/ ]1 d
- static int ccnt = 8;
& B% z! l9 f7 X( x2 d! c - ( O/ `9 r l, c8 F* E1 N7 f
- module_param(acnt, int, S_IRUGO);
1 t) |% ~ I* d9 q - module_param(bcnt, int, S_IRUGO);
$ I8 h, e. Y7 f6 y7 X - module_param(ccnt, int, S_IRUGO);
复制代码
) b7 h4 v+ e, K. V6 |* B3 h
8 P5 y, k p( U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- N( U) ]) z. K+ L# T9 C* [$ V* Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# z8 @) N `7 ~ ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) O# G4 a6 S) c7 Y
; C! Z# Y9 V5 r. e" ~- ^* J# V7 V" M7 e( S- J
|
|