|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' o1 }1 y6 y- h3 f# s+ F
- [code]EDMA sample test application7 J; x9 D, [5 `
- /*8 P' ?1 z* X% F% u! Y4 H1 S
- * edma_test.c
$ d* S ^! Z' K7 A' I( Q4 { - *6 J. c$ e1 W! ?5 [* d% e
- * brief EDMA3 Test Application, k! v0 h& F/ ^' g: [2 Z
- *" F) w$ J- t x( V: o
- * This file contains EDMA3 Test code.2 d u# W* n! D+ ~* F% g
- *8 q$ r' ?% a. k$ S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: u5 \( g, P, u: e- D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 i3 ~$ M; U1 w0 w7 Y( h - * TO CHANGE.
/ j) q- u4 v( Y0 p7 o" [ - *# D2 A6 v3 K2 L- i/ r) [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 q/ i4 m, E( W/ `( B" S5 i - *
' T! c0 m! t. ~ - * This program is free software; you can redistribute it and/or( q+ z6 g4 A) U v7 k$ t+ F: K
- * modify it under the terms of the GNU General Public License as' I% w) Q$ J% e6 r" t0 N
- * published by the Free Software Foundation version 2.9 P" b/ T9 U. h
- *
5 o9 z R4 Q( M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) ~+ C* I8 W: X& i' F& K6 `; t3 D
- * kind, whether express or implied; without even the implied warranty
4 q' K' o8 V+ P/ B+ S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 ^0 u1 M2 f4 W Z: L! r# T - * GNU General Public License for more details.( m9 n" ~8 i: q6 y
- */
$ A o2 W( v- k( r3 W4 e - . `6 k% E' ^+ \4 p; F+ ?; |
- #include <linux/module.h>! ]0 Z9 N5 g; T8 u
- #include <linux/init.h>! |' } g8 u4 x" d
- #include <linux/errno.h>
& Z. s+ W. S( O- b% l3 ` - #include <linux/types.h>
- H) @; w6 `1 D - #include <linux/interrupt.h>
2 v+ i. D) R& {3 |& ~: |! b6 D - #include <asm/io.h>3 \+ ^2 x d; q' ?! m2 V
- #include <linux/moduleparam.h>
9 \* L8 l/ d) V - #include <linux/sysctl.h>0 p7 r) i% R0 K7 h9 {3 K. X
- #include <linux/mm.h>
$ D4 K$ `" X+ O8 _: U4 @% I - #include <linux/dma-mapping.h>% U. T- _( T) M! W) J+ W6 K
8 n6 Y+ Y: f! i' K2 j- #include <mach/memory.h>
% B1 ?5 h1 J7 x, w9 `9 X% J - #include <mach/hardware.h>
( v4 F& Q. E- V- ~4 Q+ C8 h - #include <mach/irqs.h>) T# b1 n/ I6 v8 L. Y
- #include <asm/hardware/edma.h>4 g5 i1 b3 x+ V6 b
- ( X9 N/ ?8 L6 ~% Q% Y
- #undef EDMA3_DEBUG v( T+ x; D! w5 a
- /*#define EDMA3_DEBUG*/1 E/ I4 J; C. h1 y
$ u- |' u; e& M# g$ X4 a- #ifdef EDMA3_DEBUG
# M0 m# z5 i) c, N; o* v5 e% z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 J* H9 r. c$ }8 b! n p J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( u! D0 Q1 k: H' l5 X3 O2 Y1 W/ U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 g2 X2 |$ C' ~3 R9 [: B. Y
- #else
/ U6 n# K+ L$ t. }# o7 ~ - #define DMA_PRINTK( x... ); t" ~, ]8 ^7 x/ V) U- _
- #define DMA_FN_IN7 ]: S i: v2 H8 A0 P
- #define DMA_FN_OUT O, E) @9 u1 h a6 Q8 H h
- #endif6 [6 ?( p# ~0 j& z
- 4 x/ M9 w% C+ H+ g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 T# D7 b3 V$ E/ r - #define STATIC_SHIFT 3( {/ E7 V/ r6 V3 x" _2 d
- #define TCINTEN_SHIFT 200 d5 B7 b6 {* N. h
- #define ITCINTEN_SHIFT 21
% O( H4 s8 _0 U" s& D - #define TCCHEN_SHIFT 22( r. a2 G9 N- z* d
- #define ITCCHEN_SHIFT 23
. e' R G. w4 ^% o1 p
5 {1 S6 H( C0 h- static volatile int irqraised1 = 0;& s4 K: V$ A+ k( [
- static volatile int irqraised2 = 0;
4 f x5 K4 C. D2 B' x- t
! `) T" i6 s4 j/ D' q& i( K A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' p# `) q$ ~* i/ D8 r" [/ y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ S2 V( ~2 _4 l7 Z) t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- H/ K: }& v/ o3 x
- 8 k, T# @6 [ B. b. f9 J, C
- dma_addr_t dmaphyssrc1 = 0;
) ^1 k: _% }6 L5 P' @ - dma_addr_t dmaphyssrc2 = 0;
. {$ R* G% v/ [2 O6 s3 Y; i" L: Z& B& G7 A - dma_addr_t dmaphysdest1 = 0;
5 i- R, y. j; B3 P - dma_addr_t dmaphysdest2 = 0;
) ]4 Q9 w# S- G9 L) I t3 \
$ q6 M t# k @( ]& r# y* ?) w/ f1 X- char *dmabufsrc1 = NULL;
, i, B/ H, R( f" G% e - char *dmabufsrc2 = NULL;
! L( A( r5 f) l7 h9 A# L1 X4 { - char *dmabufdest1 = NULL;, Y& u/ ~2 d. A* g- P
- char *dmabufdest2 = NULL;
* o$ v9 J7 i) _; C$ {
3 P# t: L% E* h2 X" z- static int acnt = 512;2 f+ J1 [6 W: r6 i
- static int bcnt = 8;
+ N( W5 C9 p+ \7 j' @2 K - static int ccnt = 8;( U6 ?6 n7 W5 U. V
- . n/ Y0 X) t+ Y: e' y1 `
- module_param(acnt, int, S_IRUGO);1 R9 A- H9 t7 d2 T
- module_param(bcnt, int, S_IRUGO);3 @* r) b/ c& H' b, n3 Y
- module_param(ccnt, int, S_IRUGO);
复制代码
% s ?5 f& i& ]- ^0 I* G; v2 a, z( N$ p8 [. k- I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ u& w7 @5 P% barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! e# z6 ~/ @. z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 m" T' @- x& d
0 D/ H: ^7 b4 W* T# r, s( e' h W) M4 B2 ^, Y* L
|
|