|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / l7 b! B. i$ K6 b* x; |2 m: x
- [code]EDMA sample test application+ ~3 `1 g! F4 I
- /*
" @# e1 Q0 K T4 B1 l - * edma_test.c R% x- K: @8 c5 U1 T& R9 c
- *
0 B9 Z) `! {$ [- y/ P' [ - * brief EDMA3 Test Application- w6 |! z# e5 X
- ** Z. R- Z( v* K T2 C" y; E
- * This file contains EDMA3 Test code.0 m! F4 F6 ]& \" A" X5 `
- *
0 }/ f( b9 ~' ~- n T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ X9 s% h/ O6 X3 L- R! u& ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ `1 @ \4 j: a" e2 H& O - * TO CHANGE.
: {, s+ V& ]8 h - *
$ G* o- `& p5 p5 W3 _5 b# o, T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
u' t+ f3 V2 ^+ N$ @ - *
H8 Z6 Q/ n* Z! a9 G) u+ w - * This program is free software; you can redistribute it and/or
: i. l) z; j# _* c0 ^ Q8 h/ N - * modify it under the terms of the GNU General Public License as
( N! o, c) O7 b: R - * published by the Free Software Foundation version 2.
- A2 B# @6 a- Q# F - *
( R! f: q5 d" y0 q. ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 E' N* U* e, F - * kind, whether express or implied; without even the implied warranty p, z0 ^9 A) i. v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 n: a5 s- _# L - * GNU General Public License for more details., u) N0 B0 s& j
- */
+ k4 X0 h b" X A, o! \
. v- [ S: J+ y2 x+ D3 m% p1 i+ X- #include <linux/module.h>
' n+ I' |1 X+ [9 M3 I - #include <linux/init.h>
& t5 |) O$ \+ z/ k - #include <linux/errno.h>* H0 |) J9 P; y6 D- L! \% J+ v0 {
- #include <linux/types.h>
- C# z" {8 l1 U+ {4 S+ E( k F+ s - #include <linux/interrupt.h>! P* r( a* H3 h" @& U
- #include <asm/io.h>
" ^& _- {# w6 ~8 j; N. r" t - #include <linux/moduleparam.h>, Q" K+ \ R, i
- #include <linux/sysctl.h>8 V4 e1 d. D3 J8 L1 W+ p6 U4 O
- #include <linux/mm.h>' f# S1 m, P, }! P% k, \0 J4 c
- #include <linux/dma-mapping.h>
7 J6 m9 k3 b( m1 z5 R/ s# U - ) L- M+ N; Y1 H) h4 g5 E
- #include <mach/memory.h>
; k3 c8 @5 T+ K; V* f" s; T - #include <mach/hardware.h>
& m m9 n# p3 q, k, o - #include <mach/irqs.h>1 I5 j, Z7 B8 C) Q4 L; j0 |7 g
- #include <asm/hardware/edma.h>% A' ]$ H9 J" o$ I- K" _
7 x) R/ u6 z( b W- #undef EDMA3_DEBUG
7 x" w: ]# ?# ?8 ? - /*#define EDMA3_DEBUG*/- Z, c- e* \: Y+ d! H% T. d
- 5 h) z7 M' G1 P( j" E8 x3 ?# G
- #ifdef EDMA3_DEBUG
+ r7 g9 {; m* r N3 u3 }) r/ ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ t* g$ K( Q; ~! b5 { K* f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; h8 X5 I% {( P# P6 V4 A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): n/ G: X8 j0 N, I$ |
- #else0 Q5 J+ c5 M2 {$ j/ x* v
- #define DMA_PRINTK( x... )
. w7 ^* _* z+ ]' Y' O* _- r - #define DMA_FN_IN% Q: B' N r0 Q8 v, e4 G8 Y/ R
- #define DMA_FN_OUT
' X) f+ J/ E6 n: {( r% \7 L - #endif+ A% X K; c& ?) K
- $ W9 V& Z! W3 t( r N; ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 ~% f6 r9 R' Q4 Y* a% ^
- #define STATIC_SHIFT 3
8 g* @# d5 l8 C9 j7 n0 |3 ~! f - #define TCINTEN_SHIFT 20
! X4 J5 J6 f# H6 [ - #define ITCINTEN_SHIFT 21
; {/ E( o% X* F+ U - #define TCCHEN_SHIFT 22" Q, v' c4 }9 r2 q2 E6 I% o
- #define ITCCHEN_SHIFT 23! k* t; M& K$ Z; i$ W- l9 G; n2 E, q
% n4 y4 F, Y( J c& x& o" G- X, k- static volatile int irqraised1 = 0;
2 L) Q& f1 E! p) B0 m - static volatile int irqraised2 = 0;
/ o6 ^! @; e7 j- @
; D5 {/ A" g$ x7 u$ b, o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* p. Y# f: m: F7 ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
z! z. n4 J' K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, B' _* B; z% ?! P
) N) Y" j; C/ ]) V( k- dma_addr_t dmaphyssrc1 = 0;
1 c! |6 k0 N& V3 L3 v - dma_addr_t dmaphyssrc2 = 0;
9 F3 V: t6 t% n% c# w - dma_addr_t dmaphysdest1 = 0;. y: w1 x; d& _* b$ P
- dma_addr_t dmaphysdest2 = 0;8 I/ ^$ }9 ?& J
e. k3 T. a6 b2 |: r- char *dmabufsrc1 = NULL;) T: g8 [2 J0 ?/ d9 E; {* n0 F& p( u
- char *dmabufsrc2 = NULL;4 i5 s K6 f, [% z% }* P" K; e) {
- char *dmabufdest1 = NULL;6 P& f6 D0 x- V. T' C5 ]
- char *dmabufdest2 = NULL;
7 M- A0 w+ \/ f" f - ) X; W( |8 R/ M+ Z# Y0 X2 C1 V* }
- static int acnt = 512;
# p/ p- m7 }. D. ^/ ~0 X - static int bcnt = 8;" j. P/ h. p4 @
- static int ccnt = 8;) i8 y2 }: n% u9 R1 L( y
- 9 {; g0 i1 c( W# M7 h
- module_param(acnt, int, S_IRUGO);
1 i- x5 y( m% ~5 q2 F - module_param(bcnt, int, S_IRUGO);: a! a7 z5 e- n( }# W
- module_param(ccnt, int, S_IRUGO);
复制代码 3 K' P2 ?) g" n7 Z
! ?2 @1 \0 f; B1 m: M1 | 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ v7 @- A7 x; O4 R( R$ `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 X, }3 K) y0 C5 M: l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" _% P2 g0 J( G
: c, B8 M, w8 v E2 g6 i4 [/ n; Z4 W
5 N/ R, P9 s" h. I2 g |
|