|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% g& S3 X; W- j) ~- C- [code]EDMA sample test application4 A8 D& @% E9 s
- /*
/ ~! E0 e& p6 V# x" L - * edma_test.c- F1 r2 T" i r2 B" J! U+ g- e: Y
- * O. |; y5 K! U3 ?
- * brief EDMA3 Test Application2 D7 D+ g. M; ?0 f
- *
3 V( m" s2 Z- A s6 j3 ] - * This file contains EDMA3 Test code.
; Y* {4 M$ z* D0 }' w8 [& {5 m0 H - *+ M( X! L4 L Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( k; p8 P5 F5 ]0 s. X/ e3 C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% i, q9 z# C# o) ^) m
- * TO CHANGE.5 G# M+ h; m6 H7 p0 Y; M
- * o+ d$ e7 I0 ^/ I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 I. `! i7 s5 v1 B0 |* v" r3 z+ }7 a- E - *
k) G7 W6 s* H# a; E6 U7 | - * This program is free software; you can redistribute it and/or5 y- Z' Q1 x/ d+ h
- * modify it under the terms of the GNU General Public License as
O! |1 G0 q1 ^8 L- \( U4 V- l - * published by the Free Software Foundation version 2.
( m* P$ H5 W1 b6 q - *
- p3 `" \# u+ b( R( R& |4 l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any g: u: J6 N; L. s0 l% Q
- * kind, whether express or implied; without even the implied warranty: ^, B$ N$ ~6 R! o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) n# f C3 R8 x- E0 ^$ e* o6 U
- * GNU General Public License for more details.
9 C! W2 f! N6 E( y - */
% U( ?5 s3 N5 m W/ J" C
1 ]4 Q1 G2 H. H8 P- C- #include <linux/module.h>
4 f, x. _/ m: p - #include <linux/init.h>
+ K. V9 f3 i5 q - #include <linux/errno.h>5 o) r" X/ o# @; z4 f. K
- #include <linux/types.h>
9 g) d/ W- H+ o$ S* N' G" q - #include <linux/interrupt.h>
8 T. L" F% p$ V3 u, f; H - #include <asm/io.h>
0 e! j6 |* Z+ ?* }, d2 Q& B - #include <linux/moduleparam.h>
9 P2 b0 j& O- c3 a# @/ F. n - #include <linux/sysctl.h>3 p2 E2 r8 f4 q4 ]
- #include <linux/mm.h>% w0 [( t- N- P, \3 [. r7 w
- #include <linux/dma-mapping.h>0 x1 N/ G3 c0 O8 s O5 E
2 d; e5 g0 \$ I" {1 [ z, a5 Z- #include <mach/memory.h>2 u' Y0 I' ~% W4 _' X, Q
- #include <mach/hardware.h>- j: } Z0 k, b# ?3 r6 x
- #include <mach/irqs.h>
1 ~4 _" }( b" k% ~; O - #include <asm/hardware/edma.h>
, ^: _# ]4 Z6 s% x% X
x( ^' T5 Z2 u% B" e- #undef EDMA3_DEBUG
3 U, x Q$ f. E% A; `5 x - /*#define EDMA3_DEBUG*/7 h5 n3 I; k1 v9 r* M
- & F ^1 |# v, k- N
- #ifdef EDMA3_DEBUG5 L9 i* ^) h5 h$ Q# D) a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ [' k' o5 _' n2 o9 n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) Y$ k4 j* F3 s& H0 Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 i2 \5 z6 ]- |/ Z* o3 P& L
- #else5 Y5 H0 P' q& \
- #define DMA_PRINTK( x... )
6 W. V- X# L8 }1 p/ }9 j* ~ - #define DMA_FN_IN/ f" e/ s# }3 p; y( v
- #define DMA_FN_OUT
8 g$ O% ?9 W ~5 F1 K- `+ e/ S - #endif
" L! y; J" c A/ r4 y) ? U - 9 S# P/ ~* H' d! d/ ] J/ i; ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 S" ~# h; l+ Q- @2 }, r0 |& h3 S - #define STATIC_SHIFT 3
& k6 l; N7 f9 x" X: C9 x - #define TCINTEN_SHIFT 20: }2 ?6 {9 W! s( \9 C1 ?% F
- #define ITCINTEN_SHIFT 211 L3 Q, K' c8 o- c& c
- #define TCCHEN_SHIFT 22
/ G, U- i1 T4 | |; y0 f$ V) k - #define ITCCHEN_SHIFT 23
$ A0 u) r6 X' L7 w - : P4 p {& M/ x* { G
- static volatile int irqraised1 = 0;5 \2 O$ }. j5 B$ o8 k4 v
- static volatile int irqraised2 = 0;0 s; T: M9 u' D4 t0 [/ \
0 w) d; s9 u+ \2 w; u' `5 s9 W0 z$ K2 M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& O0 x2 t7 M& r1 c5 H3 h x5 C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% z' d' @- P! y6 X8 Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) E L. ~1 h( w+ |
8 W1 n" d2 X& {' E; f# ~" D; f- dma_addr_t dmaphyssrc1 = 0;( y2 p9 Z( y3 ?, H. n }! v. u- A
- dma_addr_t dmaphyssrc2 = 0;. G" L0 p) Z# [$ D5 c5 X% h& j% T! m
- dma_addr_t dmaphysdest1 = 0;
0 S+ t' D2 U, D8 t3 V; q6 U - dma_addr_t dmaphysdest2 = 0;/ d( O! c U% A D
+ b: q4 w9 ~4 y- char *dmabufsrc1 = NULL;
9 } H! M4 u7 ?* d* C- a - char *dmabufsrc2 = NULL;
! @4 k- r2 o" t* g4 d - char *dmabufdest1 = NULL;+ ^* a. s8 L3 `9 V: e- S* L; {
- char *dmabufdest2 = NULL;6 W) t4 f: M2 ]$ h" v
9 b8 r3 x4 C5 w! _- static int acnt = 512;" V. _9 L1 [5 N8 n! a( U; }
- static int bcnt = 8;6 k0 n4 c/ a+ N' G, y$ @
- static int ccnt = 8;
7 W) c" V1 O% }
+ {' V$ \! N/ E6 `- module_param(acnt, int, S_IRUGO);# [& {/ ?- e% S# g
- module_param(bcnt, int, S_IRUGO);1 l, k. K( D$ z& C( P$ I
- module_param(ccnt, int, S_IRUGO);
复制代码 0 G9 O7 m! d# Q& N4 S n3 Q
3 L/ l7 o/ G! M6 |' M6 W9 N# @) j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 x6 Z1 \# k5 C5 @' h+ sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 b+ X- f( x% q; o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; t, H r0 o# H
~! d8 o* l0 C
2 L* B( ~# ?- f+ |' k6 q7 N' w |
|