|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! S5 c* P: X5 {' n9 T5 e7 z- [code]EDMA sample test application# O u4 S2 G: D' r& {
- /*
8 i- m7 }$ e0 \, a l - * edma_test.c/ `# j4 f9 e' ]6 ^! p6 V% u: _
- *
7 z2 H- K1 d E - * brief EDMA3 Test Application
% I% ^& S# X0 k6 |0 m( b+ ^" f, K - *
( R, [% g+ Y+ L( M* I7 T - * This file contains EDMA3 Test code.- r w8 w* l( `+ X
- *
5 h$ M7 F3 N% M: L) }. n8 l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' x' K& A s. N4 ^3 z! O' N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& _9 Z* [2 d9 c7 T
- * TO CHANGE.
. r( ?9 S4 b( B" P9 a0 u - *
% F ]( P8 j- h" U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& B% s; ]- M6 l' s - *
$ W. j: j: p& d - * This program is free software; you can redistribute it and/or
( d. @8 h5 ^1 r7 d8 Z, k - * modify it under the terms of the GNU General Public License as$ [9 G4 u. q5 U( j2 V
- * published by the Free Software Foundation version 2.4 n# {. F+ f$ q0 u) `
- *& _' V' @5 r- C: Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; o K8 g8 H1 D( v0 A
- * kind, whether express or implied; without even the implied warranty$ l! x5 u5 x9 Q" q. l9 ^' S! Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 _( ^1 [2 y4 I& d
- * GNU General Public License for more details.4 R* L+ T* h& G' b' u# D) q
- */& z) i$ {; h% ?
. G6 Y0 \% X+ B$ X% J8 D. ?5 t- #include <linux/module.h>
' Q/ \: |, P" V7 M1 I+ d - #include <linux/init.h>) P, [! y8 C$ Q, U& N! s$ v/ ?, O2 U
- #include <linux/errno.h>
$ C* Z2 r2 K! ?- f - #include <linux/types.h>
$ e% V! X, r& t8 G7 ^( S$ V L: R* H - #include <linux/interrupt.h>
% a. d# X& a8 d5 p7 M$ [# h - #include <asm/io.h>
! J/ n* J& }. M- \) _4 m5 J - #include <linux/moduleparam.h>) P3 f+ `5 r5 B1 |9 p
- #include <linux/sysctl.h>
6 M/ h, S8 }$ e. ~0 {9 N - #include <linux/mm.h>
6 x0 H+ r, |2 c3 F* U2 g4 h - #include <linux/dma-mapping.h>
* x ~) D5 t& ~& N: D
$ ]( b5 B. G7 Z; o6 F- #include <mach/memory.h>6 M1 u. Z+ k3 E2 ]2 o! v
- #include <mach/hardware.h>
0 d! ]% h7 ^& g" ?. a - #include <mach/irqs.h>' V% K- D% U8 _4 {4 p; `
- #include <asm/hardware/edma.h># B7 e5 v9 N- b B3 y
- , H) l/ x& s ?; E9 k, l {
- #undef EDMA3_DEBUG2 [% c N0 V" ^8 ^
- /*#define EDMA3_DEBUG*/2 {; D0 Q9 x$ V7 E3 \3 o2 H- h* V
- 7 B9 ? F! N6 }. a+ S8 r+ v
- #ifdef EDMA3_DEBUG
3 K, p, o7 g' y. [$ @: V0 M h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
]4 z6 ~- ^( y" }7 _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* f( p( N- g/ _; q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 D- ?; y1 a: ^( A - #else5 R+ O" S* W7 ~: _ s
- #define DMA_PRINTK( x... )
1 \( y6 I, q% d, X* d/ v7 w - #define DMA_FN_IN
, |% S) C0 \) @' l( F/ J - #define DMA_FN_OUT
. r' z2 ^4 h9 m# `6 o6 L2 C {0 d - #endif" D4 B6 b, ?& @* j: Q3 i
- ( }" f4 J3 J* D! i: T2 q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& i: e7 j7 Y; `2 S) D
- #define STATIC_SHIFT 3
; V/ m* t/ c2 Z0 F( w3 x; N9 | - #define TCINTEN_SHIFT 20* ]" B: E, {4 W% W+ {; J1 Y
- #define ITCINTEN_SHIFT 21
5 s, ^7 b( D4 x( M; E+ N3 F; A1 G - #define TCCHEN_SHIFT 22# p9 p# }6 t% c s
- #define ITCCHEN_SHIFT 23
2 @7 O8 \9 U, {" M - ; l7 D& }. ]! E1 c6 i; J4 M9 ?
- static volatile int irqraised1 = 0;& a! l% n( e+ p; k: H- w" X
- static volatile int irqraised2 = 0;) J1 Z: L& C+ c# s
- * G2 R0 w( o2 X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ?! d! s! r' _# y% i3 a+ w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( g) ~* {9 ^% p+ B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! F* G+ P% [$ h# A2 n' C$ z/ F
6 p7 F* m% ^' D- [- Y- dma_addr_t dmaphyssrc1 = 0;) t1 U1 o) \$ a/ E# }. n- a
- dma_addr_t dmaphyssrc2 = 0;
/ p( e6 ^: Y8 n; j& J5 ? - dma_addr_t dmaphysdest1 = 0;# T( d0 G! {" c# l
- dma_addr_t dmaphysdest2 = 0;) z; B7 G7 w9 A t
3 {& Q+ }# a; ]- Z0 r( l- char *dmabufsrc1 = NULL;* i1 [# ]% w5 Y' r+ N
- char *dmabufsrc2 = NULL;/ @/ N8 Y7 t; N& R; Q
- char *dmabufdest1 = NULL;
5 ?5 ^( S- c* T% l* e( h - char *dmabufdest2 = NULL;: c4 x' a: g$ J
- 0 [$ S- g8 F& y6 U
- static int acnt = 512;
1 e7 L2 L% k7 g- s- _/ z+ H - static int bcnt = 8;
3 L7 \% b! b- g7 W! v K/ u - static int ccnt = 8;! ?; I1 t& \* f5 J( o$ f' n
- $ p% Z, Z, c4 e) p" e, B
- module_param(acnt, int, S_IRUGO);' F: x1 w- i- @' }& u4 n
- module_param(bcnt, int, S_IRUGO);& `$ l7 H) [' K$ V8 w
- module_param(ccnt, int, S_IRUGO);
复制代码
( X* E* v5 [$ {# j3 \2 g% V8 V# G# W" E( t/ ~7 R5 N2 r' U: }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ S( i4 h8 a2 x7 ?. Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; n/ o# Q& q6 P4 y( D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ Y- g! D8 Y4 W
% U x$ D* P" P( h
" @% ~+ l8 U! _5 j& K3 _ |
|