|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - m9 V3 J% b. X
- [code]EDMA sample test application) e( {/ c" K0 S3 [$ s* @: w
- /*
; e4 m) f5 U' M - * edma_test.c9 ^3 s x- s j
- *% d2 u6 e5 n& Q3 M; Z5 G0 A: }
- * brief EDMA3 Test Application
8 V: k' k$ `$ k% Y7 E. c* T4 O - *4 O# R e( a$ P
- * This file contains EDMA3 Test code.
+ c5 B& C2 Y# s6 t' C; _ - *- ~9 \% E% R& k2 y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' U/ a. s5 \- K& S& ]7 z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 @% O2 n- s5 W+ Y- Y5 ^
- * TO CHANGE.' J' x* W, k; x1 J
- *
* Y6 [, W0 E, A% ~2 D& a4 n5 I% ` - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; p0 v3 A; T2 G - *1 H5 r/ q r8 {" X9 i9 l, k- K
- * This program is free software; you can redistribute it and/or
7 I7 g9 s' y* ~* p9 B+ |, ^+ Q* z - * modify it under the terms of the GNU General Public License as
# |1 l. x" O" ~- d7 z - * published by the Free Software Foundation version 2.
# N& Z9 h5 w, L" Z/ x8 J9 r4 C - ** i. U9 x9 F6 O; u9 V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 D# i& r* k& ^6 M5 K/ z1 }: K5 v
- * kind, whether express or implied; without even the implied warranty
) z) u, |: B$ n A1 v9 R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- e: I* ]& D1 a - * GNU General Public License for more details.
r' f+ d9 R- \ - */
5 A+ \1 Q, {, ]* i+ B% J
& z3 I' z* d' j, r/ }" r: U- #include <linux/module.h>7 v0 h9 [* Q+ s
- #include <linux/init.h>
3 i/ W7 G1 c+ k* o% H6 m - #include <linux/errno.h>0 d1 W# G0 R2 z; {) ^* J9 C
- #include <linux/types.h># ]! V6 R, s6 P/ Z2 h
- #include <linux/interrupt.h>
" N& e* U: B( y, ~( m$ _. { - #include <asm/io.h>
- d0 S3 ]& p l- B) x7 t - #include <linux/moduleparam.h>8 Z' y' n' g J9 D9 ?1 m. I
- #include <linux/sysctl.h>
( U- e( [* ?" } - #include <linux/mm.h>4 D9 ] H. ]2 H& Z: D" n
- #include <linux/dma-mapping.h>
' ^- C/ b# i/ V% k# Y
, a8 [3 n) E% p8 i# k/ W) O! E- #include <mach/memory.h>
( {. v ?" ?$ O3 F$ @ - #include <mach/hardware.h>
2 [3 k' X" Q6 C: [ - #include <mach/irqs.h>
0 Y4 x* C- r$ n$ P( G( ] - #include <asm/hardware/edma.h>/ C0 U x9 }- h1 G' c8 U# e7 _
- 4 ?! v" E! j: U5 B" D8 _7 N {8 L
- #undef EDMA3_DEBUG
' J) K7 v8 i0 `$ G, h& P - /*#define EDMA3_DEBUG*/1 K1 U5 O4 S7 d1 O$ U8 t
- 2 q# c; [1 W, @# P! Z5 x7 W
- #ifdef EDMA3_DEBUG# Z q; r1 h5 L* }% n: b' n6 |8 t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 e9 X) D2 a3 e* p, K4 Q" R" w% M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 z4 [$ |; F7 I; a/ q+ E* L Q, h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 G; B8 e+ u/ k. u* T6 L* N4 f
- #else
& _$ d/ k* n; w/ {0 v0 r - #define DMA_PRINTK( x... )
9 E- a5 K' ]+ ^% I( W: |, c - #define DMA_FN_IN# F. s* m% T( l9 q3 R
- #define DMA_FN_OUT, Q- X4 ]/ ^1 [: ]# ^% K" J. }
- #endif# P# [$ i |& Y. s2 n9 a
- + o$ b- M+ |# i$ u$ L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ c8 c5 ~% v: u
- #define STATIC_SHIFT 3
! @) ]4 w& S- r+ ~# M - #define TCINTEN_SHIFT 20
0 t! E) h( J' ?/ C* R7 O - #define ITCINTEN_SHIFT 21
& J* {* P3 h+ s% ~+ j! g - #define TCCHEN_SHIFT 22* G5 o m [6 e, F+ w
- #define ITCCHEN_SHIFT 23
$ E$ S: l& p1 c# q8 _2 z* J
8 m' ^5 P$ p1 Z# X- static volatile int irqraised1 = 0;$ K- d, o& A% w) |$ n" d
- static volatile int irqraised2 = 0;
- v: U( A h- H) C K% c( E8 u7 h& R
5 y+ C7 `( b2 @) @* @- V2 L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; s% i- q! O! p0 G: v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# x$ e/ p8 M# j! F! j& E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ~7 X1 n* R3 L6 u4 H9 l
& S: J/ \" y% c' K6 ~- b5 @2 H- dma_addr_t dmaphyssrc1 = 0;4 {- a) C5 B2 Z) z1 A& O$ l& e0 G- g
- dma_addr_t dmaphyssrc2 = 0;
m$ E0 S2 j, w1 y4 |. Z' I' w" L - dma_addr_t dmaphysdest1 = 0;( p) `+ M4 s s+ c1 {( A* S0 w x
- dma_addr_t dmaphysdest2 = 0;# N; \0 Z5 s u5 `% z& O/ T
- ' t5 j. K, |* [$ j2 k- h, L
- char *dmabufsrc1 = NULL;/ X+ \3 g: j5 B3 `+ [5 E4 H( I
- char *dmabufsrc2 = NULL;
5 q9 a6 }4 Y; d! m. Q" ^, d - char *dmabufdest1 = NULL;
* _3 e* c8 o6 [& x1 h - char *dmabufdest2 = NULL;
1 d: R+ {1 K9 q0 w: q C! r* I
" k; v% V; c6 j9 W. X- static int acnt = 512;. V0 H/ [6 o+ u Z" ?' I0 z3 X2 d
- static int bcnt = 8;
6 J% I3 V2 e( W' o; d - static int ccnt = 8;$ k1 G/ o" S, U' l
1 b, }2 _) `& e. P' \! G: B, p5 I7 z- module_param(acnt, int, S_IRUGO);% m/ |/ N! q7 o$ c( Z
- module_param(bcnt, int, S_IRUGO);, m4 i* R7 I H+ t
- module_param(ccnt, int, S_IRUGO);
复制代码 . H* I0 `9 h7 i/ P4 m) l1 f
+ R, g% s j7 Z( R9 E. j! f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& R$ ]9 `) S( }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 h- D. S% W6 m$ ]6 Y2 ~3 h# { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 ~9 C7 ]: d5 Y( @; s) X
" v$ Q4 V+ S6 O7 r2 Y- R
8 Q9 X8 x! c" l- `1 x# g |
|