|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 U7 c2 y' _$ ~# k7 h0 ^
- [code]EDMA sample test application
* e3 y4 b/ B3 o$ Q- e - /*
( l1 A2 d0 ]2 L" n1 ~5 L0 P - * edma_test.c) r9 f+ V# Y& r, c3 b: C
- *3 I; _2 J" S1 H) k2 T
- * brief EDMA3 Test Application
+ t+ w- K2 E' ?- P0 v: } - *$ b* J: B {3 U/ m, b
- * This file contains EDMA3 Test code.
) ~* T$ K7 n3 v - *
. _% o* Z. v5 `' Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& C! V/ g6 J: j) x# m8 K4 ]" p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 K3 a4 x' L, T4 k - * TO CHANGE." w* A* {8 A+ ]/ ]: k" T5 b6 J
- *9 H: z( Y; @% v# u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 r+ S$ P6 b$ }5 C - *
" m! y% O: u/ F7 a: s8 \8 [. C - * This program is free software; you can redistribute it and/or, q7 o, V8 z" T; O
- * modify it under the terms of the GNU General Public License as+ r! P( [$ Z4 {9 Q! P# r1 J
- * published by the Free Software Foundation version 2.
+ P! a$ b+ N* U# J1 g" K, y( D - *
1 U) J& ~# N7 \1 r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. k# j6 |5 q7 q, N/ A
- * kind, whether express or implied; without even the implied warranty+ H5 v5 {4 ^( b( E" y- x8 U2 f4 w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- g; c i+ B+ j, `+ w8 l2 x
- * GNU General Public License for more details.7 m( {( {9 [! G9 i% u
- */
# s* A/ f, r+ K/ x! { - 7 \. g8 P- F- J9 \$ O( `
- #include <linux/module.h>
, X# O( a0 ~2 i1 N( x! C1 I - #include <linux/init.h>
' o: O' p* U! t1 f) ~2 z - #include <linux/errno.h>0 A' H4 N6 Y" m9 F
- #include <linux/types.h>$ b) \/ x* ^9 u7 L1 V
- #include <linux/interrupt.h># S+ v; v$ \2 O1 M3 \3 c8 l
- #include <asm/io.h>
6 x/ A( W* Y: F" q3 L" h9 d - #include <linux/moduleparam.h>
) B. Y; F- o- O* x9 G4 t- W4 R5 g/ Q! ~: m - #include <linux/sysctl.h>$ [; O% `9 {: g1 @
- #include <linux/mm.h>7 M0 m! g+ D/ k* ~
- #include <linux/dma-mapping.h>
n( L% x; o! X' k, J - 4 y" a0 p6 f& N2 }0 s
- #include <mach/memory.h>/ p& E7 M# ?8 u3 e
- #include <mach/hardware.h>1 z+ n' V+ Q7 C5 q* @
- #include <mach/irqs.h>
. T3 S+ X: d( s! F7 f5 o - #include <asm/hardware/edma.h>
& L& e# W& q0 K& r" m6 T0 O H
& [" A* a- w4 X. o# ^# @" n- #undef EDMA3_DEBUG9 A) W9 a, l0 q
- /*#define EDMA3_DEBUG*/
6 g9 u/ U D5 O5 V" j
T z0 B3 ~3 Q9 T- #ifdef EDMA3_DEBUG
, q+ \4 s& ~- M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' v0 x$ q% F) f Y1 w2 N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ n4 ]) X# E& ~ Q C5 w4 f- R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: S; A1 l8 |& J! o+ N: J5 l - #else1 f! R! D+ S& F) p/ o
- #define DMA_PRINTK( x... ), a9 M% P0 a q4 D, @! P: s1 `
- #define DMA_FN_IN! Y _5 M+ Y! {+ e! E) I7 k
- #define DMA_FN_OUT
I: ?( |5 K% C9 W# d - #endif. I( V/ {; l" I+ W+ w
% J& `* |( p" U5 Y# F- #define MAX_DMA_TRANSFER_IN_BYTES (32768). ^( u2 `9 |0 n8 \; a# ^
- #define STATIC_SHIFT 3
/ ~( s8 T2 g8 ~9 }5 f8 B# y0 t2 e) U2 c - #define TCINTEN_SHIFT 20' P1 A1 P$ y. x7 D0 T* S
- #define ITCINTEN_SHIFT 215 B+ B0 `. @8 Z$ ^/ t, K& n+ j
- #define TCCHEN_SHIFT 22
# v/ w5 @5 o" v& G( c - #define ITCCHEN_SHIFT 23
, i. X% o4 c6 @$ V. k$ S$ ^ - , p3 X6 G0 R/ O8 C! n2 c+ G2 p" U
- static volatile int irqraised1 = 0;$ U7 W+ O2 m- V/ ]( G6 @
- static volatile int irqraised2 = 0;) n1 V0 @: ^ C- ~) ^3 X, V
5 P) r( F2 x" U5 k; x5 O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& {8 a( {8 i( u4 Q1 M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 P7 H6 G3 F; z4 O$ L9 i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! ~: p* J. c# F. x/ p9 i
- ' u9 {' l6 |& @7 m% @3 g m/ m
- dma_addr_t dmaphyssrc1 = 0;5 G& W3 M4 L) T! f' e
- dma_addr_t dmaphyssrc2 = 0;
( w: A# z. p+ S3 S( @ - dma_addr_t dmaphysdest1 = 0;
+ R0 f r$ Y% ?8 d - dma_addr_t dmaphysdest2 = 0;
! T* d( _; h5 A& u, g7 C$ W6 Q s - ' b# K" A& n) l0 Y+ b
- char *dmabufsrc1 = NULL;$ X v8 e* f8 r& c( z3 Z6 h* g
- char *dmabufsrc2 = NULL;. j [9 x4 |' G; a, _$ x& n
- char *dmabufdest1 = NULL;+ P( ?) y/ E6 u& N
- char *dmabufdest2 = NULL;
! @0 @# z: ~0 B5 t" y- \6 J - * W7 F. y. t' J) H) B$ ~0 V7 {
- static int acnt = 512;
# z+ Q" v! n. }' Y; Q - static int bcnt = 8;
2 i% R: u' ~# o0 f& p4 v% s( m5 w - static int ccnt = 8;
, z' t t; @' t) c" u7 b
' \/ t2 @9 W' K2 @# k- module_param(acnt, int, S_IRUGO);9 D, {. N0 T: Y2 t. @, C( D; ?
- module_param(bcnt, int, S_IRUGO);! [2 i" o8 r% A, ^: z2 u# z
- module_param(ccnt, int, S_IRUGO);
复制代码
$ s3 }: N6 V/ E: B4 m* l4 x* \2 E z7 N) P7 N* ?3 O% n$ X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 D) `+ a1 Y2 C3 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 p5 v. @' ~1 ^9 p! ^. |; H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: A/ U v2 U1 t8 y
8 d5 p7 _- C- d! W8 X
0 d' i( g( c5 h. n
|
|