|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 F3 E6 Q& Z, ~2 `' }% x. Q
- [code]EDMA sample test application
& K4 c6 x- l: F* \6 @; L+ M' I" I# } - /*7 |' ~9 [2 q0 a! o3 \
- * edma_test.c. D5 { p$ m3 D9 _' f
- *$ F0 r9 ]/ g8 m+ _* Y& ?6 L
- * brief EDMA3 Test Application' p7 G# T F, x" L4 `6 ?
- *
* V& b; O+ U, g2 p7 y0 i7 R - * This file contains EDMA3 Test code.7 r3 U2 u! G. ]2 r$ _
- *
) x+ l) ~0 V) u& z- P6 B' a f% s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# ~5 ~6 e+ \2 a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& f( p; M# T7 T. y3 z
- * TO CHANGE.
/ B* t/ ^+ y) @" `2 O F' O( C5 u - *
$ w) s( K6 e; v, S6 X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( q& i# O7 Z9 R1 n
- *
5 S% b& ]7 ~) N/ \! M1 a - * This program is free software; you can redistribute it and/or- y6 e: |. d! `) j, C( H7 ^: `
- * modify it under the terms of the GNU General Public License as; ]* E2 b) h) L M8 z+ Y7 o
- * published by the Free Software Foundation version 2.. k3 M$ j( j* f% W2 ^2 w& C
- *
. L0 Z2 ?! e) y: H, \% r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 p& Q$ A( \6 e/ u& x! R
- * kind, whether express or implied; without even the implied warranty1 |( B" o: b+ W% S% A4 S3 K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& `( O5 O4 J! `. X
- * GNU General Public License for more details.
. G- C; u# f1 u, V - */
& d' f/ R& E7 M9 x. D* i
. d3 u; ^; y7 s9 I W- #include <linux/module.h> |3 n x0 W; @- x8 I9 B
- #include <linux/init.h>/ u! G& y/ w" Y& A/ n) x
- #include <linux/errno.h>! j& E+ |9 N" v% \& U" R
- #include <linux/types.h>
+ {/ w! _/ t E* q# Y) L - #include <linux/interrupt.h>' P: ?% N) C( v, G9 Y7 o9 t
- #include <asm/io.h>" S( g1 _ ^, v- y9 Z6 @
- #include <linux/moduleparam.h>
$ D! I1 J# h5 a: m7 U$ J7 B) m/ \( ?+ U - #include <linux/sysctl.h>3 B* W8 @/ q2 N0 W
- #include <linux/mm.h>/ q! Z6 k5 o0 n' y) v
- #include <linux/dma-mapping.h>' a* |$ C6 O$ v$ |. P& Z, Q3 f' [4 j
- 3 n8 Z- x1 o3 n/ a
- #include <mach/memory.h>
1 `7 j7 f: o3 o - #include <mach/hardware.h>* |, T# V. i( d, b5 m
- #include <mach/irqs.h>
1 M$ x6 j- N' H* l2 Q - #include <asm/hardware/edma.h> |8 w$ g, X; ^. T6 k7 I7 D
- 4 N) D1 }. }! s* S/ I6 \/ x! d, a
- #undef EDMA3_DEBUG+ t3 ^5 z9 k' M. s
- /*#define EDMA3_DEBUG*/
* d7 L, q+ V' l. Q2 ]# _ V - 6 Z% \' R; f; X/ H8 b0 ~6 W
- #ifdef EDMA3_DEBUG
3 y% b& ~( u1 Z" i& ]* d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- e, i" o8 \1 R0 e6 U: T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* |6 D$ v1 }# M B0 @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- O( h7 } F1 D6 V# ^! g - #else! K9 K8 I/ S) t9 A/ ?8 `
- #define DMA_PRINTK( x... )- }9 s; Q; M1 V7 R& g: I
- #define DMA_FN_IN
. N7 S0 F% a/ b2 S: P9 n7 S - #define DMA_FN_OUT3 V/ `& u+ F1 Q& i6 X
- #endif
S! U8 q. p( |& c0 P- Z2 f - & Q$ @1 u+ Q7 x) J$ f2 x5 P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 ?3 a( e0 o- G. S W
- #define STATIC_SHIFT 3' d$ z; S6 f% D0 P. A
- #define TCINTEN_SHIFT 20
8 c' [9 B( [5 d2 W7 [. f - #define ITCINTEN_SHIFT 218 X8 y8 t6 |4 i. \
- #define TCCHEN_SHIFT 22
* c) i8 r: Z/ q* \ - #define ITCCHEN_SHIFT 23
8 ^5 {& N% p! A
+ Z$ i. s0 n3 t7 ^! [- static volatile int irqraised1 = 0;2 Q6 E- j; l8 X1 \! ^# `) A: {
- static volatile int irqraised2 = 0;
! k- J2 l, F+ O6 ^
3 r% n3 l9 v. U4 L+ W( C4 U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 X0 V/ M" h& _0 X2 w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); M2 D8 { L. `( h* {. \! }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. {2 l9 d, `" G; `# O+ U
- r" \& d1 x' o4 A6 ~: T* t- dma_addr_t dmaphyssrc1 = 0;
, E- X9 n: |2 o& P/ x" \# ^: _, m - dma_addr_t dmaphyssrc2 = 0;
0 \1 t! G- G7 \5 Z - dma_addr_t dmaphysdest1 = 0;3 |9 v1 S" ~( H
- dma_addr_t dmaphysdest2 = 0;
3 p0 D- D# X- c4 T0 e. z# K H! V
' q+ g) e. r, l; j; o- s4 ]- char *dmabufsrc1 = NULL;
2 M2 ?3 y+ ~8 O( ]+ [( V - char *dmabufsrc2 = NULL;2 J. K3 @3 o& Y2 W+ \. R0 u( `+ B
- char *dmabufdest1 = NULL;
$ `$ @. E# N! y6 v# X6 s- H - char *dmabufdest2 = NULL;; f; i" A, H& S4 h! T. T3 x
0 f# O) F7 Z4 S ?, B2 E7 S9 \- static int acnt = 512;
7 I! f% z7 i- w# P - static int bcnt = 8;
2 y7 _ A- z( V0 J' W$ Q - static int ccnt = 8;
) z- u# ]- L" x9 Q5 ^# s
. w) D% R& b( Q8 V2 N- module_param(acnt, int, S_IRUGO);/ W+ p/ e, x" L% i: i8 u8 @
- module_param(bcnt, int, S_IRUGO);1 K1 s! i2 T3 P2 c% ~
- module_param(ccnt, int, S_IRUGO);
复制代码 4 q9 |) Y( t3 q9 ~& y
0 t7 q' @# i" ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* J- R( ~4 z6 Z! Z: p$ r/ u0 l2 y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; O" L: \+ q f5 j" | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* }0 B, B! ]+ A0 C5 Q: ~% D0 J% \7 }% V b6 F7 [+ g
4 O/ E: z9 n H# M% v/ n
|
|