|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 W) o3 J) u" b# r- [code]EDMA sample test application
/ K/ h$ T R4 |1 G, Y5 \3 k' ?: C3 M: V - /*5 R' S( {- m( K
- * edma_test.c. c4 G+ A* N% J% V
- *
2 `' j5 r7 J0 \8 p9 _. \ - * brief EDMA3 Test Application
: _* P+ k/ r6 ?4 n0 U: \8 ~ - *' m3 H- o9 @; o: @
- * This file contains EDMA3 Test code.4 q' F# I9 [" y0 c1 o/ _. {
- *! R* R% { Y5 ~9 E7 N# o6 ]9 c+ W& K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* m# G6 i" C! Q U S2 \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ q' e; r4 t. R5 ^* p* d
- * TO CHANGE.% a. E# G; M- p+ b
- *
" D5 L( f* b! E0 E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& c- g9 I# O' T% I
- *
; `$ b& M9 O, E$ c1 ?+ Y" M - * This program is free software; you can redistribute it and/or
8 K3 U+ [6 b0 T - * modify it under the terms of the GNU General Public License as/ y9 K4 \/ D# d0 H- ^& |% u, l
- * published by the Free Software Foundation version 2.+ A ?( r! P2 v, D# r! h) p- @& T. V
- *
( W4 _' W. o( X6 { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( r8 D0 [& p+ w* s
- * kind, whether express or implied; without even the implied warranty0 E& Y2 p, [# ^8 u! K( ~: t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 a' D) [( o# ^0 ~
- * GNU General Public License for more details.+ l, @5 e$ W1 z/ O2 e9 ]* a6 L9 e
- */
- m+ Z9 k& \+ V# z+ H
$ A" K! q* k8 g T- #include <linux/module.h>9 T `7 l! J+ a+ M7 @, s5 f
- #include <linux/init.h>( k) x' ?' P9 m' j
- #include <linux/errno.h>4 M j% R$ E4 H; I K1 {* W
- #include <linux/types.h>
/ s" R3 i' U8 h% J" c. J3 \7 ~. H: E - #include <linux/interrupt.h>- i2 i8 _/ C% R$ F6 i% O8 R9 g) B
- #include <asm/io.h>" P; ~8 V0 t; d7 n' N! f$ U( ~
- #include <linux/moduleparam.h>& ]) o+ Z" i+ w7 N$ ?
- #include <linux/sysctl.h>0 y5 L7 h1 e2 W4 r( A7 I/ r3 c [
- #include <linux/mm.h>1 t k# Y0 w& d4 x
- #include <linux/dma-mapping.h>
, D8 N X5 `6 t/ i6 r* t/ W
$ t4 O* w& F: a3 v# e- #include <mach/memory.h>
( m- b! k4 M \5 S - #include <mach/hardware.h>% q, r* ?8 v: d- e& e
- #include <mach/irqs.h>
( S8 |, H& E6 v: v - #include <asm/hardware/edma.h>, N# F- @9 ~6 d4 Q' v# |+ l# q
- : r; H: e, x0 j. A0 w
- #undef EDMA3_DEBUG w2 z4 Y8 }% q3 x+ m# {- y/ Q
- /*#define EDMA3_DEBUG*/. I3 U; {3 \( Y; C
5 s U# o/ n7 x6 s9 }2 F1 |- #ifdef EDMA3_DEBUG0 o* w; c" Y; {# n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' x: d% q$ U; o- d- @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
H* J+ D$ \; L* Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 Y3 i2 V1 v' L0 }
- #else1 [) |6 J6 n/ M4 a
- #define DMA_PRINTK( x... )7 d6 r! [* U* {1 R
- #define DMA_FN_IN& a+ s5 p* R# S7 W: l, u
- #define DMA_FN_OUT9 }% x6 `* W3 ]# x
- #endif
; {5 m, k4 e; r* P- F - # m5 e6 E- `# l$ S$ v' N- b5 h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' L' y2 n4 O* L
- #define STATIC_SHIFT 31 \+ w8 H3 z$ D$ f3 C! H
- #define TCINTEN_SHIFT 20
5 u) u6 d, m7 u; p& A G: X - #define ITCINTEN_SHIFT 21
- C) J9 z, D# e3 }9 M7 D - #define TCCHEN_SHIFT 220 ^& ?8 K0 R' P$ ~7 e$ c
- #define ITCCHEN_SHIFT 231 t m2 V8 D& h
1 T- g2 ?) Z7 Q- static volatile int irqraised1 = 0;
! z- f0 T4 @" R4 A$ o: X* a4 X - static volatile int irqraised2 = 0;$ g1 r# ~! `6 E& |- |/ M# [+ c
- 2 t" I" R& w. Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 P( B+ r( o8 Q% K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 w" y( c, f) {+ L9 S1 T+ A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, S( M* [7 I/ x/ _* A) P; c - ; C+ I: x6 l* g# u) e: {
- dma_addr_t dmaphyssrc1 = 0;) e. p; U' y& A1 C1 l
- dma_addr_t dmaphyssrc2 = 0;
3 X7 h3 L5 ` F2 k9 t" P3 e - dma_addr_t dmaphysdest1 = 0;
8 T+ v' O" r6 s' [0 W - dma_addr_t dmaphysdest2 = 0;
5 P: Y, q, p$ l) T - $ O! W6 g7 R3 b- D
- char *dmabufsrc1 = NULL;* Y! A/ e6 }7 l; ?: Z' a+ P3 I4 M
- char *dmabufsrc2 = NULL;
1 g' L# H1 k/ T" A8 F - char *dmabufdest1 = NULL;: a# I9 N1 w# X, o: _9 v
- char *dmabufdest2 = NULL;& [2 t0 g4 h/ f/ m0 `
1 t* t* }& z* ~" v2 Z5 l- static int acnt = 512;6 N0 m9 h( x' Z# F) [; P$ i0 ]
- static int bcnt = 8;
4 k) x! q9 w* E8 o; Q) y, @ - static int ccnt = 8;
2 F8 G* `$ u, ^# e - 4 F4 C* D* X: D9 N; Z
- module_param(acnt, int, S_IRUGO);; h3 \3 p6 ~2 m( o M
- module_param(bcnt, int, S_IRUGO);0 w; M. t1 |; v$ T% }5 w
- module_param(ccnt, int, S_IRUGO);
复制代码
; k3 ^9 }* t! x9 V# w" c" r; ]+ v- I* K- ]% l9 ^: e8 e% x2 u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. Z& I6 i+ _+ O' M( V+ sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 O/ c. z; T! `; L) D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& S; k- l' n* c' i5 X. I* o' p
1 z8 p! R9 D; G9 t3 y
) V) t5 H' C+ k+ e, Q |
|