|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # P( y& t& g2 O2 ^6 b5 }
- [code]EDMA sample test application. r% Y$ x9 I3 T7 O/ m6 {: K7 U
- /*% z! s# |9 |& `& h9 C5 [
- * edma_test.c" k: _" q! w2 I2 m
- *$ n7 Z! }+ h8 B ~8 d
- * brief EDMA3 Test Application+ L' f: j4 X8 y: T
- *
P5 {, a; {' D8 I) B - * This file contains EDMA3 Test code.% L9 {+ }, s* `# h, k$ R3 y
- *
* h, i M- A1 Z# z& w& H) O3 V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" j( h- S% A3 j- x7 j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 H# z& S0 m& s; W - * TO CHANGE.
# I9 ^+ u- j: H0 } - *9 j; V0 f/ n% I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! j8 |) `. [7 n; D( N: ^4 G( m/ X
- *
" Q, \! O6 b5 |- ^1 W0 J3 [5 b - * This program is free software; you can redistribute it and/or
9 A/ i4 A9 F: s# S - * modify it under the terms of the GNU General Public License as _5 ?5 I+ T, s9 o& I
- * published by the Free Software Foundation version 2.
& B+ f( @+ i+ i' c$ E - *; [& X9 Y- D& w; k q- e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. U: q' m; o, \6 D g - * kind, whether express or implied; without even the implied warranty
' A! H8 B( r# A7 S$ K j7 ~9 X0 E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ^ ]2 Q3 G2 T0 g5 G/ s& \ - * GNU General Public License for more details.
# L) x) ?- M* K/ n% y4 V% t% M - */4 `1 m0 R9 n$ e. }
- / Y" } p4 i0 `7 m# Q
- #include <linux/module.h>7 S# e5 s6 e8 I' c6 h2 z. ]2 j1 \
- #include <linux/init.h>/ e+ X* x1 A3 T7 V0 D$ l9 C$ u) o
- #include <linux/errno.h>* }! d. S7 f/ ?) k# `
- #include <linux/types.h>, @3 ~; b7 v( m+ r! O4 q9 I
- #include <linux/interrupt.h>
7 i' `+ A/ T3 g. {- Z5 v - #include <asm/io.h>
* t8 Z ~1 A8 t' t5 P - #include <linux/moduleparam.h># S7 \8 {0 U( \" I' {/ p
- #include <linux/sysctl.h>
4 `1 s. A/ M# G$ T l# t* { - #include <linux/mm.h>
$ q+ O6 R5 f, _8 S - #include <linux/dma-mapping.h>
. s z4 B% {. k6 |
5 F; D# H. w+ ? j+ T+ W% r: q- #include <mach/memory.h>
+ Q$ `. a% Y' ? - #include <mach/hardware.h>7 u8 x- T% d- y( K
- #include <mach/irqs.h>
1 W9 r$ [3 E1 w: @& Y+ y& ^7 E/ W - #include <asm/hardware/edma.h>9 C+ q G# z; c3 i! W/ v
- ( N! H* f* y! b( r. O# Y3 B; M
- #undef EDMA3_DEBUG9 u; _; o2 L0 s+ u
- /*#define EDMA3_DEBUG*/8 Q. H$ d! d! G6 L6 C( k
- " }4 z; p& u! u/ J. @' q0 t
- #ifdef EDMA3_DEBUG
* c1 D4 n% W9 ~- i; l. s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 ~2 {* S7 e9 s+ { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- `$ z/ k; O% F2 T$ D' b: @, O* J) u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 Q! w+ J) P. d9 u( v% [& l- q- X
- #else
4 G% u- T: g" ]) y - #define DMA_PRINTK( x... )) G0 V% y! h: c" q+ C
- #define DMA_FN_IN& ^( g8 S1 V% n5 w* k
- #define DMA_FN_OUT+ L& s0 r/ z/ Z0 K& m
- #endif
% y' t F6 y( S' ? - 9 I: O# q$ F6 Z( v# Z1 `" j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! ~( ~$ ]( f, `7 j0 N7 |# Z - #define STATIC_SHIFT 3: b& o) r U$ f: {- P
- #define TCINTEN_SHIFT 20
: @. S' @! ^8 @ - #define ITCINTEN_SHIFT 210 Z+ _4 G- R( p% @- q
- #define TCCHEN_SHIFT 228 x* W! Z+ R; Y/ [) t
- #define ITCCHEN_SHIFT 23
. o3 Z: `. \) s- p - ! }8 e9 R; K; @$ M- t
- static volatile int irqraised1 = 0;" |( I' h- X% n4 T* j: f
- static volatile int irqraised2 = 0;
9 U. X, I6 f) N! c
/ S4 [5 p8 d# j& ^" j0 Y! [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ^2 b# |' V! g+ h( ]- W- t. l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! C M' V0 V% d0 F( X3 e+ @! W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ y# d7 D) N' ]
' f/ D! C* E* e8 v+ J4 @4 I- dma_addr_t dmaphyssrc1 = 0;6 D: @" w4 Z# I2 R/ \
- dma_addr_t dmaphyssrc2 = 0;
$ p! l" D# C- a1 i - dma_addr_t dmaphysdest1 = 0;. C4 p+ A8 ]6 x- c, ]
- dma_addr_t dmaphysdest2 = 0;7 q- i% C1 w4 |
. j* g- C7 |$ s# H# @) o- char *dmabufsrc1 = NULL;! E3 T; L7 w4 N
- char *dmabufsrc2 = NULL;, W- ~0 r& y* L, t
- char *dmabufdest1 = NULL;
- Y- l7 A5 v3 o j ^& k; X2 x; z - char *dmabufdest2 = NULL;+ g v X' W3 L; ]
8 y+ e( E% K6 n, [0 ~5 `0 T- static int acnt = 512;
0 u7 s! d$ C+ e7 C. T* W) g5 P, U - static int bcnt = 8;
" K. }8 a R+ v- L7 }/ o6 U7 R - static int ccnt = 8;7 l: S% \4 V/ v7 V' K/ \8 f/ r$ i
3 Q; Y$ Y, i9 q, _* _' T) b$ `- module_param(acnt, int, S_IRUGO);5 [) |+ a! Z3 W8 u( q* k3 W
- module_param(bcnt, int, S_IRUGO);! r$ M5 K2 \+ E$ n) y# p
- module_param(ccnt, int, S_IRUGO);
复制代码 9 e6 ~+ z" Y4 r, Z2 d
1 T" q# ^. o% S: o' C% k5 t$ `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" {) F5 g4 c' \* ^ a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 l7 `( Z; n1 k" r3 r! J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 {' }% @ w$ \
; ^7 s; o9 R' G( j6 r5 a) ~4 _1 y/ F5 Z1 Y4 B2 T' t
|
|