|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! P7 w. U$ T. C% g- [code]EDMA sample test application7 E3 j8 P& |+ c" X( d
- /*
0 m1 r. E1 g1 R8 F7 |2 Y% s' B - * edma_test.c, i4 h6 t( w5 I2 a! l+ b! a t
- *; }3 j5 X* M, _1 n1 C3 [& {& J
- * brief EDMA3 Test Application
3 ~6 a3 f. z, s6 H: ^! b. a - *
\1 S+ s- r# Y6 j9 e! P - * This file contains EDMA3 Test code.9 d3 _* ?, h% t& V( R& U; _1 `
- *
( a9 C5 `. W) w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ A7 }: b* N+ m4 a$ U% ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 t9 n/ l- |/ ` - * TO CHANGE.4 t% F0 x: t6 W2 @2 t' O
- *
' J8 f* x- Y+ q: t/ m# Q: u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% Z% M5 U# A K( o( ] - *9 b4 s0 V* s7 D7 _
- * This program is free software; you can redistribute it and/or
8 m# O; d; b1 A" d$ D. W* Z6 S - * modify it under the terms of the GNU General Public License as7 I, ]& q$ V- z6 k8 g7 O
- * published by the Free Software Foundation version 2.! _- W4 I6 J( A* H2 y1 z( m
- *
+ j- ~: @) x& N" {- L1 D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( W6 {: v7 h+ q
- * kind, whether express or implied; without even the implied warranty9 n5 x& I: _/ d8 f0 ]- W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! b6 J5 V! p7 ^! ~! M+ ?0 U - * GNU General Public License for more details.0 M2 F( `3 P0 N7 I K6 `* x5 o
- */* |/ z/ v6 e$ j" S) n% M
" F# R+ M B- l8 g+ }' T+ q- #include <linux/module.h>
/ N* E/ y: L7 [4 {% M( D - #include <linux/init.h>
% I0 u( `/ B! `7 c. J - #include <linux/errno.h>
- \# C. `) @$ j; c5 L" P - #include <linux/types.h>6 A5 G3 V' k0 }) N z: l
- #include <linux/interrupt.h>
* r) n# g! N# U5 t4 f: j4 A - #include <asm/io.h>
+ A7 D7 b2 a. L& c - #include <linux/moduleparam.h>
3 o. F: H, J2 e1 l3 I2 R - #include <linux/sysctl.h>- g" ?; e& S S4 d$ j- O
- #include <linux/mm.h>1 S* k$ w$ K+ M4 g
- #include <linux/dma-mapping.h>$ s6 r, z0 n. e' k& ^8 s- X9 x
- 0 M" [# R- Q3 R+ Z6 q9 g5 _# Y7 p
- #include <mach/memory.h>% ]/ M% n' P2 {" ]7 ~- |
- #include <mach/hardware.h>4 O6 Q8 X1 z4 p- x# L
- #include <mach/irqs.h>) U$ q) x7 U6 k( g6 d# C+ Y
- #include <asm/hardware/edma.h>2 @4 u1 g5 x2 G& f9 j
3 M1 i L+ K% q& F: g- a- #undef EDMA3_DEBUG
' ~$ e: F7 {: U9 B t! e$ ` - /*#define EDMA3_DEBUG*/
6 S" p2 r1 A+ }, X
/ r$ `# L. R3 ^" X% k- #ifdef EDMA3_DEBUG/ J' ~0 H% k1 O: R( _+ A. s: g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 \( @! h6 S& `' c$ O% f- Z- m) A9 s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! ]/ P8 {! V# u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% Y8 x2 T% [; X# s9 ~ - #else
5 ?2 t% D/ Y/ g8 h$ j - #define DMA_PRINTK( x... )
* @* K- t9 s. n8 i1 l/ f6 V - #define DMA_FN_IN$ ~& }8 m' e7 W
- #define DMA_FN_OUT, g( Y/ X# f. b! N) y, J/ d4 ]
- #endif& D5 q; ?9 Z6 b
( ? n- z" Q, o: ?! q" l" O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ { L$ _1 |, @7 b, H6 `
- #define STATIC_SHIFT 3
7 ^) y* K/ i$ V4 z& N0 K - #define TCINTEN_SHIFT 200 W$ E- O2 H/ Z8 X) y& N" H) z
- #define ITCINTEN_SHIFT 21+ u7 W3 ~; i* u$ T, @
- #define TCCHEN_SHIFT 22! Y) r. C7 P5 H+ \8 J9 H
- #define ITCCHEN_SHIFT 23
. q+ I( b; J( [! ]4 G; A3 H1 Z
5 P6 w1 l6 J7 p& o- static volatile int irqraised1 = 0;
; P9 Z3 y: m- b# ?/ G - static volatile int irqraised2 = 0;
! h r' H3 ?: k - 2 C. g. @3 x3 C$ r0 R1 }+ q/ e u, K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% Y, ?1 ]3 Z& A" L/ |4 V7 s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- V( N3 w" n* l0 f4 v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; F- P; Z# d5 j# t" E; c
, j5 T" f. ?4 n2 k! c& o- dma_addr_t dmaphyssrc1 = 0;
/ I6 `: L% N2 [; n7 c8 { - dma_addr_t dmaphyssrc2 = 0;
6 d3 B1 {% A6 t7 R2 [# m - dma_addr_t dmaphysdest1 = 0;
/ a* T. x4 R+ x3 c. C! m: G - dma_addr_t dmaphysdest2 = 0;8 j' S2 v4 S: |9 A2 ]3 d
* A2 g6 N7 e) o; V# X- K- char *dmabufsrc1 = NULL;. x+ c2 D" @$ r* s
- char *dmabufsrc2 = NULL;
# ^! ~8 T- h: G9 _ - char *dmabufdest1 = NULL;6 B* F* @' A0 W- e
- char *dmabufdest2 = NULL;- P- R/ f: c% C* n: g
- 5 G( g9 Y" T- b
- static int acnt = 512;
5 M7 ?# D) i5 g7 @. U& h+ {* S - static int bcnt = 8;+ t/ Y& z- F c5 A
- static int ccnt = 8;
/ d2 f& M. L! L* R% V+ v& z( m3 u# t! J - + ^1 P, G' a4 I' C- X! k
- module_param(acnt, int, S_IRUGO);
% d6 [; }5 h$ w- I* \# ] - module_param(bcnt, int, S_IRUGO);* U% z, V& o. |; l8 `8 L
- module_param(ccnt, int, S_IRUGO);
复制代码
% N% l4 h3 m! F2 M; e4 D
) s! \# @! q) u8 l0 b. X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ s; y7 O6 z' f _/ U( b: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 P" x Y" e8 Y- A' r& d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 q0 Y2 j. r* ^8 T+ T
8 ^; p% k7 o6 Q, h$ \# V
Q# n U/ s: M/ Q |
|