|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 p8 o$ _% J( Q# ~7 v# g- [code]EDMA sample test application& [0 T7 t @- `. r
- /*
5 r1 a$ ^2 D# R, N& l6 @ - * edma_test.c
! j+ m6 h7 a1 l - *
- b5 X. I0 |+ E - * brief EDMA3 Test Application
( V( f8 [+ A2 X- y - *) ^" X8 t! J" X% W$ C. l9 L
- * This file contains EDMA3 Test code.
: [: C. P) a, g8 K - *4 `. l, c- ]. h: k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* Q# B% N( I% K4 ^, M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 _/ x& g4 Z% f4 S$ c- u4 `! ~( R" X
- * TO CHANGE.( p$ E' `) F3 o
- *# l0 J0 @: V3 p$ V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 A! S) \# Y) I- S/ ]: S
- *6 S. @/ m& h& c2 N5 t7 Z
- * This program is free software; you can redistribute it and/or
- b0 E% Y- F6 Z x - * modify it under the terms of the GNU General Public License as
$ j; s- [: }9 S! `8 B5 L - * published by the Free Software Foundation version 2.: P0 T, q& {0 c$ m- `- @& x* [' w
- *! f& G" W2 k8 }* e/ j& w, A# }" f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ O2 e7 F* P: g1 ~! g
- * kind, whether express or implied; without even the implied warranty
# f' W; K9 r3 Q ]' b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 \8 x& h! r4 H4 e" Y9 j. j+ ~ - * GNU General Public License for more details.. K- |3 b+ W8 ~9 c4 R2 [5 X
- */
( F; }9 V' q+ a6 u5 {0 I" u+ \+ z - * t+ ?& P( Y7 ~' G0 E, c' `
- #include <linux/module.h>
T) ~) }2 |! j' ?. s! C9 F) K, Q - #include <linux/init.h>
4 F: l2 S8 O: f! ?% }" j [ ]* [5 S - #include <linux/errno.h>8 H4 D/ b8 L6 }6 B* g: P& T: N
- #include <linux/types.h>9 g( I( T9 n+ V, R. S) k, P$ C
- #include <linux/interrupt.h> V: X! P/ J# }$ |. V
- #include <asm/io.h>6 f! ]% |" N* q* P q
- #include <linux/moduleparam.h>; j5 C# B7 f `/ [' I/ n! [
- #include <linux/sysctl.h>
8 F! e2 H6 ]7 \+ M - #include <linux/mm.h>
- H4 L1 @. R2 ] - #include <linux/dma-mapping.h>
* W5 i+ n3 ^1 F% E/ { - 9 O3 t% h1 J( Q8 R. K: g/ e
- #include <mach/memory.h>
5 G9 w6 H9 K4 o% _: j- l$ e - #include <mach/hardware.h>
$ N4 [: `0 U! U `0 }$ ]6 ] - #include <mach/irqs.h>0 h# Y3 @! i1 }7 T
- #include <asm/hardware/edma.h>
. y# i* O8 `& i - . G, X8 T1 x- }0 C1 V
- #undef EDMA3_DEBUG7 ]9 e4 L3 |2 e/ K. e, U
- /*#define EDMA3_DEBUG*/
3 j L, T" ^) u
8 g" A. @$ g3 h5 c8 x! f- #ifdef EDMA3_DEBUG
+ o: L1 f* S8 s: ]2 f# h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 w7 c, `5 s( g; e0 ]+ y* `$ h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& H- }- D$ J. c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): B+ E7 v# j* z; d6 W/ a
- #else
0 i: u" s4 t9 m/ ~7 ~ - #define DMA_PRINTK( x... )" ]) l$ b9 _3 E: o/ S' P$ {
- #define DMA_FN_IN5 G0 ~2 p9 _0 I; {" Y' r
- #define DMA_FN_OUT
6 E4 P* D3 [: i: Z8 e; u: P4 d - #endif7 }3 ?% i0 E, t7 z, y. E
' N2 J9 f4 ]# B# h- #define MAX_DMA_TRANSFER_IN_BYTES (32768): O* X7 L* }6 z- I n: [' [
- #define STATIC_SHIFT 3: s# h2 e( g q1 z# s
- #define TCINTEN_SHIFT 20
1 o E9 _# ^1 } G# E* v6 S - #define ITCINTEN_SHIFT 21 u) U7 T0 F: v8 h, q& I6 W1 B
- #define TCCHEN_SHIFT 22
) W e+ T5 z" k6 m" @% U5 J3 G - #define ITCCHEN_SHIFT 230 Q, Z [' c) n, r% b8 L. j
- / M" o( {& s( [$ [3 O$ V1 o; q# M
- static volatile int irqraised1 = 0;+ V2 F0 H- v3 e- q; l0 Z+ q& ]
- static volatile int irqraised2 = 0;, b8 k+ |) a! ]
) p* r) `8 a% Y( j2 A7 g- {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ u: J+ t: j& U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ?% k8 Y& \3 I. v j2 n9 ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ C5 b. N9 q6 e: s! j
- z, r3 e( z' K& }- dma_addr_t dmaphyssrc1 = 0;
8 R7 e- u0 j# @9 v; L4 h9 V - dma_addr_t dmaphyssrc2 = 0;0 G" R/ K% E( Q7 S/ D U/ k) L
- dma_addr_t dmaphysdest1 = 0;+ U1 C6 G5 k/ L9 ?. z- k; u" _7 \
- dma_addr_t dmaphysdest2 = 0;. q) I; s/ r* t+ J' w0 q4 e, z
( w. N* {% E! t2 q- char *dmabufsrc1 = NULL;3 Q6 x6 ?6 c6 a6 N& j
- char *dmabufsrc2 = NULL;) E5 }: ^; K% b
- char *dmabufdest1 = NULL;
2 J3 r8 ~' n: |# `5 E - char *dmabufdest2 = NULL;" m2 k. Q S! K6 e& s; `
2 D8 U# d1 C* |/ d$ G0 {( [1 G- static int acnt = 512;
9 A- P6 W" X S. E1 r2 {3 H - static int bcnt = 8;
0 h) v' q) m3 l - static int ccnt = 8;
5 j: |5 @; h" m7 q& w - 1 e, Q$ H' i/ U* M$ q" v9 ^
- module_param(acnt, int, S_IRUGO);
2 |9 W0 j: |, Y- e - module_param(bcnt, int, S_IRUGO);
3 p: E- D1 d! w) C3 }, F - module_param(ccnt, int, S_IRUGO);
复制代码
3 ^/ }7 i4 o% |) f- R& }- f+ {* ?2 u* [; }9 _: J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 I1 t8 {0 ?- ` O/ D1 f3 Y& k. m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, q7 m% P8 v0 A# Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 g1 a4 e4 U" ]1 L+ J
I/ Z$ S: R& S/ P$ U/ f' S. [5 ^" b
|
|