|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % A4 b! F( v4 g5 \: Q3 @* F9 i! W
- [code]EDMA sample test application' d; f. E% t1 d8 O% c: H
- /*# J( c! J* H2 A4 I: L4 E/ d
- * edma_test.c$ U1 W! Z% P% O4 k" Q8 N8 D+ V
- *# h/ \0 G8 F+ T" b3 D
- * brief EDMA3 Test Application0 B" M; q6 j+ {: y7 r
- *
3 D# y) Q8 I" `% T( { - * This file contains EDMA3 Test code.
5 n1 w4 E6 R2 i- i: {: M9 n6 N1 R - *
5 r7 ^2 K }8 S4 H# q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 A0 s% K0 F+ D# M/ h, ^# h$ }1 h, } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 K0 F% p2 [1 ^! W0 i - * TO CHANGE.
) ?: m3 j9 @/ _$ ` - *
# M" q/ W6 ~, ]" J) `) I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 _5 g) R( ]9 H9 ^ v
- *
: X9 `" m' q5 k7 l& h. U9 X& U$ ~6 ] - * This program is free software; you can redistribute it and/or4 \9 h9 J) }) C; t
- * modify it under the terms of the GNU General Public License as
) v4 p* T8 X% k' {6 W - * published by the Free Software Foundation version 2.2 g- i1 d6 T5 j3 U) o6 u
- *
8 w: B$ s* b; f8 j( J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. v \, r% D" x7 D5 s
- * kind, whether express or implied; without even the implied warranty' u, F( ?6 D* x9 e# u
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, ~3 A; I E& O4 E# n3 c7 ]
- * GNU General Public License for more details.
1 w, g q) b# S: } C - */
9 i* J% ?" l( c - 6 k+ C K# h# X& T4 W! U( [. v( j
- #include <linux/module.h>
* h4 C+ K4 r" c& Z+ j2 S0 h - #include <linux/init.h>6 h' B7 b- U% O
- #include <linux/errno.h>6 `9 I" P0 ]& S. Z: e
- #include <linux/types.h>% |' Q% v, {3 {0 M. l
- #include <linux/interrupt.h>$ V8 G# r7 r- {8 U- z# P
- #include <asm/io.h># w2 {1 _% v6 q
- #include <linux/moduleparam.h>
4 W) N. G3 F+ q4 {* l; m g - #include <linux/sysctl.h>
& ^, ]; B3 ?& }5 F& m- R8 l - #include <linux/mm.h>
( Y8 \ M. o1 Q& @, b" w - #include <linux/dma-mapping.h>$ O3 F) H3 h( K) X
) R) v7 M [, W1 l$ d- #include <mach/memory.h>8 M J+ [& W5 J3 Z: u
- #include <mach/hardware.h>
" K) G6 \: e- {7 p" |$ K# N - #include <mach/irqs.h>
1 @' V m& V/ z) C - #include <asm/hardware/edma.h>0 P$ I* `! a" }& E
- - Q/ o6 K" M$ w0 Y3 [6 d0 J
- #undef EDMA3_DEBUG1 H) ^( q; c% D ~8 o5 n" l
- /*#define EDMA3_DEBUG*/$ F. C# F; b" }( E6 ^0 A: N
* T2 `9 _/ s% b" A- #ifdef EDMA3_DEBUG0 ~+ k) J. {' ?; @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) P w6 z( W& R' U s9 _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 Y+ Q5 ~, E* c; ]1 J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( Q/ f6 ]" o+ F7 o) _9 J) G
- #else/ R' Q. t( N$ R0 P2 ~1 g, x0 T
- #define DMA_PRINTK( x... ) g4 N) y4 Q. y% G2 H
- #define DMA_FN_IN8 a% r- B+ J5 `) N7 j3 a
- #define DMA_FN_OUT
1 C2 \! [" y4 b- \3 ]/ F - #endif) [8 [9 Y& ^' K
- 0 q0 z2 M) c- F& p) \$ D' W( y6 t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 T$ ~; a) W$ E3 s7 y
- #define STATIC_SHIFT 3
# Y% m9 k0 E+ Z' K" Z: O - #define TCINTEN_SHIFT 20
! Z5 J7 T4 Y: K) t! A% Z( f, i - #define ITCINTEN_SHIFT 21
% s d* }6 f7 J' h - #define TCCHEN_SHIFT 225 }0 m1 M6 J( B7 c! d" n0 n
- #define ITCCHEN_SHIFT 23/ K) K/ S; d" u7 a0 K1 [
- ) [' p" m$ F0 A0 i: J
- static volatile int irqraised1 = 0;
( T3 P% a0 D* }" \8 q5 p @# S - static volatile int irqraised2 = 0;& |! b5 Z( E3 n9 u
1 ]* E' Y$ V& z' [: Q1 i) w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* ~* E: p8 r6 `; d7 A6 F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' B+ {* V& H$ M7 D$ Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% F" t) \/ r+ Q" e# \
5 b, F# d+ C" A; Q7 k7 X1 _- dma_addr_t dmaphyssrc1 = 0;- O: `$ x' C: x: a6 r/ S0 ]
- dma_addr_t dmaphyssrc2 = 0;; l/ G- F6 k6 w5 M/ x
- dma_addr_t dmaphysdest1 = 0;
' W V: ^+ W1 C& `" V R0 R - dma_addr_t dmaphysdest2 = 0;3 ]" V8 [$ H* y) J! \
- 6 b4 T6 u" Q I0 e; G- Z- f: V, A
- char *dmabufsrc1 = NULL;
4 {+ }( T6 R- t% N2 W - char *dmabufsrc2 = NULL;
8 E- I3 k' p2 t5 m, x/ i" l% q - char *dmabufdest1 = NULL;
G+ v6 x7 e; C- V6 ? - char *dmabufdest2 = NULL;+ G/ }1 {3 _" m% I5 d5 f
( J6 A8 Q" g) D3 M+ @$ _- static int acnt = 512;
@& \% b/ t1 F. E$ {# ]9 i/ X - static int bcnt = 8;5 _0 y' q$ H) m, c& s. f8 W' U. n
- static int ccnt = 8;
$ w- Z1 m; x9 b9 D! z - 2 X# @8 O# J( Y
- module_param(acnt, int, S_IRUGO);
# Z) b* V+ V# u4 D- y( o - module_param(bcnt, int, S_IRUGO);
! p/ A7 [' S+ L& u' w - module_param(ccnt, int, S_IRUGO);
复制代码
0 b% c: b3 q {6 _! T4 {; U* ]/ {/ P( j; h" L/ c( b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! {# t! V# D/ F1 Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% ], K8 E+ h8 L7 ~+ w/ p2 J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) k5 @ D( e1 J. M6 |: y( S1 M2 i1 Y
! G! S* `+ j4 {. E) S1 g
4 e2 R! q# w9 A3 O& R8 Z |
|