|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 ?; R, J1 B O
- [code]EDMA sample test application1 k3 a% F: X3 l+ B" W# @
- /*
, R: F) `! x. ]+ Y - * edma_test.c; G& Q. [5 i) g% _5 t. u9 L) ?
- *
4 |1 t$ J+ k3 A2 |' Y - * brief EDMA3 Test Application& T e) E& h" [/ w6 I7 ]# P6 @- @+ H
- *& }3 n# F4 Q4 |! r
- * This file contains EDMA3 Test code.
5 @* ]2 Z* H) F5 ]) k% r - *- ?: u% w/ J6 H, ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 r# x/ G* N. |/ t. J# |) ]# i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- p4 V# r: e0 _. S
- * TO CHANGE.) v P' s" e8 X; S0 I
- *8 O' b# g# J) E- q% g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# s' b3 A1 c. S - ** M9 G- C% ~( @2 B3 a0 q, S; Z
- * This program is free software; you can redistribute it and/or
1 T# p/ W( f* m1 S - * modify it under the terms of the GNU General Public License as: I3 a- f3 G( C/ F1 @
- * published by the Free Software Foundation version 2.
0 Y2 _5 a- z1 P8 X; w2 C - *
7 a) a4 h- A4 e0 T% S7 I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ ~( Z3 X4 b' ^7 B: @+ T
- * kind, whether express or implied; without even the implied warranty& F5 `) e% G" u: {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the U" r5 M6 Q1 o( Z1 x/ V* i' y* B
- * GNU General Public License for more details.
" \( q; ]9 [6 a - */
) | D# e" o% Z8 ?0 ^( W
7 g2 s% S" T F5 W( F8 A- #include <linux/module.h>
( S, I, J, n7 q- Q* f1 o - #include <linux/init.h>4 e/ n- I: \8 l2 I+ i
- #include <linux/errno.h>
8 m3 |+ Z$ G2 { h - #include <linux/types.h>
3 W% u& G5 w1 b. I, T# l3 R - #include <linux/interrupt.h>
u; T# K9 B- g2 R) s% | - #include <asm/io.h>
) U: K) r( u' ?% Y/ m" W - #include <linux/moduleparam.h>0 r1 P7 @4 |! y$ M
- #include <linux/sysctl.h>
) {" @+ q& F& V+ s4 W' o& J- a8 K - #include <linux/mm.h>0 h. U9 B1 K& I, X
- #include <linux/dma-mapping.h>
6 v2 b8 A+ l& S - * `: x% @ @- [
- #include <mach/memory.h>
( Q2 i" k( N2 f - #include <mach/hardware.h>
4 }, X9 Z2 K+ g4 o - #include <mach/irqs.h>; G+ ?+ ]* S4 \6 _& e
- #include <asm/hardware/edma.h>1 ?& n) m0 J0 Q- j. ?
- 9 M! p$ @9 m& a) H& t
- #undef EDMA3_DEBUG+ }/ E, _8 U$ V+ V& k
- /*#define EDMA3_DEBUG*/( f) O8 [: o: S- V$ f
- ! u- E2 F: T8 [+ S, R% r; s: I* D
- #ifdef EDMA3_DEBUG
3 t0 L! y/ ~3 q' `- B1 n, d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), ~( V1 j" J4 ^& T5 S: Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% ]- H& x9 X- o6 g$ j" c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. V, ]7 D- X }- q3 O$ j/ d - #else
# w% W% j5 k- U% W* n1 P+ P - #define DMA_PRINTK( x... )
: \4 ~5 S" w3 j! n* H - #define DMA_FN_IN
$ @5 H& ^3 z: Q$ f- H8 [ - #define DMA_FN_OUT
# u7 }* [; R7 D+ R, c - #endif& P5 t. Z* T/ ^. `1 U5 k6 s
! c) t% b$ l. q- M& \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; k2 e7 N2 o: M: ?6 F- N - #define STATIC_SHIFT 31 k T8 S, u0 o! \3 z
- #define TCINTEN_SHIFT 20
. H5 ^, z6 L, Y E _( q2 H - #define ITCINTEN_SHIFT 219 G# C5 }( f4 Z' ^" D; i
- #define TCCHEN_SHIFT 22
1 ^, ?! n# w* A8 ?& q$ V* U: g - #define ITCCHEN_SHIFT 23
' S7 E% L I/ U3 [ P( [( a' ]1 q
( O9 k+ _' P) @; G+ g5 m: [- static volatile int irqraised1 = 0;9 ]7 P6 ~3 l2 c- N8 J4 u
- static volatile int irqraised2 = 0;
6 g' U+ ~" W7 d
% h5 }* t% C1 V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 c: {; R9 i( k- Y( |3 Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( E% r- h: Q! @1 b. J! t+ } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( l$ A( ]: M( p/ y2 ?" [
- 2 ~$ R& u2 d& A H! k% J, t4 [
- dma_addr_t dmaphyssrc1 = 0;$ l5 L' o2 ^: H- p. c
- dma_addr_t dmaphyssrc2 = 0;8 v6 F$ c. N" I% z# U
- dma_addr_t dmaphysdest1 = 0;
/ ^7 `9 }0 V1 S5 S/ J; R - dma_addr_t dmaphysdest2 = 0;
5 c, V# l' s& h7 C# w; l' [* x; S - ; @' m' a% E# b1 V
- char *dmabufsrc1 = NULL;
, m* C5 f. K8 _! {3 z% W2 H$ J* I - char *dmabufsrc2 = NULL;
" z; V" f3 z: a8 ?% J - char *dmabufdest1 = NULL;; b6 U3 W6 m8 V& c0 N$ A5 v- E2 l
- char *dmabufdest2 = NULL;6 a. o3 S4 C( l' O: E& r8 `, N
/ r8 M5 I: S s0 X' s- static int acnt = 512;
6 w. P( N/ v( o- d+ S" v6 ^ - static int bcnt = 8;" L( W$ B0 o% P
- static int ccnt = 8;0 D9 a& g) Y" P7 L# ]8 b* E' w' T
- : ~0 F1 a7 D$ N! @
- module_param(acnt, int, S_IRUGO);$ c Q; M8 J9 N. {7 b+ e4 J
- module_param(bcnt, int, S_IRUGO);
; E/ \3 B5 S& M& q( \. n - module_param(ccnt, int, S_IRUGO);
复制代码 s. A' ^' L% B/ F% W
' z8 q( u1 p8 Q/ i, H4 z( {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# y( `/ m# Y9 ~; Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% x: @% q5 y: h5 B" s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! ~8 f. _" {& l0 e; I ]) N& L3 n
7 z) q9 i: Y% f/ Q+ y9 _9 _* `
" ^/ A$ v. A9 Q! D4 e# Q
|
|