|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & e9 k: @# d9 ~# r. [3 X
- [code]EDMA sample test application
" I4 d* _8 |# C# ^/ L1 |) C - /*
4 F9 C+ V' E, Y0 J - * edma_test.c* }6 s9 X1 @, }! [# v1 g
- *! U" s$ ]2 H, u
- * brief EDMA3 Test Application5 Q. N3 i+ a# s' s% g
- *
# g" e7 q7 X& {1 o! D6 U - * This file contains EDMA3 Test code.7 n: \; V- _' i% i a: G& y
- *
e# a2 M& s9 e6 ^: L0 B% C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% r$ v! X$ M7 f3 V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# M8 {; g( k6 D R3 E6 ^- d* u0 R) ?
- * TO CHANGE.
, o* G( w1 e6 {# b* X' p2 V+ F: p - *
9 X! A" m8 V" L( P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 \; s' k+ e- C9 _( |/ b( b5 l/ E7 c
- *( E. n, Q9 a" L! d3 n0 L q- p( C7 ~
- * This program is free software; you can redistribute it and/or
3 H; P6 v j& ?# G! B1 a' b - * modify it under the terms of the GNU General Public License as" |+ Q. f) U! i/ l. [' z
- * published by the Free Software Foundation version 2.: M$ b; I. d* g8 a& m% ~( Q
- *% Q5 {6 F7 G: L* k1 l- y! ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# D; v2 \9 i3 Z1 R4 G9 A6 h - * kind, whether express or implied; without even the implied warranty9 b" F2 _" I9 R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ }& c) s2 n# ]+ \ L! I: U - * GNU General Public License for more details.
7 S$ Z! V i& S8 d - */
6 e5 ~3 t s F8 i- b8 e - 1 Y$ M5 P0 {' C1 f2 L' i: u
- #include <linux/module.h>
: `( f7 ~( v" U; O- f5 v& Y - #include <linux/init.h>* B: B6 f# x9 T) l3 e. m
- #include <linux/errno.h>, k* }8 ?# \0 P2 P7 |, a- f
- #include <linux/types.h>
" W: ~* c2 |: K% |7 n% V - #include <linux/interrupt.h>3 _" h# |1 r4 @* O' D0 N8 X
- #include <asm/io.h>
4 ^& t% W! g3 E5 D, q - #include <linux/moduleparam.h>
& m7 ~/ |$ \$ x9 s$ q - #include <linux/sysctl.h>
( K3 g% u4 w/ ]! k* I - #include <linux/mm.h>
a, l9 K/ f1 k3 j2 |! n" u% f - #include <linux/dma-mapping.h>
' j$ z5 T0 E; q7 |3 k - 1 e% k2 D @, M/ r7 V! J
- #include <mach/memory.h>" t9 v8 {" x, c6 l# I) t, V5 ~
- #include <mach/hardware.h>
" C8 @/ s4 ]9 N) c7 O* Y - #include <mach/irqs.h>
3 v$ i! U, }% F5 k: u: @% J - #include <asm/hardware/edma.h>5 e9 H t# ~: @7 |( _5 S' z
- ) L. e7 x/ b/ D% V! n* N
- #undef EDMA3_DEBUG
+ d% b: ], i4 w7 S) e - /*#define EDMA3_DEBUG*// u* C' G$ p9 L# ^
- - _2 w/ J# f5 ?; h9 |
- #ifdef EDMA3_DEBUG, H d/ x- u! r) n; O6 b9 R. R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 c& F0 r/ G( T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- ~' F# H- X. L* b. } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! p/ m8 M5 \- \0 Y
- #else! {5 Z5 J2 U4 L6 k4 m, a( h
- #define DMA_PRINTK( x... )5 B Q0 y* m3 v3 v# ~
- #define DMA_FN_IN! C9 G3 w: ]0 Q; x
- #define DMA_FN_OUT
- p+ l! O4 Z# b4 M4 [6 ?, M - #endif# b3 X! r3 G7 B5 {
- 7 E: v- R" g% C4 [ f6 @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ t0 n2 i, ?" w2 F# D3 M) J1 ` - #define STATIC_SHIFT 3
0 l: S9 G2 l3 \ - #define TCINTEN_SHIFT 205 z* t) ^0 d; U8 z1 s/ L
- #define ITCINTEN_SHIFT 21
! s7 F8 ], }* n& _6 k - #define TCCHEN_SHIFT 22
5 E, @2 }, P# _+ D6 K, e7 C - #define ITCCHEN_SHIFT 237 Q( W7 B8 N2 ]8 ^2 w( R1 a! r: I7 v
- - W9 I8 G- f4 S) R9 |; W, ]$ n' V
- static volatile int irqraised1 = 0;8 T4 Y1 W( l& W3 c# x* S' {8 g
- static volatile int irqraised2 = 0;* ^* S' ~; i5 t- Y0 Z
- 5 d2 F, v& f! z/ ^5 f! Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ ]& r: }+ Y" r9 w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% W/ L% c; Z+ M2 ]( _! b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 J: V" M9 }- z% \& R- A - $ ^# f( G9 M! I ~( A
- dma_addr_t dmaphyssrc1 = 0;
1 F8 {$ ^! N2 \! [ - dma_addr_t dmaphyssrc2 = 0;
. ^8 e8 f. Y. z# J& j - dma_addr_t dmaphysdest1 = 0;
& n4 w; `; _3 C3 k4 V) P( o - dma_addr_t dmaphysdest2 = 0;) e+ B/ N: X+ x3 X, Y. k& U& _
; h* @! T# G% b i+ d7 o- char *dmabufsrc1 = NULL;
" \ v7 }, C+ V3 j {! n" X - char *dmabufsrc2 = NULL;
5 L" {8 r( q6 \ - char *dmabufdest1 = NULL;) {7 i3 t4 K/ |# r# e* k7 q
- char *dmabufdest2 = NULL;5 } t: S) [# n; p. A* E
- " W$ k L7 e8 F6 K3 s8 B3 [9 V
- static int acnt = 512;
* N* b. y) h& N3 a( c4 K- L - static int bcnt = 8;; f; o; G' H+ j& k
- static int ccnt = 8;- o% m+ f& o+ G [
0 Y6 x. ^" i6 Y% t" ~2 {& B% O- module_param(acnt, int, S_IRUGO);
. U) \! G/ B) c) Q, } - module_param(bcnt, int, S_IRUGO);
2 m @" ^: n2 y$ m2 J+ g - module_param(ccnt, int, S_IRUGO);
复制代码 m3 R7 S3 |- q2 i$ x6 @# z; j9 ^0 }
3 _( v) L! J, X* E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' C( B( f0 t5 R6 N e" j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. i' R4 k/ W) q5 s! l- P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 w6 K6 S# n9 o
9 @9 I& S6 I3 _( F4 \0 f/ b6 j7 B0 l; A6 {/ V5 r* Y- C9 ^ S7 O0 k
|
|