|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- b2 p8 u2 p$ p6 _3 V- [code]EDMA sample test application
1 C. K- g+ a& Z$ F, r# u8 O$ q - /*
c+ S% ]4 b, j% p - * edma_test.c* p4 ^/ l! I, t6 z/ _
- *2 N0 `- U+ J# y& D/ V0 N4 ?1 ?
- * brief EDMA3 Test Application
! g; ]* Y/ M6 h) p6 @! A: V - *
" x$ U7 w# h0 F" m - * This file contains EDMA3 Test code.
" ^& j8 B# V2 V5 d- U+ k1 N - *
2 L1 R: F0 H0 ~7 i0 H& w5 {# m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ A, b* L" \% Y/ C# ?$ X3 E0 t: f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ u& b% \( D( Q' v" P7 C' D' a
- * TO CHANGE.! A0 c1 Y4 z: z$ N; T, {3 p p
- *9 j7 g8 M5 V. k7 P2 b5 A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- x7 v' S0 p$ G- F - *
6 D: C" ]5 f1 G3 [ - * This program is free software; you can redistribute it and/or+ @2 ?0 m, G- U; l' z1 m/ z
- * modify it under the terms of the GNU General Public License as
( I+ s D6 z* K7 s* }4 T/ i - * published by the Free Software Foundation version 2.
" |& c2 M* d+ A1 j6 H ^ - *
7 M% E4 }: U0 i7 u( f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: r% X3 ~% j+ ~3 f
- * kind, whether express or implied; without even the implied warranty
' z; L+ d+ e9 K% z' [# S1 k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* a, x0 p- U9 d) S3 i
- * GNU General Public License for more details.+ W# u* W$ }6 k6 [6 _
- */
8 F) p9 D2 r2 O, C. S
4 h# r; R1 a+ _3 Z- e' O! M- #include <linux/module.h>
; D( }* j2 I, m; X; t* X - #include <linux/init.h># n( Q0 }$ J- N+ f. k! D2 k+ S
- #include <linux/errno.h>
) U6 {" Y2 q( _1 m5 L- P - #include <linux/types.h>7 U* h7 {6 g% @ ^; K( h
- #include <linux/interrupt.h>
, l U0 t) Q" G5 R1 E9 t% @ - #include <asm/io.h>
8 U: T) l! d \# s - #include <linux/moduleparam.h>
* j& O$ q; j* k, N/ p- q - #include <linux/sysctl.h>
. }8 f J! G0 Z! T I0 {8 c - #include <linux/mm.h>
( }( u, ]1 B/ o - #include <linux/dma-mapping.h>! B/ x' Z" b* V$ T
; h- c+ q: V v, C1 ]) p- #include <mach/memory.h>
# {+ p" \7 l8 F" x7 r) A - #include <mach/hardware.h>$ M5 X' Z1 b5 e
- #include <mach/irqs.h>$ S. I& t+ W5 t2 }
- #include <asm/hardware/edma.h>+ y% x$ ?, a, Z; e
- K9 A# u7 J2 v9 D+ T# k' K5 ~- #undef EDMA3_DEBUG
$ q5 G8 n4 g. T A0 f3 I1 h - /*#define EDMA3_DEBUG*/. o$ f6 T6 p+ t
- - G0 R- d0 t) d( s0 d3 x# B
- #ifdef EDMA3_DEBUG
9 P k8 _: q0 Y6 O S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ T8 l* r* q( `8 \1 ^$ |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 q& V4 Q7 n! ^7 d# w5 b5 T" x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" H% d0 x" i, t# ]8 s% f
- #else
. n( W; N: v+ i - #define DMA_PRINTK( x... )6 r3 r) k) a1 N# ~/ ~! u
- #define DMA_FN_IN
/ _9 E6 O W( v4 K! `7 ]- w+ ^ - #define DMA_FN_OUT [7 K9 s0 K& L; J9 i' f
- #endif7 w* D1 ~9 B1 q1 m! U
- - N9 U% V* z5 ^% o9 P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, y( }1 y# V1 {' j% r - #define STATIC_SHIFT 33 l) H+ `. ]: s5 d1 k
- #define TCINTEN_SHIFT 20 t/ E7 H; q# A i, g P' {
- #define ITCINTEN_SHIFT 21
: [ `* P: S j - #define TCCHEN_SHIFT 22" Y6 l! o# M- B/ K
- #define ITCCHEN_SHIFT 23/ F, Q# B$ @# H2 `, ?
4 L/ a: J/ w! Q2 U" `- static volatile int irqraised1 = 0;
J3 K- D; m' @+ A& s - static volatile int irqraised2 = 0;2 b1 \/ {' f8 P1 G* g4 q
: _7 V f/ w/ q( T9 d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 c i6 c. M" F. Z! f k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& U4 K8 M9 Y4 `- y7 a2 @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" g9 n% k4 o2 B8 l8 m2 ~; p1 c; ?
- 7 K1 |3 g8 b! T8 i* ^6 m
- dma_addr_t dmaphyssrc1 = 0;) [$ R3 `1 K! N. ?3 a7 j+ q5 L
- dma_addr_t dmaphyssrc2 = 0;1 E3 o; k( K3 k' k' I# c8 A
- dma_addr_t dmaphysdest1 = 0;
3 {: w. T1 D; E2 }7 U( ?2 A - dma_addr_t dmaphysdest2 = 0;
8 |) H/ r4 Q0 T
8 Q- q0 v; f- G+ g/ K- char *dmabufsrc1 = NULL;& _3 g% U8 M6 t6 E
- char *dmabufsrc2 = NULL;& P2 `, u! a, |2 o3 Z; I
- char *dmabufdest1 = NULL;
7 R8 x( X" k/ v$ ]5 E' p& v/ G - char *dmabufdest2 = NULL;
& ]6 l2 L( k% b6 N1 w# W
0 @' g g& @1 \8 x' B q. ? P- static int acnt = 512;, v; y7 |( U! _+ Y7 I
- static int bcnt = 8;
$ }! h6 S8 _6 p. S/ ~! Q - static int ccnt = 8;
1 C7 k+ L1 |6 Z
: a$ f. Z2 G& F: H- module_param(acnt, int, S_IRUGO);
2 h0 R! `5 `8 N - module_param(bcnt, int, S_IRUGO);: Q0 A0 A+ N1 ?5 e2 |' V
- module_param(ccnt, int, S_IRUGO);
复制代码 ; u1 l) b% ]8 x# ~
* D0 {4 D2 j/ p% C% h6 M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% A0 J% I% a4 q& }
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 L8 R0 u, E E. I+ j; G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 K3 O6 |/ o5 Y$ c
; }9 ~6 a% w$ v a
2 w& n- m8 |! M; r |
|