|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 i8 I; \. P% P. z5 K6 f" y2 a- [code]EDMA sample test application4 X9 s: N) L# y
- /*
5 E0 D) e' V$ j& S! x* _ - * edma_test.c, r7 O3 }3 }% ~! @* I% W
- *
) b% s% a% D, P: b; ?/ Y0 f) w - * brief EDMA3 Test Application2 T$ p2 Z; G. r6 _" C5 `( K8 D' G
- *5 `/ q$ ~, g$ v+ _
- * This file contains EDMA3 Test code.
0 q; {5 @, y9 |5 p - *) C2 A$ i# K, h1 i4 b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! H$ `# W) A5 g, P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) ^+ a) ~: z( ?7 @& f [) Y
- * TO CHANGE.( A! O: |1 k& R- @/ |' l7 |4 s
- *: B, g2 J: w; ` F; w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 q, P. d; G- f: Y
- *: u: T. k: g7 z, V0 N% e
- * This program is free software; you can redistribute it and/or
L" p `* i5 m' b: ]" ~ @. A - * modify it under the terms of the GNU General Public License as8 L- \6 ?" ?# U3 K
- * published by the Free Software Foundation version 2.* y4 M0 Y7 [9 Y4 d$ u9 X
- *) b0 Q* z, p+ r& I5 `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) k0 L8 J# I$ U" J
- * kind, whether express or implied; without even the implied warranty
) \6 V8 S+ c! p1 }9 _* q2 K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ h4 m( b! F9 ~
- * GNU General Public License for more details.
; j- s" ?' C, D! a: @; |- t8 O - */
# c- ~* m4 s& {6 X
0 Z! Q) R0 p$ ]- #include <linux/module.h>8 c2 Y( o% t5 o' }2 ~
- #include <linux/init.h>, _1 N9 b. U& N6 z
- #include <linux/errno.h>9 G9 q8 B7 ~) ?. ]& q4 I
- #include <linux/types.h>
5 a/ d! V. o% e6 t: o - #include <linux/interrupt.h>
}2 |6 q+ I1 c0 s% Q3 K# e - #include <asm/io.h>
2 K+ A a& Z# m0 d2 t( L - #include <linux/moduleparam.h>
& }9 R2 w& n& ? S% ` h( q# r4 v - #include <linux/sysctl.h>
/ ~. X% ?* s$ A* k, [4 d/ k! H - #include <linux/mm.h>
' l+ L; C. e- N& G - #include <linux/dma-mapping.h>
9 i$ I# T5 c( k+ z% F9 k3 X- N - 6 x3 u S% ~- l7 A6 z. }& g9 I
- #include <mach/memory.h>& x4 K; o6 P7 U6 X6 P4 ]: z! \
- #include <mach/hardware.h>- K8 ?& O: O: E& d$ O K$ F
- #include <mach/irqs.h>, j3 F3 E+ y- ^' Q- | u
- #include <asm/hardware/edma.h>
2 B& b9 b& k) \4 @) f8 U5 [0 m# Q
* x+ A9 b6 g1 o- #undef EDMA3_DEBUG
- ]$ ~5 o/ f' O# `6 x1 G - /*#define EDMA3_DEBUG*/# H" F" l$ S5 w" s" V. b
- , W c6 ^5 U; r% n
- #ifdef EDMA3_DEBUG/ e' I& d- I% n: U/ X; Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ J$ G% p- Y" K3 i- k: t$ T+ y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' h: d- w& Y* u' q- u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ a3 M1 ^ @1 W
- #else: n" C. p1 }5 [' R3 C$ x: p, G
- #define DMA_PRINTK( x... )
3 q, g% C: u! F. n - #define DMA_FN_IN
- g1 Q2 N. l# P. P% i - #define DMA_FN_OUT3 i- \: |- j6 R, x$ {
- #endif
& W- n: _ G2 M8 C - K' L( h' j' {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! Q, j8 h0 f+ u: i/ Q0 ^; e
- #define STATIC_SHIFT 3
. W9 }: U% [! a% C2 b3 r - #define TCINTEN_SHIFT 20
" ] m: R0 R0 R - #define ITCINTEN_SHIFT 21
, f6 h2 ^, p# Y" b" t, P$ O: V$ D: d - #define TCCHEN_SHIFT 22+ X) M# `8 P7 S: E5 n, s3 u
- #define ITCCHEN_SHIFT 23' B% J5 T% G+ \: I& ^$ _5 Z
: b6 _$ _ Q) K5 F- static volatile int irqraised1 = 0;( Z+ B% ?3 e6 ~
- static volatile int irqraised2 = 0;
2 u, V* p* w6 k% U: `. r6 I - ! D" |5 L3 R7 I& ~- y3 g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ^2 P8 V# G) B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ~& e6 [: H O+ N% [ B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" s1 Y0 W. h, t' I. I9 s' L" I - 2 N7 O; K+ h5 v7 F9 R: g) _' S
- dma_addr_t dmaphyssrc1 = 0;4 y7 ^: b" f' o9 t" V( ~1 b
- dma_addr_t dmaphyssrc2 = 0;
! X3 O6 ] U5 \, @0 ` - dma_addr_t dmaphysdest1 = 0;& x3 ^; u8 N! w) ^; }
- dma_addr_t dmaphysdest2 = 0;2 }' S' ?8 s! R: z! D
- ^$ b0 u1 z+ `2 c8 d- char *dmabufsrc1 = NULL;1 X' \- ]9 [* W0 o# p! j; N4 e
- char *dmabufsrc2 = NULL;, K0 R9 F' R; i8 Y1 M9 k' L
- char *dmabufdest1 = NULL;
2 S9 P5 j+ M+ m3 o( | - char *dmabufdest2 = NULL;
! L% F/ ]" `# a- O
) s. A) `" e$ A% N! V- static int acnt = 512;6 @/ u' e$ l% M( t1 m% z& ~
- static int bcnt = 8;7 }' m7 W+ Q8 t# z1 e( w' M- j$ E' J% }
- static int ccnt = 8;
; a! L% U& a/ @( { B0 B
3 l: P& V: s5 x3 L, Q- module_param(acnt, int, S_IRUGO);
* a7 p: h* Y! G" U# t( S3 R - module_param(bcnt, int, S_IRUGO);
5 A5 X$ N1 M5 d2 f" l% a - module_param(ccnt, int, S_IRUGO);
复制代码 . P* ]+ v& J) R) `6 o, d3 a
- V* \8 z# }0 R9 X- N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) T J/ A) o) d7 Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( j7 f7 ]4 Q7 q! s7 \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% b* Q5 b" O! x8 P7 c+ V" j$ o
' c0 ?- S1 y$ l9 \% M! h" o" W- r/ y. S5 D+ Y5 h
|
|