|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . H0 U+ _5 ?2 i" \# o
- [code]EDMA sample test application# Q5 W# L7 X9 H& `+ E: [, v
- /*- Z. t6 q1 J1 n- i) K5 J
- * edma_test.c u& ~: L: s& |. j7 Y8 {
- *
; p6 N# m5 V6 Z9 t& p! ~0 O3 c. M - * brief EDMA3 Test Application; b6 U7 s% ?2 [
- *
5 [! @" d. ]$ _0 m8 I- l - * This file contains EDMA3 Test code.
8 Y3 h" O H6 y - *- O' y9 V' X% [0 n! ^% }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) a, H; y" h$ M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- |8 H5 W% B! M5 F3 N3 m - * TO CHANGE.
& K4 d8 ?5 z- U2 ?' { - *
. R6 m/ J: f8 u9 X( b; P" F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ g: U) ~& H7 t6 W! p( d* | - *, [7 O$ E$ Q) ]( @7 m7 {/ p
- * This program is free software; you can redistribute it and/or
. ~. |; z4 h. F7 Y7 c& R4 y - * modify it under the terms of the GNU General Public License as
/ T# [; O: `* `$ @+ k+ Z% I# x - * published by the Free Software Foundation version 2.
U# K/ J$ t3 b3 ^6 e1 ~ - *
( G* L3 s. o0 b. _% o: V0 }+ D' V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ W! F# t0 }2 C# g - * kind, whether express or implied; without even the implied warranty
& i0 S2 K9 a4 p- k9 c5 c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" g7 i: G5 H; @3 R
- * GNU General Public License for more details.+ g7 b1 V/ q! O/ i; L
- */
3 I2 P1 i' l# b& D8 }2 v' L7 b - $ S% M' s( ^7 \$ u0 x
- #include <linux/module.h>8 Q- k* t# g/ {8 d! C5 D8 ?
- #include <linux/init.h>3 X* c1 Z- k$ X3 A
- #include <linux/errno.h>& p8 i9 w0 a) @& @6 y
- #include <linux/types.h>+ n& ]1 n" g8 s1 Q; [
- #include <linux/interrupt.h>
& w6 ~" E7 g5 Z( ~ - #include <asm/io.h>
; E. c& \- `4 o9 f0 c# ~ - #include <linux/moduleparam.h>
3 k3 b; k: o7 h! V4 I G/ o9 A - #include <linux/sysctl.h>
1 Q7 _7 c$ r9 y9 |) N {+ ` - #include <linux/mm.h>
4 _ O6 J3 w) c9 Y; m& _7 `) [ - #include <linux/dma-mapping.h>; K9 p- H2 C" V/ C9 u& X3 r
- . z2 `2 U2 ~# i b
- #include <mach/memory.h>
7 w0 |/ ?; }# {! f. m - #include <mach/hardware.h>
+ @1 y. W4 A$ ~8 m - #include <mach/irqs.h>
8 M) W, S9 [" }/ L0 R$ G! K& `% [ - #include <asm/hardware/edma.h>$ R H3 |- g1 n- R6 k% i
- 0 z; n' K& \) s8 X- X/ V- g
- #undef EDMA3_DEBUG
1 G1 k+ I1 R" j9 M- i2 \ - /*#define EDMA3_DEBUG*/, A* g" f& y% N3 C2 s) ], i, y
- & N" r8 |3 h: H8 g+ m
- #ifdef EDMA3_DEBUG
# l; v" s4 E+ E) ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 A' R* G, F6 T& u2 R% T- r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: b5 _6 m# e- \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( r( W5 k3 C4 m" z* I9 I! _ - #else
$ J1 l) C% a8 o* |# c - #define DMA_PRINTK( x... )0 a/ [( U1 @ f1 \" x# t( L
- #define DMA_FN_IN
' I6 e7 U8 n2 u6 \4 N! L0 h - #define DMA_FN_OUT+ v! Y. U5 V; V; C. A2 C
- #endif
# t; }. A& ]/ a
/ j) N% ~: U# t5 U3 R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( y2 [5 e- r* O2 v% U& Y7 o - #define STATIC_SHIFT 3) ^, N/ [5 ~, t2 U
- #define TCINTEN_SHIFT 20
' O3 U9 M. n" w5 o - #define ITCINTEN_SHIFT 21, ]* E3 m" h0 }6 _& e0 _: d
- #define TCCHEN_SHIFT 22; a& x% _- b8 J& u m# D' r# s
- #define ITCCHEN_SHIFT 23
. }% P+ f) f; C, ]: G9 M% E
: z' r4 n7 Y3 g1 G, k- static volatile int irqraised1 = 0;0 S' z7 b: E/ X8 f7 F0 Y
- static volatile int irqraised2 = 0;
4 V# }% H$ u9 x1 O5 v+ w: ^
! ]9 I* P% A# x) G) m- h( M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 G( Q/ z" X* b' t( I3 p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 w1 s+ _8 _3 R, W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 h9 y3 b {* W) g" X7 r- z
- $ z0 u! R, t4 K- G/ d
- dma_addr_t dmaphyssrc1 = 0;
% w0 T4 o0 s" |+ y3 _) Q - dma_addr_t dmaphyssrc2 = 0;6 ^5 P1 g2 A5 W8 {2 d
- dma_addr_t dmaphysdest1 = 0;+ m9 L; Q- L$ I; ^7 B0 I/ x6 L2 J
- dma_addr_t dmaphysdest2 = 0;
& J$ t2 s6 f3 N* }: W4 `
' u9 h2 e+ R1 N: S3 R: b- char *dmabufsrc1 = NULL;. b3 h. J9 I5 Q9 U! v! y
- char *dmabufsrc2 = NULL;
0 Q$ r" X7 z" ], H8 r$ r - char *dmabufdest1 = NULL;( _) T5 |( U Y1 ~) S
- char *dmabufdest2 = NULL;
% t# t) A. N: {) A# k
8 J- s. a, X# x2 P: V- static int acnt = 512;
7 w& r! {" O" p- S$ a3 W - static int bcnt = 8;
2 J. \. q( r" P$ N4 e. m6 u: K; k2 N2 y - static int ccnt = 8; S/ c& z( M# e [/ y t
' ~' t' o: ~9 K4 P5 G- F- module_param(acnt, int, S_IRUGO);
" I0 O5 @5 U" N4 v! T5 ?1 J9 U - module_param(bcnt, int, S_IRUGO);
/ X. R2 |* j. D* V0 R - module_param(ccnt, int, S_IRUGO);
复制代码 / Z2 b1 ]% K5 B
6 X- J/ D2 Q) J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 i1 `, q* }) A. p' k3 [( V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 t5 S$ h8 i" V3 y! ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! }# M- c4 q V' w) q* c
1 P& D5 s+ e9 j: l/ F2 ^' I i
; ^- u- E4 b; C+ P0 Q
|
|