|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 {5 r& U. Y6 ]' w5 m4 x3 O" b6 ^( {. [3 W
- [code]EDMA sample test application2 x& X. |, B1 q
- /*
# [0 v% b2 q+ g& _- J0 d" x( h/ @ - * edma_test.c
! A6 B4 P) y, q. |2 s/ o5 y% o - *
, |0 e" m5 @+ P% i - * brief EDMA3 Test Application
1 B2 @5 K0 r; N. X - *5 v z" L# u4 {
- * This file contains EDMA3 Test code.
6 n, Y* a: f2 J" K1 c- p - *+ m& v1 E+ ]" }' i! e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; `* [* r0 I3 @0 X: ^# y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- o' y3 d) O$ L" o' l3 B7 U% w
- * TO CHANGE.
$ F d7 g k8 O - *
! x/ S$ R) o; P M4 v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' {! I- _3 p1 ~) v. T! F - *
" f+ \+ x4 a! m - * This program is free software; you can redistribute it and/or
8 [# q; v6 @6 F; J# L' M* [9 f - * modify it under the terms of the GNU General Public License as
. h+ I9 y; A: w G4 o+ C @ - * published by the Free Software Foundation version 2.
2 u# `! z9 M* b1 I" Y5 U5 d - *5 D+ X% Z$ V7 H7 f. g: \& T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& Z+ b: |6 Q+ O9 D' W6 Y
- * kind, whether express or implied; without even the implied warranty
! \& R- A; W1 Y# f: O; r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( l0 @: t6 j8 _0 w0 d3 f5 d - * GNU General Public License for more details.: q, Y9 }* q \3 f; K
- */& |( }7 C1 z4 x, X, e) p! U& a/ F4 |
* @2 k Y) V; U- #include <linux/module.h>7 R! u J( {/ O, n' I1 r
- #include <linux/init.h>
6 t) k$ d5 H( U - #include <linux/errno.h>* m( `, ^) p5 v& [ y9 L, [
- #include <linux/types.h>
1 R# C) }/ Y, ^. B - #include <linux/interrupt.h>
/ H- }8 n0 ~8 V - #include <asm/io.h>. w/ s$ Y8 F/ q9 f
- #include <linux/moduleparam.h>
3 K6 ^: Z; B. v. R. A - #include <linux/sysctl.h>1 g* n; A6 x6 n) N
- #include <linux/mm.h>; V+ q' |7 B- X ]: u1 x3 ~3 e/ n7 w
- #include <linux/dma-mapping.h>* p9 c* ~# ?; V& L T7 d
- & E0 C7 ?$ e% y1 Y
- #include <mach/memory.h>6 o5 ?) e, ]; S5 i9 I; v- a1 i
- #include <mach/hardware.h>
0 \* P: |& p6 f% [3 X - #include <mach/irqs.h>
; |7 P+ r6 R/ f" W - #include <asm/hardware/edma.h>
. c) q3 j. o z! ]- H3 P - - I9 k& J, v( m8 @4 I6 R9 ?
- #undef EDMA3_DEBUG: P% |9 P @! h" g+ B/ g* F% u
- /*#define EDMA3_DEBUG*/
* s1 i2 p# U: L3 T0 v3 S e2 L - 2 \( @& u* \$ j* u7 F( c+ }
- #ifdef EDMA3_DEBUG
+ C+ q4 \+ E: L+ j! ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). u2 I1 T0 y3 N! c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 b0 U) q3 I" W/ |7 P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" Q; F* h4 [# c; u% }
- #else% E1 e- ~5 [( h% n* B1 E
- #define DMA_PRINTK( x... )4 k; I" s0 X1 n; Z# g
- #define DMA_FN_IN0 g8 t6 ~% z# U/ W) N
- #define DMA_FN_OUT
9 T( O1 z8 x5 h - #endif
Y. r# t- w4 y" a - ; e7 ^8 t x, @" ]( S/ t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, }( f8 `6 q& L: N( h! p - #define STATIC_SHIFT 3
- A Z9 f* Y# L3 h# g - #define TCINTEN_SHIFT 20
! W4 e! L6 w, Q0 G( ~, D7 x" }* s - #define ITCINTEN_SHIFT 217 t+ W6 y1 p ^$ M: z
- #define TCCHEN_SHIFT 22; T5 n7 S! I d. a, u& h9 B
- #define ITCCHEN_SHIFT 230 e& {+ o/ y/ v' Q4 M% t
- 2 k) s* I! E2 I. [! t
- static volatile int irqraised1 = 0;
% Q7 z7 Z H* D" A3 e& q1 _: j8 \ - static volatile int irqraised2 = 0;
, B- \. b1 r) z, j* `1 \) {
# V& U7 e4 w' u. _8 u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ H2 L0 P3 N1 i3 c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: E; j$ D3 ?4 V$ D1 o) \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" P" D# _& U" q9 O: K4 @# D5 W
- . d# j5 c5 B! N
- dma_addr_t dmaphyssrc1 = 0;* g( O. j" I8 w
- dma_addr_t dmaphyssrc2 = 0;
* z) f s% z5 J- d4 a5 ~2 U - dma_addr_t dmaphysdest1 = 0;( p- f! F4 V& |6 \8 T7 G
- dma_addr_t dmaphysdest2 = 0;5 n6 ?4 t' a# r
r0 I' {7 v8 R- char *dmabufsrc1 = NULL;4 T/ B2 H) T' d+ x8 U" E
- char *dmabufsrc2 = NULL;4 a" m; F7 v6 q* H; M4 T
- char *dmabufdest1 = NULL;
# Y- Z0 @( ]& p8 P" F - char *dmabufdest2 = NULL;6 _. s5 q9 P$ e5 [; R+ H% \& k0 f
7 Q, g. Z! X3 e+ s8 K( Y1 |7 A p- static int acnt = 512;
2 q* {& t- `# ?* G( `( o- N - static int bcnt = 8;
2 e: H6 J$ x4 b - static int ccnt = 8;
. k! C( s3 M- _ v% ?. x - 5 S1 a6 {; r8 a P
- module_param(acnt, int, S_IRUGO);
. P5 D% ^( l6 T( o+ ~ - module_param(bcnt, int, S_IRUGO);+ L1 i6 U" _+ h( Z/ o; Q
- module_param(ccnt, int, S_IRUGO);
复制代码
H8 X6 D* C4 Q' v( a& p+ O
4 b1 z, s; F5 }# |3 g; d' C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 H5 }8 H0 f0 M/ @. d' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# v5 e. l* \8 Z* `# G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) m1 ?5 b/ ~ N7 Q ]
' J7 s. l2 w3 ~
3 c. N0 C4 U2 D% x* M, y, Z. ^ |
|