|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; G; J( E' l1 W+ |* x4 Y/ q$ Y
- [code]EDMA sample test application+ i, j* u4 Z2 Z$ V9 V
- /*
y" z# a F# V0 Z) V - * edma_test.c
2 C/ J* g/ Q; ], |3 {8 r p8 a - *, N3 h+ r) d( u. i3 _* b% n
- * brief EDMA3 Test Application
# ^$ _" r I- @& ^ - *
2 Z1 d3 Q. P# ^! c2 K- f - * This file contains EDMA3 Test code.
9 v- M% }+ v4 J - *
5 b8 Z( l+ S1 F0 f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ s) G* Y/ L% `4 ~, b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 G6 d: n6 Q! H2 {
- * TO CHANGE.
2 U5 a3 H+ w O - *+ ~0 i. m S1 k- F' ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' M* G9 V h6 _. S - */ y# g1 y h R& p |, Q
- * This program is free software; you can redistribute it and/or
6 z; q! x% H- U - * modify it under the terms of the GNU General Public License as* o3 S9 b* R: Z$ u% p7 o
- * published by the Free Software Foundation version 2./ G1 {3 |; z. x3 }5 X
- *& V$ b) h- X4 N0 @- A1 D1 f4 u( \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 u( u5 ?: D# U2 l - * kind, whether express or implied; without even the implied warranty
6 s: K/ j& n! L$ k9 ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% J @5 I, C. q - * GNU General Public License for more details.
$ I, F5 V4 q! F3 s6 V - */7 s# ^' H) E' V: o" p6 D) l1 b, @' S6 Q
- + y$ D( f/ v* X
- #include <linux/module.h>; r2 U- {( ^2 g$ I& y( `+ l0 ^
- #include <linux/init.h>3 s }" l' B5 \+ q8 a; E4 `
- #include <linux/errno.h>" o0 |6 @1 U' r' f
- #include <linux/types.h>
' ]3 T! x8 `1 E - #include <linux/interrupt.h>" p8 C8 |4 F9 Y
- #include <asm/io.h>
- i1 A0 x; ~( E: D0 v$ T1 L - #include <linux/moduleparam.h>
, t V; _5 J- B+ Q P9 b - #include <linux/sysctl.h>$ @; N4 l8 h% h. G% T6 I6 q% j! i9 _
- #include <linux/mm.h>
7 ?/ e; C+ b' N" S2 @, ~3 r - #include <linux/dma-mapping.h>
4 D- a! N+ ?5 e( ]% f4 [ - ' J3 [- I1 Q+ c/ A
- #include <mach/memory.h>" [3 \& }- o! P. A. q. ]
- #include <mach/hardware.h>( e9 _' `5 V% A) E3 E$ b
- #include <mach/irqs.h>$ L* M M2 k$ x" _1 Q
- #include <asm/hardware/edma.h>6 ?* D$ n- H& W. P+ `
: M( R! V9 h9 }0 ^4 K- D; S0 ~- #undef EDMA3_DEBUG4 W3 c# K" @# n
- /*#define EDMA3_DEBUG*/' ~& A% C8 ?! a
- / L# b2 z" Z- r7 Q* a/ ?
- #ifdef EDMA3_DEBUG
4 s5 X# _9 ^$ u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% c% W R4 p: k% d, t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ V& p' \3 E+ N9 g- q$ o: G9 x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# j* g3 e8 R& J7 z
- #else
& g" H; W+ G$ q9 |1 N0 q - #define DMA_PRINTK( x... )
% R1 x' [9 i& k8 i9 U/ F+ P - #define DMA_FN_IN
- F+ i, h) R z5 j b - #define DMA_FN_OUT
/ G4 X* _' z/ p, B6 ^ - #endif+ V8 l. O' ]" b8 W# H
* F! p# K! E$ P, A7 d& c# m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* m6 Z- K& x# m. u" X& e - #define STATIC_SHIFT 3
3 V) T! T, Q9 z - #define TCINTEN_SHIFT 20' k @4 m$ l+ r1 @3 l
- #define ITCINTEN_SHIFT 216 f- M" [& L2 X
- #define TCCHEN_SHIFT 22
7 v% [/ w! M( m- d - #define ITCCHEN_SHIFT 23$ p0 }$ B0 R5 {7 S4 D3 X
- 2 i! @5 T: d! m3 [# f3 d2 B( C
- static volatile int irqraised1 = 0;
, ]5 E1 b8 B& D3 E! d( q, k - static volatile int irqraised2 = 0;0 u0 ?4 O5 l1 R
$ d( N9 A; R1 ~% t8 I; _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 m, Y8 E- V [- U- r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& p2 I4 |) z* z. I3 F6 J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Q7 E* Z3 Q% U$ d8 j0 x8 W
- * ^0 D6 Q$ |9 Q& [4 M! N
- dma_addr_t dmaphyssrc1 = 0;: p4 v9 t9 B$ P- o
- dma_addr_t dmaphyssrc2 = 0;
. q* `7 q( C: H) p! B - dma_addr_t dmaphysdest1 = 0;
( T" l4 A5 Q$ M P' t) J - dma_addr_t dmaphysdest2 = 0;9 j: ~# b1 j0 M" D2 f# w
- {9 G) c3 z5 d: Y# }" \- char *dmabufsrc1 = NULL;
$ A& U d: g8 W) g& F: Q - char *dmabufsrc2 = NULL;8 I" X7 c4 ^ Z) [3 ?5 A
- char *dmabufdest1 = NULL;
! M* G& r3 L' ?8 U/ c4 ^9 ~ - char *dmabufdest2 = NULL;
0 Y# B. C2 l% c6 c; t3 S - . c2 \4 \9 e& w! [
- static int acnt = 512;3 [6 P' q- u7 V- k3 e5 {' v
- static int bcnt = 8;* ~3 U, D4 o+ w7 A7 k# Y. e8 T: F
- static int ccnt = 8;
8 _$ ]5 p$ a! N/ W. S
; i, h5 o, \0 p: T+ \& v7 S- module_param(acnt, int, S_IRUGO);: C8 E+ I* {# ^, n$ c( j
- module_param(bcnt, int, S_IRUGO);
% g# O7 s! S; U5 O. Z& }+ i - module_param(ccnt, int, S_IRUGO);
复制代码
% v# E- i# O! W+ |4 L
( j7 K, t! e) N4 x* I* B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# @" H8 s6 w! j4 X) J" 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" _/ E! y6 j: C4 j$ N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 Y) _$ ^3 ?5 Z% b% q" t& l+ @% j, N p1 ^
$ ]8 h- V9 \8 Z/ P# L |
|