|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # R' R- w9 L' f( ^8 R5 }" \
- [code]EDMA sample test application
: b5 {1 b- H1 {6 q - /*4 f2 }9 W% F5 c& h& q; z
- * edma_test.c% s: K$ F6 [+ M7 k( s/ m
- *- O2 d' L. W x- ?
- * brief EDMA3 Test Application
6 ]! p% j0 k9 u- E1 K7 y" n - *# x; d F3 A. l5 ]) e
- * This file contains EDMA3 Test code.
1 ^7 N, i/ }9 _1 k% q& y' t - *2 v# b6 }3 R& w7 o# ]; P0 Z' [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 h2 z( G' H+ [3 X; I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 E. Q% P- T _6 B! R* g: [5 \# h7 B1 `
- * TO CHANGE.9 F2 `2 n# Y7 H/ D% y
- *3 g: H5 S* f1 k7 s# K! w- q) X" }. o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 h, l$ R8 [; T; T6 P+ ^
- *6 J) T; t2 J- g6 K; p
- * This program is free software; you can redistribute it and/or: C+ g7 J9 {: A, ]2 \# k7 P
- * modify it under the terms of the GNU General Public License as4 f3 e) U2 @( V L7 N
- * published by the Free Software Foundation version 2.
$ k% d2 ^1 {, t+ v& f - *% X% @0 ]) |5 a5 }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 K% ^; ~& i, J" x
- * kind, whether express or implied; without even the implied warranty/ u4 X7 y/ K3 e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 r6 d' O z7 [2 R
- * GNU General Public License for more details. o; j: { ^( @- X7 s" E
- */
1 m' l" f/ R! z/ s
) | N7 q" e6 @! m+ ?5 d- #include <linux/module.h># R) G7 W) t' k
- #include <linux/init.h>3 U) E! ~ _' R' b6 D% D8 r
- #include <linux/errno.h>
. H6 H9 ]2 G+ m4 P4 q - #include <linux/types.h>7 x; i S2 z ~* t
- #include <linux/interrupt.h>
3 s8 D* I2 A2 K - #include <asm/io.h>
1 e0 N; ~# K3 ^# M# n8 R' a) A" j - #include <linux/moduleparam.h>4 S0 e% E1 W* D# x1 e. D) S7 {) T
- #include <linux/sysctl.h>
! G1 Q; {) {: b8 B! {! i- f/ T1 ~ - #include <linux/mm.h>' P( D7 @9 w" @2 }* s- a! i
- #include <linux/dma-mapping.h>1 ^8 }8 o, m4 Z7 ` B
; Q2 p8 C8 M4 J. a* M: X- #include <mach/memory.h>
! h' K. u! ~6 t, I# Q - #include <mach/hardware.h>
% }7 E: Q" v2 P0 N% M9 a - #include <mach/irqs.h>. i; x' M9 L1 L
- #include <asm/hardware/edma.h>
! d: A- H0 o5 G" |0 w6 `
9 I" x$ o6 S2 c3 u( R- #undef EDMA3_DEBUG
2 y8 C2 J2 b! v* R1 g - /*#define EDMA3_DEBUG*/2 g- _. C& _, i5 e3 L
" O. `' f/ a% V3 Y6 x: P- #ifdef EDMA3_DEBUG, ?$ J2 ?+ y. K. Q6 b* ]# L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 g, v5 p& Y( U+ b$ j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" Q- [. ?: y. p; u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 l9 ]) N- p6 b& g |5 n
- #else9 k( U; O7 ~( d7 v& Z0 `/ B4 t: N
- #define DMA_PRINTK( x... ). `% P+ M. C' i$ c/ v$ Q
- #define DMA_FN_IN& B! _* [; z! v8 O0 S$ F
- #define DMA_FN_OUT {1 H3 k1 H; @3 r
- #endif$ c( J q. O6 P
- ( T+ j" G2 q4 K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 G$ d. L1 V/ C7 n Y
- #define STATIC_SHIFT 31 ~' k0 @) v E8 h- D+ i
- #define TCINTEN_SHIFT 20
; c, A3 r( ~ d) [* d) | - #define ITCINTEN_SHIFT 21
' v/ y6 J! X# b$ F+ j8 A1 b5 ]1 o - #define TCCHEN_SHIFT 22" ]% F/ Y: v" o! E8 u/ m
- #define ITCCHEN_SHIFT 23$ e6 b1 I9 k( h2 m: v5 L, C
/ z' ^; k" t, T3 x7 B- static volatile int irqraised1 = 0;
- y# S- `( E/ j$ g; o - static volatile int irqraised2 = 0;
8 D" p& r! f/ | - 4 g2 O( h6 ` X0 E6 w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% x, {2 _) c: E" g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
l! x/ c v: }+ L, P3 I& x( r" E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 v! y- z5 }3 m8 ]& w - 0 H5 l; u7 v7 R: z3 A8 Z1 z; E
- dma_addr_t dmaphyssrc1 = 0;
& F* I% l6 s4 v - dma_addr_t dmaphyssrc2 = 0;3 U6 `! L8 X8 C7 }
- dma_addr_t dmaphysdest1 = 0;
; v0 H/ i1 [) f - dma_addr_t dmaphysdest2 = 0;
3 a8 E/ f6 j! ^ - V( R5 N6 ~, ~' S$ ~. s
- char *dmabufsrc1 = NULL;5 p" C& Q. K; B7 n) h
- char *dmabufsrc2 = NULL;
# R% i v; j6 O* A: Z - char *dmabufdest1 = NULL;) g2 q# [4 e9 j6 s
- char *dmabufdest2 = NULL;
% z j. A: S/ J9 r4 G
. ?3 D! ]2 Z) _' ~+ a5 [# \6 x- static int acnt = 512;
: {/ t9 `# g ^+ a1 a3 F - static int bcnt = 8;
- A( x0 W( g3 n, R - static int ccnt = 8;/ A( O4 k) m4 n( r6 K2 ?
- 9 C4 x' Y8 y/ E
- module_param(acnt, int, S_IRUGO);6 }" b- @+ v5 \' T4 J
- module_param(bcnt, int, S_IRUGO);
% |! j: E+ w7 `3 h; o' p0 R# Y - module_param(ccnt, int, S_IRUGO);
复制代码
1 M9 q. v$ p7 A) m; P1 X9 x% y* a4 F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" d' f. b4 |3 q6 r: ~' x+ B
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, u& @9 S0 B H \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 o/ F. R F2 \8 d- D! x2 E
; \7 @2 U4 M6 T& L
8 w( k4 V. Z( x |
|