|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 f" s. H- u0 x" ]( c- [code]EDMA sample test application7 a$ K+ S. \! o- u3 M a' B; h8 U
- /*4 ~% _, D& I+ x5 F0 m) b _
- * edma_test.c
6 A# A" {! j& {: T- f/ y+ H6 U& F - *: U& w. \+ ~ C# v( R/ V) L. V0 m. d
- * brief EDMA3 Test Application7 r: t2 u: {! [% v
- *0 e. {) j1 q* R2 G; E5 g$ A
- * This file contains EDMA3 Test code.3 q/ P4 Q# s: D, ~9 t4 q! I( f/ O- h
- *
@! ]2 n" H: N- T3 u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 ]. C9 S) r) ^2 |3 q3 J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 Z4 t: ?& q4 q+ M# w. G - * TO CHANGE.' @0 r2 F" B# ~
- *% F+ g! v" Z) z7 x$ x, T. m+ p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 h& O: g- }% c* U- a
- ** u4 q! `1 N' | O" ^( p% r3 g
- * This program is free software; you can redistribute it and/or
) Q2 @( i S5 t, o - * modify it under the terms of the GNU General Public License as
7 L& Q/ R3 p: a9 s' p - * published by the Free Software Foundation version 2.3 F; i" e+ C$ \8 L F4 y
- *, w( J# h4 Y( K' F9 c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! U& E) a8 b. l) B/ W6 o4 x1 } - * kind, whether express or implied; without even the implied warranty! _: \% d' Q: C9 C1 M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( N9 L" I" @3 E' |7 n
- * GNU General Public License for more details.
' D: i8 |( B3 x - */
/ q. E& Q! A6 \, E - + E1 a0 T7 R3 s: i+ N) x( o j
- #include <linux/module.h>: D% M7 c2 p5 J$ r: C
- #include <linux/init.h>
7 o) D/ u+ p) k) P; H9 n - #include <linux/errno.h>
& |' i2 m! W3 `* X* ~) f - #include <linux/types.h>
5 K( p; [) i( q3 x7 s - #include <linux/interrupt.h>) p: G! S3 r) u( D4 R( a$ e
- #include <asm/io.h>
4 t4 A5 R/ a. |. X- E - #include <linux/moduleparam.h>
5 ~( L$ P& R/ R7 U0 ?$ u1 j8 {4 k* {; l - #include <linux/sysctl.h>
+ o" s' p1 r5 P3 W& h+ S - #include <linux/mm.h>" A+ J- z F2 S$ w
- #include <linux/dma-mapping.h>' l2 ~; f# O' U+ n; w/ f) N
- / ~8 Y! @& Y8 i& B1 N
- #include <mach/memory.h>: v1 @7 w5 g' q* Y
- #include <mach/hardware.h>" I+ b g' @, f. p, s& p% V1 b
- #include <mach/irqs.h>
0 J+ G. S4 `. |, p- @$ } - #include <asm/hardware/edma.h>
; D$ j6 k! u \) v' y$ S
$ w7 [& Z; q9 |' u6 v/ i" W! ` k- #undef EDMA3_DEBUG
; a a: u* J0 M4 f# F5 g2 r% \ - /*#define EDMA3_DEBUG*/8 R2 Y8 b/ D& Q- e# G1 {: i
- # Q+ L, M* y( _8 ^' u9 l
- #ifdef EDMA3_DEBUG2 G) K# q/ p: ]5 _: Q \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ V4 U' r1 Y$ A( H' m1 O# k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
~9 a& f ^' u7 ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) F6 }) R# N; q0 o
- #else
5 Z% b/ p$ e& c - #define DMA_PRINTK( x... ). A2 C& M9 t% b' z6 Z; I
- #define DMA_FN_IN
0 y3 m- q2 u/ P; @0 m+ H - #define DMA_FN_OUT, `* C+ \4 D, O( c+ Y+ Y5 @" H
- #endif3 F4 t; e; y, t8 P S9 h$ s
. F$ g1 Q3 R8 R" ?8 \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" h7 q3 d9 u, h% Z: `
- #define STATIC_SHIFT 3% u# n) G: w. v1 V8 `) ~8 `
- #define TCINTEN_SHIFT 20
0 o9 l* ?1 ?5 W2 p6 K/ } - #define ITCINTEN_SHIFT 21
) G" W, T( j( x2 z7 x3 a& { - #define TCCHEN_SHIFT 22/ k* j! M0 D8 \7 r1 K
- #define ITCCHEN_SHIFT 23& V3 i2 J+ N$ Q% g% u
. d- z/ `: i, E! R; S- static volatile int irqraised1 = 0;
9 p6 {2 u2 |. ~; Y, \ - static volatile int irqraised2 = 0;
$ v) q" N# H7 m5 l0 `( p2 `
/ X% `9 m; _2 m1 S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( ~3 c' b1 V& o+ w- _. f' {0 ~0 _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* Y' h0 X. h: m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) m J0 u9 A$ ~: z6 a/ k8 v T9 t& h
. E7 F; M$ `( [4 r: F: w- dma_addr_t dmaphyssrc1 = 0;6 E) j& a" J5 f7 q6 _6 q
- dma_addr_t dmaphyssrc2 = 0;
3 t6 |, @( w9 S+ e* E% r' [$ w, c - dma_addr_t dmaphysdest1 = 0;: U/ u- n/ Z9 ~' T# I
- dma_addr_t dmaphysdest2 = 0;
& E0 Z/ ~; ^) A) m' \
/ t2 j( G/ g1 z- s4 k$ O7 `' I3 E- char *dmabufsrc1 = NULL;4 f( u2 [; s9 ?
- char *dmabufsrc2 = NULL;
" b: X8 }# m* r- ?( W @ - char *dmabufdest1 = NULL;# a7 [; D/ t! g% ~( C- H
- char *dmabufdest2 = NULL;: X5 F# b8 B5 g, Y1 S
- ! x) W. g0 X) h+ J3 P$ a+ A5 J
- static int acnt = 512;
1 ?4 J: z* s3 P7 o& v - static int bcnt = 8;# |4 K6 w7 x8 X2 s
- static int ccnt = 8;
8 X7 l6 w& ]1 i& s* s1 i; C
6 f6 |/ v6 |% b% L- module_param(acnt, int, S_IRUGO); a' j/ k& w* O% p
- module_param(bcnt, int, S_IRUGO);# }; [" T% K: `* Z9 |
- module_param(ccnt, int, S_IRUGO);
复制代码
/ I; @- W7 O6 M$ V5 A) j. [
+ `3 }- K& y$ e# G: L; k F+ V6 u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 l2 Q1 o- j; U3 G% t" D l$ N# o
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 F& K( k* o8 l( i M k4 h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 U5 b! O+ G/ Q2 e7 J% J
7 d. W+ ]5 u0 n. q8 ~% I7 I, y, P6 }* H1 j0 P) M5 P- j! x. f
|
|