|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' }0 D0 e; m' `& b) N; s8 \3 T; c, \- [code]EDMA sample test application
5 m. c( L- Y5 |* E& n6 P0 J - /*
+ D! b) H" E% b2 ^" _1 k7 B - * edma_test.c( L. T& t; N! T% Y& B
- *- @% P) z) w* e! k# X o( G) ~
- * brief EDMA3 Test Application1 B" ], m J% G2 y5 W
- *
% v: p( B& p N - * This file contains EDMA3 Test code.% i' a& |8 j* @$ q! s7 }5 ?' U
- *
L3 J, [0 K$ B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( q4 s3 b1 a( M5 y& j0 Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ _! _4 n A: a! s6 T - * TO CHANGE., g3 K& D8 l2 R% Z% s: j0 C* V
- *
7 Z: H. c1 I- s+ t. @* a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 J& k; n$ N! v+ U5 j5 g5 y - *
/ s) w( m1 D' d - * This program is free software; you can redistribute it and/or1 q- t, q" ?% O
- * modify it under the terms of the GNU General Public License as
: S8 T4 I# R5 M) S% ? - * published by the Free Software Foundation version 2.
" ]1 I4 }2 v$ f* c# N - *( h: \: O/ y( b. U$ z0 A6 M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 e* v! Z% w1 E5 h# G ` - * kind, whether express or implied; without even the implied warranty
, h& \ T6 d$ A/ W8 X - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 M7 c' X2 d; O/ f, Z% S - * GNU General Public License for more details.
+ ^4 }: Z5 g! i" _+ w/ K' R$ g - */( |# c" `* n. C3 m- J' B# r
- $ y! [2 T+ J; j" T+ \1 V n
- #include <linux/module.h>
' |6 t* Z- |% W - #include <linux/init.h>
: h; l$ ? p' ~5 l - #include <linux/errno.h>
7 R6 R) h, y4 q+ ]9 ^% j4 N - #include <linux/types.h>
# H8 ~- m: F) ^4 V - #include <linux/interrupt.h>9 G% M# D: F7 }# U( v
- #include <asm/io.h>
' f: ] u B9 |/ _/ C9 g - #include <linux/moduleparam.h>
. C% K( L( O' U( U& {7 C& ~- s: @/ O' s - #include <linux/sysctl.h>
4 T. a4 K+ k9 g" n2 z/ L4 ^ - #include <linux/mm.h>
) |4 v M, b4 V2 {6 @* M$ R. |" X - #include <linux/dma-mapping.h>; _* n: u, A' }1 x1 [$ m0 b
! k3 D' ] Q5 ]* `: T q, T- #include <mach/memory.h>
8 U) d) A- \$ j. ~, L' s - #include <mach/hardware.h>9 V. }9 o) q" Y# _0 l3 w
- #include <mach/irqs.h> U, d: h2 b" M# t' j, m, y' ~& V* [/ Y
- #include <asm/hardware/edma.h>
8 ]$ [. f$ Y, `! R: }9 w5 h1 {6 O
0 Q( t# K. p4 X& w( J5 [- #undef EDMA3_DEBUG$ Q; F$ i6 _' d1 B7 w8 N
- /*#define EDMA3_DEBUG*/
, z7 E$ M: l3 C$ p9 T
1 e5 {9 Z4 v5 c) c) O6 w" s4 |5 |( A- #ifdef EDMA3_DEBUG' I7 M3 t/ K1 f. E* H* z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 r6 d1 Y* e! S* K, r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 }- W# P, n' F6 b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 l7 A9 s' w5 {/ Q$ A* a
- #else( C4 p5 o& w2 v! h5 c4 S; A
- #define DMA_PRINTK( x... )5 i f* L" p7 O: A, |
- #define DMA_FN_IN3 p3 @) n. E# ~
- #define DMA_FN_OUT
" A6 Q6 j* O k' B/ _, v! L - #endif. Y3 X3 B% o; i
2 w! i, ~, s1 _ z, f g, \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. Y, f& I6 M# F3 s; ]4 J5 U - #define STATIC_SHIFT 3- h8 Q4 U# A' e4 L6 H1 f7 Z# C+ Z
- #define TCINTEN_SHIFT 20% e: o0 Q& u- e, K' D
- #define ITCINTEN_SHIFT 21
" r. l; M( i6 c3 m! q) O% e - #define TCCHEN_SHIFT 22: A K3 W% {% \' E
- #define ITCCHEN_SHIFT 23
" |* P7 `+ z8 `$ K
5 v; V- Z' v+ Y2 ]- static volatile int irqraised1 = 0;( C' o# h b. Z9 t L
- static volatile int irqraised2 = 0;1 g! k1 t9 o }, M, b* j
- / E* r w( M4 ?8 p. V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 }! r% z+ T! X( ~* U& h9 R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' p, k$ t. K5 U$ B/ r$ ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 h2 z$ ^1 _6 H$ { - : E; @& \) e7 ^
- dma_addr_t dmaphyssrc1 = 0;
+ N; [6 ~( b& O$ E& e - dma_addr_t dmaphyssrc2 = 0;2 r6 b" N; R& w9 @( D
- dma_addr_t dmaphysdest1 = 0;9 d# M/ N [% m4 `/ G" Q; E3 B- _ @( m$ L
- dma_addr_t dmaphysdest2 = 0;4 H) D/ T3 ~/ C8 D2 h
# E5 D; \+ B) H- char *dmabufsrc1 = NULL; o* ^, M6 }6 P0 I. O
- char *dmabufsrc2 = NULL;
% ]2 T/ [1 l# W) Q% ~ - char *dmabufdest1 = NULL;
9 n6 ]" U1 h& P Z% J# }" q. ~ - char *dmabufdest2 = NULL;
1 g' @+ h; p1 \9 M2 g F - 9 m% ]6 Y6 B8 M6 }
- static int acnt = 512;
1 z4 g! o% U' B+ N: X% O [ l - static int bcnt = 8;/ o) [: i) t2 ]$ x; `; }
- static int ccnt = 8;
0 T1 b d4 R9 B- x, u( {7 w - 9 m# f: y1 A5 R) b+ r
- module_param(acnt, int, S_IRUGO);
" L( s2 d t' Q. Q - module_param(bcnt, int, S_IRUGO);9 e, r! f# w3 Y: {% T: B: B8 m
- module_param(ccnt, int, S_IRUGO);
复制代码
+ A& ~! O. l% S/ w" S1 Z2 g( m% ~8 i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ Q& l% Q4 D) b5 I+ b0 L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 ?% Q* ~1 O# R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ G2 n8 y. ?$ Q8 h" M Z1 s
9 Q( q c7 i2 i
& H w7 a+ Z& o5 t |
|