|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 f' y$ J, q8 V3 w% O0 m- [code]EDMA sample test application `8 v8 R2 V$ ]
- /*4 \ p/ ?8 o @9 C/ U
- * edma_test.c
1 ?0 f2 x6 Z& q& s - *& d3 C5 B, N& c% ^7 f/ J$ m; v5 V9 E
- * brief EDMA3 Test Application" ]- c" I$ D g' k& g6 [
- *
# d7 {) f p. \ - * This file contains EDMA3 Test code.
4 P- u T- T6 O8 g& ~4 F `( p5 d5 a - *4 v9 c, C" W1 T4 N8 @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ z6 \2 u p) A* D T1 E$ ]1 h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ q" a4 a' s! }- T$ F - * TO CHANGE.! ]) L! c# t- n
- *. R. @ X6 n3 ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 z6 h: ~5 f# ]2 Y0 M6 Q. {
- *# l, ~" o7 _# p6 i8 b, ]4 t4 B8 r
- * This program is free software; you can redistribute it and/or6 G' b9 @2 m2 ^7 P% ?$ L
- * modify it under the terms of the GNU General Public License as
& T( d- t$ i1 C1 l/ N7 x - * published by the Free Software Foundation version 2.& c. o( m o+ N) D Y; l
- *4 C* c3 [8 S5 t# i/ m& S2 k. f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: z" W+ ?9 m. u
- * kind, whether express or implied; without even the implied warranty9 \! t) Q, C5 a8 E0 z) D* n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 y7 U6 I& E# p q+ Z. n - * GNU General Public License for more details.
. U8 b9 }9 m3 ?8 G8 o - */' g$ J4 {2 Y. K- n- S7 z
- ( t) i; S l( d, v" [% Z( y8 M8 V c# J. j
- #include <linux/module.h>% }0 s6 h5 G$ J1 Y
- #include <linux/init.h>
' o* t7 _( b* Z - #include <linux/errno.h>; T, O: P- W, T) \( a
- #include <linux/types.h>
+ ?% \1 d ~4 j- C' M) f - #include <linux/interrupt.h> @% s# v2 l6 ~7 m- k2 n
- #include <asm/io.h>
: a$ B% k5 |$ k2 l+ J8 | - #include <linux/moduleparam.h># Y2 |. b! i6 K5 q" L3 j* n
- #include <linux/sysctl.h>3 |; x5 k( X9 e& C+ p% @
- #include <linux/mm.h>
" P5 T; v# F; p* C7 Z - #include <linux/dma-mapping.h>3 Y, M+ G- u9 H, z
! Y u+ ?% G$ j* m' ^- #include <mach/memory.h>" T% W. R4 L" b# Q$ i1 H& z
- #include <mach/hardware.h>+ ~+ w4 |& x9 [2 O5 M
- #include <mach/irqs.h>5 I% v6 H$ m+ {9 B: ~
- #include <asm/hardware/edma.h>2 R& T% I9 k7 ]" K
; a' h/ v1 v2 e# Z- |% W- #undef EDMA3_DEBUG, N) T9 Z! W. Q$ {7 [4 c, [" t& C
- /*#define EDMA3_DEBUG*/- p$ c' h) x% B
- $ n& P- n, b6 E# ?) Y
- #ifdef EDMA3_DEBUG
' N% G% y1 H1 N" n# I% J6 _6 _: z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 E) @5 I( ~, C. w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ P: t+ B- v- l; O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% c% `% b$ }2 J7 L
- #else5 q$ f6 [) W1 m$ U( T9 s
- #define DMA_PRINTK( x... )
" |4 m$ _* g8 J* ?: w$ e4 c - #define DMA_FN_IN
/ P% X; h& j3 C - #define DMA_FN_OUT5 |* w" A# D8 {9 X- @" @ s
- #endif
K9 v" O \5 |+ ]
' o) E/ g, G4 x1 P! r$ j* S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( ^, a8 [2 F9 v. s5 \ - #define STATIC_SHIFT 3
9 M9 c8 @0 h1 e6 c" K }1 | - #define TCINTEN_SHIFT 20
+ Z/ Z' C4 {: R1 Y' ? - #define ITCINTEN_SHIFT 21$ o+ j. i5 f7 W
- #define TCCHEN_SHIFT 22
+ Y0 c' ~1 z7 e1 l4 M) }0 g - #define ITCCHEN_SHIFT 23
; y2 }, i, P; o0 _- ~& | - + I# r Q* C1 k# T9 ^& J: v: H: Q' q
- static volatile int irqraised1 = 0;- X# S6 Z' T$ f/ I
- static volatile int irqraised2 = 0;3 E7 f( f5 x1 l# |0 I
4 L% S$ S/ g: W% L8 _, [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! V6 m7 `9 l' b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 u* u1 G. g! j8 B% }# f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
K$ O/ K( c1 b8 V' ?0 V - . J( c" n! ?+ @: N' W$ Z
- dma_addr_t dmaphyssrc1 = 0;
! O* w; P. s% ?' ~9 W; J - dma_addr_t dmaphyssrc2 = 0;4 ^% O7 d. g, j6 m% B, Y
- dma_addr_t dmaphysdest1 = 0;4 d. J+ z4 ^8 j# {5 B- y. `
- dma_addr_t dmaphysdest2 = 0;
8 s+ ^0 ~" G6 b9 [' g7 e# [
1 K/ }+ p6 M- ~- char *dmabufsrc1 = NULL;
1 i! q" L+ O6 _ - char *dmabufsrc2 = NULL;8 h) B! d$ ?: s% U
- char *dmabufdest1 = NULL;
' r: l) @2 C. M2 M" d; \ - char *dmabufdest2 = NULL;0 L7 |8 [1 t6 N1 D4 Z2 B
- 6 l+ w- w, T& i$ r1 f0 q
- static int acnt = 512;
! X& \5 {* a2 X$ m - static int bcnt = 8;3 c6 _" ?- U4 H4 c1 |3 F' R9 ^
- static int ccnt = 8;+ Y" S2 _, |8 s0 W6 |1 }9 T; z
- ) s4 u+ H$ S$ y [# d
- module_param(acnt, int, S_IRUGO);# C& h2 N3 t7 {$ _
- module_param(bcnt, int, S_IRUGO);
' d; s5 G* O8 k - module_param(ccnt, int, S_IRUGO);
复制代码
5 p; R% v9 F! h+ j8 X1 I
+ P* s2 K4 |- y- n; Z- U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! j) [6 D1 d) c) e' C) Q0 n) \# Y! j0 H2 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 Q) O/ Z* {& x/ ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 T- b' }% K$ k$ Q& P# Z
/ {( H( v2 U8 L1 ]3 g7 h. ?" s1 t) j( x$ m, `& n2 e% c
|
|