|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) j' I- ?# k) Q$ x$ ^
- [code]EDMA sample test application
9 r! n9 {, b& d) a, h - /*7 |# J; D2 a; {0 z; l
- * edma_test.c
& p! C9 @+ Y6 A- ^4 V1 c - *7 D' v; S Q' u$ W% j: C! J
- * brief EDMA3 Test Application* e! _: I$ a3 J2 H1 d) }7 ]% w
- *
, Z) |+ c" m' R: R# ^* L3 D+ o - * This file contains EDMA3 Test code.
7 K" F) {2 f6 P7 E - *
9 `. g8 l% e0 N2 M$ j" \0 u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 R. ?& a/ V5 r5 n' D+ E7 X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 @) r# @1 H- F; T$ Y3 G) _
- * TO CHANGE.
% ]9 A D+ }9 @& { - *7 W3 n! h3 r1 X" H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ Z* p* F* y0 m$ t2 @
- *- B; t; n3 R8 L# t% ^
- * This program is free software; you can redistribute it and/or8 g0 M3 j: O" F4 k: _) [
- * modify it under the terms of the GNU General Public License as7 X2 B9 o$ q c
- * published by the Free Software Foundation version 2.
$ M5 v" n( _' m& G - *
, ]- x, V; e; e9 R" Z& z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 r2 e X: E% g9 x9 A+ B n - * kind, whether express or implied; without even the implied warranty
2 {' m |6 [# P' l% ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ y/ c7 `5 r q$ Z
- * GNU General Public License for more details.
I/ J2 W8 i* p" b: `9 [4 m" x - */7 W& ]" K; V# ^' c
# S# B! e/ k w1 u- #include <linux/module.h>
; _0 q. i' E) ~# I! S2 x: o [ - #include <linux/init.h>
8 U9 B5 R9 {. g j" S* a - #include <linux/errno.h>" k8 z* M% [8 B9 u& d/ F
- #include <linux/types.h>
# D, W1 j$ v3 |: `9 Z. C - #include <linux/interrupt.h>6 v4 Q: W& @7 [2 z; N: S
- #include <asm/io.h>0 u+ w2 s1 F/ k1 M0 p
- #include <linux/moduleparam.h>
0 [5 s* B0 Q. i) i+ t - #include <linux/sysctl.h>
* a8 y6 M" ^( _# T" d4 v - #include <linux/mm.h>; m4 u: H. [8 z$ \5 M0 }
- #include <linux/dma-mapping.h>
0 H% j2 Q8 _9 |/ u( q- [
' s0 ]0 e G7 |) A8 ?9 Q6 @9 X* ^& }5 P- #include <mach/memory.h>$ D8 ^3 [" i- F; U( \0 l
- #include <mach/hardware.h>! A) ], |& S& X6 K# f1 y
- #include <mach/irqs.h># I$ C( y7 w5 ]* f. J d6 o
- #include <asm/hardware/edma.h>
6 H4 J# @5 I. u1 t3 W - + ~+ p {. P( l( a% b% O% x' t) B) S( L
- #undef EDMA3_DEBUG
& E8 \% X1 u& s$ H1 ^ - /*#define EDMA3_DEBUG*/
1 o7 T' g% H4 c6 V( _& R - + D; d$ \- o& l5 p
- #ifdef EDMA3_DEBUG
9 S0 U% n" [/ A3 B8 g. K# k7 B$ Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 a. w! j6 A+ S' _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# t6 ~- B: n' g1 h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 u& `$ [! D0 x/ x& W$ j5 Z8 o - #else8 n6 q; g4 _$ {5 v* h8 C0 l/ Q
- #define DMA_PRINTK( x... )
) N, Z! Y( D. H$ T `$ h% b - #define DMA_FN_IN
$ D" T, b& t3 m r - #define DMA_FN_OUT
1 c" N4 f& N+ c - #endif
. P0 `1 Y$ Q4 x. c7 U - c+ x+ d1 j6 b7 o( G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 [8 U" w0 c$ ]1 m% B: H5 N
- #define STATIC_SHIFT 33 f& s. z9 G, t% r
- #define TCINTEN_SHIFT 20
* a& d. p. U7 H; o4 p l) I% s7 { - #define ITCINTEN_SHIFT 21! l% O$ _* X& @7 f# q
- #define TCCHEN_SHIFT 22
, c$ f8 v7 M/ d5 N: P - #define ITCCHEN_SHIFT 23* x' i* q% t* k2 K6 r* o! n. ~
- 5 V! x0 w( k" f
- static volatile int irqraised1 = 0;
( r6 w: Q9 k6 b2 L2 ^$ A4 h; j1 ? - static volatile int irqraised2 = 0;
: i& r9 @0 D8 o, M$ b) F - % ?7 D8 |0 v& l L4 T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: `' ~6 b" ~6 }! A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ p& o4 j2 Z8 y2 J! @# \1 m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) c; l8 D `) u+ H0 {+ R& G, s
- " i- \$ m& c+ _. `
- dma_addr_t dmaphyssrc1 = 0;
) x/ M) x6 X, n - dma_addr_t dmaphyssrc2 = 0;; [! d& o/ t; L( ~" X! r
- dma_addr_t dmaphysdest1 = 0;
5 d3 ]* t+ `. P7 X - dma_addr_t dmaphysdest2 = 0; p8 Z: X J Q9 o$ L( K0 S* I' v
5 C3 ^4 }( \$ h8 q/ t( r- char *dmabufsrc1 = NULL;
5 z* g6 [: [3 K! Q% O - char *dmabufsrc2 = NULL;- B) D3 ~0 E/ b6 O' N; ] f% D
- char *dmabufdest1 = NULL;
# {! z7 }; C* B/ Z) [7 x3 O% u; I - char *dmabufdest2 = NULL;/ t r! H+ z6 P6 ~
6 y$ f5 Q) e% v" v; w- static int acnt = 512;
/ T& i( A& x2 J, A4 @2 C: q - static int bcnt = 8;
) I" a* g4 ?, P' H/ c$ S - static int ccnt = 8;$ c. a3 H3 h4 g/ q" N4 _
& f+ |. ^- B: J# T2 Q- module_param(acnt, int, S_IRUGO);- L5 X) |/ G, w6 G- s
- module_param(bcnt, int, S_IRUGO);" _0 u- j! T" o/ O
- module_param(ccnt, int, S_IRUGO);
复制代码
3 m1 Z2 \$ v. @/ Q ~. m( l& o
1 }1 ], Y T2 N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& [' l7 |9 V; M2 i+ ~. P( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: U- {5 M# Q/ X; c, Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 R" p! v3 V2 c! `7 k* K
/ ] x$ }0 {7 O6 t0 F" O2 h: a. A& L& I4 s
|
|