|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- ?7 z: i/ b5 K- [code]EDMA sample test application
: L/ x1 }; ^2 ?/ s! d; V9 g - /*
! } T" @# x8 ^; _ - * edma_test.c% O" N: D. K: o) D
- *
& {) I1 O, d# o7 V - * brief EDMA3 Test Application
. V8 }* }5 \2 y+ u. D5 y4 v, E - *8 \1 f9 \5 c1 d7 y
- * This file contains EDMA3 Test code.
+ {) Z# ^1 C8 ], B& D8 c! C7 ] - *
: Q, {1 k( L# z Q n |5 p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" k7 ?& }$ q( u6 t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ r, b8 I5 _3 U8 X
- * TO CHANGE.$ t9 G% w8 f7 O0 o1 T
- *( o- R; x/ D6 n9 ~2 t3 E0 Z! [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( e3 a, r: m5 F2 ]0 M& j9 Q
- *
' H; [9 D% { W6 C7 a - * This program is free software; you can redistribute it and/or4 ^1 x: v* R( b1 }5 Z
- * modify it under the terms of the GNU General Public License as
2 h! T8 v5 L( ^) X2 h9 R4 s - * published by the Free Software Foundation version 2.2 Q) D) @- Q& O* Y4 H# a
- *+ i. F+ P5 e4 G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 R3 ^$ c8 ^/ z2 M* ]$ e
- * kind, whether express or implied; without even the implied warranty
- k) ^7 o$ J% e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% h) v+ l+ E# c8 Q& r - * GNU General Public License for more details. _+ C2 n, A0 l* i
- */
7 n* O9 G* @3 T D2 K
3 `' H& X0 ~6 Q0 w' ~- #include <linux/module.h>* Y3 `4 N3 t9 V0 A) K5 Y' W
- #include <linux/init.h>
5 g! {% H$ e- e; i' B$ g - #include <linux/errno.h>8 ~' ] c& s" a! p3 ]* d
- #include <linux/types.h># j7 B, |6 g; T5 F! A" a
- #include <linux/interrupt.h>* w1 J! D. m% a2 E8 H
- #include <asm/io.h>
) R( u u3 l8 r/ H& | - #include <linux/moduleparam.h>
) F8 S C! V; U$ N( `) t, H - #include <linux/sysctl.h>
2 A8 q* z \' h, I% g - #include <linux/mm.h>
0 Y! C c. [1 u - #include <linux/dma-mapping.h>1 ]% x& D1 v, e6 H/ E7 A2 e
- 2 i: {3 l, S# s
- #include <mach/memory.h>
- ?/ T. O& I( ?) n: Y T$ s - #include <mach/hardware.h>$ N5 D" k* z5 ^5 p- Z) J& p
- #include <mach/irqs.h>1 D; p5 [) h2 i0 `
- #include <asm/hardware/edma.h>
5 U# h3 M- ?+ V. t5 s
, p( K2 ^6 W+ ^3 p6 R7 P* ]6 }0 a- #undef EDMA3_DEBUG
& d: j7 R. W0 _5 i - /*#define EDMA3_DEBUG*/
9 |6 @6 J7 ~0 o) R) X; C- Z - 1 O) @; P4 N. e+ ?' D- E& m5 G: ]
- #ifdef EDMA3_DEBUG# H2 p( N2 L+ Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 T- \' l9 T( s y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- |% R5 i) M. H# ~# W3 o% K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): { l" J: e% E0 O+ n3 y8 R# e
- #else$ [/ a- o, v: N2 @9 S
- #define DMA_PRINTK( x... ), n# p" v" t8 | j5 S! ~2 G5 ^
- #define DMA_FN_IN
5 ?; I) R$ b$ Z6 e8 j+ P/ l" \ - #define DMA_FN_OUT
" \7 l* `- @6 O; I$ i - #endif$ M) |" q4 a. d5 i
# q, a0 G8 i( A2 I* y, t5 p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* ]& {8 ]6 ^* f( |4 l& ]1 g - #define STATIC_SHIFT 3
0 t2 l) X$ v9 P3 L7 H7 N6 ? - #define TCINTEN_SHIFT 209 C) H3 |; c, F5 h# P
- #define ITCINTEN_SHIFT 21
- b7 \1 I9 d. Q& s, d: [4 h - #define TCCHEN_SHIFT 22
; t$ F" }( I# A' x0 b - #define ITCCHEN_SHIFT 23
) P) S% m! B+ q9 d9 ]! f! j, e - 3 h$ [3 i1 P5 E
- static volatile int irqraised1 = 0;% z4 P# x2 ]2 G) p \6 R/ x
- static volatile int irqraised2 = 0;" W6 L: I W3 X) [1 s+ @! y4 b9 V
) N. |0 l$ u* j4 G4 U) U( A' W/ s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 g5 ^1 {3 O3 h" S) A# R" |. F$ t [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 \% ^) A+ X8 u' O! H5 o- C" D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ N* W3 i6 p' ^# W: U5 k+ t
- 0 N. ]# r$ D g, P1 C- j0 Z
- dma_addr_t dmaphyssrc1 = 0;# ^- B: b' A- Y6 y# }4 I; @$ t
- dma_addr_t dmaphyssrc2 = 0;: V" a( X8 N; o: n7 A( s
- dma_addr_t dmaphysdest1 = 0; A, ^! z }3 {
- dma_addr_t dmaphysdest2 = 0;2 w7 q1 i. V, [- x5 }) _
6 J, w- y" p2 @- char *dmabufsrc1 = NULL;. L, P* e# n3 {) o( Q7 \1 _
- char *dmabufsrc2 = NULL;1 v. B- ?5 R7 b) o U
- char *dmabufdest1 = NULL;
/ r0 f( _% B1 D* t) |6 k6 F1 M* Z3 R. X' L - char *dmabufdest2 = NULL;8 v$ O* e6 p% R
$ _: C0 d5 }# }1 ^/ i6 }9 V$ Z- static int acnt = 512;
( k+ Z" ]3 o5 e - static int bcnt = 8;
, C9 {) h- _/ u- Z2 _" m( g - static int ccnt = 8;: E" ~: P$ Z/ H
- & S# J, O; ]0 l( P8 ]8 x
- module_param(acnt, int, S_IRUGO);
% p% A4 z, {2 ~: L( b2 B - module_param(bcnt, int, S_IRUGO);: G6 R9 Q3 y$ q' U8 t
- module_param(ccnt, int, S_IRUGO);
复制代码
) u6 D3 O/ d/ I9 I
; D3 M0 C- c+ U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 J. K. S" T2 H) R2 q2 parm-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 t! g3 o9 V, Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ J" `7 z8 ^" y9 l3 A9 i" _# m' b$ m) X" D" \0 [ D) n5 n* H) j
3 s3 Q2 R( z8 @8 r2 j e1 v
|
|