|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- n% u( I4 D* ]. t3 l4 r- [code]EDMA sample test application- b3 Y# Q+ N# S0 c. r4 b$ u% ], M
- /*
& p$ M/ v! ?# {4 N1 w - * edma_test.c5 e, r+ b' i# j7 c( ~! a
- *
' z1 U. q* \( w2 x& h# o' f - * brief EDMA3 Test Application' `- Q/ D) N% @% Y
- * \1 k/ }; P6 B5 o) E1 U
- * This file contains EDMA3 Test code.
. j8 _5 R# U8 ^( t8 b" Y - *2 \+ o$ b: \6 q' ^6 q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) e0 g6 C9 B8 A+ ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' e1 q; P) k* X3 r8 C - * TO CHANGE.
5 O2 f' G& L5 ^! Y ~ - *
6 Z' ^ m( E% w- i* j" h5 B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 C* j- W7 {3 h$ T( Z0 c& k
- *9 }9 X' I( j D# U- C, B
- * This program is free software; you can redistribute it and/or9 m. q6 Z6 r% m# u0 \) O; e, R; R
- * modify it under the terms of the GNU General Public License as
) [# w* s7 z& I$ B! A - * published by the Free Software Foundation version 2.
4 ]: U# |8 p: ]' S* k8 B2 \" b - *
( d/ G; v: G1 M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- \( U/ z5 M$ {6 t; v
- * kind, whether express or implied; without even the implied warranty. g: m) @% y" s% r# Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 H; j: @9 _& y2 }- B$ o
- * GNU General Public License for more details.
0 Q S) q" x. n) { - */; Z; q0 W3 }" Y6 P) [! H
- 6 }$ }( [4 ?( m2 }2 ^
- #include <linux/module.h>
$ e5 y: N5 m q( U( B - #include <linux/init.h>
& l/ [5 N9 n' o; ]9 B3 n B6 [1 v: g H9 A - #include <linux/errno.h>
: R6 a7 P, \8 ^: D r# f/ Q* l - #include <linux/types.h>
. F, l/ v4 C) O# N h- D7 K - #include <linux/interrupt.h>9 \' Z! ^. p# n$ d
- #include <asm/io.h>+ M7 g [/ ~5 P' m
- #include <linux/moduleparam.h>1 s2 A0 d. r! q) c X7 L8 `
- #include <linux/sysctl.h>
( R% f$ @; J9 w2 q" }- a - #include <linux/mm.h>- g m1 m# J, T8 J
- #include <linux/dma-mapping.h>
; l' l" H9 j2 G. Q9 i/ k+ s) q
/ t! b$ s8 f3 i1 E2 Y- #include <mach/memory.h>
B( W8 A* X8 f/ V& S - #include <mach/hardware.h>
`8 ^& ]' q3 f2 m - #include <mach/irqs.h>
+ v9 `, E: W: z: a5 W - #include <asm/hardware/edma.h>
3 f$ y$ Q* E3 k! C G$ d5 Z. `
& l( i' Q: E ]+ f/ ~6 [7 O- #undef EDMA3_DEBUG- t: v0 y# x$ D1 W3 d/ k+ _
- /*#define EDMA3_DEBUG*/- z) l' p, ~$ {* V
- , X3 T+ f r; M! n0 Q
- #ifdef EDMA3_DEBUG
) r/ r3 n) ~/ c9 f1 y6 K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ K& z% L; s5 t" ~3 i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* @( p# P! R% Z/ Y, B! G: K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
A& x0 G' Z1 d5 r - #else
8 h5 n9 k3 g7 i, @4 ~8 e - #define DMA_PRINTK( x... )
1 B% y2 M& S$ G5 q - #define DMA_FN_IN; j! v8 w" e8 q" I; v
- #define DMA_FN_OUT
~" f0 ~" {1 q0 P |+ Z; B0 E3 f - #endif
) t+ X2 w0 Q! d" p1 F
3 H; a' s, ?# r- m+ ]! m. |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
T- _1 `' y/ M$ `9 h - #define STATIC_SHIFT 3: p1 ^& Z3 k( S! q3 T* K
- #define TCINTEN_SHIFT 20
9 j. H; n3 O' W% H - #define ITCINTEN_SHIFT 21# `, {. ?$ J5 t1 C7 q0 Q, m
- #define TCCHEN_SHIFT 22
3 j& U$ X# L( i: Q# E( i3 E - #define ITCCHEN_SHIFT 23
) j1 I! I0 C; \+ l4 @3 p2 X
7 R6 b7 \ b+ b. m) C" }- static volatile int irqraised1 = 0;
9 i: l0 Q) `* Z& z ] - static volatile int irqraised2 = 0;
# Q6 O' d) ?! u" x
2 R3 w. | _5 J6 J, S$ [% ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# [/ u# w- W* Y2 W" n/ O2 }, @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 g" m# N% U9 C4 U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, h. E# N c. O( J" p( i6 D0 O7 R
2 x( T7 J' o- o6 G8 R4 i6 }. D& u- dma_addr_t dmaphyssrc1 = 0;
$ x$ b, L' [ d - dma_addr_t dmaphyssrc2 = 0;
. D- F" b1 e" y2 v& u4 X7 T - dma_addr_t dmaphysdest1 = 0;
( k' G4 l6 b6 }1 Q% K/ _ - dma_addr_t dmaphysdest2 = 0;3 h2 [. \/ o }+ S* D# [
4 [0 Q% S0 s3 D- char *dmabufsrc1 = NULL;
) i! f7 W2 g' Z - char *dmabufsrc2 = NULL;% k/ i5 {% B/ n* a4 b P* g, c
- char *dmabufdest1 = NULL;
% U, @$ h2 z, ^3 I - char *dmabufdest2 = NULL;9 G% g" L0 m( h* e. t7 L
- $ _/ W: y- z6 C, L" y1 y, \- t" p
- static int acnt = 512;0 i s0 J/ {( q. t- i
- static int bcnt = 8;5 o$ R' Q; K4 B- {4 D' J
- static int ccnt = 8;& @' ^4 s1 l' f! |8 q% ^6 }; {
, {) e: X0 A+ |$ X7 Q" t- v- Q- module_param(acnt, int, S_IRUGO);" Q- k- A" v* w: E' f
- module_param(bcnt, int, S_IRUGO);
7 ]/ }5 i0 n6 j; x# y- ^ - module_param(ccnt, int, S_IRUGO);
复制代码 9 f* P! o5 E0 F
4 }6 H+ I( h2 Y# e ^; D) c; O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( T6 k/ @! P8 N( K" j( h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 d$ T; ]# i* N5 Q4 p5 x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; z/ L/ i+ X0 l4 z5 k- ~. S# v; v: O
7 ~/ R+ ]2 v) n( e/ j: b0 I; p2 H
7 [5 w" H! Q3 \& T
|
|