|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; i6 u2 f% ]: a
- [code]EDMA sample test application/ @8 s' A1 ^. R7 R( P
- /*
% ^4 \3 A K- m* m( V4 m - * edma_test.c
4 Y, n# }) _2 a - *
# Q, N: ^6 ?& v8 ~3 r - * brief EDMA3 Test Application3 z, S% f1 h; ~ x& { }
- *
$ l6 Z6 h' P. h' L, _$ l/ v - * This file contains EDMA3 Test code.
5 G, Z- f8 H: `- F( F2 f' B" x - *
' ^+ c3 t7 s+ U+ M. P9 Z# T2 o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: x7 V, O" S; `5 h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! w# k3 V+ t+ H) Y/ K# c& a) o - * TO CHANGE.
' l, {7 x9 F9 N* W - *
V X1 O( C( B" l! h1 m+ l M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 |+ {- Z7 D/ {0 F) X
- *
9 `& [0 M; P4 d4 r, _* Z2 Q" X8 x - * This program is free software; you can redistribute it and/or
; ?3 u5 @6 A5 M/ k! M) L7 Y - * modify it under the terms of the GNU General Public License as
& @* }8 ^$ @; V1 w - * published by the Free Software Foundation version 2.
) h1 r) m: p' A1 s* Q* R S+ ^ - ** _/ Y2 M) g, Y/ ~9 v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! o7 y2 d$ v1 o3 ? - * kind, whether express or implied; without even the implied warranty
, ~6 c% D5 ?1 M2 b: b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 U' m D+ o( h3 P z8 v8 x+ ]: C- @ - * GNU General Public License for more details.
, E& b# y; g+ p' Y1 O8 S4 G, ]) r - */1 Y5 f# j. Q' H- e2 M8 Z. p
# B$ _ n, @9 \. z5 B- H: A/ J y- #include <linux/module.h>/ C! @: ]$ E* O5 W( y2 M/ r5 o. Z6 G
- #include <linux/init.h>5 \/ l1 K7 u. o7 b2 T& n* N/ e3 k0 A' S
- #include <linux/errno.h>5 o3 L9 ]3 C6 ?. X- _: a( h
- #include <linux/types.h>
% u& G- O( b8 p: l$ V* { - #include <linux/interrupt.h>
9 v0 f) h4 Y" G+ p$ R( E" ~ - #include <asm/io.h>+ \8 R& p$ u$ B
- #include <linux/moduleparam.h>! _2 H2 o" _6 U
- #include <linux/sysctl.h>* _" k, F' H' m$ g. N
- #include <linux/mm.h>- D: O* r( x- A$ |9 i* `
- #include <linux/dma-mapping.h>
8 Q, ]; F1 E- g - . k4 s& g! u" b& e: A4 k
- #include <mach/memory.h>
/ g: K8 |- b8 |0 e2 S/ O& s% w8 E - #include <mach/hardware.h>
- a. s; f( R2 i1 r, \3 K0 X - #include <mach/irqs.h>
* Y3 T8 L, W# E/ f% } - #include <asm/hardware/edma.h>
1 Q; r9 k. w0 w5 z - ! ?9 h; h; W x6 ~9 i" z9 P% W
- #undef EDMA3_DEBUG# i6 m" R. s- F; U! m5 C7 A2 s0 ]
- /*#define EDMA3_DEBUG*/0 Y6 ^6 [+ }1 ?, S4 r' A" r* w
- $ C% ^; a4 l# H
- #ifdef EDMA3_DEBUG
! l+ F% l e1 Y2 I$ W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# q& t7 X+ N4 v- o4 Z* Z( }. ?6 F! ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" {0 h9 Y( y+ Q' v5 d1 A \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 y. w" R( y6 E
- #else* e1 C1 `$ o2 z* P! H" n: Q/ G! b( t& p4 ]
- #define DMA_PRINTK( x... )
; u5 ^" l) ?/ u* ?1 _* r- y; H - #define DMA_FN_IN+ k! G2 q \6 s9 g6 q
- #define DMA_FN_OUT* B. `. @! I3 I1 v
- #endif
' p; E# b( S3 H, D j
8 q; v$ l e- F/ V6 u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; e9 O3 c% ^; A - #define STATIC_SHIFT 32 E. l5 j! d2 \ L4 X" I
- #define TCINTEN_SHIFT 20 F! V: w: h( m D& s
- #define ITCINTEN_SHIFT 21
0 I G5 ?) G4 Q - #define TCCHEN_SHIFT 225 k- _, g4 k* P
- #define ITCCHEN_SHIFT 23
" _% K0 m c+ u+ c) k7 q - # T9 Y9 }' m7 m5 x s3 `
- static volatile int irqraised1 = 0;, t! ]1 ^* q7 z; k
- static volatile int irqraised2 = 0;
) b3 t+ Q, k0 ~4 s! ~# L8 ] - * W3 R X; B: K& ?! D, {" l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: t+ T( i& H( Z+ J7 x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 b/ Q, E8 h3 u/ Y, x+ E Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 b( g6 I- f/ p* h9 T0 [4 ` _& f" s
/ Y: _1 S; W! c7 R. z3 Y2 j- dma_addr_t dmaphyssrc1 = 0;
+ G7 }. @& b! Z - dma_addr_t dmaphyssrc2 = 0;
: E2 O Q& g: ]6 p3 a4 C7 v( P - dma_addr_t dmaphysdest1 = 0;- Y6 x/ Y8 {9 O
- dma_addr_t dmaphysdest2 = 0;
P1 ?! V8 L% }8 h& G: E1 T; \ - & N( ?4 I/ m7 w9 ^8 e6 W
- char *dmabufsrc1 = NULL;3 A2 X( V! S: B1 f
- char *dmabufsrc2 = NULL;
m* ?$ p& J& E0 g0 _" D3 w: @ - char *dmabufdest1 = NULL;3 I( _. G6 C0 ~9 y- n
- char *dmabufdest2 = NULL;
. g1 d/ U- h: L/ t0 [7 Y; O! L0 B( _
2 y+ p4 {% ^( d4 ?0 N9 a- static int acnt = 512;, n: M( a- N3 x. O+ r5 c
- static int bcnt = 8;
" G1 h1 o+ T7 r; p+ i9 ~8 G6 y - static int ccnt = 8;
4 i C! |4 y% B" S( ?# ^ - ; c' Z4 w( s7 p- H, N0 B
- module_param(acnt, int, S_IRUGO);
" r4 C8 ]% }, |# ] - module_param(bcnt, int, S_IRUGO);8 y; z# h$ W5 G) U& o
- module_param(ccnt, int, S_IRUGO);
复制代码
, S% O1 b' E7 }; h
* N: x. I" n+ [- c/ G2 J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 Z5 o5 C5 O8 v2 [! \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* D/ S$ I! ?2 m7 Q, L& @' ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* |( {/ K# f8 M% W, P9 }: e
: M5 F/ R$ p2 Q
/ X4 H5 J6 J7 I7 C/ S- ^& i/ F9 F* r |
|