|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : B& L- O/ J6 r: l6 [& I
- [code]EDMA sample test application4 \6 s( u, z5 S0 Y' i% M& H, ~ A. I. b$ p
- /*
5 s. M9 M; k( Z2 k- M& t - * edma_test.c8 o+ s6 {6 ]9 h. W* e% k6 U6 l
- *) x$ Z* q+ ?7 R( O
- * brief EDMA3 Test Application
: J) x+ ~. K2 M! R- ~& j - *
6 }1 \; U9 E8 k! h: _8 {( { - * This file contains EDMA3 Test code.
' F8 h- J+ n! i* [7 r4 u. L - *
/ ~4 x$ D1 |0 m% t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) `2 h! Y% l5 B( b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" \; d6 y+ O9 M' a* q" ~) R5 ~ - * TO CHANGE.
/ y8 ?2 ?! f; x3 J& S# G0 [# J - *
$ W7 ` ~ H9 X9 ? - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 y2 s: m5 ^. ~) d9 O: I: ]- H6 @
- *4 F& Y h2 q( g6 s* O
- * This program is free software; you can redistribute it and/or
+ x2 h/ Y6 G$ R% z! c+ v - * modify it under the terms of the GNU General Public License as
1 j9 ?9 L% y8 ]. H. d% u3 ~; u! ~ - * published by the Free Software Foundation version 2.
! Y- W* }; {7 i5 X - *
5 S4 d# d+ M2 s; ^3 \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* [7 n% N u' G% B0 x( ^; R - * kind, whether express or implied; without even the implied warranty- W" K% E6 w' x' j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# g! R- s5 y0 P) @" x - * GNU General Public License for more details.
! p: J1 i8 y+ Q8 [ - */ e5 x; P3 ~& d# o8 j
3 I$ ^0 M3 }- F: g) U5 G- #include <linux/module.h>/ d# W# D$ \7 N+ y
- #include <linux/init.h>! Z8 [2 @+ ?- y- M" N0 P; {- V
- #include <linux/errno.h>
) n$ Y: h: R3 i) f* @, ^# F# b - #include <linux/types.h>1 P2 G% P X! t8 P' A! n
- #include <linux/interrupt.h>
: a8 C W/ X- J3 h1 w# \ - #include <asm/io.h>, _9 s( s4 g* O8 W/ h
- #include <linux/moduleparam.h>
& X# N% {% M' C0 ?# t1 |, {6 ^6 X1 ]- T) j - #include <linux/sysctl.h>' p0 E" V+ x/ p, |% l
- #include <linux/mm.h>
* D9 ~* c$ m$ L. O4 [* B - #include <linux/dma-mapping.h>8 s; i3 \& D( R+ o, r+ r; K- u7 O
- 3 A. Z: C3 b3 j) L8 _2 s
- #include <mach/memory.h># S2 `/ `, \, V; ~2 _4 k
- #include <mach/hardware.h>1 c1 p; P8 T% y8 B) f) U& d' Z
- #include <mach/irqs.h>
: I S6 |5 ^3 X5 ] - #include <asm/hardware/edma.h>3 g9 M) v2 l5 @4 A* @; ^" S8 F
- 5 b* D5 t- R2 a8 N- f( X
- #undef EDMA3_DEBUG5 I8 T% w( g9 s. |; J# C( T: W
- /*#define EDMA3_DEBUG*// k& [% A. l# ]7 i9 e
- % _$ E5 k& k) ]* L* s
- #ifdef EDMA3_DEBUG: e. d5 _ f/ x( y+ m- F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% A; r+ u3 I6 |1 K. w/ N( b. K. n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ G. E) [( [2 w- t* ^4 ^. | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: ~& r! ]4 B! R2 F - #else5 l' Q( g" x' o. J. e2 [9 y% E6 i
- #define DMA_PRINTK( x... )
* L( m }: o$ q+ _* T7 M* a1 F8 J0 J - #define DMA_FN_IN
+ m: x M8 r7 M! h: e - #define DMA_FN_OUT
/ l# I" m3 Q% m, V. |* K; ~3 w - #endif
+ ~! K* i& z& X
: ~2 Z$ A- ~- S1 d7 M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
n0 n8 n+ k( w* o - #define STATIC_SHIFT 3$ @0 R* M/ u/ O. x4 h- r
- #define TCINTEN_SHIFT 20
7 G6 n/ V+ ^6 a- h' W) t - #define ITCINTEN_SHIFT 21
9 }3 B8 H: O2 a" m7 e, _( o2 H% S - #define TCCHEN_SHIFT 22; j& `% @: `7 X: L0 N; |
- #define ITCCHEN_SHIFT 231 `7 m/ I* C% H9 F. A! ^5 Z
' r2 w2 ?% U' P! ^- static volatile int irqraised1 = 0;
; l, N$ {5 x6 u - static volatile int irqraised2 = 0;, U9 P* e5 j2 I" a
; c- t% I T; x+ L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. G$ t! @9 [0 @( w# d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Q- J9 d" T* J# ~, V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* J y; Q4 L. a. ~1 o
& H+ ^& r! ^0 \2 z. g; J- dma_addr_t dmaphyssrc1 = 0;
0 e0 D1 U& Y0 X6 U- ^9 H6 h - dma_addr_t dmaphyssrc2 = 0;
& {- m" @( ~2 y2 i& \7 o - dma_addr_t dmaphysdest1 = 0;
$ ?/ k# X. x" S0 w - dma_addr_t dmaphysdest2 = 0;
% [+ t2 f& n6 O$ H) l6 R - 1 Z5 Y w0 E$ b/ K8 m& `
- char *dmabufsrc1 = NULL;
% T, q1 ?5 g' F5 } Y/ [ - char *dmabufsrc2 = NULL;9 j0 S) U: \2 F* ?
- char *dmabufdest1 = NULL;& ~ t, _) n! K. l9 F. b8 K
- char *dmabufdest2 = NULL;( s' D4 y! R$ v$ D9 b# E' X# u
- , u4 e2 X3 N' `9 r' S. f
- static int acnt = 512;
5 b- N+ W6 I5 N+ u - static int bcnt = 8;' R3 n5 P. n Y1 t8 m( u# E
- static int ccnt = 8;0 S) T# k7 N4 X5 p+ H4 a5 x+ G2 F
3 t' L" s) P% L9 }2 K/ p% q Q- module_param(acnt, int, S_IRUGO);
$ S" }+ G% W, x# G+ E, v! s3 Y - module_param(bcnt, int, S_IRUGO);
7 [2 \& K, y: b4 x - module_param(ccnt, int, S_IRUGO);
复制代码
K9 i+ J* W/ Q
8 L$ k5 U' T, s3 m% B" e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 I% y& I8 @1 Z! p! W" W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ D. C8 e$ r3 a1 \3 Q& v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, X( Z- z& H$ `- e4 q* H1 m
6 k# L" w0 z5 q ^: f& ?: q3 F% R3 z7 H
|
|