|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , ~# G& `9 [8 p8 D: c: |" x& J* @( _
- [code]EDMA sample test application
& n/ H" W, H! U - /*' u: k+ Z5 `/ }! }+ t3 X
- * edma_test.c) }7 I# ?7 B) ?$ S
- *
' I: J* X9 p3 w - * brief EDMA3 Test Application
6 `# N6 l. x5 D0 L! I- F% d: F( s - *9 _9 a2 I) I: m. ^
- * This file contains EDMA3 Test code.
9 [; q1 I* w" C6 H1 i - *4 M; m' ?2 M+ i3 ~8 }. T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 r# [1 T) U9 V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 |! o6 }6 @" e$ J6 ]: t H; D
- * TO CHANGE.
. `* y# v' c, m0 a4 K. [- b8 q - *8 R5 a0 }/ S. n+ W! _7 F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 @8 Y: E! q4 v+ w/ U& S/ ?. \4 y; | - *
( y! Q5 _: `' ^: ?: ] - * This program is free software; you can redistribute it and/or
6 Q5 r, J. e; t: v3 Y$ t - * modify it under the terms of the GNU General Public License as
' i' n; Z8 A3 ~: S) M - * published by the Free Software Foundation version 2.; l! g2 X0 g& e: N4 b' J
- *, n0 ?$ a# ^; M1 x [$ Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ K0 c( I1 L9 ]0 b1 J ~9 l - * kind, whether express or implied; without even the implied warranty+ r. {2 W0 v$ Z9 Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ x! L/ S5 W1 O6 J# w( ` - * GNU General Public License for more details.5 h! k) j, c# b$ X7 S
- */
! M! M# r. w4 v
( N) K+ n% P) Y) F, a1 x- #include <linux/module.h>
2 ~& S* k( X# M$ K( y- ?: q5 s9 ~ - #include <linux/init.h>
1 K5 ~& b6 o% u9 F - #include <linux/errno.h>- B# x* z" b/ Z$ d
- #include <linux/types.h>
; q+ Z- q! r0 g% i8 x+ ]: G - #include <linux/interrupt.h>6 m, {, T+ ^% y, {. y0 z
- #include <asm/io.h>
9 Z$ X1 W' |) ] - #include <linux/moduleparam.h>$ V( k& O3 n x. W
- #include <linux/sysctl.h># O" E9 ~& s3 Z$ `, J9 R ^
- #include <linux/mm.h>& }$ P# d. X% k) d( Y" }
- #include <linux/dma-mapping.h>4 t% @" o% g+ w0 u. u; L; n
- ' E2 p c4 S7 a; s/ ~3 e# ]
- #include <mach/memory.h>: m0 g- n/ g0 H. F
- #include <mach/hardware.h>
' H+ w- F9 M. q$ P( p - #include <mach/irqs.h>
. D6 Y. h1 ~6 `( X C1 ^6 n - #include <asm/hardware/edma.h>
6 G3 l( e+ `+ R; O/ x# B, y0 l - $ O3 {" y5 }; G0 [7 J
- #undef EDMA3_DEBUG
% h1 D. P0 ]3 Z% X# ^! i' U - /*#define EDMA3_DEBUG*/
! u; E" s1 ~/ k3 u* s - 5 R$ @8 r) |5 J: P
- #ifdef EDMA3_DEBUG; B4 L+ y) F: r: L" ?( R. k2 k1 l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 T( W. K+ N6 U1 Z% ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 m1 I, w. w F% Z! [. W5 a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ Q! P) i: M( _
- #else
$ Y, E! M& S: C - #define DMA_PRINTK( x... )
5 w6 D7 n" r: K; I& \. [) l$ ^$ A - #define DMA_FN_IN
7 t) L! D! j3 n5 ~% c - #define DMA_FN_OUT
" L: U: v! u" g |1 E9 Y: ^ - #endif
) k& E$ {! _4 R& Q - 3 ]- ?( S/ N, T: u) ]3 i( x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ C6 P! @( \( \/ K9 {8 y" ?. F: p - #define STATIC_SHIFT 3) v/ C& A; V6 E# m& @# g/ ~) f
- #define TCINTEN_SHIFT 20: |2 x5 V: z% R+ ?* K
- #define ITCINTEN_SHIFT 21" [3 E& ^# A3 ^7 T2 I* V" n" O+ M
- #define TCCHEN_SHIFT 221 ~, s( p* N( ]$ G$ A3 I
- #define ITCCHEN_SHIFT 23
+ z& s$ X6 m; N7 D$ b - 9 s+ R) [% _* h6 [: T
- static volatile int irqraised1 = 0;4 ]8 H3 @! m) H& D9 b
- static volatile int irqraised2 = 0;# e! o+ Z& D. J# L9 S$ X0 o2 Q: O
- ) I4 C: P9 l% u- e: N* F! g2 C$ c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! C8 y' o9 ^3 V8 r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ O" W! x7 p% F( Q4 G) Y! j4 }, ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 v6 K# c' A8 C( B& G% _
# n E: h, q; d7 C- dma_addr_t dmaphyssrc1 = 0;' [# s. l# Q6 o
- dma_addr_t dmaphyssrc2 = 0;
0 E$ u( H1 a) g* d* c1 ]$ I% \. _* o - dma_addr_t dmaphysdest1 = 0;% \* b1 v9 P# `$ [- R$ x; m' @
- dma_addr_t dmaphysdest2 = 0;
0 A6 E4 u z# e' ?
V, Z9 A( s$ [9 p- char *dmabufsrc1 = NULL;9 C" m: K$ g. q+ p
- char *dmabufsrc2 = NULL;
6 r* X2 {* \/ s5 v+ _7 y - char *dmabufdest1 = NULL;
9 x6 S5 S6 e' C* y - char *dmabufdest2 = NULL;# ^3 J6 U' q4 P# a$ g# A
3 _$ R* }- v& }8 Z# f# m, X2 K- static int acnt = 512;" M8 k% D) w `
- static int bcnt = 8;
& J# }6 w# ~# w5 J; S; G/ I* S* X5 F( F - static int ccnt = 8;4 h; z' T1 z% w8 H- M- Y+ ]* H
. B! x' w- @" R1 s& V- module_param(acnt, int, S_IRUGO);
. B' I: A2 T' E0 l/ H: |5 b# V - module_param(bcnt, int, S_IRUGO);6 g: s8 i0 F P& L5 l: ^4 Q
- module_param(ccnt, int, S_IRUGO);
复制代码 0 j+ e3 {$ e: ?9 V* }
/ s) v3 S: c' N# l4 ^5 S+ R4 P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) U+ P3 ?4 `, P7 z; V5 V; L1 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 J( K3 ?& f7 K7 E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ w$ c0 K9 F- a# l# W$ N2 O1 ?* g7 o2 a$ u ~( O* o, S
0 ^' L+ @* T5 z: R3 G& Y |
|