|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' C c" u; Z9 ]7 y
- [code]EDMA sample test application5 j) k J5 d r9 L
- /*
5 U9 V. o1 Y# r( [# M - * edma_test.c
; W. w2 J+ b/ n# ]5 r - *( m y6 ]5 i5 p' l+ T, p; {
- * brief EDMA3 Test Application: x( e5 i b3 S. r3 E8 g
- *
# V5 D, ~: ~) B2 [9 ^# o- K/ b - * This file contains EDMA3 Test code./ F, I/ B2 D4 w$ X1 N
- *; d; i4 @7 u q6 Q3 O& K1 L. S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" R/ `/ f+ T0 e' J8 p6 ~9 z& i/ w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! z0 ?+ {: g$ a2 g& O9 B$ M - * TO CHANGE., w) {% M% Q0 ~: ]0 P, l6 H
- *
& L: _+ Z( n! g" L# G& d3 v; f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* Z$ I8 W9 c4 r0 O% A1 L1 o - *% q3 v- p( V A- ?& h
- * This program is free software; you can redistribute it and/or' j: F Y- l- Y
- * modify it under the terms of the GNU General Public License as
: S# A' L" c2 Q2 o0 S) ]: W - * published by the Free Software Foundation version 2., t3 T5 P1 ?- @$ T% S2 u& j
- *
& S ]. _! G4 U: u! Q* [ E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
|, M# t! D; n) C# s) I( Q, w' o3 h - * kind, whether express or implied; without even the implied warranty
9 J+ a0 F5 @+ L( w" Q2 [# g& g6 Z4 h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) x0 _: P; k2 a3 Y5 ]5 W - * GNU General Public License for more details.) K, G) `4 ^1 e& _7 C* o
- */$ C* p7 b' ]1 }# t* q) ?% r7 C2 F
- 4 k! p+ q4 s: A$ x4 M. ?: t2 N
- #include <linux/module.h>
# d* E1 k" ^( }" S7 S2 h - #include <linux/init.h>' a$ X& ?: e% U j5 }" s; u- R
- #include <linux/errno.h>& ^9 u" J E3 l3 i/ _
- #include <linux/types.h>9 q+ `! ~7 I. m/ d' k& `$ L
- #include <linux/interrupt.h># R8 F/ i6 h; o: q: i
- #include <asm/io.h>. N5 r& E8 y, A$ B1 ~
- #include <linux/moduleparam.h>
5 G' S( u8 c1 z5 q' ^9 Z: X9 q - #include <linux/sysctl.h>7 {- N! L# x) |, ~. S4 A; G
- #include <linux/mm.h>
1 A" [( a" d' c: G# b `4 J' e) i - #include <linux/dma-mapping.h>
, j4 M9 ^ y; C- J' B9 X - . o/ Q) B. R; j1 v* n# w
- #include <mach/memory.h>0 ?6 A# r+ u; V1 d
- #include <mach/hardware.h>
6 _/ z, I# [% e" Z - #include <mach/irqs.h>
( c) x8 ~. z, N0 d7 H - #include <asm/hardware/edma.h>5 G l ?) K# M4 n
- / h, y6 u5 }6 q
- #undef EDMA3_DEBUG# _2 s4 [: w& I T+ N% x
- /*#define EDMA3_DEBUG*/$ E! f8 O3 k# e" O, ~3 ]$ i' ~8 ?0 o
. ~; f# A/ V$ q$ Z- #ifdef EDMA3_DEBUG: d8 n2 u4 n f9 A, ?- v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). j2 W% p( W7 S5 J, Z) o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( A; g2 Q3 p; D' j+ q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* q1 R5 [$ H8 N. s% b8 r! y
- #else5 j4 N. }% L A$ j+ c) U2 P% i
- #define DMA_PRINTK( x... )
( W" L5 \* K" {: K' f - #define DMA_FN_IN/ g; X% H: M d- n# I
- #define DMA_FN_OUT
1 i$ x8 A3 h& {1 ` - #endif* L3 m2 ]* W. B% R+ c. ?
' ^" j6 b8 U0 O1 ]& d5 h$ s) w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 |& ^5 P$ `! H6 {9 @ - #define STATIC_SHIFT 3/ V# N3 R9 V* Z
- #define TCINTEN_SHIFT 20
' P# V2 e* C! Y3 n - #define ITCINTEN_SHIFT 21# c& |" S- M" t$ h' F7 K1 G' G
- #define TCCHEN_SHIFT 22
# r2 u+ i* F0 Y - #define ITCCHEN_SHIFT 236 d; N/ G/ }+ M
- 3 Q1 z- l+ s- C" Q5 Y6 ]
- static volatile int irqraised1 = 0;9 j4 K& S& Q5 ~) q# [! o3 M
- static volatile int irqraised2 = 0;
1 N7 L/ K6 ~3 s. g' I
+ D K; z4 Y. t. t6 a8 c7 u( a) H- u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 @" u. g- q9 c9 f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* A$ K( i! M$ l1 L7 n( J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 A) C/ B* U! m4 A - * C' m6 G$ V) h" N
- dma_addr_t dmaphyssrc1 = 0;) a* h$ C& u1 c' I% M0 S7 S+ z. P
- dma_addr_t dmaphyssrc2 = 0;# C7 j' j# D( ?1 }5 K+ b
- dma_addr_t dmaphysdest1 = 0;# e% ?# e* w5 v! p* m9 x( f0 @
- dma_addr_t dmaphysdest2 = 0;' g& F, y+ h. a8 v% ~
- 2 p2 D1 Q/ p$ J* k9 L/ H. J
- char *dmabufsrc1 = NULL;
; i- Q5 o; E+ w: s( H - char *dmabufsrc2 = NULL;
# g6 A- C5 D$ }7 O - char *dmabufdest1 = NULL;
$ y7 y. C( _ H - char *dmabufdest2 = NULL;
8 [( q: x Y0 b9 ]2 `+ H - ( M4 S2 @( v) P9 B7 I/ r
- static int acnt = 512;
5 D3 [ {* M+ @) p8 D; } - static int bcnt = 8;& J y% Y7 L0 K {+ c5 k! k: y) D
- static int ccnt = 8;2 e! ~4 ~* G/ p" h8 h0 d+ k) z
- ! `# k# Z8 u5 _$ X+ e# e/ t
- module_param(acnt, int, S_IRUGO); ~0 t1 U/ c9 j6 I/ l: o2 n
- module_param(bcnt, int, S_IRUGO);' t3 S9 Q% o1 Y7 ]$ \4 U
- module_param(ccnt, int, S_IRUGO);
复制代码
( K$ h7 ~" d& D M5 H3 v7 D
3 i# v7 S/ z( b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
n# G u- q8 m4 q$ d+ marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; C* k, @( ~! W& u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" g; p- E8 b! { k( T: ^$ S4 s0 i0 D8 [
* o; f# @) _ Q |
|