|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % q" \* m, |( |6 @# O6 n7 d
- [code]EDMA sample test application
' Z8 C; X7 U! T* D& { - /*
' M7 h& G& C( N1 `1 a2 } - * edma_test.c8 ~( O& W! l4 \8 }7 C% G
- *
8 z, ]. ? Y" o/ Z( ?% A) g - * brief EDMA3 Test Application
$ \3 U% N: ^* [/ z% a0 g - *) g2 @: m1 v, D) K
- * This file contains EDMA3 Test code.5 i( L7 `0 X% b5 [
- *
: _7 K; c& M4 s, [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 H. @3 N5 b6 Z; T9 l3 ?, A4 w c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( h9 w, d H Q3 r. \. ?' `
- * TO CHANGE.* g/ m% Y9 Z3 {' s% m1 s" n
- *- h+ r9 n8 c a& n: L4 Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ ~) O, g0 \# }/ q' ~% n
- *: }. K- Z E2 s' {
- * This program is free software; you can redistribute it and/or
" N. R* J0 r3 f1 W- g - * modify it under the terms of the GNU General Public License as/ d8 E; Y9 K+ Y: E& J. V+ R4 n
- * published by the Free Software Foundation version 2.+ Y- R( y; P# [& | r$ [
- *
0 Y. y/ K" B% Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 |6 p/ c) S3 t, @. W( s
- * kind, whether express or implied; without even the implied warranty* m: a+ }2 }% e# C" y: K* r& f" h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 k1 s/ u7 m. V
- * GNU General Public License for more details.
! q2 f/ B. |) U6 E - */
% ] T# x; `9 m- N
( j, H0 `9 l* e, x- `, m. ^- #include <linux/module.h> u! j! J: i R* _* Y+ D! t4 I5 K$ w- p
- #include <linux/init.h>9 w: W3 ?% l' p) z- j
- #include <linux/errno.h>' {/ E/ H Z" b, V2 m
- #include <linux/types.h>
# k, T& E, s( J - #include <linux/interrupt.h>9 G& S r' B. f" s- r
- #include <asm/io.h>% B& }7 ]: Y$ Z" ~, N, O! t; z: a1 q7 K
- #include <linux/moduleparam.h>
; S) u% ~0 S6 c - #include <linux/sysctl.h>) {7 K5 u8 h3 u1 R
- #include <linux/mm.h>* ]4 n1 Y. B( Z( ^5 u$ W0 b
- #include <linux/dma-mapping.h>, @, H8 D( ?- ^
- 9 V) ]1 P' [4 M* Q: S
- #include <mach/memory.h>
) e; E% Q) T1 U: C! O4 i5 s+ D+ B - #include <mach/hardware.h>
0 _1 B) L$ a& w" E9 p. A: N, D - #include <mach/irqs.h>
# o( ~! A6 _% c, ~( x) D - #include <asm/hardware/edma.h>
! `% W5 k( I" C6 K& h# r
4 s# r4 a8 j' v" O5 W- #undef EDMA3_DEBUG
# ]3 u/ i, _/ s7 a# B - /*#define EDMA3_DEBUG*/7 H, ~1 q( I% H# M: f. s2 [
- . E% A' t) X4 {5 \# G* l1 t0 {/ S9 f/ x$ F
- #ifdef EDMA3_DEBUG* J9 V l) _, e% y* k& s0 Y( _8 K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, s* y; j7 e7 r4 O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 o$ q N. v( n" e) [4 ?8 W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 [" L) a" t" M4 Y - #else
2 {( G& X. N9 o4 ? - #define DMA_PRINTK( x... )) }. o) @2 y7 V7 d
- #define DMA_FN_IN
b+ j$ C. _8 H - #define DMA_FN_OUT
# t6 j2 u5 ~# k' w& E# p% n# R( ^ - #endif
% [* k* w6 o4 O, o7 k - 8 {0 I; i2 J% s; E3 u7 k9 u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), A. F: o; d5 E# ~4 g
- #define STATIC_SHIFT 3% W O6 N: e. M T8 k( L j
- #define TCINTEN_SHIFT 20
/ u4 h" D4 u: a" K5 \2 q2 q - #define ITCINTEN_SHIFT 213 }$ {3 [ B) {0 G& _4 _# P2 h
- #define TCCHEN_SHIFT 22: W6 g( r U2 E3 P7 b+ v
- #define ITCCHEN_SHIFT 23' L+ w5 z t/ F6 V
6 T: [$ m9 H# s0 M- static volatile int irqraised1 = 0;& x# T: _! g% d7 I
- static volatile int irqraised2 = 0;
6 U( @9 [, g2 s! I$ e& j - * e1 b) h- H7 R# G9 j1 Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! w4 j i( v7 j4 [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; a) K) H( I. Z0 f$ b; f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); X, O- o! m# a+ W* P3 D7 `; l$ V
- " L" L( r/ ^% a4 {1 ~
- dma_addr_t dmaphyssrc1 = 0;
: Y" `% M6 [8 K. j - dma_addr_t dmaphyssrc2 = 0;
3 l& ]% V; _6 _' R8 T8 ` - dma_addr_t dmaphysdest1 = 0;
: N1 w) N- ?8 w8 p+ H( M1 V4 w3 g u - dma_addr_t dmaphysdest2 = 0;- j/ ~% o) F. ~& c1 c! m
- * Y0 f% W; k7 i' V/ A
- char *dmabufsrc1 = NULL;7 w9 C J# q# N7 P
- char *dmabufsrc2 = NULL;
7 z" ?1 n& b; G - char *dmabufdest1 = NULL; y# m5 [/ {& [$ [) s: r- u, w
- char *dmabufdest2 = NULL;
+ a5 B! M7 m6 d5 ~ V) c9 N5 j( _4 s - % B% ~9 l9 m! N2 u2 ]0 o5 M9 r9 Q
- static int acnt = 512;
4 X- z* |/ S, Y7 n/ K8 n$ O* u# \ - static int bcnt = 8;
+ j' M1 y& u$ B# n9 }- j5 K - static int ccnt = 8;
! b E+ {7 u2 J; K4 { - 7 b) t0 o$ v, Y
- module_param(acnt, int, S_IRUGO);
7 I& t1 a/ J/ k2 N - module_param(bcnt, int, S_IRUGO);
, O: z t+ h% N/ a8 C - module_param(ccnt, int, S_IRUGO);
复制代码
8 f$ b2 V; l8 t7 A$ g* \0 b& P+ [0 }" G7 R) O" P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( y: \* j: H- D# P5 ]2 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* r! B9 K- T) g: n, J: R! [1 ]1 P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 B9 x* P' V7 H' y2 t/ I: Y+ h4 j$ d" {0 b" Z/ {+ W
9 ?" n; Q+ ] d) ~9 L |
|