|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( l, {6 n$ h6 r; s: \& `% `" y
- [code]EDMA sample test application
8 I. ]6 S! f6 Z' e0 e - /*6 z9 s: w y2 M" T* Y
- * edma_test.c3 _8 W. g3 \9 F& ?: D i' k
- *# \! W$ l6 T" u& b/ P2 h
- * brief EDMA3 Test Application
p3 E6 O2 i5 U- d$ w* [$ J - *. {4 R& W1 N3 Y3 c# \1 R$ J" a
- * This file contains EDMA3 Test code." i+ B; U X& m U5 `& l+ O
- *
) u2 f6 K- j/ O) F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* l- x6 `% a" W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- }; ~3 ~/ U g; m: k" s
- * TO CHANGE.3 C- s1 |7 H z% n3 c
- *5 o2 L C3 c3 e; t6 F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 ~. m( A8 |3 p+ |/ \# q
- *
6 u9 c" j( z; [& \ - * This program is free software; you can redistribute it and/or' e+ E5 k# x1 m5 \+ A* u* g. z3 ]
- * modify it under the terms of the GNU General Public License as
' b c/ J9 W+ n: l$ i7 x& c - * published by the Free Software Foundation version 2.- y8 [& x2 K4 }1 B7 O1 a$ ^
- *
9 y: q! C6 @6 t; X* y& Q2 ]$ T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" A( T, T7 I$ Y3 G, y1 D2 R: V- e( g- A5 [
- * kind, whether express or implied; without even the implied warranty$ w+ g3 Z8 S* N/ ^+ ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) g5 w+ A. S5 g4 j
- * GNU General Public License for more details.
+ \. }5 W8 Y# p: l/ I7 k/ l - */) U6 z4 @) C( i+ h3 E6 u$ R
- * z1 \9 v* o5 H/ V
- #include <linux/module.h>
3 @+ q6 M5 E9 E& j' | - #include <linux/init.h>+ k1 S0 s2 u1 {( e9 ~+ I3 w" }
- #include <linux/errno.h>
, v1 ` O% a' b - #include <linux/types.h>9 u7 l" v0 h+ Z) L" i
- #include <linux/interrupt.h>: s3 s! f# ~' O- X( V2 \
- #include <asm/io.h>
) Y6 h/ t8 T: R9 ^. {. t - #include <linux/moduleparam.h>8 F5 l p) ]) P b8 `
- #include <linux/sysctl.h>
2 F- { k. o& [: ^3 Z+ I4 q - #include <linux/mm.h>+ [( E1 P" i2 E
- #include <linux/dma-mapping.h>
( O+ t* S3 e$ e% } N7 k; d, O
/ k. \% a4 n7 T+ l; _$ _- #include <mach/memory.h>, X7 @2 R& d W& ~6 K/ N
- #include <mach/hardware.h>8 w B) q. G: c1 f% y. t# o
- #include <mach/irqs.h>
5 W4 B/ j; v# t+ V4 P; |% J - #include <asm/hardware/edma.h>5 D; d, u; z$ f4 U7 m
- }# x& g( h7 @3 S' A' O
- #undef EDMA3_DEBUG
- q1 B' q$ l3 T* M* X8 M: F; @: [) L - /*#define EDMA3_DEBUG*/1 ]5 [! w3 p3 e
- V# ?+ o+ ^4 g1 `) k
- #ifdef EDMA3_DEBUG, {8 h2 Q$ p' o. w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) l- w/ K! Y7 b/ J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ C9 Y/ B/ U% N1 `7 a6 E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& [6 O; Z8 Q$ B7 N* i/ _ - #else+ N; j, i( A5 R" W& o
- #define DMA_PRINTK( x... ). w% P. K* _& {) W
- #define DMA_FN_IN
& \5 _0 X( F+ E1 ~6 N# d - #define DMA_FN_OUT! |; ]* ^% R$ v# r: J
- #endif! d, {9 g; b, R! A. c* m8 n
3 T% P: u9 g# f% K3 l# u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ _8 U/ w1 d- q
- #define STATIC_SHIFT 3
, L! _2 s9 @3 I1 F - #define TCINTEN_SHIFT 20: f3 t& s0 \7 s/ W u
- #define ITCINTEN_SHIFT 21, [# e7 @/ @& l# }0 m3 R9 P2 b! B* r
- #define TCCHEN_SHIFT 22
& J* W* g$ h) s# M' m' Y - #define ITCCHEN_SHIFT 23% U' k: S# H0 n; J& I9 R; j9 R( q; Q
- * [' t8 Q, z. v, A7 C* g @
- static volatile int irqraised1 = 0;
! u, o9 u% [! K1 { - static volatile int irqraised2 = 0;( B4 M A# [1 G! a9 k* e
. {# |1 D; o( C, ~$ O2 T5 \. f. ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 ~; Z, A7 k/ Y! ]6 P5 i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: N( X. `! T9 t8 G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" z( e7 u, B, h; k A8 @& P6 ~; ^
- ! j! j% L$ A9 g+ i
- dma_addr_t dmaphyssrc1 = 0;7 c/ A3 u+ o2 ~& b E q( D! o, H
- dma_addr_t dmaphyssrc2 = 0;4 g5 V1 n. [; X. _) m' \3 r
- dma_addr_t dmaphysdest1 = 0;
. U6 h2 H5 h; Z9 p8 S - dma_addr_t dmaphysdest2 = 0; [/ b2 C; f5 r- Q. q
- , i/ A! g. v/ a( T; H
- char *dmabufsrc1 = NULL;
2 m' U' h0 l. L0 P - char *dmabufsrc2 = NULL;+ L& w" a: b, g0 d
- char *dmabufdest1 = NULL;
, [' K" N9 M8 q `; h+ v - char *dmabufdest2 = NULL;; h1 _! j2 z# k' |, A' h. y$ F! k
- " C; X% \. O: l" ^* N% H; T/ p5 h
- static int acnt = 512;9 A. G3 `* \$ h$ O
- static int bcnt = 8;1 ~. Y/ T1 z0 R
- static int ccnt = 8;- W: ~. k: d$ G6 L1 X9 _+ \# n/ b
0 r+ ^4 z7 n3 Y- module_param(acnt, int, S_IRUGO);
: q/ Y! X( ^# n# N - module_param(bcnt, int, S_IRUGO);
7 s. X8 p s& P0 A, z - module_param(ccnt, int, S_IRUGO);
复制代码 ( T5 {, G7 f4 E3 C) |5 m# }
& g; p2 X' R& g9 J+ f' q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; |4 I3 G7 Y( D% A2 e& H+ a( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 R% n) D+ H7 X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 V6 m5 e9 S6 [: G/ B! P' Y) g0 B* Q9 F: ^0 _" r
7 z& C/ b: j$ u, D; a
|
|