|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
d$ x9 k! E1 s1 ]5 N: _' n, S- [code]EDMA sample test application
3 y/ X) k! y5 r. n; k2 C - /*5 }% c+ z" k U, j1 X- L
- * edma_test.c1 N. {; Z8 {2 K! L2 ~+ V6 A
- *3 s" w* ?2 T ^. T
- * brief EDMA3 Test Application7 j3 ^% d' L5 B* F/ ~/ X1 ?$ g
- *
/ W/ V( a" S' s; S - * This file contains EDMA3 Test code.! v( o& Z V: t% @* E
- *2 j' L2 y0 G8 f2 G3 I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- e5 d$ H+ n X' ~! A+ c; A* V, D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 N1 b4 H( c# u% {# H t* m - * TO CHANGE.
3 f* @- l5 o- F4 z: o- I' o - *
8 J6 h; A. s7 t o. w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, m% h$ W' s; p W4 e
- *! n/ R4 ]' ^) ^% t1 w
- * This program is free software; you can redistribute it and/or
4 D& J; R4 c/ ?6 r - * modify it under the terms of the GNU General Public License as
* L. F$ f5 z0 [3 z' y; m ~2 r - * published by the Free Software Foundation version 2.
6 C/ b( b! Y; I& m8 W1 G9 D, f- o - *3 W" z+ L: R3 O/ l6 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 M& j8 V* Y: ^" S* e
- * kind, whether express or implied; without even the implied warranty
1 x9 i: a8 r2 l& E0 P; p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' D2 b1 \6 W( Q' V! Y3 {% x3 H; E
- * GNU General Public License for more details.
7 ~ ~) G+ [. y& Z7 t1 t6 | - */' I3 h$ T* U2 v$ J
8 m2 c6 [% k% a) P- #include <linux/module.h>
: ^1 g* u. O8 ^# t6 H( w6 S' ]4 l - #include <linux/init.h>
2 m3 j: z4 {! N; d% g - #include <linux/errno.h>! u( h7 N' |' q5 r4 F! {1 s+ [
- #include <linux/types.h>
. j: l5 i7 G$ ]1 q* B" h5 ]' \8 K# O" ~ - #include <linux/interrupt.h>
2 Y' E! d4 V; Y/ H - #include <asm/io.h>, A5 C4 e6 \$ `' _" ~
- #include <linux/moduleparam.h> h# a8 F$ O' A9 p) E
- #include <linux/sysctl.h>. T+ d0 T. Q2 g, E" ]# g
- #include <linux/mm.h>7 X6 E, D/ {. ~# f6 T
- #include <linux/dma-mapping.h>; e* i1 n8 ?! ^* B
- 6 z* ^3 ?4 C3 d5 h/ @) U! _8 x: L
- #include <mach/memory.h>+ \3 n# h2 U, l
- #include <mach/hardware.h>6 @: }8 v; ?0 [+ }- L& {; {
- #include <mach/irqs.h>- t. P" ]6 Y4 L# B- h& Y
- #include <asm/hardware/edma.h>8 v( y! Q. f3 o9 i+ c
- 5 q3 Q. C% O; |0 P7 { K% _" E/ h
- #undef EDMA3_DEBUG j: T' \( p" X/ j- W6 q. \! L2 n9 Y
- /*#define EDMA3_DEBUG*/; w; @" @; ~1 R( G( k
B; U% J- A2 j; H: y/ J- #ifdef EDMA3_DEBUG! A3 a3 ~4 i7 o: v# ~" d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' }; r5 J" {( x2 z2 m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 u* E" F! H0 H0 }% ]& t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 O8 c# L) V3 M7 P/ L4 X - #else9 x0 z# g; W8 s# c
- #define DMA_PRINTK( x... )
( {' O: [9 p0 ]1 c8 _' _0 Z - #define DMA_FN_IN1 C0 A" B+ C6 U: j$ G
- #define DMA_FN_OUT) g" H& P, Y: J0 v
- #endif. ^' K" ?! H- p% i, q
- ; s) P3 p6 [! ?- E0 T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 e; ~' K3 d# o! ^) j% B) P
- #define STATIC_SHIFT 3
9 Y5 `8 n5 H. Y3 _/ c V ~ - #define TCINTEN_SHIFT 20
: T, G. n5 F5 {! s5 I - #define ITCINTEN_SHIFT 21! [/ `: }- u& ~- {8 N* w3 o- i
- #define TCCHEN_SHIFT 22+ ~- Y) M9 g& x6 `4 W5 w) A
- #define ITCCHEN_SHIFT 237 W- v( u) `! c/ L: ~! I* I. G; D
- ' T0 q, y8 X+ `* x6 x" B0 ~
- static volatile int irqraised1 = 0;
$ F: Q& Q) j/ y - static volatile int irqraised2 = 0;
" @& k9 v! g8 p+ D
; a- {5 { g) z! }# c, U% i1 L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 |* i$ Y6 R2 B. s% I! Z' u, @" H* h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 I, o, G& R$ L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 K9 Y7 z! c* `$ u
. h- [7 {7 y( ?+ _* {; w8 t- dma_addr_t dmaphyssrc1 = 0;
, H% V) d+ i* V \: M - dma_addr_t dmaphyssrc2 = 0;
; ]1 r. a. }+ f; [& p* i; m - dma_addr_t dmaphysdest1 = 0;
+ V7 s. l) J& x& ]# [7 X - dma_addr_t dmaphysdest2 = 0;+ X, v$ ~6 P! R/ G2 k/ y
- ) {2 n5 w+ G/ H2 L8 f2 |
- char *dmabufsrc1 = NULL;
: o: G. x' \5 m. G - char *dmabufsrc2 = NULL;
8 M) _( i, W) m1 Q$ g9 O! H% W - char *dmabufdest1 = NULL;
% p, w! M7 v) c! I0 v0 } - char *dmabufdest2 = NULL;
2 R3 [$ C& a; U5 d; g6 w
7 z+ V s& R& a- static int acnt = 512;
9 z$ N' r2 y0 [/ r# {( d - static int bcnt = 8;
; k# L1 e% s5 W# r3 A. U - static int ccnt = 8;
, ]& L5 H! \8 M7 \ - ! R" B+ n4 F) i
- module_param(acnt, int, S_IRUGO);
1 L ~: D: J& |; C% @$ O - module_param(bcnt, int, S_IRUGO);
$ S2 X2 A6 I) L: Q/ S7 F - module_param(ccnt, int, S_IRUGO);
复制代码 2 v/ f& N) m& z+ i& s
. s5 I# Y& V+ [7 f) M/ B F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( o/ M9 a, d& Q( w9 a7 h% Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" {$ K) s5 o4 f: L7 y0 ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 @; r: M$ b0 X4 G9 s5 Z% C$ f# |
) t( X! r0 d+ n- W# I- \6 w7 @* e4 C- N6 a, i
|
|