|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( `+ ]5 Y8 |" o- [code]EDMA sample test application6 I2 y5 C# w- o8 c: d
- /*
& L' j1 Z& v. y$ ~9 G1 W - * edma_test.c
: G6 }4 Y( @7 Z3 ~: i - *( j+ ~& h) ~1 I8 C1 `7 J
- * brief EDMA3 Test Application+ l2 V; P1 P, D
- ** B: n$ m1 h; J% e8 C+ H
- * This file contains EDMA3 Test code.
- H5 q5 G% {5 I8 Q0 V - *
# |0 m7 ~, B& Q2 C. r+ J @9 ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 q- p2 D4 X& t7 k: a" c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ x- }% \, h* {5 a: b I$ x
- * TO CHANGE.: ?& y% z/ o/ [" @- U. ~
- *
. c: D6 P1 M1 D* G, q; E" T' q0 k& d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' `' g/ U& b6 H$ \' {! y4 S4 y# d
- *& b1 s7 _0 Q$ U3 G
- * This program is free software; you can redistribute it and/or( R8 c; `. k( O R$ _
- * modify it under the terms of the GNU General Public License as" Z8 u; q0 u- |' x! ^# P/ l0 n
- * published by the Free Software Foundation version 2.5 x+ a5 b3 z- N
- *
, s6 n) }; S( {& c3 d% ?) x3 d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 K& v( {3 P# h6 W
- * kind, whether express or implied; without even the implied warranty. Q: V" r7 f, R7 x# _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' e, J+ m# } m
- * GNU General Public License for more details./ @* M6 y+ p. O* ^
- */
' C1 q1 a, r. @6 p9 f - ; ?: q9 O0 F' B; O
- #include <linux/module.h>+ Y. L7 u- T: S$ [+ n d3 m
- #include <linux/init.h>! V. G: a H, ^3 f+ w) e
- #include <linux/errno.h>
. F) s" m! D! I' y. q: W - #include <linux/types.h>
/ j" P9 V' z) N0 } y - #include <linux/interrupt.h>% B3 U0 _7 s! P# s! n; S
- #include <asm/io.h>- p+ ~- z7 K& J
- #include <linux/moduleparam.h>8 L. l/ N4 } g+ l0 N# @
- #include <linux/sysctl.h>/ H$ }- u6 s( R9 B
- #include <linux/mm.h>
! k6 w" s8 A0 p2 M/ {( H L. k B - #include <linux/dma-mapping.h>
^; z: ~2 p/ a$ E b
, w. s' }" H" i3 T7 i- #include <mach/memory.h>* _5 Z( }# E1 r, V9 t& i6 L
- #include <mach/hardware.h>0 h1 ?7 t( _3 U$ O) E- b
- #include <mach/irqs.h>) e, r: f0 H7 J' m5 h
- #include <asm/hardware/edma.h>
" s/ H+ d1 ^3 M7 Q$ }3 s; M
9 p3 P. R6 `3 E6 e- #undef EDMA3_DEBUG- X- a$ J& O x; C! x' G$ O
- /*#define EDMA3_DEBUG*/6 K: `7 o* e* V! T0 e
- ( q) X0 v( Z, q& ]( b7 f; g
- #ifdef EDMA3_DEBUG
: H1 Z1 O: ?- W% Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; c D2 {' \2 C9 L* ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ I+ n" G$ j( r& m% Q z U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 j o4 X. W/ b - #else& @4 f3 v4 R! y' M
- #define DMA_PRINTK( x... )! m9 X4 O. K, Q" {1 H
- #define DMA_FN_IN. P z8 x$ k+ g( R
- #define DMA_FN_OUT; X h7 s& I' o* |! d, ^' r
- #endif- `+ }2 _4 d! G! k
$ D2 ?+ J% w# X$ s& h3 Q& X* @( ?! B8 F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 {! {8 b; ]/ m/ \- G& ^2 w i - #define STATIC_SHIFT 33 ^( C6 ~4 P, `( D4 q" \# G
- #define TCINTEN_SHIFT 20
- I. c$ K1 r9 Q* P1 Z. R - #define ITCINTEN_SHIFT 21
! G# h' S) f# U6 v+ K- c - #define TCCHEN_SHIFT 224 G7 L3 I( E+ }8 Z
- #define ITCCHEN_SHIFT 23
~/ f# z2 z2 f6 K: u: R
. J9 T+ c+ |+ F% z- static volatile int irqraised1 = 0;
0 Q. t7 G; [ c/ r' ]$ l' I6 U - static volatile int irqraised2 = 0;
+ G5 |/ a7 \) c. G- Z* v
3 y+ B- O! j# j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 j2 ~8 p* z. t- h H. r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 \% o# o: _ D9 e* m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( u) t& s) J, \- h$ P. B - 7 Q; w; H4 k& R2 S- t1 s
- dma_addr_t dmaphyssrc1 = 0;) |* j" E! X- }. X/ q
- dma_addr_t dmaphyssrc2 = 0;3 @' s1 ]* @0 L' n7 \
- dma_addr_t dmaphysdest1 = 0;' ^; o+ S' I- b
- dma_addr_t dmaphysdest2 = 0;1 R0 D0 R5 w: i
* B- A N4 ]" i- char *dmabufsrc1 = NULL;
( `5 ?" H* N# {0 h1 ~! E - char *dmabufsrc2 = NULL;
9 g* Q! l2 u' m" k+ N. B0 j; ^ - char *dmabufdest1 = NULL;8 j& v- [! E# K' g0 F9 t* D3 F$ Z
- char *dmabufdest2 = NULL;: |! v7 K+ d6 [8 P/ |- B
( a* ~* F% {5 D& `9 w! _% o. u- static int acnt = 512;
2 j: C5 C1 ` @$ S' W7 F4 b - static int bcnt = 8;
3 }3 Q- A$ q& H - static int ccnt = 8;
0 ]. Q" ^+ \. s1 r
p9 Z0 w& `2 f+ a% ?- module_param(acnt, int, S_IRUGO);
* l" Q, `6 ]% B; B$ h - module_param(bcnt, int, S_IRUGO);$ Y9 @& w/ ?5 V" l m
- module_param(ccnt, int, S_IRUGO);
复制代码
: `/ P- ]4 R2 ]9 p5 V0 I+ x& l( ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 k- p! ]6 p, [% o% g$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# _1 Y* m* y4 O7 O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& k2 a9 R# H* X2 q
0 G+ m' M! e4 M; _& G& S, O7 a# Z! ]* N! o6 w! i; ^' S2 ?
|
|