|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 p* m) S1 H, R, Q8 g- [code]EDMA sample test application _0 y; p* ]( D: i2 w% r
- /*
8 N. s* |8 c1 Y, i - * edma_test.c
# s' F( P3 K( |! s. [6 B - *3 A7 f! T8 Y' [" @& M
- * brief EDMA3 Test Application$ }2 d- {4 d$ {6 o
- *& X* [2 i$ G2 P" e
- * This file contains EDMA3 Test code.5 O) u- H. m, v; `
- *
$ c) l/ X$ u2 ^/ s1 A9 w$ R2 r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- n6 ] s* n8 q" v3 m/ W) _6 D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" W* [& r& `; t6 N2 L6 r4 O7 s
- * TO CHANGE.
, A* F! j" J$ `; T/ s4 t - *
* S$ @& K, l) C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 }0 g$ e/ B, ]0 }
- *, K! ~ L* _2 _. c6 _. e
- * This program is free software; you can redistribute it and/or
/ A2 `7 _$ E9 ]8 Z$ i+ p, N - * modify it under the terms of the GNU General Public License as
+ `% k' s) }( o4 } - * published by the Free Software Foundation version 2.; H; P) X+ @5 M
- *6 A9 G" T" G6 e' a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: c/ ]4 r2 O! w( c S8 R7 W
- * kind, whether express or implied; without even the implied warranty
( a; m+ y9 K; P+ | I$ N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) I9 x& L. m. R% h& } - * GNU General Public License for more details.
& D3 S( G0 v; z- B7 C - */
' \8 f" e( z4 v5 X2 R7 W - $ H+ y/ Z. D4 J0 c/ ~$ ~
- #include <linux/module.h>4 Q7 D. G3 P3 i7 l
- #include <linux/init.h>
- o; D) u- n! M( L9 s! v$ w* n; K# w - #include <linux/errno.h>
' a |& p( x4 _% \ - #include <linux/types.h>
- v6 H0 s! Z! g8 ~7 P8 P+ } - #include <linux/interrupt.h>* J7 C+ ~) J8 t/ \ D$ `4 `
- #include <asm/io.h>
7 M& i8 C- k4 u. b8 ^* Q - #include <linux/moduleparam.h>) _: Z# C' D& {6 x0 \. g
- #include <linux/sysctl.h>3 P1 T, j) G! c+ ~
- #include <linux/mm.h>, A. ~. }+ G" N: w: y; ]8 G+ Q
- #include <linux/dma-mapping.h>
' g/ a+ F. V9 T) `( v8 v
$ l! W" Q6 T6 P5 C: J8 i" P) E- #include <mach/memory.h>
$ A! c; u1 m9 e5 M0 ]+ b8 v - #include <mach/hardware.h>
: o, q2 Z& \8 b+ ^/ d - #include <mach/irqs.h>$ Y o% F) O# }( d
- #include <asm/hardware/edma.h>
9 N- g h& [' R! [0 Y+ Z
7 z7 _0 c' W4 R* ? W- #undef EDMA3_DEBUG: U* ~! ~' t8 z
- /*#define EDMA3_DEBUG*/& P# k: s; E6 K E1 v" R2 B7 a
- : {- A: D: _, o% k9 a) T
- #ifdef EDMA3_DEBUG
" ~1 P# l; J$ j4 r" S9 d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 K, h. s. ~9 l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 t* R( a: D" |# m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# ^) f2 S' J% Z& \
- #else( d3 H' A0 [" `: A* e q6 J
- #define DMA_PRINTK( x... )" m( S0 b! i2 K3 C
- #define DMA_FN_IN; z) `" c. e0 \! L8 \5 T) H
- #define DMA_FN_OUT& x/ {4 f: m5 X; r2 @1 L
- #endif
9 n% q! b x. K( D - - U1 S$ b" s) Q5 C" h+ g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); E j; Z' ]" |7 s
- #define STATIC_SHIFT 3
, J Z2 A1 F8 u - #define TCINTEN_SHIFT 204 e' V! i. v. q1 S- j; x
- #define ITCINTEN_SHIFT 219 {$ p7 J# X9 e" R
- #define TCCHEN_SHIFT 22
8 x$ v4 f J- N5 T: F" d" g - #define ITCCHEN_SHIFT 23. @& f4 G- K0 K5 w- e
/ R& u' ?4 X# c& F; K- static volatile int irqraised1 = 0;- N+ D' |5 K! q5 q; B5 q8 P
- static volatile int irqraised2 = 0; M$ R0 Y+ R4 F9 p8 e
- ) I" A4 E) Y6 A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 A# h* z3 l- [9 g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( l: W8 k# e' L& n( R T$ e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! s; a% K$ @2 g. d, q - 7 u: Y9 ^$ W7 X
- dma_addr_t dmaphyssrc1 = 0;* L6 ~+ j5 ]; \8 T6 f7 M! \$ Y
- dma_addr_t dmaphyssrc2 = 0;0 j4 v* x2 B; d2 G6 N
- dma_addr_t dmaphysdest1 = 0;6 X5 h+ ?" N. C6 ^1 H
- dma_addr_t dmaphysdest2 = 0;, `' Z3 v$ G( c* T
1 m2 P3 W# e, [- S& ~! ~% C- char *dmabufsrc1 = NULL;
" I8 R5 v7 b" V% @* Z5 `4 Z - char *dmabufsrc2 = NULL;* g1 V7 h$ o; K4 V
- char *dmabufdest1 = NULL;
# m' t% G# d" J4 W - char *dmabufdest2 = NULL;+ x' y" E: n% y( K/ y% e$ o
- ( u& y+ Z: e" j4 _) O
- static int acnt = 512;
( C! D7 r: S1 d. j" f - static int bcnt = 8;8 F9 q' A! m5 n0 P+ a
- static int ccnt = 8;9 T* i( n& @/ s; d
- $ S! E J7 j o+ F3 H% T8 z
- module_param(acnt, int, S_IRUGO);% i! W: H& x) s, N7 y8 ]0 L! E x8 }
- module_param(bcnt, int, S_IRUGO);/ h; F) S# @( L: Y
- module_param(ccnt, int, S_IRUGO);
复制代码
. b* O* p; Q0 S8 y8 w4 q4 p
% p( l% M+ A5 \* l' C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, P% p# F7 B& ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- a0 E4 R: f D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, F Q8 u% m$ J2 f& {: U( b9 Q' w/ S6 r& j! J/ q( V ?1 J* ]
* |: P3 }) i- K2 k, X+ y) g4 ]+ {
|
|