|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 X1 C. u6 \5 Y7 I
- [code]EDMA sample test application
$ u9 _1 T e& p& L j9 h" u - /*
8 d9 l% _( f& D( {2 l - * edma_test.c
% z1 g- _5 y3 {( `+ W - *$ { v! c1 [9 W
- * brief EDMA3 Test Application
( ?3 u1 T- p5 g3 e$ Q- O( R - *
; D% [ e! ~/ z9 Z' L. m - * This file contains EDMA3 Test code." F2 N! {: G6 k9 s& V; C, m
- *# F4 m4 \, Q, \! ?6 L Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& C9 {7 L! d; l2 K9 H- l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; n5 {; H; U9 q6 a5 w- s
- * TO CHANGE.
. |% T' `5 x+ W - *' d8 j5 V$ `% h b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 Y1 V, f# u# h0 v% @# v8 y& A5 {" \ E - *# @7 G3 l+ H% v, u+ Q
- * This program is free software; you can redistribute it and/or
# Q1 C! ^9 r, k4 d& T- a* d - * modify it under the terms of the GNU General Public License as
( P' F' U7 W Y( F - * published by the Free Software Foundation version 2.
1 s3 D) t9 p1 y- T3 y - *
f. r @8 h2 Z0 w+ R9 j, [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: |2 b2 B/ _; O/ G6 x - * kind, whether express or implied; without even the implied warranty- w& z \; q) g- E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; f# d4 O& c7 U4 N - * GNU General Public License for more details.
, m( Y$ p* h5 q+ v! ` R - */3 r# \) p/ e- Q7 J5 f. S `
- * r1 O2 y, l1 A P8 x
- #include <linux/module.h>
: c3 j6 i1 I. O - #include <linux/init.h>
" O1 H' S; d6 v& {+ a - #include <linux/errno.h>1 C# R2 f3 m9 n2 T+ U
- #include <linux/types.h>3 ~% v7 T/ E; x9 v! n" V
- #include <linux/interrupt.h>
3 s3 H" F: H3 ?2 k/ v S4 g" X - #include <asm/io.h>$ K, V; S' q3 G( {5 O" N
- #include <linux/moduleparam.h>* }6 q# b7 d8 l, v! T
- #include <linux/sysctl.h>8 s+ a* w4 b E+ t, V4 d
- #include <linux/mm.h> S% y% N! a8 Z
- #include <linux/dma-mapping.h>
& s2 y" H- w% H7 h0 j. } - 6 M- r, a! [8 q) c5 P X
- #include <mach/memory.h>% i# ]& Q3 L+ M4 K/ c1 \
- #include <mach/hardware.h>
* G% r- q% ?" ~9 v - #include <mach/irqs.h>
4 s5 l) [2 Y% p7 a7 O9 K# r - #include <asm/hardware/edma.h>8 y0 s w- |! ]9 F7 l; M2 B; [% [
- 1 r. g2 x$ O/ V2 K, i+ H
- #undef EDMA3_DEBUG# D5 b; \$ p. E& t- M7 N( n
- /*#define EDMA3_DEBUG*/7 F4 _: Q1 ]4 A, s' Z R8 h
- 3 W) {0 B; } }6 c+ ~% Z2 ^9 ~0 S
- #ifdef EDMA3_DEBUG! A, a! c3 ^& w f; G6 a. A4 u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" b6 a( T, J5 @7 e* P) u2 f5 L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' W3 S7 F8 X$ q+ T9 T/ d6 @, G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 `) g3 s# ?' R
- #else
T& E8 }0 F9 k - #define DMA_PRINTK( x... )
1 G" P4 a% i, K, t. y2 |. ? - #define DMA_FN_IN8 i1 d U; ^. \/ `
- #define DMA_FN_OUT5 V( b8 ?: U" U! k
- #endif: `! M. b; l0 K X/ l
- 8 R9 l) p( K6 H9 B7 S& N( Q) ^" S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 t; ~! A' v+ b! y; G
- #define STATIC_SHIFT 3, b1 b$ I$ B* I+ o
- #define TCINTEN_SHIFT 20
7 f5 O" R2 b( r E& P" d - #define ITCINTEN_SHIFT 215 V) v1 `0 N$ k$ ~& C
- #define TCCHEN_SHIFT 22
" g, W3 _* J, L2 M8 O$ s - #define ITCCHEN_SHIFT 23
; G& ~0 H% z" N4 U7 p5 j1 R - / j" c$ ], S; j) Z! q0 s7 F
- static volatile int irqraised1 = 0;
5 s: P( p4 ]" Y* s' N2 M- u, w2 O/ i - static volatile int irqraised2 = 0;( e6 e; ?" |* e0 C2 p
- $ m- R; `2 R) o; C8 d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) g$ W0 t8 K5 { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# Y5 Z, ~! D- ` t6 E+ K# P. D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; G# I4 T: \; o7 O5 V/ u! a
2 M; q3 I+ Y6 c% _& i! G- dma_addr_t dmaphyssrc1 = 0;
' B- P4 u1 ?' Q. \9 k$ ` - dma_addr_t dmaphyssrc2 = 0;
# L( t! S/ a5 s* W+ _6 ^% { - dma_addr_t dmaphysdest1 = 0;
+ [0 @6 g& p; t+ ^3 n# i* c - dma_addr_t dmaphysdest2 = 0; Y- a6 _4 e$ W- I" Y
1 T4 x/ I. V; ~( H( z- char *dmabufsrc1 = NULL;4 Q4 A# i; O! M# @3 Q' z. ~
- char *dmabufsrc2 = NULL;
7 s8 s! o& i, a - char *dmabufdest1 = NULL;
- f0 |) Z; {9 m- n1 D: q8 I - char *dmabufdest2 = NULL;: c+ |. O# R, `; W8 {" x3 N
; x. V6 \" ?3 w$ v H- static int acnt = 512;
" ]6 s, i0 E8 v& i' J - static int bcnt = 8;/ P' P% n) T, b" w# i0 N7 d' ?* r, N
- static int ccnt = 8;
, K% [/ Y3 r7 N, g$ e: ]$ N, p) I6 J - / ]8 o& T5 f5 Y; l" `9 |
- module_param(acnt, int, S_IRUGO);$ m9 m6 |9 i5 y& Z
- module_param(bcnt, int, S_IRUGO);+ R! z; c% \5 T3 X. f1 c3 X3 A
- module_param(ccnt, int, S_IRUGO);
复制代码
, S# S, t* ?% j( h# A* b+ q; A; d) A+ A0 l( Q- }1 I9 ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 ^/ ?4 M0 b- Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( l% ^( X# a, F4 U3 r3 | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) p; _- z: ^9 r7 J/ s8 p. K
6 i8 d T0 C6 B1 i2 r0 k2 _, N$ u: l4 i" ^
|
|