|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / U* f4 T! G9 s; l# ~8 E R
- [code]EDMA sample test application' x7 j& |" c4 J/ R6 N
- /*
6 t, h( J* ~7 p: T9 ? - * edma_test.c
$ ^' E6 {# F' n- A9 H( }2 n - *
# t' u( o* R! l$ z. V R - * brief EDMA3 Test Application
5 G- [) G' n& w0 T0 x1 W - *
( m; A% n# p- b: K. f6 p - * This file contains EDMA3 Test code.0 u$ R0 a7 [$ Y& L: ]
- *& d( `, a# l3 F2 N9 s. E7 u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) I( K ]& M8 P- W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 W2 h1 [2 `9 d. I0 X) H
- * TO CHANGE.% ^0 u' h: g0 M- Z
- *
9 g& ~( a+ n, Y! D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 v( g( w- ^! _. k p
- *4 j5 |7 w# e# z! l8 K4 e$ _
- * This program is free software; you can redistribute it and/or
7 _7 e6 [7 G% v - * modify it under the terms of the GNU General Public License as
- B% X% L x0 K2 j$ F. v. Y& o( [( U - * published by the Free Software Foundation version 2.
. t3 t8 @0 h3 j( A' n& E - *
1 M& ]9 R7 v m! c" Q Q% ~% ?. h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 g o/ f) S6 ]$ e) d3 } - * kind, whether express or implied; without even the implied warranty
2 V2 |3 A0 L6 E; R6 C8 S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 {$ F8 I! `% y9 Z* W
- * GNU General Public License for more details.
- b& k) Y* ?+ b1 T; { - */
$ O- r. }7 V* i! _6 A4 T
- T# K; K9 J- ^2 n/ t- #include <linux/module.h>
r+ p1 |! W" j+ L - #include <linux/init.h>! T% e$ _ d) j8 c
- #include <linux/errno.h>5 i& m) g& k; H+ z& Q
- #include <linux/types.h>
0 f- o7 R2 K" q - #include <linux/interrupt.h>. k Z: G* K7 l4 J% b/ M& T# S
- #include <asm/io.h>
' p" w1 m, [' h - #include <linux/moduleparam.h>' ?) W& K8 o$ k
- #include <linux/sysctl.h>" j9 U( y, A% c3 A
- #include <linux/mm.h>4 b9 F. R* a' R, S
- #include <linux/dma-mapping.h>
4 I1 f% {0 f" w
( H3 u# H, K7 e: a, v- #include <mach/memory.h>, Y4 M8 H# p0 d/ Y. j
- #include <mach/hardware.h>
" b- v& P: F! n# | - #include <mach/irqs.h>
+ h" p" `- K/ l, z1 U- z0 v - #include <asm/hardware/edma.h>
" k* @: {; p9 }5 G5 L2 P. P
/ G' G H$ A4 Q- #undef EDMA3_DEBUG! i/ z7 f8 @- z& C4 d5 L* C. g
- /*#define EDMA3_DEBUG*/
6 n" S1 z9 @. M( H* { - 7 a h- @0 M e1 d
- #ifdef EDMA3_DEBUG, R0 X K* b6 w) t, D% i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( I$ M# v+ K+ q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" W: O0 J2 H2 I$ b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' i" \' Y- S( I7 [+ [0 w
- #else4 K! i3 B) W* t
- #define DMA_PRINTK( x... )2 s, n. ?8 A4 X& ^2 t f# B
- #define DMA_FN_IN! |4 @3 x) y' F4 U5 Q
- #define DMA_FN_OUT( w/ H' ?7 I( H& J" v; Z$ A
- #endif
: @+ Z- Z6 r7 G! P - % i- w2 F0 R0 e: T$ _0 T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): |. ~4 R/ ~. u0 V+ y8 A
- #define STATIC_SHIFT 3! p _4 k# Y* O4 W4 @
- #define TCINTEN_SHIFT 20
4 H& I7 P, x: {* M6 l - #define ITCINTEN_SHIFT 21
1 N4 k u4 q+ e3 S4 v! d' ^ - #define TCCHEN_SHIFT 225 t: W( t) _, x2 l# o& K
- #define ITCCHEN_SHIFT 23) K; `0 [& c; ]8 @
- * {4 V5 d+ E! d
- static volatile int irqraised1 = 0;. b9 L" ?2 [: ^: I3 T3 M4 v! y
- static volatile int irqraised2 = 0;
3 s! ^& ~% f( R) H& D
7 A: H. _" C, ~% \) _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. y/ ^; g% T8 a" \) j* @, u* P8 ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Y; q, M$ ]" U7 W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 h1 p* R! y( t2 o7 e4 n
$ `+ \& _. ~6 i3 B% O' S- dma_addr_t dmaphyssrc1 = 0;
2 V/ x) z, y& d- T - dma_addr_t dmaphyssrc2 = 0;
- `; V; j* k. F2 V' E - dma_addr_t dmaphysdest1 = 0;
5 f. q' K- X0 X E Z: E - dma_addr_t dmaphysdest2 = 0;/ c! M3 s+ X* f3 Y; c
+ B. l. a% Q$ a6 K- T- char *dmabufsrc1 = NULL;3 J' m* f# p s& d! H1 `. V7 Z+ U9 y
- char *dmabufsrc2 = NULL;; O( j( k2 h. B/ _. @7 L1 v6 r
- char *dmabufdest1 = NULL;
: H( I& I6 I! X% o0 W - char *dmabufdest2 = NULL;) U3 \0 g; y( U* ]
- v9 P# f$ ?% W- static int acnt = 512;
8 H; g: v0 o: C& Q - static int bcnt = 8;
# O+ |/ k# b: w) q: G( L - static int ccnt = 8;' ^& C% ^! `) B" @2 I# }
# Z. Y4 M6 N4 I" L4 m& X' S4 _- module_param(acnt, int, S_IRUGO);
; n: c7 b9 J/ z! ?. g4 I3 | - module_param(bcnt, int, S_IRUGO);5 Y: D& C$ ]* T& t
- module_param(ccnt, int, S_IRUGO);
复制代码
, _! T- @2 E+ W! c) [+ k3 m
# A2 N) j/ v5 Y& g2 K, z8 g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 N% e% F8 U- M# o8 [' D# {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ B( } D, T9 K# B9 Y# o( x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; {5 a, I* W( }1 `: D
- Z7 b- K5 v/ v' {* p
! A1 W& Q( l! R8 ^ |
|