|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 ~3 h/ ?# m3 x$ S
- [code]EDMA sample test application
) W9 o3 x; v2 k& ]' n+ I5 K0 E0 X - /** v4 |9 w% R) J* V% n
- * edma_test.c
& Y( S7 u4 E7 Y& N% U - *9 p5 Y p& P3 D9 B6 h7 P( j
- * brief EDMA3 Test Application3 @7 [, B q6 H
- *
6 q0 e, y; }/ J1 z: u" \0 J4 { - * This file contains EDMA3 Test code.
: A5 I& v9 ?' z( L) i6 U - */ Q$ |6 T* l/ n8 I* M* l* V6 |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 k5 h! {" S5 _9 b) Q4 c6 ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 {3 X+ w, L! O4 V% C - * TO CHANGE.$ f9 D! |- N& V3 s' {8 f0 T
- *- j1 w" W. z2 d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 o2 _0 x" F) m. B/ e
- *
$ Y! E, `4 A4 i/ E- A - * This program is free software; you can redistribute it and/or8 o+ _3 z& ~. V; G6 I
- * modify it under the terms of the GNU General Public License as
$ |! F) J+ \8 f. d' @- H t - * published by the Free Software Foundation version 2./ B" p$ C- c8 c4 |9 b
- *1 j z2 D! u& R( ^" F& p: L7 }* B2 Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 _$ |# K8 Q! i) Y) \- U - * kind, whether express or implied; without even the implied warranty5 |: b; ] ~( `' N6 {4 Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, ^+ J& a3 u; Y5 }4 f
- * GNU General Public License for more details.' G0 w& o2 l$ o$ {
- */# K5 o s$ v" `% M5 K
- M6 Q, f, T+ s/ Y" k- #include <linux/module.h>
* S! I) @$ T: \: A; Z$ a/ n - #include <linux/init.h>
+ e2 O5 Y3 @" t4 ?, c - #include <linux/errno.h>
x+ {3 w1 \) i! {+ ] - #include <linux/types.h>. E# D. z. B" L" [
- #include <linux/interrupt.h>
- @9 B* Y0 r `# x9 F- r" f - #include <asm/io.h>, n) F( \2 I1 @* q/ B8 I
- #include <linux/moduleparam.h>
: o4 v' i8 b0 ?: W - #include <linux/sysctl.h>
6 N# \2 I9 `# r* N2 K! O3 g - #include <linux/mm.h>
5 z0 j- \6 `. p! C% o4 U - #include <linux/dma-mapping.h>) f3 x) B0 Z {* j9 k8 b! o
- . {, ]' a: U/ i% l; x: ?$ q$ z- n
- #include <mach/memory.h>; }' ], @; Z0 F ^/ ?
- #include <mach/hardware.h>
* {0 R* q& L. \6 A - #include <mach/irqs.h># x# O' j% @5 W
- #include <asm/hardware/edma.h>
6 o' z2 W, I% b" Y/ Y( [* h - / h% w5 V A. E: I9 B
- #undef EDMA3_DEBUG
$ {2 S! k- A( q7 w0 s - /*#define EDMA3_DEBUG*/
2 @0 w/ M! E' [5 C - ; c9 w" S: e) [" w% \ }7 Y
- #ifdef EDMA3_DEBUG
8 w' Q' U9 [2 B6 M% P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& T6 k$ j" }) [$ a) n: C/ T/ s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% C; _+ y$ T$ L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); e7 o) _& \4 H+ L0 v# i
- #else- b: @$ N M6 M6 p/ c5 D' t6 r
- #define DMA_PRINTK( x... )
$ b# E! v4 O, x8 m, y - #define DMA_FN_IN$ B9 f3 Y# `' Q' L* D) q
- #define DMA_FN_OUT. s# L" O' _, L/ Q. \2 \" y# M
- #endif
. {! v4 d8 i# x! [5 X9 Y7 l - 9 P& B0 r8 B* G8 x' a+ R: P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), K3 C+ \$ O) i, I, U4 H
- #define STATIC_SHIFT 3
3 b6 a" Y! D7 J* [ - #define TCINTEN_SHIFT 20
% `. q6 Y* Y) m - #define ITCINTEN_SHIFT 21 Y* M9 J0 a2 b) r- `, |7 u
- #define TCCHEN_SHIFT 22
& A* F! \. T: D! I) y1 q - #define ITCCHEN_SHIFT 23! M1 K& o5 h% N
- + u5 o4 t# C) q, b/ v
- static volatile int irqraised1 = 0;
1 v5 @# c- X, \1 O$ q: m0 q' D - static volatile int irqraised2 = 0;7 j7 P# `1 z* S5 `- B% z
3 I! a8 e8 w3 @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 S# J7 \7 C) b3 U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ^5 [9 s( ]: \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; l, S9 S" v ]
$ r2 Z5 V& o& g- dma_addr_t dmaphyssrc1 = 0;
3 J$ e1 F6 [/ u7 T6 {4 n - dma_addr_t dmaphyssrc2 = 0;
8 q" k9 J5 s% c" {5 k - dma_addr_t dmaphysdest1 = 0;1 `# ~2 w0 Q# n; N2 s
- dma_addr_t dmaphysdest2 = 0;
2 ^* z2 A+ ^3 I/ T& O( N8 E
0 R# Q4 L8 E) j" Z. e4 V* Y0 _- char *dmabufsrc1 = NULL;& c4 G2 v5 c% {( A% N2 a/ J
- char *dmabufsrc2 = NULL;
6 D I7 N2 e4 R# \# `- ^+ M - char *dmabufdest1 = NULL;
6 I6 g( a* R5 y! \) X* i& o - char *dmabufdest2 = NULL;/ U, I1 f- c$ p; L& T* A) z' c
- ! u6 B. {+ ~8 x" N& U4 {; J/ j: }, c1 @
- static int acnt = 512;
$ ^6 L+ }2 c) V) v5 @/ i7 J - static int bcnt = 8;
( f! F2 ~2 e- E; b7 ?) d - static int ccnt = 8;
. G E2 `4 g5 c$ ]
2 j/ O5 D }% P/ c6 j. V- module_param(acnt, int, S_IRUGO);& {; y% [2 z: l" A
- module_param(bcnt, int, S_IRUGO);! j; @ F4 G$ F5 }) F$ Q
- module_param(ccnt, int, S_IRUGO);
复制代码
' m: ~. d( i% C2 t) N. t1 p& W* [) {1 e' k7 a/ ~8 S* ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" c7 Q- `, K" B. Z; _% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 i& Y7 l6 T9 w+ f* T% z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 j& d$ K; U4 e$ w
! A" p t5 e( M( S3 g& I' Y! D0 A, W. w% E5 J1 ~ R3 t
|
|