|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 z* _; H5 g3 D% ?( ^; L9 v
- [code]EDMA sample test application0 k0 ~& e+ i k' R8 G
- /*
. U- Q" ^2 @5 d; g" ~ - * edma_test.c
6 G, H- M+ `* b8 Y6 L' d# L - *) O0 K2 \& j5 w/ p3 x9 g7 l) o
- * brief EDMA3 Test Application$ L! t2 u6 q% X" }% v3 k, d3 P" |
- *
! R% I4 u. x/ L. K( Q! g0 V( j3 V - * This file contains EDMA3 Test code.
' e) p3 n6 a7 a: V5 d - ** K; z1 d/ s" y! a1 d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- ?; u" ]: \* l8 w% ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 J J# T z% s5 \2 I, }
- * TO CHANGE.
8 x/ j/ }6 |' {8 Q2 i: k - *
3 u9 A( d- J0 a2 q5 O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) R0 O; _) V9 J6 _0 o! `& B/ k& ?0 d - *8 ]$ c: _$ [8 x( j: | T1 K
- * This program is free software; you can redistribute it and/or
6 J8 R2 O+ ^8 n' z$ D - * modify it under the terms of the GNU General Public License as4 e6 L7 c; v2 S: z. n& |
- * published by the Free Software Foundation version 2.# m- k5 Q# f h, }. l7 F
- *
% t( D5 K: N6 S& V u6 V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ w) C; o- l* j; Q. [7 q; |" f3 n
- * kind, whether express or implied; without even the implied warranty
d8 L6 r; h6 \# T) q0 v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; k: k" ]0 J3 O. Q5 A* V. Z - * GNU General Public License for more details.
/ g" Z: r- Q! N! ] - */ y, n2 E4 T5 b n# F8 d
9 O, C0 [7 P: R! T Y# @4 b- #include <linux/module.h>) Z, s. w! H+ D7 J5 a2 G1 { E& r
- #include <linux/init.h>
; O! E$ x; ]5 F" X - #include <linux/errno.h>
5 W& H p% A- N) l7 e& ? - #include <linux/types.h>2 u* ?, i/ Q$ z7 r! ?
- #include <linux/interrupt.h>
! W& Z2 I1 I+ X! h - #include <asm/io.h>
. T Z ]( e# e/ v - #include <linux/moduleparam.h>
4 C# Z; `2 ]+ a' k3 f0 S - #include <linux/sysctl.h>
% J9 Q9 h2 c I: ` i% V - #include <linux/mm.h>
' ? x7 j$ {% g. V0 k! ^) ^4 }" S - #include <linux/dma-mapping.h>
7 G Z& a6 y' {& V8 U - ( I3 I) S" g2 b
- #include <mach/memory.h>) \0 c& a2 y4 c# x2 ` `) l. q9 i
- #include <mach/hardware.h>& \0 ~) `% h; K0 W* n
- #include <mach/irqs.h>4 X% C9 g2 R6 j4 b# K8 P
- #include <asm/hardware/edma.h>
8 d& [+ S7 u Z- I - ! f6 A( [! r1 H, g8 w1 T5 N
- #undef EDMA3_DEBUG
2 D7 y; {0 A6 s- h3 E- F - /*#define EDMA3_DEBUG*/
6 s/ j% U9 I# ?1 h3 m* i - - E' r6 x* n3 y1 D4 \, g
- #ifdef EDMA3_DEBUG" u$ M' [. ?( b9 \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 G8 d% q. e# O2 S/ T! C7 N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; u F+ k. J8 E6 x2 U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); V4 I, m: f, v& E! o/ e
- #else
4 L1 y. @" w( D7 l# i' W9 _# J - #define DMA_PRINTK( x... )
: s% W+ a- x% t. ` - #define DMA_FN_IN! U" h8 d: T$ \, J
- #define DMA_FN_OUT; y; `( J4 U' S& N a- D
- #endif
; Z5 z$ A% V7 {0 r6 e; o - + s U* `) y0 e, a; M: O" O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- Z( O% H5 d2 t5 t - #define STATIC_SHIFT 34 H: Y! X- W7 T: h( U: f
- #define TCINTEN_SHIFT 20
- z5 M% { T3 q8 k - #define ITCINTEN_SHIFT 21
) u4 N! r8 b: J3 R0 x9 u - #define TCCHEN_SHIFT 227 D, }* b3 r2 f3 |" X
- #define ITCCHEN_SHIFT 237 L- { ^3 e" {9 H) F4 k' j7 ~6 {
3 F1 p* ?! f q: a- t# z( G4 E( l9 [- static volatile int irqraised1 = 0;
6 \5 H) b* _. \6 A - static volatile int irqraised2 = 0;4 x3 l4 v! B6 T( i- |2 n! h5 b6 p
% Q/ l0 S3 @. @. _. T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: m! L* R* w" P7 H3 {* [5 x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' ?- Q: G. A0 O2 r% w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 B- S* }7 d0 z; Y1 U! d, ` - $ ?% B: W3 ?1 u; X
- dma_addr_t dmaphyssrc1 = 0;3 h+ |) }! c4 Z% J0 W/ N; O5 j& o! r: T
- dma_addr_t dmaphyssrc2 = 0;5 l) X$ L) b% J7 C. S8 o
- dma_addr_t dmaphysdest1 = 0;4 T) @% m* P. T. b
- dma_addr_t dmaphysdest2 = 0;7 M/ m3 K1 e6 o: Q3 T+ I/ ]
- $ g- n7 a$ |& g& |1 a
- char *dmabufsrc1 = NULL;7 C# [' l( Z( N0 o
- char *dmabufsrc2 = NULL;
5 C3 b5 u0 I2 P4 u) R* n$ N& q - char *dmabufdest1 = NULL;
/ G+ Z3 w) @% ~$ y$ v - char *dmabufdest2 = NULL;
/ U! A( f; N2 F i) X* p' [
# Z7 v& f/ B# H" ~3 B3 l- static int acnt = 512;) b, e, z% D$ h1 V: f" D* e
- static int bcnt = 8;
5 _* [; I' w6 | - static int ccnt = 8;
6 p- N$ m W7 E2 C6 r4 W" g' Q - $ d2 B! [2 L+ p9 U- X" Y& e
- module_param(acnt, int, S_IRUGO);' } ^7 r! w% M
- module_param(bcnt, int, S_IRUGO);
3 x% f/ x) ]6 \ w' Q- B" y) c4 \ - module_param(ccnt, int, S_IRUGO);
复制代码 7 ~' a1 X! e# W2 |+ G' \
% E- M& S% M2 D8 `9 B9 S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ n; G5 `. c2 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 I. _3 J3 G2 a8 V. Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" T* p9 G, F3 s) X
. T2 R- M D4 W3 ?2 ?' G2 F% W
S0 }7 T' Q: \
|
|