|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, w+ x! ]' m: d* U- [code]EDMA sample test application4 J7 w& O9 f2 N) X! q; s
- /*) k/ r( X! N$ Z) [9 @
- * edma_test.c
0 W: _! L/ P/ A' n$ S( i1 Z - *" e# ~8 X0 x4 N' V/ C
- * brief EDMA3 Test Application/ C3 d0 g, u+ a
- *- T: b( v: f6 m6 \ S2 r8 \
- * This file contains EDMA3 Test code.! i9 q; x, h4 P, ]+ R
- * f) r: g5 y& A+ Q1 {+ O6 E" X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! d; K9 j( x/ u0 ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; d+ |- P* R/ [ - * TO CHANGE.
- ?, L/ T' h. m - *0 s- a% Q B% @+ y6 S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 n. K1 T# K7 E; k; j0 @ - *# p# q9 `; r0 s" f2 ]
- * This program is free software; you can redistribute it and/or
u6 ]2 D0 N2 i - * modify it under the terms of the GNU General Public License as
7 _" y! v* m& W$ c9 v - * published by the Free Software Foundation version 2.
5 }7 N4 b+ N& Z4 B: \ - *" o1 C* q [2 }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
s+ Y! n- w4 k - * kind, whether express or implied; without even the implied warranty
2 q0 R f% Y3 D4 W; d# b. _9 D% C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* R! w7 T) l7 {" l4 G, K. T: q3 ] - * GNU General Public License for more details.4 r; |' S9 {* ^6 _) [
- */
3 e* Q/ n4 V" ^: S0 G
# _9 z7 X/ r1 _3 h% ?$ E- #include <linux/module.h>! |* C! C( w* A4 u! ^
- #include <linux/init.h>& S; l, c+ Z+ L. k D" o- l: L
- #include <linux/errno.h>
/ i' Y8 H. l! I4 \( F9 f - #include <linux/types.h>7 d; b1 y: z' N
- #include <linux/interrupt.h>
" ~: h& R, u S9 }/ w+ H4 g" G2 m - #include <asm/io.h>
4 o2 B% t5 w* r$ i - #include <linux/moduleparam.h>" ?$ r& i1 l* o @; O6 B
- #include <linux/sysctl.h>
- w; V; t# k& h1 Z/ z - #include <linux/mm.h>0 ~4 P+ _) \/ @' Y6 { m* b
- #include <linux/dma-mapping.h>
' {" @' r9 j: R: M1 i
4 T8 {) S6 q3 Y: C5 }7 D: h# v- #include <mach/memory.h>
2 i, Z1 j0 S) s& _* Y9 e* p - #include <mach/hardware.h>- z9 I/ N2 ^- {! R
- #include <mach/irqs.h>% A: W2 u1 B+ i% Y
- #include <asm/hardware/edma.h>( Q5 F! `6 g8 ^/ b2 D. R+ z5 U
9 O |3 p$ ]% R+ f g- #undef EDMA3_DEBUG
' t& Z' M0 B$ ]9 h. i; J* N' N" C) m2 U - /*#define EDMA3_DEBUG*/, S D X$ g* z# I
3 J2 F4 D/ I) v( p- #ifdef EDMA3_DEBUG" O V9 B* t3 a5 _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 K# {, Z' \5 q2 p4 ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* W- P' Y# O9 B- ~/ v& B# u: c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); ?. S' G3 |9 K5 f- d6 L1 V
- #else
- m, N# Z: ?9 S4 X: d t - #define DMA_PRINTK( x... )1 [ w) r# p5 k1 p' |) s: I
- #define DMA_FN_IN' z7 h, P& e1 b, ?( w3 `2 W
- #define DMA_FN_OUT
+ G: Y. V8 K/ ?+ }9 i - #endif0 A k) ]5 j) x2 }' W
- : ~ y% Q# F3 M9 w! X- s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# O. p1 A6 G, m% P I& A; E - #define STATIC_SHIFT 3
, f- R+ F$ b8 r6 [9 F2 z - #define TCINTEN_SHIFT 20# m& V* W" g! b7 Z* T
- #define ITCINTEN_SHIFT 210 `. C% p( o. T Z) s; T' L. ~
- #define TCCHEN_SHIFT 22
) O& d3 k" @# d) w1 o2 i( V7 z+ ~ - #define ITCCHEN_SHIFT 23
6 N4 \" t/ J6 k& `) J% v
% m8 u" Q! R7 G6 x( M x8 U; @- static volatile int irqraised1 = 0;
7 W- ^' G1 Y; q. ^# T - static volatile int irqraised2 = 0;
0 c$ I1 }; @; [ - 3 a- c% ~' g# T z& J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 W8 ]. P, ], k0 U5 ], a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 r7 H4 ~1 w* [& Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, W- n% K# ~& p! Q; k+ }0 ^7 j
- 0 @4 c h, E, U
- dma_addr_t dmaphyssrc1 = 0;( ]$ L0 F, v5 C7 J. \
- dma_addr_t dmaphyssrc2 = 0;
% Z8 {# D2 M: \: E# l2 G% [# B - dma_addr_t dmaphysdest1 = 0;8 |7 M/ Q$ d7 e
- dma_addr_t dmaphysdest2 = 0;$ B. t5 C& f; F, N5 O* V
* B+ ?2 s; Y) M: y7 j: T( b- char *dmabufsrc1 = NULL;
G- t& ]; E; L - char *dmabufsrc2 = NULL;
6 a8 _! {5 ?4 ?8 ~9 N8 ] - char *dmabufdest1 = NULL;& d& _, A$ S4 V5 {& h% Y+ s
- char *dmabufdest2 = NULL;
1 Z& N2 h. v: O) H& y6 L2 n' i7 x
' N$ d; Q8 \5 D- b- static int acnt = 512;) u* s7 r6 w- c
- static int bcnt = 8;
' S1 x! V! d. {8 }7 L - static int ccnt = 8;
8 J6 o' }5 i2 Y; v: _' p - % M% e7 G" h V8 L* V, Z
- module_param(acnt, int, S_IRUGO);
& d% ]" k% p' y" ^+ f$ X. ]- s" v - module_param(bcnt, int, S_IRUGO);0 [2 w# I' O; A5 U8 d& }+ F
- module_param(ccnt, int, S_IRUGO);
复制代码
- T0 r+ g, n8 d! b8 {. i
5 [+ P5 s n8 U+ l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( \: G) J5 b! s4 }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 T- p& O. J A4 K0 _4 d O: I/ ?' r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- Q3 l# A1 P9 I/ n8 p9 e# \
" ?( P, Z+ t# \
! A8 W6 H8 {( A0 S- J$ C
|
|