|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# C7 m7 x. @- P- [code]EDMA sample test application
4 i' I; J$ L3 v3 Z5 {) x B - /*
5 I9 V. j1 B2 Y: M* Y0 } - * edma_test.c; v4 d7 [+ b( R. [$ x9 C/ d6 z1 ~
- *! U) F2 _8 _% _+ @/ m
- * brief EDMA3 Test Application
. h( V0 J# |$ D$ @, u: B - *: ^. t# u4 F" x" j t; V
- * This file contains EDMA3 Test code.3 n1 w+ ~0 {& N; q& Q# Y
- *
& \1 d3 E, k+ [# F4 x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 n) B g1 ~1 ]* V, P% ]6 z( U3 }' G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: E6 F, z0 I3 y/ N" o8 X4 ~9 t
- * TO CHANGE.
V1 j- h v- a, G0 r4 t( b - *4 [: s; X% i5 @7 k8 z% W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 ?9 v' l a5 P; ^( Q- g/ P - *: A: \0 {; |, [" H
- * This program is free software; you can redistribute it and/or
2 V7 a# g7 Q! S2 D- T& t - * modify it under the terms of the GNU General Public License as
, i9 b1 y# t9 `& |5 _ - * published by the Free Software Foundation version 2.
1 i, _1 G) F( N% Q5 W: b - *) b( N5 A+ m. ^3 h. L9 W* t/ Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 U1 \/ h9 V# F( K; G! R
- * kind, whether express or implied; without even the implied warranty
# {% U) [8 d$ N8 ]& b3 C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' \9 W& S& ^! O9 f9 g - * GNU General Public License for more details.
* L1 a9 L* ^. q" g3 i - */
$ ?/ }4 g/ |7 g" v8 y9 b4 d
. K, O) d% N8 J' d: F- #include <linux/module.h>
; B: C w5 u8 v* R' W& q% P - #include <linux/init.h>
1 m U/ v: A S" \" j' b/ K" m - #include <linux/errno.h>
2 u% K, i3 U. k$ { - #include <linux/types.h>
& q3 p: ]2 Q# n6 u - #include <linux/interrupt.h>/ Q K! q" B' d" n; j9 i
- #include <asm/io.h>
. D: I$ @$ U( n2 P c! W) T - #include <linux/moduleparam.h>
6 L# R: m, F- G" e- q- x - #include <linux/sysctl.h>
; h) l1 z7 ^6 U- }: R' r( b - #include <linux/mm.h>& n$ q! k( r& ?0 h$ C* G1 P5 m) D
- #include <linux/dma-mapping.h>
! e' F @' |5 E9 u5 F& A% F
0 O4 G( q0 d& m% j1 Z- #include <mach/memory.h>
: _ ?) }; T% N1 ?4 }* B& Q - #include <mach/hardware.h>. J& q. I0 q6 H* ?+ m( r. f/ j; E
- #include <mach/irqs.h>* h; P# R0 X4 i: ^# Z; A! r6 ^. X
- #include <asm/hardware/edma.h>
. Z' R* y; b7 U; |1 E - + W Y. @7 D% D# F4 s) |
- #undef EDMA3_DEBUG' m6 e9 ~- V- p" q. w% {
- /*#define EDMA3_DEBUG*/
# f. T8 ~; u1 V) e' R, F
6 \* b8 m) b% t- #ifdef EDMA3_DEBUG
5 E9 ]6 n. ?+ h8 g/ l0 G* i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" w0 ^5 P& J4 h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 _! K, y2 t( @$ u F: w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* i+ t3 f: y4 U [. j - #else
! k9 d. e6 I G' _- n! P - #define DMA_PRINTK( x... )4 Q o; c4 ]; l B3 G/ L' h
- #define DMA_FN_IN: P. Y* G! ^ I) m" `1 J
- #define DMA_FN_OUT
0 G% D" U, S9 r3 i - #endif! }: M; g# n2 ]6 D* ?, x+ s5 i
: i" h |6 j" Q, H; l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" u# u" k# c2 Q% Z6 g0 A$ l" A/ K
- #define STATIC_SHIFT 3
8 z9 ^4 U- `- S9 `0 _& `; @ - #define TCINTEN_SHIFT 20% r- p# g4 [' b
- #define ITCINTEN_SHIFT 21
' g/ Z( S0 W6 V9 H6 O- }& p9 p( ? - #define TCCHEN_SHIFT 22
! s9 L' m8 Z& }, I1 T2 c - #define ITCCHEN_SHIFT 23
' v9 ~6 L+ f v2 X: f - ( C) q9 M: F% J, t% g
- static volatile int irqraised1 = 0;- L# O" O' Z( a+ R2 \% g& F
- static volatile int irqraised2 = 0;: ^# B4 q4 u9 W$ ^
! l) J: e' x- ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: a4 X& V r+ p8 B4 Y4 F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( a' o: y$ U, [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 P2 X. X- P$ b% o - + a# [% v$ b) Z. d3 n
- dma_addr_t dmaphyssrc1 = 0;
! E. j' A' J1 n3 J. D - dma_addr_t dmaphyssrc2 = 0;9 S0 e% i; b4 _/ |
- dma_addr_t dmaphysdest1 = 0;
" Q9 S! y5 b. R1 ?' g+ K - dma_addr_t dmaphysdest2 = 0;
. }( r* j& [' l9 z0 e
0 M% r2 \; _( [4 T( r, `- char *dmabufsrc1 = NULL;( t# e/ [, U4 v* G, i3 V# N8 u( I3 k
- char *dmabufsrc2 = NULL;0 o( t( z. N6 N1 @/ Y
- char *dmabufdest1 = NULL;5 J0 Y, M3 o( ^3 p
- char *dmabufdest2 = NULL;
5 ]' G* g/ J, m - : Z& W( v/ f/ N. @& ~. b8 s, C
- static int acnt = 512;4 e6 M* O6 B7 |% I5 K
- static int bcnt = 8;8 j# s' Y" V: d" v0 E0 f4 X' ]: {
- static int ccnt = 8;( i6 K. J( @) @( s- H v8 P
Y) d, F3 _# Y# W+ u$ [- module_param(acnt, int, S_IRUGO);2 H. u6 B2 x/ M1 b
- module_param(bcnt, int, S_IRUGO);
8 v5 Q1 p' P }) w6 Z% Z - module_param(ccnt, int, S_IRUGO);
复制代码 3 c/ `' P0 ~4 E, \3 C1 c; H! r3 V
8 O" l! V. \3 S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
J4 a* ? `8 X0 U/ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 m7 k2 A$ ]* H1 t V$ Z0 Q" q" G+ a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 p( \1 W8 t+ @' q
. X! A$ h9 h0 J
$ W: E, O/ a2 N. L |
|