|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 h, J N, H, ~5 p4 Q) T: C- [code]EDMA sample test application+ ]% U" N& u7 ~1 [* W" ^: ~
- /*
1 n' I0 Y' i# a* D6 m, g4 C3 g - * edma_test.c) M2 I$ P1 V @2 P
- *
. W* y7 T8 w4 C/ s+ F' V1 W3 y I - * brief EDMA3 Test Application
. ^6 x) \+ u" ], O7 K+ T) V - *
" {- ?# `% C: n/ s7 O - * This file contains EDMA3 Test code.
( ?6 ]% [7 L$ f' x - *8 N8 q3 A! U! L& H0 W* I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) ?: L2 l% ]+ o; l6 |2 l' E7 a6 A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- V# j) }9 ~( ^' v3 { - * TO CHANGE.' D, W# @1 @- e* w$ l6 s
- *
" R( K0 s6 _! u) c" L9 @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# r) o' q# X; _* V1 J/ t$ ~' ?& P - *
/ R( a6 q2 ^6 w - * This program is free software; you can redistribute it and/or
r. W. r$ T/ C. \- z - * modify it under the terms of the GNU General Public License as
1 X7 F5 i: K3 Y - * published by the Free Software Foundation version 2.
: v% e; D4 M/ f) g# Q9 f) [ - *' {$ L& k7 Y8 c% Y# W; y. e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" O7 F1 s" R# ?# X f# w/ h
- * kind, whether express or implied; without even the implied warranty* D% R7 @4 @$ N: v) E9 _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& e& C3 U) w! a7 j - * GNU General Public License for more details.
+ l) h- a3 K$ i* v) o1 `3 C - */& w7 U7 o7 }1 z# i8 {" e. g: ]
- 9 k9 [) t9 O5 f$ ?
- #include <linux/module.h>( O# D2 \" T5 \; r F+ A2 S
- #include <linux/init.h>, ?2 d) d6 {; V# w6 H
- #include <linux/errno.h>3 ?& v& S5 q# f
- #include <linux/types.h>, K" j! y2 L; C" `& e7 ]* Q
- #include <linux/interrupt.h>
- |! [& `4 y# l' h: `4 a - #include <asm/io.h>$ x+ P7 R6 ~* a3 y3 p
- #include <linux/moduleparam.h>
& M0 U( l9 K8 W3 }# C - #include <linux/sysctl.h>1 [6 d# | G4 A0 K
- #include <linux/mm.h>$ T# i* D9 w8 f3 w1 d# ~) L3 K2 O1 q
- #include <linux/dma-mapping.h>
& P5 o& z( I. b6 j9 v& o2 W - 6 L5 t# D' t. s1 E3 w- T- `) @
- #include <mach/memory.h>/ N% s* C {8 R: z4 _+ [
- #include <mach/hardware.h>5 N7 i) U8 \# G) r$ X
- #include <mach/irqs.h>
* b9 M4 E3 N% {" D - #include <asm/hardware/edma.h>
: x' T/ m* }0 l - 2 G( _+ C5 Q- U% |" i
- #undef EDMA3_DEBUG
, Y$ G5 H* Q! _1 V a/ n9 _ - /*#define EDMA3_DEBUG*/
( D' ]4 F3 R$ r - ( K) V+ J0 p7 v+ P5 Y' Y' e& x
- #ifdef EDMA3_DEBUG2 v. u0 h& |, R5 Z$ ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# e' i' ~; U* G+ w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 S" N+ t, `6 x( U5 e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. d* @3 j9 o3 s2 } - #else( Y( }" I2 M; u
- #define DMA_PRINTK( x... )1 ]2 z# S5 V1 S8 P2 g* l
- #define DMA_FN_IN
8 h$ E: C, s) t8 i! i, {2 [9 n - #define DMA_FN_OUT
6 i/ J3 E) Y' N. t2 Y% T7 g - #endif
. _7 m5 w) A, ^/ ~7 H: H$ g# {2 O
" Q! i+ D8 [* c9 b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, q' o. ~4 \! c3 k$ i f# \4 Y - #define STATIC_SHIFT 3
0 e1 I& y1 Z+ \- E5 _* H) u& k - #define TCINTEN_SHIFT 20
/ u8 `) t2 B6 U - #define ITCINTEN_SHIFT 21
1 W* O/ J6 n* ?' n2 z# b - #define TCCHEN_SHIFT 22
5 @$ b; k- Z6 R) R0 {+ S - #define ITCCHEN_SHIFT 23
3 u; _$ K* m& e; B/ ]6 v$ b - 2 k7 o- ~5 S0 J0 {' _. T% V
- static volatile int irqraised1 = 0;
$ o+ m8 _/ }: \ - static volatile int irqraised2 = 0;3 K: ]9 H8 E/ k2 m. G
0 M, c3 g, W: L! f! q( l1 F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' _# M5 F( J6 h9 j) i/ p3 S3 J8 ^4 [, k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, c/ P0 B; M7 X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ I& ~ y. [5 x: i
3 Y0 S6 B4 Q" L# O" D) o- dma_addr_t dmaphyssrc1 = 0;+ ?6 n. S: E8 ?! u" Y
- dma_addr_t dmaphyssrc2 = 0;
, `' k( o# x. Y& c, f) C - dma_addr_t dmaphysdest1 = 0;( X* W# O0 k8 P4 j+ A* O
- dma_addr_t dmaphysdest2 = 0;/ j+ v4 j4 w, E: `- {5 q
- + C! v! O. `# l1 k& |/ `) h% H
- char *dmabufsrc1 = NULL;1 N3 m" O8 F/ q) D9 ^
- char *dmabufsrc2 = NULL;2 `, d& b4 K3 v- O. K, O6 L
- char *dmabufdest1 = NULL;
1 R4 k. p9 ?5 [. a - char *dmabufdest2 = NULL;
3 B/ Y4 W- m7 w) O$ Y$ K6 { - % r% O4 s% `: B8 l
- static int acnt = 512;. N# s" J2 H& H/ ^6 o) T& I' _ T
- static int bcnt = 8;
' `% R- `# Y2 W# [, |: N- y3 X - static int ccnt = 8;
2 |+ N( b. M6 m: q6 S; I0 Y2 ?
% I# t* @' t4 @+ d2 h/ R: U/ S- module_param(acnt, int, S_IRUGO);
+ a) X3 ? h& E' X: u! ?) m - module_param(bcnt, int, S_IRUGO);
- O( x: X' D. o- O |( A0 o - module_param(ccnt, int, S_IRUGO);
复制代码 ; ]0 b* Z7 E3 o
6 B' [" }1 R0 Z/ ]2 _- B" X) N7 \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 g4 ?# B2 i( s% K9 Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ w5 v8 \9 I+ ^" }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" a! a- R3 R% k" B
: R% ~! K; w+ S" Z: W& X6 U' G$ o& S
|
|