|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - Q1 x0 a j5 {- e( g6 }. s
- [code]EDMA sample test application! M6 Q/ g, D' g' X+ D
- /*
$ H7 V J6 x( ]8 Y; z - * edma_test.c
|- w4 c! j( S& u - *
9 Q# x( ]0 E |# R - * brief EDMA3 Test Application2 z5 F6 K$ ~ K* b+ Z
- *3 h! S6 L1 B% H) r+ R" b3 x! v; O. V
- * This file contains EDMA3 Test code.2 f0 d2 ]- e! M; @5 B
- *
( D M/ C) w- f! `1 [( j! d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 s+ t# N& t" C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( ^1 p2 N9 r& i2 K/ G+ G# _3 F
- * TO CHANGE.
5 d6 Y( ^8 u& E: }: S7 `# Z6 x - *
* n( j& a1 t, e& |! _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 w L% R) I- b
- *
- n" U, }2 r6 n, b f1 J& q3 `' k# `) _ - * This program is free software; you can redistribute it and/or
0 {0 L% X: X$ | - * modify it under the terms of the GNU General Public License as
* @5 Q7 {# }, N* r& N - * published by the Free Software Foundation version 2.
/ R" l- q' U. z - *% a: o' A' `9 r, b5 k# y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any |+ O3 G" B+ \% A8 r6 q* P
- * kind, whether express or implied; without even the implied warranty* e) y% o! D8 Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 G. _ N3 q# x. M( _+ b. x! u& ^9 [
- * GNU General Public License for more details.
$ q r! L+ }5 L" R - */) V( m F4 P i) @* ?( L' B
- % J# l* Z8 w8 l
- #include <linux/module.h>
4 v' Y( y- L. s! r' G2 q - #include <linux/init.h>
8 q4 z8 ^% w- p0 B s0 f3 h- A( @ - #include <linux/errno.h>. p" {. F$ G0 @+ G% F$ t
- #include <linux/types.h>2 S9 k" u4 D; I; u
- #include <linux/interrupt.h>9 o8 Q, e9 ^9 q
- #include <asm/io.h>5 G: Z# g9 N% J7 \
- #include <linux/moduleparam.h>
6 Q' _1 `& B6 M - #include <linux/sysctl.h>
% [9 G4 Z# n. f5 ` - #include <linux/mm.h>4 H/ P G/ T9 ~( _7 X
- #include <linux/dma-mapping.h>
; M" {& ~1 [1 ^! b$ r" G2 r% d* r - 7 n/ n9 A8 H+ S: A
- #include <mach/memory.h># n, A. c: R3 e+ Z- ^
- #include <mach/hardware.h>
; @# F* y$ |4 x ^& D# ^( @' ? - #include <mach/irqs.h>
2 g( ~$ v, k; [, B2 E - #include <asm/hardware/edma.h>
' ^0 n8 x9 \0 V: m+ P - ! t0 ]8 U3 o$ ^! l, l4 J
- #undef EDMA3_DEBUG
@( B' a4 y& h8 u8 Q$ ` - /*#define EDMA3_DEBUG*/* X8 w- P/ i N6 q
: ?. F+ K7 ^1 W& R" Z5 c- #ifdef EDMA3_DEBUG
& \; K" A2 \; x7 f8 e$ Y% g' E u* x4 g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, S3 }/ A. ^- d* z+ u( x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), N0 [/ z8 H4 M5 j6 x$ ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# `3 j7 w- h8 W4 r3 l1 G/ \
- #else
6 ?7 [ v" d6 s7 P - #define DMA_PRINTK( x... )
~# N. P0 s$ t; Z1 [1 W - #define DMA_FN_IN
5 m M* J% D* ?. R) d9 i - #define DMA_FN_OUT
' A5 D, X& J) g( {6 J9 @+ J) @ - #endif
1 L2 o! r9 c- g - & L; U! k7 h$ [ @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- L) U" W3 e, O @7 m$ N4 L% U& p - #define STATIC_SHIFT 3
. A+ v; u P5 j5 E - #define TCINTEN_SHIFT 20
1 B4 V; H4 ?4 `: z - #define ITCINTEN_SHIFT 215 T9 m, B- @1 \
- #define TCCHEN_SHIFT 22 |! B2 v) G5 K; s+ h3 o
- #define ITCCHEN_SHIFT 23
- ^1 L& U2 @, N. T - " t1 d5 o4 F, Z! ^! d6 V; p
- static volatile int irqraised1 = 0;
* e! f. c/ @+ b' P1 t - static volatile int irqraised2 = 0;
/ M$ S2 I: L- F+ D1 p, E
/ g5 p5 v" Z" H+ M% e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. h* \# x* W, `0 K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: y# D( U; f% `8 q& g' ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. _5 L" b8 c* b# Z - ! J5 h. B3 Z3 y# \
- dma_addr_t dmaphyssrc1 = 0;
9 v; B4 ~$ b7 c8 L" v4 w - dma_addr_t dmaphyssrc2 = 0;
4 H( b1 Z @/ {9 }3 D - dma_addr_t dmaphysdest1 = 0;( Q( W. C: |. K7 i. R1 F+ r* o/ `: k
- dma_addr_t dmaphysdest2 = 0;
- p6 T8 D. ?! e) Z0 Q- x3 F# ` - 2 S. I6 ?* w6 K' y
- char *dmabufsrc1 = NULL;
- k- g( e9 p( s; l+ |" t, } - char *dmabufsrc2 = NULL;
1 S, h, E3 }8 h6 x' s5 W/ n - char *dmabufdest1 = NULL;
4 C+ z4 e) P) x9 Y9 y6 { - char *dmabufdest2 = NULL;- A. S6 W$ Z9 n9 v
# q+ _' d5 W' @ U: O- static int acnt = 512;1 y8 R* B/ L, G( e7 g7 n1 j3 S) C6 W
- static int bcnt = 8;
+ A0 X2 b( K) |; [1 |- G - static int ccnt = 8;
) e8 ^; h0 {% @6 r - & l: {3 C. {0 h4 \, Q9 G
- module_param(acnt, int, S_IRUGO);. A" Q, O+ F3 k8 F) W3 m8 I5 h7 [
- module_param(bcnt, int, S_IRUGO);
' U8 i6 F2 [# z- m' f" Y - module_param(ccnt, int, S_IRUGO);
复制代码 ; f" J# a- q' H, y4 K4 ]* l8 t2 q
+ W! Z2 _5 B& r& O: A! F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, }" d `$ S" z x! Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 ?# G5 n9 C* N) n3 o/ h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 R' ]5 z' Q" o1 O( J! J
9 `$ U0 U V8 Z6 f5 {
. _. x% U: d: z- @2 k |
|