|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 v% z4 {( P; j& e, {$ F' w9 p- [code]EDMA sample test application
. w+ L: v* }& r' ?9 i6 b! I3 u- e& v - /*
: }9 H7 f/ M4 q w - * edma_test.c
0 A0 j5 C/ j- c# @ - *
- h8 y4 M& H7 _% W) _ - * brief EDMA3 Test Application$ x5 e( ]( b' P: p, L+ s
- *
( y0 v' x. V& `1 f @ ?7 y - * This file contains EDMA3 Test code., U. y! q6 j% h- e. m$ f# I
- ** O2 E0 }3 X) Y1 O$ `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 {; ~ T7 E0 J" F# ]) C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; H2 C2 g- f; \ - * TO CHANGE., |. x2 d, M. s
- *
0 @* \6 O& G- {2 I$ e* v# J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' y" ] z% R2 [) ?- |6 b - *
8 _8 m7 ]7 _ d# W( c - * This program is free software; you can redistribute it and/or
& o/ u: x: r: y: d+ K - * modify it under the terms of the GNU General Public License as( D+ G; r7 n& h* X0 ^
- * published by the Free Software Foundation version 2." ?9 z, A Q3 g' \7 F% d
- *
, S5 h) u4 h, v2 u- T' `* ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ \6 J N! B0 H$ W# {6 y
- * kind, whether express or implied; without even the implied warranty. _$ L: Y; P5 ?- r6 j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ f. z7 f7 S* M1 Y- f: Q X - * GNU General Public License for more details.
9 n* k. O1 V& [4 y" n - */, U# w8 w# \4 J2 Z
1 N+ Q0 k" ~! C, x+ z; e- #include <linux/module.h>
' G6 \9 H+ Q7 X! C# ?8 d - #include <linux/init.h>+ g) E* R6 ?, M, M) m& j
- #include <linux/errno.h>
# G6 Z8 a+ a& y! t |7 o - #include <linux/types.h>
! m0 v9 M5 n9 ]& j/ J1 N6 ?! _ - #include <linux/interrupt.h>9 }! l! ^8 l. D, N/ |
- #include <asm/io.h>* K0 n! J' \) f0 B: l1 J1 L0 j
- #include <linux/moduleparam.h>8 m* T6 c7 n9 w
- #include <linux/sysctl.h>4 o: D2 X) {8 v& t% N
- #include <linux/mm.h>7 }5 | A$ k/ ?2 x) u
- #include <linux/dma-mapping.h>7 g) h) u! d* T) @- e7 R* O
+ ?" ~5 D5 R- `4 m- #include <mach/memory.h>
7 \% Q* b& m/ d8 X- ^! H - #include <mach/hardware.h>
) A. r( L0 w9 O8 r8 R+ R - #include <mach/irqs.h>
7 Q& I) T( h4 Y5 P! L. R( k - #include <asm/hardware/edma.h># |7 M3 k. F f! {1 k
! n) f# Y6 W; o, I' Y3 ?6 [, `- #undef EDMA3_DEBUG
/ w2 }6 a' I3 [- A - /*#define EDMA3_DEBUG*/
, ?& d1 S7 M% F8 u( Q; I P5 |
8 j: e) k# Z" C; n* q* ^- #ifdef EDMA3_DEBUG, r4 f) l' r) A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* T& a$ e# r4 D% t' D f1 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ C% J3 s2 t" p, F; }/ }5 r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* \) S& F6 P9 T5 T' c. Q7 _
- #else( V$ j- J4 @! c: P: w
- #define DMA_PRINTK( x... )
! e, O- n5 Y7 l K6 k - #define DMA_FN_IN
2 G! L2 _5 G& Z - #define DMA_FN_OUT+ v4 }0 m7 z+ H* P2 P R
- #endif
# \( n& p" m' X6 k1 R
$ {9 M, l$ v7 c# s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 N$ n; U L8 | - #define STATIC_SHIFT 34 [& m1 C" X8 L Q- A& F
- #define TCINTEN_SHIFT 20; J* g0 q& d/ M' v: D; C
- #define ITCINTEN_SHIFT 21) I% A3 Q# B8 R# `3 F0 [
- #define TCCHEN_SHIFT 22" j( l+ Y* z) f4 c6 {
- #define ITCCHEN_SHIFT 23
B3 C$ g2 }% F4 S
Z3 v3 v3 ?/ D5 u _7 p- static volatile int irqraised1 = 0;
9 o! S! k5 w* e* E% \! ]9 x- [% F - static volatile int irqraised2 = 0;
5 B) e! t: j8 E- Q7 M5 w0 @
8 n7 _; @. I0 \$ f1 x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! G0 e/ x5 W8 Y/ _( J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- k" U4 q% `% x( }$ t a0 B1 E; {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 i, ~- K2 t% i+ Q9 \
' T! ?; Q+ \; o$ z- dma_addr_t dmaphyssrc1 = 0;- K5 D* V* o9 A9 n
- dma_addr_t dmaphyssrc2 = 0;
# v/ S6 t1 l1 e3 }. { - dma_addr_t dmaphysdest1 = 0;
2 r N9 c% H$ ?$ ~/ N7 K% [ - dma_addr_t dmaphysdest2 = 0;
( w% _1 B1 \; f0 |8 D5 k% E! ~
6 k4 p1 a! ^& `, b8 l4 c7 {; S- char *dmabufsrc1 = NULL;! ]9 ? f2 b I! `- D) _
- char *dmabufsrc2 = NULL;/ @4 E: O) z2 H6 Y2 O6 t; z
- char *dmabufdest1 = NULL;, D9 W, b' G: D: a( r# g* A2 t& x& c4 e
- char *dmabufdest2 = NULL;1 W8 G) `2 p* k, f& j& q, U# @% ~
0 E4 V; l, ]5 c1 s4 W3 p, L- static int acnt = 512;% Z/ `' T m! p0 S! T5 Y W
- static int bcnt = 8;
9 |9 i5 W' v' r* ^8 ^1 z - static int ccnt = 8;2 O' I' l1 Z( U5 p% Y+ p/ X
- " o, N# }% E, M" [
- module_param(acnt, int, S_IRUGO);4 ?9 M' g& G& H% a6 w
- module_param(bcnt, int, S_IRUGO);! |) j& H3 |; |1 B
- module_param(ccnt, int, S_IRUGO);
复制代码
; Q7 ?. n: i3 T$ N- I4 p2 D8 n) E, R& K: w, I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 N1 X1 ]" r) o6 }# g# G9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, x* b+ o; D0 i7 R0 b; x. S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- A) e- U( n k1 k2 t1 E
# q U1 J7 g& [; L" C4 `" J4 o. i) Q3 N- j! c& F {% y( ?
|
|