|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 n$ P" F/ K* P% w- b
- [code]EDMA sample test application% H1 t2 q/ g3 u" I9 ]) g- k
- /*8 ^: ]) X. O/ q& M
- * edma_test.c! T3 ]- ]" z. ]% x
- *
( b6 b3 I( h2 U3 ~9 {$ W - * brief EDMA3 Test Application
9 y1 l4 c+ f% a/ t1 ~ - *! ]$ ~5 i3 ~ i# F& k* b n
- * This file contains EDMA3 Test code.6 E3 U2 S) }0 b# [ H. i# w
- *7 u, t0 ^; J# D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: C% q1 j2 M$ [, F; L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
z7 Y" h8 w4 F/ Q9 {9 | - * TO CHANGE.
$ ^0 q- f$ o; i- l - *
$ f! o l0 p& `' i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 d' h4 x" S8 ? - *- N* L$ x1 P0 N+ B7 S- S5 B/ S
- * This program is free software; you can redistribute it and/or9 m/ T3 f% r4 W0 p' h; B4 |1 k
- * modify it under the terms of the GNU General Public License as9 ^# H: C6 \' G# W
- * published by the Free Software Foundation version 2.' P) n. P3 J P7 l# s. | R
- *
0 }9 Z3 y- Y3 r0 |! l7 w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% S% N* v3 g/ k, k2 w! ?, g1 s& F
- * kind, whether express or implied; without even the implied warranty( ]/ B" K$ _ A" D! h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 {4 p: d' Q/ b" ^
- * GNU General Public License for more details.6 j- q7 c9 G, `
- */2 \: o& y2 T$ f) g9 r
+ s% d1 T& y& C6 d7 K4 \- #include <linux/module.h>& T7 n2 D3 M) ]6 x- R& O
- #include <linux/init.h>
0 y8 m9 c5 n0 d- g - #include <linux/errno.h>0 m5 P& u7 L* @
- #include <linux/types.h>
2 _- x [, d' N" t - #include <linux/interrupt.h>
: V, t; A1 _: k: ^5 x/ M - #include <asm/io.h>
; V d5 H W$ W ? - #include <linux/moduleparam.h>+ j0 A, j/ i& L# a+ |( X
- #include <linux/sysctl.h>" l& _ B) K0 }9 T3 g5 z+ b$ u' l7 X
- #include <linux/mm.h># t# _* @, W$ [2 F* f( u2 c
- #include <linux/dma-mapping.h>
2 R- h1 L) @+ n! U; I# Q
8 D# P0 A& c8 m' y O8 _) z4 p- #include <mach/memory.h>' n1 s, i7 b- d
- #include <mach/hardware.h>. F W8 q% y' J) {
- #include <mach/irqs.h>- `5 s" C) {- G- S' z1 u
- #include <asm/hardware/edma.h>
' M& n- p5 i/ O- {. K. a - 8 i3 @# Y* C# c9 U
- #undef EDMA3_DEBUG: H' N C( [8 a" y# d+ N
- /*#define EDMA3_DEBUG*/
$ o( R* M7 f( L/ V, R
0 L/ D% [; a( G4 _" T2 T/ b% U- #ifdef EDMA3_DEBUG
. [* x: k; c. p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 {. H0 P9 G: j) a4 Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' X/ T [- P) n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 b9 A; u, `5 _9 ^) J+ l5 c' c - #else
* A) H i$ J7 G) S H7 m6 H - #define DMA_PRINTK( x... )+ C) @2 l, k9 h4 D* E F
- #define DMA_FN_IN
0 c6 s9 J# c4 T; M7 A( u/ C6 L2 M - #define DMA_FN_OUT
% |# [6 S2 Y) w! P - #endif
F# F3 ?* i/ m9 K
$ U, [4 N, @) y- t% \0 T' i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" W- J' y( ~! J6 S; Y5 Z- ` - #define STATIC_SHIFT 3
: \: t0 e' n) s7 J0 Q r: S - #define TCINTEN_SHIFT 20# W3 I- {( Z8 P5 \' Q7 O, \
- #define ITCINTEN_SHIFT 21
6 E7 S8 M6 [. }# n9 ^ - #define TCCHEN_SHIFT 22, Z; e0 o9 j4 a' r7 i$ K( w* v# a7 x- ^
- #define ITCCHEN_SHIFT 23
( q$ [$ z. q5 J3 i; F
0 _! [" @# f; C$ k8 J2 c; @. S- static volatile int irqraised1 = 0;6 p& v9 t1 t( e5 e! f( E. J
- static volatile int irqraised2 = 0;9 d# C" O* E: D/ \$ x, J, [
% q/ E5 e- L$ h) `3 ~$ b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" I3 B _% K% W' U9 Q1 m* P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 M# @4 m) i1 @3 Q9 a' S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 x) _; g6 [/ j/ F. b5 {
6 W$ C. E. v& u! D' ]- dma_addr_t dmaphyssrc1 = 0;$ z8 }# U. p4 k& n. v# z
- dma_addr_t dmaphyssrc2 = 0;
, C: `: A' i2 l1 e - dma_addr_t dmaphysdest1 = 0;& r6 d' g* d; M- t5 W: i" T
- dma_addr_t dmaphysdest2 = 0;4 F8 n! o, \ `0 m
- : k: J. f6 o( d a2 T
- char *dmabufsrc1 = NULL;0 y" v5 U0 _4 S' N6 @$ B
- char *dmabufsrc2 = NULL;1 m/ `& w0 U* U& H @. L
- char *dmabufdest1 = NULL;9 j5 b' J2 b4 Y7 J* w2 B
- char *dmabufdest2 = NULL;+ ^* V7 q6 W* F: q
( ], w1 T& g( ~" g4 q- static int acnt = 512;% N( l8 y1 ]7 b0 O- T, e( t1 q
- static int bcnt = 8;
/ G& {! z% F m" e; D/ O) _; }4 r - static int ccnt = 8;
+ V* ^. a$ V8 ]+ Z, c5 Z
! k4 f9 Y3 ^' ?2 z- module_param(acnt, int, S_IRUGO);
6 G6 E& v, g: J3 U; H& \# K; g - module_param(bcnt, int, S_IRUGO);
) G8 R- ^7 M( n' ]: H: u7 v - module_param(ccnt, int, S_IRUGO);
复制代码 + U" H$ a w' @) J: i2 Y) b* F4 q
+ P# S9 D0 ~# n& O: V4 B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, P s% C2 p. F1 n6 J( b0 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- O# Y7 v& F/ F# n( f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) `4 Y8 r) D2 S9 \0 E$ V+ t& R: l E; T1 P$ g; }0 E% m: E
/ W& d# D- a7 P( N4 E
|
|