|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : B/ f( O1 y1 _, q& T% r$ T c
- [code]EDMA sample test application' ?7 k% B% f4 W3 d" D' l
- /*
7 E- r* m. B: L: F+ H - * edma_test.c
. [4 {( V9 M: Y$ L/ I - *
; i1 W& G2 a, J4 i - * brief EDMA3 Test Application
5 p; y: c8 x d* z# e% d5 J) h7 ] - *: r% S/ Z: b( ]
- * This file contains EDMA3 Test code." W: R1 h+ {5 P! b
- *" d; t2 b* B( Y6 k3 Q0 r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE ?8 s/ F7 ?7 h! p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* X0 [- G o+ E: \
- * TO CHANGE. |) y; V1 g- \! K y4 f/ P7 V
- *$ W; A7 q, V: n" s4 K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 O. m. F. U- ?3 s* S* W2 @* h
- *
9 j8 j4 f7 \/ N) C" T9 L3 _ - * This program is free software; you can redistribute it and/or. T5 m2 O- d3 P. w! ]$ A0 \7 ?
- * modify it under the terms of the GNU General Public License as' m$ R5 k1 X8 l# w! {" w
- * published by the Free Software Foundation version 2.' c# {6 _! ^! a! H
- *
" v6 n% k5 K" u* V7 I2 e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* @% ]% o) A( t" A - * kind, whether express or implied; without even the implied warranty
' J' h# {3 a7 k# H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ u; r1 E. t1 `2 w3 m& o# S" @
- * GNU General Public License for more details.6 \% o4 }( B+ R! ~' M& C
- */( A: f1 i/ Y, }3 X8 D1 \
- 9 w7 _1 h. I8 f9 W: k
- #include <linux/module.h>
& q1 v) ~- l: b: h7 o& g - #include <linux/init.h>
- @. g- O$ K2 i( N - #include <linux/errno.h>
7 l/ E4 v+ | o% ?! U4 V - #include <linux/types.h>, L$ D8 Z# `5 P% P7 _+ T. `
- #include <linux/interrupt.h>3 x) B4 ?/ o% _% S/ S- l
- #include <asm/io.h>
4 C( [7 T/ P( Z; ]$ D1 } - #include <linux/moduleparam.h>
1 [3 Q3 d# l# k7 E+ z# M - #include <linux/sysctl.h>6 ]$ t7 v7 o' y
- #include <linux/mm.h>1 g3 f; R/ L0 W; \! i0 P4 H* }
- #include <linux/dma-mapping.h>
, x1 c+ i& f/ y. x* i4 D* O - # w/ y1 e$ j" s1 m: C
- #include <mach/memory.h>
9 R& B8 P% f; r; i - #include <mach/hardware.h>
+ F5 O+ @+ p. h }0 e6 s0 X - #include <mach/irqs.h>
7 H4 T' {- ~: y- ?5 h9 n7 |& p& F' [ - #include <asm/hardware/edma.h>
7 ?/ j; [0 H& D6 @
) H. J7 q S" P* j5 ]- #undef EDMA3_DEBUG
3 a; ]) X1 ]% y# o/ R1 K- M - /*#define EDMA3_DEBUG*/0 m X7 p, g7 {, h
- ) c' S% e) B+ l! }
- #ifdef EDMA3_DEBUG) \) q$ L6 {; K5 P8 n: ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: X) Z$ ~- Q, j# B2 `* S. O: b0 V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 _! \: j- q" _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" X B! p; `3 X4 e
- #else" c* {4 c* x/ J( y
- #define DMA_PRINTK( x... )' V6 Z: O8 \2 L9 Y9 {$ Z% \
- #define DMA_FN_IN
9 N3 Z0 v) L o( p- p - #define DMA_FN_OUT/ X; u* p4 Y8 {, Q
- #endif# w: ^* Y4 A0 u2 L$ M( g3 ]2 o _
' n4 C! ^2 E' U# S1 \. F4 R- s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: R2 S" H! e5 ~7 V - #define STATIC_SHIFT 3
/ ^' I/ M" i1 `8 ` - #define TCINTEN_SHIFT 206 @# E5 ~' R) A# k; v
- #define ITCINTEN_SHIFT 214 x; ?, P: K- X. q. p
- #define TCCHEN_SHIFT 22
1 ^! S* k( ]: v- `& Z: h$ _ - #define ITCCHEN_SHIFT 23
' {, s! V; U0 U/ Q. m2 E0 F" o8 V - \6 h- D* _% I' @
- static volatile int irqraised1 = 0;; _( x+ @/ B2 ?1 }( N
- static volatile int irqraised2 = 0;. _6 u) f A& O9 R
( A6 V0 J9 s1 H c* L* K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 J- D, o" D/ ?8 t5 l+ W) U3 P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! J4 K" o1 t2 u0 r5 V& a" {: n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) B6 r- H/ d% P# M5 y |/ a! X$ N, [' m
& g! d2 [( ~9 {. r; h: X/ W0 ~- dma_addr_t dmaphyssrc1 = 0;6 X/ m0 y& @/ x% E2 A4 M5 M. w8 T
- dma_addr_t dmaphyssrc2 = 0;' {8 a! B& J9 t4 R" [5 ~
- dma_addr_t dmaphysdest1 = 0;
, _9 e7 P& w, T- W. @ i - dma_addr_t dmaphysdest2 = 0;, l z5 A/ ]" u
- , q, S+ c2 u+ C/ T6 @7 ]" f
- char *dmabufsrc1 = NULL;
+ H8 a8 j M. i' x& ^ - char *dmabufsrc2 = NULL;, u$ a* U6 m' X8 w3 q+ W1 L7 i! ?) n
- char *dmabufdest1 = NULL;; ?: R( @; R/ J5 v7 ^2 W
- char *dmabufdest2 = NULL;
8 y) ]! V5 v- U& A8 @$ H - 9 c, s' ~( V1 q* b" j( E
- static int acnt = 512;& S+ z" |, y2 p1 G& s3 I$ ?
- static int bcnt = 8;1 [7 n. q C. P; r/ n8 U
- static int ccnt = 8;7 \- {5 ^* S, V
- ' ^ U6 I! k' A4 E
- module_param(acnt, int, S_IRUGO);) ]( `& N# s0 i3 o6 P
- module_param(bcnt, int, S_IRUGO);( P _3 f, A2 o9 U; t% y
- module_param(ccnt, int, S_IRUGO);
复制代码
# h; R3 S% ^5 M5 `; @$ {# ^- t1 l4 w* n" \4 Z. y, s1 w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: o4 M- B Q+ _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# V# y9 t& Y; c5 Y+ O8 d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. \+ r0 @% Q" D; y8 w& q" p2 ^# ]8 j5 v& q
) q0 G, O4 i4 f! x% J9 ]
|
|