|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! j5 D1 x/ f5 l6 b1 ?- I" [$ u- [code]EDMA sample test application
2 ~+ M6 B: i. ^! T - /*
* h- U- V* z( B- X) H0 f& q - * edma_test.c
7 r! S# l* @# [" O9 }& u- C6 j" A M - *
- a2 i' n; W" h' N% H: j - * brief EDMA3 Test Application
, V. p- D" n2 C J4 @# `5 j - *4 u" w* u" y; @/ L+ G) c. S
- * This file contains EDMA3 Test code. ?& V8 M1 B+ D0 ~
- *
2 X# {4 Z. K" v4 c7 p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 z0 Z' F+ V* p7 ^, C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 O+ w0 k/ h3 l- `9 u - * TO CHANGE./ X* b% Q6 |; _! k
- *6 z9 H' y. L9 f; A8 A" Q8 S( b/ r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. q9 L; s! x3 \5 E4 a: p
- *
4 d. K" C7 @/ c* q- p - * This program is free software; you can redistribute it and/or
$ A) }' ^' y& T% B* W - * modify it under the terms of the GNU General Public License as$ i; [( ~# C- a# u! a: e
- * published by the Free Software Foundation version 2.8 K5 b( `5 [: C) v
- *
$ A; F( Z7 Q0 F/ Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" C' l' V$ m6 A' M! [) C - * kind, whether express or implied; without even the implied warranty2 W4 S) _4 v* l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" [3 M- T5 f- L% U" w - * GNU General Public License for more details.
$ |+ q+ m1 }& G: s - */
) `3 V0 G) `, g8 f7 Y p% G. \ - ! z& b6 j R# Q
- #include <linux/module.h>
% R, L: z, {! c* x - #include <linux/init.h>
7 w, i8 |! b4 x9 ?2 D9 H# \9 Q - #include <linux/errno.h>4 [( A! \( R1 v8 S4 p2 n$ ^1 U
- #include <linux/types.h># i( s5 b# f8 h, u( a! m' i
- #include <linux/interrupt.h>" }. [8 _. N! s! L% c/ p! ^, W+ n
- #include <asm/io.h># k% N/ j/ E& P+ Q) S2 y& q
- #include <linux/moduleparam.h>2 H, I/ _5 e$ ~9 X
- #include <linux/sysctl.h>
! T- L, w4 T w - #include <linux/mm.h>
& y) A! J+ F( V: v/ B& t' d/ h - #include <linux/dma-mapping.h>
z5 K( L5 |, [- Y - " P8 L N7 K" s$ ?- Y
- #include <mach/memory.h>
8 t2 D+ W' k- z" A2 q - #include <mach/hardware.h>1 s- S4 A0 b+ a( ?2 x! A u
- #include <mach/irqs.h>
. M0 Y ]# z& L% E& a$ {8 z - #include <asm/hardware/edma.h>5 S4 P; D$ T6 `. O
- ( A! h9 r/ J9 W1 t; T2 G6 H
- #undef EDMA3_DEBUG! O- x: V; j) Q+ X. k$ {/ \+ M
- /*#define EDMA3_DEBUG*/
3 W8 L s4 S/ f. ^7 J2 Y - , I x+ K4 b" f4 f
- #ifdef EDMA3_DEBUG
' T# D) q1 ?9 ~' H5 t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' d8 p/ @. R2 U; M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 X: `- }- V6 t# I8 p- J( N6 `+ I* s1 ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 d3 W) O. C. H2 ^5 C
- #else
, j- b) w: c. V - #define DMA_PRINTK( x... )
$ q6 ~, e' X, ] - #define DMA_FN_IN
" H9 j; ?7 I7 |8 ], _# K9 \ - #define DMA_FN_OUT. E) }" j j/ R* n6 ~9 X* ?2 a
- #endif/ \; }' U1 U: e; ^% r
+ l- t5 x6 Q9 t; u; e. l: s/ h5 c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 G e- E9 m, \8 a# t# P& O
- #define STATIC_SHIFT 3/ Y, U6 R% q' T. r7 t; r
- #define TCINTEN_SHIFT 20
' ` _8 H- P9 o) {5 o6 |9 Z - #define ITCINTEN_SHIFT 21
/ f/ }1 l+ f/ g' g1 q - #define TCCHEN_SHIFT 22
8 H/ O7 F/ p* V6 q) _8 z - #define ITCCHEN_SHIFT 23
4 T/ @- ^8 D. [4 D. n - / D% a/ \3 u, E4 W
- static volatile int irqraised1 = 0;* h% M1 m! p# ~! k' z: l. K
- static volatile int irqraised2 = 0;, X4 m" t3 {0 x2 l- x
9 _2 W- x9 M4 [/ E- k& e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ W6 n( F. _: w2 o# t+ [# K J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ~- }9 j" A1 H5 ?7 o7 Q: S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 \+ e" ^) d& W3 R6 L) X
T$ Q( M) U1 b7 D) V. B- dma_addr_t dmaphyssrc1 = 0;
* F3 i) U* {- m# d3 \ - dma_addr_t dmaphyssrc2 = 0;
' a$ w; d" W T0 ]) ? - dma_addr_t dmaphysdest1 = 0;
' @$ ]4 R7 @; N - dma_addr_t dmaphysdest2 = 0;/ y) A, I% U7 \. g
) z- Q# q$ M1 H. J/ x. Q- char *dmabufsrc1 = NULL;
) D+ \- V# J) V3 W* G) A9 v" c0 h' S - char *dmabufsrc2 = NULL;
& K. D7 C- G' O& w+ @2 s1 c: R! D - char *dmabufdest1 = NULL;
3 W) v6 q# Q! }# _& D( Y - char *dmabufdest2 = NULL;! F5 T/ {8 a h8 l p
8 J4 J% o+ l+ B( s, q! f- static int acnt = 512;6 t4 {7 x; E8 q6 j
- static int bcnt = 8;
5 e3 _2 a8 L9 l - static int ccnt = 8;% w- N2 v6 C! n; i/ d( _
- 3 A; e- M5 a, R5 d. c
- module_param(acnt, int, S_IRUGO);% @- b p! u: N; d& x v, S
- module_param(bcnt, int, S_IRUGO);4 H; g* r9 D- ], e \+ a8 ^
- module_param(ccnt, int, S_IRUGO);
复制代码 0 ?- m& P. b0 ?) l5 a6 l) i
7 T) ^0 |7 P7 m E1 y6 y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( p+ X* g; w8 g' A' V- z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ @: s% D$ \& Y" h2 h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) ]* U; G0 S8 g1 T' w4 r8 s( v# o0 h; k# z5 g7 L
7 L" s4 k' I) G* @& Z
|
|