|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 o$ n# l: s, A# Y7 U" ~; e g
- [code]EDMA sample test application" X, J0 |1 ~2 H/ e3 n* x
- /*
) V+ ^' a) O9 h5 L: p( _ - * edma_test.c+ Q) X' n9 _% ?4 x' E# Y" F4 {
- *( A$ l! @: e" m+ A* P; ]
- * brief EDMA3 Test Application& d c+ k# D( x; b+ q
- *
4 K2 j) ~& c; W7 ~0 |+ o9 I - * This file contains EDMA3 Test code.
2 E1 ^( ~& }, C1 j0 C2 ~7 z6 V2 p - *8 F7 a2 ^. U: D& U4 G
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* d9 E+ [5 `% @6 y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 ]6 f% ?; w# g! }; d- R - * TO CHANGE.
* {" I" \, t* F! Y" f' J- y7 G - *8 E' p6 ~/ e- H" C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 y9 Y$ b- p3 r V# x0 W- Q - *! \% n2 q( M+ {5 r9 G8 g( i
- * This program is free software; you can redistribute it and/or1 R2 ]) ]$ H. p5 {: n1 i* _
- * modify it under the terms of the GNU General Public License as( F7 k: U) h9 G3 Q) w
- * published by the Free Software Foundation version 2.7 }6 l) \$ n/ M, o5 V7 n
- *: p2 f( o7 D0 h. o; t$ s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 P+ G E+ v! o6 M% p3 R+ z - * kind, whether express or implied; without even the implied warranty
x3 _% `; Q( e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
L, v$ S. i; ?- i2 b d2 J# L" J - * GNU General Public License for more details.
! n* g0 g6 e% m+ R$ [) h# } - */
3 ]9 c; @* U0 O% y) } - - o1 t( j! ~1 u2 R0 G* c7 _# x! m
- #include <linux/module.h>0 t6 m* r2 o5 i) f' j" E, M7 K0 \% O
- #include <linux/init.h>* C% c- W. \; n _
- #include <linux/errno.h>* L- P5 w3 E( J6 |, N
- #include <linux/types.h>) ]9 s" J7 R$ x, k% V# y
- #include <linux/interrupt.h>
; A2 [& t8 |8 G1 i6 D# u, ~) {; p - #include <asm/io.h>
$ F2 o" R n3 G+ ?7 }; s' n - #include <linux/moduleparam.h>
' |- O @: t3 \. k: c) p - #include <linux/sysctl.h>
5 N! P, n, e9 L, v5 g9 A( E - #include <linux/mm.h>
0 x% z- ~! j+ ~) N' v - #include <linux/dma-mapping.h>2 }6 `; g+ Z+ z. B: n
: q8 x% M0 I! X3 W0 S) }/ L$ Q- #include <mach/memory.h>0 c# S) t' `) T
- #include <mach/hardware.h>
3 Q1 T: R, s/ R8 [& t. S: \+ ~1 x - #include <mach/irqs.h>
9 V9 |( u9 P6 b, V* J6 p - #include <asm/hardware/edma.h>+ h, W% u& T# H$ Y8 `6 z* J" i B
- ! z6 u" W0 N5 d7 m0 d# p
- #undef EDMA3_DEBUG
/ a. _- L* j. t3 I - /*#define EDMA3_DEBUG*/; ^& N6 e4 e! G1 |2 F; S3 s
3 u& C- }6 n: t. C( T5 C; Q, C- #ifdef EDMA3_DEBUG
9 ~% g4 ]8 z/ h# F4 [0 G1 t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 Y+ C% K9 \8 x8 v6 R& `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 c, a1 V: A! c2 b' T/ [8 Z( n* y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" Y H# H7 C$ D& ~% O4 z" ?
- #else
$ ?4 y& U8 G) C0 b! \; N) _ - #define DMA_PRINTK( x... )4 Z3 v. c9 T' R9 U- q
- #define DMA_FN_IN* Y& ?7 r6 _* C3 [& `% ~0 `
- #define DMA_FN_OUT# F7 e9 \' S. n U- j
- #endif7 i' }2 q2 R/ p) [, a
/ o/ ~8 K0 F) [% Y# ]( T2 R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 H3 Q ^8 v' }8 V
- #define STATIC_SHIFT 3* q8 P' |/ Y+ J7 `; F; v: N" k, D
- #define TCINTEN_SHIFT 20
* z0 |, G5 N% q, g' T z/ z - #define ITCINTEN_SHIFT 215 [+ q* r" u+ e
- #define TCCHEN_SHIFT 22
% F- z6 _+ q/ Q( Y - #define ITCCHEN_SHIFT 23
8 w7 O; D. r8 a5 b - 0 Y/ c/ d2 a: T+ C1 F6 m
- static volatile int irqraised1 = 0;7 j2 s0 ^3 \" w: a
- static volatile int irqraised2 = 0;
1 } ?" ]# a) J, D5 }. S, Z, P
6 T5 b8 @9 b, E) F% A/ y* j8 N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" \2 k8 X! v( r. _8 { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 P7 s# W$ p' e4 P3 j' s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 C# {: x) Y1 K5 G$ d& X. p) m - + M9 B! z, U+ P% C8 G+ k! C
- dma_addr_t dmaphyssrc1 = 0;
! Y. ]# P+ I! K) {3 w! f0 r - dma_addr_t dmaphyssrc2 = 0;
0 d/ e& ]. q% m( U9 m1 E9 k - dma_addr_t dmaphysdest1 = 0;
# O B( }, V0 d. l1 B m - dma_addr_t dmaphysdest2 = 0;2 }& k$ A0 ?7 f: g6 R# d
3 `* P2 L% O) h# [- char *dmabufsrc1 = NULL;
- @' P6 @0 g( \6 K - char *dmabufsrc2 = NULL;
$ H0 u1 `1 V& F( D [# U+ V - char *dmabufdest1 = NULL;
& u8 u! r- T0 i X. W; n - char *dmabufdest2 = NULL;0 i/ O6 A( x4 e4 a, ?
- 3 O, s3 D" I3 I0 k
- static int acnt = 512;
' o) V; Z6 ~9 y5 b. N( U. \ - static int bcnt = 8;2 _% g8 T9 l$ Y( f: T( q
- static int ccnt = 8;* b ~( A! v7 u- g$ h+ ~/ c5 a
- ! t: K! ^3 e: d
- module_param(acnt, int, S_IRUGO);) m4 _4 z2 y& p9 n. C5 t) g
- module_param(bcnt, int, S_IRUGO);
9 e8 D1 I! A! Y0 ]5 F. H - module_param(ccnt, int, S_IRUGO);
复制代码 , N- e7 w- F! r) ]& [, N7 q8 t
; {- k) L% @3 N7 u4 d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 r6 v& Z3 M( h& \/ X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" ?. \+ a. z1 ]- [- }, \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. B# C0 K- Y+ w0 D* d0 w. Q) p, v/ z
0 U/ P! [' ~7 w% o/ {" i& |( F
|
|