|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 Q" w# v& e/ y2 l! I, e6 U- [code]EDMA sample test application9 S% P$ D+ O" @% J/ m6 [
- /*
& ?/ v1 O( u" u! Q5 D) D: b - * edma_test.c
. `3 ~% }3 Y7 I ~% s - *
& `$ z4 q" O4 H' _4 o. @# b$ ~! F - * brief EDMA3 Test Application
% j; E- j6 f0 m' `3 D - *8 o; [% D/ f/ g# ]3 r y b) Q8 @
- * This file contains EDMA3 Test code./ i8 ^- t, d9 z7 W! |
- *
; R3 d, X# l6 E& ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% f5 e4 e! T- w/ @: s T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: Y1 |4 f% u, i1 E1 a - * TO CHANGE.2 }" w& Q! u# b1 t
- *
2 }. I. U0 M9 a- A D1 c/ e" L" N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 v7 N! ?- V( `' v# k
- *
9 ~$ G( x$ r% _8 w5 y - * This program is free software; you can redistribute it and/or( m4 r# D/ l o4 P1 \% l1 a$ |9 P
- * modify it under the terms of the GNU General Public License as8 z3 N4 W) D9 N7 O3 f
- * published by the Free Software Foundation version 2.
c3 K- [4 r. P9 ?/ I- ` - *
# v! Z" T! o* p* Q! N- C% v% z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* A% w5 b$ h7 v; } - * kind, whether express or implied; without even the implied warranty
5 V* g# {; d4 ?) b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~0 L- ?; g0 m. I0 i6 ` T3 V - * GNU General Public License for more details.
1 E, a. D' R& Y+ F% @/ j - */
- |7 e$ w I8 A' k) q3 Q z4 l( y
9 ^2 r" m2 t0 A/ x7 ^9 a- #include <linux/module.h>8 ~1 e* F* g" t0 F* D- |# L7 U
- #include <linux/init.h>1 S" l3 d$ H# J9 A3 u" U+ q& a) w
- #include <linux/errno.h>
4 ~9 b) y, \2 v0 ? - #include <linux/types.h>3 E7 X& b5 h6 |
- #include <linux/interrupt.h>
7 h5 p: h2 Q$ d5 M& ? - #include <asm/io.h>) @9 L! m: F, f! s- D+ R; p
- #include <linux/moduleparam.h> W* i9 n; j* v" D3 \- D% P
- #include <linux/sysctl.h>
/ {8 I" }" |4 L9 r0 L - #include <linux/mm.h>
# F- u" v k1 D! z0 T' \) ~$ T - #include <linux/dma-mapping.h>* A$ P' X3 w, [2 S) U8 W1 K
- {/ j8 s) x5 q; m! j
- #include <mach/memory.h>
! _+ l' q7 p- o, [9 V - #include <mach/hardware.h>
0 D! O+ s* n8 L* o - #include <mach/irqs.h>: \3 O; ^4 T3 y
- #include <asm/hardware/edma.h>
8 f% s# E3 q$ ^' s7 Z& J
7 L" s( O& L* N6 {- #undef EDMA3_DEBUG! [* ^$ R2 G, e" I" _2 ~" w
- /*#define EDMA3_DEBUG*/
1 w; [$ N0 C% {5 P& F6 ^ - 6 R1 l( A% m* V \+ z- b) q g
- #ifdef EDMA3_DEBUG
$ H2 m7 t3 U- T. ?2 o# @. x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ s5 q$ u5 @8 Q+ F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# F6 x3 I1 b8 D" z- N- O7 |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ L4 D3 E3 N* w# b3 X7 O$ u - #else
, ^ R, w2 }; I( u# o - #define DMA_PRINTK( x... )
, \8 k2 [* G' h& K# h: } [ - #define DMA_FN_IN
0 o! E" C: w# k - #define DMA_FN_OUT4 X3 B9 n7 K: e9 v
- #endif
; V: j. w. N. I F( B - $ S! X7 v6 M" f, _; p' V1 ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 Q& C2 a' s, I( [' |% [9 j$ O6 L
- #define STATIC_SHIFT 32 E1 i0 {* S5 }' D
- #define TCINTEN_SHIFT 20
; g3 V- j5 p. D1 q - #define ITCINTEN_SHIFT 21
* ^) k( t3 Z d% f" V6 @ - #define TCCHEN_SHIFT 22! b! x# [4 S2 V
- #define ITCCHEN_SHIFT 23
! P) _8 z3 A3 V7 s4 P/ @( ~ - 9 _5 [1 w1 f7 r" t
- static volatile int irqraised1 = 0;$ n& o! o. m ^5 y: S% G
- static volatile int irqraised2 = 0;8 p2 o" n6 M& ^- z: [* Y2 o
* s4 q0 }# h! ~) z0 G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ o2 ~# G& P$ r3 h: E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) h- ]3 x$ `$ o0 L5 L% L2 ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! T6 j, y% X+ E; u" k9 `8 z6 Z6 E
- + Z& R1 [8 w$ h1 V1 a
- dma_addr_t dmaphyssrc1 = 0;
{2 R% @% N z2 b5 S& W - dma_addr_t dmaphyssrc2 = 0;
8 i- \, h) Z: |: F# q8 ] - dma_addr_t dmaphysdest1 = 0;- ?" n. F3 O2 d5 [8 C
- dma_addr_t dmaphysdest2 = 0;9 U/ z3 _- K! @: E4 y1 Z
% L* z6 j `- k. l4 n- char *dmabufsrc1 = NULL;
' ]0 J$ z7 @. p7 G" M - char *dmabufsrc2 = NULL;4 J* Y+ H3 @5 f
- char *dmabufdest1 = NULL;% q) o. s; ~6 h) s! G1 C
- char *dmabufdest2 = NULL;, y! @7 S- J* B3 Z) Q0 Q- g: ~
- ) p. k+ E# f4 b9 u/ B+ s6 n
- static int acnt = 512;* \# m- s6 p& `
- static int bcnt = 8; K1 y! ~" h1 Y' V @( M
- static int ccnt = 8;6 f# M- c1 ~& R$ ] t& E/ Z
; Z# L; _! ?5 q/ ?& |: s. p; D- module_param(acnt, int, S_IRUGO);0 X5 M: f* y$ `& I2 S
- module_param(bcnt, int, S_IRUGO);9 h: H' |" |2 r7 L$ W' v6 }7 Z3 o
- module_param(ccnt, int, S_IRUGO);
复制代码 3 ?7 [4 o% j$ i
: h5 f, K5 Y# q, k9 r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 |2 N' a5 Y: C! ]' }: H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" |" b5 u! [' y4 t! V/ b" [. l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 j2 @! q6 E% l4 U% z- v3 F
4 b9 M$ b- s( e' {5 U
! y5 \ K$ q3 U% U0 E
|
|