|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 M0 C. E. K, f) h* { t
- [code]EDMA sample test application% T7 y+ C. k5 T/ b* Z6 |. M& w
- /*
3 t+ E+ s0 ^7 b4 i' E3 V! k7 Z" u - * edma_test.c
% Y, h i$ s' N. F - *7 g: J* x* {! {# T. {$ ?4 a
- * brief EDMA3 Test Application2 {& e! ~/ X& O( X3 O3 ]
- *
7 [5 N) T8 S( L- u- c2 O+ { - * This file contains EDMA3 Test code.
# d4 u! o) z; U6 l/ W; A/ n. D4 X - *, Z# z/ ^: W9 [0 g8 {# j/ W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; I' ?; F. o7 `7 y# H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# p+ ?- t5 \9 Z
- * TO CHANGE.
6 T5 @% T7 N6 l. c0 a( H: ?9 ^' o - *
/ Z1 k! R9 R4 F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ Q: e. v! R% r( B/ f - *- Q7 @1 o: W7 V% [" ^
- * This program is free software; you can redistribute it and/or
: O+ d: u3 r2 o- C/ R" | - * modify it under the terms of the GNU General Public License as
! ^1 M! { H1 M+ h - * published by the Free Software Foundation version 2.
8 O6 U' I& l6 x$ @ - *( i5 V! p, W; g0 t6 t" D7 I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, ?/ u% D) w: ?$ l' S - * kind, whether express or implied; without even the implied warranty6 P. j9 g) m5 a0 _, p. B; v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 ~4 {$ ]# B$ r) s4 I/ w4 c8 Z - * GNU General Public License for more details.2 n8 \5 Y& W7 \. e B
- */1 y% N! S# S# M1 c
- 4 h, h# [8 [3 h! ? o: n6 Y
- #include <linux/module.h>
* [; n! ?' _8 g/ P% M4 A - #include <linux/init.h>9 [8 n$ ?+ b+ Y; U- x1 D& A
- #include <linux/errno.h>
1 n0 j4 Q' K9 R) k( j. ] - #include <linux/types.h>- L/ b2 q4 m6 D+ n0 t
- #include <linux/interrupt.h>
* V' p" i1 q* Q/ r4 {. k5 j+ @, x4 ] - #include <asm/io.h>6 `$ X! j' G9 x& E3 @( R& ~
- #include <linux/moduleparam.h>" i6 b6 c: ^, x
- #include <linux/sysctl.h>
+ h$ z3 F3 H8 d! d7 i, E- _$ d3 v8 H - #include <linux/mm.h>& q/ v5 t3 o, \
- #include <linux/dma-mapping.h>
& {/ ]7 w& Y! n
& U v" J* N, v7 H- s' _' T" H6 z: e- #include <mach/memory.h>1 \) D6 L0 Y7 f; n$ Z& B" W
- #include <mach/hardware.h>- g4 B0 H* y7 I
- #include <mach/irqs.h>
3 \0 O# \# c, K9 c" U5 N( p$ G, m - #include <asm/hardware/edma.h>* F0 K: z5 ?5 C; T4 T$ j, K
- # v( Q1 r: g6 ~% ?- n; q
- #undef EDMA3_DEBUG, y6 Q. A1 y9 r
- /*#define EDMA3_DEBUG*/
4 d/ d% X: _; ]7 J7 q& K( F& ? - , q5 | }1 L( p u7 v
- #ifdef EDMA3_DEBUG
( p5 @0 w: v2 S0 e' } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. e4 l* N6 q; C; A9 B6 ~2 F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' ~, H$ h& k( { a# o# W7 k5 v, d, `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& e8 S: |: L, ?. y7 `
- #else/ U6 ~7 f) V' E g+ @
- #define DMA_PRINTK( x... )
: E$ [9 j! S7 @6 E - #define DMA_FN_IN E: v: Z% J/ B" M- D& [
- #define DMA_FN_OUT
/ I1 ] g b, y+ w - #endif5 A4 E# g2 w. o) g) E
- v! ~9 u4 j) c% \- n! O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! k$ l! w, Y8 Q$ i1 p* r- |; o
- #define STATIC_SHIFT 3
- ?5 e7 R0 E% R" x' c - #define TCINTEN_SHIFT 20
2 O2 s; n- n" M0 C) X - #define ITCINTEN_SHIFT 216 s# M: `1 }+ e
- #define TCCHEN_SHIFT 227 M0 I/ X' z$ \8 e7 A* q
- #define ITCCHEN_SHIFT 23# ]. q! f" Y7 I, B7 I( m* d; Y
$ V" H8 r' U* e- static volatile int irqraised1 = 0;6 X7 P' r7 M Y) u7 i. a. h6 s7 s
- static volatile int irqraised2 = 0;
8 f% ?0 L- n6 O: c, y
4 ?' b8 ~# o s: T# j6 N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# k* { O$ Z; b6 N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- C; z1 P/ U$ I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 p2 y+ l) O0 J$ F! h. b
& y; o8 @' ~7 w& ~) ~ ]2 I- dma_addr_t dmaphyssrc1 = 0;
P6 ~( l0 Z6 ~! x4 P0 H# R - dma_addr_t dmaphyssrc2 = 0;8 r* y6 v& ?" g% w/ k+ Y6 ]( H
- dma_addr_t dmaphysdest1 = 0;
" k5 ^! h& w+ y/ B" \' Q$ ~ - dma_addr_t dmaphysdest2 = 0;4 L8 t' M* }. z" b$ G
- 7 i6 t2 F! P. Z1 _; l& D a
- char *dmabufsrc1 = NULL;: X2 r5 e0 h$ c
- char *dmabufsrc2 = NULL;* y; D- d2 N' g- z S
- char *dmabufdest1 = NULL;
$ S) O9 S/ d9 ] - char *dmabufdest2 = NULL;5 ]1 P% x6 k# Z( u4 y( R
6 e' C$ }8 H$ T+ Z% N- static int acnt = 512;4 \' v% O0 _. k/ Z) i
- static int bcnt = 8;
5 |' |& Z8 W6 T - static int ccnt = 8;
+ A$ @( @& n3 b0 Y# S - 3 w+ @; X7 u1 x2 }1 ?
- module_param(acnt, int, S_IRUGO);
7 s& O+ s+ o2 I2 Y7 A# z - module_param(bcnt, int, S_IRUGO);
3 U; _' _# A: ]8 Q* S$ M. o - module_param(ccnt, int, S_IRUGO);
复制代码
# c& ^7 F V( c6 Z! D* p/ H0 Y+ f4 [9 @- r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. R0 u: t T( G; P& |& Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# j8 r+ Y; m, n5 ]7 _" M" e/ [' s" `' s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ e( Y3 @$ h" O
1 d! u# r) S- i; w( y, m- |4 u9 L/ ?
2 Y, {; T0 ^& ?) O! C5 E |
|