|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! Y% m( q! W7 J" |: r* a* x: o" u- [code]EDMA sample test application
3 Y! {( e0 `0 K, T - /*
' h) E. K' _3 S1 `3 i& @ - * edma_test.c3 B' A6 d5 T- N! q! \) D
- *
& y' G4 _1 y( [: D/ G - * brief EDMA3 Test Application2 A0 Q- N( [$ O* }/ @, x8 y
- *
9 Y* f5 `6 z6 P R4 G; ^8 j - * This file contains EDMA3 Test code.& P: a; a+ g8 C4 j, i: A' h9 |
- *
/ ?+ J: v! A& W8 O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 c8 b V' H$ g: E; N( T" L( Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, ^3 H, X: N' G0 z! @8 T1 I+ c. j
- * TO CHANGE.
7 @6 t& d& K# S; Q; a - *
+ H; b6 o8 ^, t- V; x% O! C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( B; H* R( ?- m5 n% ]/ Z
- *2 ~) I2 z- R: Z- x
- * This program is free software; you can redistribute it and/or: R. g3 c3 j/ v! I
- * modify it under the terms of the GNU General Public License as! h0 W! P4 E3 G: T3 _& ^ |' k
- * published by the Free Software Foundation version 2.
- z% a! T! W3 J1 U4 P - *
. V& W1 }, \3 G( _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 u5 T2 v2 H; ~, T, V - * kind, whether express or implied; without even the implied warranty
4 _% q, b* M' x& h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 B; U- ]8 Y, T$ N$ L - * GNU General Public License for more details.& a% v0 A- B# @) @2 x+ y4 b3 o
- */
3 C1 w8 c& H& u5 |
. f3 `1 ~- ~' C# @- #include <linux/module.h>! q# s- H+ v: a2 p0 Y& j+ ~
- #include <linux/init.h>2 D3 R* E- s3 F
- #include <linux/errno.h>
, n4 T5 ~9 k/ b, ]3 u: X- f! G) f' S - #include <linux/types.h>1 X" @3 F! G5 k1 f9 H: G
- #include <linux/interrupt.h>( F6 |5 v8 h" @( a2 i- G: p
- #include <asm/io.h>: B+ j9 F* E2 u# e. x8 d" ^) V; ~ \
- #include <linux/moduleparam.h>
6 t" a6 s7 H$ a! b. V% y$ L+ C( U - #include <linux/sysctl.h>
# B1 r0 C; i! ]7 O4 M! Y- I - #include <linux/mm.h>
/ B2 ~: v4 Q1 X+ U. V B' |& z* y3 W- R - #include <linux/dma-mapping.h>1 f8 u# L/ i* f/ c1 h( r% `
- ( y% ^9 U" L: X6 p
- #include <mach/memory.h>
( T# D& P, u7 k# t4 _9 c4 D% C) `3 ` - #include <mach/hardware.h>8 j! X" U7 U3 p$ x4 C$ s
- #include <mach/irqs.h>
O. {' _* m1 I! h9 K - #include <asm/hardware/edma.h>
* Z# [2 c) E( \$ F - 4 Q+ b/ Y, K0 i4 f
- #undef EDMA3_DEBUG( [% S# b. @2 a0 C+ J9 u+ a
- /*#define EDMA3_DEBUG*/6 U3 G4 _2 ]: H
2 p4 C' E- I3 ~* b p- #ifdef EDMA3_DEBUG
: d7 r! j/ E& H8 h) Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 Z3 y* m7 @+ I- F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( I1 W3 Q5 [6 {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ W& f) r f7 [7 J. c# y
- #else/ s5 l/ V7 b8 z" v8 j* w
- #define DMA_PRINTK( x... )# @' R$ k9 X4 E" x" N
- #define DMA_FN_IN. O( H& d( c+ \7 b3 {) t
- #define DMA_FN_OUT
; o, h) j+ e# Z# |5 d - #endif2 C5 \& ]" |" G' N- z& m8 Q
- 7 U. Y( ]; M: i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 V2 b/ N2 ?) o" `# D6 P0 Z - #define STATIC_SHIFT 3
% r+ @2 K0 P# a - #define TCINTEN_SHIFT 20
: V; E G+ X& P& i. S/ ^ - #define ITCINTEN_SHIFT 21# K5 u- n! h3 c: u! ?! [
- #define TCCHEN_SHIFT 22" u. o) j% @" I: G T% K h' \
- #define ITCCHEN_SHIFT 23
$ h& g: {5 H2 e( E: S - - C3 z' r0 Q7 k% v+ m! D4 G2 n
- static volatile int irqraised1 = 0;6 w8 e* O$ g# W9 L; Z
- static volatile int irqraised2 = 0;" S$ B! w2 g2 \ z4 Z c# V
- Q; q. ]! X% ^% l& _9 t+ Q) {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 m) h: ]2 z5 L7 @% p) p! i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 \# f( m7 d9 l+ ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 p, p$ F# i+ O% {9 v* _
: |) u9 X6 s% `- dma_addr_t dmaphyssrc1 = 0;; k! C3 u; U4 r2 Z
- dma_addr_t dmaphyssrc2 = 0;
6 T/ t) U$ e! a- V4 w - dma_addr_t dmaphysdest1 = 0;
+ j/ X1 N% i& V( X - dma_addr_t dmaphysdest2 = 0;
$ L) L* J& G. w
! c: N8 \# m. d. w7 x- char *dmabufsrc1 = NULL;4 \0 w; _) }2 C% m! ]1 Q1 l
- char *dmabufsrc2 = NULL;
8 S0 c% _& e! ^7 C - char *dmabufdest1 = NULL;% l7 |/ {% M* Z) X6 u& M
- char *dmabufdest2 = NULL;
- `8 `! C& D0 d Q: f/ H7 |* Q - 8 r1 }- I( ?7 V% @4 {7 f' v
- static int acnt = 512;) C2 e: B3 C& D$ C
- static int bcnt = 8;
. R; ]& d$ ^4 P( V# \% {3 `5 ^ - static int ccnt = 8;
2 L( [& }1 b) Q: u$ ?; [; f
" ~, y! h7 I- Y9 R& J0 D7 q- module_param(acnt, int, S_IRUGO);' K4 d- c: z0 ?- P4 c( [# b3 o
- module_param(bcnt, int, S_IRUGO);
& |1 F& ]7 j2 x - module_param(ccnt, int, S_IRUGO);
复制代码 0 H. A4 L2 b1 O+ K" K6 z
! K m: m! r' I, z ]+ v" F, P" t/ P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 l$ w$ a1 \9 x0 K: M# [. ~( o4 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 j+ n( k6 G- o. }; {7 F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 E% p9 k4 |: K) }" _
* E! c) v( M+ V! [( }: F2 J5 n
|
|