|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; V: {$ _% x$ u, r1 c8 Q9 f- Z; T: _- [code]EDMA sample test application) E4 ]: \. Q! N+ o/ J8 \+ ^! _& Y5 y
- /*& z" e7 k1 w i9 R$ c6 M
- * edma_test.c& z r, h8 l# N: O1 l5 M5 y
- *
8 q$ q1 K E* U1 H1 P - * brief EDMA3 Test Application
, m& @% C+ b8 r) _- e' e* e5 | - *% d3 E0 X( g6 N( r) I
- * This file contains EDMA3 Test code.5 \2 l9 j( @3 X
- *0 w+ F( W# S& I+ W4 S( w, M& P* @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
H" s& e9 Y& p+ g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: c* G+ a$ k s% Z/ g T - * TO CHANGE.: t' I( x% f( u0 j8 C5 i3 e: R
- *
' y9 h! B" K. B2 h' [, Q0 ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: i" x, \, B! M' Q/ `7 @
- *
5 [; }+ g/ I0 K3 B9 x - * This program is free software; you can redistribute it and/or t/ ~% m H/ D9 |# h+ \' M
- * modify it under the terms of the GNU General Public License as
: l, G$ X8 P' J9 B5 j/ n, _ - * published by the Free Software Foundation version 2.* z# T8 {: g! s
- *9 ^3 u" ^7 ^' M4 f0 q H7 _# r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 m1 ]" g g/ {" m( v4 u
- * kind, whether express or implied; without even the implied warranty/ b- ]) }$ R$ ~5 F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 P* z) Y4 k+ g, w0 j
- * GNU General Public License for more details.2 x% N; ~+ E' w" R/ `6 I
- */, L( h; v* E8 S# w4 x. a
- ; t4 C; v9 L9 X$ j5 H* ]1 M* b1 O
- #include <linux/module.h>
! K4 p, N) ]& _# p( f, v0 t - #include <linux/init.h>9 R0 j' H9 z3 C5 V9 U
- #include <linux/errno.h>
: S$ n h! C! u; `( `7 |) s. s - #include <linux/types.h>1 E: L- k( n: ^/ b1 C" y9 D. ~
- #include <linux/interrupt.h>; @" C2 T: z1 x& y% ^
- #include <asm/io.h>3 U) B1 {9 w6 c, r3 s- s2 l3 ~4 j2 v
- #include <linux/moduleparam.h>/ r" j. H0 Q1 A& W) F
- #include <linux/sysctl.h>5 a$ a; s* O9 o# t; ^
- #include <linux/mm.h>
! ?- |% X6 i4 `- Q0 d7 s - #include <linux/dma-mapping.h>; O6 k/ G& B; R% c
- 5 _/ h' m7 d: Q/ V2 _, i
- #include <mach/memory.h>, D2 @( m) Q1 e- y6 ^
- #include <mach/hardware.h>
# [8 O7 z# i* U# ^6 E - #include <mach/irqs.h>
3 j* p* C+ o1 l5 y* i- b: r - #include <asm/hardware/edma.h>
. q* f6 f- `. o4 F - 3 w1 R" a* d, m, b( o% C8 U7 s" V
- #undef EDMA3_DEBUG6 ~6 y. L8 c d' Q% `
- /*#define EDMA3_DEBUG*/6 t# W4 V# |' O% P' m# C
) x1 Q9 ?5 z3 ?- #ifdef EDMA3_DEBUG6 W- _1 v8 a/ g5 t3 P& J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ V+ y& r- f8 M' h! \( d, \+ z) Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; e* X5 X1 z _ J - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% @, d; u- A7 L8 Y; H
- #else
9 P- W/ x+ g7 z: s' i5 E2 ~# S, V - #define DMA_PRINTK( x... )2 j* F- k p0 k6 S" Q4 B
- #define DMA_FN_IN6 z# e( J. u. l) Z
- #define DMA_FN_OUT
1 X+ F0 o9 [' f6 K+ r7 A/ L - #endif
4 f: L- i0 F: t8 R* I3 v) G
; x5 o2 h- f# z. m, M% k6 h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 t5 S( }" I. O+ U0 x! ~ - #define STATIC_SHIFT 3# f0 n/ {- d; F! M( U8 n
- #define TCINTEN_SHIFT 20! p8 [4 B$ L& q/ g( J/ I. K8 U
- #define ITCINTEN_SHIFT 21( m* `% p) N1 T; _& `
- #define TCCHEN_SHIFT 22; g V- q+ q, W1 p/ b
- #define ITCCHEN_SHIFT 23# e9 e2 K5 i' m/ f/ }4 X s
- 7 ]0 ~6 K: n4 `% o
- static volatile int irqraised1 = 0;, g% Y: p( J4 }: s; k
- static volatile int irqraised2 = 0;
+ ^6 S' Y+ Z. i+ |5 v - # v" }" j! g8 e/ l( D7 N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* S2 ]0 l. y; h( J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 {9 {4 D+ x) Z: W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; q$ E1 h8 X# Y7 F( Q
; r! @! N# F: r- R- K$ K( r- dma_addr_t dmaphyssrc1 = 0;" V# G1 S( @4 K- c/ }1 }
- dma_addr_t dmaphyssrc2 = 0;
7 M; c' [5 ^3 |2 }7 K, n* A - dma_addr_t dmaphysdest1 = 0;: a/ O4 T, y: P7 ]& S, `$ _5 N6 D
- dma_addr_t dmaphysdest2 = 0;7 Z4 w. D! w1 _1 h. W# m7 d
- 3 x! {/ R u: B
- char *dmabufsrc1 = NULL;" j a' {" e: Z0 U& {% h
- char *dmabufsrc2 = NULL;! D2 `' A. m8 K) x
- char *dmabufdest1 = NULL;- y7 x. Y2 V3 K7 ^3 q- ~7 j
- char *dmabufdest2 = NULL;$ _: ?8 ]: t2 ^; W
5 b1 R! s- i0 N% @1 U' A- static int acnt = 512;
+ y; k$ f9 I5 _" \, h - static int bcnt = 8;3 r2 e0 H8 }& a* j, Z2 B1 H
- static int ccnt = 8;3 B$ E2 ~0 i( b# ?; m- x' l b
- 5 n2 z+ t. Z r3 n# S, Z1 L
- module_param(acnt, int, S_IRUGO);5 P1 C% S- E$ U8 a. n3 P' G
- module_param(bcnt, int, S_IRUGO);
' y! m* n4 k+ p! n6 y% o' M% D - module_param(ccnt, int, S_IRUGO);
复制代码 / {1 _; Z0 B3 I3 [. G0 C
0 ~3 ?4 x5 f1 D5 N t' k, e; Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 l; b6 {9 f3 }0 m% z3 S4 b5 E$ F, k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 {& y) T. |: i0 |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. _ F6 i& S u6 ~. M4 w& c& W4 A
8 X0 o* `" V, b' a
& L* K3 a# J- e3 N" b |
|