|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' B* [) [% r7 d: _& V. `
- [code]EDMA sample test application- [* o' `4 X; a U9 `' R0 \* [: \
- /*
4 j% t6 r$ ~2 Y+ X/ Y - * edma_test.c( y0 b6 Q! \5 R' x g
- *9 w+ @% L# R6 L# Q' [+ j! y
- * brief EDMA3 Test Application
* N' I5 i- f1 |8 o+ b1 u) p3 r h - *
$ O- F- e" L, `; D$ C: ~ - * This file contains EDMA3 Test code.4 w+ R/ W6 _7 L" @: Q* G1 E* X4 ?/ k
- *
' |. d! ]( X" n- M5 b% T3 c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' r7 _! I7 W6 D- I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 c* ?. ^8 K/ C - * TO CHANGE." |9 r; L) K/ @' p' L$ Y
- *
. v' [9 |# }& s: _" ~4 F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' q* \( O0 m6 _: P( D6 H' l2 ^8 T - *
7 S7 N, `) M: U- G$ ?5 w& I: L( D& l - * This program is free software; you can redistribute it and/or6 t2 b! e6 `) T2 ?
- * modify it under the terms of the GNU General Public License as, `8 ?2 X9 l7 R6 a
- * published by the Free Software Foundation version 2.
# y( ]( m2 ?: G( d* l8 e; R - *
# H/ r) u/ z. `6 g( I+ S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- W! V9 C/ Y; p( H: d. R- w* h
- * kind, whether express or implied; without even the implied warranty
- f0 ^2 w) v( ~$ O! e; O8 s/ i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 X# h- |! f5 A
- * GNU General Public License for more details. m) B; D% q x9 U8 @; u& L- G
- */: Q4 E, c3 l- c
- 0 m; Z4 ^+ ~6 f
- #include <linux/module.h>) |6 C; V7 A& N$ J
- #include <linux/init.h>
7 i( N4 E6 s& r# K1 [8 ]$ x - #include <linux/errno.h>
[. `7 D3 Y0 f) |# { - #include <linux/types.h>, r i3 m/ `4 g/ s- g- ]0 B
- #include <linux/interrupt.h>
/ {* ^" V* J1 n) M$ T0 @2 T - #include <asm/io.h>' @+ r2 g: o, Q* _% O
- #include <linux/moduleparam.h>
6 ~6 p8 n C/ c- L! m& |0 B - #include <linux/sysctl.h>
# H. l: `; E2 r2 M/ f& e1 J - #include <linux/mm.h>2 S q$ ^9 I3 {) ]% w0 j* h
- #include <linux/dma-mapping.h>! r. i+ M8 r6 p( m7 A. m+ T
- 6 E9 |! Z! Z& ~
- #include <mach/memory.h>6 ~) i9 o T( y2 n2 x/ h) m
- #include <mach/hardware.h>. N- e& y+ B+ a [5 P
- #include <mach/irqs.h>8 a' S6 e x+ e5 a( n! y( \
- #include <asm/hardware/edma.h>
8 x; ^2 S- P3 O/ E9 j0 H, M
* J5 k' w7 [5 a- #undef EDMA3_DEBUG
( I; `: `+ O- J: H - /*#define EDMA3_DEBUG*/. l6 h z* O0 O6 Y
1 P. s/ e. O0 c) B) g5 e! J- #ifdef EDMA3_DEBUG; U$ N4 N% x# v# W4 V% g0 e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' r$ C6 V7 Y' Y0 f' }+ V% E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- q" R; h6 \+ t# m+ \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
}; O! A, o |5 b: s4 W5 W6 s - #else0 d" e9 H. U8 ?) l& `; A: s+ o( |
- #define DMA_PRINTK( x... )+ C C5 X2 }# {9 E' i
- #define DMA_FN_IN: g5 T" h. D6 @4 H# U1 i
- #define DMA_FN_OUT
1 O1 {; O x, r, S" t0 Y - #endif! L. M7 ?/ R2 |, e1 t1 R
8 W: N- D+ c2 i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 L% _6 V$ N5 X2 }
- #define STATIC_SHIFT 3
1 x6 n8 z( `( B - #define TCINTEN_SHIFT 20" m; `. f$ @0 O" Y, n$ v
- #define ITCINTEN_SHIFT 21- Z K) P4 j, I# C3 |* Y
- #define TCCHEN_SHIFT 22% b" M' @% V: r( L n: _ S0 v) M4 K, f
- #define ITCCHEN_SHIFT 23( Z) P0 F0 ]6 t4 Z% R
0 C+ }" V) ^9 Y1 H7 c3 H- static volatile int irqraised1 = 0;* a1 @2 w6 m/ m0 V! p2 Z0 i0 ~6 Z
- static volatile int irqraised2 = 0;
% E. O( \ k2 E7 |1 |
$ q% g# D; m4 y8 q/ h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 t6 g2 x1 P; q# R) [6 m, X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 T- B3 ^8 c5 x# r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% d$ A7 |/ P( [; S5 E2 V
3 t2 ~* ]5 [/ ~5 g- dma_addr_t dmaphyssrc1 = 0;# r9 D r7 z2 q+ A. l1 i
- dma_addr_t dmaphyssrc2 = 0;! y) w, v: S8 R% j
- dma_addr_t dmaphysdest1 = 0;
+ c; L4 A; @, R+ O; p0 ?1 C - dma_addr_t dmaphysdest2 = 0;
# H- m5 t6 ~7 l9 H& P
7 I8 Q) i" _; C4 I1 m. ~- char *dmabufsrc1 = NULL;; G% b& \/ U2 ]+ A
- char *dmabufsrc2 = NULL;
: w& w$ G' I- L, Y" E - char *dmabufdest1 = NULL;3 B& g7 D3 `9 u
- char *dmabufdest2 = NULL; }3 r6 S- _6 g! _
- . [ c7 o( j p6 t9 X+ `
- static int acnt = 512;
9 J* t3 f* K; f3 R - static int bcnt = 8;
9 h+ J v% i$ Z/ s - static int ccnt = 8;$ [+ m& ^) m" ]% T" X& V u2 a9 e3 d
- 8 L5 Z3 r8 q- f
- module_param(acnt, int, S_IRUGO);! A d) K% K* R& \- `- [
- module_param(bcnt, int, S_IRUGO);
9 d) U$ N* t9 _9 A; ^4 D - module_param(ccnt, int, S_IRUGO);
复制代码
$ C' l* F$ S- u& }& e& N! m3 L% g8 z% p+ _! _! G* T$ l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 D; Z- g% _1 u6 `" Y" Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" Z9 \- t0 k. e7 x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. i! u7 n- ]+ [0 y
6 M8 L- z4 B) O1 f# M( |
2 S! o8 @2 T. I& ]5 d: j |
|