|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - B0 y7 U0 y; Y0 e& X) P
- [code]EDMA sample test application8 v0 f+ L9 u) X# z) \3 L/ i+ l
- /*" E2 n, i# V# K0 t
- * edma_test.c
! C, Y5 d3 A# J3 ?5 l- ` - * v# L, \( g$ [( A
- * brief EDMA3 Test Application
" `9 l c7 E+ J. r7 E' z' q2 H - *! m. N. h: J' L; O5 q [' M
- * This file contains EDMA3 Test code./ E" L5 ~2 s" K* i
- *
3 |. i1 s8 {" ~4 ]: K$ s% [7 l' k1 ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ G# D+ q9 @9 ]2 ]8 m. g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ F$ O: g3 @ R* u+ r - * TO CHANGE.
* J2 v0 N/ M% ] - *
% R6 R0 Q" l5 t' r" k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( ]$ Y, F- l5 \- V' m* _/ ?
- *
~7 }1 Z* n/ u - * This program is free software; you can redistribute it and/or
1 [( P- G3 T- S$ [9 a - * modify it under the terms of the GNU General Public License as
" d2 B$ ^+ x# L/ N - * published by the Free Software Foundation version 2., A D3 s, w" ^2 W* z, G
- *, X0 v! L" g# [4 }; Q9 j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 z) [$ {6 D% D4 K, n: F - * kind, whether express or implied; without even the implied warranty
) b8 m0 z/ c$ J# `. E5 Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% _3 A* u& O8 E6 O8 k8 W% ?: e - * GNU General Public License for more details.' `, z! ^3 [/ H, Z
- */
7 o# M: x) y, T' R. m, M/ m
. l- }" Q* h) s4 c" Z- #include <linux/module.h>
^/ D& h' G: A! U2 b - #include <linux/init.h>
2 j a3 ]# N- x! _1 y - #include <linux/errno.h>) @% Z5 Z) n5 I8 [
- #include <linux/types.h>
4 I( {. X' M! {) y3 o - #include <linux/interrupt.h>
% a; R+ M; g. [5 U9 O - #include <asm/io.h>
) E" z0 A7 l+ I& ]+ s+ n; ^ - #include <linux/moduleparam.h>
. d9 S! z3 {1 C- Z x( }5 u - #include <linux/sysctl.h>* j/ h% `! }- I( W+ a- D
- #include <linux/mm.h>
: e5 [5 ] i, c& D) P/ A - #include <linux/dma-mapping.h>
, R/ W; D8 l3 V' m* {2 t
6 t" o- H9 R0 S9 d" I( l- #include <mach/memory.h>) }7 q8 J5 p) s/ S/ Q! a z
- #include <mach/hardware.h>$ f4 o* o) S5 v: k! P* b# q
- #include <mach/irqs.h>$ R1 G: C7 W5 y4 X1 N
- #include <asm/hardware/edma.h>- K2 ^6 o* o/ w# l
- ' \# M( F3 O! D# o+ e* Q0 d
- #undef EDMA3_DEBUG
7 Q5 I5 l3 Z, V# a - /*#define EDMA3_DEBUG*/7 ?1 N, X7 s; ~% Z; ?/ I, }
- 1 _9 A5 I# x* I- B) E, O
- #ifdef EDMA3_DEBUG
5 T+ a5 O) p ^' W- q0 | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' T" T) S( {, }( ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, o4 j4 H1 B& h% t# e* y& } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& j' ]" [+ P0 W) n9 v - #else( q& b3 i; p. H. m3 K3 t
- #define DMA_PRINTK( x... )
# w" D$ M/ v$ ~9 ^' H' c - #define DMA_FN_IN. ~( V/ k9 X b2 J) b$ e3 v
- #define DMA_FN_OUT7 f& p6 ~' t. h, |( W+ s b
- #endif
7 S4 j8 t+ D( w$ s& l8 ]$ Q - }6 }( G0 e( m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 @0 @( H8 V! J$ l: D7 a0 i - #define STATIC_SHIFT 3) i2 I g6 q5 |' J5 C, r
- #define TCINTEN_SHIFT 206 Z3 @& ]4 v2 j9 Y6 q! J
- #define ITCINTEN_SHIFT 21
; l7 r5 H$ b, V8 e8 a# F# ` - #define TCCHEN_SHIFT 22' b) L3 X2 b; N! R' B0 ]
- #define ITCCHEN_SHIFT 23. D. \2 P4 k1 d$ D' w8 Z) v
- . @4 A9 y: E& R; v
- static volatile int irqraised1 = 0;
; U3 I& i* }" G; j/ Q - static volatile int irqraised2 = 0;7 n+ _- A) D) B8 q; U5 D3 I7 ~) b$ E
- 4 O" L* Y* n1 O; \9 N8 v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( B* y# j$ [2 W5 x. h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 W& i. X9 y5 n6 Q( E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 z, U9 [* i5 J, d1 T3 b - 5 D. Q$ q+ }/ U0 g6 [! U
- dma_addr_t dmaphyssrc1 = 0;5 R+ ]& \% \1 B' t
- dma_addr_t dmaphyssrc2 = 0;: w6 ]$ R* h1 }2 M. T
- dma_addr_t dmaphysdest1 = 0;
# r9 ]: J8 L4 C - dma_addr_t dmaphysdest2 = 0;
$ x* v* N- |) z( y4 o: j
; ^7 {7 `! n d6 G- char *dmabufsrc1 = NULL;( p" j, [, Y3 ~" C& P$ _5 E
- char *dmabufsrc2 = NULL;
. k+ m W. `* b6 O: \$ }' g - char *dmabufdest1 = NULL;
9 i1 F0 F6 u0 D( J - char *dmabufdest2 = NULL;
2 u9 y; ]9 O3 P# K9 ]4 U8 Y - % a/ {% H3 ^" B0 I6 P# @2 ^
- static int acnt = 512;0 v4 `5 ?4 [* `3 x: Q. s. I w
- static int bcnt = 8;% {8 }+ l+ S" t8 j6 U& Z
- static int ccnt = 8;
y% b8 d" ~; C! [' R7 l9 Y$ P - 6 b Y! M1 h4 E; P: K2 {1 ?
- module_param(acnt, int, S_IRUGO);# P6 w0 ^" A5 F* k. R, W- G, N
- module_param(bcnt, int, S_IRUGO); T% M, M% U ]. d/ T9 Z
- module_param(ccnt, int, S_IRUGO);
复制代码 5 j- O+ h! X3 u
, N' E6 r9 x, i; F0 Q. `/ u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 G! g* Y* g+ T7 r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ l8 ~: [8 ?4 h1 W. d. F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, Y6 a5 d3 _ w7 ?
! i. s" ?& n, d2 h) o' t- d
" ~% e, o+ E) d. u, L* c |
|