|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* E; R! J3 k7 \3 m0 K# X9 C- [code]EDMA sample test application" n. V8 ]$ o5 k# p8 O& m3 k
- /*& {, l4 A2 G/ J0 M F( Q+ d2 o
- * edma_test.c
" k+ `& L: V$ E0 p" ?# ~ - *
) s; k7 z6 p% m - * brief EDMA3 Test Application
- v h3 Z# u3 r+ F) _; ~8 k - *
8 f6 @# m$ @, V/ j+ I - * This file contains EDMA3 Test code.7 ]; [; P4 K0 G' w( \" u1 I& b3 w4 R9 o
- *
6 g# ~* l; T4 e, n, D# o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% C. z3 ?9 \% V/ h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 N/ j) v" R7 I& u3 ^
- * TO CHANGE.9 f& D# t @' v3 J; Q/ L! V8 R/ e: ~
- *
7 g p }+ V; V2 k0 L% r" u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ C& W5 V- ~! ^ - *' p8 \$ L2 A1 k
- * This program is free software; you can redistribute it and/or, U* h i, K1 ~+ _4 ~. I# Y6 |! y
- * modify it under the terms of the GNU General Public License as1 ^' H" A( ~2 R5 H/ W
- * published by the Free Software Foundation version 2.' J* t e1 j0 I: d- g) @
- *4 \/ f% C3 d% o' c, `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 {/ n1 \8 @5 ]9 p% s5 E - * kind, whether express or implied; without even the implied warranty8 g2 |9 s) [) B6 t1 ]- K4 w+ [2 _7 E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# c0 q- b5 H. `9 i - * GNU General Public License for more details.
/ u! ?; d- }8 f8 M" j/ [ - */
4 M/ n% T1 x* {/ H; |$ R T! G - : o u- k9 @0 F, [8 C( c7 L# k
- #include <linux/module.h>
3 r. Z2 h' S( M7 J+ ?! Q, D - #include <linux/init.h>
( v0 }: r! F+ n) b, n - #include <linux/errno.h>/ W: u4 k/ c1 O8 ^ f Y. o
- #include <linux/types.h> @) ^% e! p; s* a+ B0 Y3 A% q8 b
- #include <linux/interrupt.h>
/ w6 B$ N% B; i. L - #include <asm/io.h>2 K1 d8 |3 Z7 U! y* ^
- #include <linux/moduleparam.h>
/ R" U+ d! _6 ] - #include <linux/sysctl.h>5 \8 c2 x3 N- w: u" }
- #include <linux/mm.h>
; l: I1 K8 Y7 v3 w1 V" S0 ~' ` - #include <linux/dma-mapping.h>
7 U0 C1 c/ c& a
8 {: g3 F+ y# G4 p2 S7 }- #include <mach/memory.h>
, N' ^; a; U6 |+ p7 ? - #include <mach/hardware.h>
% l- F) m% t \' ?) O7 }% H2 A - #include <mach/irqs.h>8 q8 [5 U+ _" i- b5 A, X
- #include <asm/hardware/edma.h>6 t9 ~! W1 h) I7 N: K
2 p ?, q5 B& u0 T7 T+ W% n( @* Q- #undef EDMA3_DEBUG; j6 Z/ z D3 ]3 g$ Y' p
- /*#define EDMA3_DEBUG*/
0 ~1 U- x `2 B1 K2 q - + R! e$ ?( M' t7 l" j
- #ifdef EDMA3_DEBUG
2 B: a) A) k5 F" U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). v& I8 ?& _; Y8 d" i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. P/ \' H# O. M4 r" H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ ~/ T: N* e. m1 ]; \ - #else
: j+ @3 h! a" F! `7 c& H - #define DMA_PRINTK( x... ): v8 i ^0 I' s" @; X: I$ C( d) Q8 R
- #define DMA_FN_IN
8 w3 s9 `- |1 m' Z - #define DMA_FN_OUT$ o4 ~6 T! b7 C- ?1 {0 \, h& T
- #endif: y* p i3 ]4 t; ]2 c, `3 w4 o
- V3 z1 s9 P! h0 b4 ~* h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 s& a. \: N6 w0 P g
- #define STATIC_SHIFT 3
- O% u3 G5 R2 U& q - #define TCINTEN_SHIFT 20
7 h) h8 P. ?6 ?0 J - #define ITCINTEN_SHIFT 214 W7 D# \6 L9 k1 b S
- #define TCCHEN_SHIFT 22
) k! F/ R8 f- }- U7 R7 T - #define ITCCHEN_SHIFT 23: e: n& d9 J* h/ f
4 a- z$ r% C2 O8 {, R- static volatile int irqraised1 = 0;
* {# p4 h' I! d - static volatile int irqraised2 = 0;
% g" Y. E0 q# v) B
# o# R1 G% {: `3 k/ A, P* c. M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' d0 B& @6 M! P; J" y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); s$ p3 q/ M( Y0 {+ k! O x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 r& h) V% Z t9 D$ r) x - 2 a- _% W; G& B" y B6 K/ W7 R) b+ _$ p
- dma_addr_t dmaphyssrc1 = 0;
1 x* k' c* v! c+ _3 g - dma_addr_t dmaphyssrc2 = 0;
9 e! K7 [0 I7 x3 Z; j$ P - dma_addr_t dmaphysdest1 = 0;
! P6 u" i1 P; w& ]9 j( e: | - dma_addr_t dmaphysdest2 = 0;; l2 ^( [' }, h, n
9 |8 Z& K! ] Y t3 T# y- char *dmabufsrc1 = NULL;
4 }$ G0 } _5 H: o* a7 ^9 E - char *dmabufsrc2 = NULL;
3 ~" d- ~ T" e- `5 n% t$ C - char *dmabufdest1 = NULL;
/ C- V' U6 r9 y- Z6 K - char *dmabufdest2 = NULL;5 I7 V6 a1 {" ?4 ]' y
8 U- c& s4 U2 z) a7 q5 f* k/ C1 \, j- static int acnt = 512;7 W1 o \/ n8 l: H4 s1 [
- static int bcnt = 8;
4 m# m/ c) x, L6 `, A - static int ccnt = 8;
: E3 J/ x" L" I; e+ D9 b - ) X7 y' g* ~7 [, P
- module_param(acnt, int, S_IRUGO);
; `* S7 D7 F* | - module_param(bcnt, int, S_IRUGO);& v' d7 D/ o0 i X
- module_param(ccnt, int, S_IRUGO);
复制代码
?& a7 q A5 b3 z5 L6 v, N. t) {
* y6 p. n6 R' U9 Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 h# l" Y Q- H- A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 W6 Y" X3 y3 d7 @/ N) t, Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, z: v/ N ~4 d' J
: A1 [! s: f5 }4 ^: U" g: Z: W3 `! e
|
|