|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 b9 h' e' x9 _( V5 B, k- [code]EDMA sample test application& q+ s) I* ^4 i, o" W
- /*1 Q. L0 ^7 [& d6 c
- * edma_test.c
4 p( R3 Z; b/ `- i - *
( p1 N5 U+ f& j d( v* N- B) O. M - * brief EDMA3 Test Application
% x' P( y) \$ X7 E0 t+ J( s1 N - *
: c9 z/ ^7 {: P1 p$ ?; f' | - * This file contains EDMA3 Test code.& m& v5 p4 H5 h, g2 ~5 }4 m
- *
- i' M- U4 o6 g" R Y# U, { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: o) m: B3 M8 |" \2 q. y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& `2 R& D/ B) A; M6 V9 |' [ - * TO CHANGE.
. H# _; Z( C: R6 ` - *# ^" B. L7 l4 w' m1 F' y, |6 C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* n0 K# h- F% h5 ^; v4 S8 J - *) T' i& r* B# p; A& y) c, X8 X
- * This program is free software; you can redistribute it and/or
m+ F/ [5 D4 W - * modify it under the terms of the GNU General Public License as
4 D, M0 j- G4 ?7 V - * published by the Free Software Foundation version 2.) [7 D" t) K3 @/ I
- *6 D" e" b: A' n2 ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
r9 l% u3 w# j2 U - * kind, whether express or implied; without even the implied warranty( A, u8 c7 ~8 G4 A" B5 H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( F, m' j/ ]/ a7 u; |8 O7 { - * GNU General Public License for more details.
" f& Y! x9 o. v0 q9 c% u - */. o$ d, t- t& X# t: P
( l t+ _( s' }; z6 a- #include <linux/module.h>4 h% Q3 p; `( I5 C' u) x3 }
- #include <linux/init.h>
2 n1 T' h1 N0 T- e; C$ Z - #include <linux/errno.h>
1 Y1 J1 |; a! ~1 _& C; c# f - #include <linux/types.h>7 h6 P/ D1 \( @; y. _
- #include <linux/interrupt.h>3 }2 H) S8 X% u: p
- #include <asm/io.h>
3 a ^) k& E5 R% E% O - #include <linux/moduleparam.h>
1 A/ G- k$ L9 D& l o - #include <linux/sysctl.h>8 f7 f4 e) S& _2 u T; i" Q
- #include <linux/mm.h>
$ P* n" c# B/ p, n: Z# _: X W1 L - #include <linux/dma-mapping.h>
3 [: g5 I" r% a% j) O- w - 4 F, H+ v0 s& |+ e% J
- #include <mach/memory.h>3 y# ^: a" G) X: [" b$ K/ l% j6 t% i
- #include <mach/hardware.h>
1 _- o6 U" f! R1 ]- D - #include <mach/irqs.h>
+ B* P/ X" E8 C! {6 p& C" e6 D - #include <asm/hardware/edma.h>
, F+ m+ U$ ]& u5 R
0 |/ A/ ~; S9 r# X0 N1 Q- #undef EDMA3_DEBUG5 z8 |' `; J# N5 T3 p5 J3 R' v
- /*#define EDMA3_DEBUG*/
7 i4 L- j1 A9 Y0 @3 h6 Z/ R, g* J* F( R
2 f* S; r! ?' g. W' S. }- #ifdef EDMA3_DEBUG8 |3 l S/ {& d7 }& M5 {, k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ |" m. S( m7 h6 s& c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: x1 ?) c0 @4 R- g/ n2 f* d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 D# y/ z4 I) c$ K% h& v - #else) {% V) k! S) p2 g. P4 \: ]/ O
- #define DMA_PRINTK( x... )
0 b; `" e. ?! W6 w - #define DMA_FN_IN
s% N" N% A$ Q" L, I - #define DMA_FN_OUT
* |7 c! ]2 G( A - #endif8 b7 u1 |1 c, l. Z7 u8 O+ q3 z& i
& s* S/ b0 m: n0 y% d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 M% D2 z- \! Z* |" @3 _ - #define STATIC_SHIFT 3
+ u r+ ]5 @- b! o7 ^ {" m! M - #define TCINTEN_SHIFT 20, b9 @( O9 g- z5 l( T
- #define ITCINTEN_SHIFT 21
, i6 a6 ^1 z( l, J3 S6 R1 l# m - #define TCCHEN_SHIFT 22
1 ]5 H9 S3 Z9 j# u5 n5 {& z - #define ITCCHEN_SHIFT 23
% n, @$ v3 L9 Y - " N( n/ I1 e( }+ C$ |8 P& |$ s
- static volatile int irqraised1 = 0;
5 D* l9 ]* u0 ~# c. T - static volatile int irqraised2 = 0;
( f* V8 W5 i3 P" y - 3 ~/ E1 h, S9 O5 ?0 X& H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" U: D) X( R) X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 r4 F, |, _' ]6 ?! g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Z! B. z3 E7 C2 ?5 Z# F
1 g. h& S3 C0 @3 P- dma_addr_t dmaphyssrc1 = 0;
/ C$ b3 k: W7 _# O3 c - dma_addr_t dmaphyssrc2 = 0;
' N8 b2 z3 Q) |/ @6 \/ S4 T - dma_addr_t dmaphysdest1 = 0;
) F" V& I. n5 g# ]8 E% L - dma_addr_t dmaphysdest2 = 0;! [6 N$ w1 H' x4 @
- # E# k3 k4 R9 D* M
- char *dmabufsrc1 = NULL;1 W) u% Z) p* a, {
- char *dmabufsrc2 = NULL;
3 L0 v, Z% J& |$ k - char *dmabufdest1 = NULL;6 ^ `6 k! D' p- G% f
- char *dmabufdest2 = NULL;
7 t8 y- B& r" ` - 1 V4 q, B+ [4 H+ ^" {
- static int acnt = 512;
3 t" [+ _2 [& j9 v3 O# I7 g& A - static int bcnt = 8;& t1 z3 R- Y* e* u8 F& `- O
- static int ccnt = 8;1 o& ^% E9 I+ W9 F
* e% Y9 f* @4 N# s6 {; V- module_param(acnt, int, S_IRUGO);5 p2 Y# `6 w! }4 w" ~3 M
- module_param(bcnt, int, S_IRUGO);/ Q8 r% i; Q$ x0 ^2 Y
- module_param(ccnt, int, S_IRUGO);
复制代码 8 r, o* z# e7 {" M5 p
% J" S6 b6 j! m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ?9 {4 U8 y8 g7 K" D% F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 J0 [+ S+ n+ T- x5 d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# [6 t1 d6 J! p% p0 P! H% f! w* v u
# @, J+ A0 s! g4 R) S- l
7 f) L4 G5 D* y
|
|