|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 `! p- g5 G- ?( o d- [code]EDMA sample test application$ I/ b2 d) p+ @5 ]
- /*
* O/ [% o% P+ k" B4 x - * edma_test.c8 g3 }7 u" g2 E: A$ T( |) J* r
- *
6 ?6 b6 j# s/ j) Z6 x$ \1 s - * brief EDMA3 Test Application
/ r- F& X/ T: S* P' H# q" W# J) M4 W - *7 T& n3 i! `6 U9 E
- * This file contains EDMA3 Test code.0 v3 u+ E+ v2 X3 F( v6 q4 ]' \) \0 }
- *
; g3 J: P0 z9 B" t# }0 C3 k4 w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" h: K( \7 b' g$ S0 M) t0 H8 l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) Y: U3 C2 \3 f, ]8 n b9 L
- * TO CHANGE.
* \3 L+ W- O0 v- ]; M/ ] H - *" t. r3 O m) A0 h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; [5 r5 l3 \( q8 ?5 s
- *
& z9 e4 g1 J/ f f - * This program is free software; you can redistribute it and/or" e9 t ? S4 b
- * modify it under the terms of the GNU General Public License as
! U+ @- |3 m9 k* y1 v" M - * published by the Free Software Foundation version 2.0 _6 O1 _. a, _- G9 ]
- *2 A% i* h+ ?$ K+ K4 l; f) t3 `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 ?+ {8 {- Q* V% p% `# Z - * kind, whether express or implied; without even the implied warranty
- a: y+ f5 `; a4 G8 B0 W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' K7 P: K$ B. ~2 a' v
- * GNU General Public License for more details.6 l2 [+ x- F( W* Z0 Z
- */; h2 Q9 S2 C; B D9 H% ^4 {
3 \5 z' R4 x/ y7 T) F O9 V- #include <linux/module.h>8 N" {. V/ ~' u( f
- #include <linux/init.h>8 j i+ ~, c6 G! h+ t; W- l: x
- #include <linux/errno.h>6 \4 X2 D Z% D" J
- #include <linux/types.h>& F" N& L! ~$ u, u
- #include <linux/interrupt.h>9 W" z! H4 W" [1 N! O
- #include <asm/io.h> N L, s( V3 G! A5 J2 I: I4 G
- #include <linux/moduleparam.h>. u, y- K3 g g2 o* @& i3 l- Z
- #include <linux/sysctl.h>9 H" L6 B0 U, ]$ v( Y
- #include <linux/mm.h>
- P3 J+ N' E/ R5 Q: ]7 B4 f - #include <linux/dma-mapping.h>
& [8 n# W4 Z1 @8 @+ F" t( |! B - 1 V6 V, m9 k' u) n& N
- #include <mach/memory.h>
' ?* P3 H6 l! @3 K - #include <mach/hardware.h>5 O0 S7 ~( T" x, {6 ?
- #include <mach/irqs.h>; b1 a3 D- J4 B* D
- #include <asm/hardware/edma.h>( F/ n( \' F+ i6 I4 q; J n6 Y
- ) h2 S K* I5 G3 r4 t7 J; V: b
- #undef EDMA3_DEBUG
$ s$ {" y: _# T - /*#define EDMA3_DEBUG*/
; }( o7 T5 ^2 i6 F1 A9 E# Q2 m
6 j+ t( C& e; x! z, x$ k, M( ^- #ifdef EDMA3_DEBUG) J- s& Q! ]: Z3 @# @3 N2 j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 w4 m' p0 l2 f9 t8 v. q! l f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ \% ]# p" s7 a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 d* a& S( n$ m1 n0 V
- #else
! Y/ I% ]: j" a2 M9 ` - #define DMA_PRINTK( x... )# ]5 s% h: @" `4 Z* U6 T9 m4 I
- #define DMA_FN_IN
/ f: ^8 Q) b l j - #define DMA_FN_OUT
8 C* r" n% C$ \/ z6 B: ?. I, v - #endif
# o0 k! a% v2 z5 @5 M, h
* ?3 Y9 t `) i; N& d) M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 J6 X" a8 j& [& q0 S) k
- #define STATIC_SHIFT 3- ^; z$ }- n" i
- #define TCINTEN_SHIFT 20( M, V' B% U; K p/ ^$ U v9 ?. h
- #define ITCINTEN_SHIFT 213 e2 R+ h- k2 v6 H0 J1 l& y; Z3 B: m
- #define TCCHEN_SHIFT 22
3 b0 ~" D; p3 S# {7 C - #define ITCCHEN_SHIFT 23/ I- _ {; V0 m' G* B% c
- & p7 r* B9 X- a& y3 \ X1 _
- static volatile int irqraised1 = 0;% P9 w) U4 y" G: Y0 E
- static volatile int irqraised2 = 0;
/ d4 G7 y# C7 }6 f$ B$ q
# h C# L6 x" N4 c1 |. U* n0 y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# {2 c5 q5 q9 a; J4 @' V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, S/ C Q$ C0 O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* z) ]' B8 Q6 x* b" ] - * A V6 o1 g0 k# O! P* u; V/ _1 ^
- dma_addr_t dmaphyssrc1 = 0;
; P# d( s: c' c/ M9 K' m4 I4 r - dma_addr_t dmaphyssrc2 = 0;7 N+ j* G: ]% T
- dma_addr_t dmaphysdest1 = 0;/ {" \8 T- h( C# ?
- dma_addr_t dmaphysdest2 = 0;
9 A) H1 {/ ^) I4 b
: Z; T6 G. F3 F6 ?# Z \. V9 a/ h- char *dmabufsrc1 = NULL;% L( T) |1 m% s/ F" N4 u: t
- char *dmabufsrc2 = NULL;
9 G& Q, |8 q& l) k- T - char *dmabufdest1 = NULL;& h: ?& \% o7 y m. ^; \ _. x
- char *dmabufdest2 = NULL;8 s2 e% ]- O5 \9 r* X9 y
- 7 u* C3 j5 t/ Z9 i9 X2 _
- static int acnt = 512;! G7 J! a3 A% s2 H. I+ G
- static int bcnt = 8;1 C/ j4 C4 U1 ?. T! t6 V8 j. g; M# N4 W
- static int ccnt = 8;
% V( J) i: t( {- A, g5 u7 m
; i, V) G! m* |+ `! ?) l7 u( W! p( V- module_param(acnt, int, S_IRUGO);
2 Q. l y1 W# \' F& ~5 w) Z - module_param(bcnt, int, S_IRUGO);
# K, B! a, E" @/ V3 z* o - module_param(ccnt, int, S_IRUGO);
复制代码 / ~8 L$ q1 w! C4 E
E* c2 ]1 a" ~' S/ D" P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, j0 n K6 H( R" S3 y4 Z. e) Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: X9 p/ b# P! L6 R5 x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* i* f- j: ~: M) O! V& |
2 M) Y+ Q7 }- t0 k! N' Y2 ]/ J9 m& D! @4 {, l$ y
|
|