|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ q5 v, r" w! c5 \
- [code]EDMA sample test application
( L( D) `. f3 ]# Q& b% B - /*3 f9 @$ J* `! g& q9 d1 N/ J
- * edma_test.c5 Y: _. Y8 E; e' L
- ** y: ]( X% A! c, s
- * brief EDMA3 Test Application
) Z: T ^) A4 g! h - *
: r& X3 y- x! r, V0 n, c - * This file contains EDMA3 Test code.
/ M* E% U0 R2 k X - *( @/ M$ p y2 C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 ?2 I- W# q( o. M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( @& M: v$ e4 Z! \# B1 Y1 K - * TO CHANGE.
( @" o" N( {! x. \4 ] x. i - *' F, D$ O. p8 y) f& u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 G# U' K, i, A0 Y) w& c% D3 ?* ~+ r
- *7 A. p4 M! S: r1 k! N6 M* h
- * This program is free software; you can redistribute it and/or
3 ]/ i2 B x6 C3 [, z - * modify it under the terms of the GNU General Public License as
5 b" a% U" q2 ]" q1 d) o. e0 X - * published by the Free Software Foundation version 2.
, k, N3 z; X2 p* s' G v' h4 U - *
3 r7 b$ n2 \6 N* p& } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 T4 Q8 B, W3 k# X - * kind, whether express or implied; without even the implied warranty
; _1 ~( m Q: h0 _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 ?& [1 D5 p Z& C - * GNU General Public License for more details.) j. ~; R, x9 M
- */
" @: F/ l# I8 C* B% E2 V0 u
3 F }0 R2 f& E" B2 }6 k( d- #include <linux/module.h>
: f, |% |% P( B' t - #include <linux/init.h>- T6 T! d+ s9 [% ~8 y# W2 n8 g1 R
- #include <linux/errno.h>
: l0 W% J8 ]( @7 m - #include <linux/types.h>
" k- Z" C- Z. h- ]$ X- N3 z! S - #include <linux/interrupt.h># B, z3 q5 o( v6 n8 l0 e( P
- #include <asm/io.h>" w' u- P6 |: f8 _" g# o5 o
- #include <linux/moduleparam.h>+ L, N1 S/ q+ t9 i7 F6 Q6 x" q# x6 r
- #include <linux/sysctl.h>
0 J8 A: L; r4 c$ G1 W - #include <linux/mm.h>/ h+ z( b1 y* u% ^6 H9 W X& ^0 H
- #include <linux/dma-mapping.h>$ e5 {9 r1 W* U) @
/ A" o) u+ p9 K' t4 X; n6 F- #include <mach/memory.h>
" w7 D* b J! T3 e - #include <mach/hardware.h>
z" n) _% O& p1 s& ~5 Q - #include <mach/irqs.h>8 B2 r! U' D) j+ ~( E
- #include <asm/hardware/edma.h>
8 a5 J/ `8 i8 ^* I* i( \9 U+ f0 _4 Z8 c
( i0 W6 z* [4 O- #undef EDMA3_DEBUG
1 L4 A- W' F. ~/ B5 t6 e) Y - /*#define EDMA3_DEBUG*/% h" O) C) t% a" J& {0 x
- 3 n+ W; ~: O' D8 X
- #ifdef EDMA3_DEBUG
2 M: t; |2 k M( m9 `- s! D, P( Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! r( V7 x1 @9 B& \/ [* M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): f3 [* R) C, n: j( w9 ~8 [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ p- z2 S5 L; I. b8 Z4 Z) D - #else
3 N4 b9 [( c6 k - #define DMA_PRINTK( x... )
: F4 l! G, v! e7 R( ? - #define DMA_FN_IN
+ e4 ~$ y$ ^ n - #define DMA_FN_OUT
$ o% U1 G. x4 y/ f R4 R W - #endif
) Q& j1 I5 B# y4 v) U
$ N/ y6 \3 ^: `$ Y- s1 S# A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- B' e9 T/ P+ C# i - #define STATIC_SHIFT 3* m2 B) N' S( v7 b! r% B: m7 t
- #define TCINTEN_SHIFT 202 N6 B$ N7 A3 h* U: W
- #define ITCINTEN_SHIFT 21
- L- T! O& k+ I: S) T4 j - #define TCCHEN_SHIFT 22
- p+ \ d- q. o! _: V+ S# \ - #define ITCCHEN_SHIFT 232 Y8 }' Q, k- c! z! [# c4 P
1 H3 k( N, Z$ O% x! z' D3 d" r4 O- static volatile int irqraised1 = 0;
3 q; x* T$ J/ J5 ]2 | - static volatile int irqraised2 = 0;
# `6 ]& H, j0 ^0 f; ] - # h2 n0 S: m& }5 N+ e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) E: i6 G$ I; Z; S5 X3 v" Y: N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 W) A/ t# y }/ E0 y( p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) @; X- Z9 ~" F9 p6 f2 |* p - / q- r. d8 J$ s
- dma_addr_t dmaphyssrc1 = 0;& R& ?* S s) W/ n# a5 k- A
- dma_addr_t dmaphyssrc2 = 0;
8 I. y" ?' E) Y$ G- _5 b) g - dma_addr_t dmaphysdest1 = 0;2 C2 c3 z0 S$ x3 f' f/ h+ N
- dma_addr_t dmaphysdest2 = 0;
7 e2 _6 x( Q( h0 {% V- l - - _' Q% }# f. |# f6 y' k. Z4 t
- char *dmabufsrc1 = NULL;$ b+ E- ^' T+ K3 t4 m5 z# i8 x% n
- char *dmabufsrc2 = NULL;! ]5 B( ^8 @- ?, [8 I. v, n
- char *dmabufdest1 = NULL;
4 `. Q6 n5 A4 m% U8 E - char *dmabufdest2 = NULL;
# F* M: \' `- c q x! o; `
4 G/ H! B* P/ @$ p+ y, m7 n, P- static int acnt = 512;0 z3 K. m! B) S8 j
- static int bcnt = 8;
6 ]9 s3 [( f _6 r! W - static int ccnt = 8;
$ r% w1 \4 n% D. `( W - - p H& L! Q, I" ], u! o3 h
- module_param(acnt, int, S_IRUGO);! l, J& J' o. B- a" [
- module_param(bcnt, int, S_IRUGO);
* `0 f/ l* S( v- ?, w - module_param(ccnt, int, S_IRUGO);
复制代码 5 N0 L- p; Y3 B' _
: s1 F9 h! l6 z/ Z' ~; b4 V+ u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 {9 k: W* E! s G0 l ^ S! Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# G9 w {7 _; _" H0 ]+ t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* P" U% l) d" n0 a4 a
! u( K1 N, n9 Q; t0 z0 F
d9 \0 L$ C- r I5 g9 \ |
|