|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 Y$ i# p3 I4 ?' E5 m; W" H7 m+ m
- [code]EDMA sample test application
% v6 @' \5 w: G$ T7 B3 O- j5 y/ ] - /*
& U8 E8 |5 b7 b$ u; \, L3 h! \( S - * edma_test.c
% W( e7 Y( K5 Z/ \1 ~' h - *2 x, M% h* [9 i8 s8 h
- * brief EDMA3 Test Application
, Y0 h3 S: B8 `( |3 }: |( i9 ?3 L/ ?6 P - *: \0 P" b$ i* M5 d: S. i1 l8 V
- * This file contains EDMA3 Test code.
* L. W& P/ ^' w - *9 f3 D. [9 c& O X" j1 G! ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
E, V8 I y' Y3 B# \3 Y- B: ?4 E2 X4 ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# h; m( {5 E6 g% _+ R5 |7 { - * TO CHANGE.% q! o' Q5 m* q
- *8 @6 R; q7 S! j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ m$ d3 l4 ?9 A& _( W+ m# s5 _ - *. Y; N. A/ ^( j, q: K' \
- * This program is free software; you can redistribute it and/or/ S# T8 j! U4 h9 [
- * modify it under the terms of the GNU General Public License as2 A: @* {; x" W; a8 f
- * published by the Free Software Foundation version 2.
( J% n+ z& M" Z" V; N; z2 @8 h - *
9 g2 B4 s; K: d' a1 N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ l2 c m: W7 B* y
- * kind, whether express or implied; without even the implied warranty
; o0 u- W+ M$ T; l! {, M1 C/ a& x, C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 p% j# i( `) R' A% {/ M - * GNU General Public License for more details.) S. h3 h6 u Z/ Q1 k$ J
- */
, D% H. f* e+ i8 O2 _) `% g - $ _) W' J) k. H( E/ k9 R" _+ C
- #include <linux/module.h>0 _+ G Y3 l# I9 x# ?
- #include <linux/init.h>
N: ~" J, M; R1 n2 s& | - #include <linux/errno.h> o3 ~6 s; t& {( e: j5 L
- #include <linux/types.h>
9 R9 t ~) k% o; q/ u - #include <linux/interrupt.h>
+ l: L. F) c# k: E) v6 A- G - #include <asm/io.h>4 P. z e1 y$ N, b: k4 n! R
- #include <linux/moduleparam.h>
+ c( F8 S# B; b" n% r$ m - #include <linux/sysctl.h>" x C7 h; u7 `- z
- #include <linux/mm.h>
9 Q- X T1 F% S) E" ?+ N - #include <linux/dma-mapping.h> X5 [# `+ q" a; @
- * ]" Y4 |8 J5 j, }( r) P
- #include <mach/memory.h>; d9 h- ~( J$ i" n% @; {. l
- #include <mach/hardware.h>& @' n# c1 J; m7 o1 w. k' Y- L
- #include <mach/irqs.h>
, ?) D5 n9 P% b9 E' @* _ - #include <asm/hardware/edma.h>% l/ A* j9 e ~5 d8 S! w5 ]$ a* P
- ; p; ]/ G- Q/ k9 `, C( g' ~
- #undef EDMA3_DEBUG
, u) u; H. o# }) Y - /*#define EDMA3_DEBUG*/
1 R2 W$ ?# X9 i
/ P4 M: L! E* M+ y- #ifdef EDMA3_DEBUG' z+ B- I- y/ W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" Y* y0 _1 E% M. Z! w$ n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 C/ j( g& M& u& Z V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, e! f6 n% n2 ? - #else
2 ]/ L1 o( E# K - #define DMA_PRINTK( x... )
8 H: C6 P8 q/ d6 n3 S; z- ` - #define DMA_FN_IN
a- {# V; e/ ]6 D' A2 V - #define DMA_FN_OUT: `4 v# A S6 |0 z6 f: f8 M* W
- #endif& S! E' i6 k- p/ Q/ N
- " W0 r) @; X- b1 o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! I! T3 a. a6 c
- #define STATIC_SHIFT 30 x9 F/ s* u I" \
- #define TCINTEN_SHIFT 20' d. b5 q, K& T9 q
- #define ITCINTEN_SHIFT 210 T8 t+ ~8 Y6 H" S1 u; a% B
- #define TCCHEN_SHIFT 22' T. L* d/ l% f
- #define ITCCHEN_SHIFT 23+ p3 N: H O/ t. C$ p
' D* K, q' w& i" s2 ?6 C, f/ y- static volatile int irqraised1 = 0;9 a( `8 ^0 n; r2 G
- static volatile int irqraised2 = 0;
* [: `" \( h# j6 t7 {0 s
% I# P: k& h2 v; S2 P" M# Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 W1 F; x7 U4 t. a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- G( t& ~; }, X+ k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 r5 M8 w% c- j# i' K" P+ H
- ; J% ~& r$ t* R
- dma_addr_t dmaphyssrc1 = 0;
4 U' q2 g8 j- V# w ~# W) C - dma_addr_t dmaphyssrc2 = 0;: W+ O4 r5 g5 B O+ Y! S
- dma_addr_t dmaphysdest1 = 0;
9 s: N9 N, U! F) [ - dma_addr_t dmaphysdest2 = 0;4 J3 Q' {2 ~5 | m
9 J0 z! u: M; J, ]- h8 O- char *dmabufsrc1 = NULL;, a3 _+ c% D8 Y+ B! ^
- char *dmabufsrc2 = NULL;- \- t) |' A' I. t* F9 I8 |/ L
- char *dmabufdest1 = NULL;4 Z$ ^; ~- ^6 |( L
- char *dmabufdest2 = NULL;% L4 v- `3 [; L' ^4 Q j
- $ t+ c0 V- f, w, K* G5 C6 K0 D
- static int acnt = 512;
* A+ i; j& u$ ^0 U$ K, V% x1 R - static int bcnt = 8;
8 X3 ]* l0 I* [- \, Y* w3 | - static int ccnt = 8;
7 D3 T8 l$ w9 K% A2 m8 f
4 i) z4 U4 g2 C% K- module_param(acnt, int, S_IRUGO);: i+ l! D9 p1 S# z8 o" P8 B
- module_param(bcnt, int, S_IRUGO);# ]8 y9 u: z9 V, Y* ?4 i
- module_param(ccnt, int, S_IRUGO);
复制代码 9 |# F; c7 t+ S* A' D
$ R, n- G9 E1 _5 S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ m9 M* y" v3 n2 o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* g# Z( |: K: G9 k7 t8 b0 Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' }# _' z! J$ [: P# E+ z) w
: K( Q9 ~/ c4 Q; _
; Q# x- F+ n& k) N; r |
|