|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . `; E4 B: e& Z; M; i
- [code]EDMA sample test application3 L. ?! F% c, `; G6 B$ n8 d
- /*
% O) d5 {) Y1 h4 S- W" }% T2 W- C - * edma_test.c
+ U3 | L2 b/ s& j; p/ i: e - */ J$ q/ \: V/ h" Y+ x
- * brief EDMA3 Test Application
- ?. z8 m" u* N; {% C; a- [. x - *, p4 e( g- `2 C& n+ b3 X
- * This file contains EDMA3 Test code.
$ D* Q3 e1 Z, r+ R) E4 F1 S - *
* a6 w; Y: b2 i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* m: i+ a* N h3 v" v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT I' G9 t; T7 Z
- * TO CHANGE.
* o( q0 s3 a0 t6 {3 V - */ ]: i7 I( P; a5 p5 `6 X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' z* Y2 I# q E- K - *
. E6 s" a. o) M - * This program is free software; you can redistribute it and/or+ j* V' Q% U9 m) }. I1 L4 ?! R
- * modify it under the terms of the GNU General Public License as
" M8 U$ `: |9 U, w: G) S% n4 [ - * published by the Free Software Foundation version 2.
+ v8 }5 X u/ X) C T* f - *4 e3 C6 Z$ k) A7 B z! B7 u2 G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; H' p- W }. B. t/ [% r# k4 [& ] - * kind, whether express or implied; without even the implied warranty
3 D, v2 ~4 g6 D* k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ I5 T! M: M- a* y0 A/ D1 j/ `# B
- * GNU General Public License for more details.- ~) {0 Q, @) T' w% Z7 ^
- */
0 M9 ?8 P) f6 v+ I
& H! w) q6 g5 a! K: g; m/ O- #include <linux/module.h>
: P* @; h. C5 ^! N# W$ w$ X9 S - #include <linux/init.h>
- E) T; n+ X7 G7 B1 V& e& y' j - #include <linux/errno.h>
/ ?; e1 N7 L8 u g9 f. { - #include <linux/types.h>) W5 y# Y. H: E6 k/ r, W6 d2 a1 t
- #include <linux/interrupt.h>
( ^ G+ |1 L- a8 { - #include <asm/io.h>: T4 G7 j* t9 G. X4 [
- #include <linux/moduleparam.h>4 h; j- O. P8 |" q N, [4 c
- #include <linux/sysctl.h>
9 ^4 s& a J8 k - #include <linux/mm.h>4 S: R8 r$ x( _6 z& Z
- #include <linux/dma-mapping.h>( {& @& b2 a& |2 f
2 B& z# _) q- t- #include <mach/memory.h>
& n6 F. N4 n# b4 x7 n3 o - #include <mach/hardware.h>2 l ~5 }# f0 M5 K
- #include <mach/irqs.h>
; U8 C' x1 S* c - #include <asm/hardware/edma.h>
9 a f( q; @9 W3 U
& B$ _/ ?2 ~) p, W2 \- #undef EDMA3_DEBUG
0 G/ F, u& R7 h7 L, F! M0 n - /*#define EDMA3_DEBUG*/
0 S1 V- V2 O |, G) R - ) s% g- E( R% \
- #ifdef EDMA3_DEBUG2 I5 S3 q( c. m* \! O; g" l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- ?3 }$ v& _( v) a4 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( Q" u1 F7 U+ k @& \! J! m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 c- U2 b& n" @2 N: X
- #else( w& w" S) J: ]$ G
- #define DMA_PRINTK( x... )+ f& y' w6 v& J" x8 n) {4 |
- #define DMA_FN_IN
: B; S. g# K b# C& O, [ - #define DMA_FN_OUT
) n3 }0 z- `0 `( @4 ^ - #endif; m0 F! G( n7 j. w
- H9 k [, E- q: H: S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- T1 ]1 a0 O, p4 U: ^3 r! ^0 J
- #define STATIC_SHIFT 3, p, ]7 B7 t3 Y6 Z t1 L
- #define TCINTEN_SHIFT 20
/ \# N# J- s( |" j - #define ITCINTEN_SHIFT 21. e; X1 j" X3 S
- #define TCCHEN_SHIFT 22
I. \& t" j2 R" b5 r( v - #define ITCCHEN_SHIFT 23
) n: G* ]4 f; F% E" ~
: R" W* E" i& f1 }9 ?- static volatile int irqraised1 = 0;+ N0 E7 l; g; ~- c# E
- static volatile int irqraised2 = 0;) F8 ^ E+ `9 J& ^9 V. W/ { t9 f+ ~9 y
- 0 o/ d C$ Z' o7 B/ {% Q$ ?; n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); x5 [. J+ G5 E; \2 w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ?& g; J7 F2 l+ S/ g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* N% r B5 y/ W4 a
4 h8 i0 `9 i0 K0 M5 p3 M" `% p/ n- dma_addr_t dmaphyssrc1 = 0;: z2 H5 ~8 L( ~; \
- dma_addr_t dmaphyssrc2 = 0;* \7 V8 e, o; X6 N- s0 P) X
- dma_addr_t dmaphysdest1 = 0;0 `' K# q% \) I; Q$ r+ U
- dma_addr_t dmaphysdest2 = 0;0 h6 Q1 Q/ W A1 \5 f$ h% N& h# k
. a5 ?% p' ~% G/ ?0 N: y- char *dmabufsrc1 = NULL;
5 u% }/ g$ m4 g6 g' ~+ I+ l( x - char *dmabufsrc2 = NULL;
" G. j6 O- k8 O* c) C; Z - char *dmabufdest1 = NULL;
: o5 Y6 K. ]- o2 t/ j/ w - char *dmabufdest2 = NULL;
! c6 F1 T) L! `0 F9 D/ l7 E" W" m
7 Y0 p4 N' b! p5 w: y( W: ^- static int acnt = 512;
5 f4 D) l5 d* {8 [2 E! y- Z - static int bcnt = 8;! z1 c, i" j! T S2 |
- static int ccnt = 8;
4 L. N, q0 Q. o4 |" t
1 d) F/ e2 n% G$ I# Z- module_param(acnt, int, S_IRUGO);
. \6 P3 } x* X4 Y - module_param(bcnt, int, S_IRUGO);* d0 q' I8 A# ~
- module_param(ccnt, int, S_IRUGO);
复制代码 % f6 z' Q9 x! O' ^. T( E/ w
; y/ B8 h7 c/ S" b% x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 F' w1 s9 U& V- v. E* k& J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( _% E8 M" G) |$ C" c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* G+ Z0 J) C; {: c+ R5 m$ i3 G. _; D* g/ }
+ G0 m% d8 G2 i5 C, \; q/ F q6 } |
|