|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( g5 ^6 c6 F. X; w h P- [code]EDMA sample test application
0 @7 o; K& P8 b$ d2 t - /*
( O9 _& h& a1 ~& K1 X5 ` - * edma_test.c
/ C8 s y' j" X, K# Z5 J; ^$ B/ J - *
- { I! |7 c' A0 Y$ l - * brief EDMA3 Test Application
* w5 z) R& j) I9 A: J3 `* Y' S - *6 J, |/ I( R" k7 [ A
- * This file contains EDMA3 Test code.- s$ Y& t* }" r7 [( n6 p1 j
- *6 D. P7 C4 [9 W! U' h' `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 U, U7 I& C. ]: o" v6 I: D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( b: u$ v+ o6 y4 D: y7 F4 _. z - * TO CHANGE./ \; G4 a2 G! g; i' l
- *
/ P6 S2 n, v) t& n) j1 Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 B) j+ S0 e0 o1 G7 T1 G+ Y! { - *
2 X9 e ]1 X# s1 d+ R - * This program is free software; you can redistribute it and/or
% K$ W/ V" N" o - * modify it under the terms of the GNU General Public License as! J: r' Y7 s/ F
- * published by the Free Software Foundation version 2." l% i5 R5 f6 f9 E2 m- g4 y5 s
- *
5 h K5 k1 a ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any i% e. _7 {0 |4 n5 T: h! H
- * kind, whether express or implied; without even the implied warranty- e' ]+ y* U3 P C" ^; D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 @5 c" v" E" |
- * GNU General Public License for more details.
2 i/ W) |/ R5 X( u2 O% v/ a3 M! N - */
9 { a" s% M. b! T0 y
) U) ]4 M& H0 l6 r* _. Z2 V- #include <linux/module.h>& V- ~! M- f- W! i: ^( }; `, q
- #include <linux/init.h>
0 j6 S8 M, Y+ q. H, z; e- C - #include <linux/errno.h>2 i! d* s4 o# Y
- #include <linux/types.h>
9 N- B* W! }0 t0 B: u1 e) z - #include <linux/interrupt.h>1 R' X9 w# N f# G
- #include <asm/io.h>3 P) }( u+ v6 O0 [$ j1 J
- #include <linux/moduleparam.h>% j8 j- s+ L8 W' s/ o' J0 \; k+ D
- #include <linux/sysctl.h>
: j5 I9 Z- [. ^' Z - #include <linux/mm.h>
9 X. o" S B/ F2 {. O7 u# Z: P4 n - #include <linux/dma-mapping.h>- G; _. l. {: u7 a0 @$ G, [2 @
$ e( u$ T ^5 l/ q- #include <mach/memory.h>4 k2 `5 j- s2 e
- #include <mach/hardware.h>0 U0 u& Q2 a- ?4 y2 ? S6 _9 f' o
- #include <mach/irqs.h>4 ]8 E$ D# p5 M$ d( O: b
- #include <asm/hardware/edma.h>
) H+ N1 z. Q0 _; f) M - * X6 m/ @, [& u; ]2 e! x
- #undef EDMA3_DEBUG8 z9 ^7 T$ x) o! U1 M3 l9 q8 j
- /*#define EDMA3_DEBUG*/
# i$ v& p$ h% r3 L+ u$ @- ?2 F - ; V1 J# s0 H B* X" G
- #ifdef EDMA3_DEBUG4 G7 x% z s% q+ R3 y5 f
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* z' Z* M- s$ y: q) w& ?0 T- z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ u( o# {% t# h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 g5 S5 }& j! W; R
- #else8 s: N- m7 e3 M B7 u
- #define DMA_PRINTK( x... )! q! G a% Z( ~8 F M
- #define DMA_FN_IN
" t! a) K$ j& r6 N- @! ^% A% v - #define DMA_FN_OUT; A) \5 h6 I0 `5 ?2 ?8 R
- #endif
A& s$ e+ s4 E, D# ]! `5 k - 4 [2 Y8 T K5 `1 d4 _2 V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- Y1 D7 i( w! M
- #define STATIC_SHIFT 3* B% B7 }- ]& \* L7 d) W
- #define TCINTEN_SHIFT 20
9 B* C* D2 L; C" E - #define ITCINTEN_SHIFT 21* g) Y0 U: o4 c8 A4 b* V; E
- #define TCCHEN_SHIFT 22: A, i* n8 s B# u, c
- #define ITCCHEN_SHIFT 23' K9 Y/ I0 U; O; Q
& Y7 k/ M1 z( X# f. |- static volatile int irqraised1 = 0;
( ^+ w( R3 v- o" c+ K - static volatile int irqraised2 = 0;2 g$ P; I$ M' L" A- e0 g% W5 ^* p
- 3 d3 `3 S0 ^ j! l" F1 W# b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, u5 z- z4 Q9 S5 T1 }) K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 j; Y8 f" e7 X4 k# O& q3 @9 k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 @+ d) B) _9 o2 K) @) m
- ! g+ h4 Z! B4 b6 G7 g0 c$ h
- dma_addr_t dmaphyssrc1 = 0;' Z0 Q& |/ X% t. Q: s
- dma_addr_t dmaphyssrc2 = 0;4 A2 A3 Q7 v K- Z& g
- dma_addr_t dmaphysdest1 = 0;- s9 e8 N# k# J" S
- dma_addr_t dmaphysdest2 = 0;' |' X$ a! d( G- E
- ' o. s. `5 k3 {$ O( _4 M
- char *dmabufsrc1 = NULL;
; G, x6 o# v. j9 ~7 T. @& B9 |+ z - char *dmabufsrc2 = NULL; @) {: C4 D5 k/ F# |
- char *dmabufdest1 = NULL;: `7 c3 N8 \4 U/ s# e; Z* w
- char *dmabufdest2 = NULL;
. h) E8 m" e/ I7 p - ; x' W9 K" h9 |% I& n3 e7 Z
- static int acnt = 512;
% x, i$ d6 Q& L) b( Q" w: D - static int bcnt = 8; X9 S& M, I, d
- static int ccnt = 8;
5 b- a: }5 z. ^
$ D y) O, V4 W5 R( ^9 b- module_param(acnt, int, S_IRUGO);
1 k d X, @5 G; z - module_param(bcnt, int, S_IRUGO);0 N2 m6 \ f3 \0 H. ?2 B
- module_param(ccnt, int, S_IRUGO);
复制代码
/ P$ R& c3 \9 I/ x& b5 U2 B; u8 |3 c' _
) i" L4 i# q# k2 _) N C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 p, F9 [$ P- E) e2 o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 Z$ G% l( n* D$ L6 o7 s1 h) {, y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 g. p% p9 r6 q2 Z$ I
5 \( q2 b: r P; g6 h" M# L2 O( }
" p/ W- j1 l4 A+ N: v+ H
|
|