|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 O; \- l. L1 m2 V5 e" I9 ?; n
- [code]EDMA sample test application A- ^1 n1 F$ n: U3 S
- /*$ j9 Y$ ~4 L- g# j W' \
- * edma_test.c
& {3 Z/ X( }8 O - *
G: C9 w3 e+ F. g+ b - * brief EDMA3 Test Application
- u: A$ K$ C+ q0 K - *% g& U {2 o4 G6 E# B) o$ b- N
- * This file contains EDMA3 Test code.
! {0 ]2 s D9 v# X - *9 n" I `8 \' |1 o* b* ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 n5 U, i7 ~8 \% L3 a4 } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 h. U1 D( s2 v7 U1 g7 P8 r
- * TO CHANGE.
# h0 ]2 a1 q( H. f' Q1 c- i+ b - *
6 O- N+ I& Z# w4 v; W3 X5 j2 B2 x* c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ? m5 S: r. l+ C0 f) m$ l
- *
5 c, H/ X# l. } - * This program is free software; you can redistribute it and/or* _) O |7 D q2 H! B; _
- * modify it under the terms of the GNU General Public License as
/ y3 N7 m7 \" ` - * published by the Free Software Foundation version 2.
: \" d9 ]) {2 Y5 O/ G - *, d6 j2 t6 _$ ?$ L. c7 F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ A9 ]3 f; q& m1 T' P$ E - * kind, whether express or implied; without even the implied warranty! h U! z0 S, j! S/ J- I8 F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ k. w$ z9 Y4 u; f. S7 j/ U0 d - * GNU General Public License for more details.
+ f$ L6 g! @: y* \2 J+ ?$ E6 n- Q* x - */
* l- g! `2 S8 z' X$ G! v- E4 g
/ B0 w: r. J8 {. d$ o$ o( a" ]- #include <linux/module.h>
( Z* I% ]- R: x! } - #include <linux/init.h>
6 k; n5 m2 r! n3 \8 ^8 w9 K - #include <linux/errno.h>
9 |" P# P' c0 @- r9 b - #include <linux/types.h>
# \9 c& |- T# I* y! s3 ~ - #include <linux/interrupt.h>
+ z4 U* n+ c' s: u - #include <asm/io.h>
/ c' k- G6 Q- ~; [ - #include <linux/moduleparam.h>( f" ] i. |& l2 `- Y
- #include <linux/sysctl.h> g& p6 B$ g: m$ F% J9 K
- #include <linux/mm.h>( \( B7 _. ?. U' T ]4 r0 ?
- #include <linux/dma-mapping.h>
& G2 M. d9 \( z2 Y! h# y# ~ - 5 b7 F8 s6 c: k0 s" c# ]
- #include <mach/memory.h>5 m: Y& v6 [8 e2 ?% k& ]
- #include <mach/hardware.h>
( a- u( X" ~6 D) Q b, M' H! I$ [- r - #include <mach/irqs.h>
, B/ l9 }" V' s) T, T) n - #include <asm/hardware/edma.h>: ]+ C) ]: h- o, D( W
, t, e; k9 }5 i: s: c5 A- #undef EDMA3_DEBUG
' i) W' M/ N# j/ \ - /*#define EDMA3_DEBUG*/
3 R7 [- a! y8 W" @3 O! s - 9 g7 `9 h- C: I( w
- #ifdef EDMA3_DEBUG+ F" U# N9 J$ ^4 z$ a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 g& R1 Q; I1 C5 ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" _, `& v$ X1 U' N! k8 ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" s0 K) @* ~2 R. ^9 Y$ ~ - #else
# O3 |% }2 i% D/ n* F - #define DMA_PRINTK( x... )$ x# k z9 H2 K9 Q% H5 p2 }# \6 x/ t# z
- #define DMA_FN_IN$ @) ^/ L& q% K* j4 O; f
- #define DMA_FN_OUT: W; F. u4 S( [, B+ v
- #endif
- v/ o( J" @4 P3 s
' A" m, y9 t; }7 E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( i' z, p. U# _- s Y M3 u - #define STATIC_SHIFT 3! x# Z. i3 m k, R
- #define TCINTEN_SHIFT 20
+ }- V6 s3 B k - #define ITCINTEN_SHIFT 21
( Y2 k) g# L! G5 J1 u- o3 i - #define TCCHEN_SHIFT 22
9 }2 P* ]7 h& I$ n9 ~( X; S4 u - #define ITCCHEN_SHIFT 23) \2 i- f4 G0 H
- . j; ^3 U- ]0 v" g! R" M, \, l& ~! P7 `
- static volatile int irqraised1 = 0;
: A. F1 n" N2 @; J - static volatile int irqraised2 = 0;
0 ~2 U# k7 F" W+ I) e# P. q7 [ - . ~+ v# B8 h* b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. z8 j! ^5 n$ z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ m8 i: q5 q6 @2 W8 h& S# T F5 M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 [; e0 B' M7 |4 b5 w* H
- 6 r) n( Z2 a. d6 O% L4 p( F
- dma_addr_t dmaphyssrc1 = 0;
) M2 N9 ~9 D4 f7 O( T - dma_addr_t dmaphyssrc2 = 0; A- h! l( q6 v8 l" w* a
- dma_addr_t dmaphysdest1 = 0;
' X$ }) z) l2 b5 }4 P3 E- k - dma_addr_t dmaphysdest2 = 0;
3 H' R) {. F4 L3 }! h. v! L
- v) `" q# }8 f% Y8 Y& o7 z& r- char *dmabufsrc1 = NULL;
* ?6 p; x, m5 K# J - char *dmabufsrc2 = NULL;9 i# J" l: k0 ?' M a
- char *dmabufdest1 = NULL;
, `6 s, t7 y' l/ O# q' L' ` - char *dmabufdest2 = NULL;( g# e/ U) Q0 Y `
, Z* M1 b9 K- c% a- static int acnt = 512;
' z6 x' ]' A- A5 m - static int bcnt = 8;" P8 ~3 w- K8 u7 D, s& H
- static int ccnt = 8;5 M5 [( C- [( P8 K9 u
9 B. Y* n3 n' }/ o. M) k- module_param(acnt, int, S_IRUGO);
$ |3 d9 B" f( s7 s1 L6 W - module_param(bcnt, int, S_IRUGO);4 r2 l% b( p1 r" J x. m- s$ i8 V: c5 ^
- module_param(ccnt, int, S_IRUGO);
复制代码
: y9 V' u( c# ?+ u8 S0 }: ?! z
& X3 q. y* D. v1 k: K- `( d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. D$ x* L, t0 q) M! k, Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 @& w. g5 p3 k# I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 F- X' S. B' f; L/ r' x
" Z1 k r8 E( l5 J) t) N$ e! w! X m' ]5 u5 V) q
|
|