|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 K! \0 |) Z" M* ?( ^
- [code]EDMA sample test application! t5 ?6 X( R: Q5 x
- /*
. z0 p5 p% ~5 U5 F - * edma_test.c
) L; D0 @7 X8 D& p7 v/ j6 W - *
1 y1 j( k' J( N* r - * brief EDMA3 Test Application7 }7 h8 q' b0 _) ~9 m+ d
- *4 N7 e, G+ H3 D
- * This file contains EDMA3 Test code.
6 c) ?/ V" C$ f) E Z - *
& v# ` K4 B, a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" X! }* z# q8 ~$ {" c* q; M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 r3 \* J* r; t' P9 Y" T* O7 Y - * TO CHANGE.0 m0 n4 c' ?" ?$ a: r' r; o" B
- *" y! G2 k" r, h8 w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 V2 Q: I1 I4 r) P4 j - *
' f7 A* K' S' T7 ~& [ - * This program is free software; you can redistribute it and/or
; ]) u+ V4 B, B( g' _ - * modify it under the terms of the GNU General Public License as6 K' {% e. J& x9 E1 W- \2 _* K" X
- * published by the Free Software Foundation version 2., E) G$ W9 _' O) u: ?
- *' J9 w" |- B# i- E) W$ \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 H. r: i; V: L' m5 D7 `2 g5 A - * kind, whether express or implied; without even the implied warranty8 M1 v+ \: B% U M$ y1 H( D% L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. G# p5 q5 u2 Q( n
- * GNU General Public License for more details." q! j7 n6 t. @/ D; u' \7 M
- */
( e- B+ n U, I7 w6 E3 [- A
. N1 I- _2 D9 i \/ n, E* n2 N+ k* D- #include <linux/module.h>
( n! H7 Q8 C* L! y- [/ h% V4 J - #include <linux/init.h>8 V. D4 g2 g! \! H7 \* y! e: l
- #include <linux/errno.h>; \3 L) D6 k2 J% K4 H
- #include <linux/types.h>
4 y" u* C- {' @. H& s/ \, P - #include <linux/interrupt.h>5 U1 `, o" b. e( E$ a- M* N3 P
- #include <asm/io.h>
6 S5 O5 P7 k" n0 f3 y1 m [ - #include <linux/moduleparam.h>
/ Z$ _0 q4 }" L9 y - #include <linux/sysctl.h>" t, x& {2 h& a& c
- #include <linux/mm.h>
7 Y! M9 Z5 r* j8 Y" s - #include <linux/dma-mapping.h>0 O. j, [ g- b) {
: ?: {* o# S3 c- #include <mach/memory.h>7 ~! B' f4 g/ t3 x9 `+ P
- #include <mach/hardware.h>- n! h7 U7 q% Q+ d. {; A$ @; E
- #include <mach/irqs.h>0 J+ G- Q( _' M5 S4 a1 q( N1 n8 v
- #include <asm/hardware/edma.h>1 W: g) U9 Q6 b7 @0 C: N
- * O3 r6 I8 }8 e( X
- #undef EDMA3_DEBUG- G% F& T* M/ z, @" M
- /*#define EDMA3_DEBUG*/
8 u) a7 \* A% G - - f: {, t- I2 d
- #ifdef EDMA3_DEBUG& O, {9 P* v: \6 `" B, L v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; f" K; Q! J& t" e6 z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, N O: f( z% L8 A. y- e3 F& d5 X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 R% W- l* k6 c0 Z/ t$ ~! l
- #else% Z: ]' v9 M, j3 U
- #define DMA_PRINTK( x... )
! x9 h2 _' U: x9 }1 E - #define DMA_FN_IN( p( F8 Y5 n7 x$ V8 Y6 H: y
- #define DMA_FN_OUT
( L# h/ r. n& q5 I - #endif- j" m6 i [! _6 @: O* K# Y6 n% T
7 i( { P. q: y, v5 _4 g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 q7 a. ^5 w$ w/ G: F c& c
- #define STATIC_SHIFT 3
0 F6 M' u+ P% \$ ?! ^ - #define TCINTEN_SHIFT 20( D: ~! a+ d/ M. r
- #define ITCINTEN_SHIFT 21
# B% d# K3 Z+ I; V$ _1 |) @ - #define TCCHEN_SHIFT 22; c6 I w: d4 F) d9 {5 a' H
- #define ITCCHEN_SHIFT 23
% q: M, f7 W! Y4 r
) i' ~' K. e; T7 X- static volatile int irqraised1 = 0;9 _8 K# n. R# q
- static volatile int irqraised2 = 0;' c* | {3 @) Q0 e
8 y; N/ X$ T. X6 R$ d) A9 E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ]" d4 P( A1 u% ?) a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, x% f' K. P) J) O( ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. G4 x' H" A- O2 g7 T& w( l+ g
* x8 _9 }$ ` o- g, a- dma_addr_t dmaphyssrc1 = 0;
4 l# d! t! R$ B/ Y, ^ r9 E - dma_addr_t dmaphyssrc2 = 0;
+ b$ y0 n+ o: y- K - dma_addr_t dmaphysdest1 = 0;
. V0 P+ w3 g- b& B - dma_addr_t dmaphysdest2 = 0;
; V9 z. z9 b1 S/ T4 B9 V& b - ; j i B$ P( d4 Q
- char *dmabufsrc1 = NULL;
: q% Z7 B5 x# ]- f, v* m: ~ - char *dmabufsrc2 = NULL;
4 B! A# `) C8 E) G - char *dmabufdest1 = NULL;
, ? ~- h2 k9 Y2 N, r2 J - char *dmabufdest2 = NULL;. T) N2 C p) \4 U% e
1 Z: i6 H4 p+ C: ?- static int acnt = 512;
8 _* q- ?( y2 E4 S1 v - static int bcnt = 8;& ?) Q6 C7 {% [6 m0 L
- static int ccnt = 8;
* K1 T6 \1 z# s, ^. T* u% _* O6 @ - O6 \2 g' L4 t$ X
- module_param(acnt, int, S_IRUGO);0 ^; N% ? j: r2 S( p; h+ o
- module_param(bcnt, int, S_IRUGO);7 N% A, `1 f6 ]
- module_param(ccnt, int, S_IRUGO);
复制代码
, g! J$ R1 z* r+ M) @+ `
% u: {, E* N* |" w) v5 L8 H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! }5 E# W) K( ?. R x) b. n7 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% k: t- e8 g5 b4 r2 T+ q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) S6 j3 A! r0 u: X
7 Q% _1 e9 h4 P, B$ d! k4 _( x
0 C# n9 ]. x2 I/ q- I" g$ q5 F C |
|