|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 [9 y9 h/ c9 S* t/ v7 T& h' i- [code]EDMA sample test application
8 c! [- \ r- H! X g; [' B( j - /*
/ h/ J F% C! T1 |6 _6 }5 C - * edma_test.c% _% F* Y( k' b5 {
- *6 D# f- ], F* o! b
- * brief EDMA3 Test Application
& Z; p* p: u4 g9 ^ - ** a% `8 ^( h2 c* ?2 P
- * This file contains EDMA3 Test code.
0 y: T2 d) |6 J$ J1 R/ I1 o( ?" s - *7 G& N: o/ H' q1 a' n# E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 P; z6 _1 p: J0 l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" X" D# F9 |" _$ z
- * TO CHANGE., z. N' K6 d3 m* I( ~
- *! f8 ~/ ` H p" r# x% k4 ]9 E( A* o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% v' G g% X/ C$ a b
- *0 O* n' Y$ S+ i. r7 X `, u& n
- * This program is free software; you can redistribute it and/or+ J4 N9 G0 R, Z
- * modify it under the terms of the GNU General Public License as) [# }# ?5 v3 R8 A# l& q
- * published by the Free Software Foundation version 2./ A. T; N5 u6 @0 L& v4 p, s
- *5 A2 N3 e4 S. X1 x/ M( v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& E6 e+ e) v9 W/ y* S
- * kind, whether express or implied; without even the implied warranty: X: Y; M/ N8 c4 S0 A# t8 P5 l* m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* x& Q; z/ I- T5 x) g7 o
- * GNU General Public License for more details.4 h) W' {8 k+ o" \. ^
- */
* @* q0 G4 v2 }# w$ j* ?6 C - 4 e" U6 I9 [7 f; B
- #include <linux/module.h>
* ^8 o; K. D) }* ^ T - #include <linux/init.h>7 e5 B/ i/ c$ w7 e9 F# v: c
- #include <linux/errno.h>1 S2 [4 ^/ c. W, V
- #include <linux/types.h>
5 H8 v# [% x; K, j - #include <linux/interrupt.h>
! c$ s. U7 F- O5 j' R8 f: ]5 a' J - #include <asm/io.h>
- A" H- y1 r' P: ?6 z! B# \2 v - #include <linux/moduleparam.h>4 r& H5 S9 | p* g
- #include <linux/sysctl.h>1 b5 Y* P0 h' e" M/ J
- #include <linux/mm.h>5 {' X! @8 L5 C8 ?+ S( E' u. H. i
- #include <linux/dma-mapping.h>9 L& e9 H% Y1 L5 y. l; S
! S, A( v! }7 f# s3 L- #include <mach/memory.h>
8 m- m9 E/ {& n - #include <mach/hardware.h>& ?- Y5 Y, U: j* o
- #include <mach/irqs.h>
; Z% f. W. ~5 P' Z1 W$ D' m - #include <asm/hardware/edma.h>4 }2 T- J, c7 T3 m: ^* c
n) M* P" g( x5 \7 L/ A: S9 h- #undef EDMA3_DEBUG V/ I6 g( v8 ] F
- /*#define EDMA3_DEBUG*/
q2 h Y/ w7 U/ U* j+ N7 O, M
9 G% J3 o( a$ D, } B+ K) A- #ifdef EDMA3_DEBUG
, E8 b6 m! Y; z( C& | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 w' u6 a, W2 F- Y" l8 O9 w3 O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 D" y8 M1 |4 z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: u% }- ]/ }. d7 ~4 t7 Y - #else
8 Z: c3 j" i& \2 y9 i1 H6 `2 _" y$ E - #define DMA_PRINTK( x... )
, o7 k3 v; a( k2 O: m - #define DMA_FN_IN. m% K: t6 u% M8 C; } R- M
- #define DMA_FN_OUT
$ v8 V3 f8 N+ k: W3 |6 H! E - #endif
$ D1 m5 K1 @- j - ' K1 M- [( x0 j: l8 m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 ^3 R! |6 I; V
- #define STATIC_SHIFT 3
3 _! J/ K- E# G3 a: H - #define TCINTEN_SHIFT 207 Q) [2 y+ ~6 w& ]/ N6 [) f
- #define ITCINTEN_SHIFT 21! ~, X+ M/ Y8 T/ `9 E3 z. o
- #define TCCHEN_SHIFT 22/ H( C6 r$ ^; \. l7 ^/ w
- #define ITCCHEN_SHIFT 23) }$ o4 ]9 Y9 G7 b9 g: S8 ]7 }
* o! q1 i1 g. J* S- static volatile int irqraised1 = 0;
. l( k& F r& A- Z4 y! ^ - static volatile int irqraised2 = 0;
A+ v$ O, L6 V# @# u
; f w7 @8 O# G6 g5 C# L# G8 D" B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' q9 N8 o: X1 m1 t5 q# b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 C$ X# b! \( z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( `' f# ^" L- I! C0 d
# I" _$ k' B$ T' W/ N% i1 J2 }- dma_addr_t dmaphyssrc1 = 0;
! y- q I8 E% Z! o: ^7 H% { - dma_addr_t dmaphyssrc2 = 0;
0 i- E/ @/ l7 O9 j" \" B; V - dma_addr_t dmaphysdest1 = 0;: s( M; ?- H% c# T. }& U
- dma_addr_t dmaphysdest2 = 0;
D) F9 L" f3 f9 H3 S
& R. b9 U5 u+ Q$ i' s! m- char *dmabufsrc1 = NULL;# K+ X0 I) v" H' D* ^
- char *dmabufsrc2 = NULL;
' D/ u- e0 M/ J" k; s! \ - char *dmabufdest1 = NULL;7 Y" d f" W$ ]- p* }" x, J* A8 n
- char *dmabufdest2 = NULL;
F$ \; d7 r/ I - , m4 p% m8 K# ^, s" p
- static int acnt = 512;5 h! E$ b0 n% s- ]& F7 ? G2 ^5 B& E
- static int bcnt = 8;
! B" n. c# O8 H5 J7 A7 N - static int ccnt = 8;* _' O3 _ L9 J- b+ u5 Z5 t
- . i$ G( \' Q( m7 e7 ]
- module_param(acnt, int, S_IRUGO);& R# z" ]" @. k8 x0 O9 Q
- module_param(bcnt, int, S_IRUGO);
% Y6 M" H0 n$ z1 v - module_param(ccnt, int, S_IRUGO);
复制代码 0 t* [2 H; v7 q0 ` W0 {2 u
3 ?2 P- q) u d4 ~( {! ?! Y3 i( \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, C3 B) x( I: a4 Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 u4 a& u1 Y, O' o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. a3 k8 m3 v) u. ]" S& u9 N- n5 T) c9 ` s. J4 r$ G/ M+ t
+ ?! U2 S/ y4 O |
|