|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 w. \0 u! d! x: _/ |4 D
- [code]EDMA sample test application+ {8 a* @% i; S- z( i7 g S/ K
- /*4 u1 `/ j( X% W) t2 D2 v
- * edma_test.c) H' p" R: a0 H0 k
- *1 s3 Y8 |5 D0 N9 D& N' L
- * brief EDMA3 Test Application
9 R$ p( g2 W# {& w& G4 Y$ e& O* K - *1 y) V- Y3 W: |% t
- * This file contains EDMA3 Test code.- w3 c, z8 J4 e: h# w
- *& J7 L3 b- m5 I5 n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ S! d, @2 Z. [! {+ ~7 @4 h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ n( H- J- x( N+ D) U0 b; P1 }
- * TO CHANGE.
w p8 C8 Q1 {) b% B9 r; N - *+ y/ P% h2 v, i8 Q: J9 k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" v* ~; z" d P- D3 @2 O( J, g - *
4 c! K' t2 k3 B1 ~) A - * This program is free software; you can redistribute it and/or
. P% I/ \: Q/ U; |# T b* V - * modify it under the terms of the GNU General Public License as
* q1 G8 |; k' g. G1 f; z - * published by the Free Software Foundation version 2.
* D- i9 j- o" `1 u( p# f) d - *
* Z$ O. T$ h; G; P+ W- m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. n# B3 W+ B' Q2 k/ H/ V" c
- * kind, whether express or implied; without even the implied warranty
* ~4 ]1 b" P% E5 X' y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* v) F) W6 n% x8 B+ R - * GNU General Public License for more details.$ x' f5 H& }/ A
- */
0 u6 _3 G) J; x0 O3 H* W. n
3 X/ {; @( e4 O2 W Q- #include <linux/module.h>" J3 g* t6 m) h
- #include <linux/init.h>9 m* m% o R9 X' d( O7 R6 x( T& a0 i" p
- #include <linux/errno.h>5 V) g3 m5 d5 U9 M
- #include <linux/types.h>
& Z& }! q c. T2 P& x0 y - #include <linux/interrupt.h>
3 }& h, E; b% o% ]- q, ` - #include <asm/io.h>4 n6 U( T* E3 D: m8 Z/ l
- #include <linux/moduleparam.h>; ?+ E9 a: k6 P4 y
- #include <linux/sysctl.h>( z% d: M4 I$ R4 m; p
- #include <linux/mm.h>
- {9 Q/ x- C* V$ h - #include <linux/dma-mapping.h>
9 f- z2 J, E7 E - . t5 }) \! l+ a2 @
- #include <mach/memory.h>
% `1 T. M N3 D: t( g: B - #include <mach/hardware.h>% |* B5 `$ B1 ` I/ |
- #include <mach/irqs.h>
. T$ V) r) t [3 J; O - #include <asm/hardware/edma.h>) ~* o5 x! Q3 D! j" |/ e
- $ X. |. u4 T2 i8 Y- d" O
- #undef EDMA3_DEBUG
2 q: \' G# f+ o( y( z( @ - /*#define EDMA3_DEBUG*/% T5 @3 v4 w" W1 T
- $ Z2 @ P# @5 r8 i5 X( k
- #ifdef EDMA3_DEBUG
g9 r; |$ w; }! z" \( x9 s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 Y' x# }, c" n! |( B" n! s( j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 z: K( e4 X7 a1 U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 i4 |8 L9 R# [9 L# b1 q& ~ - #else, l5 M! @' `) N3 b
- #define DMA_PRINTK( x... )& u6 K+ B$ V0 l |+ P
- #define DMA_FN_IN
+ L1 z$ p6 p V% M' z - #define DMA_FN_OUT
1 @6 m; Z: i( ] - #endif* u' I$ y0 I' e/ l) X
" a. z4 ]6 b! Y, E$ B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% z* Z& [ e, r6 P( \" W* M3 j - #define STATIC_SHIFT 3& k' @' d' r4 o6 O4 s* ?# }
- #define TCINTEN_SHIFT 20. D$ j' Y% \, G. O. p' a
- #define ITCINTEN_SHIFT 212 r; Y! N# C8 V+ [3 `& q
- #define TCCHEN_SHIFT 22
1 k, o5 P6 P: } E* |. y - #define ITCCHEN_SHIFT 23' ]6 e) F8 s$ R) S i# ^% U
- 9 j2 L# Z% O) k- e5 L( t
- static volatile int irqraised1 = 0;' _5 H/ B) \( b% j3 c4 F5 v2 a2 m
- static volatile int irqraised2 = 0;
' r- F& s% A: [! N; ^ - 8 Z* k/ Q) \8 L+ ^& r/ ]+ x/ E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 G' c' f; Y1 Y, w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ~$ w) f0 ?. G! ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 Z5 d: k: T. Y, t' ` - + {/ p) N6 f$ l6 Q
- dma_addr_t dmaphyssrc1 = 0;, @$ Z$ W) u$ q: O* D: a
- dma_addr_t dmaphyssrc2 = 0;
- I3 p% M- W, @4 X - dma_addr_t dmaphysdest1 = 0;
0 ]6 d( I6 ]$ n4 P# {6 u L - dma_addr_t dmaphysdest2 = 0;; Z8 T" b, Y% x1 T, }
) M" `0 V E/ A. o2 C, C- char *dmabufsrc1 = NULL;- _/ k1 n7 S p/ [ Z: S
- char *dmabufsrc2 = NULL;
& t! K9 }" n$ m; i( t* ? - char *dmabufdest1 = NULL;
5 Z; w' Y/ w! B1 E% |8 K$ ~' ~1 H+ j" s - char *dmabufdest2 = NULL;
! z& G- d& j, j4 p - * g& R, v# G( E' S( x2 Q
- static int acnt = 512;
/ q; H; Q, P8 E* z. N - static int bcnt = 8;9 e# q# ]! V6 \% Q" F( w( ^
- static int ccnt = 8;
% q# t* M* e5 O+ n- j
( L* T$ X, ^; J* m- module_param(acnt, int, S_IRUGO);
b' ?, V( x* m5 P, Q" u2 L0 N, w/ q - module_param(bcnt, int, S_IRUGO);1 d, n3 ]4 j D5 k" m& d
- module_param(ccnt, int, S_IRUGO);
复制代码
* e% w9 l3 g \9 H
4 M' b) E8 r4 f; F& L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" ^. ^0 i- o& V0 V1 ]. @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. i; `- |, z: j2 J* b: s+ |% i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- X1 z8 J8 r; ^
- W% b0 _6 C+ O' J
6 \* `5 I D* v0 Q1 v |
|