|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , H; `/ N+ ^# q8 e& N0 a
- [code]EDMA sample test application V: z6 b( `' j/ ?1 N$ H
- /*
" D3 E- G! I( u) S! A2 S - * edma_test.c3 Q+ W* y! }: i9 G4 l s. N
- *
1 J& f8 @. t) M2 [, ]( C - * brief EDMA3 Test Application
/ }: {# r: G/ H0 Q% S - *
) U8 W$ @$ H- E8 [' y, D- } - * This file contains EDMA3 Test code.6 O+ L s: T# b# Y" B$ H/ ~" A8 ]
- *
% [5 F' g/ V! x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 w( k! O4 R$ P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 Y* _. {0 ^5 n0 I7 r: h8 v - * TO CHANGE.; T' d' m# D0 g6 ?4 A- ?
- *1 \3 w g( v; o2 h, Z. L6 H; J/ N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' i5 ^6 f8 S" K9 R0 X2 Q9 g- F
- *9 I+ b+ Y4 }3 T4 E5 t8 u
- * This program is free software; you can redistribute it and/or
1 W, g" v+ C" I/ G7 n6 D2 Z - * modify it under the terms of the GNU General Public License as& I0 P1 k, ?! L6 s
- * published by the Free Software Foundation version 2.% A' N2 ^, W5 r8 R" w; P$ j
- *6 @& S/ \! i- @/ n* o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( ?1 k7 a. c3 H1 |" H' P
- * kind, whether express or implied; without even the implied warranty
/ E1 @! O1 w, W! _( m3 o5 d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 W. U! z+ f" ]# U! r - * GNU General Public License for more details.
7 n$ _# ?7 _# e$ ~5 h - */
% H! [' l, |! n* l, @8 ?# g
8 u0 K3 K: y& y* Q3 G- #include <linux/module.h>- J* Q/ W7 t: e5 [+ a% B+ b
- #include <linux/init.h>
2 ]7 G1 U: R% ~ - #include <linux/errno.h>
* d m# E# G/ r1 r - #include <linux/types.h>
; b, s) n; v- m# R - #include <linux/interrupt.h>
7 z/ A$ g h7 O' c% S* j7 C+ f - #include <asm/io.h>" Q3 U4 P; x; _- [' }5 x
- #include <linux/moduleparam.h>
2 B4 Y5 H. C% x9 ]9 J/ k7 I7 V0 p9 I - #include <linux/sysctl.h>
* D Q& s; D7 {- G8 x8 [ - #include <linux/mm.h>( Z0 {2 [7 n/ m( a+ C0 q% r
- #include <linux/dma-mapping.h>
! E" D$ E. D" y( n3 A) w
; g$ K R2 H1 k W7 Q$ s- #include <mach/memory.h>
2 U" m& X! @6 Q9 ]! @; P/ l - #include <mach/hardware.h>
2 q9 c3 S4 }9 q2 R' z - #include <mach/irqs.h>
V0 c y! T3 e8 q( a7 A - #include <asm/hardware/edma.h>
7 W8 N" V2 \6 a7 B - 7 w: H1 k+ D" J: M% F% Y( @' G9 P. z
- #undef EDMA3_DEBUG
1 f u" \ `# o8 W - /*#define EDMA3_DEBUG*/3 [; e& `- x! m2 [. v) a9 Z' V
- ; A0 t% y7 a. D$ U( T6 q: a, k
- #ifdef EDMA3_DEBUG
! U n9 W5 v) e+ w7 ?( e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) E; H" k. ^- D1 x" ^, {' F" ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! ^9 T% [6 D" j; z' h T8 w% T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): ^* j. g& L K) }! J
- #else2 |' v0 X V/ _
- #define DMA_PRINTK( x... ). x/ s1 J8 a# O0 }* Y5 n
- #define DMA_FN_IN
; f1 @* |3 k6 _7 G5 t& Y- E - #define DMA_FN_OUT
: M" J5 j* I- k1 Y5 l$ c" u! L - #endif
/ h0 ? S8 X n3 U0 r
8 h6 \- W0 |0 F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* m) j! h0 U; ^4 G' e" q% R% ? - #define STATIC_SHIFT 3
- a; F& h" v) ]) e8 y8 J6 l: V c - #define TCINTEN_SHIFT 20) E7 o( ?, i+ a$ }% K. r
- #define ITCINTEN_SHIFT 213 j6 Y$ F( l. T/ |
- #define TCCHEN_SHIFT 22
# s/ M5 O9 d+ [ - #define ITCCHEN_SHIFT 23
- v9 I9 a; \! w$ K" `
" V) T9 l. t" i! g! l/ I- static volatile int irqraised1 = 0;( [& n6 \/ m" ?! y5 t- Y
- static volatile int irqraised2 = 0;. ^. J' ]( L/ S! I( h+ I5 }- ^
- . d9 X$ y7 R# `% g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% h0 m! u% }9 w* E, C3 N; L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ w2 @, |# z4 J9 z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& W* ~# g* t: |
- 7 |- P3 [9 ?, e, R2 p9 [
- dma_addr_t dmaphyssrc1 = 0;
5 R: K6 Z& I; n) b. T; L" Z - dma_addr_t dmaphyssrc2 = 0;! k/ j) F! i: K) k) r
- dma_addr_t dmaphysdest1 = 0;
: V0 m8 [3 f& t1 X - dma_addr_t dmaphysdest2 = 0;
3 S8 O0 l' G! P, e2 o; I% X" |, b - 0 c0 f& n" k* y
- char *dmabufsrc1 = NULL;
5 m( T6 K# X$ e" p, s* u* K' t - char *dmabufsrc2 = NULL;
' I8 ~$ M Q! K6 g4 G3 T2 q9 ?, ]! Q - char *dmabufdest1 = NULL;$ R: f+ K" b2 i$ j2 {# L/ z- \
- char *dmabufdest2 = NULL;! @" i( |6 e n# H! A% V' _
" ^) L; O; E" ?* E: D- E$ Q- static int acnt = 512;
" b q$ N" h1 C - static int bcnt = 8;% R+ b" t0 K1 j% d4 {/ b
- static int ccnt = 8;+ b' w3 r! }0 o \
- $ g% g$ D1 u2 \
- module_param(acnt, int, S_IRUGO);
: U& [- z; I) l( l/ d9 V# G - module_param(bcnt, int, S_IRUGO);9 V+ V+ h" H, F9 ^7 j* P, y
- module_param(ccnt, int, S_IRUGO);
复制代码
, a: I5 H! l1 e; d# b' d
/ b* R8 s" p6 e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: o5 k" r, [1 D7 Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 Q2 Q4 Q6 Q( G. ]2 S% I, _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" u+ m: _8 y) z8 O& y8 u* w. C7 T$ V- I
: q, R* r- T: ]& |
|
|