|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ P# U h) E4 e& ^+ e- [code]EDMA sample test application3 P- ^- l3 J$ H- x1 u) F
- /*! v' k+ h0 E' n
- * edma_test.c5 z0 ^% H; t2 m5 b! D' T: }
- *
6 g8 Y9 h, i- ?# E4 l" ] - * brief EDMA3 Test Application. j, Q. I4 R" |1 s6 I2 Z
- *
y: x1 x% ?3 [8 f' s# K$ _ - * This file contains EDMA3 Test code.3 l, c) S% X' X1 K
- *0 \) |& _8 a: F6 }6 T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% E0 }% m3 O- N- _! f1 | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! Z; c0 N/ `( Q6 V5 E/ j; i4 {; j
- * TO CHANGE.
# ^% f5 `+ o P7 E9 s - *
3 I3 e* x1 j; q6 U' P4 B1 b1 e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' H) i5 _8 q/ I9 l. f9 c: S - *% t# S4 z1 X& T F1 z7 \
- * This program is free software; you can redistribute it and/or
" {/ k* c# F2 p& k - * modify it under the terms of the GNU General Public License as4 G. _, c7 [+ U1 R0 B7 T9 ]
- * published by the Free Software Foundation version 2.
0 M, y9 N) r; b! K9 I7 L W - ** W; E" \- M# \6 Y2 z& @. A0 n& d S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! S; f& m* R/ R. d - * kind, whether express or implied; without even the implied warranty* H% c+ A5 m$ H# Z3 L* m/ D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 @6 p4 i, Z+ v" { - * GNU General Public License for more details.
8 R# y ?4 i+ w) @3 R - */
k* R: E& s: f! Q( r8 p P
9 T: G: j( ?! o \- #include <linux/module.h>
" h1 h8 `7 b$ M) f# r( w - #include <linux/init.h>
0 Q1 n" c# Y/ ` N5 S - #include <linux/errno.h>2 k; O) X( k6 T Y0 q
- #include <linux/types.h>
' G0 O3 L$ i% L% V+ H - #include <linux/interrupt.h>( A; ]$ B; `6 v2 J5 S
- #include <asm/io.h>( o) c2 ~4 L/ K; g
- #include <linux/moduleparam.h>
3 D# k$ g2 J0 c: O+ { - #include <linux/sysctl.h>
5 c4 U3 a* X, F4 N9 C - #include <linux/mm.h>, f$ G1 Z% f$ Z% }8 m8 g
- #include <linux/dma-mapping.h>. D. y- y! \/ |2 j+ h
2 H5 A8 Y, O' ^& Z) _; T- #include <mach/memory.h>+ M: S% i' @0 k4 k2 @5 p
- #include <mach/hardware.h>
2 r" C9 ~) s3 X1 e+ f - #include <mach/irqs.h>+ H/ ?4 }1 X+ p' F
- #include <asm/hardware/edma.h>
3 @% W4 }2 ~; W8 M2 _
/ [6 ?& l8 h( y- A4 a- #undef EDMA3_DEBUG
% O$ ?5 l& v. Z n H - /*#define EDMA3_DEBUG*/! @6 j5 I& R& a' Q) O1 G7 x+ j+ p
- 3 r1 }2 s' g3 h% ?
- #ifdef EDMA3_DEBUG1 @: D/ D; b2 N& Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 a4 ^5 u6 m/ s/ `3 o9 l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); `5 W' i2 |2 D" T# p
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) F* z$ L* ~* i4 X# o4 F - #else) E% B) _8 {8 h% h7 R: k
- #define DMA_PRINTK( x... )
$ H6 `) E9 E1 i6 _, k3 N: M4 |! ] - #define DMA_FN_IN
" y+ E( y. T6 s4 Z& V% { - #define DMA_FN_OUT: m1 c: G9 ^8 R& g- ^6 k
- #endif
) W6 y' h5 w. }- d. F - - v, B$ D, v* A- @6 m; n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' F; ~6 Q0 l) U; S; p, o/ U
- #define STATIC_SHIFT 3
9 g& n4 \5 m6 T. N8 R- f: w - #define TCINTEN_SHIFT 20
7 E: V. X$ m7 w# M$ U - #define ITCINTEN_SHIFT 214 P* L4 p" W% o2 Q
- #define TCCHEN_SHIFT 22
+ [' ~; S8 r* i# V$ w - #define ITCCHEN_SHIFT 23" f5 p: [3 w* Z9 h( f6 d$ q$ i, r$ d. f
- ( b5 ?* N }% L/ V/ T# E) G0 A' |
- static volatile int irqraised1 = 0;
1 c! V* z9 W) A2 P8 b1 c, s - static volatile int irqraised2 = 0;
, U: w9 `; v' s# n7 B4 D
" g; z, l5 s1 S9 ]' G: ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 q3 L: A9 J; `3 |! Y( A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, E0 S; f9 O* W8 z# ~2 P7 D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 F& }- T: P5 W$ c1 O P% F" }
- " J/ x# P4 r/ e2 L* z
- dma_addr_t dmaphyssrc1 = 0;4 Y' a1 h! p; r( ?
- dma_addr_t dmaphyssrc2 = 0;
& r, s( ?3 k- q% b' `2 q+ u9 s - dma_addr_t dmaphysdest1 = 0;
& H1 N- X" H( L0 x - dma_addr_t dmaphysdest2 = 0;
+ y( \/ @1 V% ^) d, a - ) H5 P2 R/ D# m3 R
- char *dmabufsrc1 = NULL;
! g: r/ Q; H; S/ E& q( d/ P - char *dmabufsrc2 = NULL;
# T9 F0 C0 x8 a2 m$ H. Z - char *dmabufdest1 = NULL;
6 E- O9 V/ k( p. M8 R2 N6 D, e - char *dmabufdest2 = NULL;) Y% d: p: H* `# ?$ f+ @8 Q9 |
7 D2 y" W* f z: w) g, [! @$ X- static int acnt = 512;
7 J3 B% y8 m* n; F - static int bcnt = 8;3 z& K$ e' ? C
- static int ccnt = 8;! s) w; Y) t- Y$ M( h
1 G* a/ G0 T6 w- module_param(acnt, int, S_IRUGO);) |5 g! b# i; a% U0 f' Q
- module_param(bcnt, int, S_IRUGO);2 W! i2 x' l7 g3 l8 M' n' t
- module_param(ccnt, int, S_IRUGO);
复制代码
9 O* f$ p5 b! |8 Q2 O1 `
+ ~8 F" J+ c+ c2 \* j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 _2 G0 R( w h' T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ g5 \# y E& q" W7 B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- a9 _$ [: [4 L% L
$ o- E4 b& M2 i0 I5 Y( L- f: x) y! e2 _( J9 p* k4 R8 ]4 G
|
|