|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % h9 P( E# j; Z% b6 P1 v; U
- [code]EDMA sample test application2 W0 [: P2 U9 }7 o
- /*) X# @, {+ X" k3 }/ }# p
- * edma_test.c
7 Y* m' W6 s( Y! N. @ - *
/ Z" q5 e* e6 N; S( k& Z - * brief EDMA3 Test Application
8 G1 W& `: [) n `* l( t, Z - *
; c5 u( [, t; `% h0 J - * This file contains EDMA3 Test code.! v/ Q# S2 P$ Z! [+ }, ]
- *
5 `0 G1 q/ N u: R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ h8 E# P5 D, g4 S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ Y8 Z6 a) x m9 E5 l7 U - * TO CHANGE.% }0 e( ^7 R3 x# L* S) s+ ^( _
- *
. n2 }, c- W4 S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' `2 w5 F' {: [' B) X - *& b9 L! B: T4 J/ U& C+ c
- * This program is free software; you can redistribute it and/or
- }8 h' ?# t/ x( {' j - * modify it under the terms of the GNU General Public License as
) I% D# {: l7 e3 Y8 Q9 w - * published by the Free Software Foundation version 2.7 Z$ A* Z! u5 b0 R- ?
- *( M X- A \6 u* d9 E. c1 V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 m' C: E" l4 U; l4 N% h. p
- * kind, whether express or implied; without even the implied warranty
; k# y4 N! e* U5 S S( k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ t7 a4 z* e2 @2 ~* m: B - * GNU General Public License for more details.- m) ^0 g" C. x9 m- _, H6 \
- */4 `- \0 P( U+ |7 o. t
- . ?$ {6 o/ m" @+ T+ Y/ `$ r
- #include <linux/module.h>
% q% ]+ |$ u1 x- N: W0 ~$ P/ m h - #include <linux/init.h>$ J6 C' O# t0 n! Q# k G' p2 N
- #include <linux/errno.h>. O& D; x% l; H8 H
- #include <linux/types.h>
$ I: j# z& a" L/ }. @ - #include <linux/interrupt.h>
& t/ _4 @: [, { - #include <asm/io.h>9 W; K6 L, g4 q9 \, `5 j7 w
- #include <linux/moduleparam.h>
( \: s b8 s- Q9 [ - #include <linux/sysctl.h>+ `0 p; D7 N7 p, |* L' o
- #include <linux/mm.h>
1 L, H$ f* q, x, Y9 X8 ?- o - #include <linux/dma-mapping.h>2 H6 o& d0 ^5 u s
4 P1 d0 i7 K5 {: O- #include <mach/memory.h>1 a8 K1 ^$ _8 [+ s" a4 u. D
- #include <mach/hardware.h>
; u+ \5 Z- m& T* x5 W2 O1 E - #include <mach/irqs.h>
4 d& @3 c7 {/ o1 v8 D - #include <asm/hardware/edma.h>7 c' @3 t9 l' M( X& J; \
- 8 @, j& f( F6 d9 m0 K) g+ l
- #undef EDMA3_DEBUG6 I5 h( L; F8 B1 T
- /*#define EDMA3_DEBUG*/
0 y# d# q( ?+ j1 N2 v; k7 p
/ U7 V3 P: X8 L7 \/ L- #ifdef EDMA3_DEBUG
: R( E9 W @4 w! c3 A, Y9 o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; E4 n4 K( y9 c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* i Q; N9 Q! {- f; D5 n% f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( n2 x# i+ W* I5 }! V6 q: E
- #else; p9 [5 a- f U* t* I
- #define DMA_PRINTK( x... )
0 Z* w4 J% ?3 {+ [1 u6 M8 \* u - #define DMA_FN_IN
! A! Y4 z8 @- s* h& T7 c$ F - #define DMA_FN_OUT
2 d6 V' D( R- n* ` - #endif/ e9 h2 K+ ^9 n9 c( U D
4 W. ] n4 D% P$ [/ A- #define MAX_DMA_TRANSFER_IN_BYTES (32768): o) g ^. \ Z- h( Q; T
- #define STATIC_SHIFT 3
& n1 u- M' V. p4 Y; [ - #define TCINTEN_SHIFT 20* k! s9 y ]/ b( e8 m
- #define ITCINTEN_SHIFT 21
3 F2 c- d! |, G - #define TCCHEN_SHIFT 226 c; e( M+ f; B. C9 K
- #define ITCCHEN_SHIFT 23# D3 L, O8 d7 s" v6 `/ m1 v
- 9 @/ i; Q- A: d# a. M
- static volatile int irqraised1 = 0;
3 F7 Q) A. X [" N I& f - static volatile int irqraised2 = 0;
; R- O3 }" r6 j4 y9 P/ ?
- {% {! J1 n+ G, d/ W! H, O0 W. `- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 y$ @( D) m' ~, Y* Y9 d3 G- C8 z5 \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ [7 l- O# l; d$ T/ L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, B# ~; }* w) [. o1 k! J
- 9 w8 F& z7 ~- Z+ D& } r
- dma_addr_t dmaphyssrc1 = 0;
# k1 Q' [, r( V2 f7 J% v% w5 I - dma_addr_t dmaphyssrc2 = 0;+ T% L. Y4 h4 I- E5 I" y
- dma_addr_t dmaphysdest1 = 0;
- {# N& k4 k2 a( D - dma_addr_t dmaphysdest2 = 0;8 e& o8 _" }* U
# j( C- W/ ~9 b8 p8 W; [& b- char *dmabufsrc1 = NULL;
4 \& Z& `8 u. d7 n; a& a - char *dmabufsrc2 = NULL;
) A# |& m4 J$ P- ~) b - char *dmabufdest1 = NULL;
' h- [$ e$ g7 X/ c- R - char *dmabufdest2 = NULL;; d6 g5 D3 @7 E ~
) {7 u, d- W8 @2 z4 J' J- static int acnt = 512;
9 S9 [$ N9 a: ]5 E) F2 s - static int bcnt = 8;
" G, d5 f5 G% s - static int ccnt = 8;: z6 r) U8 v( u- Z
- I& D) {( J8 f* F' L8 \# i- module_param(acnt, int, S_IRUGO);
/ @/ k- f# C2 X" E, |3 A - module_param(bcnt, int, S_IRUGO);
; o6 e, h. Y: `4 p0 @8 { - module_param(ccnt, int, S_IRUGO);
复制代码 ) ^6 W2 M* ]) t+ o' p: N: G2 s% ]* o
* U3 ?0 N3 ~) t$ a8 K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! [6 r7 {+ @' c% h5 u* G; b8 B g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 O7 j4 s$ d% e9 p; m! {# ]' I$ k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 G( a6 O& A2 z0 L: I! _& k
7 m$ N/ n4 W2 j
3 K5 V6 B. T& J6 G" A4 f4 L |
|