|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 v! v& U8 l; k8 x# B- [code]EDMA sample test application* s" J! d" _* `. A) k6 c& X% X
- /*+ B, c' B ?8 A# y8 W* O" V
- * edma_test.c
8 l Y% [* M7 C7 |% |& h - *( h5 y) Q2 D4 j' ^% K
- * brief EDMA3 Test Application6 H) u' J1 V$ _0 O, Z. k
- *
' R9 Q. |& j& z; u1 ^, S# b - * This file contains EDMA3 Test code.6 p- Y- [% ?9 f) N/ @- D( ]
- *
3 e$ {" ~) s5 h# ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 j: s+ `, c, E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" \/ C( \- n( A' h* \! ~/ ~ - * TO CHANGE.
' r0 a, Q$ m. y2 u8 B - *& @# n. S0 c8 Z4 S3 G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 A6 Q% ^! x( v5 a6 I5 p - *
4 M* ^; u, x6 k& q - * This program is free software; you can redistribute it and/or5 H% ^+ d- b- n$ M ~5 o2 R8 ?
- * modify it under the terms of the GNU General Public License as- c' r3 @5 w" s; @; E: a7 ?
- * published by the Free Software Foundation version 2.6 f& V5 i$ ^: `4 Y+ J, E% H
- *# ?" L) [; Q" P$ O [; r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 R6 z# Z, n, L$ Y3 _ - * kind, whether express or implied; without even the implied warranty
+ P( A4 \& O4 U& S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ p4 P; i$ v/ G( ?: Y1 n
- * GNU General Public License for more details.
1 y# W7 i4 F. s1 q - */( g5 J: m- d$ m: o6 L: P! g
- * N, E% b8 T% O3 p9 k+ l! ]
- #include <linux/module.h>
; L" R3 t: R S8 w( I4 Q Y - #include <linux/init.h>
7 `6 e/ R' q- O - #include <linux/errno.h>& ~% x- v+ {0 W8 b: u6 T" l
- #include <linux/types.h>7 X( {* Q0 P1 C$ T
- #include <linux/interrupt.h>1 x; s6 q, Y3 J# H. W; a" F
- #include <asm/io.h>. }. Y. F5 f1 s7 d
- #include <linux/moduleparam.h>
M6 G' W8 H- t1 e" ? - #include <linux/sysctl.h>
: I( D% {" A8 |8 w: A7 x K" f! ^ - #include <linux/mm.h>
5 m8 g l) A0 X! \$ f& A% X, u - #include <linux/dma-mapping.h>- t# O$ X$ C, h) W
- [2 g. z+ j1 t& |" {0 I# S- #include <mach/memory.h>& X* w. \: P6 x% a' D" O. K7 B
- #include <mach/hardware.h># O5 K+ Z6 y! I. L
- #include <mach/irqs.h>
# D0 L9 \5 \/ y: g: \ - #include <asm/hardware/edma.h>6 E3 V/ l8 z& {% V
" d1 Y/ l' Q" ]' Z% Z; ]- #undef EDMA3_DEBUG
8 I- i {! \! u& ^! Y - /*#define EDMA3_DEBUG*/+ ^, J9 X/ c a: b4 x6 N4 T8 r- C
- - R2 x5 f1 d5 C- C
- #ifdef EDMA3_DEBUG! _1 \+ e4 R4 p8 r% T A) R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 I" H% [1 c+ a5 \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 x) V3 W% ~% Z. F4 X6 n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" l9 g0 G k$ N! N I g) D( D - #else" ?. }$ d( C& ~
- #define DMA_PRINTK( x... )
" i+ F+ ?9 P. H9 e- g1 ` - #define DMA_FN_IN9 S. }8 j/ V+ \/ E
- #define DMA_FN_OUT
# R3 D: Y8 f4 N9 _6 h - #endif9 G# p) n. a1 i6 Q
- 0 W$ h/ F$ S* j; p6 B# [. K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 D* [* l" c! t" f3 } - #define STATIC_SHIFT 3
( S4 G" M; ~) d% _4 |" F2 v. F1 z - #define TCINTEN_SHIFT 202 w% U# u* t' f* y& q$ Q
- #define ITCINTEN_SHIFT 215 a( R; v5 S8 R1 G' N7 g7 X- _
- #define TCCHEN_SHIFT 22& Y% d8 [* y z2 A% {0 |
- #define ITCCHEN_SHIFT 23
, N7 n% {# n: ?1 T: u9 U
: X. g1 @' r+ ?/ a- static volatile int irqraised1 = 0;+ o2 f% h8 S. P% z
- static volatile int irqraised2 = 0;
1 J* {$ Y* a+ c6 [! i: l/ e - # r" N0 Q5 g- g$ R# p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, d) i; \, H: e. B1 a3 r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( `- c3 w: B& r2 U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 l' m+ T2 D0 Q( Y# n# P. U5 G
- D) Q$ O8 w g7 f& R# t l1 g
- dma_addr_t dmaphyssrc1 = 0;' ]3 A0 f# P# `
- dma_addr_t dmaphyssrc2 = 0;
/ W8 {+ I( u! ~. A- |5 v5 i, U+ ] - dma_addr_t dmaphysdest1 = 0;
' Z+ t2 A; j3 c* E- e5 W8 Q - dma_addr_t dmaphysdest2 = 0;0 j8 k4 B0 c& e1 T5 w$ o t3 D
: m# L4 F2 H |1 ~- char *dmabufsrc1 = NULL;4 w. _* f: }' d3 m* L$ w
- char *dmabufsrc2 = NULL;
( R/ r/ d! e6 d3 g - char *dmabufdest1 = NULL;
" Z' H; I& j5 x0 k - char *dmabufdest2 = NULL;% H% R( V8 X0 r, W
9 I4 [: j3 m) `! l; Z- static int acnt = 512;
5 D/ v1 \7 _4 M- _4 w; [& {5 B - static int bcnt = 8;
; p" b% F; F/ \ - static int ccnt = 8;
& P' ~3 f2 G X
4 m$ z/ T! s3 @2 s8 t- module_param(acnt, int, S_IRUGO);
. J2 P9 u+ E4 U; r! M6 N - module_param(bcnt, int, S_IRUGO);$ K% @% g9 f& w; f7 X. a
- module_param(ccnt, int, S_IRUGO);
复制代码
3 d( m4 Y) C+ a+ A: w [( Z& S: ^) U& `: X h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- P4 {- s7 \" |1 Z- h0 N' D6 Y* ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 C) \/ w2 q8 [7 Z' Y3 y" ^7 E3 U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 H% P6 [$ u/ p; L1 m" ~# B' b
& Z1 F( j3 D% Q# p, [2 ~/ s
) {# M- U* o0 S$ U |
|