|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 D" @9 u( p% C% S4 f- [code]EDMA sample test application
" ]% E3 u2 p: t2 H - /*9 d3 k) {8 t% x3 V
- * edma_test.c
+ K! H: i* x5 Y9 p5 F5 x& R - *: _! G; _, l3 w9 L) b* b! ~
- * brief EDMA3 Test Application) @3 ~+ {0 Q. x/ d- C: f
- *) c( V& U2 I( F- I$ s# F$ L
- * This file contains EDMA3 Test code.# j4 K* o% B/ J# B) N" p) J
- *
' M4 G O1 c$ R/ ?# N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! o7 U4 {3 u7 u9 U* k1 _' t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 s6 p. t6 c" b2 m- N3 z4 f - * TO CHANGE.
6 O5 p* m7 s |; @ z2 J% H+ N - *( R1 t8 D/ R. T* w8 X) q1 p2 p' k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: @- K; Q& c, {* X3 }
- *
3 x1 l9 Z* t" d( C# P e$ V - * This program is free software; you can redistribute it and/or9 m1 g! y, d( r5 q
- * modify it under the terms of the GNU General Public License as' v' a2 [' ?& V |
- * published by the Free Software Foundation version 2.4 a7 Z9 I9 e* U9 U1 B. G9 g- Z- ^
- *
U: i) G+ `9 U) X7 `9 I: \" C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 T- ]/ Y6 w6 g( ^7 t& t0 r
- * kind, whether express or implied; without even the implied warranty8 @3 l# f U/ [3 ]9 }% Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 h& ^8 o* i& U( w, ~ - * GNU General Public License for more details./ b4 D3 V; [$ u3 ^
- */! ]+ P/ d. J; V, L I/ L( c
I* [9 J) q7 |2 q- #include <linux/module.h>
& h o5 N% G4 L) l/ m% h - #include <linux/init.h>) D- s# H7 O( F/ l
- #include <linux/errno.h>- M3 m7 q, V3 H. B
- #include <linux/types.h>1 ` w1 }8 K. J" b6 b
- #include <linux/interrupt.h>7 z+ m0 o- r0 Y6 _% D2 v* L& K
- #include <asm/io.h>9 }8 ?' b c" L% h& h5 y( W& e7 d
- #include <linux/moduleparam.h>' s" `/ H" E, z" h
- #include <linux/sysctl.h>
' [# R- X+ `% G+ _! ] - #include <linux/mm.h>
; W9 L7 V b8 r0 ?7 ~ i4 { - #include <linux/dma-mapping.h>& C) S) ]+ q2 o6 N
- : }/ U/ ^8 A8 f1 Y n& \2 ]
- #include <mach/memory.h>1 ?$ F! ^ c9 J, c
- #include <mach/hardware.h>: A3 m+ [/ m+ s" J* C/ ^2 B, l
- #include <mach/irqs.h>6 f' X4 R5 k$ F) _. i
- #include <asm/hardware/edma.h>
1 y5 I" `) u S5 Q0 P
( O7 W# |/ w. m* R K- #undef EDMA3_DEBUG/ w6 Y/ G# ~" c1 n3 u! d. q5 l
- /*#define EDMA3_DEBUG*/
& D6 j" C2 p& N `, {% w
. K# S7 R8 Z+ S- Q4 ` b- #ifdef EDMA3_DEBUG
4 `$ |, K$ \) A4 U; J# X8 z/ g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" ?. @) ?1 E, t a. m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( y. z* `; u3 f/ R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; U- s, I# K, {' q5 d - #else
1 b" b k0 a7 T( G - #define DMA_PRINTK( x... )4 l! I. J2 n' z$ l% X, P
- #define DMA_FN_IN
! `) z2 G$ a3 N& z: R, I$ ]- I - #define DMA_FN_OUT) O+ b ^; Y' V% _
- #endif$ Z! L" G# u/ Y' o" l
- . G5 ~' s) S z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! |# F) a0 y. y6 n/ U1 r - #define STATIC_SHIFT 3; q5 w2 y; l8 B
- #define TCINTEN_SHIFT 207 z4 Q$ x# G( l" ~6 c; J
- #define ITCINTEN_SHIFT 210 V( _' P: Z2 z; z- `
- #define TCCHEN_SHIFT 22
0 G& V' K: s7 ^. e - #define ITCCHEN_SHIFT 23
# {+ h6 k) h) v# Z6 y0 g: | - * O% s$ U& } D
- static volatile int irqraised1 = 0;+ G i2 {2 I8 h' p; g" | z
- static volatile int irqraised2 = 0;' V/ I; _! |9 C* A9 m
- " h4 j: h1 B! \1 T) u. {/ G F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 H4 L6 M1 `! [8 ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 {+ N7 `+ B* P& r) l# v7 }! S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, z# D. |6 t7 X; u# K
- 8 G1 |, ?7 f, l: L& t7 Q8 Z
- dma_addr_t dmaphyssrc1 = 0;
' b, @+ D9 C/ O7 \) q! q$ s - dma_addr_t dmaphyssrc2 = 0;
/ I7 m& q4 M# ?& F$ L& R# [ - dma_addr_t dmaphysdest1 = 0;" N9 X9 ]2 W- k* c6 h
- dma_addr_t dmaphysdest2 = 0;8 _' D& p8 i: a: E. o% t
- - }- g* Z* d" |: H
- char *dmabufsrc1 = NULL; _3 x3 }; q4 e: U
- char *dmabufsrc2 = NULL;
, C2 I9 p' L6 f6 ^4 {1 K - char *dmabufdest1 = NULL;
9 I* }9 p% Y0 F+ b( @ - char *dmabufdest2 = NULL;
2 r0 T( f- |! a1 Y5 n
/ ?6 b& { G, o. \+ f- static int acnt = 512;
2 _; H* x4 [9 z: Q: O6 a - static int bcnt = 8; P' o& D2 r7 q& [ w. \7 T8 I7 ^
- static int ccnt = 8;; Q+ u! r% Z% p; g7 ^2 q8 Z2 R0 m5 g
- ' M" p' Y7 A5 H% l3 F& P
- module_param(acnt, int, S_IRUGO);* d) {5 J0 C) p. n* _( y$ t- E3 k
- module_param(bcnt, int, S_IRUGO);. U" F, _7 f5 A7 m) z7 I' O
- module_param(ccnt, int, S_IRUGO);
复制代码 2 B3 W5 H k3 j5 E5 m
( B8 F. g6 a6 Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) B/ ^; M n( N+ y: z# J/ G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 s/ D: t5 s! M6 \9 ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 M7 T# x0 [. D4 P' l4 ~6 \6 h
; X. e. y/ c& J5 K4 ]3 d) T; n; ~1 a
|
|