|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' F) M7 l# o! o$ Z: p2 O- [code]EDMA sample test application
7 a4 I$ Y* S2 c - /*) k5 b5 _* m' G( F, _! e1 _3 }$ H
- * edma_test.c1 V4 ^8 n, z" `0 L
- *
) R- e+ E. V4 {+ T3 V- d R - * brief EDMA3 Test Application- J* G* [2 Q+ |2 d0 `6 \
- *
. W" U6 x7 H% `$ G - * This file contains EDMA3 Test code.1 Y; V& h% P. A G
- *7 _5 ]6 g3 L) u$ w8 l# L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* r- g8 R" i5 D, h: ^; t' b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! u/ u4 ^7 o% @4 l
- * TO CHANGE.
+ [, e6 T) Z6 ]" a2 v( m( R3 c - *! o& p Y0 \2 ]7 ^9 Z$ n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 l: _# Z5 \6 n - *. Q4 S: E. |, |# u
- * This program is free software; you can redistribute it and/or. a P! \2 w6 l! A* ]6 |! D5 }
- * modify it under the terms of the GNU General Public License as( H/ L: y" L6 Y3 O# B: O7 H1 X* K
- * published by the Free Software Foundation version 2.) ^$ P" |% x! @4 R, F, J, u/ l& }
- *& N( Y3 U7 l1 p" q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 i @9 ^% ^6 b8 e5 H
- * kind, whether express or implied; without even the implied warranty7 F: R- g5 y) C% g. S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) Z | Z# J0 E8 r9 y - * GNU General Public License for more details.$ T, U3 L+ Y. `- H) y' w2 }$ e
- */
: u9 D, T0 R" _' ?
3 u7 T$ P( m& o) u! ~ U! U- #include <linux/module.h>' _6 t: F! |8 u2 P8 M
- #include <linux/init.h>
: j; J3 A2 g0 A& ~1 t* }+ B - #include <linux/errno.h>7 z% u. }1 \0 O% b- V7 E8 _% u
- #include <linux/types.h>0 S* y% A4 v1 \9 k
- #include <linux/interrupt.h>& }' }3 i% Z/ g$ A
- #include <asm/io.h>
( k) C& N7 M5 q% j( h - #include <linux/moduleparam.h>
, I6 r: T' b Y6 V% s/ E$ L - #include <linux/sysctl.h> d& b) N+ b+ L' L: ^. k, K1 [
- #include <linux/mm.h>
1 [) y0 c) z. W1 B" p; m+ G - #include <linux/dma-mapping.h>6 k+ z, |# @% Q8 f: y+ W3 a
, S) x( `8 Y" X! B! h! U- #include <mach/memory.h>
* n; q% z3 A) U4 t8 P R' W9 Q - #include <mach/hardware.h>
9 v* d' n/ }$ h8 y; l$ ~& N2 \7 J' R - #include <mach/irqs.h>; o# `- K' T" x3 h
- #include <asm/hardware/edma.h>. {3 u2 w% [ ]1 `$ d
/ Q% T8 _ w0 E+ J- o- #undef EDMA3_DEBUG
1 f2 j. F" \! X; { ? - /*#define EDMA3_DEBUG*/
$ I, M4 ] Q0 C5 Z - ! b5 \6 l+ w% F9 P" M5 R3 g
- #ifdef EDMA3_DEBUG8 F3 e% E# g. |- F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% v6 L/ {5 _# C5 Z. {) a% b( J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 d; l' }& u. U; r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! W# }& R/ e) z+ T n. l3 B# e- G; v
- #else
4 s- [2 x- j/ t4 A# ] - #define DMA_PRINTK( x... )$ N2 j8 \" D U8 C" A5 W
- #define DMA_FN_IN
8 j' ^6 _( P) X3 i' F! g - #define DMA_FN_OUT
" L) a1 S- h$ {4 h O - #endif' @* F! H; x+ K, q& p
1 V! O F0 {! U" q2 K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 y. O6 _. v% j8 K - #define STATIC_SHIFT 3
/ n: v" c( P% G) G; a3 H+ J$ ~' v - #define TCINTEN_SHIFT 20
# b( `) b' s' [0 O: i* ] - #define ITCINTEN_SHIFT 21
" w0 b& d }4 l - #define TCCHEN_SHIFT 221 Y/ V" j9 [% o9 d& t
- #define ITCCHEN_SHIFT 23
8 l0 i8 A7 w1 F8 n - 1 h8 H, Q4 A0 T' r& {2 L4 ?2 N
- static volatile int irqraised1 = 0;
: l7 |$ }; Z o - static volatile int irqraised2 = 0;
; s$ e( n1 [4 R8 V' u - # w/ N* L1 c# h7 _! D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 |& r% @9 n6 z/ n# ?. C" e% C8 e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* m* X$ Q* c( a% X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 @& h1 n; |2 R: B, K9 d) T% o
. f+ S. s- w- o& z& z& q$ {+ R- dma_addr_t dmaphyssrc1 = 0;
7 D$ }' Q! |. m% R3 P - dma_addr_t dmaphyssrc2 = 0;- J# b0 l7 K/ f( @% `' w
- dma_addr_t dmaphysdest1 = 0;) M1 G4 B* [1 e2 _3 _* M& p
- dma_addr_t dmaphysdest2 = 0;
/ E( m" V0 j! z- n3 ]" Y
9 }5 X' N, M* L" E- char *dmabufsrc1 = NULL;9 W( q+ W% n2 y: s, I3 {- o7 @
- char *dmabufsrc2 = NULL;4 B& t" C3 W- t" C- j) u* _ V
- char *dmabufdest1 = NULL;
+ y- \- q3 m3 T3 `; F; c6 ^- E* C9 B - char *dmabufdest2 = NULL;; q9 {1 \4 Q1 }
* G, m4 Y* i: N- E: Q: A* B- static int acnt = 512;. y, ^3 d) r4 t
- static int bcnt = 8;2 M) @. {6 E; s3 _ h: q
- static int ccnt = 8;
; T) @: M8 M5 x2 a - ) c% @: {9 J* ^5 T" [1 V- w( U
- module_param(acnt, int, S_IRUGO);. N% g* s5 _/ C5 g$ N# {
- module_param(bcnt, int, S_IRUGO);
7 W# b/ v& U. Y' g5 |4 B0 ]- Z4 q - module_param(ccnt, int, S_IRUGO);
复制代码
" N. z y' ^3 H; _- i/ v) m. l# @+ Z6 D0 |* J- {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 U* j$ L, l' y# parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 i4 }/ B' q. ]/ M: b2 m' u, x6 s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 v6 R/ p9 c$ e0 c
5 }9 s! b, _$ {/ K0 M- \! U2 T; q$ ~8 L& P6 a7 m
|
|