|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 x/ y7 V8 I: ]( y. [6 z8 a0 B2 C- [code]EDMA sample test application; b5 {2 z% i4 {+ m
- /*# b2 a+ C$ f$ t; X9 E: @
- * edma_test.c
- u, ?% i% R' C! v/ U( X, S( P - *
2 S7 Q, a2 D; U3 u; } - * brief EDMA3 Test Application+ d: m7 s$ ^% O) x/ X
- *2 h7 \2 p! `) @$ x, q3 Q! V; z$ Z
- * This file contains EDMA3 Test code.7 P0 w$ L6 x, J- o8 Z/ v8 L
- *
5 `% u5 w% g8 I" q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& I* m; h+ X5 H! B! o2 [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! g& i/ \! f4 G. k# [3 y% x4 g" {% W
- * TO CHANGE.: I/ J6 N: Z. e1 H1 c+ k+ P( d
- *. H5 E0 f4 u4 Y9 T! ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 w- }; G6 W6 U8 r
- *
- D( a# R8 N. @3 @0 Z* N4 ~ - * This program is free software; you can redistribute it and/or
- k) Z9 h' V$ I8 d2 F ? { - * modify it under the terms of the GNU General Public License as( K. ?/ E2 ?+ c6 p0 a
- * published by the Free Software Foundation version 2.
" M; ^) k2 C, x5 v' ~3 h - *
I" S" w/ F- o4 B2 h1 ]6 C; B2 T, m8 c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 G' e; h* w. H9 ~
- * kind, whether express or implied; without even the implied warranty9 P6 n+ O6 c% |+ S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 p1 Q& |, I; h; z - * GNU General Public License for more details.: _, Z5 i; K+ O4 c
- */- p/ V; B5 z" f$ U$ w3 H' V
- G' n2 @$ p N# Z$ F2 ]
- #include <linux/module.h>
" P/ |/ I( D9 l9 t* o# J+ e - #include <linux/init.h>, ^; D0 S: f+ b# G: ~
- #include <linux/errno.h>
% K. ] p& g. j3 b3 n+ q - #include <linux/types.h># {7 Q7 P, S4 }( l; |0 |! L1 g
- #include <linux/interrupt.h>* ^' ?( T" c7 @
- #include <asm/io.h>
5 J% y& x2 M9 |" S, z( i1 x - #include <linux/moduleparam.h>) c% t' \! Z$ s5 `. Y9 b
- #include <linux/sysctl.h>
$ }9 Q) }. M8 s- z, E7 K - #include <linux/mm.h>& ^2 k$ @5 G' ^( n( i6 o! Z
- #include <linux/dma-mapping.h>0 w: @0 V- P7 T+ |: M
O& Q2 Y- T8 \! q- #include <mach/memory.h>8 Z- a# m# a2 Y2 \; d4 B
- #include <mach/hardware.h>
; @2 W, S. d) U R - #include <mach/irqs.h>& E' [" C. G( x& ]* U2 r
- #include <asm/hardware/edma.h>: q0 M8 k' E+ ^ c; ?6 w+ v2 U* V
- - x8 C9 P+ T( a3 ~& P5 t
- #undef EDMA3_DEBUG" f4 y2 d$ y/ Z2 X
- /*#define EDMA3_DEBUG*/: o: C- W" ~5 G- b' o0 h
- 2 L$ j/ @7 I3 b l1 |) r
- #ifdef EDMA3_DEBUG
( g# e* }* |! m5 Q: i! q9 P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 j' d4 [& _& g' e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 D' V8 B: Z" Z5 A+ x6 m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) e8 u- w$ \/ T% D( o
- #else
8 {0 t2 C4 A+ b% d% Y - #define DMA_PRINTK( x... )4 c) b. y0 M6 N& C
- #define DMA_FN_IN
+ j% S- G0 a' {' S2 u. x+ X/ U - #define DMA_FN_OUT
6 r% M! B* x! j, |. f) I! P; _ - #endif) X& c- W# f3 E+ n8 R' L, ]! t( T$ [. Q
K$ r2 D1 d; {% R* L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 W" c1 L$ o' B* h" z+ }- } - #define STATIC_SHIFT 3
2 V1 j" M7 j5 C+ e - #define TCINTEN_SHIFT 20
, |& I" ^; A% V - #define ITCINTEN_SHIFT 21
- h) n3 j+ H( b9 p - #define TCCHEN_SHIFT 22: z4 a- H O) t# [! n. k
- #define ITCCHEN_SHIFT 23
f8 F' Z5 M9 U8 ` - 9 R7 U( t# ^: g/ _6 K" n0 ^2 o8 a+ N
- static volatile int irqraised1 = 0;& i3 Z7 ]9 [9 c0 U& m
- static volatile int irqraised2 = 0;
1 X' R, U* g6 ~7 z: u" w
" m/ V. X2 A5 r; x0 O4 M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 o. h! _' [+ t" a2 b. u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! o( | W8 K' b9 A: l7 J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. f8 q2 c4 a9 A. [& | - 7 j" v$ {2 k1 V; B0 w- y* c
- dma_addr_t dmaphyssrc1 = 0;
) L1 N. u0 y! _6 S7 G6 u) t - dma_addr_t dmaphyssrc2 = 0;/ J+ R5 Q. Q; B# m( q7 d
- dma_addr_t dmaphysdest1 = 0;
& G) f6 S4 ]7 N2 Q - dma_addr_t dmaphysdest2 = 0;# P0 l9 H: e, Z
, v7 c2 s% U3 ~" L- Q0 n) V- char *dmabufsrc1 = NULL;
- |2 g- F W8 {) t$ I4 P - char *dmabufsrc2 = NULL;4 A$ [* v9 _ J# {9 p+ y \3 K! u: c
- char *dmabufdest1 = NULL;
' R' N: H( G: I0 D, K7 M - char *dmabufdest2 = NULL;
) [6 @6 c! j$ ]1 G+ d; O - ) i7 z1 ?0 S, N4 y p- ^8 ?
- static int acnt = 512;
' h5 _! k' e$ R" D - static int bcnt = 8;$ \' \9 R( ?% O4 p) C
- static int ccnt = 8;
% [+ U, O. ^1 b! T) n8 ` - ' m' x# h9 ?, B- w+ a4 [8 l: ?$ d
- module_param(acnt, int, S_IRUGO);
# T: h! |8 A% w. Q. E! f+ Z! W - module_param(bcnt, int, S_IRUGO);
$ x4 H! w; L. j* V3 ^- O. ` - module_param(ccnt, int, S_IRUGO);
复制代码 - `% m; {$ x( s% Y. a
3 S. r5 G3 p% j1 m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* k. J3 h3 K: h" A6 i2 qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 s+ n$ _3 `, \) I, U' n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 [( F2 l5 l# G2 M3 E, f/ t) M( m7 e
1 p; Y8 U f+ [5 }7 l7 H6 H9 W: G& q. a
|
|