|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 G3 x- g) g' Q, g& K1 G
- [code]EDMA sample test application
% q8 a9 j. ^7 o6 _8 _9 G - /*1 `* h% e5 `1 s
- * edma_test.c
# W) \7 q8 P* G2 P3 Z - *
0 ^' J5 M0 t- H1 v - * brief EDMA3 Test Application" m; P* v5 `) A3 y6 h0 G8 R; D. R
- *
% @4 y* T$ h7 {- s, F* b6 O4 r - * This file contains EDMA3 Test code.3 b+ b6 w2 y- _+ ^; L
- *
& Z9 g, Y! z! v# H6 r: [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ e/ F5 x7 C6 c9 _$ E- B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 Y. I* k* m( I/ n! b# n0 S u" ~ - * TO CHANGE.4 r9 `" C" v; b: F
- *
/ B4 A7 N: V/ c: q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ D. H8 L& L/ w0 D
- *" M& H9 r( z3 \ @
- * This program is free software; you can redistribute it and/or9 P" l! i/ E8 M, d# [+ B
- * modify it under the terms of the GNU General Public License as
7 E) z6 e* H4 z' `2 j* c - * published by the Free Software Foundation version 2.
6 W" T! U% C$ t# x - *1 E, E/ c g3 v9 ~* K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* x2 H# L" L$ i- P( f - * kind, whether express or implied; without even the implied warranty
: q( s6 G3 Z6 Z. H+ ^" j7 R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b, L% Y; z- s - * GNU General Public License for more details.) a$ f; s R9 U9 A8 J4 N
- */
9 Y, W- G; c! _; ~6 T - ~* z* z& q# X& v8 A
- #include <linux/module.h>& {2 i6 T& ~$ P }% a, F: o
- #include <linux/init.h>8 b( q3 w/ S& n' E
- #include <linux/errno.h>' g& H. p- [; j5 A
- #include <linux/types.h>
/ K8 E0 f# h% ], i: L9 ]$ L; O - #include <linux/interrupt.h>
# ^4 ^8 B/ o. n! C - #include <asm/io.h>
5 [! E4 l! H% p, I - #include <linux/moduleparam.h>
4 l; \0 l- \* @. w4 G& c! g0 | - #include <linux/sysctl.h># \' t" T3 X0 {- i9 C5 I7 H1 [
- #include <linux/mm.h>
- i. G7 D( |: a- i4 ?; l - #include <linux/dma-mapping.h>: X; i& H6 f" E1 ^
- # a! T6 U/ z: T2 \/ S; g) u+ W
- #include <mach/memory.h>* Y6 z3 t1 A6 ~
- #include <mach/hardware.h>+ I; ?" Y" [3 C: e* O5 l
- #include <mach/irqs.h>1 I7 a Y' G5 z" n( E- J
- #include <asm/hardware/edma.h>
7 L( P! Q3 R; o, p - & D. |% N" c" M; K# `3 X2 ~2 U; ]2 C
- #undef EDMA3_DEBUG' ~8 E4 T# R" w' F U8 n
- /*#define EDMA3_DEBUG*/" m1 S& _: e: n" ?2 _! j9 p% G# o
- 4 L8 e; {/ R- l# `; m
- #ifdef EDMA3_DEBUG, a7 R, r& o% e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- s% }4 x. C" x2 K$ [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 l S: E" S' Q9 D. u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' h" C# @2 o' t' K0 z/ H. H: c; [ N% ~ - #else; a" _/ [/ Z" i1 h
- #define DMA_PRINTK( x... )' ^+ P' S3 l: L- O* |/ m6 A
- #define DMA_FN_IN
6 _) Q) I0 j3 y1 }& T - #define DMA_FN_OUT+ X+ b! t; c, u8 [; A- z( a/ d
- #endif
+ R# B5 a7 l5 K `/ d! j
# ~) j- s) O' n; H7 w- #define MAX_DMA_TRANSFER_IN_BYTES (32768). d% E; C) ?9 s- H
- #define STATIC_SHIFT 3
; B& _) n7 z' [& x1 N! x - #define TCINTEN_SHIFT 20
# J3 |' t( o ?6 X a# ] - #define ITCINTEN_SHIFT 21
6 [- H: B4 A' \0 g9 r; p6 M - #define TCCHEN_SHIFT 228 v4 ]( `8 i! e$ P. @
- #define ITCCHEN_SHIFT 23
3 { y+ T1 d+ [6 O+ _7 O - # a- I: `% ?: f" o. l
- static volatile int irqraised1 = 0;
8 A* k) b9 w/ i/ e - static volatile int irqraised2 = 0;4 S8 O. U" I- v' P. }5 R
- . q# T; t1 a* M& m, a& P! ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& r0 A; E$ W7 B4 }* o2 G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: m) b3 y; l, p% W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 u* j4 I) q5 S/ i: q5 _; B - 0 w2 b! @$ ?) h4 n6 _' b
- dma_addr_t dmaphyssrc1 = 0;9 B: ] x L. J- v0 ?4 b5 R" R5 Y+ ~
- dma_addr_t dmaphyssrc2 = 0;
& _+ ?6 B/ ]; E - dma_addr_t dmaphysdest1 = 0;
+ v: C# f/ T7 D* R - dma_addr_t dmaphysdest2 = 0;
" Q( |% D6 ?0 ^
; a0 e& z: a o5 y" h- char *dmabufsrc1 = NULL;/ N. Y$ Y1 y0 _9 @( c$ _
- char *dmabufsrc2 = NULL;% ]2 V* [) ^. l0 l5 ^" i! ^
- char *dmabufdest1 = NULL;2 i' T- k) `2 y! k7 _6 S
- char *dmabufdest2 = NULL;# i9 V; t) J" `; E4 j, B% j
- - r; v0 ]* A$ }# p( e8 q% L
- static int acnt = 512;/ M4 q) K [! }) o& r
- static int bcnt = 8;; l. ], e9 A. o M
- static int ccnt = 8;
3 ?) m9 n9 \7 Q4 F
$ z4 N4 S8 b9 L8 l: Y- module_param(acnt, int, S_IRUGO);
8 R }) E6 V% m. l7 V* H# [ - module_param(bcnt, int, S_IRUGO);
: x9 o! ~/ b% I+ d: W - module_param(ccnt, int, S_IRUGO);
复制代码
3 f; [9 P c0 ]" ]8 g8 `7 t
& |+ K" g2 S W! s7 R5 K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- F4 F: e/ ?$ W6 o+ \6 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% X. Y( n7 f; K4 C& |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% w8 a2 b6 N3 V! ^
7 y1 `+ T# u# Y4 q6 j
& N9 p. B, O# S5 [2 C& }2 W. R' W
|
|