|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 S) |1 e; h: f# M) m9 Y4 M- [code]EDMA sample test application
6 f7 q& @# U( M( `2 h - /*
$ x0 [1 t/ [8 ^" H - * edma_test.c
: X/ H6 l5 a; f: y - *; e }9 x; w$ ?$ m' g4 b
- * brief EDMA3 Test Application
5 H/ f; r- v' H5 W - *0 o* ]4 y- I. P6 s0 U7 b
- * This file contains EDMA3 Test code.- w% b7 A2 S9 X
- *
# Z8 X2 l, P( }! t b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: R2 i' n0 k' ~9 C* b, T" q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" k; a) K0 y4 S; Y - * TO CHANGE.
, o9 K3 w6 }* O; U! l8 r - *
l" V( b. m/ [! Q, }8 C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 i: \8 b" i; w5 i3 \. I2 t
- *
0 k( K; m9 K9 m% V/ n. S - * This program is free software; you can redistribute it and/or# x6 v% f+ q& K. ~
- * modify it under the terms of the GNU General Public License as
1 m" O2 y! Z: }+ Z$ H* @5 b - * published by the Free Software Foundation version 2.9 l$ k. t" a$ a: B4 k
- *
) [* j0 k" g; ^; m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 u& T& \( b% l7 K% g/ B7 p, p- D - * kind, whether express or implied; without even the implied warranty! q- f, z2 k9 Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# A1 c, F3 \ ~7 a. A: w
- * GNU General Public License for more details.
5 }- N5 N* D6 g* e - */
. }2 b/ V- _( n3 ^' f - D' c- E. G0 O4 B8 t1 m; M
- #include <linux/module.h>
% W: |( C3 n. u - #include <linux/init.h># Q2 w8 w8 N; g9 [9 c$ k
- #include <linux/errno.h>
6 k7 E4 E2 j# q9 R - #include <linux/types.h>
1 Q0 p+ K( m m, Z" ` - #include <linux/interrupt.h>" ^ W% S! d# {' N! o+ t
- #include <asm/io.h>
9 K4 _4 `% x% m; ?8 l - #include <linux/moduleparam.h>
) t6 Z% u8 v7 q8 M+ l - #include <linux/sysctl.h>5 m- p+ c" B# B1 w- i
- #include <linux/mm.h>3 _& a6 |/ s+ ^+ D( N
- #include <linux/dma-mapping.h>: q1 q5 R: o( ?; d: C
- 6 J( X2 K/ X$ f5 H; P) s O* E
- #include <mach/memory.h>( c- e& f# q0 k
- #include <mach/hardware.h>
; \7 _8 N3 I! J; s% c - #include <mach/irqs.h>8 x- C. s M, d/ I
- #include <asm/hardware/edma.h>
! t/ a+ U' h z2 Z1 L+ n( d% S
1 k2 I+ i% z0 w W8 Y' i; B8 _* I- #undef EDMA3_DEBUG& \: b6 S) Z% c; |8 D
- /*#define EDMA3_DEBUG*/) q2 _, f1 G. C* y H
9 N6 [) I' ^) v- #ifdef EDMA3_DEBUG2 n/ D k% H1 A: S) Z. J2 ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' a* E- O) y9 l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 i# ^% I5 K0 {" Z, i9 t. b( u+ Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 U0 v8 t$ ^! r- ?
- #else2 P, I! j# @) B; A N$ X$ o
- #define DMA_PRINTK( x... )
* T* j3 S& m6 b - #define DMA_FN_IN
0 Q/ y$ p1 d5 Z* a - #define DMA_FN_OUT
( R+ i7 M' S1 q; ] - #endif
4 y6 p3 l+ e$ V4 h, n$ K6 d - $ F4 p/ `1 f0 E0 s+ x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' g- u! T6 D5 I% j6 J
- #define STATIC_SHIFT 3
+ F g% R' \* F: d. M) ^ - #define TCINTEN_SHIFT 20
9 X5 [4 x2 }! M, q1 q - #define ITCINTEN_SHIFT 21
, c0 X" p, s6 d2 A: \" e - #define TCCHEN_SHIFT 22! Y" i1 c- h" V3 b9 ]" ~. \
- #define ITCCHEN_SHIFT 23
, ^4 } N$ R" b; O- p. ?* [
+ ^4 w) k/ _( E, V- A- static volatile int irqraised1 = 0;
6 O/ f" `# a1 K$ } - static volatile int irqraised2 = 0;
1 w' Z; e6 ?# r& d - 5 A2 `$ ]- ^* L6 E0 m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ m- P2 h- V! } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: w( l4 p7 t: D+ e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 s# }$ f, g `% p
- 6 I) E) \& t4 W' U! c6 I
- dma_addr_t dmaphyssrc1 = 0;; s0 u6 J3 [, f
- dma_addr_t dmaphyssrc2 = 0;
L) a% f3 n4 q. L/ V - dma_addr_t dmaphysdest1 = 0;) @ }0 e, n0 y$ H
- dma_addr_t dmaphysdest2 = 0;* |5 v. I/ X+ o- l" \3 c
- x( O5 v0 A, B2 \ Y4 }( i
- char *dmabufsrc1 = NULL;% N! U7 k% o2 }7 b' H! q/ q
- char *dmabufsrc2 = NULL;# C' ]; `6 b* P: ] f7 N/ D
- char *dmabufdest1 = NULL;8 ~" E, ]4 a% Z( X! j2 h
- char *dmabufdest2 = NULL;6 q; a1 E" [0 Q! {+ Y6 C# N
- ! r5 E! j! p2 ^+ v( s6 I# K
- static int acnt = 512;
4 q0 g- n' o3 v" v- \ - static int bcnt = 8;2 {% J, J$ K' ]1 a7 R9 Q
- static int ccnt = 8;: H* s" s( ~6 B4 S; ~8 }- Q
- & h6 o5 p" L5 d! p' O# P/ w% m
- module_param(acnt, int, S_IRUGO);
# w0 c. [2 Y+ `& Z2 h- ]) Z - module_param(bcnt, int, S_IRUGO);1 J; F) I |( ]/ n- V
- module_param(ccnt, int, S_IRUGO);
复制代码 & H8 e3 Q* [9 W; g! U1 b4 A
. e' Y- P; u' C* W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 N' g7 s/ I1 q, Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ m1 O5 J S8 [( [% X) |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) V% e2 c6 w9 k, Q$ d& [
! {3 G. }6 o7 K3 U! {7 B* J
" ^2 w9 i t8 ~7 O$ ^+ {; T |
|