|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 d( M& r5 b8 f5 |5 b4 Z3 }
- [code]EDMA sample test application( F4 ?& Y$ M+ l5 l+ X
- /*- T) w0 {4 k# E9 L; g( ^2 y4 v4 m
- * edma_test.c
, R% H. w& V$ g4 S8 ^ - * r ~, F6 q3 f. T) R7 j! {
- * brief EDMA3 Test Application1 o7 V" P* m& q, C$ w
- *, \7 N6 G7 G0 k8 i, y2 S3 }4 v8 C# v+ ]
- * This file contains EDMA3 Test code.
* b% }4 @5 X# ]/ s4 @ @+ `7 r - *. A. q6 ~; Q( g. a5 _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 ]! E/ ?* M/ t: p9 X w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 x; y( h1 G `# n5 F ^
- * TO CHANGE.
9 \% p. B$ i8 ]8 c - *
7 {# A6 n1 E+ X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: E6 i0 c8 I& D; O& a
- *$ ?* I4 r2 t H( b& N& z: d9 s
- * This program is free software; you can redistribute it and/or
+ b+ Z# U5 _! y) R9 m - * modify it under the terms of the GNU General Public License as! D0 a. e$ r% P- i3 j
- * published by the Free Software Foundation version 2.
# }+ e/ ?' v& h. } - *" q& a: P* l+ d1 [) ` A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ g9 U# S8 g9 t* |
- * kind, whether express or implied; without even the implied warranty
& i8 r. c* ~! u$ N+ o9 a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 J6 ~2 ?7 A, ^: y- I9 ~* ]
- * GNU General Public License for more details.* E4 H8 N& o2 i- n/ s- m# U+ t
- */' i- h1 R2 R9 N0 O/ ^
- : Y7 s" p; l6 m
- #include <linux/module.h># O1 B8 T5 x0 k$ ^* e+ }! b3 @
- #include <linux/init.h>
; }. e9 Y. u7 i O' L4 Y - #include <linux/errno.h>5 A6 v2 `4 I# O* ]$ T
- #include <linux/types.h>* z" X3 C# g+ X4 E* u0 P2 X! d
- #include <linux/interrupt.h>
" @" g1 V; D8 ]; c1 G6 Y - #include <asm/io.h>
/ a/ r, Q8 x% m8 N9 h - #include <linux/moduleparam.h>% w/ {8 O/ ^/ D% u! `% c9 ^
- #include <linux/sysctl.h>9 L! G% h# V5 Q. ?2 J
- #include <linux/mm.h>3 I. ?. A; T3 J; R1 j
- #include <linux/dma-mapping.h>7 k# {+ ]4 d) f+ `+ ^) o
- ! b* Q5 [5 ]7 x" G& {: y* T
- #include <mach/memory.h>2 N3 y& I- N( \+ g/ T
- #include <mach/hardware.h>' k3 S$ s4 ?7 }9 k- z
- #include <mach/irqs.h>
0 {2 r' ]( x- v; C: G& ^6 T; T - #include <asm/hardware/edma.h>
* w( e, r8 W# M: |9 H' j
~8 F ^& e6 K1 Q5 {% s# n- #undef EDMA3_DEBUG i% y- t, a6 k$ T; V
- /*#define EDMA3_DEBUG*/
- Y: d7 A0 @3 c, W
; \0 [- X. m: e0 a' k- #ifdef EDMA3_DEBUG9 [/ h' v1 j7 \. n) `+ x8 ~' W$ f$ A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 z# ]' L) D- a# c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 M5 U$ ]- y; u) z6 X9 t6 P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 p: \* @- x( T" Q2 `- _! a
- #else
1 m r9 ?/ L% S% i* |# k - #define DMA_PRINTK( x... )
8 I1 j7 t* b* P1 e9 z( j: l - #define DMA_FN_IN
/ a4 ~& V0 Q: q7 s - #define DMA_FN_OUT" X# l: o4 p; W$ P, ?# X
- #endif
! C$ r) U! E7 t: v/ T8 n- g( ?0 B - 3 I0 {0 Y9 r+ v5 e& t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& x e" T0 j# g3 d. P8 F0 t9 W c
- #define STATIC_SHIFT 3
0 X0 Q2 B- {9 x: Q9 @ - #define TCINTEN_SHIFT 20
. f& k' X! K% ~- e# G6 _8 p9 q - #define ITCINTEN_SHIFT 21% g1 b# i( H, P9 r! W3 r
- #define TCCHEN_SHIFT 22
( x) L" |$ S8 U2 q& B2 t1 W - #define ITCCHEN_SHIFT 23
7 k8 u% x5 ]7 ?
6 x: e3 z5 ^0 T, d* \/ M% s8 ]- static volatile int irqraised1 = 0;7 G# S+ Z& `; y' o
- static volatile int irqraised2 = 0;7 v9 O; h: s8 l8 n8 G: t
- V9 \& _, |% a0 G. m" U$ ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! t4 d4 v) s; r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' J: R. k% G+ r- C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- f* F' E- T: C; u. Z5 `: u
6 T# b; K* s/ M' A& V h) |- dma_addr_t dmaphyssrc1 = 0;. c5 v$ V0 U. W1 q1 o
- dma_addr_t dmaphyssrc2 = 0;& t5 Y& p; E3 t7 \2 P
- dma_addr_t dmaphysdest1 = 0;
8 }2 k9 t1 \6 A6 |: A6 u - dma_addr_t dmaphysdest2 = 0;$ P* a1 i5 N3 I1 Q
0 I7 r1 Y6 C1 ]- @5 i# \, a- char *dmabufsrc1 = NULL;. J+ Z# [8 t8 z! L" [
- char *dmabufsrc2 = NULL;
* b) I1 W1 }1 K/ ^( D - char *dmabufdest1 = NULL;
; O" }; W% U8 d7 S% M/ c9 w5 b - char *dmabufdest2 = NULL;# J/ [. x4 T8 x3 r4 b: K( [
- . Y" j1 k6 ^) ^& Z9 U
- static int acnt = 512;
% b( C+ ]9 y) ]$ S - static int bcnt = 8;$ z; O' c; J% Y' J7 i5 T. o
- static int ccnt = 8;- X) a- I9 X4 R( I
- + q/ D7 i% w! f" L8 `
- module_param(acnt, int, S_IRUGO);
) g+ ?5 O) O5 i5 c5 D% C3 v, ? - module_param(bcnt, int, S_IRUGO);
n: H% p! N- K7 Y - module_param(ccnt, int, S_IRUGO);
复制代码
7 H2 e6 D" t7 C4 H1 g o! b/ d9 d% s3 j6 y+ ~/ @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 P3 ]2 W! w. n4 Q& i% W( f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( _4 a0 y2 B) g+ u1 j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 {! X& \* s( y( I7 _6 e6 ~4 v. {5 o8 h& w( x* z- x
3 }/ c8 U& L- M4 Z. O `
|
|