|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ Y4 t' D: D+ Z! m/ ?" H- [code]EDMA sample test application
: ?. g; T% \" {$ Q- V2 { - /*7 O; s1 {0 G5 Z) T
- * edma_test.c
" g% x+ n! J5 h6 Q1 Y. a - *
' `* v0 d9 u+ r# c1 Y$ a - * brief EDMA3 Test Application7 k3 i9 k9 a: F' S5 q: ~* m0 N
- *$ p0 _9 g; h4 |" w1 ?# t( x! g% b
- * This file contains EDMA3 Test code.% z" ~" K, C1 z; L+ d2 E+ Y
- *
- A! F8 `$ _% f+ k& D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 Y8 ?. _' b8 E5 m, J9 Y6 c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ B: s0 `2 |/ |: X% _9 v
- * TO CHANGE.3 Y- J& j9 W5 \7 l/ X' P1 f
- *. C t4 e: P C( O$ C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// C! x: [" F, T5 Y9 y1 a& p: Y
- *2 A8 O u' n* ]/ H5 V1 u
- * This program is free software; you can redistribute it and/or
+ G% T1 b% g5 ` - * modify it under the terms of the GNU General Public License as
- {& f6 V) L& n# @+ I - * published by the Free Software Foundation version 2.9 y* I0 _/ n5 V& T
- *
. y' |6 U$ ^5 g$ ? E6 V* c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 T/ t9 L! R- c3 p4 R6 j* Q: x
- * kind, whether express or implied; without even the implied warranty9 ]$ w" w$ N- F6 s" y. d: R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# h2 o. r. H4 {# y
- * GNU General Public License for more details. D5 s U8 j3 N1 _; P
- */
, S' D$ x/ l9 g3 k) `! _
7 B! w0 K( G0 l2 y5 L- #include <linux/module.h>
& L& c3 R, @& A; ^! B - #include <linux/init.h>
3 }) l5 }2 Z% G - #include <linux/errno.h>/ C3 w' O/ U$ P5 Z" G2 ^4 `
- #include <linux/types.h>) d' w! s' h' n# t3 S
- #include <linux/interrupt.h>2 N; [" S: s% S1 L/ K5 o, o. p% |
- #include <asm/io.h>4 ]+ ~2 t& E7 g& I- u4 C9 j
- #include <linux/moduleparam.h>- E$ _2 t6 _: i; d1 s1 ]" W3 t
- #include <linux/sysctl.h>! d8 |/ X6 w% U6 X+ X
- #include <linux/mm.h>, {% Y+ b. H8 r7 w! ]
- #include <linux/dma-mapping.h> q- }+ r2 q( {
- . l: H9 @" i3 p, V" D
- #include <mach/memory.h>
5 D- I* T. H& @! F$ w3 y! `$ t - #include <mach/hardware.h>
; o" M! W2 m L7 s - #include <mach/irqs.h>
4 H s Q4 B- f+ K$ b( i) ? - #include <asm/hardware/edma.h>: a7 d( R0 L0 D5 I- j
* T) w E6 h. K& d4 O- #undef EDMA3_DEBUG5 Y6 O' B3 d( l- I2 y0 [5 m9 T4 L( L0 i& [
- /*#define EDMA3_DEBUG*/
4 K) N+ d* J; p% r5 k1 E; t
. D- g6 K/ {' A- #ifdef EDMA3_DEBUG
. ?, R* B8 V4 V: r3 W' ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. U8 A$ a7 E' |) N) g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 C' z4 _: P9 J" H6 ^- z1 h; } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" X3 x1 a' y4 O! V0 d" r- E6 ? - #else
1 L; T6 p ~- {' u/ q - #define DMA_PRINTK( x... )
?! x' |# b/ q0 ?3 \8 d - #define DMA_FN_IN2 F* k L8 Q" X# f+ v4 g8 M
- #define DMA_FN_OUT
2 L- v0 q' @7 ]7 v2 V ` - #endif& [) M0 X0 }$ \4 q5 S
, q4 b1 z3 f/ z7 I0 |8 g+ g' R3 Y: N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% }3 Q3 u- N3 q8 F( {9 D
- #define STATIC_SHIFT 3
9 @) `; R. C: f2 M$ e - #define TCINTEN_SHIFT 20" Z' h- o: J- e/ K: f9 p
- #define ITCINTEN_SHIFT 21
+ M: d0 V" k/ h9 j2 y3 N% ^, x - #define TCCHEN_SHIFT 22
+ q5 |1 F- Y E. S0 O/ X4 M: P - #define ITCCHEN_SHIFT 23
2 J y6 ~( j/ y5 N+ J) ]% t* c
+ y" l4 `4 |$ W7 G- e- static volatile int irqraised1 = 0;' N! f2 C: D! X
- static volatile int irqraised2 = 0;3 R6 C0 M! j% H5 ^3 a8 e
" u+ g$ H. z+ m: C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 I- m, `8 P- R4 I7 ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; e6 ~! v- Q) x' e K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; j" g: e' [. s }' Z - 4 ?7 c" u% V6 h+ D+ K
- dma_addr_t dmaphyssrc1 = 0;
* N9 X3 l% I8 m& }/ t - dma_addr_t dmaphyssrc2 = 0;0 `' Z" a& [/ \5 e. R
- dma_addr_t dmaphysdest1 = 0;. w) V' b+ b. H0 A$ v: | s
- dma_addr_t dmaphysdest2 = 0;
4 r5 a3 D- ?4 o; e
, y5 P/ e! W. Y4 M; Q+ m2 C- char *dmabufsrc1 = NULL;
( D" z- |( _/ o' ~' r& t - char *dmabufsrc2 = NULL;
! u3 C3 q# a9 u! J - char *dmabufdest1 = NULL;: t4 K! Y' g1 O; M: B. O1 D
- char *dmabufdest2 = NULL;
5 R# V; E# C; O5 k - 3 a, c( L. N1 R6 d
- static int acnt = 512;
$ M& q3 L c8 U - static int bcnt = 8;5 R8 g6 E: x5 M$ Z4 ^) B) {
- static int ccnt = 8;5 I; S/ v- E8 f8 |) z
3 \7 X8 q' i2 t5 U- module_param(acnt, int, S_IRUGO);0 }! s. r7 s7 x; n0 H
- module_param(bcnt, int, S_IRUGO);
6 w5 P/ k. w3 I, ] - module_param(ccnt, int, S_IRUGO);
复制代码
* O, a! e# J& p6 E' N& y; k' t/ _+ _( o, O& h0 [# I4 c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 Q+ E/ G: Y* b2 T a0 v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* a1 K. J: G8 k0 b* ?( h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ R5 B3 m# G- Q
; T3 J# J: Q, y0 e$ N$ F5 g
+ w' H9 b; v. l. v) b B8 F5 H" h
|
|