|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# `" U: O$ Q C* ], `$ l8 @- [code]EDMA sample test application
5 G% u1 R9 j2 B9 w- r2 ] - /*
2 N1 L |: r, Y5 d0 {" u2 s$ S9 X - * edma_test.c
. j2 T/ B+ C- T E2 Z% J/ C. Y - *6 z% A* J, a3 T/ b5 D/ F
- * brief EDMA3 Test Application
$ Z7 {. c0 I+ ]3 H$ A, G2 h& y3 m - *
+ E$ z. ]$ R& k - * This file contains EDMA3 Test code.
9 X/ ~, A- g% q0 E5 f: d7 \) a - *2 [6 a, \6 t% J3 h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( t/ x, d6 F" `' t5 h2 m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 {4 p: {& w! d3 B% s- d - * TO CHANGE.
+ n0 Y2 }" {; e9 ~! F1 j - *' K# x3 N7 H: R' U& C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 q4 @0 ~3 t: r+ w: v - *+ z% i/ ^# w9 I8 w, ~
- * This program is free software; you can redistribute it and/or& l7 j6 p' E5 P8 I4 o2 N( C2 |
- * modify it under the terms of the GNU General Public License as6 G$ f5 x* {- A% c" D- s
- * published by the Free Software Foundation version 2.! d7 i7 H& S. G# A0 P2 X2 f
- *0 f9 r, [5 A; ~- p6 P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) m8 H8 s6 O4 Y7 x - * kind, whether express or implied; without even the implied warranty; f) R/ r% h$ ]5 \4 ]5 ~" a/ H! h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: Y2 L0 J }" d1 Y/ _ - * GNU General Public License for more details.* s. N! t# L4 C( ]$ i: l
- */ G4 C4 t/ R! {3 d
5 M/ Z% o' R6 T- #include <linux/module.h>% x) h0 ?, b2 l: o# [
- #include <linux/init.h>
, ?+ [: r4 ?& F$ ~' h! Q - #include <linux/errno.h>
& t3 F: D) U& f% y7 }, d6 S - #include <linux/types.h>
: r/ G: d4 p1 V$ ?, L, T - #include <linux/interrupt.h>
# a- N6 S) O/ x z# p P7 m - #include <asm/io.h>
m) R: w& m2 @0 e+ b+ @) u0 r; q - #include <linux/moduleparam.h>
# A9 J, |" u9 f Z% U, a - #include <linux/sysctl.h>4 c! [* m* r5 D# T& K
- #include <linux/mm.h>. A8 ?" W0 }& S9 l
- #include <linux/dma-mapping.h>
1 Z7 i6 Q/ Q4 B: o
1 q) X/ [0 D" x; R) A0 H, L- #include <mach/memory.h>7 d; I2 X0 }, m. o$ J
- #include <mach/hardware.h>% C2 x2 O! k$ q- c7 D- `$ L
- #include <mach/irqs.h>" p, }! S, Q' `7 Y
- #include <asm/hardware/edma.h>
$ R; S+ P) _5 g/ \ ^% _
/ ?7 A$ m9 ? X( z4 e9 F8 J; f5 h' [- #undef EDMA3_DEBUG1 w) \1 S5 C0 X- \/ A9 P
- /*#define EDMA3_DEBUG*/% a0 u- @ B4 [! Z! N
- & H; h& B, j3 g1 k
- #ifdef EDMA3_DEBUG2 z" H. y+ v; s$ j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) P P$ `* I+ {1 }0 ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): @6 h5 G5 ?( G; P; l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# n% J% y. j* j" K) z4 ^# O
- #else
( p" ^* u. R9 `1 [( q - #define DMA_PRINTK( x... )/ z/ Q! S- F9 k/ B! N! \7 @) }" m
- #define DMA_FN_IN
/ k" z1 \- p* C - #define DMA_FN_OUT
! v% e- i0 z& L; y7 F8 W - #endif x* i$ @3 a5 w
' [: s ^7 y! i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 Z# u% k! k4 O' j: T
- #define STATIC_SHIFT 3
$ S. D' J. r* ]$ {# g7 { - #define TCINTEN_SHIFT 20
0 _& M" v+ Y5 H& |7 P5 ^' z! l9 C - #define ITCINTEN_SHIFT 21
' |0 K* O" ?) _! x2 t I - #define TCCHEN_SHIFT 22
3 a0 ^- a4 s6 T2 k; k# u9 l4 c1 b - #define ITCCHEN_SHIFT 23' u7 \2 P. Z* a0 v+ J, m, K
- ' i7 ?# g% M+ s+ G, J
- static volatile int irqraised1 = 0;
( P2 `0 p- P: ]# n% c - static volatile int irqraised2 = 0;
) G/ [& D! m' N' G. l - & M$ c0 z7 [, s2 O& ~- S) J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 L( m/ k6 @' [7 t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 r3 Y9 V1 z1 l4 C$ W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( y" p6 b s6 c: \1 E. V. w; I
4 L- A& H% b! P, f$ V. y3 l9 F- dma_addr_t dmaphyssrc1 = 0;1 R3 k9 { C8 O6 x3 {4 ^7 L
- dma_addr_t dmaphyssrc2 = 0;
y: d) ~8 }8 K; | - dma_addr_t dmaphysdest1 = 0;' ]1 |- D. Q5 ~+ j2 d1 n. l' L5 ~
- dma_addr_t dmaphysdest2 = 0;
7 P/ D/ r+ b T
8 \( K5 j4 U; `/ h7 G- M- char *dmabufsrc1 = NULL;5 U6 y6 i5 U; w' j/ |
- char *dmabufsrc2 = NULL;8 `% y0 v- L4 D- W$ w4 |
- char *dmabufdest1 = NULL;
3 E* Q, e% l) z. }% W - char *dmabufdest2 = NULL;6 g+ Q5 [/ ]7 C* W( ~3 {$ U
- 9 [2 \$ O, t7 F) c$ {0 ~9 o
- static int acnt = 512;
3 l) ~* m' ]+ s( C. R5 W5 W' P; N - static int bcnt = 8;
, I9 |. I; E$ g3 f& q U - static int ccnt = 8;+ i+ @+ }: b! J, V
7 ~! `; d* j# U# G; j! Z# w- module_param(acnt, int, S_IRUGO);
) L4 C" R+ C+ {& o" h - module_param(bcnt, int, S_IRUGO);* C+ F2 u" g9 z0 j
- module_param(ccnt, int, S_IRUGO);
复制代码 # g. c2 b* X5 u3 }, X8 S" @/ y
) _( J4 m5 d( ]9 n9 z7 ?4 v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 @/ ?' n) D' M6 w3 `* m& T5 m, _; n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) N3 X4 a- f% @1 O) |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& I( R7 ] s) o4 o1 I
1 W) q% E( {$ E! O9 t: n% |7 g) |: f3 }/ Q
|
|