|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 [- [, p t+ y$ V8 m- [code]EDMA sample test application ?" R% X; `; b- l
- /*
! J& X) z& n3 i U+ i k& Z2 \( B - * edma_test.c
1 K. x+ t0 n/ a& S- b - *
5 s# ^5 \/ v: a7 s - * brief EDMA3 Test Application9 j0 ], d3 g5 k/ V4 ^
- *: a4 M3 U9 D; [- c; f
- * This file contains EDMA3 Test code.- m/ K+ K/ U% K! m& H+ t
- * p# b% a, O; O# c7 t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE Y+ m& H$ ~6 x$ m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- X6 r& z9 ?$ Y7 M
- * TO CHANGE.: e9 S. t2 a+ T7 c3 i
- *
% ]& D+ ^' B7 v% s7 e* F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 R/ C1 Y( j+ M6 t - *
6 b" m& L+ P9 {# g {1 n8 b - * This program is free software; you can redistribute it and/or% Y! l: l' ?# w0 ]# R3 L* }- `
- * modify it under the terms of the GNU General Public License as0 x+ j+ E$ r+ w4 e+ U. \% F6 P" L# ~
- * published by the Free Software Foundation version 2.
4 x) O" X! q& v/ k4 } - *5 Y% g3 G$ T+ E; E# X+ D5 k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# K6 F( p& V$ Q' A% Q' |/ @
- * kind, whether express or implied; without even the implied warranty' B5 H$ G- J% x' ?0 t) t: Y2 T5 A; z+ k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( a9 l- R+ X3 j& }3 _+ W! ~ - * GNU General Public License for more details.0 }% I2 Y, s" O. v) f
- */
; n& b: \. p6 i) `7 d' g: I - , ~3 d) d0 P! }6 ^
- #include <linux/module.h>
. C- u5 N! n1 Y; Q1 V - #include <linux/init.h>
5 P8 k& o; R# Y0 E' X2 v - #include <linux/errno.h>
& W$ ]7 L. F) M: E9 m& A* K& Y5 o - #include <linux/types.h>
0 D+ h0 b7 D9 _, x/ z6 V - #include <linux/interrupt.h>
0 ]0 t2 {9 S8 {! [0 Z - #include <asm/io.h>" K4 j+ P3 U) v* c2 F( B
- #include <linux/moduleparam.h>) Y2 k! ~; [1 M8 [ d
- #include <linux/sysctl.h>
$ s Z9 z, V+ M. A1 t - #include <linux/mm.h>
; r! }& s4 ~! `# _ - #include <linux/dma-mapping.h>
, {! \$ @2 K" e* l& w! S - 5 I. U8 h' E5 l
- #include <mach/memory.h>
9 Z: Q/ H+ K2 n3 z1 h% T - #include <mach/hardware.h>
+ D" d( B. y; j# W8 J2 @ - #include <mach/irqs.h>3 y, ^" T f5 G. }
- #include <asm/hardware/edma.h>
; H/ y) r& c& {6 W! I! N% a% z; r - " D0 K. Z5 x" a# _- e: k4 u# o
- #undef EDMA3_DEBUG5 @% F3 L8 J4 `
- /*#define EDMA3_DEBUG*/ u. [' O- n* g
- ; d5 _' D, E% {3 i" b+ t
- #ifdef EDMA3_DEBUG! b" U/ B0 b$ c8 M p& u H% m. L9 D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 e+ b g" A, U* Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ m& ^6 J5 _7 S0 o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); f* F' q$ U* v) A4 Q- t6 ^# c
- #else" N$ E% b1 o0 ~% }# Q# w3 }# C/ W$ _
- #define DMA_PRINTK( x... )1 l+ G9 |0 y( u2 o& I
- #define DMA_FN_IN* K0 F B0 e# K
- #define DMA_FN_OUT: o1 r T& m7 M: @, |
- #endif
o; ^: r8 m& T, Q X+ {7 x, K - / W' n+ c1 c5 Z! p# J& B# l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% o- C4 q% g# c! |7 `& B - #define STATIC_SHIFT 3
9 O! c$ I6 N" G# {1 N9 h+ n/ b! ~+ g - #define TCINTEN_SHIFT 20
& A* D f) C3 R5 q3 B4 A" q - #define ITCINTEN_SHIFT 212 Z: s' ~2 t6 F3 t
- #define TCCHEN_SHIFT 22
! U9 X$ [, I3 n8 Z* v5 @ - #define ITCCHEN_SHIFT 23+ Z8 |1 m* y e
- 2 P! e% [; ~$ q5 `+ D, P
- static volatile int irqraised1 = 0;& {( Y; @* U$ N; g0 i) I3 Z. [& M( {" m
- static volatile int irqraised2 = 0;
+ w- P4 H0 _: B; H) V! J - % O0 q/ Z4 q1 n0 d8 q% a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ o! y" q4 ? M2 G, Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ S$ w; G' n/ M+ H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Y e0 L5 ^6 d& t
- , `/ M; a/ S8 b0 @
- dma_addr_t dmaphyssrc1 = 0; Q- l- Z. R ?4 _" P6 [+ j! z
- dma_addr_t dmaphyssrc2 = 0;
, Z, n ?/ a6 {+ }/ k- g - dma_addr_t dmaphysdest1 = 0;3 g* V# I! ~ O8 r R- U1 Q$ d
- dma_addr_t dmaphysdest2 = 0;
; g# B+ h/ J) @8 y5 q" w- Z - ( O Q6 P9 d3 ~" v- o8 f, S
- char *dmabufsrc1 = NULL;! @( L: z9 |, Z7 K; U. S" `
- char *dmabufsrc2 = NULL;4 A, F) `1 O1 j5 q1 [+ L" n
- char *dmabufdest1 = NULL;' b% i. J* i! S: f$ q/ }) ~0 y
- char *dmabufdest2 = NULL;: g H! V* ~: d7 k) \
. L0 F6 r8 w* t- static int acnt = 512;
* ^' m k3 T+ ~; F: P2 B3 _' b - static int bcnt = 8;
5 L& O4 E' ?5 C* _- V u' O - static int ccnt = 8;8 c$ i/ b9 G& r4 n' F
, L" f3 K) `" y% t! G6 A# L) X' U- module_param(acnt, int, S_IRUGO);: ~. M, `. j# q- I L
- module_param(bcnt, int, S_IRUGO);% \: R% h8 d% G* x6 P
- module_param(ccnt, int, S_IRUGO);
复制代码 ' w% q& S; S% @7 o; `; ? p L
4 U0 ?) g# f- [) a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ F: }9 s6 T L/ e/ Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 Q9 ]# O# M2 i/ s/ W) E- l' P) U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! [5 U' X" v7 i2 h
: x$ \4 C/ t, E7 w$ t5 B9 T- @1 a
% w) o# a- ?- y
|
|