|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; ?! K. z9 @5 R7 N- [code]EDMA sample test application# G. |7 U& } T8 h3 e5 @
- /*$ \) @5 K" |6 ?; l
- * edma_test.c' j; z" S* }/ ?
- *
, I" r% m8 P6 \5 @ - * brief EDMA3 Test Application3 l" D) K7 N; q% O- E! h0 g7 @
- *
8 j e* f/ w' m! ^ - * This file contains EDMA3 Test code.
: G! {, o8 H& L6 q - *
. b. S& S c9 m/ W' N" P2 N- K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* k% G' J' e/ M' q |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 m. K# k: O7 J* [' | - * TO CHANGE.8 i7 C" p* R6 n4 P, K7 c+ f
- *5 `( |$ {2 `; L2 M) {# X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 q. L6 s* a+ N" R/ G. i- K7 ]1 H - *
* t; M5 [5 p; a1 v9 k - * This program is free software; you can redistribute it and/or" p% s2 K- i, `3 ^
- * modify it under the terms of the GNU General Public License as5 p/ _: }7 \8 C j
- * published by the Free Software Foundation version 2.
6 q v9 C6 I4 Q8 ? - */ G) k3 M' L. w N$ r& H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ J( m, ? L7 d M# i P) R2 c
- * kind, whether express or implied; without even the implied warranty s E9 x0 \& L' U- M, ~* I: o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! Y' l8 y/ Z4 @ o
- * GNU General Public License for more details.
' m& m/ X" \- [+ q0 u - */
- {) \8 D: [- L' r0 w: U
( n9 |& w4 X+ [. J- #include <linux/module.h>
* S; Q" ?# B& E" {4 u2 l# U - #include <linux/init.h>
8 y {+ s5 K, P8 a, {- w - #include <linux/errno.h>. w& \ A/ A3 T. w4 i3 G" P
- #include <linux/types.h>9 {/ ~6 W# U: q j: D
- #include <linux/interrupt.h> E1 ?& p) \2 Y. C) [# b9 ^
- #include <asm/io.h>
5 @6 g* e- H5 ]/ z$ k8 @, } - #include <linux/moduleparam.h>
+ J! t# ]/ a0 o2 Y3 k7 o - #include <linux/sysctl.h>
& J+ E v' P0 n) Y% _ - #include <linux/mm.h>
4 q5 \9 @5 l, j& o6 P$ g2 h7 R - #include <linux/dma-mapping.h>* S' g3 l7 r; i; I2 L9 y' G
- + R, w6 @& D/ C1 M( K* j4 M
- #include <mach/memory.h>
1 X I( x% d3 N& V1 D4 D - #include <mach/hardware.h>, }- _6 D$ l- P3 b. Y
- #include <mach/irqs.h>, a$ a$ |, m/ R
- #include <asm/hardware/edma.h>5 q1 }+ J$ d1 i& _
- & ~3 e. o) B& ^* j
- #undef EDMA3_DEBUG! k, R1 u& h9 X+ U% y
- /*#define EDMA3_DEBUG*/0 {1 b8 ~9 V' I) m, [! l& W, x5 i$ G/ W) d
4 W/ U5 @2 f9 p$ N- r8 }2 r! a- #ifdef EDMA3_DEBUG V- S7 e& c9 Z+ {8 S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ y( _8 D7 R; e# V; q" p; L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 n! s/ y- T, Q: O$ j$ m' L6 w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 B% a% K% j2 d: l7 z - #else
9 l0 w# k+ e/ B1 X5 f% U6 Y - #define DMA_PRINTK( x... )
, T" j* J, Q* a! v" o" a - #define DMA_FN_IN7 Y3 l, T+ z$ R
- #define DMA_FN_OUT& q3 H" h) l, F
- #endif
4 N3 y' H' w6 ]" u
* S/ P4 Q6 p- Y: K; O" D& S% P, G8 G2 P8 O- #define MAX_DMA_TRANSFER_IN_BYTES (32768); w9 z, O1 D3 n) } Q
- #define STATIC_SHIFT 33 ?- |! I0 o- t( e, C+ t4 z
- #define TCINTEN_SHIFT 20( j* m* [! d1 o) S \2 z9 G8 r# v
- #define ITCINTEN_SHIFT 21/ O/ P( z* D" T; G1 |' c8 ~1 d- [, P! _
- #define TCCHEN_SHIFT 22
0 p: c! U0 p1 D' ] - #define ITCCHEN_SHIFT 23
8 q& e: x8 W% m+ k9 ^& C0 u
- n/ u) K# H- Z/ Z) B+ N- static volatile int irqraised1 = 0;
: m- D) H* p& ]6 c8 p - static volatile int irqraised2 = 0;; _1 F: N2 A$ e0 Q& ?0 ]( l1 P. a$ i
9 Z+ }' f9 }9 L' B0 \5 c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 M7 R+ u( i( a# p% G& M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 c. T3 |: b+ h0 a3 A5 ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 K( n" s: R9 B - / K- ]/ ]- _5 Q0 C
- dma_addr_t dmaphyssrc1 = 0;
~0 ?& {3 ?& y - dma_addr_t dmaphyssrc2 = 0;& n/ H* t+ T; y/ v. V) V
- dma_addr_t dmaphysdest1 = 0;
' G' w4 c: W) E - dma_addr_t dmaphysdest2 = 0;
. M5 N* D9 R, l* j p# j4 [1 ]& Y9 G
* d; {- r, ~' ~, p K+ A6 W4 O- char *dmabufsrc1 = NULL;5 a2 O G1 h# z/ H( N0 @ G
- char *dmabufsrc2 = NULL;2 J P( e# M) O7 @: T: f
- char *dmabufdest1 = NULL;. M. ~' A* f8 g; Z( X, p1 c
- char *dmabufdest2 = NULL;
2 m0 c! l" ?4 m6 C: B - 4 ~# A& S, K, r/ [2 [
- static int acnt = 512;4 |; b7 d! G: S! w3 m; V
- static int bcnt = 8;5 ~8 G; I+ z- s- f9 a
- static int ccnt = 8;6 z' C" ~# P0 l( }9 P
- 8 E6 J3 ^3 G- D9 \8 b1 J
- module_param(acnt, int, S_IRUGO);
; K- ~6 R0 b S, h! N, v - module_param(bcnt, int, S_IRUGO);* ^9 h: K1 o: z5 B
- module_param(ccnt, int, S_IRUGO);
复制代码 $ T$ M0 `3 ]( g% y; t
" N' z0 h8 p6 Q! p1 x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ R% R7 b4 i$ J1 ~2 J2 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" i' b' {0 ^( V* \* \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# w, K& v; l" E( h7 D- ~
4 O3 `) r% z% w9 B
6 X+ @) j* _9 n, Z# s |
|