|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* D% i, p% _$ D. |6 z- [code]EDMA sample test application W# d+ u0 m5 q: }+ [& G X4 B$ e7 ?
- /*
, k; ^3 b5 _- L; e5 r7 H( Q - * edma_test.c. t: k q. O3 a5 u! }9 K) ^& I
- *& g* f+ P4 K e( U$ ^' G
- * brief EDMA3 Test Application
9 x- N3 h0 T* K - *8 Z' u+ ~2 s. G6 O% p0 V% v
- * This file contains EDMA3 Test code.4 y, }& T; V! _- G% g% R$ G7 h. X
- *
+ a' E; a8 N# x4 m+ z3 ?/ y' W/ ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: B' i2 D4 f% l+ D7 c- u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! L; i+ Y3 Y6 n
- * TO CHANGE.- }$ G1 ^# J+ G J2 A
- *
( h" }: p B% C' r' q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 _7 K" I' `5 @/ S) R
- *$ m4 h6 V5 ?# A, A0 ~' }( O6 s
- * This program is free software; you can redistribute it and/or
3 X) N7 _3 p+ r: T F1 i - * modify it under the terms of the GNU General Public License as
4 R3 s1 N* U ?4 ]# ^9 w - * published by the Free Software Foundation version 2. N- p( N4 z2 m- u" F
- *+ u- a: d f8 S* A: N x2 k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' E4 A0 ]+ g! @6 i" _
- * kind, whether express or implied; without even the implied warranty
2 x9 V0 W: G8 R& v- ^5 B0 O0 p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* \6 o/ ~- G& v! J - * GNU General Public License for more details.
~/ O' Y: z! i! A* P - */" M9 h t% T. L7 \
- - Q6 ~) R6 y. h3 i, f
- #include <linux/module.h>
* I( d H: d: [$ R: Y% ` - #include <linux/init.h>
9 F0 N6 [; I+ i& n; F - #include <linux/errno.h>
; z/ Q5 E3 }0 ` - #include <linux/types.h>- f. G5 U' S0 c3 @6 ]
- #include <linux/interrupt.h>) {6 |3 b1 R7 J4 a4 F" M
- #include <asm/io.h>
9 T/ N+ \( m. I! T$ x0 { - #include <linux/moduleparam.h># {+ i2 L/ ~: L' o, Y n
- #include <linux/sysctl.h>; ]) @3 h# t, O7 H0 E
- #include <linux/mm.h>
: m( k6 H5 W( U, v - #include <linux/dma-mapping.h>
: O& y0 F* P) C* Y" L' H) H4 t - - N5 I" n: g( U# N6 b6 a7 G
- #include <mach/memory.h>
8 R( z; x& p! O/ r8 j# H6 Z4 `, ` - #include <mach/hardware.h>
' _& M, s/ d( @+ M* v - #include <mach/irqs.h>
5 P% {9 }" c0 o+ X. R$ A& B - #include <asm/hardware/edma.h>
+ k/ D) F- ^8 D' K8 N; }/ `
) o& A6 D2 K. O& t+ z8 V: H1 x+ q. g- #undef EDMA3_DEBUG
& C9 |! b: c B- }: N/ N. ^. [# o - /*#define EDMA3_DEBUG*/4 p: Q4 I2 ?; O3 k! y4 ?
- 1 D( C7 b3 c! q: l0 H- t1 K
- #ifdef EDMA3_DEBUG8 N' x# V; |( h$ p0 C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 c4 j6 B2 A T) k7 n, }. z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# p2 A0 e3 I* G( ?/ J6 [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; d" A" [. y# k8 }% i - #else
9 y' R; x9 }( V* N5 g; O - #define DMA_PRINTK( x... ) q H9 Z$ l0 X5 q, \
- #define DMA_FN_IN
" n) R* O# a! s - #define DMA_FN_OUT
- H/ h) c0 J3 H; T* F, {; H- H - #endif, m' Q4 J4 m2 M* h5 [- e
9 V1 z- G& |2 p, e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# o2 W7 ]1 E( M4 m7 g, |5 b - #define STATIC_SHIFT 3) h4 ?7 T! u" Z, e; m) }6 W7 K7 O
- #define TCINTEN_SHIFT 202 J" G7 |; R9 k0 B- E' J
- #define ITCINTEN_SHIFT 21
# a4 J( M& f" s8 Y* } - #define TCCHEN_SHIFT 22
. K r0 W( d, N' D - #define ITCCHEN_SHIFT 23, {9 N+ [" I+ Y& q5 C' `1 G
- ; u- Q$ g: G. D8 }! m6 t6 t
- static volatile int irqraised1 = 0;& }/ _; Q8 B: i9 \
- static volatile int irqraised2 = 0;! \) i7 l; d2 U# o, f) N- x0 ^
- 5 P8 \' o& M3 v0 p7 l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 ^* i, q# s. [. X1 o0 S( ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: L, E; L0 T7 t# a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 N' N% H' q0 a, D2 ` - 1 j( P1 _0 R% g- J1 p. t
- dma_addr_t dmaphyssrc1 = 0;7 K- j7 @% A! i; Z9 p' E+ A- `
- dma_addr_t dmaphyssrc2 = 0;8 W# f5 d+ a5 _
- dma_addr_t dmaphysdest1 = 0;( N) D* g9 A% [ a0 Q7 K* f! D$ F
- dma_addr_t dmaphysdest2 = 0;
. G: L) x& T% \
9 A' P% E" d7 s4 X- char *dmabufsrc1 = NULL;' x5 o4 a+ T0 E% Z2 \1 @! j+ ]; u
- char *dmabufsrc2 = NULL;0 i$ _( \( N& M. L
- char *dmabufdest1 = NULL;
- c6 X( d. a! ~ - char *dmabufdest2 = NULL;
4 E8 V( V" I k - 3 j# ?; `3 s0 l) [
- static int acnt = 512;6 A" P1 G1 B( D- z8 O9 v
- static int bcnt = 8;( K9 a/ ~) ^+ ~1 @' D+ {
- static int ccnt = 8;$ M6 O$ {. y$ s# c1 B- N
- 9 r3 P4 t# n- `' }. x
- module_param(acnt, int, S_IRUGO);0 i" S7 V4 Y3 m0 I& d5 p, @* q
- module_param(bcnt, int, S_IRUGO);9 B; s& i u4 p# A1 L, A
- module_param(ccnt, int, S_IRUGO);
复制代码 8 S/ j) W9 w( Z
l3 ~/ d6 g* r1 ~" N- H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' ~0 @. j/ ]7 ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) s0 b, T. m9 B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 j- f' _/ s$ R9 `& l
; J: k4 x$ r* H. ~) D% B, b
0 n0 X- d `' h% Q, T! K |
|