|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # ?1 h1 c7 ^5 p8 M6 b# P
- [code]EDMA sample test application
0 v$ I3 J# @ R4 P3 C - /*. X N$ [ n1 b' D4 `1 _9 n
- * edma_test.c
* x. u& W& ?* x+ {7 p - *
0 \( D( P. T, d) W. I. m0 V8 g - * brief EDMA3 Test Application7 q+ u; v, }) I% `
- *1 e/ E7 c, c' R/ e
- * This file contains EDMA3 Test code.
% e. D/ H5 z2 S8 @ - *. z5 g2 ?6 I" F b! J: t2 x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) e' [- f( h5 L6 s* W. e; [3 t0 I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, O( ~) B( G- R; m9 Y' @$ D2 Z - * TO CHANGE.
2 S& ]1 L0 e4 Y - *
4 V e' t6 u3 T$ Z5 W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& M K" L/ }. ?6 D; E# N" _
- *
' w; q+ m. w; E6 v) b- M - * This program is free software; you can redistribute it and/or
1 o3 n' t8 L$ U& ^% }; E - * modify it under the terms of the GNU General Public License as
/ f7 i7 F$ q: E; @0 G# B1 q, } - * published by the Free Software Foundation version 2.
6 P. p% M" {4 s0 b - *' `* R; A3 v0 h x2 A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 k6 t' V* f9 o8 d! S8 n
- * kind, whether express or implied; without even the implied warranty/ w, I$ Y" }, I7 h3 r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 y: i: l9 l- x& n% @) {3 b2 m4 j
- * GNU General Public License for more details.
3 M. `0 D- k: g" Q0 y - */
* T. R: N* K0 L9 ^! d0 ^ - # p! d- B+ i, H$ k$ A+ `, D$ q
- #include <linux/module.h>6 W) t( g) N+ X' z7 Q E8 P/ [
- #include <linux/init.h>
, b. W+ _( o, C ^ - #include <linux/errno.h>
3 _2 e& z2 O( d( x8 B# g( d - #include <linux/types.h>) V: |% p) }1 V7 x
- #include <linux/interrupt.h>
i$ P0 n- p1 `, J. P2 j$ H4 U# ^ - #include <asm/io.h>
* @$ \0 F7 l: T+ H+ H - #include <linux/moduleparam.h>
) w4 r4 r& E& A9 O - #include <linux/sysctl.h>. m; M* Y6 ?7 m. f% f3 e
- #include <linux/mm.h>! G4 q2 T k" j. j: L) q
- #include <linux/dma-mapping.h>/ ~( S$ t4 Y1 Q- Z
5 `% j2 e3 m1 d- #include <mach/memory.h>
) [2 W9 B- Z: e - #include <mach/hardware.h>
* B8 g5 |( L s6 p - #include <mach/irqs.h>
) B4 K3 o- M* Y1 u - #include <asm/hardware/edma.h>& f M2 _) h# v0 P, U
' ?$ ~9 b. k- _7 m- #undef EDMA3_DEBUG0 \, h) V; L# S h7 o
- /*#define EDMA3_DEBUG*/
: W# e( I; t1 Q3 E* o9 ~% ~% ^ - , O9 L9 V4 w6 f; C9 n
- #ifdef EDMA3_DEBUG
: x& v1 c6 k: K, g" I$ n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 K' u; _- Z2 o" I& E" }3 L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). K5 S* N+ p( D: I/ s) E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( ^: c2 v/ I# Y, Z; m, R0 O
- #else
4 I% U" Q+ _9 o" ^. g - #define DMA_PRINTK( x... )
4 l- L9 `6 x1 [0 I - #define DMA_FN_IN( w+ [4 X1 y3 Q G1 S) d+ v
- #define DMA_FN_OUT2 }* I( X/ m8 v! v8 m1 S: ^
- #endif
' ]2 o% E% b" [6 o+ g- T3 X- L - & J+ x% r: C, a; z* b7 I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- K! z& ^6 L U
- #define STATIC_SHIFT 3
* e0 D( y. U) u6 Z! l4 l2 {1 O; r - #define TCINTEN_SHIFT 201 H# v$ z0 R. W- ? O. E4 q
- #define ITCINTEN_SHIFT 211 a& G1 |( b! a
- #define TCCHEN_SHIFT 22
* h5 |: B5 g. O" V. y - #define ITCCHEN_SHIFT 23& }9 P8 ^% j& @
- % N% z# ]5 a* p
- static volatile int irqraised1 = 0;
) A# N6 k5 k5 @ - static volatile int irqraised2 = 0;( R& k% \5 O; d
! q1 U L: P5 i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! f5 Z6 m, F7 ~- W* V L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ N" k" b2 p }8 [( S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 K2 h- L4 \( N( v5 U6 d
+ [5 B; w8 _' x9 t. ]; }1 X- dma_addr_t dmaphyssrc1 = 0;
" n7 F5 i. t* ~: |8 ^4 k1 M! u9 u - dma_addr_t dmaphyssrc2 = 0;* u4 Y4 T E- L+ [. @$ g+ G
- dma_addr_t dmaphysdest1 = 0;. i, q0 ?. b: y5 e5 z: Z
- dma_addr_t dmaphysdest2 = 0;
1 i0 Q$ d n. F, R: l! W! N" r
. x! B$ V0 g1 Z' z- char *dmabufsrc1 = NULL;; U6 g" m E3 R% n/ ^* W2 j5 Q
- char *dmabufsrc2 = NULL;9 `; z: ~+ I4 H/ \: ]
- char *dmabufdest1 = NULL;
1 k# S+ M, O! }+ G - char *dmabufdest2 = NULL;. h+ q" m( W8 Q4 x# t. S) G5 V
/ U3 \) X4 x5 V, A8 N6 Q& o- static int acnt = 512;1 n0 q3 M4 [7 y2 i
- static int bcnt = 8;
( m q6 `) i* B% ^ - static int ccnt = 8;' U2 B- r) Y8 R7 J& A- z8 s! M
- s8 Q; c3 A% g- _# {; I& J! {$ Z
- module_param(acnt, int, S_IRUGO);
' J* q1 j( X1 A) P - module_param(bcnt, int, S_IRUGO);& e n9 F" N4 w& r! ~; @1 {4 k
- module_param(ccnt, int, S_IRUGO);
复制代码 ; L! H2 Q9 K) F6 B1 c7 y, O( \$ x C
9 i# v s3 {* A1 [7 g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- G$ r8 f: k }6 I: ~6 b _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; \* i; L, G: e9 `9 a2 c5 ^; y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, g" s3 K. B: [- X
4 G- [* F b& ~: a* W# s. K2 [
|
|