|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 f" m( B& p) `+ p+ W" _- [code]EDMA sample test application
5 u" N7 U& j5 M/ x" W - /*
: X% H2 u- R* h% h( q0 t7 l - * edma_test.c4 K6 l# @8 _ z* P. Y2 c' B$ F
- *, V% N& G, v; o* a% e
- * brief EDMA3 Test Application& ]" v6 G* w+ K% {8 T' @: c! [
- *; B$ x; B4 n# E
- * This file contains EDMA3 Test code.) C; \; z1 Y! L) M
- *
* Z8 `( w$ v5 n1 g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# V# G/ d( a) D+ q5 c/ `) C0 H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( |3 N, ?( X: h- f3 p5 J n* F( O - * TO CHANGE.# K+ j! A# }$ q) v" j$ L
- *! E8 z2 n& g! z% s( D$ z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 e4 M' W& R% J3 j+ c2 G/ [6 S
- *
4 p8 R7 v! W" @5 h - * This program is free software; you can redistribute it and/or% I8 S/ U0 g$ T: D, n" ~
- * modify it under the terms of the GNU General Public License as
: Q9 z9 h5 t0 q' e1 m - * published by the Free Software Foundation version 2.
) l+ v8 v/ f! w+ _6 ^- K* c5 q6 D - *8 i o5 \. @* ?% U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
F4 T8 U' R# D - * kind, whether express or implied; without even the implied warranty
9 i% D" j. ?+ h) N, d7 L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; Z! }9 u6 g# L0 t$ n7 S( S - * GNU General Public License for more details.9 x: ]' N5 l2 w* L. Y* U
- */4 O& U+ G: ?2 J
- ! j5 `' I2 f" {( [1 G7 a- m, L: n7 a/ B. H
- #include <linux/module.h>
% P' N1 A3 Q6 @* d - #include <linux/init.h>
, z& f s7 {0 L+ C; P - #include <linux/errno.h>
3 B3 d9 ]2 f0 y! T - #include <linux/types.h>' g) n4 Z \8 O6 a* s
- #include <linux/interrupt.h>
5 @3 p: W# k' A& n, @ - #include <asm/io.h>
5 E4 ^: [- `, f; I - #include <linux/moduleparam.h>
: G1 F: I1 O8 { - #include <linux/sysctl.h>
9 U$ C6 S0 D8 S- ]5 l0 q - #include <linux/mm.h>, X9 Z3 P6 g. ^% l& }) Y8 I
- #include <linux/dma-mapping.h>0 p# t: J6 g# @" o! V w
- & J' N3 C" e" J" x# {$ ^
- #include <mach/memory.h>
4 ?7 a) f: M- y0 R1 S/ `, w) i - #include <mach/hardware.h>
# L1 y U% `" L& Y - #include <mach/irqs.h>
- e) l% }. \( f- t- g9 R8 a9 a5 D+ w1 b5 G) i - #include <asm/hardware/edma.h>1 U7 d; M: m( A: b; d
; L+ |: |/ g6 b; b$ Y* t5 y6 ^* v9 X- #undef EDMA3_DEBUG" p7 W m) [( _- s; w5 w
- /*#define EDMA3_DEBUG*/
! Z+ q0 J9 C3 ?' [) r- z - I6 y7 z3 J* J
- #ifdef EDMA3_DEBUG
( k" \. x' I1 Y- L' ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! `* [" Y' P# ~+ @) l( l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 d9 c8 F0 W4 I1 U; E- P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 c2 Y \1 b9 H9 t- {; ?5 k
- #else
! V/ ` F( W0 s5 _) E1 i - #define DMA_PRINTK( x... )% F0 i, G( C, O7 j+ y
- #define DMA_FN_IN6 _: l" |& p/ ]& U- j$ E
- #define DMA_FN_OUT
# q5 d: G K* ^0 S: F - #endif g# K. z4 K/ d" ]* U
- " u% Q% V7 K* D; A9 D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ b% }/ H: j' W7 [- }7 p$ w - #define STATIC_SHIFT 3
9 u" x" C9 v$ H Q+ N; d - #define TCINTEN_SHIFT 209 z2 u! f) R7 U$ b3 H
- #define ITCINTEN_SHIFT 21: q, t& m6 O4 S/ i! G. U
- #define TCCHEN_SHIFT 22
+ z5 M8 J" `0 z* M - #define ITCCHEN_SHIFT 23
: N( a Y4 P; P. h3 V
8 T2 f& Y- H" ~9 X% z% Y; P- static volatile int irqraised1 = 0;# h- a( K# Z( D& f/ r- E$ B
- static volatile int irqraised2 = 0;; Q1 o+ P1 j& S
6 @' h( r8 [+ ^5 o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 \' U* F7 c1 y& I0 s5 H | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 t; t: {( A( o5 @1 u: S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' U! o; s3 v6 J% j
4 p% T1 v/ k0 P$ ~3 u- dma_addr_t dmaphyssrc1 = 0;
/ V; ?, ? Y0 \; U) k4 x8 e7 F - dma_addr_t dmaphyssrc2 = 0;& F8 V; i0 g {6 A8 i
- dma_addr_t dmaphysdest1 = 0;
5 J5 j2 D; z U. ]* ~ - dma_addr_t dmaphysdest2 = 0;
, Y5 H$ I$ K. m# K
7 ]; v; k- X& b- char *dmabufsrc1 = NULL;
# O. e% Q, ?7 a0 b$ ?6 O( P - char *dmabufsrc2 = NULL;2 x3 N( F1 _; N' ^+ i' U U
- char *dmabufdest1 = NULL;
6 g. e$ l( `7 F7 Q - char *dmabufdest2 = NULL;! w: X; ^) q h; A' I7 T9 l
e% h; ^" Z$ @3 |- static int acnt = 512;
( W! o: k+ f/ \0 i9 y) R' a# K - static int bcnt = 8;& l' z- K4 s! `0 N
- static int ccnt = 8;
9 i, u8 Q9 k2 p1 M# z9 M/ W - ! R8 v$ e* ^) u
- module_param(acnt, int, S_IRUGO);! S$ f5 G$ g9 X% z C
- module_param(bcnt, int, S_IRUGO);
' e- K. B4 W& p- k - module_param(ccnt, int, S_IRUGO);
复制代码 6 j0 P8 B) ?. k8 a, ^7 v
1 J1 ~% |, f$ a. V) l+ {$ F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ B) l2 Y4 {8 ?# v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 J& _' R3 Y' u& z6 C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
H5 }: R6 F) [3 A" l- S) I/ G/ R; b. v5 L2 K( V
, [) [( ~% g& {/ a
|
|