|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 s3 g) U; [, R/ Q" v. l
- [code]EDMA sample test application
" [0 r" T4 x$ X$ c8 s! ~4 \ - /*0 |3 A* l1 J& C1 f. h1 ?
- * edma_test.c2 l7 }6 w3 @! N$ L
- *
- J4 `% M4 c: ~. d3 V. [ - * brief EDMA3 Test Application% Y; j* q$ t) B2 D: V6 E9 K' Y7 G
- *
/ A' G& d0 w: o$ P - * This file contains EDMA3 Test code.+ ?0 l# ~* N8 r8 i$ h i6 }
- *( e, g' u$ `+ l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ ?3 M5 H6 X! r) h0 l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ n# u/ J+ C$ H4 c$ g4 R
- * TO CHANGE.3 h- a; h q- q; h/ A
- *1 P2 ]$ M1 w+ }# [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 y2 W4 Z8 N4 B+ p2 q
- *
0 J" M; |- C1 D - * This program is free software; you can redistribute it and/or+ ?0 i. n9 L7 i- w
- * modify it under the terms of the GNU General Public License as* U7 ^, g8 l7 F1 _2 u% W4 O
- * published by the Free Software Foundation version 2.
2 E/ ]) z, x8 b6 s' Z5 ~) | - *3 {) x$ _$ r# }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- L) Z' O4 r$ ^1 g+ j4 W
- * kind, whether express or implied; without even the implied warranty# J g2 K( Q2 s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( v! i# K6 b% P, i - * GNU General Public License for more details.5 V ^, O) K9 G0 q: H& J. U& h6 l
- */
* i) O+ m% v; g. w8 ?# V/ ?/ V
) d( f6 _, Q* I. M0 |$ D- #include <linux/module.h>6 M. h" G5 {! _! F9 a/ |: u6 y }1 {
- #include <linux/init.h>- x3 Y9 X. a/ f+ K/ z# i2 [) r3 Z
- #include <linux/errno.h>
# M' \$ J( s6 A. {! u( @# r - #include <linux/types.h>. Q: d5 Q8 R$ V! o _% q: V
- #include <linux/interrupt.h>
8 d- L4 G- C! S4 K# l+ e% Q - #include <asm/io.h>
9 y# b( i+ ?6 z% T% Q: {6 e- W - #include <linux/moduleparam.h>
) o' T' u0 B: B - #include <linux/sysctl.h>8 [ _( U; z5 y2 A& g
- #include <linux/mm.h>
+ y* _. @( @9 G: D- Q8 S; x8 X - #include <linux/dma-mapping.h>
( p6 f* d' h8 g9 a
- y) J) u$ ]. H. r1 x0 i6 W, f- #include <mach/memory.h>
) F2 G, b: M' ]$ B) Y - #include <mach/hardware.h>7 Q: {" H0 M9 m
- #include <mach/irqs.h>
: O( i8 w" o7 K- r- a% w - #include <asm/hardware/edma.h>+ V) V' O4 L. O8 p
- 6 p, W) i2 F( ^3 e3 F
- #undef EDMA3_DEBUG
/ t+ N- ?! F6 G! }# f - /*#define EDMA3_DEBUG*/
. Q+ l; K$ r+ y: p - 4 G! `+ {+ }! w6 v+ `
- #ifdef EDMA3_DEBUG
; o0 Q! q* A) f& R9 J: T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 S2 \) t# F {- R) ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& X+ t! c, [; p( L1 M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ Y8 y( O: S4 s% S- a, V
- #else, W$ N; P" U8 d* F# J$ N7 m& d
- #define DMA_PRINTK( x... )
+ ?! L5 _- g5 n - #define DMA_FN_IN
V% `' }$ I, q4 \% a4 R - #define DMA_FN_OUT- @" _% r% s! q: S
- #endif$ C( Z& |7 m( s* g2 v
- - F8 Z: v. I- [/ e, V7 e8 W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 P A* B3 O- d7 x - #define STATIC_SHIFT 3
5 r E0 ?: m7 w1 j - #define TCINTEN_SHIFT 20
8 f; n/ T- \* ?* C - #define ITCINTEN_SHIFT 21
" d) g: J0 [; Y; x: ^, j# H! | - #define TCCHEN_SHIFT 22: B' \ W; O; {1 ?7 r
- #define ITCCHEN_SHIFT 23
5 O" l) U* b% U' R
: R: @% t& ~& {; o$ l' ]! G, c- static volatile int irqraised1 = 0;% `: A+ q; z& x% j
- static volatile int irqraised2 = 0;
/ y' W2 R) `4 p) P* A. }+ ~
/ E, O7 a4 ?# T' E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" \2 R8 H) C8 f/ q+ m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 N0 \' _0 Q; C- n4 j9 t( `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% r& v) b9 q6 H# L+ J+ O& O
- 6 t( l9 E$ ~5 Z0 D( V3 ^' D* W
- dma_addr_t dmaphyssrc1 = 0;
5 T8 n. o C3 v) T* m! J0 ] - dma_addr_t dmaphyssrc2 = 0;
) L# Z( w8 U1 k/ Y Z9 j$ G - dma_addr_t dmaphysdest1 = 0;& ^0 u P! K$ a8 e4 t
- dma_addr_t dmaphysdest2 = 0;
: A( ~5 b3 H+ D- q3 a$ Y, | - 8 q8 |9 h" _3 P+ |8 Z
- char *dmabufsrc1 = NULL;
U+ @) a" }9 u q - char *dmabufsrc2 = NULL;
" ^( W2 ~' Y& R( h: R- @ - char *dmabufdest1 = NULL;# R; ?( K" p& l1 s* X" o1 r
- char *dmabufdest2 = NULL;
* z9 g% {3 ^' s
" }- Q0 u6 K* d7 L- static int acnt = 512;
9 Z' e% l2 r! U) g3 p - static int bcnt = 8;2 w4 {: U" R7 t$ L* ]! m2 j
- static int ccnt = 8;# ?# R! O% w7 Y3 W* n- C) v
" E7 p% Q% {- H* Y+ U6 q+ _- module_param(acnt, int, S_IRUGO);
: L" k1 ?/ s# f7 o6 Z+ v+ T2 k4 [ - module_param(bcnt, int, S_IRUGO);
2 O5 V5 {: V) U - module_param(ccnt, int, S_IRUGO);
复制代码
9 j( Y% l9 {2 G j- n, l; P6 L! V7 z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' q l9 q! @; u/ h, h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) w% Q. F9 w2 A& }6 A/ b0 x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# J5 E0 f8 |4 @. Q+ }' X% { N1 j% C0 L# P" f
/ |9 u% o* @1 `+ Y2 B
|
|