|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 _$ |8 I4 b4 ?, p3 A2 V' F0 j
- [code]EDMA sample test application$ G' @8 X+ l- ~2 M( K( a
- /*
) y, V, D& B. A y/ r0 s* Q - * edma_test.c
% Z" t& [7 d* U" j - *
, O8 ]/ n" g$ j/ v - * brief EDMA3 Test Application
9 R' Z' p0 r$ h/ n - *
* j2 H& c, X8 V - * This file contains EDMA3 Test code.' Q' h0 N* }( l& Q: y7 ?) f
- ** r$ U# k; y. V Z6 k p0 {, i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ B) f' X+ F4 m, [9 o6 P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* K: ?% V" i9 @+ Q
- * TO CHANGE./ ~0 `2 F4 O# ]: n% ]) y
- *5 X; H8 ^, ~8 ?; u8 J9 ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* W0 `6 r8 U( V, j" E
- *1 _/ ~, L/ A, o1 w0 A: J
- * This program is free software; you can redistribute it and/or& J1 ] Y% V# x3 H7 c1 B8 F; K+ K
- * modify it under the terms of the GNU General Public License as4 I9 n4 q% K) S" g
- * published by the Free Software Foundation version 2.$ ?# g. }8 |2 p2 n% A! O
- *
. E7 i% ]9 B6 Y- }: ~1 ? - * This program is distributed "as is" WITHOUT ANY WARRANTY of any ?5 {- d8 A3 w2 e
- * kind, whether express or implied; without even the implied warranty
& O0 ~8 A' W! ^; e+ l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" z: s4 x1 v5 w& c3 v/ e3 q; v - * GNU General Public License for more details.
: u4 q; B; D# `6 L6 Q; ^2 ?: x - */0 d3 A' B& H; I, \
- " k+ m. q: i. {! K: l# H! G
- #include <linux/module.h>4 P1 Z# _3 s( J$ D4 Q' N2 ~
- #include <linux/init.h>
* F X9 o9 B* Y. K7 _( ]0 D+ y8 ~ - #include <linux/errno.h>- r) u& R1 N; I/ @' s
- #include <linux/types.h>
8 y R7 p, }3 l - #include <linux/interrupt.h>
2 W, _! M3 j9 I2 g8 v [ - #include <asm/io.h>0 M, {* B- l( [- c. N; _
- #include <linux/moduleparam.h>1 L' `: f7 \* T* y7 m
- #include <linux/sysctl.h>4 o% r, \+ H! W/ b i
- #include <linux/mm.h>( Y& X; U6 W! [& ^6 M
- #include <linux/dma-mapping.h>9 O* E- m0 i3 Q& O" [
* k0 U. ^+ D" i4 k% H, p8 m- #include <mach/memory.h>
; E% Y' @1 Y6 A9 T, S. S7 T - #include <mach/hardware.h>
2 T4 G& d8 Q7 R" N - #include <mach/irqs.h>0 [& t5 I2 C9 A" L4 s
- #include <asm/hardware/edma.h>: Z# R0 v$ P0 i8 y/ U- z
, e/ V+ {! C7 j- [- #undef EDMA3_DEBUG, [5 j' {, `5 x* a
- /*#define EDMA3_DEBUG*/
+ M3 X, i; B" ?. y4 Q F. @ - 6 x8 ~4 Q4 m. p/ O ?- A. d& E& Z# o
- #ifdef EDMA3_DEBUG Y- }. Y+ e! c! E$ E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 O% F( Z/ D; V- }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 ~% l$ a8 @ ?& Q+ X3 @. }! | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). c# z3 \' @- y% ^9 O
- #else
# u1 t5 f, S! v - #define DMA_PRINTK( x... )
! F1 g( b4 z4 @8 v- V - #define DMA_FN_IN
" v: U: r, n& d# I9 ~1 k1 @ - #define DMA_FN_OUT @/ S7 q7 [! K) X; `. e- {; I
- #endif
5 F' I/ z# I8 d$ x - + _% ~2 o9 K2 c' \5 @9 B+ ^7 m P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* q) i0 t6 V9 l7 R# m& R. b/ ~7 X7 C - #define STATIC_SHIFT 3
( D( `8 {$ n5 O/ j - #define TCINTEN_SHIFT 20+ w& f$ Z' W6 q5 U# M2 t
- #define ITCINTEN_SHIFT 21
' H, K7 X# X1 W - #define TCCHEN_SHIFT 22
7 R1 M) e% l4 Z$ f% f" _ - #define ITCCHEN_SHIFT 23! z, [7 ?, U" i' S7 p3 Q# ^
$ h' H8 y. m! I+ y- static volatile int irqraised1 = 0;" @( A: g' L" T0 [3 @
- static volatile int irqraised2 = 0;
6 `3 \# u7 W0 Y8 H9 K - 3 ?0 O7 u9 {* @0 X) Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 b; C, u* L Y: c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ i6 f3 r) G3 _: f, |% j& p$ ], t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 r, }; v! ?- p/ P3 I( P
% N6 {' n' U6 h. i" O- dma_addr_t dmaphyssrc1 = 0; K5 R* ^! G3 o& C0 ?
- dma_addr_t dmaphyssrc2 = 0;
; ?! u; ?. b F I% Q$ B3 R - dma_addr_t dmaphysdest1 = 0;
+ {; u* ^' |- l- t2 c- k6 G. J: c - dma_addr_t dmaphysdest2 = 0;
3 w7 E( j" b* B: Z* t0 A8 D4 N' r - * Y6 t# T+ x1 O+ N) A
- char *dmabufsrc1 = NULL;
" B$ z6 H% D; W+ t; k3 m - char *dmabufsrc2 = NULL; B* L! K Q- |$ f
- char *dmabufdest1 = NULL;- U, c6 |! \& ?2 w
- char *dmabufdest2 = NULL;
* S! b6 C p1 g* t - 4 x& `: z& U1 y8 {1 D
- static int acnt = 512;
0 ~1 k: g3 [, B% \ - static int bcnt = 8;+ x; l6 S1 g* G5 R4 R I, K$ Q+ Q6 o
- static int ccnt = 8;
$ A7 w: T" s. z7 E4 H - : `% D# v$ q& \
- module_param(acnt, int, S_IRUGO);! Y, P: S) ]1 p& h7 \; \& M2 Q
- module_param(bcnt, int, S_IRUGO);. e1 P, ~; B0 r3 u* M
- module_param(ccnt, int, S_IRUGO);
复制代码 - I* @- G2 {$ e% y- t
( I- @) Y5 n$ x0 j# \6 ^, i2 D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ E( w5 ?1 t1 @! h$ k& G* K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 R3 F$ G: |/ y. u+ `5 N+ O; Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% w/ ? q' o6 P2 C4 a5 K7 D/ r
$ z7 H; G* T- V3 E' J3 a6 G- D4 e3 F
|
|