|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 f% n1 N( ]' E3 }+ Q2 ]% e
- [code]EDMA sample test application
# R4 r( L8 a( | - /*
5 X$ i* e$ v8 Y1 `1 w# C - * edma_test.c) S$ Z V; h; H+ a8 Z4 ]/ z: r. h
- *1 {: h B) Q4 U" c9 ]9 [
- * brief EDMA3 Test Application
& H' {0 Q% B* \2 K - *; d+ S, y; q& y
- * This file contains EDMA3 Test code.8 X4 B2 _2 C3 U+ ^. l8 [# i) V
- *
e& E9 {7 Z* \! d3 d8 \1 q+ I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. O4 k9 t$ g P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* s6 Q" p6 k& r, U% T6 v
- * TO CHANGE.$ T# P! T- p$ ?5 g2 C9 l, U
- *
& ^! ~% b2 `0 L1 I8 @6 X7 E1 z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 T' J% v; v1 F0 d& f( g x
- *7 g, g5 i' k ?0 \
- * This program is free software; you can redistribute it and/or
, T! O1 R' M4 p H( E8 S- b+ d - * modify it under the terms of the GNU General Public License as
" J5 m# j/ E3 m9 \8 L - * published by the Free Software Foundation version 2. L/ y @0 @/ p, @1 J! O/ O. k
- *" D: V2 q& j k. g& P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 B# H/ f7 H! o- n) D# n, i9 g" V
- * kind, whether express or implied; without even the implied warranty
1 W: |1 ?9 @, Z( R U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; T' h8 ^! A! S! j
- * GNU General Public License for more details. ?, g( h$ N, U" ^
- */$ b5 ~2 Z V S
- , d2 t/ M- [) p1 k9 t- b6 l/ I
- #include <linux/module.h># p, N, `7 h [* ^' m( \2 m/ S0 U& s
- #include <linux/init.h>
! H! l4 s/ b, p - #include <linux/errno.h>, x8 ^* o5 }) Z# n0 p/ b
- #include <linux/types.h>
$ j0 z |2 Q5 U, b8 e } - #include <linux/interrupt.h>
. ?- T: Z3 W( B+ r - #include <asm/io.h># l/ z8 B4 X" w3 Z/ R8 R
- #include <linux/moduleparam.h>
) k9 n$ k# C& B+ J+ N1 m" L$ K' I& ] - #include <linux/sysctl.h>% d7 m% t2 X% R1 p1 r p5 I& W
- #include <linux/mm.h>+ _. P- `; U3 R7 k" F# v/ v; Q$ [; x
- #include <linux/dma-mapping.h>
; z- ^) t6 f6 E$ x
" `/ ?) \. q' j: n- #include <mach/memory.h>
0 F! A" l, f. |: \ - #include <mach/hardware.h>
1 {8 D8 Z, F& a5 a! Z- \, R" K% D - #include <mach/irqs.h>
% h: L2 T* M1 _; K r9 T; V8 R( c - #include <asm/hardware/edma.h>3 N7 R4 X `+ E
- 9 k9 }9 x8 e+ T: O) j( G% C
- #undef EDMA3_DEBUG
4 p, W T. s0 [1 q* Y) N5 ^; Z! [ - /*#define EDMA3_DEBUG*/
! S3 j4 u, }. r6 _
+ i& w a! \/ J' H R/ h& d! Q- #ifdef EDMA3_DEBUG/ }; Y1 _) H: K& W! ]2 w/ q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ m- F( J, x u2 v) @4 b/ L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" X* M& @! X2 A: y! x2 U5 S+ w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ o+ H: n! w# K1 k" Q, T! G
- #else( k# O6 _3 V2 B+ F( k# L
- #define DMA_PRINTK( x... )& H, ]# J7 k! F
- #define DMA_FN_IN
5 @! I7 F& Q) c5 Y- r8 w - #define DMA_FN_OUT0 w; C% x" {4 F' E7 L0 _
- #endif- T% J; W0 J9 D/ U! F$ F5 t7 U
( P0 A* K! ?- [3 d- @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
B; `; |7 o# Q - #define STATIC_SHIFT 3
% q! P& L0 r+ @: _0 ` - #define TCINTEN_SHIFT 20' F1 Z' M+ V1 U6 K5 O
- #define ITCINTEN_SHIFT 21: f& E* \# ?+ `& o0 N. r
- #define TCCHEN_SHIFT 22
0 V S3 ]" m; x& x4 O - #define ITCCHEN_SHIFT 23$ a+ r0 t4 K- ?( w
- # F# t5 E2 \8 d* R& b8 t) f1 F9 Z
- static volatile int irqraised1 = 0;
7 o, `6 T/ K) O$ } - static volatile int irqraised2 = 0;
$ w0 c; F! ~5 Y" I) u7 e H - 8 @4 d! {! n) x& c: m) X3 b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 l; q5 R! v) M [! T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- v& W, \! r( ?$ h/ V1 e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: H& B- `" p7 v' `& f - ! K/ ?2 [8 U2 M1 s; K8 w1 q$ `# y; t
- dma_addr_t dmaphyssrc1 = 0;
2 D0 o' \" `9 `; [& @7 T) I+ g - dma_addr_t dmaphyssrc2 = 0;' p4 w R2 Z" V8 R
- dma_addr_t dmaphysdest1 = 0;$ f8 z# n9 f5 m4 ~6 f# I5 p
- dma_addr_t dmaphysdest2 = 0;- Z; [! L8 E2 h" a$ @
* T, Y3 c2 G9 D$ n: p- char *dmabufsrc1 = NULL;4 H2 s5 ]: V2 o5 c) u
- char *dmabufsrc2 = NULL;
l5 C% v" C, V9 C: ?8 | - char *dmabufdest1 = NULL;# A8 K f2 ?" _, d6 H
- char *dmabufdest2 = NULL;" P5 i! l' b3 z7 s2 i- L X
- : T6 p% e# g7 E) [9 t9 k3 L- \
- static int acnt = 512;
% V; g# ]( [- [ - static int bcnt = 8;7 d$ Q! [) w. Q! M
- static int ccnt = 8;7 q& l7 a) C$ K2 H0 ^
0 a. \3 P0 Y; p, t% a1 B. [- module_param(acnt, int, S_IRUGO);/ \$ _3 O) e& _. I
- module_param(bcnt, int, S_IRUGO);% }5 Z7 v8 ]& j1 N& V% _ U9 ?
- module_param(ccnt, int, S_IRUGO);
复制代码
+ y% @+ G* w* M2 o' l# T6 M/ f8 b V- U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
e I' ~* w+ u W# c- p9 {5 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# X' ^' @5 j$ m/ ]/ m0 F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 |. e2 m$ Z K L- Q! M, B
' K- x# E" \# d
) d2 i7 _0 T) ~& z% s7 M, N# @* V |
|