|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 C5 i0 ` J: S- [code]EDMA sample test application7 G, g1 W/ f7 b2 j& q
- /*
$ F5 u, O% J# [8 f' D" X% I - * edma_test.c# e$ z6 K5 {- V" T8 s
- *
# Z% r/ D6 z+ E( p5 X5 h; [ - * brief EDMA3 Test Application
/ f, K$ N( z+ c4 q; V - *1 \) j* g$ ?) ~$ H7 q- ?- ]
- * This file contains EDMA3 Test code.! y) ]9 A. W) n* R0 L- m0 ?5 v6 f
- *4 {3 S4 `. E' w Y: c& a9 \' B; k, h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. D t, k$ ^! t) j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ U3 a- o$ P. U; m! X. [7 w2 }6 i - * TO CHANGE.5 e0 H8 m5 D1 s& \
- *$ T% q1 i) B' F5 t( x( S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 m. D |! g5 Q% Q: Z+ x& _- a; l* B
- *
+ L7 ]9 F6 f2 ~/ M - * This program is free software; you can redistribute it and/or
( p* w9 a# A' b- _ - * modify it under the terms of the GNU General Public License as& \+ S: b1 Q/ b
- * published by the Free Software Foundation version 2.6 V+ ]& l& y# {* F: ^$ _
- *
2 ~7 u. t0 G3 L( `. L5 @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 t* J7 Z! W7 H: ]. f; r
- * kind, whether express or implied; without even the implied warranty: f7 d# `) s2 ]7 s0 l4 W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) |2 A1 G2 X6 U0 h5 w- A6 G4 C6 W F& X' Q2 @
- * GNU General Public License for more details.4 u" I! n8 j3 m: F2 `- |- O
- */
+ Z- ?( L; V3 i* s6 b- s/ l1 [
& g1 O6 [ L$ {: w9 [. Z- #include <linux/module.h>
e& V/ `3 ~- u - #include <linux/init.h>7 Z1 x" C f- _) F4 H: d0 Q
- #include <linux/errno.h>+ T! W, F1 c( X m$ x1 b; O$ @- t# F
- #include <linux/types.h>
8 S! M2 T3 F x3 g# P' u- Z9 [ - #include <linux/interrupt.h>
4 Z `6 M$ N% `1 s1 [# r1 m7 J" v - #include <asm/io.h>! m9 f c c, S* r$ _$ B
- #include <linux/moduleparam.h>
' Q Q }5 }; ~5 J& a8 V - #include <linux/sysctl.h>* \4 S- _& ~9 N6 N. ~
- #include <linux/mm.h>
/ o. W% Q/ t# _* B! f3 a# [- U - #include <linux/dma-mapping.h>
3 I! V% q2 b" E J7 u; G" F3 R7 t
- I2 f5 d# v. b% J$ @" b- #include <mach/memory.h>
: _& _7 d4 T R4 ?/ E' e - #include <mach/hardware.h>+ D1 Y) X+ m! {6 ~. M [
- #include <mach/irqs.h>. o- ^4 Q1 Z8 d3 N: T' ?
- #include <asm/hardware/edma.h>
) E7 F1 h! w3 e
9 X4 w- K9 a2 ~0 ^) |- B3 V- #undef EDMA3_DEBUG- c/ n d- b1 H" z3 s, T8 ?- n3 b$ g
- /*#define EDMA3_DEBUG*/$ |- o8 o+ u& T- ^4 `
# c9 Q3 \$ j. p/ L' m& h2 V- #ifdef EDMA3_DEBUG
5 e& I$ i; S# I! Z* g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 S! D. t4 z( Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 |0 L7 ~4 B, S' p. S5 @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, U" b% {5 L2 R* a - #else, P# D% N. r5 z
- #define DMA_PRINTK( x... )
- I# h3 I" m, u - #define DMA_FN_IN: ?2 Y0 Z" r/ \3 Z; t
- #define DMA_FN_OUT# [. r a. F. f' v% B
- #endif: Y2 W, |; E0 q$ ]$ k9 s( c) e" g
- 4 |0 _5 a# ~" ~0 b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 [1 i6 a" y$ C1 W* G - #define STATIC_SHIFT 3- D7 y1 b1 m0 V- s+ E( z# W7 {
- #define TCINTEN_SHIFT 20# D2 \9 ?% H8 w6 T
- #define ITCINTEN_SHIFT 21: G0 j1 g/ I4 D; {- X
- #define TCCHEN_SHIFT 22
/ o6 Y$ X3 z2 N9 R - #define ITCCHEN_SHIFT 23% r) z, j9 {/ [7 `" p+ `' v
* i' w5 T2 r2 i* V2 g9 y8 B1 N- static volatile int irqraised1 = 0;+ H4 q, ~! x0 `. l
- static volatile int irqraised2 = 0;
. s9 M) @) s. W# A% s( I$ v- }! i - / j, x d/ m) } A3 M( K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! m# F* }% k0 B5 G6 } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 v3 b8 b$ x2 ]8 n! {) p/ P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& u A: w: [" l; j+ c" Q i( a
( }. @" l3 ^: A9 t; [- dma_addr_t dmaphyssrc1 = 0;
3 I. K2 u8 c; b. u% s" V7 Q - dma_addr_t dmaphyssrc2 = 0;
. v+ [% f; l1 G' ]: d% X' j - dma_addr_t dmaphysdest1 = 0;
& i d) v2 _7 @1 A; g - dma_addr_t dmaphysdest2 = 0;' l1 `, w- j) Q6 @% p! V
- e9 G% d# f/ e# {4 W: Q, a
- char *dmabufsrc1 = NULL;; Z2 G% \9 w5 Z; m9 P
- char *dmabufsrc2 = NULL;0 x, i& W; Y) l1 h4 g
- char *dmabufdest1 = NULL;
: s0 C# y' @+ x e- q# M - char *dmabufdest2 = NULL;7 q8 F- O8 f* I/ X
% g2 S' p2 t; C" M( l/ |( _- static int acnt = 512;
( b& L8 P! D' y( p3 u' r - static int bcnt = 8;- O: F& p0 B/ n% V5 Q: o
- static int ccnt = 8;
) z% M" V+ t3 J9 J5 ` - " E" ^8 H. m" o0 Y
- module_param(acnt, int, S_IRUGO);& }! ^( m2 |* K* \$ V& N* ]
- module_param(bcnt, int, S_IRUGO);4 U+ ]- _: {( M6 ]
- module_param(ccnt, int, S_IRUGO);
复制代码
! C: K; l, m& b7 n+ K) a) R- @; n8 ~, S* n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 o1 f1 _% p+ m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 g8 |" K& L& i7 i3 K3 y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 P5 F; w( o# j! r8 c' H9 V9 x( e) q0 k2 K4 C
+ e' G& W& |: M2 {3 ~ |
|