|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
a3 m3 B4 ~+ T- a% q7 e* m- [code]EDMA sample test application
7 J7 P. k- m2 x& _! P. j i - /*' w" B$ r$ \4 F- K+ j
- * edma_test.c
+ f) M! S- k2 I - *
$ S6 T9 R! C. B# B0 j1 F - * brief EDMA3 Test Application+ o# A7 [& O) b, c X( B" p9 ?
- *6 s3 O! |! t8 J
- * This file contains EDMA3 Test code.0 M; x- G$ n. V$ `
- *
8 o: x) W( M+ r5 v# t6 m8 [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; ]1 \4 [' d& N, l5 v$ ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ F# |- b: |2 h b+ Z% x+ V" O - * TO CHANGE.
. Q% |; t) l1 g6 G4 k/ j& S: @ - *" i* @" s* J: r. D) y0 f# N$ z- `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 u- E4 L5 o. L+ A2 @
- *
& V2 \0 o) I3 Z! k5 \& N - * This program is free software; you can redistribute it and/or
/ V1 A# K% x- ?3 X2 \ - * modify it under the terms of the GNU General Public License as
$ h; F8 N3 C- q" G, f - * published by the Free Software Foundation version 2.8 j! r( I! l7 G1 m
- *
. a0 _1 K; n% `& z1 { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* Z) _8 i' n& o
- * kind, whether express or implied; without even the implied warranty9 B9 i4 z; w* ~- X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 s& W' c4 B9 j& [ G V - * GNU General Public License for more details.
* o5 z+ W; G5 V0 }/ v# d4 | - */
9 f* t8 H9 |+ U M+ v& r) E - / F9 N& \# K6 I& `- q0 V) r' G5 K
- #include <linux/module.h>! J( N, x# h+ p5 s
- #include <linux/init.h>6 Y% b9 W8 J/ m, E
- #include <linux/errno.h>+ y8 M& s) M( t2 F9 ?" f$ D
- #include <linux/types.h>
" w7 M$ m2 P% P! O, o% _6 E - #include <linux/interrupt.h>7 H) K6 c3 x4 L% z
- #include <asm/io.h>
. i! ]" ~# C7 _$ J4 X- }, `7 ?( Q - #include <linux/moduleparam.h>
0 o6 B& D1 [4 z5 V4 v+ U - #include <linux/sysctl.h>" U4 U! [+ h: k
- #include <linux/mm.h>
# s+ }' d9 U8 s+ t1 e" X2 n, o& ?' } - #include <linux/dma-mapping.h>& ?9 u) b1 l" W1 ~+ L$ _/ B7 p
: e1 w" j+ D& ~ M! S: q( d- #include <mach/memory.h>6 d$ v8 L* X8 {9 E( J
- #include <mach/hardware.h>
1 i4 ^: l3 Q1 M4 ^9 Z - #include <mach/irqs.h>- m+ v4 |6 Y/ Y, X+ _
- #include <asm/hardware/edma.h>
0 S. l, {, ^3 k& T# D( R - : a& Z7 B. z! E4 V( p- C
- #undef EDMA3_DEBUG! {) y: c5 B. f6 p) o3 l
- /*#define EDMA3_DEBUG*/
, ?5 B- H2 b1 z4 B* `: E. u - 9 O1 X a' D# z
- #ifdef EDMA3_DEBUG
' V& ?% }# n8 @) U. r: v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 W/ w, C+ P1 w) g2 z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 b* q7 V+ [4 `0 Z1 P% l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
P+ `6 O' c# _ - #else
; D' m+ }! ` B6 w - #define DMA_PRINTK( x... )
X% i [8 [# A ] - #define DMA_FN_IN$ k) ^* \+ Q" \- o% w* Y; f
- #define DMA_FN_OUT( U! b% |+ p4 A$ _# D! F* [; v& }
- #endif4 r# x* Y. {, n& g( S6 U
- B& d: x8 `) \% {) ^ _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 h) s Z" _2 k% O$ R
- #define STATIC_SHIFT 3$ u B1 P& r$ Z, x5 y" g# u
- #define TCINTEN_SHIFT 20 ^( o2 p; V3 L
- #define ITCINTEN_SHIFT 21
5 V: L, v1 k$ b# C5 x5 J( y - #define TCCHEN_SHIFT 22
T; M8 A+ f( ]5 b - #define ITCCHEN_SHIFT 234 p5 W2 O3 c% o! y' D
- ! h* J4 `8 t6 c Q& }
- static volatile int irqraised1 = 0;
" |; R! P% s s ~ - static volatile int irqraised2 = 0;! s6 I) G" _( n, O' A% d3 ~
- Q& s& ~0 _; u. C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( m3 [& C% K+ D3 P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ j& \8 {; Z7 L9 g* F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 o) X6 p Y6 W* H& O6 G6 D5 |
/ {+ Z. D: g1 G, O- dma_addr_t dmaphyssrc1 = 0;8 @* w! h$ {! L5 \% L
- dma_addr_t dmaphyssrc2 = 0;
' Y+ e5 S: l" r$ y4 i- i - dma_addr_t dmaphysdest1 = 0;
8 ^: O7 Q+ h1 M3 D# P/ C6 [ - dma_addr_t dmaphysdest2 = 0;2 f; G3 d' E+ c0 Y
9 r4 f' N7 _& X9 ]7 l: n- char *dmabufsrc1 = NULL;
& H8 W1 F' K* h/ o* v8 U z' [ - char *dmabufsrc2 = NULL;
) ~+ L1 J2 c5 a# a) R - char *dmabufdest1 = NULL;
4 U3 [: J7 \% Q$ v. ~1 w - char *dmabufdest2 = NULL;
/ |7 [$ ?, B9 @ - 6 U9 H* G$ T: N
- static int acnt = 512;
2 h. p% w7 a/ B, G0 d - static int bcnt = 8;
6 k6 q, y6 b, ^' x6 ^" Z0 f( U - static int ccnt = 8;
& }7 U: o2 ?( _; W - 1 Q, ^6 x: f# p, b- U8 N/ E
- module_param(acnt, int, S_IRUGO);0 S5 t6 u4 d# R4 b# w7 l, k- g
- module_param(bcnt, int, S_IRUGO);
/ v" X1 ?* c# `; r: V; |: p/ C" |+ T - module_param(ccnt, int, S_IRUGO);
复制代码
3 r2 X- H9 q5 S4 |( C! O; Q- N1 X
* D4 C. y# D$ I) Z6 i& e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 M+ A/ D6 }0 y6 G% garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: s a$ F. {3 v& a2 b2 m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& r1 K1 y3 S, a1 b
) N- p) p" G9 Q1 S. C' Y) {
7 i5 v6 T; Q& w( e
|
|