|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " U% m; A8 a1 c$ b* s
- [code]EDMA sample test application
( t' D) y6 y4 m- E7 L' F - /*
: A: n( M: @' r" ]8 _ - * edma_test.c
8 _) g" A- h' K7 \7 t- w - *
$ x0 v: H8 g u( j1 e# j - * brief EDMA3 Test Application' Z5 L* S, D' E- @5 C6 X5 J) k
- *7 D4 S z1 v2 D
- * This file contains EDMA3 Test code.+ H+ u/ o& R+ S
- *7 X4 ?, s2 ?; r( m* L8 {5 d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& J& Q8 y7 P& b4 `7 c* }4 l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 T' p# @2 j: V o8 ` I& U: P, y - * TO CHANGE.: g- N/ @# \, o# ~% k- Y
- *
s7 m: o& I8 Y, q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" q7 Q5 P% Q3 S - *
# W' j& O3 M$ o1 j8 q: q# b - * This program is free software; you can redistribute it and/or
5 ]! @! v5 I8 v- m! n( F8 Y0 O - * modify it under the terms of the GNU General Public License as
+ j- Y, Y5 U, W, M j- |/ n - * published by the Free Software Foundation version 2.- t6 o" F; Y5 L6 u
- *
4 Y( ^: @) F+ a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# b( Q+ a( d u - * kind, whether express or implied; without even the implied warranty0 Y- S+ s) e# |0 [' h, H/ B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 z% {6 n2 j8 F g6 _
- * GNU General Public License for more details.
* q) Y# {$ W+ j# D, d8 D% | - */- X+ G$ @8 V+ K" W
- , I9 O$ P E/ D: H/ n2 x" h
- #include <linux/module.h>
* v2 D" \" x8 ~5 Q9 i& i. m - #include <linux/init.h># ]% r% k4 r' r3 B% q
- #include <linux/errno.h>" ~7 ~! ?. [5 u% y
- #include <linux/types.h>- B1 A2 _3 T/ d @
- #include <linux/interrupt.h>% }* q( ~/ V) K4 S0 ?
- #include <asm/io.h>; b6 U0 d9 A( i7 B$ F g5 u8 f
- #include <linux/moduleparam.h>
! j9 x: `: r! J" \' Z" v+ E1 T - #include <linux/sysctl.h>8 w8 |/ ~# q7 K* U/ k) ]' C
- #include <linux/mm.h>% G$ _1 ~. A7 E! u7 l. c. W9 o+ G% \# _
- #include <linux/dma-mapping.h>
( C* p, m# t" Q1 K4 l% a
- c- i: R5 a, Q+ G- #include <mach/memory.h>: m0 ?. Z: d' e2 n- w& X/ y
- #include <mach/hardware.h>6 X# [* B* c" G( S/ E
- #include <mach/irqs.h>
2 |! L& g3 [! V. n - #include <asm/hardware/edma.h>
4 c* }4 b' E+ q: b5 w7 `
3 w! ^$ `1 _% X! f$ a& Y, J- #undef EDMA3_DEBUG
U8 y" q. t2 |' v - /*#define EDMA3_DEBUG*/
$ n2 |, D3 Q& ]$ R - . P) m X5 n# B4 S
- #ifdef EDMA3_DEBUG
( m/ \ v: z( Z, `9 ]# N& j8 c, T |* a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( i1 b& [( E b/ c A0 o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), W! J/ N" D% J6 i) l4 {7 \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" ~+ B4 L/ ?; i" V# \4 K# D - #else- m l* e9 S5 j1 j1 W
- #define DMA_PRINTK( x... )
1 ^& L) J$ p0 I) y' R5 M' ? - #define DMA_FN_IN/ m4 n' I; i! j
- #define DMA_FN_OUT) ]# F# W1 Z; ]' |' _- G2 K: y4 F
- #endif
8 I1 Z! F' D6 f' Y, F - " e, {8 z j) V+ I% l: | g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( T2 W4 J8 ^! q9 R+ T
- #define STATIC_SHIFT 3
2 b3 y5 ^% E+ q; ] - #define TCINTEN_SHIFT 20
, O8 Y. G1 S0 Y) r - #define ITCINTEN_SHIFT 21$ Z/ D9 R! [: ^& v
- #define TCCHEN_SHIFT 22& U8 E( a5 |$ u
- #define ITCCHEN_SHIFT 23( `7 L6 z; r6 O& _
- ' M' Q2 R8 ]* f& ~7 D
- static volatile int irqraised1 = 0;
- g8 {/ ^7 @2 {: f$ c5 u3 O - static volatile int irqraised2 = 0;
H% F% B/ W* Y% Y$ \0 K8 s
/ s8 {9 m' \5 d+ \3 e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# w: s1 p9 R% ^$ J$ e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 p, J8 y9 |: d- s7 Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; j9 z' Z1 P6 `- \, j- v" P
& v& O) I1 u( w- dma_addr_t dmaphyssrc1 = 0; d0 ]% x% ]9 [" e& ]$ T- h
- dma_addr_t dmaphyssrc2 = 0;& F) }3 J! m. _
- dma_addr_t dmaphysdest1 = 0;
3 A- O- b- B4 _# f - dma_addr_t dmaphysdest2 = 0;; U% h4 K% i: \* V' ^% s
- : N3 O% b; D2 _" ]( C' E8 [) S
- char *dmabufsrc1 = NULL;
/ Q7 s- q! q: a - char *dmabufsrc2 = NULL;
3 U/ m, {2 c$ s- x. ]# } - char *dmabufdest1 = NULL;2 z8 c0 @8 \0 s+ Z- x
- char *dmabufdest2 = NULL;
* Y: Y- Y1 o. \* X8 f5 X - 9 @ f7 l( [4 f( y3 e$ h8 ^
- static int acnt = 512;
* y! w' s! f4 k r. _- P( y - static int bcnt = 8;7 _- [, I* o) B C
- static int ccnt = 8;* X8 G3 r+ w$ j- z) t5 b2 V: y, T
- F5 S& x. B% f& {2 o- module_param(acnt, int, S_IRUGO); L* {9 p+ p. P7 [2 G, Y. P R7 T3 S
- module_param(bcnt, int, S_IRUGO);, n; T3 V9 _6 {* T- a, I
- module_param(ccnt, int, S_IRUGO);
复制代码
0 o. _, D! V. A% ?3 L: J. u" Z) e1 f' u
" C4 X7 [( p5 R; A- H& W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& p8 B' w9 c6 r$ [% d7 G, A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! Q( {7 S% _. D+ y8 f; a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 w( E7 D6 l) J2 `- y7 m7 ~' f! A6 N- w8 U9 ]
+ l0 ~1 p! {+ F |
|