|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; M0 }( E: h+ q H+ g0 H/ K1 y( G/ P
- [code]EDMA sample test application
; N; L* i. h$ k. P$ F. i" i) \ - /*' |( V8 E: u9 M) A, e3 o; U Y) n
- * edma_test.c
6 }) e$ i- ]" J: ~ - *7 l# o$ s: U0 J+ f. m0 I6 P) V
- * brief EDMA3 Test Application9 ~& t8 I# h W- q; F @
- *. c# S4 G' M6 O! ^/ W# y7 L; g
- * This file contains EDMA3 Test code.% k2 X7 x3 E8 E, H
- *4 a5 ^) w: @# S1 M% h$ [. L! P' b7 ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, a$ @) @5 k! X s, A3 U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ ^4 E) J4 w* R
- * TO CHANGE." e. V7 I) X; q7 U8 q0 |6 L% M
- * U7 C) R u/ m$ ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 \0 V$ y6 W% [4 n6 P - *
. J/ [1 V8 J$ I: Z - * This program is free software; you can redistribute it and/or# U: A) H5 i/ [9 y/ f
- * modify it under the terms of the GNU General Public License as' _/ p4 P) K3 N3 N. P& R. u+ T7 Z. g/ M
- * published by the Free Software Foundation version 2.
* y, j& g* L+ k; W3 C7 I9 w - *
4 p# @: ~: i$ i; n4 Z/ q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' k( i- T1 n1 k; b6 V/ v
- * kind, whether express or implied; without even the implied warranty9 R* g4 y# O& n" G7 v; m! _6 k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* q; t; j) g% w2 {6 b
- * GNU General Public License for more details.) K; N( N2 W% z, W
- */- T3 s: F; ~8 y" x l
. o9 a7 `6 C: A% y) {- #include <linux/module.h>, C% ]: b8 f ?+ \9 O
- #include <linux/init.h>
5 f0 T3 |2 J2 I+ I; x) Y - #include <linux/errno.h>9 K! d# a& t h3 x
- #include <linux/types.h>
/ O4 Y8 K' T+ N- E _) I - #include <linux/interrupt.h>
5 U3 X& A8 a& l% e2 U - #include <asm/io.h>5 `7 f5 X6 _4 ]: `# `& ?
- #include <linux/moduleparam.h>/ c Y, e4 T6 n! k2 ^
- #include <linux/sysctl.h>
6 J) F! k! A' }1 h/ s1 @' J - #include <linux/mm.h>7 [) w4 i8 ^& n2 j7 c- i; {
- #include <linux/dma-mapping.h>
0 a. h* A3 S) v- L/ w' j - 9 P8 {9 e7 ^1 ?/ n7 r% W" C
- #include <mach/memory.h>
5 S" T4 ^6 _8 j5 x, ~6 U - #include <mach/hardware.h>- g- R0 [ F1 Y
- #include <mach/irqs.h>6 _7 a- o- R/ {' V
- #include <asm/hardware/edma.h>$ |" [& m0 `' [' X: ^( o' x, R
. P/ J. X5 q0 ^. j- #undef EDMA3_DEBUG
3 j7 Z! K2 o8 j- q: s" E4 D8 a5 t* { - /*#define EDMA3_DEBUG*/
$ \3 P, }% p' ?) e$ X3 w( M$ X0 _
9 \9 W$ `! k. M' N0 p( i- #ifdef EDMA3_DEBUG( ~4 u$ E' m# s0 L; [, A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). D3 {, i+ v$ e( d2 M) f) T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% c% P+ I$ c0 X9 w7 `' l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 A9 c% Z( y# h+ }+ P) G- n - #else
3 v6 A1 M& ? l% @* W V! i - #define DMA_PRINTK( x... ): K. }# H- z" K
- #define DMA_FN_IN# }9 e6 j% t, d. o7 ~) P
- #define DMA_FN_OUT% \" F! S6 j+ k2 [
- #endif
5 I9 F' ]/ x; I! j
+ O# F: B- x( k# O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& @" t+ q1 j( v ^) ~3 ?
- #define STATIC_SHIFT 3* n0 w/ M3 a$ r+ o! P! P4 |
- #define TCINTEN_SHIFT 20
$ G }- I! p: H: Y - #define ITCINTEN_SHIFT 21
+ |5 c, C7 p) {8 P - #define TCCHEN_SHIFT 22
# d8 ^" p+ `/ k. ? - #define ITCCHEN_SHIFT 23
2 U4 \8 j2 t3 @. i) `
! W# G1 S: q# I0 W- static volatile int irqraised1 = 0;) P/ m. E: S& k$ R* ?1 U" A' P
- static volatile int irqraised2 = 0;5 d1 ]" X }' o# c- K) `
1 M9 C$ ?0 r Y- k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 T; W/ H( ~- f3 V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 s; N, L% p2 w! V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Z& }5 h w- h* c# S
9 e( L0 J: `/ P! B' k% y# g9 q- dma_addr_t dmaphyssrc1 = 0;
& m/ U& S( R5 L& g$ N \ - dma_addr_t dmaphyssrc2 = 0;& |2 H3 Q/ ?7 z+ B; {0 \
- dma_addr_t dmaphysdest1 = 0;
7 t/ _! q" ~& A) Q. x - dma_addr_t dmaphysdest2 = 0;
( M7 C# v4 Y) S9 E# O1 e/ \ - . a$ M7 t* P! q) t. p' P
- char *dmabufsrc1 = NULL;5 Z* S1 z* T2 F5 q3 J) G6 K$ f
- char *dmabufsrc2 = NULL;
' D4 v w: Z0 o - char *dmabufdest1 = NULL;
/ z; e% ?7 V w X7 X. b - char *dmabufdest2 = NULL;3 W6 O' b/ b& c9 d5 i! ]
- - r- L7 E& t9 w# b1 c
- static int acnt = 512;
2 D6 }6 P) _# {: C6 `0 ^ - static int bcnt = 8;
9 m' H9 }0 c& J7 S - static int ccnt = 8;
' p+ @7 M8 k- y4 P/ k
! V# H* o8 m! [: d# d. \- module_param(acnt, int, S_IRUGO);# q9 S- x3 Q6 h' q# F6 y
- module_param(bcnt, int, S_IRUGO);- t3 U# x; x7 X# C! E. ]
- module_param(ccnt, int, S_IRUGO);
复制代码
6 I2 z) \2 a; \7 U- A& ~$ U
* R8 ?! R2 O" K$ |" @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 E2 q: A% t5 O0 b2 t: s! }3 A( a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" t' a) `; G" [: c8 ~$ D) Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) w) }5 w5 B. Z' Z( ^
3 D( M4 S) E$ A- N' [
- h6 [% h ^9 h |
|