|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; y' f. w% I( O6 }. n- z- [code]EDMA sample test application
. R. m3 g7 C: M0 d2 @; x% C - /*
; D. @3 B x! @& U - * edma_test.c
/ \8 } T& N) _ D1 E - *
5 ^7 Y+ k3 l6 Z$ b" \2 s% K - * brief EDMA3 Test Application
/ T; w/ O9 J" ?; W - ** m9 z& h& ~) u8 b( H! d; c' L: X6 ]
- * This file contains EDMA3 Test code.$ e' Y2 K! c' z% N Q
- *
9 ^- I* ?8 v* ^' m3 ] L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. x; o: `* i7 \ T: ~+ A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! [. t6 \7 m$ i
- * TO CHANGE.
9 X" ?7 ~- | p+ T: G - *( M( w. q' p* A5 [+ a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. A3 y. t, V. v* E3 P8 i( d3 Z - *
+ ^' u4 F$ P" p8 E# d - * This program is free software; you can redistribute it and/or
3 a4 V P2 j) w4 z - * modify it under the terms of the GNU General Public License as
3 x7 V* l4 i. S6 }' r: [$ P - * published by the Free Software Foundation version 2.
* u- D- R( Y6 _2 M e; | - *
7 W# K) o3 Q% v) t7 P) r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 f$ o- f% e! o% A
- * kind, whether express or implied; without even the implied warranty% x) T+ S5 d# p8 S9 x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# e( T/ o$ ?% N8 f
- * GNU General Public License for more details.3 g3 ~6 N% D2 ^5 n& ]0 v. I
- */
8 ?. e8 v! k* \" B9 J" v
3 a- a: f; P6 p) M7 `- #include <linux/module.h>. Q9 _6 q( a" `6 k: z* g' B' A9 S
- #include <linux/init.h>
: {$ R; K- Z5 ]; d0 U - #include <linux/errno.h>5 \7 U3 }6 N2 ~2 T. p/ e2 a7 y
- #include <linux/types.h>
: _7 H& f1 p8 T$ V0 A, O/ ^ - #include <linux/interrupt.h>
2 T1 H3 x% n. E _ - #include <asm/io.h>5 v# Q! \6 x/ z6 z& L# z
- #include <linux/moduleparam.h>
. X% U& f8 m3 P- A8 D, H" s - #include <linux/sysctl.h>
8 h) t1 i: [0 W0 c& R- z - #include <linux/mm.h>
3 }6 f& a7 ~2 x/ H6 L' Y - #include <linux/dma-mapping.h>3 P& G# R% l/ J# B
- f4 s4 `( r: T- #include <mach/memory.h>
8 U9 y+ ?" z6 h8 K - #include <mach/hardware.h>
' H+ o# E5 T9 ] } - #include <mach/irqs.h>) A7 ^7 {" V5 x9 D! @9 x
- #include <asm/hardware/edma.h>- V9 O' n! Y% H/ x; E) j# N
% y) d' D" M* ^: n( U- L- #undef EDMA3_DEBUG
! F( l4 c) A, C, n9 }1 [" V, A) F; d - /*#define EDMA3_DEBUG*/* K% N3 s* G; x$ C% i( h
- & Y M6 l" v: @9 Z0 I
- #ifdef EDMA3_DEBUG
$ K( l# T$ z) b; z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 _. ]% x% b2 b: @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
i; E. k1 t- V3 N$ Q# a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# F( l" }: X7 L! y - #else+ I# o* @* c& H( Z! G- Y" |6 l8 e- o
- #define DMA_PRINTK( x... )
5 a+ H: q" Z% r# T0 C% O - #define DMA_FN_IN
3 B" Z3 J- N* ~3 y- z - #define DMA_FN_OUT8 y3 s6 A3 s! K7 L0 \0 c% M7 `
- #endif8 P7 g4 ?* d8 K) _+ K
% e1 x$ g% C; T) F% |% S2 ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. J% D+ ]( W w6 V' y - #define STATIC_SHIFT 3
: z5 S, _- a$ g* H2 c$ b) \ - #define TCINTEN_SHIFT 20
& n) v" e7 f N# I( A" ^ - #define ITCINTEN_SHIFT 21
8 X( N4 m3 Y v% j" }! V F5 k! v - #define TCCHEN_SHIFT 22
3 l8 z- {9 M9 U' f* W - #define ITCCHEN_SHIFT 23
$ `1 k& N. ^& x0 h
/ h' v( _, }' x# g- static volatile int irqraised1 = 0;
$ B6 `& g3 z" l) m - static volatile int irqraised2 = 0;
4 L5 m) U6 j0 X4 _1 O& O+ c, u/ M
( X$ L; J3 T, Y) @) G/ V- y I# U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 G8 T8 k; Z1 P/ @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 |5 r) w+ j& e% V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: X( F4 Z& N4 E' u5 z- l
/ J. _3 c& Q Z. r- dma_addr_t dmaphyssrc1 = 0;
5 a4 m/ O a% K - dma_addr_t dmaphyssrc2 = 0;& Q% z) Y0 v1 i
- dma_addr_t dmaphysdest1 = 0;
; e% W* F; Y$ u& h5 z; v - dma_addr_t dmaphysdest2 = 0;5 `( b9 d+ ^% h' K; ~8 i) `
- # R' P: z6 J, N z
- char *dmabufsrc1 = NULL;
' h1 U, @; n4 n- O* m3 o: r" \6 [ - char *dmabufsrc2 = NULL;7 w3 F$ U' V% x$ a9 k
- char *dmabufdest1 = NULL;/ p0 n/ |' O+ ~8 D7 X. R `' G* R; e
- char *dmabufdest2 = NULL;' [' U, a1 ]8 I
- * l; J: K1 Y: j! Z
- static int acnt = 512;
8 V- f9 V: |# _% _2 B& e - static int bcnt = 8;# i. G: m( M( e8 g5 `; \5 }, }
- static int ccnt = 8;1 J7 [4 l1 g5 D- M6 p
% E7 \3 d j( t& m. f8 b% K( c5 S9 `- module_param(acnt, int, S_IRUGO);
/ G, ^8 a5 y _! e - module_param(bcnt, int, S_IRUGO);
: j# r$ f& O' O1 s+ }& ] - module_param(ccnt, int, S_IRUGO);
复制代码 H, V/ R! X& `) [
: |& e O/ \7 e [& q, ?; n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. |9 n/ ]) V6 G- R' W8 S2 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" J. M" S; P9 p+ z# j6 p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 O$ ?( C( {& Y
9 K0 ^2 K' B9 ~4 V4 M; _
# W9 e1 K: u3 @6 N! C |
|