|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' j" b" N2 ]; E1 a+ R
- [code]EDMA sample test application. G" u9 d" [4 q
- /*
& ]# E' P; f7 I' D M3 M - * edma_test.c& E0 S6 s# s( B9 m1 X
- *
. R$ b; _" X. H# ~7 C$ l) K3 {) e' T - * brief EDMA3 Test Application" ]1 E) I7 b9 c- Q- \
- *
+ Z6 Y4 D5 E8 S) @- B5 {# p5 h - * This file contains EDMA3 Test code.
6 l# X3 r1 a- F, ]. } - */ W& ^. d+ X1 K+ S1 `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* ` j& @, c2 ]3 y& `9 ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 B2 n( J- s2 ]: E y
- * TO CHANGE.
; g1 J4 ]( F2 t - *$ N I6 k8 T- L/ M/ T, i- \9 X% ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: S# z8 x6 u" G% V - *! A! \) k& K& h* j1 }
- * This program is free software; you can redistribute it and/or' g: p( P$ V: x) k: C; O) `
- * modify it under the terms of the GNU General Public License as
/ S! w# |* m/ X$ T+ C* Q - * published by the Free Software Foundation version 2.
% |! q. W: v7 @& `* B1 {$ _ - *
/ i- J5 I/ E1 N! o9 ~% j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& R) S8 ~3 X, O2 M% v
- * kind, whether express or implied; without even the implied warranty5 C, t1 R6 g D' U: y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% _/ C+ G4 c% z4 \* S
- * GNU General Public License for more details.
/ y% ^2 |% L& ]$ W7 t - */( V ?5 l( t! y" H- [
- " ]) I5 y6 ~+ c( O3 @6 p0 l; x" c
- #include <linux/module.h>. b5 V6 w* a; n- ]8 O
- #include <linux/init.h>3 X$ m, w! X* C$ w" B' R
- #include <linux/errno.h>
7 t) T9 y3 T( Y - #include <linux/types.h>
: h8 r; p! m4 K; L - #include <linux/interrupt.h>* ?. ^& u+ p g% i9 Q; R
- #include <asm/io.h>
8 b0 s8 z0 M3 m& I( q! m+ s - #include <linux/moduleparam.h>1 x& I( B+ ?# p! f# `. B
- #include <linux/sysctl.h># V( f+ Q) V% T2 ]3 s
- #include <linux/mm.h>
6 s. t9 j# ^% ` - #include <linux/dma-mapping.h>. Q4 z h7 t) I" L; E$ o) L
- 5 _4 r/ W. | D$ l \+ A
- #include <mach/memory.h>( q) b# f0 J0 i% C# g
- #include <mach/hardware.h>7 Z$ _' Z; D1 I$ i v' R0 f/ k
- #include <mach/irqs.h>) C a I/ W7 \8 f# }. Y; H
- #include <asm/hardware/edma.h>
$ B0 ~$ S* z9 z6 x - 6 c. ?* o2 o$ V& m+ ^
- #undef EDMA3_DEBUG; l i5 w' T1 S8 |4 r7 `$ [2 k
- /*#define EDMA3_DEBUG*/
% X0 |/ f8 z9 O! S* f& @ - ( ?5 s& E/ r$ s% d$ {
- #ifdef EDMA3_DEBUG
* |' e( W1 G4 E7 Y0 O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( z; B1 A0 w5 d* r& h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% m3 _/ L( a! g) e, K+ V& r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" A7 Y6 X! W% C& ^
- #else. j. | e2 y: E* g" \
- #define DMA_PRINTK( x... )
H7 Q! q* e6 I4 R* U - #define DMA_FN_IN$ E- E* P0 A$ ?, M F# Q5 U9 H
- #define DMA_FN_OUT
+ b* J f5 |. K& T; O% N - #endif
% m' Q: G5 f7 @+ K( }4 `
6 A4 \2 q D5 F" p+ U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' H G0 Z" ^! M" l+ I - #define STATIC_SHIFT 31 b5 ?; u6 k8 ]1 a) N8 _) c" i5 H
- #define TCINTEN_SHIFT 20
q+ M& h! l P" k2 | - #define ITCINTEN_SHIFT 21" q G* [2 O2 I) E; k1 `, ?
- #define TCCHEN_SHIFT 22
0 S A$ ^0 g1 ^; m4 V - #define ITCCHEN_SHIFT 23
( ?+ c! \8 U [% H$ x J% R - t7 K |6 S& d% [. ]7 |" i, u
- static volatile int irqraised1 = 0;
% e6 }6 E& r9 A& h - static volatile int irqraised2 = 0;
6 I* R& m$ f; W: W: p - % Z2 b( q; t) L+ m/ {6 ?( {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 W( T. u6 U% r( _# v2 F/ K2 |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 I- q& W+ P" D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" g* K, X6 e( i1 G
- 2 u# a Y# b/ X
- dma_addr_t dmaphyssrc1 = 0;
( I9 o+ Z" q5 L - dma_addr_t dmaphyssrc2 = 0;% @2 J; k" ?" |8 f, b, k
- dma_addr_t dmaphysdest1 = 0;$ r$ a* P8 u# n3 J9 Z/ G
- dma_addr_t dmaphysdest2 = 0;, v2 w! `6 ?4 H8 G' Z( b
- / [1 Q* b5 u5 | G% e6 I* _
- char *dmabufsrc1 = NULL;% ?9 [/ Q% e$ i! j) v8 |3 H0 ?
- char *dmabufsrc2 = NULL;. @; n4 p- G$ P' C
- char *dmabufdest1 = NULL;
7 F7 D. a( m1 K6 j7 w$ K - char *dmabufdest2 = NULL;
( e/ p( O5 Z3 d. \; v# X5 E3 c# M - 1 M. w+ N" B: C; H8 |
- static int acnt = 512;/ R, b" {' V/ T* i
- static int bcnt = 8;$ f% r) {+ i5 S1 d1 f; y
- static int ccnt = 8;
; s- B; E/ d# P# X - - w* _1 c; `2 ^
- module_param(acnt, int, S_IRUGO);; ^8 a" M+ I: ^; i4 p7 X7 o8 @! e: t) b
- module_param(bcnt, int, S_IRUGO);4 s" U% J" R: g' J; C
- module_param(ccnt, int, S_IRUGO);
复制代码 / }& k- J0 H# ?; s9 Q5 |
4 L8 s/ O' `. K+ d% E! R1 x+ Y, s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; p: w$ Q3 k! D0 E6 r% \3 o2 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ M# V6 d% `4 g) [3 S' V) G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" T5 f0 Z, \. r- Y5 D
) M2 J/ d/ W U; }, Z# B! x6 t: A
|
|