|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( _8 R% l1 A$ Z3 B u- K
- [code]EDMA sample test application" { ^! l3 Z. n+ k0 x3 a! T3 y
- /*
; Z1 j6 Q3 G1 @* d7 H5 L& o+ s3 x - * edma_test.c
( t9 F0 e" d# e - *8 M E' n% `4 |) Y
- * brief EDMA3 Test Application; z2 K* K- H; r/ E) W5 ]
- *
" i/ L9 m' E+ {, A - * This file contains EDMA3 Test code.
4 @1 v' ~* G" O( ]6 a - *
6 y" C/ g% V6 e# s4 R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! b" B/ n1 N/ b$ o2 O2 d- n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* l- R* D+ G6 M( l3 k& J- P4 z, P
- * TO CHANGE., L" q6 Q6 G* U* x! p, O9 O
- *
1 [/ T5 y# e% k) F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 L1 i+ k F& D: t& r3 O - *. J% O1 |8 `) J* F, y: z% B
- * This program is free software; you can redistribute it and/or; k4 n9 w3 y6 k' a
- * modify it under the terms of the GNU General Public License as( a+ L% n2 G8 V& Q
- * published by the Free Software Foundation version 2." K9 I8 [; Y- ]: Y
- *
" v* k& b l! }5 s0 _8 ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 v# K5 U7 A U* {- C. V2 Q - * kind, whether express or implied; without even the implied warranty
7 ?( p( [5 ]- G/ m' l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" V) O. u! u3 }7 O k - * GNU General Public License for more details. l% x3 ~; Y( w( G3 W# B* b, a4 f
- */
5 B6 { `; j, ^; Y" z0 S0 L1 W
8 |6 `) K$ Z( Z0 O+ E" K2 R, W* H8 m- #include <linux/module.h>
) Z& {- i$ R9 x b' e) n - #include <linux/init.h>3 D7 M- _8 a1 j# v0 Y9 j
- #include <linux/errno.h>
" a+ y" D/ {. s0 @- |! m9 n - #include <linux/types.h>: O4 a4 k$ ?( L3 i ^
- #include <linux/interrupt.h>* k$ T( s: v z6 i* N
- #include <asm/io.h>" b. T' ^ e- F$ p
- #include <linux/moduleparam.h>) H8 q$ u2 P5 H$ [
- #include <linux/sysctl.h>
1 m0 }; m: j7 D) l6 v4 m - #include <linux/mm.h>
: s1 n6 z) Y* b6 @; w+ [+ l( L - #include <linux/dma-mapping.h>4 E3 V/ x, g0 T& O% i) w0 ]1 i3 i
- % I V! k: l1 j5 n3 V8 m
- #include <mach/memory.h>$ R A1 f) i* }& N+ ~: F- j# v) c
- #include <mach/hardware.h>
/ |8 J. `' Z. j4 S: N0 X' ] - #include <mach/irqs.h>" e6 [; F+ |8 d' u3 ]" i k1 q# ?
- #include <asm/hardware/edma.h>9 O$ r' d& f9 U# q
7 D4 f$ n* G- C- #undef EDMA3_DEBUG0 d1 L% H" ] O* w* w
- /*#define EDMA3_DEBUG*/; }* a3 G* o, z& O4 F
. i* P$ q! W6 b2 {- #ifdef EDMA3_DEBUG
/ i2 K0 r8 u7 R( f: A8 u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 ~; V6 s" ~4 H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 D% n$ P2 F' }4 I4 G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# z, f/ s8 R9 ], ]: e3 F8 J! Q - #else
6 \) ]2 C l2 m: \3 t( V - #define DMA_PRINTK( x... )
: k9 g4 m6 }$ l$ Q - #define DMA_FN_IN
$ Q, V/ H5 ^. U! Q B - #define DMA_FN_OUT" T Q. O9 q% r# r% y+ L
- #endif
b. I6 _' H, j i5 N( b7 a
1 F) F, v. o# l( h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 u& M" w4 c' y7 O5 m* H - #define STATIC_SHIFT 3. @/ y6 u: s+ j$ B
- #define TCINTEN_SHIFT 20
: U5 _1 J2 W2 I: q7 m1 [ - #define ITCINTEN_SHIFT 21
; F) b& O6 {1 u' F0 Y - #define TCCHEN_SHIFT 220 }: T* z; X& w! q# S
- #define ITCCHEN_SHIFT 23! \# A- T! O$ x& f
- & O5 f h. A* w7 g. c4 ?8 m; I
- static volatile int irqraised1 = 0;
4 s- {7 \$ t4 D, m5 y - static volatile int irqraised2 = 0;
# r5 f2 @0 \6 V8 P6 V
4 [. ` Z1 _* P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 D0 h+ L1 I$ U0 ^5 z' U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 s" \8 w/ {) K# U9 k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: r# O' F8 n$ n$ y9 Z" w9 n3 M( [3 G! d - % ?* |$ M R6 J$ d
- dma_addr_t dmaphyssrc1 = 0;+ c6 q7 [5 }" m. K+ R" _4 t
- dma_addr_t dmaphyssrc2 = 0;
7 b t7 K2 j! K; O/ v' k: `' A0 h - dma_addr_t dmaphysdest1 = 0;
. H1 |5 Q9 H$ g4 S6 U - dma_addr_t dmaphysdest2 = 0;
' d' x9 P) k; l5 B - $ n! N9 k# ^. r
- char *dmabufsrc1 = NULL;) A8 }# t9 B3 S9 }% V( Z
- char *dmabufsrc2 = NULL;9 A0 X4 i0 D J4 O
- char *dmabufdest1 = NULL;1 [! X. r/ A2 N
- char *dmabufdest2 = NULL;
% _1 l4 R, X2 {# i' D5 h
. r3 O6 x/ W3 M. x, k- static int acnt = 512;
! p4 L! t$ |& Q6 b) q - static int bcnt = 8;
9 c4 h: y' J8 {5 P0 A* ^( Z: S - static int ccnt = 8;" t3 i: R3 f4 }. o: V! u
- 7 ]- [ Z* A. R( [! z( y0 R u
- module_param(acnt, int, S_IRUGO);9 Z, T' z- a2 v# \* s) T" v
- module_param(bcnt, int, S_IRUGO);3 m3 s2 [$ [% S6 L, H
- module_param(ccnt, int, S_IRUGO);
复制代码 . [ e+ R5 |1 B. f
Z( n) K9 M7 r/ u# _6 {) X& b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' b" t% ~- v! B! varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; m$ \& g" c1 u& k) ~' Z- D+ |) c- i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- X" N" O& V& d
& K& l C& i0 q. Z, Z
2 l& R# Y1 @! Y- w8 L9 ]. J* K |
|