|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 d+ ` {; n2 @
- [code]EDMA sample test application
1 d6 m2 n. s0 y+ t/ C2 P: j - /*4 P" S& H$ {3 g4 f6 t6 S
- * edma_test.c
+ m# l" ?8 \" @* c" h - *
5 b8 I, r5 {1 K0 a$ C - * brief EDMA3 Test Application
, J. c1 A- [) z/ m6 T" C - *, k5 D5 |! ?0 D4 @6 o. j5 p
- * This file contains EDMA3 Test code.
& p0 c+ ^$ B$ w; S1 y/ q9 p - *
$ @4 a1 o8 l! n: m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* x8 j8 R, x0 b2 K& w$ u& |4 E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# h# J: d1 e" C$ e - * TO CHANGE.
, u: V T) e+ O% l4 y4 U/ I$ { - *5 y0 }/ c- @* i3 q# Z7 i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 o! _' [! `( z @ - *" |8 I U7 C% O! U: ]
- * This program is free software; you can redistribute it and/or
, E9 \3 b, }9 J' S) W - * modify it under the terms of the GNU General Public License as
+ t% B1 j$ q n( i. M - * published by the Free Software Foundation version 2.
% E$ b1 l+ g9 Y! I# }) { - *
- F5 ^- X9 L. s; O( } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 @* I$ F, b, a/ Z+ a - * kind, whether express or implied; without even the implied warranty
3 m- Z+ G% L* `2 P% V3 }; V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; p- ]! T' g4 a' Y* r - * GNU General Public License for more details.3 w, ]: O% L$ {
- */
7 I/ v: ^1 C/ I$ c" j
/ z2 V* R# I% }$ h- #include <linux/module.h>, l3 P$ e, i% q/ ?: [0 c
- #include <linux/init.h>3 g1 k8 p4 f& a
- #include <linux/errno.h>
# J1 K: [5 v' N4 C! c - #include <linux/types.h>
7 G3 B' u. Z$ i* F% V% j - #include <linux/interrupt.h>
8 F) i3 R$ p: a' R' i% b - #include <asm/io.h>( f6 ?# w8 W7 l6 v1 b" k% b3 K
- #include <linux/moduleparam.h>
" g, C" c$ O- ], d' C! u$ a- ? - #include <linux/sysctl.h>
& u3 G, s8 V7 K - #include <linux/mm.h>) R6 ]' w: V' P
- #include <linux/dma-mapping.h>
. a9 k; Q! \0 d4 Z& o
# d# r% a, P7 `; Q- #include <mach/memory.h>
' I. G1 x3 M7 s) b! z - #include <mach/hardware.h>
+ r2 d: ?" J* V - #include <mach/irqs.h>3 S9 X+ ~6 l" ? N( d" `
- #include <asm/hardware/edma.h>
2 }; M/ ^ E. H - ; J6 o2 Z# W8 J @) W7 W% d& C
- #undef EDMA3_DEBUG( ?( X" B; x f* c s$ t
- /*#define EDMA3_DEBUG*/3 R7 f9 P: R: P2 S0 v
- ) `, z8 b& k7 c! V: j2 ]
- #ifdef EDMA3_DEBUG
" I: W4 H6 _3 @- L! M; s; V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 E" [: d9 \. U0 b9 T T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 N6 D N0 S7 M! ]. j; i& n+ K0 [- }8 _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); P# v4 c" R, X3 E
- #else+ l8 M" s$ {% b* |4 O
- #define DMA_PRINTK( x... )# Q& F7 P0 T- ^1 m. w: g; s
- #define DMA_FN_IN: {5 U/ H5 z/ g% A W$ F5 E0 |
- #define DMA_FN_OUT$ w" m8 R/ U' U3 `% X
- #endif, ~6 L& U( M4 K0 _
# G$ g7 ~/ k2 \/ a. B( q+ Z ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ a1 k/ }. p1 {# A - #define STATIC_SHIFT 3
9 |% {- \1 H- P' T' w1 F! F - #define TCINTEN_SHIFT 20$ G1 F2 P9 w5 g0 t6 V$ a
- #define ITCINTEN_SHIFT 219 s4 P+ d; N. u* r5 G
- #define TCCHEN_SHIFT 22
$ k/ M% y* {5 ]& r - #define ITCCHEN_SHIFT 234 B- j) I1 r$ U% ]( k4 q
- * _8 i# J# G) s; O6 l/ m4 x1 s3 u
- static volatile int irqraised1 = 0;2 N9 J1 z+ w4 J5 L" o8 H
- static volatile int irqraised2 = 0;
% C/ Y" |. h3 z! R/ F: M7 }
. s$ h- }( J5 l; e! G: h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 k- C- O7 o$ X6 g! E( a& ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 P. b& Z. s5 [$ I3 j) y3 e) n( [! a x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 n v5 C' S- W - : K* v9 v( S7 {/ Z
- dma_addr_t dmaphyssrc1 = 0;
M6 Z3 a2 \8 E! d9 H - dma_addr_t dmaphyssrc2 = 0;
1 N( E' \9 T8 R, w# T3 a2 y - dma_addr_t dmaphysdest1 = 0;, B/ Z c# S$ h, ]
- dma_addr_t dmaphysdest2 = 0;: S0 v1 P& R( C! o
- o( {4 d3 |$ r! l- char *dmabufsrc1 = NULL;7 o7 `' N0 ]4 Y( a0 U
- char *dmabufsrc2 = NULL;. }4 ^$ M6 V$ Y
- char *dmabufdest1 = NULL;
0 M; y5 B% @1 P$ q% { - char *dmabufdest2 = NULL;
) Y. v$ d. Y5 Q7 _) o2 r4 |- Q - & M1 X) w! u5 `3 \9 g
- static int acnt = 512;& ^7 i0 n9 C3 [+ s+ s1 v
- static int bcnt = 8;
0 H; M9 i& m; M. G, g( o0 T+ d: S2 h - static int ccnt = 8;
& f+ u, _6 `* \+ i0 g% [, W
/ |( e4 u) a8 N1 q- module_param(acnt, int, S_IRUGO);
9 e7 f/ ]$ t; q1 m/ Z - module_param(bcnt, int, S_IRUGO);
b( `3 O4 m" L! e; i+ q4 t - module_param(ccnt, int, S_IRUGO);
复制代码
! K, R# j u8 f( ^. {# B* r$ ~+ X9 [4 s' c3 e: z- @7 R, w; u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: }4 B0 y( H3 rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' y0 N7 j2 l$ ~& t T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! U/ J6 c% G3 C5 G% B
" @; u# Q; c" H7 f+ ?
" h. t/ m0 v' ?* U X: Q* F- J |
|