|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 L ~) |# f; {1 u/ |. G
- [code]EDMA sample test application. z X( q6 J1 D
- /*
4 [" ]9 m4 @, R9 O* |0 M - * edma_test.c
# t9 V+ x8 e& z3 X4 V - *0 ]. @3 w" h4 i4 e6 G8 q, h
- * brief EDMA3 Test Application
3 s: X1 a" s% G2 g* l$ ^1 O4 `* c* a - *
O; [5 w/ b3 ~( X$ X - * This file contains EDMA3 Test code.
9 r8 o) W, T3 B4 d - *
+ [* _( t" q8 Q: B2 |+ X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 D1 | {' Y8 C7 w/ H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 q3 p) {3 U6 I8 k8 t
- * TO CHANGE. C4 }4 B3 y1 L( G5 Q3 w; Q7 q! y! N
- *
1 A- W1 A+ b+ P( O; @, j2 c5 p9 t. o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ p6 h" z. @8 ?4 U6 s8 ~8 o7 r - *
; X) [/ d- h8 A - * This program is free software; you can redistribute it and/or
+ e: |7 Q" ?0 D1 k! { - * modify it under the terms of the GNU General Public License as% i7 ~" M7 o+ `
- * published by the Free Software Foundation version 2.
# n$ S6 }2 ?' X3 t0 w" {! ^ W' u- f! y" c - *
% t9 o$ C' T M2 @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 l6 E' w* _3 U9 R8 I+ l7 f+ t - * kind, whether express or implied; without even the implied warranty
- W2 S* p$ V- D8 f3 w: E9 ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 U# Q) J L7 b" s* s - * GNU General Public License for more details.: F# `. x0 l& l8 R$ M B5 P
- */
! { A- O: [) o9 c. n5 K3 g
. t% X* X4 w b& C$ X- #include <linux/module.h>, l% [& Y, Q( F. z/ F7 h7 \1 ]* g
- #include <linux/init.h>
6 X" C/ O5 J d. U& [ - #include <linux/errno.h>" S: e+ C: O& ]/ e3 e0 P
- #include <linux/types.h>
9 l4 {3 B K1 n _/ J k6 V; B - #include <linux/interrupt.h>
/ N" f5 V) `# ]# X. D/ ^% ^$ i - #include <asm/io.h>
# E; q# E+ D9 `: C - #include <linux/moduleparam.h>2 q d$ K5 a0 _) G
- #include <linux/sysctl.h>
2 L' p* x6 l, ]' |) j' Z - #include <linux/mm.h>* j2 ?+ N0 e4 W
- #include <linux/dma-mapping.h>0 A3 C3 b, y$ e2 {9 z! C
5 [" }1 b5 j# g4 A6 G7 c- #include <mach/memory.h>! {, p6 |! t1 v2 y
- #include <mach/hardware.h>2 p" [/ }1 Q3 p0 _+ y
- #include <mach/irqs.h>4 t$ t+ z/ i; U" }) [" b3 I
- #include <asm/hardware/edma.h>- ?) T. r( x t, P& G3 ]
- : I6 G7 Y" L5 ~* t4 r* a
- #undef EDMA3_DEBUG
1 \+ @4 L. s9 k - /*#define EDMA3_DEBUG*/
# e! P+ e; V# A3 `& q% V - 4 L$ ^: X& m' ^% W' @# n5 V
- #ifdef EDMA3_DEBUG
1 u- Q7 l) {" g7 d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* P' s- L9 t2 s/ n( c+ R" |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! B0 D# Z/ Y; u3 |/ A* d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 @) o7 Y! w; h5 T* S( U, ]! R
- #else$ H* O0 i! w+ m0 |: p" |
- #define DMA_PRINTK( x... )
- F' G0 G7 z1 u# k3 t - #define DMA_FN_IN
# ^" P% z# U( F. @0 q - #define DMA_FN_OUT
* C$ B9 U& @3 J - #endif# f7 V! `5 H& ~& S* v/ C; j* P
- 1 k- W# p% a1 S9 p; w; `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! h- o& k. y# U: w2 a$ k1 J, G - #define STATIC_SHIFT 35 n/ O; I: w/ `7 M) ]; O) ~, H
- #define TCINTEN_SHIFT 20
0 a% a7 z5 f, S1 x - #define ITCINTEN_SHIFT 21
0 i6 }% z+ d$ J3 q" g - #define TCCHEN_SHIFT 22% r8 y. x8 L5 q b4 i) |7 a# y( E) f
- #define ITCCHEN_SHIFT 23# e4 u- e+ O) Y1 l
R7 v5 R8 E- R, w5 n2 z8 ?$ L; ^- static volatile int irqraised1 = 0;- Z) }! y; b2 Z) a6 U
- static volatile int irqraised2 = 0;3 j5 R5 e7 Y* ^+ ~& ^, L4 Z
( Q$ t5 K$ I" O& S# G+ \0 _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; J$ z: ^/ z) s) {/ H8 H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! N9 D7 @( v9 R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" C/ {# ? T, t" _. L0 ?8 p
& J6 G- X! j# ?% J3 \1 H/ G1 O( I- dma_addr_t dmaphyssrc1 = 0;
1 g7 t. O, m: I) X$ P7 F+ X+ F - dma_addr_t dmaphyssrc2 = 0;! I$ N+ G& j0 `5 Y3 z% n n
- dma_addr_t dmaphysdest1 = 0;% k1 ^: F: u% a
- dma_addr_t dmaphysdest2 = 0;0 t* X; {: c/ O1 T& B1 O
- ) f8 _0 ~: y: J% f- `, n* V7 I
- char *dmabufsrc1 = NULL;
+ V# A1 a4 [& c7 z& g - char *dmabufsrc2 = NULL;! P$ J$ M5 z7 V
- char *dmabufdest1 = NULL;
. ~( K5 B7 ~; ~' v; ~( ~ - char *dmabufdest2 = NULL;
; {' T9 C% E" X/ ^ - 9 `# U1 k8 U0 ]
- static int acnt = 512;7 T9 ?5 C4 F% l! o# x, D
- static int bcnt = 8;
. m+ i( J, N# w - static int ccnt = 8;
i# J7 A2 H% |2 |& t! B
, B8 L1 R, L2 V7 t) R- module_param(acnt, int, S_IRUGO);
1 M9 O6 z4 M; T1 R& {. e+ K - module_param(bcnt, int, S_IRUGO);
3 }! C& s5 B, x& x6 s: q2 d2 h - module_param(ccnt, int, S_IRUGO);
复制代码 ! c0 o/ K% V* I% V$ W
4 K1 R3 }" Q- p, _: l$ T2 l, c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ V2 M& W* \5 E" J O( B' v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* j* s" P+ B8 G# `4 P2 l" n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 {# s) i7 @, B( W) y6 ]$ g! k3 W2 W R3 y( J
3 P& s/ f0 b( U! L
|
|