|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" O# _& d k& y' i$ u2 J8 n- [code]EDMA sample test application
1 D6 Q1 N# G0 v8 O - /*1 y! H: c; {. p2 d! u5 j
- * edma_test.c; a; W o7 y) L! M9 X. l
- *
6 W0 D, z u8 x7 p - * brief EDMA3 Test Application
% [" `2 ~; n2 i) T! ?, Y' u+ r - */ R, d& E& g! A
- * This file contains EDMA3 Test code.' U b* B* l3 e) j8 s7 Y7 g
- *# a; z# Z: Z: }$ Q* t" Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% A6 b* j4 [3 Q: w+ t9 N6 `3 Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 s. z3 H" h4 `2 X) M: ] - * TO CHANGE.
: g( A! a7 q8 B$ o$ }) ` - *' [) r8 I4 s- w$ `0 K6 e- T8 ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" T0 O" M- h# R; Q# U+ P* l
- *
: a5 V. @! u' } - * This program is free software; you can redistribute it and/or
0 B- v9 H# E7 h" A! ?8 V& G' D - * modify it under the terms of the GNU General Public License as
% E* @* D' c9 C. [ - * published by the Free Software Foundation version 2.
+ {4 b4 J2 ~2 Q9 X8 Z - *
+ a. A1 y) r' l& k, t# f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# F5 O5 m# q8 i3 S8 E& F6 @ - * kind, whether express or implied; without even the implied warranty" a6 h$ a5 C# f4 u0 Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 B. c# `& X/ A8 }5 D0 H! i - * GNU General Public License for more details.7 P. @3 u% r/ e$ m y
- */
6 M! \+ K5 ~, E% {) ?5 t5 N8 Q5 ?
9 J% p! t( g6 J8 h5 V- #include <linux/module.h># n( k& I( ?/ Y o
- #include <linux/init.h>
4 [: _! e0 G! B1 U& O; p+ Y - #include <linux/errno.h>
0 K5 D( n0 a% c3 d3 x/ k - #include <linux/types.h>! `7 v& O1 p* f8 n0 K6 U
- #include <linux/interrupt.h>& w+ D9 ~3 g* X) C! f9 Z
- #include <asm/io.h>
/ R9 c2 v# L" H2 A - #include <linux/moduleparam.h>
" Z; d/ s# p) G ^2 D - #include <linux/sysctl.h>9 q" {, q+ a" z( j2 u+ U& g/ R
- #include <linux/mm.h>& ^) q$ M! D! d4 [) ~* s
- #include <linux/dma-mapping.h>
9 H1 u0 c* u4 U& @ - ; N. ^6 ^5 n7 t0 I
- #include <mach/memory.h>( C; u1 i9 e9 x0 r4 I
- #include <mach/hardware.h>3 @8 a$ r6 I2 L* n: c
- #include <mach/irqs.h>
$ n$ A$ o( S i H# J" o( i$ } - #include <asm/hardware/edma.h>! y j; N7 Y6 F
- : e% C$ o! K! I) q
- #undef EDMA3_DEBUG1 B. u# [# T* i$ _. e- F
- /*#define EDMA3_DEBUG*/
/ l4 U* I2 M* [6 V
6 R! T# U- ?; f+ ~+ D; g- #ifdef EDMA3_DEBUG9 o- Z# O+ \& z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 g% S( n1 {4 m5 V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* P- a, i9 Y+ `4 z/ x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ ]5 p) Z- C. K# J3 j
- #else7 V, D7 \/ X$ e" O# |* r, ~5 q1 h
- #define DMA_PRINTK( x... )+ e+ Q4 F4 O _; Q2 |9 ]
- #define DMA_FN_IN
6 w; ^3 k' t+ [ {1 L! O& q - #define DMA_FN_OUT; Z0 c6 A- v& x t }
- #endif' N( o S: U5 ^8 l# X9 ]! |% g
- ( k! F* V1 U5 J$ `4 ~+ g, a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" z6 ~ W' c2 i1 q: Y, Y
- #define STATIC_SHIFT 31 y* ~2 E1 x3 W* t
- #define TCINTEN_SHIFT 20' x0 [$ G) D/ F% V! j
- #define ITCINTEN_SHIFT 21
# g5 |# X! t% q4 } - #define TCCHEN_SHIFT 220 U5 K T8 e, |- }2 `9 e9 f/ N9 u
- #define ITCCHEN_SHIFT 23" F7 o, l) \0 S" C+ q5 t8 \
- 1 Q5 ?! {! a8 [; @1 |( v6 R
- static volatile int irqraised1 = 0;
8 }+ S7 |% F' U, `9 q+ L8 r( t - static volatile int irqraised2 = 0;
+ g" E1 @3 n' A8 C5 K# E A
1 M, q: b i% K, n& i$ V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ]% u. U0 _2 T4 Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ i+ U; o0 E: y2 ]6 f, k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' i$ s( |; Y1 l% {- V) t
- 1 C3 g* ~8 |4 B1 W! [8 ]% M
- dma_addr_t dmaphyssrc1 = 0;
5 H+ H5 `4 L P4 ?' i) S, r - dma_addr_t dmaphyssrc2 = 0;% T7 ~3 b9 t( u6 C6 I0 ~( A
- dma_addr_t dmaphysdest1 = 0;
7 ?, y0 e. p ]3 m# L - dma_addr_t dmaphysdest2 = 0;/ k- x- ]6 J! e% z9 G5 j
1 s( ]- w2 |; C) h4 C! k# f- char *dmabufsrc1 = NULL;8 W9 ]; O0 @ k, k0 E! ^
- char *dmabufsrc2 = NULL;& y3 n' w5 \+ Z2 o) w, A' u8 f
- char *dmabufdest1 = NULL;
6 y3 w9 M) m4 C5 b2 A - char *dmabufdest2 = NULL;7 y6 L3 y! W9 L0 O5 z$ k4 W+ }
; F3 \# R/ ^. |& `: m2 M1 p- static int acnt = 512;8 W6 N) g+ q3 Q' d
- static int bcnt = 8;
, \9 x3 K( o9 Y9 e9 a+ y- J - static int ccnt = 8;
# V6 D) N6 V* ` - 7 v7 n# x# y% l+ [! f; T$ y
- module_param(acnt, int, S_IRUGO);: p+ P% m* n. I
- module_param(bcnt, int, S_IRUGO);3 W9 p% L1 g4 \1 l- p
- module_param(ccnt, int, S_IRUGO);
复制代码
0 z, @# b) K9 E. B+ `* s- V" I- w$ v H( r/ O& x( d5 j/ g8 Y( d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: V2 w& \& f, ]* R* Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ w; }/ B7 K, h5 _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 a/ n1 k# D7 ]' Y7 S
" S/ v# b! r( r6 B9 {; A0 u: T4 H/ _
|
|