|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ F2 q! }( i3 ]; ~( U* t- [code]EDMA sample test application! u6 K. p' L: g
- /*9 M6 c" ~; M# }& U; |( G+ }8 E
- * edma_test.c6 G8 r a! x' m
- *
: R0 d& @0 _! T" @9 ` - * brief EDMA3 Test Application
5 B- k' \+ D2 y# n. j/ l V - *7 x3 Y' D' {* r4 N$ K% x- B
- * This file contains EDMA3 Test code.
5 |) V; Q8 L" |0 z9 }1 q7 h' F* r& i$ W - *- N! d+ `$ o; n$ \ f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 u2 ]( C8 U; v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; `# w$ ~+ U8 o$ S3 k W* ?
- * TO CHANGE." I, E! s; O! | |0 P$ G' N4 P
- *
3 n$ A. \8 r5 c* o. e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( {3 M C" p6 U; Y6 K/ R9 F% i
- ** y. X; u: K" S# R) v$ M/ ?
- * This program is free software; you can redistribute it and/or
- y. k1 }0 R# z0 X5 I - * modify it under the terms of the GNU General Public License as3 l: \* ?1 h' d
- * published by the Free Software Foundation version 2.! K Q; H/ _: S4 L& O" U
- *- @5 Z9 i0 Z4 v/ N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 _1 M% C9 F1 N4 y( O; o. G+ H - * kind, whether express or implied; without even the implied warranty' v6 ?" S6 g2 a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 [- g+ h7 s; D* } - * GNU General Public License for more details.1 c: a2 E8 S! T
- */4 ?9 }# _% Q; p! @0 m3 N& k
7 U+ x! l* s) X' J. s- #include <linux/module.h> r+ Z o2 e% A$ @
- #include <linux/init.h>. Q: u6 W" E5 Y9 g3 n6 l
- #include <linux/errno.h>
' O, w) S% B/ h) K - #include <linux/types.h>7 |# ]( ~4 q$ j* v1 d; x
- #include <linux/interrupt.h>
4 M8 c0 E' T @$ ^4 ?6 f3 `- u - #include <asm/io.h>" h0 I2 p D1 S' Z- P% @- d" v( o+ i
- #include <linux/moduleparam.h>7 U% u( }% ]* ~
- #include <linux/sysctl.h>
9 }: w5 q/ b) L3 r ^4 l3 |6 B - #include <linux/mm.h>
7 _6 ~! T1 P+ W) b - #include <linux/dma-mapping.h>
3 R/ P; w9 [, `! P- P - N; g" Y, n E9 v6 X; }
- #include <mach/memory.h>
/ N1 n; t" C2 n$ P - #include <mach/hardware.h>& D7 G. Y2 y) I# D0 _% g
- #include <mach/irqs.h>4 T: Y$ I% F2 a* {+ V0 [ c* X
- #include <asm/hardware/edma.h>$ k- u% c% _- b$ {' l6 C( c
- ( C8 c8 k- h- l5 V1 C: _: U$ v$ O
- #undef EDMA3_DEBUG" L9 Y5 b$ c! b, [
- /*#define EDMA3_DEBUG*/) T$ f6 Z# ?& ^ }! O$ h% s3 h
- ) b/ p1 G4 A; x; D
- #ifdef EDMA3_DEBUG% b0 ]! t. J9 [# J" {! a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ `2 ?& f) f! T5 W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; [! D0 Z5 C0 V, k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- {, [1 ]: ]' B6 d - #else
0 c: D; c+ W1 m6 c; u0 ~ - #define DMA_PRINTK( x... )# L) D+ d |5 u' w7 H' i
- #define DMA_FN_IN
+ z* L& y; u1 |* k1 r - #define DMA_FN_OUT
) d {& `6 F+ _' j+ X - #endif
$ [( |* b( m2 b5 L. Q9 V) A - ' U* q( L; R: @8 P, y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 ]; m% ^' o. s7 y* e
- #define STATIC_SHIFT 31 Z& H9 J3 B2 N
- #define TCINTEN_SHIFT 20
' M. x# Y# S$ y/ C a2 @ - #define ITCINTEN_SHIFT 21
S4 R& [& S& y+ P& H: t - #define TCCHEN_SHIFT 22
$ B9 _& l& O$ A. N6 ^ - #define ITCCHEN_SHIFT 23
/ T' K6 O' L- H I1 b% k% z - ( z, h9 U$ I4 a
- static volatile int irqraised1 = 0;5 ?$ Z, g% d W# r* S1 |' s) L
- static volatile int irqraised2 = 0;1 R' S3 s* E4 w6 I2 f% o5 p7 t5 B- Y
* ?/ P, W' U1 A$ Y. \; ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( X6 L1 G( A c/ E1 n: j) O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 Z3 |. P/ H" n: V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) s1 I7 @: Z4 O7 d - : x7 ?1 P% I% r7 q/ H7 Z( o2 @) o& ]
- dma_addr_t dmaphyssrc1 = 0;
) k/ K5 |" x0 S3 q3 M3 { - dma_addr_t dmaphyssrc2 = 0;
0 _6 q# |4 m- {. g' b8 b - dma_addr_t dmaphysdest1 = 0;
0 e5 `0 Y+ S* h) x+ E) q3 N( o - dma_addr_t dmaphysdest2 = 0;9 V" x0 X) I; J. N2 W
- , i k3 [. c' L
- char *dmabufsrc1 = NULL;
4 y8 ?& g& r$ ^3 ~8 \& s$ a - char *dmabufsrc2 = NULL;
, B C! L' L$ s1 I- p$ Z - char *dmabufdest1 = NULL;* M$ F5 E7 l2 f$ r* O& `8 A
- char *dmabufdest2 = NULL;
: z! h, Z9 g4 r - ( i3 c) u( Q) X# M" L0 q+ p2 I
- static int acnt = 512;
, ^( z, _* |4 X# d( x C - static int bcnt = 8;& c8 Y& L7 m8 ~. W% |, C
- static int ccnt = 8;# G' R* ^3 b/ D$ a# b
- 5 c! v! o4 s0 D1 p
- module_param(acnt, int, S_IRUGO);
8 \" @1 u- r R3 n0 C - module_param(bcnt, int, S_IRUGO);
, `2 P2 c5 E: ~0 } - module_param(ccnt, int, S_IRUGO);
复制代码 # Y2 U, H. W3 w
3 u) n% y* l0 Z9 y/ Y7 | 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& w" I$ g% t% q* g4 T, 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 N: O9 p; H( E R0 K. C B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* ^6 G2 f& d2 Z9 `) g! Y
. w" n; b6 r& \/ W4 x: h7 h1 P% Z' x! U& G2 ]. U+ Y
|
|