|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! z! ?( ?/ Z( m! |7 E3 X
- [code]EDMA sample test application
3 e2 _% i. n D5 m6 r' V$ ] - /*) x$ H8 ?' ]) Q6 e& O' h
- * edma_test.c
+ |' l" j* G5 W0 w) y0 X! J; N - *- T8 `; _" e/ w0 @
- * brief EDMA3 Test Application
# ^, L" W: X0 a! e8 O0 u1 V- }% v - *
1 o- g+ Q6 X4 {7 q5 x9 U0 F6 K+ r - * This file contains EDMA3 Test code.4 d) ~# p/ U) T( F
- */ E1 ^; Z" C1 ~% @7 H- {
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' ]5 h3 t" B" s2 { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( u$ M( x+ h2 k - * TO CHANGE.
6 e$ m/ h# l0 b7 [ m; C5 N5 s - *
! X7 u8 b E# H9 D8 Q! R( z3 R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 c9 O( G, T# s - *
6 r: i( ?. A) i- ^! X' {1 K/ ? - * This program is free software; you can redistribute it and/or# b* U) Y$ ~; ?9 ^: V
- * modify it under the terms of the GNU General Public License as
a0 h# g8 |5 Z7 a% y8 t - * published by the Free Software Foundation version 2.( j& [, t& t) B+ [1 S
- *& R- y' M; m3 @9 `$ o7 o" \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# S( ~* s8 s5 a% q& V& \* v$ d( }
- * kind, whether express or implied; without even the implied warranty
) R. F- l8 B& L3 j. Y/ m4 b! u8 F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* }# d0 ]" ~$ R2 L0 i4 ~
- * GNU General Public License for more details.
( p, U+ x$ K7 _( C7 m4 u- e$ h - */
5 v; ^& Z" [' E1 ^
" r( Z9 ^5 }% L8 G/ M- #include <linux/module.h>
( t+ k2 y$ T& M, g0 c6 E; | - #include <linux/init.h>& U1 p+ \6 W" n+ S
- #include <linux/errno.h>6 q- Z" ^* F8 J. R. [8 h0 o
- #include <linux/types.h>! V6 ]2 t: p4 S0 q
- #include <linux/interrupt.h>4 @+ @, r) |7 [
- #include <asm/io.h>4 ]6 t0 N& B$ g( a' @" C
- #include <linux/moduleparam.h>
z1 B; N, K4 k/ c - #include <linux/sysctl.h>
1 P$ Z6 w* x! u. k- l2 G/ _& z - #include <linux/mm.h>
: y2 E5 P1 y t$ a6 }/ ]7 z: c - #include <linux/dma-mapping.h>% _$ F3 d7 e4 z
- . v% ]- B7 ^3 j; J+ \* F5 _
- #include <mach/memory.h>* @) _6 s/ h5 V, |5 }4 o
- #include <mach/hardware.h>% ^5 m' Z$ x3 F7 n4 ]8 u; y+ B5 A
- #include <mach/irqs.h>
9 p0 C% n' U% Z! H T+ Z - #include <asm/hardware/edma.h>
; s, ?: s# s' j9 J* V* H. b - ; ?; S. E- b& i/ k3 _% [
- #undef EDMA3_DEBUG
) v9 L. m$ q" G# J1 E - /*#define EDMA3_DEBUG*/) }+ O2 V+ }+ `/ u5 q
/ U0 C& S0 d% u% b" R- #ifdef EDMA3_DEBUG7 n" D+ l' l' q% f7 c8 d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! S: |" ]/ c5 b& V3 D7 S4 r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" R8 {1 y1 u+ Q* r' F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: O* U) }0 [. v# x4 O - #else' m: k: Z) R+ [+ P' |5 R
- #define DMA_PRINTK( x... )
8 h; a: A- t/ v. ^$ ^# g; h - #define DMA_FN_IN9 ^! M2 M$ _- a5 j' Q" d' \3 e7 t
- #define DMA_FN_OUT
3 T8 e5 h4 g( U) i; Z% G - #endif
" B G' k/ |- j5 G0 v7 }
0 J2 P/ }" R4 V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) ?9 z$ U& m9 k# b0 f2 U" K - #define STATIC_SHIFT 3
' [/ H3 H$ Z3 ^& E% N$ u - #define TCINTEN_SHIFT 20
9 i+ h8 h( j6 V - #define ITCINTEN_SHIFT 21/ t- y; @7 _; i/ ~
- #define TCCHEN_SHIFT 22; q" A2 l$ a& [! h' i
- #define ITCCHEN_SHIFT 23
/ Y* C ]. s" I( O1 z
+ e- P* L% ~) e- static volatile int irqraised1 = 0;
& C3 D0 i# l* G& D% r - static volatile int irqraised2 = 0;
& U, O3 t% d6 ~( J
4 o2 {* h" X6 Y# ?/ `5 B# U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' ^3 d8 r- j1 F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 s/ O8 U! q; U' z2 R3 L$ X) f; e7 V- X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) @" Z7 W6 b# Y5 ~2 s
: g( i, t4 `- ~& b; {! {# y" P* s1 p- dma_addr_t dmaphyssrc1 = 0;2 h5 S2 r$ V- X% M7 l- L
- dma_addr_t dmaphyssrc2 = 0;& U- f0 ^: `% X) O2 p. N: y |; I
- dma_addr_t dmaphysdest1 = 0;( N' E+ H$ }" j
- dma_addr_t dmaphysdest2 = 0;0 ^7 R& e8 c- h5 e6 L
- + _ X- P) J. w6 ?% E
- char *dmabufsrc1 = NULL;
Q+ E, l' W, F2 j6 ? - char *dmabufsrc2 = NULL;
: K" g8 }! r6 K: T - char *dmabufdest1 = NULL;
, v. w7 ]" W5 ^8 l; | - char *dmabufdest2 = NULL;9 G! C8 f6 }( A( @9 _6 x l
- 9 @ ?" R- c# M) w- ]/ u) F
- static int acnt = 512;
7 [+ i' x% l. i8 x+ u. } - static int bcnt = 8;
3 C& @+ h0 l4 Y& F) c9 a, q - static int ccnt = 8;
* U: B" M- L. g; J! `4 F
& d6 z9 n. C, B$ U3 B' r- module_param(acnt, int, S_IRUGO);6 F/ [' `6 y- d1 u% h1 v5 S; k! n
- module_param(bcnt, int, S_IRUGO);
" {5 I6 k/ q- @8 V; I9 n* R - module_param(ccnt, int, S_IRUGO);
复制代码
# f5 a+ `: J* [1 A( V! q4 h$ _* ~/ ?4 e/ o! e: r1 K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' z- Y( h" S' Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 R( v" N$ x }5 @. O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 g. j) V0 z9 ^$ }5 z3 J5 A8 |0 `$ y. K/ Z! b( g5 R! a U
8 j+ [% R7 e% j$ t* d0 @
|
|