|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 e$ _+ y' E8 ?7 p- [code]EDMA sample test application: f# X4 v$ D9 E
- /*
7 o3 N) _3 Q- t0 N! Z Q - * edma_test.c& F: Q/ G1 j3 \9 U P+ Y) c7 r
- *+ X' g. c$ X. A" b
- * brief EDMA3 Test Application4 L2 ~: a# i, ]2 I! v/ d* L
- ** \2 h$ |) \9 p) ~1 l
- * This file contains EDMA3 Test code.4 t- |- f y, a/ L& a, q
- *
+ F3 \" j6 N# z6 _; [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" @* x; {0 q6 N9 U% A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 m4 z( Y; ]* ^% z$ p( _9 a3 ~
- * TO CHANGE.
( E }$ \# I8 _7 R6 Y: c - *4 E+ s+ O! m$ m) x3 h) t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 f I' R8 r; c6 ~+ c
- *# n0 s+ K1 e6 v6 g4 w
- * This program is free software; you can redistribute it and/or
$ J/ _( G" |+ Q! ?" w - * modify it under the terms of the GNU General Public License as+ x2 |- d, Q( y4 w+ W1 ^
- * published by the Free Software Foundation version 2.
9 g7 K: \8 S" E7 ] g0 S; X - *
4 A, s( c% f, i+ V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 i, o. [0 d$ R- r - * kind, whether express or implied; without even the implied warranty
* `$ f% j0 s5 B5 ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 O& @1 ?4 O5 s6 Z# h" r# \ B- {8 f - * GNU General Public License for more details.% x9 f" {6 z1 {' a5 s9 B
- */ y4 w8 c$ v/ u( w
- 0 q3 G& Z- G! y8 y
- #include <linux/module.h>2 a8 g% s g9 b( A+ L
- #include <linux/init.h>! R0 j) x* K/ W2 w7 n
- #include <linux/errno.h>
8 l x. a) n3 s' s$ j3 ~: O - #include <linux/types.h>
) X; p! ?& ?# U& C& L% p - #include <linux/interrupt.h>( v% n* R- P9 D
- #include <asm/io.h>
2 V, i/ U% s# c/ k3 W: Z0 E - #include <linux/moduleparam.h>
7 Y- R5 X8 ]/ L+ C - #include <linux/sysctl.h>5 f) N1 |7 i9 q3 T( ^4 c
- #include <linux/mm.h>
- C) }) i2 J/ V7 r - #include <linux/dma-mapping.h>) I' ^ }9 l; q- w; W2 C: R6 D# r# e
- 9 e4 |+ m( ^5 |7 u
- #include <mach/memory.h>
; H2 \! y3 f3 M/ E2 ~0 R - #include <mach/hardware.h>
; m' Q1 J* K) P - #include <mach/irqs.h>
2 M; Q0 }. g# [; `( \0 V - #include <asm/hardware/edma.h>
$ K8 r1 x( _5 x
0 R: v* p6 @2 S6 M" K$ r9 q, K- #undef EDMA3_DEBUG% H* {3 j; L4 j- k
- /*#define EDMA3_DEBUG*/8 n5 o/ K# O- {+ l. b+ |. X
2 k% j, c9 a! o$ l u0 |0 Y) j6 g- #ifdef EDMA3_DEBUG
, S! K( t7 u+ x' A+ X5 u) m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); ~7 K1 ]7 T% P' K# D6 }# ]) r7 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 }8 J. ^* }. ~2 s" x7 }5 }8 M7 [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* Q% K- {% n c) ~
- #else+ y$ ^9 d, u y+ i0 R" J3 k
- #define DMA_PRINTK( x... )
3 L8 o$ n e0 m+ [6 \6 u. g9 Y* x - #define DMA_FN_IN& |3 f3 d/ X$ q' H; \+ a) S& R' w E& |
- #define DMA_FN_OUT% s5 m3 x6 A. J7 o3 F
- #endif0 U, i% Q, o% D/ D: K' I* K
6 G0 B0 s! q% r8 h4 `- #define MAX_DMA_TRANSFER_IN_BYTES (32768) g- |1 A" C' ` B* b9 R
- #define STATIC_SHIFT 3& R- l/ O0 k6 v' D+ M: O
- #define TCINTEN_SHIFT 20
5 A" y% p. I d9 x: P - #define ITCINTEN_SHIFT 210 q# |. f @) k( ^% W
- #define TCCHEN_SHIFT 22
X( T$ P8 ~* n3 l; T - #define ITCCHEN_SHIFT 23
u L2 ~9 H& M% l - 3 m) {% s. H3 U
- static volatile int irqraised1 = 0;4 V# h- n: G% K% \
- static volatile int irqraised2 = 0;4 c2 H4 Q) w5 U. x6 Y
/ z! K/ a4 ?. N0 o+ q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# T. w3 [) h. L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: f% g C. I& E" _7 s: @% X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ k+ a& A! N/ [7 e3 g5 w/ f
9 {0 K8 D8 ]& A: o) f) Q- dma_addr_t dmaphyssrc1 = 0;
, `- t' b7 q% Q+ M; n - dma_addr_t dmaphyssrc2 = 0;4 y' H1 {1 A. T! v/ M# T9 a
- dma_addr_t dmaphysdest1 = 0;
/ D) p, V2 L8 C' H - dma_addr_t dmaphysdest2 = 0;
W2 B/ H# |: ?$ k' M$ D - ) d0 |* l: F' I1 ^7 x) `! C" C
- char *dmabufsrc1 = NULL;3 I/ d: Y) S& a8 L
- char *dmabufsrc2 = NULL;
4 j- F+ I7 \, I: S( v& o - char *dmabufdest1 = NULL;/ b2 O3 }. ?# ^3 V; u1 [6 g* H
- char *dmabufdest2 = NULL;
! K+ M3 G4 l" C - , l. }1 t8 s5 W# K5 k
- static int acnt = 512;
* | U9 Q" \# E# j* R7 n - static int bcnt = 8;2 o. q T" s2 z5 z
- static int ccnt = 8;
3 m. c9 |+ v" _
2 `8 { ]9 c9 w2 |4 X! t) w- module_param(acnt, int, S_IRUGO);5 z9 t4 S1 G. i( n
- module_param(bcnt, int, S_IRUGO);
1 V8 I1 R1 r% P% P( P - module_param(ccnt, int, S_IRUGO);
复制代码 1 f7 N9 b' A0 L$ `4 L) k% Q
V z- v; L, z1 H( [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# B+ k7 k, D. j v' H; barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( h/ }: J+ f+ t; A6 w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 n; H0 N7 t: `. D# A4 O- e
, O1 u3 F# f( g" o2 D6 @3 j+ B( [6 `: t! [/ q& J
|
|