|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % \( U: o# k: X
- [code]EDMA sample test application
' N) S& R+ W. |* f4 T - /*, B% L. u/ |! `) v+ [, N4 q% W
- * edma_test.c
5 ~2 i4 M3 j3 A( l8 S) c - *
6 \2 w1 d: D \/ A! w. d3 } - * brief EDMA3 Test Application% ^1 x* I8 w& a' m
- *
1 L4 \: a9 b* G2 w) P! b; P - * This file contains EDMA3 Test code.
0 ?7 }: v0 ]* n! ~; P% o - *+ O4 a, |' u* \" z& E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 {! N$ _! N4 i' r1 _+ C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* H6 i/ W" `8 ? G
- * TO CHANGE.
: q7 K; W7 L, l# c - *7 h3 _" ?% H0 m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, p0 Y9 H/ f* ` - *1 k) @( w$ O0 q" K& ]
- * This program is free software; you can redistribute it and/or
: i9 `0 Z5 }; Y( n - * modify it under the terms of the GNU General Public License as
- H3 ^2 L$ @! ^7 J. X - * published by the Free Software Foundation version 2.
/ M" _' \; H& Z2 P% [% t& v - *
8 Z6 E) I$ ~) `3 p0 W5 E/ W' { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 W; s8 B6 D* E; z5 Z( M* A& G - * kind, whether express or implied; without even the implied warranty
% F b9 r7 ]2 ~! V/ p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% G2 y" {- y0 Z8 e7 d9 G6 _ - * GNU General Public License for more details.
- w* g# V7 t+ O - */! P; }7 y, D0 j/ Q2 C& b3 F O0 H
( u* d& r3 X3 a- #include <linux/module.h>5 Z( F5 H2 H! M# s% f
- #include <linux/init.h>% A8 B4 f, s! i% c
- #include <linux/errno.h>
) x: f3 U& ~' J. O1 z - #include <linux/types.h>/ w' W, B: {' \4 }& j
- #include <linux/interrupt.h>5 N6 X+ E q7 X A2 U# O, G
- #include <asm/io.h>
3 K: U/ B: T- y - #include <linux/moduleparam.h>
* T7 n V' {3 I) m - #include <linux/sysctl.h>; h# Q2 a S4 ~* R& T- l
- #include <linux/mm.h>( C/ g; j; C+ Q6 o" @+ j
- #include <linux/dma-mapping.h> \5 e* L* p# B8 M
- D9 u. }% T7 l) H L- B7 x7 N
- #include <mach/memory.h>+ ^4 D4 b5 [0 x5 A- X" {
- #include <mach/hardware.h>0 ]) T$ q) z" G1 @7 _
- #include <mach/irqs.h>
1 s/ Y2 w" F# O. J6 j0 y. P7 j - #include <asm/hardware/edma.h>
& l% F5 {. n5 W {9 x0 N0 X+ E/ g- X
$ T E2 j, G$ c. \' z" h- #undef EDMA3_DEBUG9 L4 {1 }% i v0 b, s( P1 I
- /*#define EDMA3_DEBUG*/4 ]9 D+ B5 v: f$ v, O
- 6 I& T2 v2 n" \" y# O
- #ifdef EDMA3_DEBUG3 G6 f* Q, ]3 H P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; b9 x/ {& E3 v. Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
p* ?+ G- x2 K, V/ l# Y1 o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) [" R- a6 R+ D, g+ b
- #else3 E5 k# X9 H/ C7 l
- #define DMA_PRINTK( x... )
% Q4 f* x3 s0 f* i# ]6 F - #define DMA_FN_IN
* v7 r" {# {6 J0 z+ d& z* Z) v - #define DMA_FN_OUT: c$ S* N- D7 G9 {0 [ u! T
- #endif# q! q/ P# d& X& d
- , z% D6 A9 E; S1 u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 @5 T0 a5 H. u& W6 J. _
- #define STATIC_SHIFT 3
0 E' s& A/ ?9 m' A6 h - #define TCINTEN_SHIFT 20
( {# ]6 X6 J' `6 R% k7 o" f9 e; ` - #define ITCINTEN_SHIFT 21% o& V9 V' C+ d. i& M U
- #define TCCHEN_SHIFT 225 f0 I: D2 A. w2 U' O
- #define ITCCHEN_SHIFT 23
. t4 j& t8 i' F' }1 @8 h" c - $ z$ C/ q n2 s) `
- static volatile int irqraised1 = 0;
, m9 i# Q$ h1 ?1 @ - static volatile int irqraised2 = 0;2 b0 R7 J( A$ f' \. Q9 P* W
# a; z: Q( ]- E n) J+ Q* \" O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: W. G% i4 ]- S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 ?' z$ W4 b" e! u" ]1 |7 d. K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: l: T z$ k1 n1 B6 b
- b% A& X6 O; U! u% B' _- dma_addr_t dmaphyssrc1 = 0;
- |1 C P, r. m5 p* H - dma_addr_t dmaphyssrc2 = 0;
1 T8 f" q9 t' ^0 y9 l1 N1 H - dma_addr_t dmaphysdest1 = 0;
7 P) y! \! B8 \; K+ ~! h - dma_addr_t dmaphysdest2 = 0;
6 a. }9 R$ Q5 t" l9 {2 n
6 A) U- ?1 O. \- char *dmabufsrc1 = NULL;% V- f/ `- s$ x- k
- char *dmabufsrc2 = NULL;' E5 a2 W- Q- ?% M1 G. l2 e
- char *dmabufdest1 = NULL;3 \ X/ O: D7 j5 P
- char *dmabufdest2 = NULL;
! v5 Z8 U S* ^+ S - : X, n, l) ^7 q+ g, G# x4 _
- static int acnt = 512;* |5 ?5 H2 W1 a
- static int bcnt = 8;
! L$ D1 M7 I) w$ S8 ?% [ - static int ccnt = 8;7 S; Y: L4 g9 H% P$ p
- 7 j9 }8 t# k' f- U
- module_param(acnt, int, S_IRUGO);/ M5 M3 f" A. b6 u5 X C0 z
- module_param(bcnt, int, S_IRUGO);
2 o$ W" c) e x( g9 i* M4 F - module_param(ccnt, int, S_IRUGO);
复制代码
6 u p% h' \0 Z" c! z' s; q8 F: r, i0 ^' w1 ^5 d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& ~7 T) m2 A. 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ @6 X/ P3 u3 Z* @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 o% c N$ t8 e9 t
3 e5 G' f- O2 F7 A+ w. W4 ]0 B2 e6 K7 u1 q, w' n0 }+ c
|
|