|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 b: r2 ]# L7 }3 |* Q- [code]EDMA sample test application
; u5 u! r5 H7 K& Y - /*& U+ V& b# T& U- \% ]8 G' @5 {2 h
- * edma_test.c
, M) I9 G6 J9 O* m: F - *
6 p% t1 b: I, v' i' T - * brief EDMA3 Test Application
# F- r5 \! P+ I) s4 Q1 f - *3 w5 a# H5 ~: y" X% \4 n
- * This file contains EDMA3 Test code., t7 G8 U3 y2 a7 F$ g. @1 i+ x
- */ H. ]: T7 r- w: u8 J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, V/ c0 ? ~' @$ ^% c0 _: k* V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 t! f9 R+ M' {$ d' y - * TO CHANGE.8 H9 R) I i3 K
- *. e- y1 A. a& g' R9 {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; E+ W" J9 \3 l2 K% a! z2 o
- *
& ~/ T$ E- J6 @8 z9 S v; ~ - * This program is free software; you can redistribute it and/or
3 p g, C; ?/ N7 l7 G6 k& P - * modify it under the terms of the GNU General Public License as; D" x& f1 o/ [% _! e0 a
- * published by the Free Software Foundation version 2.3 G# [' \( y: ?# E3 C+ o# k% c& k
- *& k( g9 V. b) L9 C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( V+ A7 Q0 }. n0 P O. c
- * kind, whether express or implied; without even the implied warranty
/ K) y, Y6 B. P5 U: x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 h! [! }6 q0 X - * GNU General Public License for more details.
5 q' ?; v9 z$ T' f& N) u - */% u3 m6 @! g3 i2 O0 s) v
7 T; S# b" c" w+ R- #include <linux/module.h>
! [& Q; T7 h' Z - #include <linux/init.h>7 ^; n1 f1 {! Z0 _2 s
- #include <linux/errno.h>/ l; q3 [9 q) }$ d
- #include <linux/types.h>
6 X7 Q/ K! Z% G" x2 v - #include <linux/interrupt.h>
% X' U5 a ]8 I- p' ~8 x1 d - #include <asm/io.h>
4 |8 G. x! v3 E) m - #include <linux/moduleparam.h>9 }7 z! E2 x7 C6 R7 t1 n
- #include <linux/sysctl.h>1 @& K4 C3 V2 ?2 g
- #include <linux/mm.h>
$ F2 D# l n, J- Z! K! L% r1 [! e - #include <linux/dma-mapping.h>" V2 r6 u+ I+ N
- 7 ?6 o6 j; c7 C( f& ?2 J+ o% t
- #include <mach/memory.h># F1 \, L$ [* n# G$ D% P* _& Q1 \
- #include <mach/hardware.h>! S7 R* }- K3 [
- #include <mach/irqs.h>. P J) \2 A0 l; s! ]) @2 r
- #include <asm/hardware/edma.h># @/ j% A# ]% i: h
- , f+ V& j& U3 |2 I
- #undef EDMA3_DEBUG( h: X$ Q" L4 F3 U! j0 n- H
- /*#define EDMA3_DEBUG*/, u" z, m4 m9 B" ~$ U s$ V4 {9 p
9 M; X* q4 h& u' e- #ifdef EDMA3_DEBUG
6 B5 L) ~' P* n- m7 R% J2 G) F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): V' A& F8 b5 o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 f6 z- _7 k# J' S7 P1 P* u7 v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 b+ {) M$ d& r+ O6 i; D* D* Z
- #else
. e- P* }" v, N6 h: B! s - #define DMA_PRINTK( x... )
6 ^. f5 R: p3 j - #define DMA_FN_IN" |9 f: e# y l: Q b) q- m
- #define DMA_FN_OUT1 I8 e, I. X* ~4 e" \9 Q3 G
- #endif
; z: [4 [0 P$ C/ P# U0 d/ d2 @6 f - ! T! F9 U: p9 q5 j# O3 O. k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' q, O: P5 S# x( } - #define STATIC_SHIFT 3( y4 Q! w( u1 S$ j! I
- #define TCINTEN_SHIFT 20& T: E5 z8 R% M. m% G& w( f; [
- #define ITCINTEN_SHIFT 21; ~0 N7 Y Y# ?- s5 E3 D6 ?: Q
- #define TCCHEN_SHIFT 22
4 N0 ~7 q/ t8 C2 b% | - #define ITCCHEN_SHIFT 23
5 L. M3 m! v! d6 Q% X
4 p0 @! H; N3 m! c- static volatile int irqraised1 = 0;# O+ L$ ?0 Y$ D2 }& z8 b9 d% i! j
- static volatile int irqraised2 = 0;
1 P, y; P$ Z. G4 Z: e# } - . R' I- Q3 F/ Q: P. H. t1 V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# u8 R1 \. w# K: p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! D9 D7 s# s) ?; r2 j1 _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; l& n7 k& C: w( Q0 m/ y
- % m0 @4 i3 _9 m- C! P
- dma_addr_t dmaphyssrc1 = 0;
. j- U4 F) L( i8 w3 L" w - dma_addr_t dmaphyssrc2 = 0;
& U: b; x8 f: v - dma_addr_t dmaphysdest1 = 0;
% j, i9 B( {# F: J+ u - dma_addr_t dmaphysdest2 = 0;
8 m" O) P5 ?# p$ R5 U" |
% Z% v+ \* y" o y6 h& D; ~$ O5 w- char *dmabufsrc1 = NULL;
! G+ t. a, \, S" U& }- z, W - char *dmabufsrc2 = NULL;
( G# a9 o1 x( P# P# g - char *dmabufdest1 = NULL;
. _) S! ~* \+ @ @- }) d' p. s - char *dmabufdest2 = NULL;. `1 _1 T0 W2 s8 ^2 A" o, n5 m
- 3 ~; S- E" @' }
- static int acnt = 512;" X- H I! P3 Z; P3 j
- static int bcnt = 8;
- J6 R- z5 k7 m4 \- C - static int ccnt = 8;' k( E0 [2 S/ K7 g/ V W7 P
- * B# g9 G0 L2 }* E
- module_param(acnt, int, S_IRUGO);" x0 a; z( Y, ]8 m
- module_param(bcnt, int, S_IRUGO);
% `' w# s: m5 _$ _+ w - module_param(ccnt, int, S_IRUGO);
复制代码
" Z# s# I% P6 d( f/ H# a v& U* T8 v- @$ ?' j2 u2 O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, ^' F E, e: D. F# k. ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 O! P# R; A) ~ \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 P/ p1 y/ [. K- j5 v
1 B5 G2 _+ B. Q9 M6 m w( `$ e: y( N. @# g1 u9 b
|
|