|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: w0 U0 J/ ^' K3 W- [code]EDMA sample test application3 M C7 s: L. z7 f3 l6 P* e
- /*3 l! H; X6 ?% g- h
- * edma_test.c
2 H+ ]% z7 ?( ?5 D; |' I- D- n9 Q - *" ^5 p# a7 ]* G& ?( c! G
- * brief EDMA3 Test Application
# K/ ]$ i% ^: y - *) l8 @6 u6 |0 q% c0 @5 l4 ^. H
- * This file contains EDMA3 Test code.
9 K1 T9 q' j( {6 }! V - *0 ^- w$ `! \4 L7 t5 F* ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 F* H9 E5 T: S4 @+ E- q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, s: Z4 S, q" _: k2 ?6 a: n - * TO CHANGE.
% e) E5 C3 a! p% o7 o; l - *- l# j9 [" [8 X, r L! U9 k% f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// ^2 A( b) v1 J- i
- *, l4 ~: L" U& x. g& T: ~! v
- * This program is free software; you can redistribute it and/or
$ p# X% n S3 j& d; M - * modify it under the terms of the GNU General Public License as4 T0 [5 V/ l. |9 ~: B& n
- * published by the Free Software Foundation version 2.7 k5 y6 Z6 P( y$ W! r; k/ ~8 T
- ** R a4 R O) A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 A P/ @9 `3 |! ~- M: {" Q - * kind, whether express or implied; without even the implied warranty$ g/ O# p: Z% f6 h7 U2 T7 ^4 f/ C1 E N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 W6 |( s- C( e, K, n- |7 N
- * GNU General Public License for more details.
/ |9 C }" A/ Z1 P c6 O. n - */
4 Y# |4 r7 }! c3 K$ `, L2 g* u3 D
$ J' J6 ~0 N3 z$ j- #include <linux/module.h>7 e0 Y7 O+ X: v. i) h* K
- #include <linux/init.h>6 r# h3 {. I# R0 J
- #include <linux/errno.h>
' a2 L o Y; }3 b - #include <linux/types.h>
( r9 S4 g& V( e# W* A; D - #include <linux/interrupt.h>
. |1 J m5 H# U* W - #include <asm/io.h>
+ v! O S. P$ n! q5 B w$ _ - #include <linux/moduleparam.h>9 i* i5 v6 G$ n/ ]) v" G, N# y- t
- #include <linux/sysctl.h># p) X9 { V/ h0 @5 u8 f
- #include <linux/mm.h>( w0 d( z H N) {
- #include <linux/dma-mapping.h>
- Y0 ~ Z8 s5 Y1 R% P7 W( ?0 d
( V/ D# \. D' N; m- #include <mach/memory.h>' u2 F& t) j b6 b' r u4 X6 ?: n. J
- #include <mach/hardware.h>
2 i6 } r/ t9 w3 k8 N8 D, d f: [ - #include <mach/irqs.h>
- [8 C3 T Z3 w: d - #include <asm/hardware/edma.h> t# w- F2 \8 A- x+ Q
- ' T2 N0 {# _: n; D8 a
- #undef EDMA3_DEBUG
5 @; y K" V; v+ v. ~% W - /*#define EDMA3_DEBUG*/
5 B* R7 S- x4 f7 @' D" W6 `3 s - & w) X7 K2 T Y* S
- #ifdef EDMA3_DEBUG
x1 F, }% B9 w- p3 A) B6 @1 ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). o8 a1 r8 m/ L/ h8 r1 l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. i0 v/ Z) B, s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 Q/ e! F+ h6 W0 }! T% O - #else4 q$ X# z! H) z8 B" z
- #define DMA_PRINTK( x... )! p5 f) y( M7 J. Y
- #define DMA_FN_IN
: o% _+ o9 @" s9 n! ^ - #define DMA_FN_OUT
1 I0 [! w1 h% e4 t - #endif
- m i& f) S- g. Z2 t
0 v. O# `8 |2 H3 _' J1 d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 l) R3 n" o) [. I- D- X
- #define STATIC_SHIFT 3
) w+ u5 N: s% G5 d - #define TCINTEN_SHIFT 20
' H: F2 J6 o5 H - #define ITCINTEN_SHIFT 21: Y6 q f6 p" d2 o# j1 O1 T/ r
- #define TCCHEN_SHIFT 22 n* x4 |. D& ~, g& q- S3 F" q
- #define ITCCHEN_SHIFT 23. @, q: k/ r) ~: L' {
3 E, z [5 p/ \1 [7 R/ _, ]1 w- static volatile int irqraised1 = 0;. G) G, n* @7 X) a
- static volatile int irqraised2 = 0;
3 n# S$ }4 r' l - 1 x$ g u9 N! Q) e! |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' t9 f! b7 u& K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 p4 g8 N6 E" g( `$ u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 q0 s2 T4 ^; _* I
/ J' b5 V8 v1 H" X. r4 c* O1 k- dma_addr_t dmaphyssrc1 = 0;
% _6 A2 n8 D; k6 t4 @2 k - dma_addr_t dmaphyssrc2 = 0;1 J' `! i5 m* {: |; }
- dma_addr_t dmaphysdest1 = 0;) S* W# S/ t/ z& C/ V9 B
- dma_addr_t dmaphysdest2 = 0;. l( f* a" _- I* G* ]% i( Q2 ]
- % c6 \) a3 {9 n; Y4 s; G7 b" p A. o
- char *dmabufsrc1 = NULL;
$ W$ i4 K) E1 s S4 j, V, t - char *dmabufsrc2 = NULL;
& I9 W$ v" p- p: A- I$ f - char *dmabufdest1 = NULL;
6 Q( s' `$ }' D$ e* B& N* N - char *dmabufdest2 = NULL;
+ t+ r+ Z) l3 G: W# n - 9 x: s2 x; D+ R: f, }1 X
- static int acnt = 512;
) K) m* N0 l( u* |* b - static int bcnt = 8;
7 o* K+ ^) S: S' I9 ^, o" _+ l - static int ccnt = 8;
" K( Z$ n! V0 i3 V, H4 L
; J- f; e, r* E8 W" W+ C- module_param(acnt, int, S_IRUGO);4 ^) N' M% ]/ H4 q' g, Q
- module_param(bcnt, int, S_IRUGO);: A, A7 H, m& X
- module_param(ccnt, int, S_IRUGO);
复制代码
) V9 J7 v. y2 n( }4 k! Q4 e& F. i/ p+ f s
+ v8 B3 z" j1 i* k. K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: ^3 P9 ]/ c* D/ E. n( P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 T4 D1 i; ^5 C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 d4 x( k7 ~: [: C8 N: N
" G& \7 H6 U9 X1 H& X: \( g( ^# W7 f' z& m
|
|