|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 i; Y0 S$ y- K4 B" [4 F, X( f
- [code]EDMA sample test application$ Q$ y! S- j' h; C
- /*
2 h2 Z9 y4 r: M: E - * edma_test.c
. }/ l5 I, W% p S* D - *
8 W4 O& D; w3 _# E% x- ~ - * brief EDMA3 Test Application
$ v$ I5 Q5 n' b& Z v - *+ i* B. B, D. q1 c6 ]5 Z, L( C; [
- * This file contains EDMA3 Test code. g) b' h+ x5 ~: H: q0 z; F+ W
- *
: t3 E/ @" E8 W0 U! s$ Y' U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 V( Q1 o5 `3 m0 S* g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, I$ _+ K( \ A2 M - * TO CHANGE.
/ p# Z4 V/ P9 t" ` - *# ~! f. z8 [- ~, ^7 ]' W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 M2 |( r: G9 \' T
- *2 D" ^: L- O- s8 A: `
- * This program is free software; you can redistribute it and/or
. R( \& r% d( t; ~% {# ~! i - * modify it under the terms of the GNU General Public License as7 t( S* ~, m6 c$ B# |, a: X
- * published by the Free Software Foundation version 2.. O& S$ p9 c W
- *
1 h0 j3 E" y- z5 R9 u/ E, R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( ]5 E: V+ `, P& \) D: V - * kind, whether express or implied; without even the implied warranty
' p" x) @, ]' U' P0 ^' r4 |3 u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the y1 V/ I5 u4 g4 ^. p, f
- * GNU General Public License for more details.
& {7 L8 A5 X/ ^/ o$ W7 a7 w - */: ]; n. w! f- C% O: }% @1 |
- ) O0 r9 S( |% \
- #include <linux/module.h>
5 E1 |& N) Z% v' e6 X" m! h - #include <linux/init.h>0 U0 C- b9 V% h2 g5 \' y. @
- #include <linux/errno.h>* T' h8 o: o4 Z0 y4 V7 u1 s
- #include <linux/types.h>+ ?6 A( |( X( h& I2 g' X) w- c
- #include <linux/interrupt.h>
- v1 {* b' l7 H+ G+ k' u - #include <asm/io.h>
8 _; Y9 v5 \+ ]: x! S6 N7 @- ~ - #include <linux/moduleparam.h>
4 S- j2 ^9 \: r% P; b* ]$ x - #include <linux/sysctl.h>
' E+ H; I: v; y3 b" m; ^ - #include <linux/mm.h>1 S( b% G( }3 W# \' q& X& d
- #include <linux/dma-mapping.h>
" y- C2 n% E5 n - 7 k7 F) k# U/ x5 p V- B y
- #include <mach/memory.h>/ ?- x0 o0 t& y# P8 K2 o
- #include <mach/hardware.h>, z$ v' B# H- w: q$ j
- #include <mach/irqs.h>, V; Y; K1 h# `* a9 ^
- #include <asm/hardware/edma.h>
6 A, N B: h f - " X$ e9 K* i, g- k; F3 I! F
- #undef EDMA3_DEBUG/ Q. n+ ~: U" D' M
- /*#define EDMA3_DEBUG*/
/ E1 e; b* h* J) T0 b0 Q( V+ F - - ~/ [! N+ a5 T- ]) }: B y, `% j
- #ifdef EDMA3_DEBUG+ w( P$ p* u, M" o2 `! Q8 V% L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! X2 Q/ _/ N/ Y2 {1 t8 ]6 ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 n w3 g; t; v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). ?& E# d. C% O# c7 u# l( H
- #else0 A5 o$ v' X( C5 U2 G
- #define DMA_PRINTK( x... )6 a2 _0 f. P" z8 f
- #define DMA_FN_IN M5 G7 T- I0 {0 Q
- #define DMA_FN_OUT
! n6 p* i5 o1 A$ @$ a) V/ } - #endif
7 G) i" w/ ]; {5 s( D
. Q5 d9 ?* Y! h+ [( O! Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 h/ i9 k( O7 _1 V* }) y7 Z4 M* Z - #define STATIC_SHIFT 3
+ M) e5 \8 S( P( j4 n - #define TCINTEN_SHIFT 20/ }/ c% Q5 U: {9 r
- #define ITCINTEN_SHIFT 21
- s; ]! u1 }7 w" P' \+ k& b. @ - #define TCCHEN_SHIFT 22
9 \- X. O* F8 C& f - #define ITCCHEN_SHIFT 23
7 y0 p R- M! y* v$ e9 b, w4 Q - . y3 t/ y6 D/ E7 O( _( n
- static volatile int irqraised1 = 0;7 t' o5 g ^; V8 n# z& _
- static volatile int irqraised2 = 0;
( W* I8 F7 n1 ~/ a+ k
" e: s" A) i" y! i# ~3 z- Q4 q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ A0 h- t: U7 P. t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% k/ U2 K3 a8 |5 X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 _5 z7 N1 o& x
2 p7 W3 J7 P0 z0 T3 m& @- dma_addr_t dmaphyssrc1 = 0;/ j; o; B' ]( ]6 i2 T
- dma_addr_t dmaphyssrc2 = 0;( p/ ~- e+ y4 X1 H: g9 R
- dma_addr_t dmaphysdest1 = 0;
% D4 s/ D" o* W& }( K - dma_addr_t dmaphysdest2 = 0;
* ] D) q( b% N: i8 P# L( t - / h, i+ L' I# z
- char *dmabufsrc1 = NULL;4 Y |# ^0 Y% \1 K* G. F+ c% \1 L
- char *dmabufsrc2 = NULL;
$ T+ _ z6 d' X( I# U4 H" E - char *dmabufdest1 = NULL;
. }3 N9 t% V7 m# a7 x" q - char *dmabufdest2 = NULL;, a( ]' I/ g! I7 [0 ?+ ~0 H
! V K& j' F8 n2 L5 S9 b0 }2 {- static int acnt = 512;
+ G Z& ^: ]8 O3 h/ z - static int bcnt = 8;
3 R+ D8 Y; |, d$ \' I2 F - static int ccnt = 8;( Q: \1 T. r8 E) h1 _/ c; i( ~
- * o# _6 m, P* D0 C8 p, g
- module_param(acnt, int, S_IRUGO);9 p% I3 F ^2 o1 Q: D# \
- module_param(bcnt, int, S_IRUGO);
, N, @* I, ]5 A - module_param(ccnt, int, S_IRUGO);
复制代码
' h& v- b- A ~% w6 q" Q
p, e; r6 X- a, p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ o* I( b4 k# d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 L4 N9 E- ~5 d% F! ?9 F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, ]: G$ h* Z* `" U
6 o) |3 U! \' N5 O
2 S+ `8 S' y) q$ i
|
|