|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, u, ]/ R2 Z0 `9 u- [code]EDMA sample test application6 y* |$ p2 ~1 E( r0 C! O8 l0 y
- /*
. R q& h) {+ |# Y/ ], ? - * edma_test.c
# Z7 j5 D& d7 [1 |, Y - *: c, F1 S5 s2 k" t3 o1 x% {
- * brief EDMA3 Test Application$ p8 _4 ?5 B3 r: A6 E
- *
) f+ J5 w$ v: z) g - * This file contains EDMA3 Test code.
* j! O/ E( T: z - *
' c, Y( t$ s! b+ E! i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
D6 d X( j0 e* O0 S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( S6 ?* W6 F- v; E# {8 { - * TO CHANGE.# q/ j" I6 O& G! j6 G4 V; h% l3 O! A8 C
- *
# D) w( ?3 H- p5 u' r' f; e8 G0 R, { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ x0 j2 F1 ?- B+ ^, w+ ~% N2 H
- */ z6 L( H5 Z) r: t0 l
- * This program is free software; you can redistribute it and/or
: a9 n0 Z. y" C! ^; g) z - * modify it under the terms of the GNU General Public License as
$ O. {" e2 G; ^- A7 n - * published by the Free Software Foundation version 2.
; D/ P, g& \" v4 { - *' t5 l+ K; w F. P: D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: [" L* }. u8 K6 c4 k# N+ x: x/ _4 H - * kind, whether express or implied; without even the implied warranty4 n; m' W# U; `2 h- i5 Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 \1 l- f2 m. J/ ~ y1 f
- * GNU General Public License for more details.: v4 g% h# Z! p2 a9 w* b
- */+ Z' k! r" ]5 F" g" }
6 F6 u: {0 c: M9 `8 ]- #include <linux/module.h>
) e4 b% K0 [. Z% @1 ? - #include <linux/init.h>
; C5 i! A0 X& |: | - #include <linux/errno.h>
8 A+ m! D* F w# B8 s - #include <linux/types.h>
; S- e8 f: z8 m" g. w - #include <linux/interrupt.h>
. m8 p# N* h' d - #include <asm/io.h>& E/ X; w7 Y* G4 E8 u8 q7 ]: }
- #include <linux/moduleparam.h>5 U6 R! i3 p5 p n1 `0 N, M! Y0 A
- #include <linux/sysctl.h>
; B& b( j. h, `+ U, l; C - #include <linux/mm.h>+ P% Q6 k: K! _5 J
- #include <linux/dma-mapping.h>4 h& ~: g, z, d' _4 ]
- 3 ?' W& N' V/ w Q' y
- #include <mach/memory.h>
) x5 ?& |9 f3 h) }6 x' r - #include <mach/hardware.h>
, t& i* m; l. n5 {2 y5 _4 i9 _ - #include <mach/irqs.h>
& e3 M: R1 V4 {0 l - #include <asm/hardware/edma.h> I1 t X4 {0 f1 V
- 6 \2 B l$ e" \, x/ i6 B
- #undef EDMA3_DEBUG
" ^( A' |( L+ m( Y8 T - /*#define EDMA3_DEBUG*/
: K3 l% L9 \3 A% Y* u" T8 C
0 M( j2 R! o ^5 x( C7 j; r- #ifdef EDMA3_DEBUG/ R( L9 G. D/ p% `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 \2 G% v$ H: m! Z# d9 {( t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" {( C: p$ {3 K: ^* J9 b6 f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' a& O' E1 s4 B8 R( |& |, Y
- #else
j- Z( d5 P2 e- @3 y/ P. G - #define DMA_PRINTK( x... )" [+ V. {9 D: ^) M2 {
- #define DMA_FN_IN
& @$ y0 P! ?5 ] S" E* H" O0 \ - #define DMA_FN_OUT+ n Z8 ]5 ~5 c# W/ {& E0 k
- #endif
, Z, e6 a% d$ I3 @2 f: ?
# E, R8 Q3 [$ n; F3 y7 H4 r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 Q& `/ {# X! c) P8 X( O
- #define STATIC_SHIFT 3) ]$ G4 d5 r9 ~, A8 s
- #define TCINTEN_SHIFT 20
0 q- {% o w, D A- r - #define ITCINTEN_SHIFT 21( X c5 I& `- D0 P
- #define TCCHEN_SHIFT 22
) U. q$ Q6 o4 f- E$ W; l9 g7 K! A - #define ITCCHEN_SHIFT 238 L( _8 i' L H. @& p( h0 z
- ( e; I5 P \! \5 V) A4 Z* x
- static volatile int irqraised1 = 0;; G" }6 ]( R1 X* ^9 `
- static volatile int irqraised2 = 0;
* M3 V4 K4 c9 n) D0 f1 c3 F& q4 @ - 2 L \7 ~. p& F! i' ~# }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ?. S& R7 d9 L6 e+ a. Q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 S3 K" `9 u' I) V' ^+ p, A i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& U2 U/ D ^( d, X h8 y" C - + e' }( W3 n% w( O7 V' b( V
- dma_addr_t dmaphyssrc1 = 0;6 R) L5 U% c8 B! ^" ]" M( o
- dma_addr_t dmaphyssrc2 = 0;* r4 H, c `& ~& H
- dma_addr_t dmaphysdest1 = 0;1 W1 q0 D+ \3 F2 }# T
- dma_addr_t dmaphysdest2 = 0;
$ B. Z/ J! Y# Q- e9 r( { - 9 G/ Y* T0 Y( L( }, T- M: f; N. T
- char *dmabufsrc1 = NULL;. }& n# N) s6 y* v( a8 @# J/ s
- char *dmabufsrc2 = NULL;; @8 S( Q# M; `- Q
- char *dmabufdest1 = NULL;
- m! e) u. q. m# z' | - char *dmabufdest2 = NULL;
8 }' I. \) ^! Z4 O- O% t - , }8 `; I- v2 d5 _ U
- static int acnt = 512;
3 P/ \4 H$ n5 J# ]: s ~0 h - static int bcnt = 8;# J" l. Q9 D3 Z: D
- static int ccnt = 8;+ W0 r' P$ v6 m) t, G9 V
- 9 L$ ~6 f; m/ V2 Y+ D) j
- module_param(acnt, int, S_IRUGO);
+ k5 V& y% q' k - module_param(bcnt, int, S_IRUGO);8 ~* m# R& q/ g2 g
- module_param(ccnt, int, S_IRUGO);
复制代码
* x. \; `9 N% z* c, m$ r* d- E- s" r" \0 t5 g Q. V- [$ o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) I3 z( Y; G" W& a% A3 V& [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: @$ R0 o0 b: X) T( M) ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& a1 {% F/ J/ m
# A! a6 w3 ?! n$ Q# M. k9 s! v
5 G: B0 k# n7 O v6 { |
|