|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" h5 g+ w8 W) G' H1 J' V5 ^% u- [code]EDMA sample test application. \. x5 k0 W4 q4 t5 U8 i$ |, h/ |, f
- /*) Q$ `! @# D, Z U2 m. O
- * edma_test.c
5 H! Z$ J; }. u2 x - *8 Y- O$ P: h6 w9 ^
- * brief EDMA3 Test Application
* _+ f( N* Y+ D; c6 K - *
4 ~4 p6 |" v) i; a A - * This file contains EDMA3 Test code.1 ~* B& j1 |0 X) Z7 `9 V
- *: @, l$ x/ n3 p; {! f3 V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE O: ~+ N, e$ t8 F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: S. m% L( f' L, `) Q# ] - * TO CHANGE.3 g6 x" `7 t* r+ m
- *. r! v, m, o( H, L. d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 F) C$ U: A0 y
- *. k/ x+ g( S3 n- m
- * This program is free software; you can redistribute it and/or
4 _) _0 a7 E( D$ {/ \ - * modify it under the terms of the GNU General Public License as% R; s3 f2 D7 v7 e
- * published by the Free Software Foundation version 2.
5 y% D$ a8 o$ ~! k* t - *
& p F8 K$ L! z1 i6 Y! u) Z4 \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. P, `( k6 c0 i2 V& P9 |9 k0 I' ~! H: g
- * kind, whether express or implied; without even the implied warranty+ }/ k7 G0 w/ Q0 d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! C! c( V( r9 a4 L$ d6 `) {' Y; s
- * GNU General Public License for more details.- f+ K6 H8 U+ r; O3 Y* d
- */. w5 G, H0 Z. m9 G! c, k+ G
- # Y8 ?5 ]0 ^+ N8 b1 p0 c9 M6 J
- #include <linux/module.h>4 Z) Y$ E" a3 L9 I* P
- #include <linux/init.h>! E7 m% u. d7 X4 M
- #include <linux/errno.h>1 U1 Q) u, s- a
- #include <linux/types.h>, t; r# G/ d" b3 T) K' M& [0 t/ k
- #include <linux/interrupt.h>
6 r( a0 s! @8 N9 y8 D0 O - #include <asm/io.h>; o7 m* e( ]& t) C+ @$ }
- #include <linux/moduleparam.h>! z& H( I: [. N6 n* y
- #include <linux/sysctl.h>
& {$ R) w- B% U8 J/ F6 q - #include <linux/mm.h>- w- ~/ Z* j: h
- #include <linux/dma-mapping.h>
) }4 j( G2 V4 M3 E. e - * z8 [* L7 D" j, @# a/ p0 n0 \
- #include <mach/memory.h>
$ t8 F" _( i# {* d. ^% g4 c3 k - #include <mach/hardware.h>
) J& R$ k7 i+ a# N- I* a, r - #include <mach/irqs.h>3 s! E; F; u) V
- #include <asm/hardware/edma.h>
& X% ]' C1 Z# ~! \2 A8 h - 3 P2 N; [/ `6 ?/ h. F- k
- #undef EDMA3_DEBUG5 T$ p4 v. q- V8 P
- /*#define EDMA3_DEBUG*/: H+ D T0 b3 @- U( o
% G. m9 b; \, h7 E {- #ifdef EDMA3_DEBUG
; p4 p n' z* C6 c$ v; K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' `9 z9 ^5 T0 b% y" X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 X3 f3 x; ^4 k$ F: Z( w& {! l1 R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 B! v2 y& I% d5 Y
- #else
4 R# a2 F( Y" S8 c, @9 w0 d - #define DMA_PRINTK( x... )
3 h& \; _1 ? C2 f6 q! ]$ a - #define DMA_FN_IN
* e0 H3 `- Y# M3 W$ n - #define DMA_FN_OUT4 ~8 t8 U. n/ `$ O
- #endif
$ i2 ^# U, |- R0 `$ t
! U* t( n8 j1 s2 d/ R: g( S, q ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768), s' l g% u. v
- #define STATIC_SHIFT 3- n0 n2 ^9 \# I
- #define TCINTEN_SHIFT 20
0 C% V2 r0 l9 r" B - #define ITCINTEN_SHIFT 21
; a, S; L! ?+ g8 | - #define TCCHEN_SHIFT 22
, G: T' `& D7 H8 e3 u0 X/ A w - #define ITCCHEN_SHIFT 23# y9 t1 K! a: B7 @4 N
/ \$ A/ j& N. z3 s- c- static volatile int irqraised1 = 0;+ H- n" Y6 Q* w" q
- static volatile int irqraised2 = 0;# X0 I$ s) z0 n( l
- 5 L; L* s+ b/ ]! ]. q% m) J' |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 x8 e; B* }' y. Z J3 i0 P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ V6 t* ~3 V8 B* I3 {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# `) X1 i2 z% [3 K& L8 Y0 ~
/ a' t1 [, U: z2 C# m/ u2 T/ P, a- dma_addr_t dmaphyssrc1 = 0;
/ ]2 ?3 q, w$ Q0 W q" B/ L6 k - dma_addr_t dmaphyssrc2 = 0;! l& m6 B/ @7 u
- dma_addr_t dmaphysdest1 = 0;
( x! m5 B3 o% C' a3 K- Q! m - dma_addr_t dmaphysdest2 = 0;
5 R2 {1 j# @ o; a; X+ _7 t; O& ^
% R4 n2 d0 I, t9 h* S- char *dmabufsrc1 = NULL;, G& v" z9 _0 X& {. y
- char *dmabufsrc2 = NULL;2 `, D; M/ x& ]/ p; `- w
- char *dmabufdest1 = NULL;$ N4 `3 N2 L; u3 \1 `/ S
- char *dmabufdest2 = NULL;4 s- H, m' |, z1 u3 h! J
- 9 x m/ m. H# \1 f- Q: q7 L9 {9 t
- static int acnt = 512;
7 l6 R% H7 k5 Z2 \ - static int bcnt = 8;2 _3 ~+ ]! w4 g% n- r3 a+ i
- static int ccnt = 8;
[# m' F4 q( k- L9 S/ A: F% Y - 1 e1 \% v$ `7 j
- module_param(acnt, int, S_IRUGO);
! P* p; P/ n- r M9 y! @, z' |3 v. f, Z - module_param(bcnt, int, S_IRUGO);
# ^* C" H7 [- Z! e - module_param(ccnt, int, S_IRUGO);
复制代码
2 O1 x6 P; `- x4 @- C- _. T& t: C: x
2 v2 g1 A" l9 M/ U! l, w$ b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, X: W+ a! K% X+ t8 Q8 W5 Z, v; n' |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ P F" o/ R5 E$ l$ U2 } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 W$ T. w% S7 U! q9 T' [5 U
" b% k( M/ w0 H5 N; \8 ?0 z3 X" U: h8 b
6 T# s- Y$ f7 z; R; ]$ M |
|