|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 ]5 h# Q& v+ L. f- m1 P
- [code]EDMA sample test application% ?' H: R j6 k$ ] q3 F
- /*
7 [1 B2 u2 Z$ d I) j9 a - * edma_test.c6 w0 J8 c* b3 e. R. m* p$ I$ H
- *3 C ^0 a' X6 D1 w2 P/ a( z
- * brief EDMA3 Test Application" u! w1 N O" @# F, r8 j3 b
- *
0 s4 A: t: F9 d3 f - * This file contains EDMA3 Test code.' @5 U( w' `4 Q. ~
- *0 M0 {% x' ^! k. d, x( G
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ H) B' W6 @ |1 P$ e% _$ H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ d4 {; n3 t% c" }. G* N - * TO CHANGE.* j; w6 U; Q! X2 C/ W
- *
# C7 `6 I* S9 `& n& t& r% D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 b2 D/ W3 x% `' n- X/ A) A, j) y8 M - *5 V1 ?1 r' m% j' J9 f
- * This program is free software; you can redistribute it and/or' ^& }* w E z: e* m& R
- * modify it under the terms of the GNU General Public License as. z. J8 Y/ |& l3 b
- * published by the Free Software Foundation version 2.7 [1 w$ a% f- u
- *
. y6 H2 }9 O0 \6 O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: p( h- {9 \ u1 P' i
- * kind, whether express or implied; without even the implied warranty4 N5 N! D! o8 _( g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. n9 K& F9 `! n2 c# x+ U
- * GNU General Public License for more details.
% J% i. Q8 B) Y0 k- ?" J - */
) V [# ]$ r, x9 l# S1 T - ! [9 B5 e2 Z) A- Q5 ?- R
- #include <linux/module.h>
$ @' c4 J0 Q% g" ` - #include <linux/init.h>
7 g6 p5 W& Y6 d - #include <linux/errno.h>9 ^: I. z% k" F# q& x
- #include <linux/types.h>
1 K" s$ i8 e! q - #include <linux/interrupt.h># N3 o: M, }- z% Y( r& ?8 Y% x. w
- #include <asm/io.h>
- v" _: i% b; x( t g - #include <linux/moduleparam.h>$ Q7 N6 f U) N' ^: I
- #include <linux/sysctl.h>: \7 w/ o3 L, A& D" z: B/ i. H9 D
- #include <linux/mm.h>
# R* l, J" z' P7 G* _( Q, l* t - #include <linux/dma-mapping.h>
( n [0 P) P. ~+ i0 w
/ k A( w& {( R5 X- #include <mach/memory.h>
8 }% Q- B: f9 D8 i y- ~ - #include <mach/hardware.h>
' k8 g9 O5 _- i: [' U6 b C+ u$ S. ^ - #include <mach/irqs.h>
- ?. X3 _+ Q: C# l# g, a* r: I - #include <asm/hardware/edma.h>
; y8 E4 h$ i3 ^6 X9 ~
: n: p& O3 d; A- #undef EDMA3_DEBUG
( T; a/ j D$ H - /*#define EDMA3_DEBUG*/
$ R4 W9 B# g: ]- e! F& [7 g - / E& t( E" p3 N- l& f4 l
- #ifdef EDMA3_DEBUG5 x) n9 K6 v+ g% o. J+ k, {8 f3 O/ r7 U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. f: F' U! m' i- f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: C! ~0 O1 S) c) v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ g" E( {5 x$ \' f' [ u/ F - #else
4 y) m) o3 ]7 }, ]& n# E - #define DMA_PRINTK( x... )
4 j& J& p+ J- s8 ^0 C - #define DMA_FN_IN' d5 ]+ A) A/ N$ h' e
- #define DMA_FN_OUT
$ H g2 r( F1 x' B8 X, f& }6 W1 B6 C$ ^9 e - #endif
! b8 Y1 B! J+ p# J9 o
+ G5 Y9 h+ p; I+ F7 s& [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' w- T9 J5 ^5 q F) @ - #define STATIC_SHIFT 3* ?& V. z& `& f, Q
- #define TCINTEN_SHIFT 20 P; d8 q" {% W# X' M
- #define ITCINTEN_SHIFT 21" @0 @. c' Z6 i' [! S8 M
- #define TCCHEN_SHIFT 22
; [0 q H8 A( D/ i) x - #define ITCCHEN_SHIFT 23 {# J& _4 ~& b: h- I* D8 K; S" w
& z8 f# f' k2 Q7 d$ y$ o1 F1 i- static volatile int irqraised1 = 0;
0 E6 Y& q- C& |/ n- x - static volatile int irqraised2 = 0;2 y4 U. H; S/ n( q( C G# t
- ( H6 F5 A0 D9 \- t2 y! e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. n3 [, m0 b* U5 y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 s4 I9 P- [5 b6 A' T9 I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 B; R$ ?2 }; B7 ^8 R
0 q' f2 D" T, L# W5 `% w- dma_addr_t dmaphyssrc1 = 0;
! N2 A) c# W4 ^7 I2 ^, J( a4 r5 K - dma_addr_t dmaphyssrc2 = 0;0 M& w% b: |. v. Y5 u
- dma_addr_t dmaphysdest1 = 0;3 l5 p8 t) u) Q# }: ]4 A* t4 X
- dma_addr_t dmaphysdest2 = 0;
3 s6 }; X! [# @. h- |1 n7 s - 6 r8 n N9 J$ h5 D" v6 F
- char *dmabufsrc1 = NULL;4 w$ o* D2 }! F7 |
- char *dmabufsrc2 = NULL;
! `2 N7 I0 D( W' P - char *dmabufdest1 = NULL;# g1 U, X+ X( B& m
- char *dmabufdest2 = NULL;* i6 R, L: m8 q5 j
- 9 A$ h; G, L/ F& J7 \
- static int acnt = 512;
9 d( S& }3 D. ?) V: B - static int bcnt = 8;! O3 F4 U4 M2 ]0 M
- static int ccnt = 8;! e, U% K2 e5 E5 x G3 @
- $ e8 m+ e+ `3 U; c$ i0 V
- module_param(acnt, int, S_IRUGO);
' K, Y0 k8 M8 M6 I- r2 z8 E! m0 q - module_param(bcnt, int, S_IRUGO);, @: B- e5 e1 g$ u9 V# m# Z) r
- module_param(ccnt, int, S_IRUGO);
复制代码 . S& J% H3 e5 y8 a% d8 h8 |" f- @2 y
' O- _& y5 N) ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 I8 b% A z2 c5 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ _& F: ]+ R8 e T# R7 a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 u5 F4 \, E. {" t9 Z6 V3 r
: N8 c* `0 e/ U7 U# H0 v/ w
* G' C: t2 Q0 a/ d' t3 J6 x# b1 d/ D |
|