|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 j4 M; A1 T% B
- [code]EDMA sample test application
$ w, _! o- q% B# Q' C1 G2 r+ w( { - /*7 J& Y" T. E* |/ O# g1 R! W) n
- * edma_test.c
) O, x P, s2 \4 V7 v - *+ U2 O8 g. b! A. a B7 h* N. q
- * brief EDMA3 Test Application
! E7 @; E3 {. U5 j- I7 X - *4 i; f7 d% a8 r& T T
- * This file contains EDMA3 Test code.
# m+ I$ ~5 m9 m! S4 X X - *6 X# F/ F0 ~! L1 ^' n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 ?. ^6 p, E5 X+ ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( { i& C% {& e+ ]6 A- h - * TO CHANGE.
4 n' M8 F/ g: l, E - *, h( w' z$ y, r V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 b- z+ ~3 m! f5 P" ]5 J6 A; o - *
9 r7 ]* X. r. I3 U+ B6 |* x - * This program is free software; you can redistribute it and/or
% Z: m* f3 }, f5 W5 F/ k( G. @( a; i - * modify it under the terms of the GNU General Public License as
. ?. [( {' ^: v$ o - * published by the Free Software Foundation version 2.; D) o; g" F( x9 E+ g
- *# w; y2 E$ O _2 H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( _: _$ X/ Y! P' h1 o
- * kind, whether express or implied; without even the implied warranty
6 n8 i7 j8 @ f# ?, P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* K: `" T7 a5 n7 |/ Q& h; ? - * GNU General Public License for more details.9 q2 y1 W% N1 Q9 I
- */
3 X( H b+ J9 P9 g) w) o - 0 P& N: ^* z% Y. [( k
- #include <linux/module.h>
! e1 @" d5 ~! l. _0 ~; ?1 j - #include <linux/init.h>
2 `! {# C9 _6 W - #include <linux/errno.h>7 a6 h: A) \! ~; U' H( \2 y$ W
- #include <linux/types.h>6 | _* }7 N7 I, p T
- #include <linux/interrupt.h> o" |0 s1 W( i: o! O" S
- #include <asm/io.h>
8 y, c) [* K) K" d" b2 t - #include <linux/moduleparam.h>* W: j' _8 a- V, E# h7 D
- #include <linux/sysctl.h>
4 B h- Q# @6 n$ ^ - #include <linux/mm.h>- B/ h' @* S) X8 \. {. C3 `5 ]
- #include <linux/dma-mapping.h>$ i" j# o8 \4 f1 T
/ N* E) ~. T) Y2 T0 g- #include <mach/memory.h>& { _' z, P4 S1 w* x
- #include <mach/hardware.h>1 B- f1 V; B. S+ }
- #include <mach/irqs.h>* ^7 a; j0 z* @# `2 G3 p6 U
- #include <asm/hardware/edma.h>
) Z4 A$ a' I) p: l# m
4 T. c* f+ N! l6 }# Q/ x- #undef EDMA3_DEBUG
8 J& E% _9 ?* a* q$ {2 s& E( N - /*#define EDMA3_DEBUG*/
3 N P8 R7 `* h; N3 t+ J# o - + c) h5 F& \. S5 d
- #ifdef EDMA3_DEBUG2 ^3 W4 }2 b* T7 T4 n; f8 `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): {1 p. Q, P3 N: B+ Z( S7 E# ~+ Z" G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). o4 t5 Q2 D- J! D# U1 m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* M: t( q- Z) K) ?! e6 S, C
- #else- \% _# j+ v: g
- #define DMA_PRINTK( x... )0 U3 C; L3 M7 O4 `
- #define DMA_FN_IN# J4 H# Q- R7 `& Q4 F( J4 B e
- #define DMA_FN_OUT
) z6 |& P# I3 I- u$ B - #endif8 d3 a5 l3 e! A! a/ x
+ n& B( o; f! R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 |* G' M8 A/ D9 z - #define STATIC_SHIFT 3. [6 t. b7 K: q0 o8 C1 q4 g% h
- #define TCINTEN_SHIFT 20
) z& g! Q- r" _) n8 A- @ - #define ITCINTEN_SHIFT 21; p* [ S% i1 A7 P0 |
- #define TCCHEN_SHIFT 22
9 x w9 u' S9 v3 S0 t3 w+ f - #define ITCCHEN_SHIFT 234 B) k/ n0 N$ \8 ?6 f
- Y- o* j5 G5 y/ B( U: I" {
- static volatile int irqraised1 = 0;
6 \% \- i; a" c1 T/ x - static volatile int irqraised2 = 0;% X( j: U; r' V+ m; p
, n& E0 `) W3 B1 @6 r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ p& C* P4 z3 m9 e) C* }8 ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( f1 K/ g- _2 I0 j K, `+ m9 R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; S m8 u/ R8 h - , V# Y* q+ x% Q) q3 k" J8 o- @* `
- dma_addr_t dmaphyssrc1 = 0;. j1 e5 L }+ \" v
- dma_addr_t dmaphyssrc2 = 0;2 W' w* u+ A% {4 y. Q& P: ~! ?5 z# _' u
- dma_addr_t dmaphysdest1 = 0;0 E5 z$ B- \9 K
- dma_addr_t dmaphysdest2 = 0;
1 S- u1 ?: z1 Q7 u; k4 O: n
( H. W& A, J& F0 l- char *dmabufsrc1 = NULL;( L4 y, K+ r" M4 C
- char *dmabufsrc2 = NULL;
1 Y# s8 D; ], @3 G; d7 x7 S, M, ~ - char *dmabufdest1 = NULL;
( j7 l/ m1 v: i: K+ d3 j - char *dmabufdest2 = NULL;
! }/ E: m8 ~' ~" W: K) k
& D" m2 U, H5 E6 x+ H9 N% x# M- static int acnt = 512;% I i' N: d! |# h
- static int bcnt = 8;
5 F R2 ~% w, o, ~! j$ U - static int ccnt = 8;
* L) u$ ~8 T t8 x - % {; Q7 Q6 }: L3 u/ D, [& c* ^* c
- module_param(acnt, int, S_IRUGO);* g/ W* d4 a: A: S1 F) ?
- module_param(bcnt, int, S_IRUGO);
: ]3 r2 O$ Z" h* C# D' E" N - module_param(ccnt, int, S_IRUGO);
复制代码 $ G# V) g7 h5 ^# F$ z5 b, O
# h* E" N6 @% R) \& G1 P: g; @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# {- d# H$ Y5 I5 U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ H% Z# M! i3 ~( l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 q' q7 i0 k5 C$ A" _) i6 U% C6 L! W
k/ w9 E; y1 @% H8 c* I0 _ |
|