|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 Y/ d6 N6 g5 U9 f
- [code]EDMA sample test application
; f3 [" C$ q% F! R/ o$ o - /*
4 h) f" }; v3 ~8 R6 @6 ^, k! T - * edma_test.c) N+ T$ E1 |/ I$ \ F8 R
- *
: x3 g* s Z8 m# W) w# t - * brief EDMA3 Test Application
, y8 c: N: M2 w; J+ z - *
6 X2 J: [# _; c" E- K - * This file contains EDMA3 Test code.
# K/ _7 J( ?0 \ - *
: e- R$ v# ~7 V3 K* `5 ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! t6 f7 L. D; @ F \" R' d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: X+ V! q5 L5 S$ f( }) ~ - * TO CHANGE.$ y. t* k; Y, }( U& ^$ G
- *
6 I1 {# s/ c, v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 }+ p9 u( i9 d1 ^- F- P( M
- *' r0 R6 k. Z5 m4 M& u$ q2 A0 D
- * This program is free software; you can redistribute it and/or9 y j' \; W% o) v; |. P
- * modify it under the terms of the GNU General Public License as
/ x# K) T0 T0 k - * published by the Free Software Foundation version 2.
, v% z7 G |1 C; H - *
) K# z9 s- g3 D5 A5 n$ F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& D: l" ?3 c2 P$ c6 g+ G! a( ~- \ - * kind, whether express or implied; without even the implied warranty
- h$ x/ b/ R, i. S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. a: Q {, I* k" s# N; O
- * GNU General Public License for more details.) p( s/ }2 U; N- T
- */
7 L2 E. v* h& T W* G8 S+ p - # V6 ^7 y) k0 O) a& f& U
- #include <linux/module.h>$ k/ _3 e/ d# `0 F5 p/ m
- #include <linux/init.h>1 H% R. `' L# R) P/ l9 B5 h
- #include <linux/errno.h>8 J5 v! l6 y; W H1 [' N$ L, e
- #include <linux/types.h>6 M7 s4 q5 n/ F& p) |$ u F* A/ r
- #include <linux/interrupt.h>
8 f, e6 u! w. R* g; H - #include <asm/io.h>
* p: e7 \) e' Y3 g# E- M" c/ M6 C - #include <linux/moduleparam.h>
X# g# I0 j3 T! C# D - #include <linux/sysctl.h>/ [/ S2 K2 i8 N: a$ \
- #include <linux/mm.h>- b9 c6 N# _6 ?7 V
- #include <linux/dma-mapping.h>9 M* c3 z8 W8 d+ X7 s" V
3 t9 n6 ^+ Z' v3 O0 t1 L- #include <mach/memory.h>
) _2 C; }8 ^& }7 \ - #include <mach/hardware.h>
' {7 d' G& ^& |; D3 I. h4 T# I - #include <mach/irqs.h>0 V2 p, |/ s# h& w7 Z
- #include <asm/hardware/edma.h>9 |; L, r {+ V) N/ f6 H/ ?6 j4 g
9 w+ A& v) i4 G- q- #undef EDMA3_DEBUG
) Y# f. ?# U/ L m4 B$ C) s - /*#define EDMA3_DEBUG*/
% v9 r( S7 R; } - # g- N4 i. f1 D- v a
- #ifdef EDMA3_DEBUG
8 `/ Z f" w1 \3 O2 o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" ~/ `5 j3 i" r$ U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 ? d. a; m# l- U/ `8 h( o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- A; a' L. e7 m5 {! N - #else% ]* J% g! e4 f: l" @* K
- #define DMA_PRINTK( x... ); c- O9 y1 P: v" W2 }: u
- #define DMA_FN_IN# \) [% A4 d. ?: B$ u! _3 @
- #define DMA_FN_OUT
3 V6 w/ V/ @# W- @* Z+ U. X - #endif" Y6 C: @0 R2 C5 d! n$ p. n/ U2 Y
- , R3 Q) }) ?% E. h, f# ?2 L' x+ t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" S T9 w. i9 h$ o3 R# w - #define STATIC_SHIFT 3; B0 y+ Y+ ?9 [% H$ A- G5 `
- #define TCINTEN_SHIFT 20: t o: J; e7 V" w: g
- #define ITCINTEN_SHIFT 21
7 o9 C3 M! f6 [ - #define TCCHEN_SHIFT 22
; Z7 `+ a7 z& m1 t* e5 [ - #define ITCCHEN_SHIFT 23
* N/ f9 c: k$ {# i) U. q6 i
! z4 A) x0 m9 F1 f. J/ [6 ?- static volatile int irqraised1 = 0;
% l N1 }" B8 G b: e! j `7 L - static volatile int irqraised2 = 0;) a7 g+ A2 w1 ~2 M
2 J: i: {2 m$ d: l) g X* X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( a3 F6 l/ r' `5 E3 z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 H8 ~* b* a3 i; d8 E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ C+ V, G# u; E- C r* r) d- d
- 4 b7 b7 e+ m5 f2 c
- dma_addr_t dmaphyssrc1 = 0;
' A: v4 o6 c9 G1 w - dma_addr_t dmaphyssrc2 = 0;
3 v* \3 b. B! q! q" _; T+ v# {; b - dma_addr_t dmaphysdest1 = 0;) S6 r( Y+ G6 N3 W7 m: S+ A
- dma_addr_t dmaphysdest2 = 0;
: e O! W; g* e
2 G: ?3 @0 E5 E$ X- char *dmabufsrc1 = NULL;* X( C- H+ }. r+ G# S8 X: K" ]' w
- char *dmabufsrc2 = NULL;7 ^+ T5 k- h" g; g) [
- char *dmabufdest1 = NULL;: q& k% Z* p5 H
- char *dmabufdest2 = NULL;
" N4 U6 B; g4 k. E - 5 n# t- [# t, {4 ^8 E
- static int acnt = 512;
. Y- I! N$ R0 n' ?5 L( Y/ t2 e+ A; F; { - static int bcnt = 8;
2 g6 N6 q5 H0 {0 D8 j# F% B' ? - static int ccnt = 8;
/ N8 A0 o) S2 W; c2 E - . [/ m4 C: u, c/ C
- module_param(acnt, int, S_IRUGO);
: X- F) k* u2 o7 I( l# Z2 O: e - module_param(bcnt, int, S_IRUGO);
# m( q0 w* T: h3 L - module_param(ccnt, int, S_IRUGO);
复制代码 9 z, y1 \! L3 Q# p- U6 p
" n P2 s* a$ _" w' S$ C0 l, @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) `5 N5 L1 ^$ |, u3 c/ \( k% Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& i# n. B; r7 ?# n5 Y) C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ m; p* v- H4 O6 T2 g! `
3 f1 B+ Q$ E+ p( ?& ^6 e) c( g: ?: p+ h- _3 t. {
|
|