|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
c/ Z" E1 v( M3 a- [code]EDMA sample test application9 Q& Z7 U* f. K' P0 s) f$ O
- /*
7 w) ^4 q$ ~9 U: x" e, w* y - * edma_test.c9 n% K( m/ q# {( K& t3 j
- ** x8 ~" H8 Z4 C. C- ]% W
- * brief EDMA3 Test Application
# R m7 o8 ~* H: z - *& Y6 q0 Z$ s5 F9 e# K, `$ {
- * This file contains EDMA3 Test code.
/ P5 p$ b; h" L( c" Y$ X - * L) ^$ c5 F2 o( p* I* ~) j! V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 U5 u# }0 x& b2 P% {, s1 j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- T6 @- b! C1 S* k$ E2 F% g" M a& d1 O% U
- * TO CHANGE.* {1 R8 e G: _5 n1 H: r9 t/ n7 ]/ `
- *
# n8 E( |' V4 f6 V! q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ [0 X/ o b! F6 ]# b# \' A0 ?6 q1 \ - *
( u% x" \( ^1 A% V- T7 i! `2 S - * This program is free software; you can redistribute it and/or
: W9 h% m- e, t5 U$ { - * modify it under the terms of the GNU General Public License as( j# q F* B1 _* p# ]0 \& _# I
- * published by the Free Software Foundation version 2.
7 O2 t. V7 `* _$ E* G - *& z( O& Y8 d2 X% Q) j: a. C0 H7 \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 W, P6 [' L6 u# d; T
- * kind, whether express or implied; without even the implied warranty
1 E/ i! y% }- F1 P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 d4 [- e; }! v - * GNU General Public License for more details.
; Z; \+ y$ b8 h - */
2 O& j- k8 e6 a `( b
3 a% B8 W/ a7 ~) i- #include <linux/module.h>
* ]" T# `% n( s3 x5 L: M - #include <linux/init.h>
: i, n9 R# {4 v - #include <linux/errno.h>
) b* k% _, P1 k2 W* u+ L - #include <linux/types.h>3 A. y7 K$ \9 W$ M* Y! N
- #include <linux/interrupt.h>- ]! @& B! Y O- A& L" v
- #include <asm/io.h>/ H& Z/ u1 v) l3 @" M& h1 }
- #include <linux/moduleparam.h>
% P" a5 ~5 L" l! l - #include <linux/sysctl.h>
7 S5 I; ^5 V: a& K" ^ - #include <linux/mm.h>" L6 k1 e E x" T
- #include <linux/dma-mapping.h>
: S# O( M8 ?9 ?5 c( ?
' ~( B e0 K* X, y- #include <mach/memory.h>
9 [' I/ L; ?2 b - #include <mach/hardware.h>" Q4 r* m9 s9 q* y* L0 R
- #include <mach/irqs.h>
+ I+ x1 J# A) q' x" B - #include <asm/hardware/edma.h>2 Y2 Z( c+ U9 t, N. `# s0 m; x" ~
- & v- y9 l5 {- T: O9 s# L
- #undef EDMA3_DEBUG+ o% R+ @4 W& K
- /*#define EDMA3_DEBUG*/& F3 q' t$ g* Q# X- W( c9 X; ^7 @3 Z
: G0 u: ~- M: r7 X: d- #ifdef EDMA3_DEBUG
/ X. F# c T$ O% Y- w! d2 B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! a$ h! L, _) X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 |5 `5 O4 I% K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( D+ w& _; y6 H8 a - #else
' X4 T W: t( _$ x. g$ A% v# ? - #define DMA_PRINTK( x... )
. R [7 p2 B5 \2 @2 J2 F T - #define DMA_FN_IN
4 h+ ~6 `! f3 c. x9 y2 k - #define DMA_FN_OUT; J6 i2 h- D9 ^% X: C' D7 {. i
- #endif
2 G8 C8 H8 o9 |* X/ ^' e9 d# c
" Q; R* f) Q! ]4 A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' W- d8 a* I0 O* j( X4 p" A
- #define STATIC_SHIFT 3
+ C& S% T! D0 }$ i - #define TCINTEN_SHIFT 205 J4 X9 Z. J' i2 V+ k4 _
- #define ITCINTEN_SHIFT 21
% x& W! N' W! @/ e - #define TCCHEN_SHIFT 22
; L: P* }, h' z% c/ i/ y - #define ITCCHEN_SHIFT 23
K5 a; H/ v+ \( E3 K: ] - 7 S6 _! G% d% E! U/ V' u8 }
- static volatile int irqraised1 = 0;6 ^6 V* L- n0 M! [1 N5 r1 S
- static volatile int irqraised2 = 0;, N& A8 v* b* f% Y; S" ^# L
- 6 ~; K9 k3 }5 ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Z- b y0 Z6 \/ B3 P/ F- p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 r; u* _% G5 H) [5 ?+ @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- \. v+ t* [6 a P( x2 K
* w8 n3 j0 n% X/ f9 _- dma_addr_t dmaphyssrc1 = 0;
: f1 `, Z: W* U4 e* x - dma_addr_t dmaphyssrc2 = 0;
2 p5 y. c9 a% V4 q; S/ w% z - dma_addr_t dmaphysdest1 = 0;, G5 t( ?& n( D& R4 o6 ]
- dma_addr_t dmaphysdest2 = 0;
* T5 S0 y& z2 c5 j - # b ^- Z3 h4 w3 E% ~/ @, w
- char *dmabufsrc1 = NULL;
% h3 H& d$ L2 n. e" Z - char *dmabufsrc2 = NULL;& S6 b, k3 s) e7 K
- char *dmabufdest1 = NULL; P9 c2 @6 G5 B8 f( Z' A% d' z4 l! r
- char *dmabufdest2 = NULL; R" D' x4 c) K
~+ A* z6 K; ]& g+ m: C1 }* e2 T- static int acnt = 512;
! R: K8 x; f$ }& F3 r) a - static int bcnt = 8;5 a9 Z- `* J q2 F9 D* w, u9 C
- static int ccnt = 8;
L" l' `8 f9 v# d# G% d' ] - : B# m, @1 p# H1 I' L# l
- module_param(acnt, int, S_IRUGO);0 }* q5 w/ e& x6 z* P9 d+ k
- module_param(bcnt, int, S_IRUGO);
9 I0 U* y1 K; c( `2 B" m - module_param(ccnt, int, S_IRUGO);
复制代码 % p) ]& ^4 \2 m7 O ?7 \
5 J9 z K {; m. W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 O/ j5 {# X/ k) U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ l0 o/ k0 D) ]# Z) t' ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& a4 W8 M& |) P$ @% B0 [+ I
% ^/ W" g z* F9 t
$ i1 q7 v7 y- J |
|