|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 m2 o E+ m1 Y3 L1 i3 h- [code]EDMA sample test application$ q9 a- E o: @: a0 j8 q
- /*: x9 ~5 X8 ], B3 X/ w9 [* U" D
- * edma_test.c
/ L; E' {, m6 ~- H; t3 j - *# R0 [! A, D3 a. X4 y4 |5 X% j. X: K6 J
- * brief EDMA3 Test Application5 x& \/ L+ s0 M& @7 J4 J
- *
) D9 k$ K6 x! l9 {9 X9 @7 B - * This file contains EDMA3 Test code." Q$ ?. o! |) T
- *$ A$ P5 V! Z% g# g$ x6 m0 ~0 z4 a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& B! s9 b! ^% `% }& x1 \5 y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. \; @% h6 I2 w/ j. q) S. A
- * TO CHANGE.% ~1 M2 Z7 O& k, Z4 e2 K3 t
- *
! z% s, I% o" l; p3 x: b: _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( ^, q8 p T2 \7 u2 r/ c/ c
- *" u3 o5 E, M9 ^* J3 n4 E4 W/ K* ~
- * This program is free software; you can redistribute it and/or
) Y3 }3 K2 z \4 Y) i9 Q- i - * modify it under the terms of the GNU General Public License as1 h9 p. T9 D& o/ Z, ^- S
- * published by the Free Software Foundation version 2." r% Q0 X; V* Y+ A
- *
" \' E+ L( } j o1 H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) k5 b8 d& ~. s - * kind, whether express or implied; without even the implied warranty5 t# ], H H' \; b" [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' G5 L1 A. P. a6 E* L" [
- * GNU General Public License for more details.
4 K% o+ {3 z: f' I - */# h9 H- e4 g n3 f7 K% d
- 9 J) a: Q% h/ X+ W. [
- #include <linux/module.h>
% u! k* q2 w D3 e$ _2 Z% X6 Q - #include <linux/init.h>/ K: ~) l. n: Z, a# a
- #include <linux/errno.h>
2 T/ G; o6 n0 A/ U, S - #include <linux/types.h>0 ]1 U9 t5 d3 P0 @ i' r8 p
- #include <linux/interrupt.h>
& p2 y/ W$ T8 Y& ? - #include <asm/io.h>: n. k+ S1 A$ d9 g7 P
- #include <linux/moduleparam.h>9 o. A' x1 J ]' T
- #include <linux/sysctl.h>
8 {, q# d( r K/ F( [% T1 Y9 p - #include <linux/mm.h>
5 c' b2 Y K5 I/ ?& | - #include <linux/dma-mapping.h>
) h- I0 `0 }7 a0 ~
& r. G3 P* M+ S1 K g% D$ E. ]- #include <mach/memory.h>
4 T0 c% u& d! T3 x - #include <mach/hardware.h>" z1 o/ R, C4 j& V. O/ t* y& `
- #include <mach/irqs.h>- J( A4 D$ `0 _
- #include <asm/hardware/edma.h>' f( ^: {# L1 a$ A
- 2 `2 D( S- ^, d8 F( v& h( _
- #undef EDMA3_DEBUG2 j) H. b0 } p6 A1 q2 A
- /*#define EDMA3_DEBUG*/; b7 O0 z4 H# z- k) g$ ]
) `- a7 v7 m9 [0 u- #ifdef EDMA3_DEBUG
# r- K- d: Q7 x) R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 b v$ A4 S `5 Y; K. q: X& r& j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; o7 B& i0 N/ {& [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ J1 h! e2 j& _7 H, S
- #else
) V" {& H) ]$ t0 M/ V( X! s6 c0 Q9 d - #define DMA_PRINTK( x... )2 |1 c$ Q- {4 q( u5 n& B
- #define DMA_FN_IN
2 C4 T+ J3 g. x; p3 c- Z - #define DMA_FN_OUT* x/ {" G- Q5 N+ h3 Y s) k$ D8 ]+ U
- #endif* z- A+ l, t5 i: i" |8 {$ Y1 U
- : P4 ?0 F/ W2 W" }8 c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
y8 v' ]0 j3 S# b* y* ^ - #define STATIC_SHIFT 3 r, E P# [- F+ m+ S! L- O( q+ i
- #define TCINTEN_SHIFT 20% B) k, Y: c$ y! _
- #define ITCINTEN_SHIFT 217 T F( W t% e2 E
- #define TCCHEN_SHIFT 22
& Y& t7 k2 [ r6 Z - #define ITCCHEN_SHIFT 23
0 L8 ?8 g3 l0 } W5 m- z3 @+ N6 e
3 ]3 m8 ^$ n9 I: w5 j5 y0 x- static volatile int irqraised1 = 0;
* r7 Y x: y: U - static volatile int irqraised2 = 0;" p, W$ v$ T& p. X1 ~: }8 k
- 9 B3 a% _2 l5 j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 w5 ^% k( l; z' I$ `+ e3 Z0 _# w1 w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ k; \7 y H. X5 m' J% }. P3 f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; X- h v$ @; a4 F
- 0 _: E# c/ e/ J# b
- dma_addr_t dmaphyssrc1 = 0;; O% s4 @2 }: ?& h' B: F! j( I
- dma_addr_t dmaphyssrc2 = 0;
* w' r I f$ O! m - dma_addr_t dmaphysdest1 = 0;0 ?% a" }4 T0 W1 j
- dma_addr_t dmaphysdest2 = 0;, w l7 V3 R1 g4 ~% R! P
- % g4 [8 a% A* X4 |& ]
- char *dmabufsrc1 = NULL;7 ~$ S4 j: f/ d+ u9 k
- char *dmabufsrc2 = NULL;9 ]1 F2 j2 ]/ H& u @2 }9 s
- char *dmabufdest1 = NULL;
* }* S4 s! W5 _ x( j) ~& t8 ~ Z - char *dmabufdest2 = NULL;2 I" l& _, ?6 j. F- Q& u7 `* a# @, x1 }
- V- v! N; z1 D/ V- static int acnt = 512;
0 @1 u7 A5 n+ r% }% G! _7 P' g - static int bcnt = 8;% i+ r8 i5 b: [. T. ]
- static int ccnt = 8;9 j: m& c) R d% a1 G5 K5 h" _* I' L
3 \6 a; C! |; _7 s6 i- module_param(acnt, int, S_IRUGO);
1 u( x* W3 H* a/ u - module_param(bcnt, int, S_IRUGO);; S$ z, u9 K3 s- R1 ?9 v" _& r
- module_param(ccnt, int, S_IRUGO);
复制代码
5 k) P# W2 ]9 D6 p/ \$ j
* a, t3 x* B2 Z, P& q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( w+ ?( [+ w: i' M# 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( w( q' ]5 v; y# ^! }1 I4 \$ k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 L7 q: w- J1 i6 n, q: P
* r. @2 ] H8 C2 z+ G+ }& ^
4 l: Z' ? m6 l& l3 L5 U |
|