|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , C$ d3 S. [' w7 q7 { ~+ _8 b
- [code]EDMA sample test application
! s' ~4 J3 R$ p2 R- q5 _ - /*- E$ t* ]4 |7 A/ l% N6 f
- * edma_test.c8 f+ h! J d1 M
- *4 W* P9 u: J* }3 v: |8 o& G
- * brief EDMA3 Test Application
- v' p( m) \+ j- E - *
5 W9 Y& f: ^# e5 { - * This file contains EDMA3 Test code.
) [3 @( T4 C# a* Q1 A4 M& E - ** J% y8 F i( e# _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) e+ g z; T# L" \) j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: l$ n: n5 I, ~5 o
- * TO CHANGE.
+ r8 n) S: P) F& i) q - *2 o& w8 |% ?" L* q i; h6 T. O6 d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' v j& f( l+ B
- *% Z2 c9 P7 B% A
- * This program is free software; you can redistribute it and/or
8 J! _3 x7 o2 P* E3 k& D5 ^1 m1 B - * modify it under the terms of the GNU General Public License as5 T |5 N1 G3 g( i. P6 l, h
- * published by the Free Software Foundation version 2.
, G) N+ u2 d' |; @: h# T: c - ** V( R! X) X& J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 J L4 G2 ]3 I; U
- * kind, whether express or implied; without even the implied warranty
+ r8 H5 i3 E, \3 ^5 D% U) c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ _, H. _+ I6 ^# C6 i6 q - * GNU General Public License for more details.
& [/ J8 ] H* Z6 Y c T1 f9 W" M - */: E( |6 j+ I: I; u0 s9 b! F
4 B+ y5 O0 O) W# t- #include <linux/module.h>
, L z" k( b$ s - #include <linux/init.h>
+ x9 n* w! Z" l - #include <linux/errno.h>
; e& j Y& A$ r, j+ W - #include <linux/types.h>! `- ~4 j, k/ ^+ P
- #include <linux/interrupt.h>1 S" d1 M9 V: F& i$ Z2 a6 E1 x
- #include <asm/io.h>/ X5 w1 u, }. ~7 {! [: i2 }+ Z
- #include <linux/moduleparam.h>( ?7 ?% h) I* R, B$ z5 D
- #include <linux/sysctl.h>: y2 k. D+ ?; l; \. z
- #include <linux/mm.h># W" t. h% M# ?7 Z
- #include <linux/dma-mapping.h>
+ c' S& D. @4 @7 m8 v
( e2 H* u6 C& d; ^4 _4 e- #include <mach/memory.h>7 Z$ \- a# L3 W/ h) {
- #include <mach/hardware.h># B ?0 I0 E \/ V( q' [
- #include <mach/irqs.h>
( _" |* c" r& Q - #include <asm/hardware/edma.h>
. p$ O0 c6 Y: f! } _" [( V/ D - 0 k: z8 c' A: t' g
- #undef EDMA3_DEBUG/ a: b f5 w2 W! O/ S/ L3 c8 \+ f* v
- /*#define EDMA3_DEBUG*/
8 k7 E, S o6 m/ ^$ E - 8 o3 n5 T2 I! g* R6 ^
- #ifdef EDMA3_DEBUG
5 O% g7 |- ^: }3 }0 o4 D+ @1 T" C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% Y, E5 ~; \( P" e8 N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ G. V1 D0 ] ], E' [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* g) N6 c( [/ q, G0 c+ \ - #else9 Z. i9 d- F; x! X* r9 l
- #define DMA_PRINTK( x... )* G, ]* T; }: }, x7 C( O* A. _
- #define DMA_FN_IN
# _" y8 y e+ O d* f* z - #define DMA_FN_OUT( t" Q- C" k, m& g5 o6 S
- #endif
6 X0 G+ _( Q. c/ F+ e6 p2 w
) }* e+ a/ S- s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 p5 }4 b8 t+ j
- #define STATIC_SHIFT 3, m9 V% T; E. Z2 K( q' ?1 \4 ~, T
- #define TCINTEN_SHIFT 20
% H2 p5 f) A6 b! O: o - #define ITCINTEN_SHIFT 21
3 D+ c4 M0 i: x' O. | - #define TCCHEN_SHIFT 22
' p0 Q& u2 v2 [& x) e& ?9 K/ W - #define ITCCHEN_SHIFT 23
% {2 x* P. _! y! A8 c - 7 l4 ~% |5 l2 U2 Q
- static volatile int irqraised1 = 0;
% o7 S2 O# A5 d; h - static volatile int irqraised2 = 0;
) G' n$ j2 j" V6 O' ^3 J+ u0 A - + a" O. Z2 v5 n) X8 f$ A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ m: ?6 c# R% {' `4 l3 N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 y! I# h* f2 N) i6 @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 _8 T9 W1 L. b5 X" E. T; _
' w9 L: L: K; n; {8 a; ~" E- dma_addr_t dmaphyssrc1 = 0;
4 s9 R5 B- t3 h; F( {3 X6 l - dma_addr_t dmaphyssrc2 = 0;
j% l" `+ W) Z% m3 {! W( B; X3 _! ? - dma_addr_t dmaphysdest1 = 0;1 c1 Y" L/ T* x% R, Y
- dma_addr_t dmaphysdest2 = 0;
8 J. t3 l" ?8 F3 t* M2 [1 M
a- C4 N A$ s& K6 F: c' p- char *dmabufsrc1 = NULL;
. h% i( A7 u+ @: g8 T4 A4 Y - char *dmabufsrc2 = NULL;
# `4 @' f3 U) X* E+ ? - char *dmabufdest1 = NULL; D/ V& o7 [0 l3 s% q8 P& @1 i
- char *dmabufdest2 = NULL;
& S/ \! ]6 C& F3 {9 _ - , t$ E9 a; ~! e
- static int acnt = 512;& e3 R- g& Y: G% c" ?
- static int bcnt = 8;
! X) k4 X, A- R - static int ccnt = 8;
6 m8 e2 D9 ~0 [; q - ! |- D m7 Q; P+ T. }
- module_param(acnt, int, S_IRUGO);% u- i0 g5 P v. x
- module_param(bcnt, int, S_IRUGO);+ n& N1 G' H" b- o4 z
- module_param(ccnt, int, S_IRUGO);
复制代码
' ?. h, i' D1 i/ Q2 l- g! n" M& u( ~- j: c, l# m) L8 h7 X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ E$ |9 \! F. z6 g0 x0 P8 \ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. ] E, E P0 q# Q" X; H3 a" i3 ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 G* p5 U& J5 f. V. v
* {' ~1 z5 d8 Q( G$ a: y, s5 C- ^, H7 T4 ~) X f
|
|