|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 `( f3 W# ?" J/ G- [code]EDMA sample test application
! Y5 [6 r+ Z, ?5 O! F3 X2 v' t - /*
- Z4 C$ }- v$ _8 o' e2 F - * edma_test.c
( `. u2 g) A% T: l7 R& Z - * f4 s. T! x8 C* ?: k
- * brief EDMA3 Test Application
# C8 D) q" E$ r! U8 W - *" x* L9 u4 ]- V h: @/ Q
- * This file contains EDMA3 Test code.3 d+ G" z2 |/ E& F6 b2 P' o
- *
( k6 {2 |$ X/ K2 g0 F& i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) U% m) q! ?) l9 T& R+ B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 g$ Q# ]+ t @9 T% J6 ^ - * TO CHANGE.( s' _3 H# \. z& o4 c# E
- *5 |- D: M/ A3 Q5 N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 q5 J$ Y# h ?1 ?) _* ~8 d' I! y1 W
- *& c; ]" X3 g5 u( @3 N
- * This program is free software; you can redistribute it and/or. w( ^1 i, f7 Q3 c
- * modify it under the terms of the GNU General Public License as9 n$ e7 g2 F0 R* \* g
- * published by the Free Software Foundation version 2.
3 g% i: }* a) {4 d - *
5 E+ V# ]/ M" Q f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- ?4 j4 O6 S' O/ t
- * kind, whether express or implied; without even the implied warranty; g1 l9 i/ ]7 i$ }, P- I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ ~: S) U& {, k! k3 G+ g1 j
- * GNU General Public License for more details.
Z# @& @# d) y' U, w - */
! S: G* C% R) Z0 ^ C
5 ?& Y9 _- E9 w% t/ C- #include <linux/module.h>. ?" P& l) C9 p7 S3 S" G- R7 v G
- #include <linux/init.h>
! K9 E& _3 n+ {3 N9 s - #include <linux/errno.h>: T7 O. t, M) I2 v- T) M
- #include <linux/types.h>' b; G3 y; R) T. n0 c5 ~* N5 D6 W
- #include <linux/interrupt.h>0 P7 `( }) k; O' E
- #include <asm/io.h>2 s7 i8 J% `5 @/ Z$ e3 j3 q
- #include <linux/moduleparam.h>
. y% B* w ]& Y( c - #include <linux/sysctl.h>
& n6 @4 y& A- }8 F6 S$ e( j - #include <linux/mm.h>' x1 `5 y, ?' @4 r) s
- #include <linux/dma-mapping.h>. O& _) G# Q1 g/ x4 h% l z
X J* K4 l; G- #include <mach/memory.h>3 P! w& P# {! s2 H
- #include <mach/hardware.h>
; g9 h8 |% u4 y; m. n. E3 h - #include <mach/irqs.h>
/ V; |+ q7 e: m. F0 j$ ` - #include <asm/hardware/edma.h>9 d2 n+ E1 g w
- - h) R. M! y3 @! K; A; c
- #undef EDMA3_DEBUG/ w7 t/ Z. B1 Z. ~5 p
- /*#define EDMA3_DEBUG*/
- ]5 n, ?4 B9 D' Q! O - 4 D6 V9 _0 e" p D2 {4 X' V' f* C: F
- #ifdef EDMA3_DEBUG( `+ j/ e8 L8 X, `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ b* Q0 G1 I0 C( j: U- A& ?- Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 b! A7 D/ ] ~- H1 `7 s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ v# p3 `% k" v" v# v
- #else
0 `( ^- x4 _: g# s. ]/ j - #define DMA_PRINTK( x... )
+ @5 l; \( T( d9 L - #define DMA_FN_IN6 @: Q( O. q3 ]5 L$ j% _
- #define DMA_FN_OUT4 M5 O/ G2 s, t/ c3 G; ]+ h; Y
- #endif
0 ~& J1 e) V3 r* X - , b7 ?& T) w7 F, v1 L+ ~$ G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ ]) a/ O5 b; V. n6 q6 p' \8 t+ ^ - #define STATIC_SHIFT 3- T+ m5 r' ]4 g9 ]1 b6 ?! c7 M
- #define TCINTEN_SHIFT 20
: o, T6 D9 v, E+ m: i4 T7 _ - #define ITCINTEN_SHIFT 21
, r8 U4 u0 _# D+ w - #define TCCHEN_SHIFT 22
* F6 ~" y5 f: k8 Y G% m' q$ ? - #define ITCCHEN_SHIFT 237 s4 o8 L, ^& C0 D0 l, G! z
- 1 J- g% N* z' B Z) u3 Z" p
- static volatile int irqraised1 = 0;
8 p4 ~& ` C J, y5 ?1 z - static volatile int irqraised2 = 0;
5 e% o" f4 H' Z3 z - ; g; _* l7 x, e: c5 d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 A2 F8 j" p0 z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- k$ r5 j( e( k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. W/ D3 W* h4 C) R4 v) D; \% M
$ ~9 t( Z; _: w% V% Z7 `- dma_addr_t dmaphyssrc1 = 0;
. p# p7 t5 v1 H. A - dma_addr_t dmaphyssrc2 = 0;
' O' V1 f5 \% v6 p0 \0 J* `2 }1 ` - dma_addr_t dmaphysdest1 = 0;8 N% n9 ?7 ?4 F: C( t
- dma_addr_t dmaphysdest2 = 0;7 o% R! j( a$ n! T
- , |$ i- X: Z# m" Q7 U$ e
- char *dmabufsrc1 = NULL;1 O) L* j7 V- Y
- char *dmabufsrc2 = NULL;
2 C) r3 e5 b8 w" o4 t9 m - char *dmabufdest1 = NULL;- b6 J, m# q+ m) s
- char *dmabufdest2 = NULL;
* f+ q+ [; h: s) w5 k
m- T! M; r5 L; r- static int acnt = 512;4 Y: R" ?# d; p2 c- }
- static int bcnt = 8;
5 K: K4 P2 ?& S. `( |7 B6 J - static int ccnt = 8;
6 ]8 k* r9 ?( i* ?0 @& u& v- g - 5 L& \3 ~# i0 D, \0 G! c& V
- module_param(acnt, int, S_IRUGO);
4 c" p+ Z1 c! H/ T; | - module_param(bcnt, int, S_IRUGO);
$ D1 I5 b4 A1 I9 J' o - module_param(ccnt, int, S_IRUGO);
复制代码 & E8 c; K9 ^' I8 c/ f
- p d5 l9 w4 q! [$ m$ @ i: o% O) @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# p$ I) `: A& D8 Z$ S2 |5 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. O( i0 v& J7 V# s5 n) i6 g1 r3 ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ v( V6 n+ {( V
, a" T2 g# s4 E* z2 g
5 f4 h- Q3 i" Y* b ?
|
|