|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , f/ K: ?, l' o; l3 g
- [code]EDMA sample test application
( d8 C; \% a) P% g7 N9 k# K7 T. Z - /*
$ @% A. G/ p) O1 N( p - * edma_test.c" W/ r0 f4 m$ q2 I/ ~/ x: y' k
- *
, K _- D% [1 x! V' u6 L - * brief EDMA3 Test Application
. h/ {9 }" a( |- ~1 }9 u - *8 O- y. o, i9 n: t/ q& S
- * This file contains EDMA3 Test code.
% s$ d" {, \3 G6 r9 a* J* y4 f% a - *
. |1 e( R B' E8 q* `- o( G8 ]- S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ l2 w' u' K" b; U3 ^- R# s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" C1 _, }& B& Q& B0 i8 t - * TO CHANGE.
) Y. I3 V) z1 P& x5 Y - *' H1 p6 p+ C! G$ M( ]7 y( b/ T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, O0 m, L0 t6 G6 Z, N# f( S- w
- *. O, _ `# B& v+ _& ?, j
- * This program is free software; you can redistribute it and/or
' L, j: |' y. r7 A* U8 q0 G - * modify it under the terms of the GNU General Public License as
/ G1 h# p. |+ y8 A, }! P - * published by the Free Software Foundation version 2.2 q) ^! s4 Q( h1 J
- *
! R2 |- R9 C) P: X5 |8 W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 M8 e: w; _7 b* M+ u0 j* } - * kind, whether express or implied; without even the implied warranty
! ?6 V* p% u$ T8 ~+ H& V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% B- p, _7 m- h9 T - * GNU General Public License for more details.* g! |6 V* E/ f2 u2 C& s$ s
- */
1 B! H4 Q* r0 m5 Q/ n {7 P - 8 T' S: E+ e ^
- #include <linux/module.h>$ K5 u |+ ^! |$ |0 B
- #include <linux/init.h>7 a! I9 U( s' d
- #include <linux/errno.h>* S1 a. D- T0 `" f( c5 U* U
- #include <linux/types.h>
. ]1 e9 k% P* {8 s" r2 n - #include <linux/interrupt.h>, _8 T# Q( n/ }) g* d k" O
- #include <asm/io.h>- x! m9 e8 T( C
- #include <linux/moduleparam.h>. [8 p" T7 x3 [ b! l4 X8 i
- #include <linux/sysctl.h>9 y& g. I7 E2 w% J! K
- #include <linux/mm.h>4 j! j0 L$ p" _- W; W( e: {' w
- #include <linux/dma-mapping.h>9 f/ ]/ Z, j. d* P
' D% W' t) Q0 E6 X8 ~- #include <mach/memory.h>
$ n+ E. V. ?6 w2 y4 K5 v - #include <mach/hardware.h>
. r" F2 T W2 V: z8 e - #include <mach/irqs.h>4 H* g' y$ v+ B) h, N% _
- #include <asm/hardware/edma.h>
3 t+ D4 g% ~$ V* s8 q. `, E - 1 @: V$ ]( U3 E9 s$ e% e! R& U
- #undef EDMA3_DEBUG
! f8 g% F( ^% ~! M - /*#define EDMA3_DEBUG*/% Q- K# h% h2 v
- + n8 t6 ]/ z+ I* D: W
- #ifdef EDMA3_DEBUG) O& z' Y, d, ?, W# J/ ^& v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). I {' u' W7 _6 o6 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) G, n; I; B. F4 A) t0 F. m( b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). e3 |0 j: h8 {
- #else
+ {5 e0 T" R/ h$ v+ z - #define DMA_PRINTK( x... )
' N( r$ `/ a8 v: y - #define DMA_FN_IN& B# W0 M0 f6 O3 M$ v
- #define DMA_FN_OUT
/ [% k. N6 s& V- [& \/ i - #endif4 ]+ i; Z5 Y' T1 D* h, z
- % }3 ]) I2 c: U. E1 b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), o5 `( a& _' m* a% ~
- #define STATIC_SHIFT 3+ F& i b C, j j# G+ m @9 Y' J) a
- #define TCINTEN_SHIFT 20
! X) |% X- q$ B - #define ITCINTEN_SHIFT 211 I, T/ _* W4 P2 {% s6 \, k7 i. h
- #define TCCHEN_SHIFT 22
9 e' _( V1 @$ u; S" N8 Y - #define ITCCHEN_SHIFT 238 m, u* u6 s9 N1 M# w! c% t8 S
- ( Z% f; _% [$ _3 M+ \7 Z# |$ T
- static volatile int irqraised1 = 0;: D& Y. U$ B7 G
- static volatile int irqraised2 = 0;, K) G, c5 @. l* L+ K
- + d. k" }, w! z' w' R/ u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 f G% ^1 p" ^. b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); [/ k4 Q1 y8 g$ u5 Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: d+ e4 m- S5 Q
+ E) `5 K5 e0 ^- dma_addr_t dmaphyssrc1 = 0;
7 K/ l- H; d, C0 C7 ^ - dma_addr_t dmaphyssrc2 = 0;% ]1 `; P* y5 t4 D4 |( v( Y, M
- dma_addr_t dmaphysdest1 = 0;3 S: w/ U3 Q$ X5 S
- dma_addr_t dmaphysdest2 = 0;1 `3 x- h; z h: ~
3 o4 [) x3 y. `" h: w$ k2 c- char *dmabufsrc1 = NULL;+ M& X- T3 N. c6 A
- char *dmabufsrc2 = NULL;
% K& x6 D% R3 c+ a5 s6 z - char *dmabufdest1 = NULL;
- \" l1 \( g* @7 `6 z. h& n1 _ - char *dmabufdest2 = NULL;" g- B$ D) j2 G. D& h3 c3 X
- 4 P5 o4 I0 c; U) b, o
- static int acnt = 512;
& j/ T! o( K6 z4 F2 j - static int bcnt = 8;
; u- _8 z3 E8 ~0 y( r - static int ccnt = 8;
4 [7 ]9 A5 f+ {, n8 v8 _- t: @
9 p8 p- i- A! z! }3 Z- module_param(acnt, int, S_IRUGO);- C+ c$ ^$ s0 `8 U5 w
- module_param(bcnt, int, S_IRUGO);) G) E9 o4 @& ~4 ~3 c2 i0 R
- module_param(ccnt, int, S_IRUGO);
复制代码
* D4 t* e8 c$ d' ^& R' j! h! Z4 r& `7 A3 |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, v9 L2 W) `' V. P- Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ R9 z' ^1 ~0 R( R. z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 v; X% j2 ~- S" _4 e8 g' i& s- Q* b; ^0 z- A$ s( w
* W+ ?1 ?5 N* x$ T7 T0 U* g+ K( E4 Y
|
|