|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 C! _' N* n p2 m5 U
- [code]EDMA sample test application0 U% Q- K; C3 j. d& x, a' M/ c+ e3 v
- /*
j4 O9 H$ _5 {$ v. Y W, M1 U - * edma_test.c
6 Y/ w# s* `; y$ z4 I - *
- Y! }" J' j# M1 `/ G - * brief EDMA3 Test Application' ?, |7 R& ?. x/ t& y
- *
- _' Z/ J& `8 ^0 E/ R - * This file contains EDMA3 Test code.
5 w2 w* G+ v, k' ` - *
( T' \0 x: ?8 y. T4 ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- \( V8 L5 `7 `; L3 J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' j& k# |2 t4 o7 `: {. F/ S
- * TO CHANGE.
2 } y4 ~! Y; \ S - *- t( Y. x- i; Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) x& C* c$ c" B! m- |, O7 w - *3 X% R( L9 S5 u. c
- * This program is free software; you can redistribute it and/or
3 {! a h: L6 T$ @4 w1 w7 Q - * modify it under the terms of the GNU General Public License as
2 g5 S/ d x4 `5 N( ~- n' P - * published by the Free Software Foundation version 2.
: s, |" B, f$ a+ ~ - *
' ^7 p5 p* L5 h0 B% Y3 f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ E( W; l* S' M: Y1 K# B* X! @3 ~ - * kind, whether express or implied; without even the implied warranty$ i! y* _( j+ _+ I( X0 H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 h4 k: b7 S" l/ _ h - * GNU General Public License for more details.
: ?4 k- W* `6 y9 y* J) T - */
) {8 K! \! x: v/ Q3 H2 q2 ~! }8 D - V; x- a1 P' N t+ P* L5 \* I& R
- #include <linux/module.h>) |1 ~7 K8 q' _/ O# g* D
- #include <linux/init.h>+ g* l& a+ s* }: K7 H8 V
- #include <linux/errno.h>
6 E" k6 c! K! T - #include <linux/types.h>
1 |" x E! C+ O8 G - #include <linux/interrupt.h>
% ?* Q6 M( i# @' p/ ?) g" t/ e - #include <asm/io.h>
9 J& n; }0 I$ H6 R - #include <linux/moduleparam.h>
! O2 X+ c, N1 {9 D- O - #include <linux/sysctl.h>* @: f- t: K* _( r
- #include <linux/mm.h>
$ z/ Q7 W4 L" q% Z, g" h* U - #include <linux/dma-mapping.h>
. y* O2 z, K! i
" i+ `2 }/ A" G; z" `- #include <mach/memory.h>* k! B! Y B9 t" H- O6 m8 e
- #include <mach/hardware.h>
. ^! q. c: b8 U# E, ~" v3 X! o - #include <mach/irqs.h>/ ?* y2 c% n% J* V2 @
- #include <asm/hardware/edma.h> W7 B- A% D7 W* ]+ L! ^9 H
- ; U! a6 y$ ~ `) ^1 {* f
- #undef EDMA3_DEBUG! f5 D+ u. @: A
- /*#define EDMA3_DEBUG*/. {% `" I# m; d- i E
- , [( N9 ^7 n* u8 s0 V# r$ n- X: D- l
- #ifdef EDMA3_DEBUG7 U$ H) r$ k8 l) {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) U, m( Y; G: T9 G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% j: c* L$ J: F! ~% L1 ]; U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 {1 P: [$ m2 T4 T; d/ g+ `$ @
- #else
2 G- P( m* |; Y# w+ s1 v5 D - #define DMA_PRINTK( x... )
2 N- u/ V2 E3 l - #define DMA_FN_IN: j' Z% m5 _0 C* S/ d2 n
- #define DMA_FN_OUT
2 P) f3 Z2 w& Q2 J! z - #endif
. c- j R4 Q& v% @' [9 }
. J( r* Z8 r+ [" l* w1 R; j2 N* I! o- #define MAX_DMA_TRANSFER_IN_BYTES (32768). f' B5 Y J) V5 u* f
- #define STATIC_SHIFT 3
, }$ m3 x+ k, F6 z/ p% M& Q- I5 B - #define TCINTEN_SHIFT 20% Q! } @6 Y7 @+ j) l/ w7 ]
- #define ITCINTEN_SHIFT 21
- G- H, W) z+ W, S, Q0 c - #define TCCHEN_SHIFT 22- C# o w4 Q+ F. v% u! s) C5 k2 W
- #define ITCCHEN_SHIFT 23
2 Z3 T$ g+ O: e6 M! S/ a - 2 R9 n0 h& K2 ^9 ]
- static volatile int irqraised1 = 0;7 [: s( y% C* q1 e+ d3 X
- static volatile int irqraised2 = 0;/ G8 Z6 P! W8 C5 p( J3 Q
: f* Y# E$ C" p8 S* @8 \( Z+ u. F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 d) c$ ~8 K% u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ?( m* n' f' |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; C8 t( L/ P3 d+ I- j - * P. W2 g. x* Q
- dma_addr_t dmaphyssrc1 = 0;8 f2 J o7 a* Q M$ G: G
- dma_addr_t dmaphyssrc2 = 0;1 V) | {# a: t
- dma_addr_t dmaphysdest1 = 0;
$ E8 ~2 J# L* H' V0 R - dma_addr_t dmaphysdest2 = 0;0 ^7 }- i. P w M6 ]- ]: a2 X5 k
- 6 D$ |) j; I7 u/ S7 U. r
- char *dmabufsrc1 = NULL;2 Q, |/ m; T( m* p* @ z
- char *dmabufsrc2 = NULL;
0 Y( l4 X6 f3 x5 k. \8 t& } - char *dmabufdest1 = NULL;6 E$ [$ w* i" k/ @. b3 Y
- char *dmabufdest2 = NULL;1 c% }! D0 n4 L7 Z' J9 G* d+ Y) b- P- \
- 4 E" |9 n/ B; ^- y9 J3 o
- static int acnt = 512;$ m- u" L# k! ?3 j9 X8 L. E
- static int bcnt = 8;
7 Y0 i# j7 `. {# l2 m - static int ccnt = 8;1 B% f) C. @( w! O+ Z
7 `8 \! S- A- G" U9 r, l d- module_param(acnt, int, S_IRUGO);
" |4 _6 [" M6 g - module_param(bcnt, int, S_IRUGO);9 Y2 y8 |/ p2 A0 F' F
- module_param(ccnt, int, S_IRUGO);
复制代码 0 A K; J7 ]9 e# }. U0 d& x6 d
( t+ [/ `0 e: u, t, k1 x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: T/ k3 t% q; V) Q- G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ q* m% y8 G1 J0 f8 c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, ]( `5 I f7 R s& i' f% m- X$ Z4 L. A+ @% R/ g- E
0 ]* _$ B# n* o6 G |
|