|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" T& {8 A- f9 e O- j! G1 ~ v- [code]EDMA sample test application- \. J! }& d; G6 J( ]
- /*
+ D; P# E' s% O/ [2 d/ n - * edma_test.c: f. s* f; o& V+ f5 g/ u/ S
- *( y! [/ u9 f; S1 Q
- * brief EDMA3 Test Application
9 k9 S5 L' ?& P% H - *
0 f: F$ [& n' a - * This file contains EDMA3 Test code.
0 @0 A% t! _& F) k - *
" V/ V4 v$ |4 o% c ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ g6 o" T& D% P' I( i" g" J- T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; E/ [2 [( y7 I5 ?+ i) Q% f - * TO CHANGE.
% n1 I$ O6 P1 b0 ^ - *) `& C! p$ r" \6 F9 u' M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, ^) ]- |! j' M) S5 N) i! x - *& I# d' A+ y/ Y# x, b! S: P
- * This program is free software; you can redistribute it and/or
" r$ C; j6 {* s! I$ P [2 {5 A3 ^ - * modify it under the terms of the GNU General Public License as. h9 x* k& ~( n9 W
- * published by the Free Software Foundation version 2./ n/ o$ c# S5 Y1 ?/ q& |
- *
( d, P3 v# q4 j' t; a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
m k" D | D5 ] - * kind, whether express or implied; without even the implied warranty w7 z% p1 T2 U4 S& w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' \4 F( Q, ~5 y# e" O; f - * GNU General Public License for more details.* s$ s1 ^% i! a. }/ l+ E" N9 U; X
- */
: y; M1 I1 ^! I3 a+ E/ L+ F
% C. q4 V- ~& C+ o! O$ G0 P2 }- #include <linux/module.h>
8 J- k! b8 |, F" p4 ]* C* p3 x - #include <linux/init.h>. Z% C2 F. T6 u
- #include <linux/errno.h>4 I* W# N9 E" S2 s4 X C0 w/ o$ q
- #include <linux/types.h>
! b1 k& `. f/ k; A, ? - #include <linux/interrupt.h>
9 S0 D$ R. a7 O# g2 T( R; G+ b1 D - #include <asm/io.h>
. T! V' Y0 a, [+ ] - #include <linux/moduleparam.h>0 E- S& a# t B9 H: U
- #include <linux/sysctl.h>
$ J! z: o( a3 c - #include <linux/mm.h>
+ ]$ ~2 F4 u1 T0 N, z+ x+ W - #include <linux/dma-mapping.h>+ H: I9 G: { {/ Y
- - f1 e% W2 y! C$ i: A0 m# T
- #include <mach/memory.h>; l6 B2 d4 A3 ]
- #include <mach/hardware.h>
, R0 ? L6 o% ~% p+ t$ P - #include <mach/irqs.h>3 w# M7 v$ Q8 m! b; H
- #include <asm/hardware/edma.h>9 W4 X, w$ b2 k$ {; |& L9 y
- & U/ [4 K3 w4 s
- #undef EDMA3_DEBUG1 ]( z, b6 M# }1 l& x( Q
- /*#define EDMA3_DEBUG*/1 y$ U1 V8 W3 h* h4 V; y) J
; e) H. n5 s; k/ M1 j1 m- #ifdef EDMA3_DEBUG+ T. Z: ?+ \- Q9 f+ ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# h I' g2 l* N: i' X/ l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- C0 j2 i/ j1 ^4 v- g2 ~$ |$ C! W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ O/ S' g- X& G% m Q5 W9 I; x
- #else
8 F# q- c% a9 g" G - #define DMA_PRINTK( x... )( [2 S+ u$ i/ J
- #define DMA_FN_IN' h! z6 U* [5 w' ~4 X
- #define DMA_FN_OUT* G0 s; Z' c# [) G9 \
- #endif
- ?4 ~4 L+ W$ {/ z: \ G - 3 f& P2 g$ \3 y4 i7 \9 P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 d, D* [ T/ f1 \) T% O& i
- #define STATIC_SHIFT 3. f& E X# J- Q0 Y& ^1 O
- #define TCINTEN_SHIFT 20
7 v. a3 V" q7 T r$ V' G( Z1 r% X, Z1 S - #define ITCINTEN_SHIFT 21
- _/ [/ y9 x; t1 \, o! w - #define TCCHEN_SHIFT 22
2 C+ f6 F9 U! b% M8 | - #define ITCCHEN_SHIFT 23$ c' @; E7 S7 |' |) ~2 t
' q/ x5 b R8 j: t' b" D: f# T* t- static volatile int irqraised1 = 0;
7 x/ r( [7 g4 p) l2 |# C! e - static volatile int irqraised2 = 0;5 _, X# u/ r8 g. x
- 6 r& f% ~6 r- `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& |3 y# s0 X8 ?: o3 ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 n3 d7 f- D4 {1 A1 H! {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( s2 d8 W% V& ~
- ; `+ G7 m4 _9 Q
- dma_addr_t dmaphyssrc1 = 0;
6 {! C% Y- x* O0 c' c# I - dma_addr_t dmaphyssrc2 = 0;$ E3 a( c5 Q; d* b
- dma_addr_t dmaphysdest1 = 0;
$ ]/ g0 B- y! i; g. O - dma_addr_t dmaphysdest2 = 0;
; Z& Y+ L5 @- { E1 I - 1 k; o' }- x% |$ R* t
- char *dmabufsrc1 = NULL;
: z, A* x. \1 A' k+ ~& q+ i5 [ - char *dmabufsrc2 = NULL;
7 p# m5 ?# Z) W; o' f - char *dmabufdest1 = NULL;
* j4 X8 z" ]2 T- k2 o b) x ? - char *dmabufdest2 = NULL;4 [. h) Q5 G# w
- " G* ~: \, C0 o+ u) U- m* I: g
- static int acnt = 512;
' W9 m; P* p( c1 `; Z4 H - static int bcnt = 8;$ A$ k4 r8 V) _! `3 ]
- static int ccnt = 8;
" u1 {7 G1 M+ A3 I2 i* B - ] X2 J8 U1 v5 J! S- Y
- module_param(acnt, int, S_IRUGO);
P, D' b, w: a# ^! I - module_param(bcnt, int, S_IRUGO);
$ P$ u- U/ i2 w3 D* S - module_param(ccnt, int, S_IRUGO);
复制代码
+ `. f3 a6 W' _( c0 K8 R$ m5 X* M9 {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) u$ _. |6 E# j( E) L. U) @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ g! E9 q `9 A3 Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 g g$ c/ b( E) }6 S* P$ t' g/ ^$ |) H
" y: w. D4 Z/ ~+ ?7 Q
|
|