|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ |$ p2 ~; p6 m- [code]EDMA sample test application
: s1 n" b. |0 ]2 v; C0 [ - /*3 X+ H2 x3 c6 i6 }+ I& ^" [9 I7 `
- * edma_test.c
+ s* _/ f/ ~2 ~/ l1 u" A - *" O2 ?; p; j3 r" S" B% X, _
- * brief EDMA3 Test Application
# m8 V1 `8 z6 E - *3 r( T) h/ C6 N5 Y# ~$ @# Q
- * This file contains EDMA3 Test code.% M5 j" f8 ?1 q5 Z( a, z$ I
- *. [. a y3 o6 r6 W B6 M: e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: P; Q$ {. `) c! X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ v/ K2 H% J1 c - * TO CHANGE.' U6 a1 H! w$ @* Z( L a8 b
- *
* p4 c; p! m; q5 j U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" o# B3 Z U4 g6 q e# j$ J
- *+ r- m9 O+ [3 a
- * This program is free software; you can redistribute it and/or
0 O% J5 k0 F( T! F. O - * modify it under the terms of the GNU General Public License as2 U% [6 d7 z: a u) _
- * published by the Free Software Foundation version 2.
0 d& e: O5 _ V) X' P3 u - *1 U5 Y3 A6 v, [& w* f- H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 ?6 e/ z1 H" _; ^$ J6 M: _+ n: t
- * kind, whether express or implied; without even the implied warranty+ o2 S: v' @- ~3 A3 C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- x" u2 {3 o! z9 e - * GNU General Public License for more details.
* X( B9 v( X; n. G/ D - */
+ L1 n+ c' M T( X! P9 w# | - * k* m4 A, z1 w8 u: i: e L% B( n
- #include <linux/module.h>
1 n* n T4 r8 O1 V+ X2 n - #include <linux/init.h># d( T9 K: ^/ a: A; }& E
- #include <linux/errno.h>
7 T ?: ~& M; s8 y& A$ L - #include <linux/types.h>9 M/ G: Z K2 h' O/ c, x6 y$ t4 Q# F
- #include <linux/interrupt.h>' D6 e, }9 M) Y
- #include <asm/io.h>
& Q: L/ U4 i- T2 \ - #include <linux/moduleparam.h>4 V2 n7 i, b `! y# ~
- #include <linux/sysctl.h>. H8 _: ^, X. y8 \7 X u
- #include <linux/mm.h>8 s, Z! i4 }9 b
- #include <linux/dma-mapping.h>
! N. A E* z, [ x5 v8 h3 h8 U8 u
( P! X$ B$ k* y/ x# @, |- #include <mach/memory.h> v1 |& L. o. ?8 B5 R2 m
- #include <mach/hardware.h>
; k& I$ e, V3 x3 Q - #include <mach/irqs.h>
5 p, c: ]" s1 A - #include <asm/hardware/edma.h>
4 U* j0 u/ p* F% h! G# s9 |& f - 0 o! @- |# L! a" _+ h1 I, V5 ]8 o9 Y
- #undef EDMA3_DEBUG
( o5 l a# Z( m5 w, M. j/ t/ @ - /*#define EDMA3_DEBUG*/
5 q1 R( D0 U5 J7 i4 Y- ]
; c% p4 t7 d% M1 M! n- #ifdef EDMA3_DEBUG& l3 s6 N: {$ x6 a5 d, I- y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 h( W% z- D, ^/ ^/ M6 t) G! E
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( X! W. ^/ _$ x/ A7 u! y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 ? L, f3 M& ^ k9 R- f - #else
6 [- P" {( j- y# ~8 T+ E - #define DMA_PRINTK( x... )
- t" C, [+ o4 U/ D - #define DMA_FN_IN
: L3 }# Q, V1 W7 a - #define DMA_FN_OUT
) U5 a$ U U U6 U& s& T - #endif
7 m% d- E! w; ~ v+ }! P$ f - 9 ?3 y c$ c' x9 p0 G6 j+ q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( C5 r& p0 S4 z# J- o! H! s - #define STATIC_SHIFT 3
) h! P# `% s0 a7 h) ?1 r! x' R - #define TCINTEN_SHIFT 20
, P: D9 A; p& u6 X - #define ITCINTEN_SHIFT 21
) P' c. ^4 \* U - #define TCCHEN_SHIFT 22
5 u! s0 o- v: b( ]9 B( ] - #define ITCCHEN_SHIFT 23
5 U7 N5 o& A5 I9 ~/ k5 l* p
6 t: r$ t/ Z5 G7 V8 S- static volatile int irqraised1 = 0;, C# B! @( z2 Y+ I; [
- static volatile int irqraised2 = 0;( f% z& W, x# D: [& b+ w, m5 V
3 h, [1 g$ g+ M- ~- `3 P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: A! H. ~, |) z$ V5 e' t2 C1 v: M! C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, w! d, v% [% @8 {' A, T, d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% B4 l0 M5 n \: \2 N: Z, p
- / [( r- [0 n f* N, c8 o7 [
- dma_addr_t dmaphyssrc1 = 0;8 |7 R: Z, ^- E* X1 f
- dma_addr_t dmaphyssrc2 = 0;% U8 [; J/ J; E( O
- dma_addr_t dmaphysdest1 = 0;6 U: f8 E6 r8 [+ F8 D
- dma_addr_t dmaphysdest2 = 0;# h+ N3 y- h3 h) C- I2 R2 `0 g
- ( `/ L7 N Q8 n, N3 W, T, Z( q+ z
- char *dmabufsrc1 = NULL;
% B' A3 R; K `3 J# u2 N# { - char *dmabufsrc2 = NULL;/ L" b( U7 g/ c5 f, G4 L
- char *dmabufdest1 = NULL;+ H1 {& }0 ?# \
- char *dmabufdest2 = NULL;7 j" T* z- {% q, o% `+ c
' t+ C6 U* t- {. A: o- m6 b: L- static int acnt = 512;0 ?! i }% q$ Z l/ L, @
- static int bcnt = 8;
8 w; `, P$ y( o e3 b! |' y - static int ccnt = 8;7 g9 s- z4 F0 s& L
- C2 @% g8 R W0 O$ R
- module_param(acnt, int, S_IRUGO);1 j1 c9 X( D* x$ e8 g
- module_param(bcnt, int, S_IRUGO);
% h1 W5 K/ i' F8 g - module_param(ccnt, int, S_IRUGO);
复制代码 " u2 X _/ c$ E
3 L* a' J4 L$ y& k1 i7 @9 p0 ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 |( i& ?8 @& ]1 T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! v4 ?( T) q7 e8 E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 D/ s+ [' l& {6 c6 r8 O; B, P
8 t, C/ B* |, ~, t: ^+ X3 Z3 ~2 k2 i' O4 b b
|
|