|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % l4 q; y' |8 q
- [code]EDMA sample test application2 z2 J- w2 u E. }6 S
- /*" y- u) y# Q& Q" q4 |. A+ i
- * edma_test.c
) K3 h# i) s: o6 Y- e6 E# ^1 m2 v' R, u - *
+ O3 g3 I9 p0 S/ x5 ~# A+ Z# z# a - * brief EDMA3 Test Application7 o! ^& A0 c1 W, L4 v7 }( |
- *
5 n1 x- j7 n+ N; g4 ] - * This file contains EDMA3 Test code.- G' P: m0 T/ K5 n
- *
6 A9 e$ W; _ | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; k x' i q2 g% @5 Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; E( o0 P$ M$ s9 H$ @5 S& P& c
- * TO CHANGE.
9 P" b, ?1 P8 W" @6 S# Y& d - *, Q) J6 o* B2 ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 a" r8 b: z. x
- *
2 I* ]7 k' P/ [; R8 K8 [ - * This program is free software; you can redistribute it and/or, D# x% P/ B$ k \) A% A: q5 u
- * modify it under the terms of the GNU General Public License as
; S, y( ^! ?4 Q6 h - * published by the Free Software Foundation version 2.
4 R) T$ r, ~3 x - *
Z) i, D5 g) _8 t3 u0 o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! A1 z9 b& V' ?) f6 t* n x
- * kind, whether express or implied; without even the implied warranty
* Y% {5 D! \5 @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& \8 E4 O/ f% r m
- * GNU General Public License for more details.4 e& r* }" L8 m
- */
, U8 Y* J- n! ^) w
0 D; w& r- @7 ]' S- #include <linux/module.h>
; T! e# {. ]4 N" g% E+ I - #include <linux/init.h>
% x f* K) s7 n4 ?1 R1 |4 P2 W3 g0 s - #include <linux/errno.h>
p8 D0 T0 P. r: d: k/ ~ - #include <linux/types.h>
9 j9 P& A! N3 S5 t# t( ~% g/ r - #include <linux/interrupt.h>
" ^. o' |3 E; h- p$ ` - #include <asm/io.h>
6 W# J: R; S. i: F8 I/ c - #include <linux/moduleparam.h>2 w) g7 s& P* Q6 i' G6 c# q3 E' ]: x
- #include <linux/sysctl.h>
' @/ R; b1 n; k9 `/ u - #include <linux/mm.h>
T" E9 }+ S4 t' D5 G - #include <linux/dma-mapping.h>
4 q' F2 }( e p1 o* I2 e - - s. V8 X; v* x
- #include <mach/memory.h>
* I' f9 O+ X$ v. Q - #include <mach/hardware.h>
1 n5 I9 v& y3 R9 z6 ~; c, P! u9 d - #include <mach/irqs.h>
, R! `$ u0 ?) P" c - #include <asm/hardware/edma.h>0 X! \ d4 a# U; p1 L8 |5 m
- . z% e1 }; N4 U( E, ^+ s
- #undef EDMA3_DEBUG
/ o% Z$ m; ]1 e7 W - /*#define EDMA3_DEBUG*/6 f7 s4 `% r$ [' i; y4 Z- T# Y5 x
3 H- f8 H' z" I* z' r- #ifdef EDMA3_DEBUG
( i: `% |+ k) f" k1 x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ D* A& a5 m2 u" ]! k* D' I0 S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& s7 B" ?, Q3 a( q% ] s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 L1 m0 h7 d1 ^; E1 S - #else
# t: L }; E: K0 `% g - #define DMA_PRINTK( x... ): Y" F, T/ S1 f( u8 l
- #define DMA_FN_IN
3 V4 S5 l0 c$ v9 ~# o - #define DMA_FN_OUT$ J; L) g6 ]0 S+ R
- #endif
; {. L, p/ h7 J P5 \4 r& l - 5 q9 B3 R0 {2 g! U. \' b9 Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* V# S$ K% h! z
- #define STATIC_SHIFT 3
# y& S, h$ r# p6 m" P" o4 F - #define TCINTEN_SHIFT 208 q) G; i1 X' q, R9 }2 L; V* S
- #define ITCINTEN_SHIFT 215 k; A, ? L# ~; S R! N% r
- #define TCCHEN_SHIFT 22
, q# {( c4 d) w8 h2 T% n - #define ITCCHEN_SHIFT 23$ I" H& n$ p: ^* C0 {/ Y
- : {+ T% p' ]) ]) u
- static volatile int irqraised1 = 0;7 I& c8 N& X* Y4 G
- static volatile int irqraised2 = 0;; ?4 y/ _+ y9 b6 l, K: ]
/ p! i2 H0 R) w* J5 G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ]1 @6 I* i( W9 H5 R. J1 c: x) p/ Y, X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 C+ f- I0 b( A" S2 e8 P# B; B8 c! O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 O1 k- X: a/ S4 T3 M: }8 x
/ X. k# f! m* P+ e- dma_addr_t dmaphyssrc1 = 0;
9 Y* h1 n+ c3 h7 a' o - dma_addr_t dmaphyssrc2 = 0;6 c0 ~! A# K9 B- e
- dma_addr_t dmaphysdest1 = 0;
* D- ? a: `8 D% F - dma_addr_t dmaphysdest2 = 0;9 }5 G6 L( w" y8 r8 Q9 m5 E
- / \9 q0 Z; }( F# l
- char *dmabufsrc1 = NULL;6 M& {- O7 w! A0 Z) L) [$ `
- char *dmabufsrc2 = NULL;8 |! u& g1 B/ d1 w* T/ a
- char *dmabufdest1 = NULL;
3 Q* L U$ v3 C+ p3 o3 o - char *dmabufdest2 = NULL;1 Z; {- y# a3 A8 s2 O) K
+ } H/ J% n. o- static int acnt = 512;; f; C+ x. K( K. E
- static int bcnt = 8;$ x5 g" N5 @/ U. w7 h+ Q
- static int ccnt = 8;
, y, B. e2 a- T, O+ H$ T5 }
1 K( R, t# ?; m( Y& k) Z- module_param(acnt, int, S_IRUGO);
$ y' R4 j& h D. T9 C - module_param(bcnt, int, S_IRUGO);; \' B* B: D. w0 A
- module_param(ccnt, int, S_IRUGO);
复制代码 ) t3 v5 {& t5 U" n
- ?0 d0 h2 i: f; F+ @! q: a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% o! K5 Y# ?. b2 I( X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ \7 T2 A" b% Y5 j& u. e4 M1 p; I4 o( j! b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. e6 J) L: j9 M0 R
0 ^7 l6 j. ~7 I X5 i* E
; P) s5 B! w. U5 w0 M2 u" | |
|