|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 i# A! a; u: i6 u- ]' R( ~- [code]EDMA sample test application
$ _) _/ G! ]( O3 Q - /*
; Q( ?' Y1 A0 M# i# s - * edma_test.c
( ]9 V9 ~' M1 B; M/ Y& M! h& ^7 T - *
7 Z' |# t& ], ?; I; ` - * brief EDMA3 Test Application
: O6 x( A& [& n9 r; K; i% w - *
' x1 m5 B [/ X - * This file contains EDMA3 Test code.1 b/ n; V/ D$ e: U4 Q
- *
/ v% M# \0 X. m2 c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% h$ S( T9 ~& P4 S* }& T7 F: Y/ A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( c$ y' g6 ]7 P: B - * TO CHANGE.
: r2 U/ |/ @! z - ** x" B1 m6 ~1 K7 z. }4 S3 R3 t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ f6 X' U: y: x- N* ]; O
- *6 Z0 l( y6 y* ^" [
- * This program is free software; you can redistribute it and/or
9 A( v$ D3 y/ r/ S, ^ - * modify it under the terms of the GNU General Public License as
- ]5 s1 B" Y, k - * published by the Free Software Foundation version 2.* H7 P% G$ b0 o0 @6 E
- *, X8 c2 O& m4 z* P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' G8 U9 h* ^7 }' u4 k6 E; M9 P: q1 f - * kind, whether express or implied; without even the implied warranty
# N5 D4 S& J: |* S9 j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' _* u$ r! }5 `% P# o, {+ [ - * GNU General Public License for more details.
$ D+ e+ e$ M5 N. ~' [* b& H" [" U - */
$ [0 E4 H3 ]* S# c0 P - & _0 T$ W9 |- x! T. M, l
- #include <linux/module.h>
$ }0 G/ }& [9 }! F - #include <linux/init.h>2 P% W' ^1 {) K5 n" C5 p9 L. s
- #include <linux/errno.h>
1 @4 {+ X! n; O1 [ - #include <linux/types.h>4 q8 T# X7 ?: G, P
- #include <linux/interrupt.h>
2 x9 G' N# p L - #include <asm/io.h>6 x! A6 R) z. l/ m- K9 p
- #include <linux/moduleparam.h>
9 t; C6 Y9 \+ D( h1 D7 _, D - #include <linux/sysctl.h>
; x8 K" \ k: d- x0 @ - #include <linux/mm.h>/ l6 n' h. h' P
- #include <linux/dma-mapping.h>; q! `$ ~& h3 Q5 w; k
; t. J7 A: L: x Y7 u- o+ s- #include <mach/memory.h>
) v |/ ~ R7 I - #include <mach/hardware.h>4 o1 S) W. E: S0 S* {
- #include <mach/irqs.h>
% ]$ U( p1 r3 ]1 w9 `+ n- j - #include <asm/hardware/edma.h>
1 w) ~( a @& Q/ w9 a' Y0 |5 ]
) Q) r! l/ P0 N+ P- #undef EDMA3_DEBUG3 k% U- c2 Q1 n y' [; P. n0 P! J
- /*#define EDMA3_DEBUG*/8 _+ U4 K2 }. s* W' c
- ; g' m% ]0 r" g1 }
- #ifdef EDMA3_DEBUG2 O8 @9 @ ~* I4 q2 z4 C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& t4 N# O1 D4 u6 u0 Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- w( `: L& C2 N4 C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# X, ]) p% i4 J0 d& H - #else( c) [; w1 `' @: C( R/ c5 Z, z
- #define DMA_PRINTK( x... ); ~# B; d% M! ]) y' o
- #define DMA_FN_IN# n0 r. d. C( D/ L! ~" u7 _
- #define DMA_FN_OUT
. C0 j( E' U. p" g9 ~* v1 S+ R - #endif8 p1 X3 f5 b) @" L- ^
- 7 A& B+ t" n0 I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% L9 @- l% J2 ?8 ^
- #define STATIC_SHIFT 3: L% X2 b: ?8 s; F+ V5 K
- #define TCINTEN_SHIFT 20; f3 t3 K( U+ J5 [7 y5 [
- #define ITCINTEN_SHIFT 21
8 J0 {( B. |, S4 Y - #define TCCHEN_SHIFT 227 z* S/ U& c+ ?
- #define ITCCHEN_SHIFT 23
0 q& W! y+ | o5 D, F - 1 Z) a& D' E' v" }
- static volatile int irqraised1 = 0;, O, y {: g" @4 q* g# }9 k
- static volatile int irqraised2 = 0;
# v W* u3 \9 l7 e& }# }& N3 o
& V: x, T3 ?# a! S. F( n- Y9 k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( B; d" i! C x& Q9 _& i4 }" D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. V& j8 |3 l4 A2 x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& p! ~. U' ]2 U. e
# n* Y' W. ~' H, P5 x+ z- dma_addr_t dmaphyssrc1 = 0;! `; H1 `" e* q1 ^
- dma_addr_t dmaphyssrc2 = 0;
5 K; ~+ H; B% c0 m X" O - dma_addr_t dmaphysdest1 = 0;) J" y) k0 \7 Q5 } h
- dma_addr_t dmaphysdest2 = 0;& P2 i% e$ c" k
4 O0 B! e$ C9 X- char *dmabufsrc1 = NULL;
6 B, a! z! N, d( F+ O" A# w5 d - char *dmabufsrc2 = NULL;/ @# a- m) m( s" b7 L
- char *dmabufdest1 = NULL;' w2 n8 N8 t6 R
- char *dmabufdest2 = NULL;! ?" v4 K0 `( r0 q& c# o
! g: }# H9 g5 W* z& e- static int acnt = 512;
( g h/ R% w+ f - static int bcnt = 8;
! U( p. o3 g T( v! X - static int ccnt = 8;6 |) c% B/ q F6 [$ ^% A
- / Z( l" u& f5 b; V3 [ [
- module_param(acnt, int, S_IRUGO);
0 B7 S( j" _* z - module_param(bcnt, int, S_IRUGO);
5 R1 {5 a: |5 p, `4 p - module_param(ccnt, int, S_IRUGO);
复制代码 # r( S! [# X6 O0 t G( e
& V4 \3 H! [* r8 Z0 P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 K1 G7 ]$ Z n- marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 g7 ]1 T# r- h% y: Q2 d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 D* D n% m! M- q0 Y2 t
7 z6 E9 b) m3 I/ U8 H6 X% S1 |6 b& V B) N
|
|