|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 d! A5 L0 }, ~ t9 W- [code]EDMA sample test application
4 N0 u3 Z9 d" l+ T - /*! T& }+ J0 F' u# D. C( a& i
- * edma_test.c J) V W' v8 u0 \1 Y
- *) ]' n. y; q" E6 W, q( |* K- \* n5 ]
- * brief EDMA3 Test Application
" g6 |& ? f% |# u - *
! m E9 |" {( q7 M: c- w* w - * This file contains EDMA3 Test code.7 K6 ?9 J7 w$ j( T$ v/ O7 w' {
- *
; d+ |. ?) Y8 Q9 G, e! g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 [( @) S" c+ g/ D- M# V9 h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ |4 n0 H1 U% G* Z
- * TO CHANGE., H: P& T( E, D! v& b3 a
- */ ]" Q6 T# @' ]. @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 _9 F6 v* o2 p) }6 s
- *- f) d0 @+ K% K! q+ E9 M# ?. {# O
- * This program is free software; you can redistribute it and/or
; K1 ?4 n& m& _3 P- H: X0 m4 r6 r - * modify it under the terms of the GNU General Public License as
1 J! z; V* h; N1 r' Y: D - * published by the Free Software Foundation version 2.
9 W- h0 r* ?2 {: O7 |7 x" K$ Z - *
( P3 U, Q, ]6 g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 H! E6 X3 O" V# x6 q0 O$ x - * kind, whether express or implied; without even the implied warranty+ F: r% k3 F( d: @: q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* m/ o, `' B- i) \$ p - * GNU General Public License for more details.
) i- i+ Z0 n* N - */8 m( l' J6 ]' M% f( j) s! z
% G1 ]. P' C) m! n. C1 L- #include <linux/module.h>
& E$ I9 g x8 o0 t3 r - #include <linux/init.h>
) p- X# ?3 D- P& N4 P - #include <linux/errno.h>
# W% @+ f9 r# p% }$ N - #include <linux/types.h>
6 E/ |* S$ k+ l - #include <linux/interrupt.h>
4 ?% R8 E# O [ - #include <asm/io.h>
3 S1 y H e$ I" z - #include <linux/moduleparam.h>
8 k9 r: t0 s# Z& b/ g% | - #include <linux/sysctl.h>
6 H$ S1 {; Z2 N, @ - #include <linux/mm.h>
2 \) Z5 G- R! R1 ?0 m4 l - #include <linux/dma-mapping.h>
1 c; O; P- ^2 l+ U/ _
( K; S8 w3 X: Y& `, o z) f; A- #include <mach/memory.h>
0 y7 m& A+ z8 S2 E0 E$ l( X - #include <mach/hardware.h>
' f+ W3 I, w. z1 V) {! B | - #include <mach/irqs.h>
) H' I& k" B0 t- u - #include <asm/hardware/edma.h>! ?" |9 m: m2 D! J% F
- ; L3 f. k6 C0 w
- #undef EDMA3_DEBUG) h f2 a5 ?, L. p5 Y1 d
- /*#define EDMA3_DEBUG*/
4 w8 n0 \( y# P/ v* F
2 Y6 b" @1 E, c" K1 G- #ifdef EDMA3_DEBUG3 j. t1 T- Y' j, y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! j, K8 U9 g* W6 y5 L2 |/ n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 ~' L& e1 p; L; } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 o% s8 `; [( @
- #else6 |; Z/ ^2 x% t: E+ {( f
- #define DMA_PRINTK( x... ). Q# e g% {2 u! ^. F8 p
- #define DMA_FN_IN
! n7 z8 e# F$ { v$ L& \2 y - #define DMA_FN_OUT" Y' n3 ` e2 y' t5 a$ Q
- #endif
' _8 P7 e5 a6 Q! _/ D
8 I" p: U" G: s2 _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 V( |2 D' \8 H6 @' {4 W - #define STATIC_SHIFT 3
8 s" Q/ s% u$ `1 J7 e' N" m - #define TCINTEN_SHIFT 204 r4 I% ~. U5 S3 v, i4 U& c0 Y+ V* k
- #define ITCINTEN_SHIFT 21, _) {0 b+ v: q% s( P7 S4 x0 q5 X
- #define TCCHEN_SHIFT 22( X4 Q1 v' l7 q6 k; Z7 M
- #define ITCCHEN_SHIFT 23$ ]. B4 N4 v9 m v) C ]/ w7 a
( f) Q. I* G ~- static volatile int irqraised1 = 0;9 ^5 e2 h) V( C) ?5 I5 U! [
- static volatile int irqraised2 = 0;6 X8 i2 {4 L" M4 D
- " e5 i8 Y( v6 ` t7 N3 p# u& U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' w' }, k0 O! a" W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 N! i* z9 n7 R6 f% J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* F/ \! M: m2 B0 p - & u/ x- ]: u5 w: Q1 b
- dma_addr_t dmaphyssrc1 = 0;) l( M2 T! @! ?
- dma_addr_t dmaphyssrc2 = 0;
) }5 n: N/ C7 H$ i - dma_addr_t dmaphysdest1 = 0; ^; g0 K+ T/ s0 w4 a: W5 w' V
- dma_addr_t dmaphysdest2 = 0;
3 Q" V9 G& n2 [: j9 ]) f - ' b4 z, f! o5 `4 t, t/ N
- char *dmabufsrc1 = NULL;
0 s; R% [5 y' L+ f2 i1 l% e1 ] - char *dmabufsrc2 = NULL;
# h% @/ }5 V2 Y! [4 H8 p2 ^4 N - char *dmabufdest1 = NULL;
3 ]5 f1 l. f/ T/ C0 p! ] - char *dmabufdest2 = NULL;
% j5 C9 R+ c5 [- T
i/ f2 s7 Q/ {7 {' P4 Z- f: A- static int acnt = 512;% V- F' s; Q# V$ ~ f
- static int bcnt = 8;1 ^, W S- {- v
- static int ccnt = 8;
/ X$ k* L4 Z! b! e+ y* n& e
. }9 F( K' H2 ~% t) W- module_param(acnt, int, S_IRUGO);" d0 Z" Z" B) f. i% ^8 z
- module_param(bcnt, int, S_IRUGO);
. h* p: T2 h2 j: N - module_param(ccnt, int, S_IRUGO);
复制代码
- C3 X8 y- R- s8 _, V4 K% [' i2 P- j5 |* Q* }2 [- ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 ?% W* o6 i- B4 @ [0 a4 I7 }3 m" J- n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) T$ f$ u5 l" B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 v5 H4 z0 ?( Z) x
; i: J' B% h7 |
, `" N& B3 m! Q S* T7 ?* x* ]
|
|