|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! C% j# ?' Z `3 i. u: O- [code]EDMA sample test application4 L% \- L0 |0 P& P7 K7 K8 {
- /*
S, s [( @- l$ m2 t$ u - * edma_test.c
0 R6 N8 B! j' }% g! @& d - *) J4 K q3 c5 t9 g% r( C
- * brief EDMA3 Test Application
0 k0 ]$ y# `8 F: b: s - *
' Y. x/ p' ~0 V3 F% M( f4 m - * This file contains EDMA3 Test code.5 f: A+ E! R1 }1 X ^
- *
% h/ o' G! n: v5 Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 k4 D, M1 Q7 h) K8 G" {8 h( L' \. M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- S8 v* o) T$ I3 Y. r+ E( u$ t - * TO CHANGE.
: n, {# Q0 B+ x7 Y) a' N) Y, Q - *
8 @) E: ^8 a) {' l" A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- d* L! \3 r5 V& G7 i) {& V
- *( W+ u7 p, J0 u; j+ Z$ |. R
- * This program is free software; you can redistribute it and/or
! c1 h Q0 h8 v* j% |" p' l - * modify it under the terms of the GNU General Public License as: o& V# g' \6 W" \4 X
- * published by the Free Software Foundation version 2.* v( u O7 v+ y5 d2 o
- *
9 }3 t5 T. a" S/ V! s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ ^( G9 f3 ^& k- n - * kind, whether express or implied; without even the implied warranty# o7 M1 L0 @, ~3 d3 N$ M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* u& l% V/ z* ^2 |, s; Y, x) j - * GNU General Public License for more details.
$ {. {3 d# U2 N - */1 Z. f9 H) b8 w9 a& u5 E
$ g8 W& h9 J" I6 y v- #include <linux/module.h>
$ W3 k X7 r$ \ w; D8 q" S2 C - #include <linux/init.h>
4 o8 U1 F$ S; r9 C - #include <linux/errno.h>
[* q Y( @2 c) t- O9 \ - #include <linux/types.h>
9 w1 X; z0 r! C, Y% P - #include <linux/interrupt.h>& r; c. g' V. y* ]" C
- #include <asm/io.h>
/ ]; P. P8 u3 V- m K) L4 T - #include <linux/moduleparam.h>* @% b! M) p" Y- ?: r6 |
- #include <linux/sysctl.h>- L7 H' \$ `' F2 x/ x! H( Q
- #include <linux/mm.h>4 Z t+ B- N$ n$ o2 c! ?. d
- #include <linux/dma-mapping.h>
' P3 |$ N: z) n% \5 U; N
6 Q9 V5 y# A: _, W- i6 R0 `- #include <mach/memory.h>
4 w$ u4 B% A( ?% Z1 P - #include <mach/hardware.h>
2 t- r0 r1 X# }5 U2 u1 ?2 H* r - #include <mach/irqs.h>
# j: B& Z+ i, C: V, i2 f+ L9 ] - #include <asm/hardware/edma.h>* }7 K' W7 F" s+ ~: l4 H0 I* ]9 D
; y# Y2 R. [' X2 b- #undef EDMA3_DEBUG V) ~# y) R3 F3 D- ?
- /*#define EDMA3_DEBUG*/
& Z& K9 w3 f; C6 q# j" ?- n' J - * ^7 Z; r3 b6 C8 e) i/ ?. d
- #ifdef EDMA3_DEBUG
8 j. h' v* |) V6 j# R% y- K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 N& Q1 U- i4 e! S' F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ g% ]2 J& ~- x/ r) E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ z* f+ a+ }4 B% \' z; P% i& a - #else$ \2 q5 W. y. Z" @1 R/ Y/ V3 Q3 c
- #define DMA_PRINTK( x... )% [: `) }1 v( _0 j
- #define DMA_FN_IN
c; K3 y0 p' i8 ? - #define DMA_FN_OUT
2 J9 d) F5 N2 } - #endif% E6 n4 U1 [$ e0 i+ o8 w
9 ]. K7 T# b& L/ W) n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! P6 @- ]# f0 I/ @$ X! D - #define STATIC_SHIFT 3
. m: m; L* Z r/ v! ? - #define TCINTEN_SHIFT 20
8 c% C7 X1 e4 Q0 V- x i - #define ITCINTEN_SHIFT 21
* O; |/ h0 {) {# w, z; k$ N - #define TCCHEN_SHIFT 22
/ A3 M: p# r) {( A- p* O, K - #define ITCCHEN_SHIFT 23
+ I- R9 j0 Q6 Q A( V - + K2 j; v+ F8 G' y
- static volatile int irqraised1 = 0;" h' A5 I6 v$ O: o( w- b4 c5 P
- static volatile int irqraised2 = 0;
1 d2 X5 C. w* U' O7 Y2 S9 m2 h/ m - 4 w; `4 `: w. L' d) ?: H' s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. t- a( B. h: D$ M3 x3 w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
m4 q& I. G2 b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 l: i2 a& K0 @$ }! }6 i
1 z5 p/ _; F# b! X- Y9 z5 ~$ J" G. b- dma_addr_t dmaphyssrc1 = 0;* l6 F4 B) f% k- l/ Y K+ D
- dma_addr_t dmaphyssrc2 = 0;8 d7 k8 p# _4 Q$ F
- dma_addr_t dmaphysdest1 = 0;. X6 R+ T# w4 U: R& F
- dma_addr_t dmaphysdest2 = 0;
1 t$ ]" @- L, [ l# h3 p }- p A1 ^3 O - , U( U @5 C* U/ h
- char *dmabufsrc1 = NULL;& o: c) p: `! l! ~& W3 D( S6 v
- char *dmabufsrc2 = NULL;- b% e+ h9 X) h
- char *dmabufdest1 = NULL;# @5 L3 v: \$ D( g) Q
- char *dmabufdest2 = NULL;
7 f! P7 h* ^# b) X% I5 _4 k - 0 z8 q4 @4 ?% f
- static int acnt = 512;
7 t q, ]4 e$ l3 d) x o - static int bcnt = 8;" [% S+ b6 ?+ d7 f& Q3 x3 N1 i
- static int ccnt = 8;
/ V# n( B+ M, ?# x g" m& t - 4 m4 A3 i9 e Z( b ?% `
- module_param(acnt, int, S_IRUGO);
5 D3 g0 m6 ?: j7 k3 \ l - module_param(bcnt, int, S_IRUGO);# F" F) W' ^. I" \# ]3 c
- module_param(ccnt, int, S_IRUGO);
复制代码
+ S! t. C. c/ z9 ~; ?
6 W; @3 n. q9 o N( l) g4 L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, y7 y+ s$ R: e5 J5 B( |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
V" t- y% b4 C2 k2 U& [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) U; l) c- o4 @! `1 x: H; `4 E9 `: \6 j
; W) U6 `4 U( T0 X# G* I0 {9 c2 v1 X |
|