|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" b5 }: \" ^9 E- [code]EDMA sample test application/ Y/ s( d0 Z! o+ T+ }/ d/ I$ p
- /*+ E2 e/ m3 [/ T7 v5 g3 F2 [, `8 W3 F
- * edma_test.c
; p) @: ?2 e |4 a - *1 W& C: y/ s6 S' ]7 R
- * brief EDMA3 Test Application, H! I1 Y1 h% S+ ^
- *1 p: v$ t3 Y2 I$ n) S+ P o
- * This file contains EDMA3 Test code.
8 V" W. }, \6 h - *2 Y/ C( ~ q3 k& b: y! p9 p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 j' {6 C5 k# s3 |; e3 k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ v5 G a4 T& O2 y - * TO CHANGE.6 C+ i) b7 c1 |/ E6 _
- *
% s7 r" j ~1 f# k, F- w0 e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 l0 }+ `3 z& D - *4 s' M& e- J+ {, ?% J* I* h
- * This program is free software; you can redistribute it and/or
+ A: n& t6 X! { - * modify it under the terms of the GNU General Public License as
: t l6 H, p X2 J5 Q! ~ - * published by the Free Software Foundation version 2.7 R0 z( z- r4 ~: h
- *
8 p' A$ @9 s' o2 B. n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 I# f& @* V% W/ g; R! ?& G, R- @
- * kind, whether express or implied; without even the implied warranty' \# v+ t! h' L# s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 ?/ L0 {. D2 Q3 S9 s - * GNU General Public License for more details.
4 o5 k1 Z1 Q( h! z( S" ~ - */
% s0 R' N3 r* P- p
6 w- y! G9 V% \: z0 m- #include <linux/module.h>
# h2 a* N! y4 \( p4 r - #include <linux/init.h>+ i2 ]9 m9 G3 j/ f
- #include <linux/errno.h>
# j7 V" |5 Y+ l1 {1 I: K1 U - #include <linux/types.h>. w* k- y* [% m
- #include <linux/interrupt.h>) d! q3 N$ W+ \0 {) M# h, S' T4 \
- #include <asm/io.h>+ \$ h. P2 e1 E% t, z
- #include <linux/moduleparam.h>
# w$ P9 i. ]2 [/ l8 W' o - #include <linux/sysctl.h>
; W: o5 `* S4 y! i - #include <linux/mm.h># _. \6 k N+ H, t' `& A. h2 Z
- #include <linux/dma-mapping.h>1 B7 S- n) D6 O a
4 M3 h" {4 w/ Z, b# ?+ k$ E- #include <mach/memory.h>$ i: a, x$ f, L$ q; Q( k
- #include <mach/hardware.h>
( {" s2 M8 Q* W# _$ O - #include <mach/irqs.h>4 L. A1 I- O2 S+ a; T
- #include <asm/hardware/edma.h>6 | l) M0 b- I
- * w( n2 ]! z8 [" W1 z/ z& G
- #undef EDMA3_DEBUG8 T! b/ _& g( i' ]# R
- /*#define EDMA3_DEBUG*/; j% [/ |) |7 |8 h6 F5 F( ` X
- # o' `4 J7 h9 N; N' l
- #ifdef EDMA3_DEBUG
* r) d5 M" [+ Y3 o7 w1 B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( X& h) A0 k9 y- _, t2 h$ W7 h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% F* h; Y1 V5 N& X/ ~6 O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, O& o" f5 K# j! b, p- A8 O F% J - #else
% Q! G. a$ `& h0 _1 a) U0 S7 i - #define DMA_PRINTK( x... )
/ o7 C. e$ y! j - #define DMA_FN_IN
$ c/ r' ] q/ k* |* h# j - #define DMA_FN_OUT9 `0 D: f- W7 U; e6 d7 e
- #endif
7 m+ d1 n. ^6 H& V - 7 ?2 E Y/ c5 Y, [ h2 s: |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) K% j9 d k3 J. Z$ g3 N) c! v3 ~
- #define STATIC_SHIFT 3
* u; F; ], i& F( J$ A' o - #define TCINTEN_SHIFT 20
' Z b8 ^& ?4 A% O5 Q( t - #define ITCINTEN_SHIFT 21
; Y, y9 n: p! T/ @( | - #define TCCHEN_SHIFT 22' n+ k' ]& t& s+ c1 J% e. @
- #define ITCCHEN_SHIFT 23
. L" X% Z4 I# B) w4 Y7 u* O! g6 ` - O3 }1 r5 ^" j4 @
- static volatile int irqraised1 = 0;( S. {# W6 }( f0 Q1 _4 F! I) m2 b
- static volatile int irqraised2 = 0;
: F) [) T" o m& r/ e; Q, E
4 p7 w4 y) R. u9 {0 b7 a' k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) P% q# F& G3 s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ k f% Y2 X- E+ S9 m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% }1 ~$ Y; F/ v: d, o: w# b e. d+ K - , ]# ?! C+ p& E9 _6 o
- dma_addr_t dmaphyssrc1 = 0;
( Z9 j" C1 B7 \ - dma_addr_t dmaphyssrc2 = 0;* @4 u9 Y! [+ d0 |# z
- dma_addr_t dmaphysdest1 = 0; {" ]8 a3 ~7 v% Y
- dma_addr_t dmaphysdest2 = 0;
$ E+ k7 c* s1 D! h
/ Y" S% a2 r8 F; g& Q' f- char *dmabufsrc1 = NULL;; j. f% ?2 ~; `
- char *dmabufsrc2 = NULL;$ }7 E8 ?' ^- @7 W1 x1 t' K$ U( F
- char *dmabufdest1 = NULL;
7 e! C! w0 ?' ]0 M8 ]& E - char *dmabufdest2 = NULL;; a: H, @/ @, R6 k' a% V' s
8 O' I O- d4 q/ p3 H& B- static int acnt = 512;
- z/ c- E5 e' T6 z1 } M' k; u# a7 u - static int bcnt = 8;; r8 K* l) c, j$ C# B' a2 J$ L7 C: J( H- a
- static int ccnt = 8;
: f! @1 A9 b& y) N4 t - : J7 ^4 d) j; [2 v$ l
- module_param(acnt, int, S_IRUGO);4 C& K1 U6 K) ]; u- L6 o* I. q1 ?
- module_param(bcnt, int, S_IRUGO);
9 A+ B7 `: {3 n2 ]8 l4 ^ - module_param(ccnt, int, S_IRUGO);
复制代码
/ O( `9 D: T1 k6 p
( f+ {. }& @1 n/ { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. |6 Y p5 i1 \& x2 S0 u
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: L6 Q3 }2 Q! i2 a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 t+ r0 S, U. |
7 y& l" g g X9 J0 j* R! u( {1 V7 I6 V' K
|
|