|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 m# z ]/ \+ R7 y- [code]EDMA sample test application
0 a+ P) t q* B( B; g }0 @6 i - /*' ]7 X- Z v0 w2 P" f4 w0 ]
- * edma_test.c o$ W7 a' K' B8 P& B# L
- *
/ ~/ ]: q* u5 j - * brief EDMA3 Test Application
7 k% I8 V& c Z1 z - *
# J6 A5 K# n9 |8 T - * This file contains EDMA3 Test code.
; N& N, P4 Q5 a# Y; Y - *
5 e$ _! Q0 d+ k/ Y$ w- j! a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( V a- K) U, x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 H2 X+ R( G- j% f' _2 O& i. m
- * TO CHANGE.2 B, D, U% c! c* w$ |, D- p
- *! k: Z* ]# `. v; R* d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* O9 }6 z' V1 b3 \3 X' Y$ f5 F - *
; A0 I) E9 \. i _* q3 r. t - * This program is free software; you can redistribute it and/or
: w. w j) }8 s: M! E* P - * modify it under the terms of the GNU General Public License as/ P; X! M5 c6 h( G
- * published by the Free Software Foundation version 2.
" C' T0 \" }5 h. }2 S, E1 x' w; V! l - *
( Q4 \! m3 I6 X+ \' @2 e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& j1 F) A0 B9 l4 M d: {4 {4 n - * kind, whether express or implied; without even the implied warranty% g( \5 j# N* Y Y2 k2 a3 i' f/ \( a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 }9 H' l0 A/ b3 o
- * GNU General Public License for more details.' V" \5 f* g# W. F8 E5 d
- */
7 O! [. S; G$ i1 t* M
5 V% d$ E" F' m- #include <linux/module.h>! Q9 m) E+ z. v5 E
- #include <linux/init.h>
3 Z$ A4 e' K# a; R6 E - #include <linux/errno.h>7 t& J& i# j u. a3 z# @
- #include <linux/types.h>- Y+ S- P2 W7 ~3 j
- #include <linux/interrupt.h>6 R W! }& [4 m" o# P
- #include <asm/io.h>5 G- r' b! [( R
- #include <linux/moduleparam.h>4 M; V$ H0 O/ L9 [ l
- #include <linux/sysctl.h>
! r$ y5 n$ l* Z/ @ - #include <linux/mm.h>
+ `; L% {& h0 ]. n2 | - #include <linux/dma-mapping.h>
@- f; S! {4 @3 R - # T1 H4 w; a. n% @& H2 [) g
- #include <mach/memory.h>
. ~5 ~. b% W# y+ p, i, D$ A - #include <mach/hardware.h> h- A9 S8 j7 y$ n* u- c' I; z
- #include <mach/irqs.h>
$ n: n6 c/ p, o" M; T( c - #include <asm/hardware/edma.h>. x1 c* _. b! x5 O7 E
: n! h& b9 E% Q2 [- _3 W- #undef EDMA3_DEBUG# a8 ^& d$ v+ O& J$ J# H
- /*#define EDMA3_DEBUG*/( d A# ^8 h( M
- ' w: v* R* R" t+ Q; V2 [
- #ifdef EDMA3_DEBUG8 x1 p7 W( l0 t3 y8 U" c; f, V: Z/ G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 ?# E. a, b( }- q5 C! g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) z' h. d% r0 Q! Q& i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 u: H% O ]( b" {3 w; b! d
- #else
0 ?; H. z5 G8 ~# D/ {% t - #define DMA_PRINTK( x... )3 H- z0 {/ f) }: ^( E5 q
- #define DMA_FN_IN
; D K( x7 ~: {5 A3 V4 ~ - #define DMA_FN_OUT% d1 U& L) a& ^
- #endif
* H* x1 g2 T2 R/ m% U - 4 k/ S/ H8 {/ Y" |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# q8 D- h; V, {6 d! P; G - #define STATIC_SHIFT 3! `1 x* S2 y6 J; c D+ {; O
- #define TCINTEN_SHIFT 20
* ]' i( u0 m; h1 v) U - #define ITCINTEN_SHIFT 211 q: j; a& G( y y
- #define TCCHEN_SHIFT 22
+ o# L C3 f2 { J" l2 X - #define ITCCHEN_SHIFT 23
t! ~) v2 s8 j; }
% x h- U( }' j+ f3 ?" s- static volatile int irqraised1 = 0;
6 c% v3 [& s) p- e# G# N/ M - static volatile int irqraised2 = 0;" o M4 [3 e& o* k7 z
- # g2 C j, {9 N' |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 o8 C1 n/ _+ L3 g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 m9 C! h. t b# l* Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% F; ~4 y0 Z1 r5 E6 j1 r
) }$ Q- m! h1 X4 _. J- dma_addr_t dmaphyssrc1 = 0;# B. `9 ?0 K; k# [. C
- dma_addr_t dmaphyssrc2 = 0;
5 Z3 a) t, b! M9 v+ m - dma_addr_t dmaphysdest1 = 0;
9 z1 X, T; M" u/ T4 p - dma_addr_t dmaphysdest2 = 0;
9 @1 ] ~" E) `2 L0 K; T' J6 V - 3 U& m' g5 X, V; C
- char *dmabufsrc1 = NULL;+ y% U( p" i7 K7 Z
- char *dmabufsrc2 = NULL;
2 T( v* w( `& W4 P: v - char *dmabufdest1 = NULL;
/ M2 D; t" f2 I - char *dmabufdest2 = NULL;
; Z" w+ _" o! k9 ] - |' c; z: @# ^- E
- static int acnt = 512;
/ r7 p/ W- x S& c - static int bcnt = 8;1 k+ F+ C* O# ^9 y, N! k% R. N
- static int ccnt = 8;
8 M/ @; R1 s* {# `& ~' W7 ~ - 0 p/ n2 B* b9 ~; B
- module_param(acnt, int, S_IRUGO);5 g" l F; v0 g; q6 p( G
- module_param(bcnt, int, S_IRUGO);6 j7 A% |' z4 N! U& k
- module_param(ccnt, int, S_IRUGO);
复制代码 % j c0 d' f( ]& n
! q" V$ L3 m5 `- o! ^+ p5 V) R0 \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" L2 U& p# G) n- n7 V y- x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# F5 e+ ~; b1 _2 n% |1 e) D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( c0 i" W, [8 }, Z0 W
/ E* `* x& Q1 T: p& U. s( H9 d$ \
3 Y8 E, u- Z1 K |
|