|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. i- v5 G/ W: X/ j1 L% L* @- [code]EDMA sample test application) I9 o/ J3 _2 B
- /*
3 ]) e4 \* t* F) X: B4 d - * edma_test.c
% g2 q9 S! z2 a - *
) z+ U7 D+ w; l - * brief EDMA3 Test Application
* f: f0 b/ P7 E - *
2 V# Y0 e$ q2 l" | - * This file contains EDMA3 Test code.8 T& o; M$ V. x3 Q, k. }
- *8 e* T- j/ Q4 t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. d7 c$ F. B6 s; k$ v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. }' Q0 h. S, c
- * TO CHANGE.
- _! U! V4 G/ A- z3 {+ B% q6 N - *
: [1 o. c$ o* P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) z* U; T* X# w7 {2 O% i
- *9 G& o$ U/ W' x! A
- * This program is free software; you can redistribute it and/or: t* z: ]0 A0 S4 R7 v( Z% M. T
- * modify it under the terms of the GNU General Public License as9 _% L; q$ i0 |6 t$ u
- * published by the Free Software Foundation version 2.) Q% e# b. f `3 R
- *! d+ U1 e$ P7 ~4 L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: { h. v$ r" z1 e* F) {
- * kind, whether express or implied; without even the implied warranty
w% r7 ` u& ^, V& s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, a& _, P; c; Y+ i
- * GNU General Public License for more details.$ O% [8 V: v2 \% i* n i/ n1 Z; N( k- L
- */
9 G: l' \& Z3 ?. F; Q; @- a# p3 h% x: ^
$ l! B7 v9 B# V1 s: |5 n" m- #include <linux/module.h>
, w2 A- C2 c/ I - #include <linux/init.h>" q+ x4 O; I+ U
- #include <linux/errno.h>
3 q7 Z* g0 E5 ~. N+ r! h - #include <linux/types.h>: s0 R/ l% E) a0 `, r
- #include <linux/interrupt.h>/ d$ G2 S$ ^0 n: Y: G
- #include <asm/io.h>$ L, Y! [1 H/ u& Q6 l
- #include <linux/moduleparam.h>/ W) h1 h3 c5 D; P2 O- `; r
- #include <linux/sysctl.h># e! ^7 |: D$ _, m2 J
- #include <linux/mm.h>
+ |/ t; N! o1 R* ~1 U/ W - #include <linux/dma-mapping.h>
1 C# A3 c/ P0 _) q/ {% `
4 u) ` |* l( g2 b! M& n- #include <mach/memory.h>
; Q7 X" ?, m r# L1 Q - #include <mach/hardware.h>$ u- {6 g8 P# I1 Q& n) n# W
- #include <mach/irqs.h>$ b' N% \' f4 ^! a( m
- #include <asm/hardware/edma.h>
7 x* `6 I8 B0 ~/ @$ S0 B2 @& b5 Q- w: f% A
+ [ y4 E8 D! B4 {# i& ^- U- #undef EDMA3_DEBUG
, ? T- S9 [& X5 B, |0 t, x - /*#define EDMA3_DEBUG*/
6 t# x/ f! i* }/ {8 s% a* A
) U q: e# g v7 l- #ifdef EDMA3_DEBUG! C7 E- X3 H% ]" _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' v8 O0 u+ s0 J4 S5 i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), q1 S# i4 ^; E8 q3 N9 {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 W) g6 b7 `' \$ S
- #else* I6 c h# f% i* V, u9 R" u
- #define DMA_PRINTK( x... )2 ~- S+ Y' ^5 o! a3 j; s9 p, [% y b
- #define DMA_FN_IN
* p0 ]# t; @& Y/ x$ D6 u3 `7 V8 c; N - #define DMA_FN_OUT H% Q. z" F/ [6 @( m
- #endif2 }) q% g0 A0 f2 t6 F' N* c7 e
- ; n3 Z5 E' n# B1 F3 `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ n/ L: N6 O2 S9 i6 W: d
- #define STATIC_SHIFT 3. I; q3 n; L$ V6 {5 i: R- F
- #define TCINTEN_SHIFT 20 s' G Q4 u# n- i5 E: Y, b* U
- #define ITCINTEN_SHIFT 21
( [. r" m. [1 }4 D v - #define TCCHEN_SHIFT 22* |9 X1 u8 W4 v* A6 p3 Z
- #define ITCCHEN_SHIFT 23. E* I) \! y" c* E
) @8 ?9 Q; I( O# x0 y- static volatile int irqraised1 = 0;
+ [- i! G9 r2 |4 ?6 \ - static volatile int irqraised2 = 0;* ?! V0 G# H6 ]: N! I
- ) y. P4 W7 b" N4 g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- v+ e* x0 d6 u( ~# ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) P Q8 N: s |: z4 D! l7 h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 L% w. U, m/ x/ a5 v
- 5 a' V: r+ L: w3 Y
- dma_addr_t dmaphyssrc1 = 0;! v3 Z- H( z' C( `5 f
- dma_addr_t dmaphyssrc2 = 0;; C8 x ]3 b9 l1 G% L5 x% ?
- dma_addr_t dmaphysdest1 = 0;
X) H# h0 V9 L9 _ - dma_addr_t dmaphysdest2 = 0;
/ @$ t- w0 p# ?% N0 ^3 B U4 ^3 ~/ g4 ] - : M* W2 w5 B8 u# P& M$ K
- char *dmabufsrc1 = NULL;
# J: |, D4 d* G+ [ - char *dmabufsrc2 = NULL;; `( F! F- y0 z# f
- char *dmabufdest1 = NULL;
$ c I4 I8 ]. A4 \% I - char *dmabufdest2 = NULL;
) g9 s) P2 l2 L$ J% r% j0 g. { - 1 o1 `# S" h4 x1 J, {
- static int acnt = 512;( H. M/ V/ L0 M) ]. _1 z
- static int bcnt = 8;& O; H0 A: Q4 h3 H8 X3 R2 C+ A0 J
- static int ccnt = 8;
7 K, L) Y( [6 Z; L0 g' N5 ]3 U/ I - P* a t) E% t/ n, K1 q
- module_param(acnt, int, S_IRUGO);
* d. _7 J8 s% B$ |4 c - module_param(bcnt, int, S_IRUGO);. Z1 }/ D+ L- q
- module_param(ccnt, int, S_IRUGO);
复制代码
3 O$ K# E% X( t0 q, t% s. l$ u2 }$ k/ P) M; M' G+ Z* ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 N8 A. ], b$ J# P; \7 sarm-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 R; p% |6 m1 h/ a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 ^5 r/ Z) Y; h. O
5 D% G' d" l$ g- f( P, s i
' k {" C2 I3 N; D6 d: p+ V- d. ?
|
|