|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, i& ~! _5 q9 D' N) ~$ B- [code]EDMA sample test application: g8 g$ b1 f# P
- /*
/ f" t; |. b/ D - * edma_test.c. D/ U/ T: {0 U& M
- *( z {- x- H$ f3 d2 K+ ~
- * brief EDMA3 Test Application
0 p4 F/ E4 X# \ - * v e3 A/ U) a: l" L
- * This file contains EDMA3 Test code.
0 Z2 Z( G1 S; {. f3 N0 s0 v - *
2 B5 Y* o9 h$ }1 h9 T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE `/ Q. q) i' f# t' }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 l9 M9 w& o, o- r8 j - * TO CHANGE.4 L- H7 [5 R7 f3 S z' g
- *
8 _' w: c! ^- P0 L9 E. R8 _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 A L4 l9 [: P% n( J3 _9 S - *
) Q8 l( P' d3 A - * This program is free software; you can redistribute it and/or7 b m2 v) _- j; V- P
- * modify it under the terms of the GNU General Public License as
3 i2 h. Y+ e; y1 @7 R Z. ? - * published by the Free Software Foundation version 2.3 ^6 l' v& w! V
- *
5 s/ s! b7 C7 M- q5 V9 y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& J S7 [' W( x; ^- Q) l3 L9 D( |& B
- * kind, whether express or implied; without even the implied warranty
( L5 q4 j: ^, v' I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, O7 O+ i* ~6 }# q" o( ^
- * GNU General Public License for more details.2 O; ? |$ U$ _* Z
- */( W) |! a6 g4 S2 m9 T1 d" N
- 5 K. K! u& X+ e/ x0 l5 B ^/ j
- #include <linux/module.h>9 N2 F+ ?( m4 q9 i1 T
- #include <linux/init.h>9 C6 O( I- }1 s
- #include <linux/errno.h>% t3 A6 F& V6 y- Y
- #include <linux/types.h>) z1 B6 K- _$ d2 ?
- #include <linux/interrupt.h>( V/ I0 M5 I8 _9 N- s, U
- #include <asm/io.h>
- ]9 h: i4 q& {! t: c. ?$ ] - #include <linux/moduleparam.h>; j7 W4 d* I$ T! R }2 W0 c
- #include <linux/sysctl.h>
0 C. ^' Z( K8 M - #include <linux/mm.h>% s6 M* \0 h4 P q. E+ v
- #include <linux/dma-mapping.h>% j5 h# T% M. [4 ]& O8 [
- - F3 z/ m* Y$ e5 U
- #include <mach/memory.h>4 c; ^. z0 ]9 B
- #include <mach/hardware.h>
7 n4 P2 |$ B* r7 y2 s; I% L - #include <mach/irqs.h>
6 o8 _, l) f% r8 B - #include <asm/hardware/edma.h>
1 g1 {" T/ X! D/ r; K7 D
! c" q- E1 z+ \5 }( _- #undef EDMA3_DEBUG7 m9 @/ y+ e S8 |
- /*#define EDMA3_DEBUG*/
" v- S4 T5 l6 G- ?$ g0 Y3 |# g - & o( w, u# U( @) P. D" e o0 d, u
- #ifdef EDMA3_DEBUG5 D7 m) ?, G3 U n' O- [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! J r$ E0 L& {9 u v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 D$ P& H: B; @4 o0 ?, f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- N/ W2 L Q2 L* v: i) {9 L - #else9 t4 U, q6 J8 b* M
- #define DMA_PRINTK( x... )/ y9 E, L) [$ n* ^
- #define DMA_FN_IN
: A% @8 ~( g* u4 K0 j - #define DMA_FN_OUT9 `8 t d6 q; A+ Z# n; Z0 p
- #endif: T# ?1 {6 g/ M @+ f9 \! P v
- & t! ?2 T. E1 ~: e0 m, g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% S& \4 ^" I1 C6 r
- #define STATIC_SHIFT 3
) |8 t: Q. }' M* P - #define TCINTEN_SHIFT 200 g8 |. U! d' d- U2 ~- N
- #define ITCINTEN_SHIFT 213 w, r$ B0 o6 M
- #define TCCHEN_SHIFT 22
, E4 y- v0 t) N7 g; U" C - #define ITCCHEN_SHIFT 23: N/ Q) b' l2 J2 @& F
! e! \1 p1 g" Z9 o, t" x4 D# B0 L- static volatile int irqraised1 = 0;
, v! u; j8 W$ e3 m# j/ f- M: V - static volatile int irqraised2 = 0;0 G9 N1 J" J1 Q
- , H" O; k0 E* H5 W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 G+ l! p% ]$ F/ F4 G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. u, p/ g" W' G$ A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 u/ T1 x8 [) r/ A7 H2 a
9 P6 {3 l4 Y, h9 `, k: `4 i9 ~( \3 X- dma_addr_t dmaphyssrc1 = 0;
& P9 ^* K0 `5 z# B: x2 b. \1 O - dma_addr_t dmaphyssrc2 = 0;" D5 E' ]" @7 z: s
- dma_addr_t dmaphysdest1 = 0;
7 \/ s: O- U% e, d: w* B4 Q5 y - dma_addr_t dmaphysdest2 = 0;
# h* ]5 `' l) g/ }
9 P% m% Y2 Y8 q+ ]* P- char *dmabufsrc1 = NULL;- g7 g& w6 y# _" D+ H
- char *dmabufsrc2 = NULL;' t2 b b' I# X. b( H
- char *dmabufdest1 = NULL;( E" H9 g- l9 q) S- w
- char *dmabufdest2 = NULL;
" G, W# \- w( R: S' F. W
/ n* i& y# d* j' w& R1 }1 }- static int acnt = 512;
% Q9 y- Y( {+ i2 U/ ? - static int bcnt = 8;
& r, G7 {$ ]/ a) S6 N - static int ccnt = 8;0 h* }. N H7 e- S4 _
- # v' |1 J! X' _
- module_param(acnt, int, S_IRUGO);
6 N: F$ ~9 f$ n7 n1 D$ v - module_param(bcnt, int, S_IRUGO);
. F3 z; l$ S8 n1 B q3 V) Y - module_param(ccnt, int, S_IRUGO);
复制代码 % Q" C' T/ A5 `
' y- y2 w8 S! S; W) i1 T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 o G& b4 ~$ ^: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' ?; ~+ [$ z' ~$ [- j: P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 s) A7 L! H* l" \3 Y
: U6 @3 W1 z9 y" M" f# b
& \% D `- E, z |
|