|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * v- T% X% c, o0 G+ Z# F
- [code]EDMA sample test application
2 A" h6 r) B- G% T/ K' l* J - /*
( h9 x! L- O, N - * edma_test.c. B Q6 y: F; |5 ^2 c$ G( h
- */ c4 E# a5 N& {& |0 t5 y9 n
- * brief EDMA3 Test Application
9 p; c3 J1 m9 M- y - *
1 C4 G, w. S0 p- C9 s* f% y - * This file contains EDMA3 Test code.
$ K; }2 e1 v5 j" ^' @4 S - */ d. l5 c3 a$ C! ?% w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ ], z+ [: ?+ J. ]/ [. g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" f) O$ P8 V8 b0 t$ L# o/ `/ I. ?
- * TO CHANGE.( G) W8 Z6 s/ u$ h2 L
- *
% h0 @0 k) p! `! E- | X2 n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) a& |9 W7 V5 Q1 n; Y; ]% Q R
- *
3 z. K8 K+ E. F5 I+ Z% L - * This program is free software; you can redistribute it and/or
5 d3 _' D Z4 N* w3 O# n - * modify it under the terms of the GNU General Public License as
) V6 Y! X9 }! }% Z* e5 c6 [ - * published by the Free Software Foundation version 2.4 z8 i0 y3 x I' _2 p" d
- *+ h7 o3 }* p; c }1 c0 B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 x8 E1 n# j& [7 g% Y
- * kind, whether express or implied; without even the implied warranty# M* @ g p |1 B; Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 l- D+ F* g1 y, w6 R* A/ U1 A2 s- l
- * GNU General Public License for more details." n2 b: R: O; u- y( J
- */# ?5 x; r" e; _. T9 i8 D
) Z- f& p) _# a9 I; ~- #include <linux/module.h>
: ^) d& S5 k8 {$ X0 k$ o e1 } - #include <linux/init.h>
8 g t% v" Y. Z- l - #include <linux/errno.h>
* _# W" e0 X- t. K - #include <linux/types.h>
5 B' [+ D+ K( | - #include <linux/interrupt.h>! S0 L3 E4 y! G. R4 M: T
- #include <asm/io.h>
1 u9 A8 u, r8 ?1 e - #include <linux/moduleparam.h>0 p, V* Z" Q6 p8 q+ ?* v: J# X
- #include <linux/sysctl.h>
( y& l+ f2 |' ~ - #include <linux/mm.h>
) u# I0 p5 }5 [3 f/ v, b - #include <linux/dma-mapping.h>
, |2 n9 i# a8 N W5 a - & I: d( K! v$ y
- #include <mach/memory.h>
8 p+ c, ^" v+ v8 C - #include <mach/hardware.h>; n5 W6 j6 O$ ~0 _( o: N
- #include <mach/irqs.h>9 Z) }, m1 M( C1 S
- #include <asm/hardware/edma.h>
$ s j3 M% Q# x8 K+ T/ b/ g' ]. f
5 i4 {/ H) k% [" @- #undef EDMA3_DEBUG
$ E, V* `& p2 C - /*#define EDMA3_DEBUG*/
' e/ Q3 j8 e+ v; \; s - # w' W3 z5 R2 u$ m# N- h0 k Z
- #ifdef EDMA3_DEBUG
+ K$ W. {: a1 L: U+ G! I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 q9 y! m9 e% ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& R3 q7 X/ p3 g; N# y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% r) n; w$ t$ c! Z
- #else- q: @* L( L2 ~- d$ o" D( y
- #define DMA_PRINTK( x... )- H$ t& Z& h2 L# ^
- #define DMA_FN_IN
0 P" Y+ m/ w. ^ - #define DMA_FN_OUT
1 X' v; N* w, S% s - #endif
9 a+ c3 K, T- ]! e
- ?4 v# T3 r6 x5 V, W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 d4 [+ a. a! W s* P - #define STATIC_SHIFT 3
% ?* |. ?- d: k/ x1 O+ V - #define TCINTEN_SHIFT 20
: {7 {5 T7 v- l3 F* K3 @ - #define ITCINTEN_SHIFT 213 U% a$ ` Y# J+ `. G
- #define TCCHEN_SHIFT 22% H8 i+ b( D) }: ~- U8 _
- #define ITCCHEN_SHIFT 235 c g2 {/ B$ Z( U7 d5 `0 n* x
( B. `3 j/ g2 g4 c- static volatile int irqraised1 = 0;
+ J7 x8 U, {& {. q! v - static volatile int irqraised2 = 0;. E4 [/ D: h) L
- |, v T- f. ^6 }0 @% ?5 V/ y. R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 r1 k& C/ u) h/ \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* d. i$ Q6 \/ f2 v: G! O) z4 @: L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- }1 C( H: V, g/ j" }0 h1 o D
6 R9 t, S' h* Y7 \- dma_addr_t dmaphyssrc1 = 0;7 @' ?& e( V9 B, C: U
- dma_addr_t dmaphyssrc2 = 0;
" ?7 R9 V: O$ ^ - dma_addr_t dmaphysdest1 = 0;2 D2 }& h- L1 L
- dma_addr_t dmaphysdest2 = 0;& O0 v3 C& H; r, q0 [
, s3 k( e! q9 J- char *dmabufsrc1 = NULL;
- O: M; ~6 k# e - char *dmabufsrc2 = NULL;% U, v+ P* P3 X
- char *dmabufdest1 = NULL;
' b" D \7 E% U ?# n ~5 I" y - char *dmabufdest2 = NULL;& @! k4 d# P2 u
4 o+ F% Z- A% m3 [$ C- static int acnt = 512;5 y. \- w! c" F/ j. n
- static int bcnt = 8;
2 j5 @ Z% b0 Y# J+ ] - static int ccnt = 8;6 F& {1 g$ D8 x9 c
- % |' Y/ ~9 s3 ^3 o9 G
- module_param(acnt, int, S_IRUGO);
% D0 V( `' N: ?4 H$ S2 c) Z# U - module_param(bcnt, int, S_IRUGO);
2 h* z- f( Z5 ^& J. ~& a5 u - module_param(ccnt, int, S_IRUGO);
复制代码
' Y! |4 {8 ]7 }% q7 N) f
/ ?0 b6 @- T$ v2 Z* g0 ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 B0 Z& G% E: c5 r! Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ P. q7 i+ R" n( \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ b% \ i2 J5 k" I; |* Y
9 N D6 A8 o! @: ~4 f
, M: a2 w" s1 y- N6 e4 Q1 X/ c |
|