|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: Q+ c! P. Y# ?- [code]EDMA sample test application& ?7 T7 p( X# N% z: y% K
- /*' e. ?! t3 h) ?+ @* z2 Z) B
- * edma_test.c
: K9 W3 W* {% k. n - *8 Z) U+ G; E/ E4 S+ k0 p
- * brief EDMA3 Test Application7 z% \0 A1 y" {7 [! a* Z$ ^
- *
5 k; p) m- S, u) q: G - * This file contains EDMA3 Test code.
! v% |$ u! n4 h! ]" F - *
1 F- x, f9 M% N4 z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 J4 S" U! R$ r - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# E7 D) f i F# j! w
- * TO CHANGE./ o' g& ~# U [6 N1 [' C3 M7 i C: G
- *
! m8 a7 ^$ U0 Y% ]0 _$ } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 W! X( E* n& ~; h6 J7 I - *9 j B- n! o6 b! F: C5 ]. W( G
- * This program is free software; you can redistribute it and/or$ F1 t+ F/ _7 M. d
- * modify it under the terms of the GNU General Public License as, y3 J4 h( Q2 d. h
- * published by the Free Software Foundation version 2.. A9 i2 l* o7 M
- *, e4 ^7 M! V P% b+ ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# C# u* c0 A+ w+ o
- * kind, whether express or implied; without even the implied warranty& v" L' G8 `+ H" @% @' Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 V( H v; D5 y2 i5 Z: Z
- * GNU General Public License for more details.
; ?# g- W8 z0 [: Y1 X - */
3 R: E3 @8 K& ~* U( M0 W - ( p! M- T+ S: K2 U; }
- #include <linux/module.h>
- Z1 p9 k! p# w! m- D( r+ _ - #include <linux/init.h>
# y) e& Q- z$ B/ b - #include <linux/errno.h># Y v, w4 H6 e" o6 q
- #include <linux/types.h>
" Z5 B2 L1 }/ q4 U2 B | - #include <linux/interrupt.h>
' V7 X/ g- \2 O. H* ~0 d4 i6 T- C - #include <asm/io.h>
. B- R4 ]. ]* Z% v! G+ v+ e - #include <linux/moduleparam.h>
; V) M" y) z& g' C+ t - #include <linux/sysctl.h>7 Z+ g+ s# d. D& ^6 j7 T
- #include <linux/mm.h>
# {3 }# S' I& T6 N* R/ ] \& }: f - #include <linux/dma-mapping.h>
7 a H: q6 F8 ?- w - 1 Q! L* r/ h5 K3 t2 {9 G& `5 C
- #include <mach/memory.h>2 f4 R- c3 F" N
- #include <mach/hardware.h> J8 f& Q: x, P! a. F) h5 S
- #include <mach/irqs.h>/ F4 L6 u1 o( J% O$ _
- #include <asm/hardware/edma.h>* U" ~" _) @, P. g4 E/ J) O& @+ g
- 3 W3 U- O9 h. I& k" W1 ~
- #undef EDMA3_DEBUG9 {8 E! U2 {3 E% f3 `- {1 X8 T+ b
- /*#define EDMA3_DEBUG*/! {& G: p% O8 h3 y
- , J% y1 K( Y1 J# U" u5 P4 V/ w2 E, W
- #ifdef EDMA3_DEBUG, D$ Y/ G9 a: w7 V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* [0 T& c1 o3 p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); q8 s) b; |! B1 l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 I0 [4 z$ i- G# H2 i - #else
: Z6 \2 x5 \/ U: B; D% R3 Q. k - #define DMA_PRINTK( x... )
. h1 j- {% S' g - #define DMA_FN_IN
/ l+ `8 G# H3 T$ J - #define DMA_FN_OUT
Q; k s4 F0 G* L' h - #endif
/ N% J4 P, A% `9 w0 I. [ - # W4 I! e/ e7 Q* e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 o- [" R! }$ U& M ~3 _; c- J& k- S- ~ - #define STATIC_SHIFT 32 v; h4 i% o1 \( w/ B7 o9 q) u
- #define TCINTEN_SHIFT 20
& Z* M0 l: K m( x7 a) q - #define ITCINTEN_SHIFT 21
5 K2 G8 }; v$ ~* H- N3 o0 e - #define TCCHEN_SHIFT 228 Q9 F' |5 V, {- P4 ^. u3 w/ n
- #define ITCCHEN_SHIFT 23
. m# Q, G E$ l, M - % s# x" A" u! D( |) a6 V
- static volatile int irqraised1 = 0;
- F6 L4 Y+ q3 r4 s. |5 I - static volatile int irqraised2 = 0;
% E" m2 [. b( D$ Z! D# Z
- p! ^5 C* f9 }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; N4 N/ j) {$ [1 F* _1 G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 C2 |# X: o2 O- r$ J/ G+ t7 T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* U Q" J2 \) n6 g: Q1 {. u2 }
# b2 a) m' `% N" k- dma_addr_t dmaphyssrc1 = 0;! D4 P+ P! J8 x$ w
- dma_addr_t dmaphyssrc2 = 0;
- N; ^* F. _) P' Q - dma_addr_t dmaphysdest1 = 0;* a/ j; n% L" l6 u5 R) y. t
- dma_addr_t dmaphysdest2 = 0;
1 |, D: T2 H/ F0 r - ; s1 z A0 z8 _- p3 B0 z; T! _. Z+ `+ q
- char *dmabufsrc1 = NULL;
& l7 f9 ~" A5 Q& n$ I - char *dmabufsrc2 = NULL;
0 V U$ K; e, u* p - char *dmabufdest1 = NULL;) x6 E; I5 L: ]: Y$ }+ Y
- char *dmabufdest2 = NULL;/ Q2 b" K% F6 t1 w2 r
- J- T& h! _+ K0 r/ ]$ O
- static int acnt = 512;
- N: _# E; k$ ^ - static int bcnt = 8;, f) J. K6 r! P2 m% x
- static int ccnt = 8;+ P/ b% m; M2 x/ U M8 \# ~. H
2 P0 a6 e0 G+ F9 v9 u/ x+ T7 R- module_param(acnt, int, S_IRUGO);
1 @; w: I7 O9 V, y* ?4 _9 P - module_param(bcnt, int, S_IRUGO);
; @6 D% Q$ T( ^/ R! ^ - module_param(ccnt, int, S_IRUGO);
复制代码
( t" P$ P# X( M0 R( ^9 @! ]0 I& \, }' R% {$ w) a) X9 q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* p2 [! @9 @7 n/ [% e. Q barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" h! X3 H. X4 U9 ]! l1 G+ _9 ^; O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. [: k4 u) [+ |, a* P# j# K6 H$ U. ^8 | {
* t5 q- Y/ `, L9 `! @, ~8 [- Y |
|