|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * X# e% t R% e5 y
- [code]EDMA sample test application
6 S, E& r' B4 y4 ^( z - /*- P! U$ C8 m6 \) h' W5 S
- * edma_test.c! f! H$ V; K# y5 w% y5 }
- * ?: S. W8 t3 P
- * brief EDMA3 Test Application
; R( v2 P' K3 t5 n - *; W: y6 ?. M7 H$ E+ g: @
- * This file contains EDMA3 Test code.- m3 I. V$ x7 I& T3 h
- *) X3 P0 a3 w7 x: n" E5 R8 y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 |# f/ M" Z4 \0 w; Q7 R6 ^. U V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* R% T2 c8 E6 l `& N - * TO CHANGE.) t7 L O' W- t0 F2 h/ v9 \) m3 h& d
- *
4 x( Y! e1 `4 q5 `1 P, r U% K* b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 [1 v$ W' t6 \
- *
& v8 y% Q3 \+ ~ - * This program is free software; you can redistribute it and/or( F n! a$ v+ f* J( ~' `4 q |
- * modify it under the terms of the GNU General Public License as
4 \( h* P2 d0 V, R. Y - * published by the Free Software Foundation version 2.
1 l/ A5 w% R u5 |1 C7 X - *$ ^9 L& V& |* ]) u0 n; z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 R& ~( ~# e/ R5 m2 O! w- z+ W z - * kind, whether express or implied; without even the implied warranty
& o; u1 [# v8 R, `2 Z; M' T. V1 z0 | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 q+ R& s. N4 d5 y9 U' Y' R4 H
- * GNU General Public License for more details.. Y3 R+ L% I) d4 y. B+ T L
- */% `4 g" o# J1 w B/ j9 W4 ~
' r3 a' S1 o* S: I) H- #include <linux/module.h>
6 Z+ w, B9 ]+ S - #include <linux/init.h>
& O6 b+ N3 K' p1 f4 A0 W - #include <linux/errno.h>' w3 w5 d5 p4 o0 h4 k4 K
- #include <linux/types.h>& C- g, p8 R: a2 K
- #include <linux/interrupt.h>
! H( f1 R( g) q! Y/ a- d( v. w2 A - #include <asm/io.h>
' ^ h* [5 q% V- J2 d4 u* N - #include <linux/moduleparam.h>$ n$ O1 v; D4 Q6 R
- #include <linux/sysctl.h>' [# j+ \- M! V* H$ I1 ~" S( W
- #include <linux/mm.h>4 \% o8 O% q/ u" j
- #include <linux/dma-mapping.h>
9 l$ ]% r+ g, p6 Z( B/ \7 Z5 Q) W
# M+ g% g- k) ~5 @- o- #include <mach/memory.h>
3 V: L N7 H: ^1 v' R- w' O8 w - #include <mach/hardware.h>
! o+ U3 O x( x q* H5 ?8 X - #include <mach/irqs.h>
1 S8 T1 b, B o& V0 ^' p - #include <asm/hardware/edma.h>6 s+ _' [. @0 t9 C
8 D% @* k& x& K/ u4 E& y- `- #undef EDMA3_DEBUG3 b" P& q/ v9 X+ Q% Q: D
- /*#define EDMA3_DEBUG*/* j2 T5 n4 I3 E7 w. Z
- ) w8 @ G; j- `( F# X( ^7 k' S
- #ifdef EDMA3_DEBUG& J& H1 t1 M1 `0 z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- h2 e8 u3 @! Z7 ^5 A& L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 C" L- G5 H/ m8 \, X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 Q. U& a- l* u- {" `; v7 U - #else; h2 E% p* J2 x
- #define DMA_PRINTK( x... )
; _9 O V& d2 A8 ?, C" ^6 j( j - #define DMA_FN_IN
0 k4 y. o+ j7 R0 d; b' B. r0 t! x3 k - #define DMA_FN_OUT
# J a7 s4 x+ C2 Q6 K - #endif
, ^0 l$ K2 m4 ]' r- Q1 ]9 R
4 i& I. _2 t; }; y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, z! d$ D; w7 U3 H( o - #define STATIC_SHIFT 3! v' z+ [6 U5 l8 W
- #define TCINTEN_SHIFT 20, K" b5 R _+ f1 R# e+ z
- #define ITCINTEN_SHIFT 21
6 E [- r* a0 J |2 C - #define TCCHEN_SHIFT 226 T$ q& g" M2 R; J; O( n: I
- #define ITCCHEN_SHIFT 232 R! z- D W, ^9 m+ e
: u+ c0 h, \+ m. ?0 {+ m7 D- static volatile int irqraised1 = 0;
; {- R+ l2 N1 N5 U5 c* X2 a2 i/ P0 R - static volatile int irqraised2 = 0;
\' m$ a* b+ Z5 h* ]' z4 n
# [& a7 G. p, B* c; g; |, M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 m) V F& G+ r" }/ L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ n8 d3 f2 _, x# c- y. q3 I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 `& x$ y* _- m) q$ y3 B
, g1 V# k* f) c ^. q0 V; p- dma_addr_t dmaphyssrc1 = 0;
0 b7 D' M. j2 s. K% p$ p5 [7 J; x+ @ - dma_addr_t dmaphyssrc2 = 0;
( L$ j3 z" a$ o0 k; b - dma_addr_t dmaphysdest1 = 0;; g7 ^# ]8 R$ }* n
- dma_addr_t dmaphysdest2 = 0;/ i! C4 t+ }$ _8 W
; S. O. f1 p& c* |- char *dmabufsrc1 = NULL;* p! o( O a& T3 r1 U
- char *dmabufsrc2 = NULL;
' |! w$ n n9 [) N3 K! b - char *dmabufdest1 = NULL;: R7 y# K# D9 [& z/ u: [7 t
- char *dmabufdest2 = NULL;$ R$ h4 S5 A& e: l
7 h2 ] O/ R$ Y- static int acnt = 512;
5 T4 w" V8 F' f$ B' [2 I% ?' j - static int bcnt = 8;6 k" `' m* X9 v
- static int ccnt = 8;
0 ^. E" M: T' V9 T- @* E$ T! S
+ I7 D" a7 t2 S! d& n/ T) I1 h! l- module_param(acnt, int, S_IRUGO);
# ^0 a# x9 t: O7 G- K4 \ - module_param(bcnt, int, S_IRUGO);
* i) [/ Z; d+ J: T4 C - module_param(ccnt, int, S_IRUGO);
复制代码
: `0 U0 x, p W# W F
7 O( n: _! O5 V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) N$ t, ?" F4 S- `$ _3 V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. v9 s9 R4 I. q6 x; C `5 [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 E' J: M z; j6 t5 }6 z
, L8 W, W' A2 X- k
- \4 q6 h4 T* p9 K0 T- g |
|