|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 P" g5 H% h: W) J" j- [code]EDMA sample test application& K, x ~/ o: z
- /*8 u0 E: {6 b, w7 U, F
- * edma_test.c
, x" h( E4 B, Z* l, ~ - *9 d: [; w" j$ X3 A
- * brief EDMA3 Test Application
$ N. D) W1 U, d. C' [ - *
1 }! Y. D0 v+ q* J - * This file contains EDMA3 Test code.
( b; w8 o6 ]* d - *; x, d0 _. T4 c* t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* F5 M9 O: z# d7 j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) O0 A3 n6 T! F% {
- * TO CHANGE.! s) J1 ?) G* V/ J
- *
" {# L. x/ e1 ?5 N& H) ^7 p, t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 w& u0 t g+ ]& j1 ]$ L5 C
- *
" n- g& q$ v. F - * This program is free software; you can redistribute it and/or
& r0 I0 p3 w' ~6 m; S - * modify it under the terms of the GNU General Public License as0 g1 z. m) L3 U+ d
- * published by the Free Software Foundation version 2.
# u6 T6 Z6 C' w2 a7 E% ?% k - * ~# H+ t* k9 [$ Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ l: J2 H0 z6 o2 ^ Q
- * kind, whether express or implied; without even the implied warranty% d2 t4 Y$ F" ~, i' ?- I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 a% e7 W) I7 I0 `; D7 Y7 `
- * GNU General Public License for more details.$ M, y% ]" J2 k `
- */
) |( k" u- [4 c6 E4 ~ - 2 I% d* J$ t" U/ ]. P- j
- #include <linux/module.h>
: j8 ^, i$ r2 f. n" i - #include <linux/init.h>
# D( L: t5 U- ]) T9 ^# {/ [: I - #include <linux/errno.h>
: i$ n: b& |8 o [1 [5 C - #include <linux/types.h>
- a5 V9 p, o7 e% b4 h7 U - #include <linux/interrupt.h>: s- l3 M* S! w$ h
- #include <asm/io.h>2 i) G- {: k/ p" r) @6 E( C
- #include <linux/moduleparam.h>( P @' x2 s2 B' |, v# U, e6 F
- #include <linux/sysctl.h>" H: D% f! ]: A# Q
- #include <linux/mm.h>
+ r: W) z: ]7 M8 m - #include <linux/dma-mapping.h>4 u% a0 R: p$ ]+ `! @% T2 r( U
8 T9 n5 w" r, w9 n& J- #include <mach/memory.h>
( ~, ^/ K8 e$ ] - #include <mach/hardware.h>
* Y+ m' i% k e - #include <mach/irqs.h>0 t% @' C c" ~2 ^. R# e
- #include <asm/hardware/edma.h>! y% Y" b1 f+ B! \( d1 s
- 7 b6 m0 S/ m Y. D# ?& Y
- #undef EDMA3_DEBUG" o, `5 g! T* n# r' [
- /*#define EDMA3_DEBUG*/* J- |0 q/ D& c6 t) j6 _
- ; b* z! J8 k( h5 P- O: l
- #ifdef EDMA3_DEBUG
! N5 W5 ~8 `0 |3 T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 D. c4 \1 ? z1 ]/ B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! b! D' n: z) }- B8 a$ W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 g( L0 J4 d" E" h# v. W- Z x - #else
1 i8 j* @% g9 {7 r - #define DMA_PRINTK( x... )
' o! N$ e/ A M8 ? - #define DMA_FN_IN
) b* X$ T. R. h% l' \$ C4 y% h( Q - #define DMA_FN_OUT
1 h7 N; s& E# k - #endif
/ y4 h; @2 Z) j% u! g7 h7 Y: W
( R$ F- `" Q; W' ~- m! a& T- #define MAX_DMA_TRANSFER_IN_BYTES (32768). k( G* T9 j( l& ~
- #define STATIC_SHIFT 3- ~, {: E4 L7 H) F3 m
- #define TCINTEN_SHIFT 20
5 l0 G6 E' x: E* \ - #define ITCINTEN_SHIFT 21
6 ^) @9 b. {) ~) y: v6 [, z - #define TCCHEN_SHIFT 22; H$ I2 Y' f& F
- #define ITCCHEN_SHIFT 23
9 L0 s4 E: y7 n2 U" l1 J3 ^7 {2 j - ' s4 `2 V$ H( V, j8 z- |3 W
- static volatile int irqraised1 = 0;0 e! N/ W8 N) ]4 j7 Q$ ?+ }
- static volatile int irqraised2 = 0;
6 P; K: \$ g5 A& w+ E9 [
( x$ Q7 s+ s% \ V/ ?% l' A6 N8 O5 U* h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, h, F d9 P' P; z' T. s6 V& Q" f5 \; U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 `) M$ p5 G2 h) R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 S+ ~: v& u5 k! m% S - ! B$ v. _6 x1 j6 o$ I
- dma_addr_t dmaphyssrc1 = 0;; W/ Z4 O( Z& \& M. g& P' R
- dma_addr_t dmaphyssrc2 = 0;! |4 r, q: z+ C/ ^
- dma_addr_t dmaphysdest1 = 0;# k, }% C2 [3 B h1 |0 U
- dma_addr_t dmaphysdest2 = 0;) ?( n1 X8 |" R+ H# l
- |: W5 q) V1 ?8 A' f$ T- char *dmabufsrc1 = NULL;
' D- K% o' A- P7 D4 ^ - char *dmabufsrc2 = NULL;
! M! i% v' p }, G) W - char *dmabufdest1 = NULL;
# ?. k+ `( H: ~4 E" c% a - char *dmabufdest2 = NULL;" m% j1 a R% |! }+ b; m% l
5 |2 Y* R: J% e9 n1 m! N- static int acnt = 512;! K+ P" h, @) a/ o2 s3 H
- static int bcnt = 8;
1 G2 o5 t, z' s8 d% [7 A - static int ccnt = 8;
8 }% i4 H/ d, T7 G6 p - : `/ @, I0 ?/ j+ L% P
- module_param(acnt, int, S_IRUGO);
( Y' L, |4 U$ e" W: _7 ]: _: n# C - module_param(bcnt, int, S_IRUGO);2 o2 u- t1 `& A. Q
- module_param(ccnt, int, S_IRUGO);
复制代码
7 k h$ _5 h, q/ @* H2 Q7 a4 y6 v0 S! w, _7 e0 X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! v5 |$ M% ?- a4 `; X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* p- y% S5 d% ~# a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 p4 `3 M3 k0 A" F
8 N2 |& E/ o" w7 F
; A, z# H- f0 V' @/ c* I6 l- Q |
|