|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( D; [1 g; o8 M+ _; T/ S' \- [code]EDMA sample test application
3 n' q7 `2 o& Z, X; V$ H - /*
5 P5 i; ]+ |( {6 T6 [ - * edma_test.c
Q! S9 ?: W7 x, l$ ?9 k - *- p9 _" k+ x* w' n1 k
- * brief EDMA3 Test Application
+ R1 E, R; Y9 b4 x9 q" a - *
$ ?7 a. d" P* w& Q/ [+ V - * This file contains EDMA3 Test code.% t2 _- v0 E" Z+ j1 k+ \5 R0 R/ c
- *3 l) o( \- X% K, j1 n& w) n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* d! d' {; M5 N# v( i' [0 r! u& d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# ~* a! h6 s' L. O# x
- * TO CHANGE.
1 f! F1 s4 f. y6 y- J9 s - *
3 x% A i- I# Y- [7 d# g( L8 x8 R( m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) I5 |( p3 h" e8 H3 L; _ - *: D* e4 ]1 N: f
- * This program is free software; you can redistribute it and/or
/ `+ |3 n4 ]6 M* J. y - * modify it under the terms of the GNU General Public License as+ O5 v6 ~, t( p$ U, `* N- |" u
- * published by the Free Software Foundation version 2.4 S3 l* _' A: Z2 N
- *
# M0 i5 x$ H# ^" P Q" t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- b6 O$ O* O, ]; Z2 e* S9 u
- * kind, whether express or implied; without even the implied warranty9 o3 w, a& J- _2 h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% r8 y$ w& k8 C6 x# L
- * GNU General Public License for more details.
, O+ D' Y0 w0 Z$ V+ q( A1 v: q - */7 Z. r: f3 t3 r
- 5 e# N- z* M. P
- #include <linux/module.h>
" X) l" ~& F) |" V - #include <linux/init.h>
% [4 R9 e) v# q: o/ D5 W0 V0 g$ | - #include <linux/errno.h>: o ~ Q) C. j& J. k8 C* N+ i( d
- #include <linux/types.h>, h/ G4 t5 l6 Y1 ]4 ?
- #include <linux/interrupt.h>
5 F1 t: W' G1 q3 L9 M - #include <asm/io.h>
8 ] B$ d, C: w) B( p3 x4 w: X+ I - #include <linux/moduleparam.h>$ M' u f$ W6 p' U2 s
- #include <linux/sysctl.h>
: ~3 R9 a6 a- j$ f* _& \ - #include <linux/mm.h>
# b2 S& a, m; P6 j7 h - #include <linux/dma-mapping.h>4 O4 L5 H5 V& N% d3 g. J
/ M3 F& r, o! R" k9 ]7 s$ L- #include <mach/memory.h>
: s' [+ u, v# L/ ]6 Q* i$ Z - #include <mach/hardware.h>! }) U# K8 |3 D: u- V: ]2 }
- #include <mach/irqs.h>; I( e9 P2 C: Z+ }2 F
- #include <asm/hardware/edma.h>( Z/ `7 K8 U* }: \
- 5 @6 m- V- r0 a, s {9 L$ x, v
- #undef EDMA3_DEBUG
% e8 n" u. l3 D6 T: Y - /*#define EDMA3_DEBUG*/
' t5 q' d- i: c- h. S
% l* ?! A+ I) ^3 X- #ifdef EDMA3_DEBUG
# g+ o5 \* Y& \: u( [ X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 {3 d. t/ K) v; G. T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& n; @, ]- t% o, X( o( @! ?8 K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 P9 G6 f+ h6 N7 n% t3 B6 g# k$ `
- #else1 X& |9 l" H/ \8 N4 K
- #define DMA_PRINTK( x... )
; ^$ |! K3 Y( F# W - #define DMA_FN_IN
. X& p- I* Z @ - #define DMA_FN_OUT
5 }* r( ]6 j( g# g2 ^. e5 w: o - #endif
& b$ ~1 j, V1 p# G* ?& ~
3 \ ~, z+ c. H, z( R3 i/ Q3 [2 j- #define MAX_DMA_TRANSFER_IN_BYTES (32768) u3 A! A; Q" P$ I! K3 ~
- #define STATIC_SHIFT 3+ y2 [# J& T7 U. P
- #define TCINTEN_SHIFT 20
* w' ^& ~+ F/ Y, H - #define ITCINTEN_SHIFT 21
8 ^/ J9 @# L. }$ R3 t3 I! ~3 { - #define TCCHEN_SHIFT 22; i, X% \+ ~& a$ ^+ j
- #define ITCCHEN_SHIFT 23) ~6 L1 d% H$ \2 [! @2 [- y
0 ~9 y& z$ ^3 N. p6 h$ X8 G# b& x- static volatile int irqraised1 = 0;* M/ q- Z* }5 i) Q/ b
- static volatile int irqraised2 = 0;5 M, g% j2 c' M5 z
- ( x5 q! B4 }5 g0 d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: H. y! c. m) D) ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ ?/ P& T% u2 l, s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, G. i( v4 a3 G# A
, P$ j9 g8 ~5 m1 w7 _/ e- dma_addr_t dmaphyssrc1 = 0;
6 k' s" ?) z/ c1 A4 ], }' y - dma_addr_t dmaphyssrc2 = 0;
% Z6 S2 |; F" ^4 Y, X - dma_addr_t dmaphysdest1 = 0;
$ F" `( P& \8 Q* ]: h- I* E - dma_addr_t dmaphysdest2 = 0;" i. K7 N7 a2 J9 ^; p; s
- % K0 U& P& ^# t8 {$ g, {- C
- char *dmabufsrc1 = NULL;
, p& O* @) t; |, }& _ - char *dmabufsrc2 = NULL;
! }8 X* t# [9 @; O# n - char *dmabufdest1 = NULL;
' P# Z" I; O s - char *dmabufdest2 = NULL;
' E9 c" o) v7 D% p+ j7 n
/ ^& N6 `% r( ]- K- static int acnt = 512;
- Q F. K% v3 U( J7 k3 a - static int bcnt = 8;% Y" T1 c( s, t& F
- static int ccnt = 8;% C/ A( v, n- n" }; {1 a
- * u% D# F. y& L, H% _. d
- module_param(acnt, int, S_IRUGO);) [" W5 |9 V; h
- module_param(bcnt, int, S_IRUGO);
- m) f8 S W( d! | - module_param(ccnt, int, S_IRUGO);
复制代码
( T3 U% v; N, J3 {& _- m+ z1 ]# d9 B0 g8 \ t! r( X- I; Q1 l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 @, Q4 n; W `- z2 g9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& H, T$ \7 }3 k; I* k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' r1 ]- [4 M& O' _% @# b- \; K7 ^/ i; a( b
9 ~0 Y# S8 a: W$ ?( O
|
|