|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % |' d$ y' y1 `: W
- [code]EDMA sample test application
0 m+ k4 y) c% M. A# S - /*
. d' K6 \5 e0 [2 j; D% T7 L - * edma_test.c* G1 u" _9 g6 \# p/ `
- *
& _7 k5 T7 E& x - * brief EDMA3 Test Application
4 k! [4 V3 w, |' W3 K7 o( o" [7 a - *
+ a1 W, r9 U% @ - * This file contains EDMA3 Test code.+ J8 S! w) @/ g* [' Z+ ~) R/ t+ `* O Z
- *
6 ^0 Y( @- S+ Z. A$ s, r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 x/ ]4 V R6 O! ]( L) k4 L, Q! V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: G; G8 O7 c$ H1 a4 N
- * TO CHANGE.. ?/ Q0 e7 [# H2 z' q
- *
" Y2 }1 h' C1 x& ]8 h9 D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- z" v+ k3 ~$ a! T$ O - *
, X# k7 p+ c" H5 H0 H$ a3 [3 a - * This program is free software; you can redistribute it and/or) m# ^$ j# o5 q' E) H( M$ M( ]
- * modify it under the terms of the GNU General Public License as# d! ]& L5 y: N
- * published by the Free Software Foundation version 2.* S% B% R, R2 [& I+ N7 v
- *; }- [" e6 h/ D9 e! J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any [& z% v6 x; E
- * kind, whether express or implied; without even the implied warranty. A5 o3 z- i- @2 S' _8 n: a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& @0 R9 L, d) h6 i8 h- j
- * GNU General Public License for more details.
4 h j$ t( v) f; ~% y# n - */( D2 {% ]9 d0 d$ C+ y- S
/ F7 h" B% i2 r9 m1 t, t, U% `- #include <linux/module.h>/ \2 [0 {* V8 A- q, `* J
- #include <linux/init.h>
2 k5 t! Z5 k! f* E6 E, A4 Q- i - #include <linux/errno.h>
2 n0 z) z' w/ a- I8 a - #include <linux/types.h>1 S; I& m# C: D
- #include <linux/interrupt.h>3 D/ `7 Q c6 W4 U, |4 n
- #include <asm/io.h>
3 N/ I* y! O( o1 |! a1 U! b - #include <linux/moduleparam.h>& g7 F1 o& N1 J& V4 N- o5 \5 a2 g' [2 K
- #include <linux/sysctl.h>
3 q F- x* o8 y6 z( t+ E) v$ l - #include <linux/mm.h>: g6 v, ~; r4 r! F) B
- #include <linux/dma-mapping.h>
: H0 k( B: ]& w- I) ?1 L$ y- z
0 p& C& j2 ^' ?! @3 G7 ?- #include <mach/memory.h>* B! {0 t: }4 g; u* D8 Z
- #include <mach/hardware.h>6 F# d1 K% O9 f2 h: i
- #include <mach/irqs.h>2 D9 S2 G9 R; F7 K# o9 d }$ J+ X
- #include <asm/hardware/edma.h>3 U, B5 k8 H; g
1 |7 I- M' c% f6 j# s" v- #undef EDMA3_DEBUG1 N, O( w* K' ]' }7 ^
- /*#define EDMA3_DEBUG*/
" [2 A. o6 {9 N8 ^- `; }- x4 F4 r2 z0 Q - " j; |( ~" h$ V4 [' |
- #ifdef EDMA3_DEBUG- n3 N ^8 C7 E* B% ]5 `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 S$ T5 [- v9 N: k3 Q( w$ U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) l9 y) I' h0 n& L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- Z4 N' R% r% b1 b' K - #else
& Q5 X H; ^, n- @/ d. P( W. g( c - #define DMA_PRINTK( x... )
2 M" f; f. G* r, I. @- a1 h/ Q - #define DMA_FN_IN
* O( X) ^1 f; ~5 m2 v X5 V - #define DMA_FN_OUT
9 Q; U0 s! q! u& t1 ?6 N% F* X - #endif: W6 H- j9 C. f0 B! \
- & P; B. M) b/ l8 }* t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 U# y `' K. M
- #define STATIC_SHIFT 3
) W" L5 U+ k4 ?* D) ` - #define TCINTEN_SHIFT 20! x" S1 P- a9 J- {2 `+ _
- #define ITCINTEN_SHIFT 21
5 o2 t6 |, P" j7 h3 n- u - #define TCCHEN_SHIFT 22
! ?+ B* b( r# D" W - #define ITCCHEN_SHIFT 23
6 A8 h6 O @! A# i Z* b. \, D - 7 X# B- i5 b e0 O% O' ~
- static volatile int irqraised1 = 0;' S, L2 v9 r! n# [" W% \+ h
- static volatile int irqraised2 = 0;& x! W& i/ v, Y% d6 L! k
- ' [' A1 L! t5 p4 A9 g9 u) ~/ j) K* l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 O! b. U; Y3 a i" J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* z% d7 j2 [7 H; o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 h% k/ ^" y( n, W
+ B2 K$ S, j0 V9 M# R7 W- dma_addr_t dmaphyssrc1 = 0;) C$ V9 a% I1 n/ \
- dma_addr_t dmaphyssrc2 = 0;
' I8 v+ j2 g1 W( M. S, v- q - dma_addr_t dmaphysdest1 = 0;
" H# c; ?' n" J! Y8 T8 M9 l - dma_addr_t dmaphysdest2 = 0;
0 Y- W# e+ W0 W/ ^$ j - ! [- f* h: v k/ n2 x6 O/ ~( I* N
- char *dmabufsrc1 = NULL;" }/ c2 k) I: f
- char *dmabufsrc2 = NULL;
! R) k# q) W& k1 [& J4 Y - char *dmabufdest1 = NULL;9 W; H* |& U# e! d- I
- char *dmabufdest2 = NULL;
, h4 P( f8 C" { - ) y# d; C) Q: k
- static int acnt = 512;* [1 P- W4 M4 {3 b
- static int bcnt = 8;
V0 t! K/ v2 j w- f - static int ccnt = 8;8 n- T- P) t' ~( w, o
- A& O" |& m' W- d; P) d8 O6 ~0 q- module_param(acnt, int, S_IRUGO);
; c- p8 V) m. n+ l) `: ^5 c1 q" u - module_param(bcnt, int, S_IRUGO);5 v( R1 N8 L( }+ X8 H
- module_param(ccnt, int, S_IRUGO);
复制代码 6 S* P$ N4 q* a1 Y( R/ J; @
& ]& N* I. _1 Z. J. Q* e4 C/ y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( V6 P4 T- D$ a. marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 ]3 b7 |# r$ D1 e8 `4 x5 |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 p! e& w H1 O, H) V, r; X$ L" w+ d
3 \ e) z+ d$ n: ?2 k; `
|
|