|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( B7 m. s& i: T) ~3 Z9 e6 [
- [code]EDMA sample test application; U& l' J! `6 q A/ ]. }( a2 h
- /*
, R3 p% X; i- d/ P' h5 \ - * edma_test.c1 x* k% X9 X+ Y" c" E
- *! d% y/ Q/ P d1 Q6 |' c. ~) u7 `
- * brief EDMA3 Test Application* G, z- k( F+ J W5 E+ S1 y
- *- S0 ?9 g8 L3 a, w
- * This file contains EDMA3 Test code.
5 @' f' O+ N& M6 ^* t4 ^) Z - *8 y( ^# [. N e# e9 m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 Q3 N6 M S# _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 w( e. F0 E3 L4 `0 r
- * TO CHANGE. Y7 v- H" t" |& r: w- M) Z
- *
2 v; ^0 r* V! X, q: N2 t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 i% r: x9 i( x" @: K: m. G- U, G - *
0 G/ V1 t- u. |/ d6 C - * This program is free software; you can redistribute it and/or. }; n D5 b4 X+ u* M( Q
- * modify it under the terms of the GNU General Public License as0 {1 q, n6 F* b8 I( J3 r+ O
- * published by the Free Software Foundation version 2.
6 b/ ?7 G0 f# ~2 z) {5 A2 P$ Y - *
9 z4 N1 M) }7 L( n. M& A8 B9 h7 i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- g8 {2 _& S5 ?. ]) @ - * kind, whether express or implied; without even the implied warranty9 `0 G9 d; }% U$ x4 L! t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ W8 g! } W A7 t - * GNU General Public License for more details.
3 x$ W( P! ~6 r% ?8 }3 B+ q - */
, L, A$ v9 g/ \8 D' V - 4 D8 l: n( F7 ^( h- I
- #include <linux/module.h>$ X: d3 J( Z" V, }
- #include <linux/init.h>
9 C! v J' C% k0 i J( {7 z - #include <linux/errno.h> B+ M( \, M8 {' y3 z& w
- #include <linux/types.h>3 B" I- p* ]+ s$ W+ a2 S/ t
- #include <linux/interrupt.h>
8 U; m, G' Y+ N$ C$ N& Z - #include <asm/io.h>9 j6 E$ Y9 z) m0 T5 ?
- #include <linux/moduleparam.h>% P! a1 m- N- G
- #include <linux/sysctl.h>$ ^8 ?2 H9 p% M2 l/ i
- #include <linux/mm.h>* W1 D8 r& ^! L) `; U1 Z
- #include <linux/dma-mapping.h>
Z$ \/ i/ \$ g0 u5 ` - # @ H/ f) r. N7 H- Z* ~
- #include <mach/memory.h>
5 \" P9 m9 b- {, G1 K- v; q( f9 s4 k - #include <mach/hardware.h>- S- N5 m# |9 Z# P, F5 w9 w# `
- #include <mach/irqs.h>! t; h8 z7 f7 t9 m( @
- #include <asm/hardware/edma.h>
! J) e+ S0 _* o2 a: L
2 M1 m; N3 u+ g* S) l- #undef EDMA3_DEBUG5 C$ ~- s6 V5 k5 X; z6 o1 F
- /*#define EDMA3_DEBUG*/
4 f3 h" x! X T) ?6 X: v - ' K7 @3 Y3 }+ l) O4 `
- #ifdef EDMA3_DEBUG; l' Q" L$ p7 M J3 B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), }) ~( Q& m) N5 F, P$ X0 J$ u! L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 y/ I, p+ A9 m3 \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 m/ @3 y! ]* ]6 G6 }
- #else
, L' O' D& |! _8 a - #define DMA_PRINTK( x... )
& |# u: ^' {. s, ` U) w - #define DMA_FN_IN
# T# f$ ]5 ] k n) w1 S4 Z& O - #define DMA_FN_OUT+ G' c( I; Y1 u
- #endif( c! x; f5 W4 W% y% q
0 g9 ]0 P/ u& J# z2 _& ^/ Y# w' q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# Q8 m5 w3 y: K! g% j
- #define STATIC_SHIFT 3. _' Y6 J0 p3 L/ {) x- e) \
- #define TCINTEN_SHIFT 20* a( B3 F, ]: h7 k7 ~
- #define ITCINTEN_SHIFT 21
3 g7 [1 p" ~+ u5 E - #define TCCHEN_SHIFT 22$ {5 H! }# [ {+ `/ s+ J7 P
- #define ITCCHEN_SHIFT 23
& v4 x4 B$ f0 e! m1 B - 3 h. K% U' w$ Z- M" h% I+ t9 D# V
- static volatile int irqraised1 = 0;
+ O% g; v( h0 k6 r1 O2 O5 q - static volatile int irqraised2 = 0;7 _7 M% @9 b& u0 }) m) P/ D
- " w$ _3 e! Q2 X0 }/ Q; o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. h6 z( z& V/ U2 p' O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( v! [8 G/ _/ c; Y' v) J4 h I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ~' G( d+ I/ g8 p* x
) { \2 s- u5 {5 N- dma_addr_t dmaphyssrc1 = 0;6 ~6 X. K7 }7 K
- dma_addr_t dmaphyssrc2 = 0;
' o& T. `8 F- J' R+ M; D" w' P - dma_addr_t dmaphysdest1 = 0;7 W+ u9 ]; m3 a$ p( R6 S/ h2 F
- dma_addr_t dmaphysdest2 = 0;( U3 [# y* C; o4 p+ @" h0 `
- 3 b3 b3 b8 v! V4 w$ z" S
- char *dmabufsrc1 = NULL;
$ E/ r1 n8 K" j4 V& A5 G6 z0 U - char *dmabufsrc2 = NULL;
( V6 a5 {3 L A - char *dmabufdest1 = NULL;% W5 {9 \# l" G+ w& ]. Y
- char *dmabufdest2 = NULL;
$ B& o+ N, M- P- `1 `
8 D2 f$ F. v/ `! i- static int acnt = 512;
( `4 i+ |; {: H) [1 i - static int bcnt = 8;
7 h) R4 e$ D! e, y! T# d; D; } - static int ccnt = 8;
! Q8 i3 ?, n3 s! X% e
3 t! a. w" p+ ]0 N" v- module_param(acnt, int, S_IRUGO);
' \4 h4 W9 ^% S8 d6 ]) [5 ^/ a- _8 p! O" T - module_param(bcnt, int, S_IRUGO);. ] Y) ]# a6 p2 Z
- module_param(ccnt, int, S_IRUGO);
复制代码
$ K& x# L& M' A9 c
& J9 @# f* ?3 a6 x6 d% c; \! x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 W2 }* P* H4 K7 A6 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) P/ `7 Z% } ^+ ]. Y3 t5 g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 b0 U9 N" C) b' _3 N
, S8 j* _" a9 b' h* q0 Y% q- j" y* _) t+ a1 }! E9 i
|
|