|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' F" w$ u' B8 X8 _( A
- [code]EDMA sample test application7 M8 @! E" P. a- s# q D. U
- /*8 H/ g4 C; e+ r
- * edma_test.c
6 X1 \' i' H- u4 L - *
: ?) @% g7 j8 M6 A - * brief EDMA3 Test Application/ ]2 z; j& h3 Y0 b& p5 z
- *9 l6 K: U9 x5 ^: A
- * This file contains EDMA3 Test code.6 z7 U5 s5 G+ @2 E2 `5 w# o
- *2 `2 j# d6 x# |* m$ L: _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- T- I. ?2 {3 B( X z7 w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- R/ T. y" V0 i
- * TO CHANGE.0 C: D I6 Q/ Z3 {% U
- *
; h, z/ R# S4 t+ l6 ^) i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 C& Y i- f5 P5 ^ - *6 y' p' P' F. g
- * This program is free software; you can redistribute it and/or# d1 p9 g0 G; W) J5 N
- * modify it under the terms of the GNU General Public License as( G* m1 \+ n* C7 w- C
- * published by the Free Software Foundation version 2.
) H7 _: n A# Y, D+ H/ s - *
8 ?: d6 O' |* [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 a! d( w [- ]. e T" ]% D
- * kind, whether express or implied; without even the implied warranty% N3 ?/ g% J, @2 [# q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 P6 t: ~% [. ~3 B/ ?6 x - * GNU General Public License for more details." Q; R# I3 U: ]* P C8 z+ O
- */' i* Z2 m# O# j5 o0 ?8 l6 z/ `
- : h; ^* {7 n; P$ v7 k
- #include <linux/module.h>5 X& S, A. L9 L0 M
- #include <linux/init.h>0 e. B( J, n; Q- X, e$ f, y' i
- #include <linux/errno.h>
- f' b& [! L) I% B" f* |' G - #include <linux/types.h> p1 e' e4 |' |0 ?. N
- #include <linux/interrupt.h>$ P; y% ?" Z' w
- #include <asm/io.h>$ {" i6 l6 @% c: u# @: l
- #include <linux/moduleparam.h>
& _$ H+ F- T, P. h - #include <linux/sysctl.h>+ ]) g! x0 S4 Z" p+ K
- #include <linux/mm.h>
8 t! U( b8 y& M8 D! |, W$ r - #include <linux/dma-mapping.h>! i3 |: u! z; i3 p I
- ( W6 k# k! x# j% ]& M0 S
- #include <mach/memory.h>+ d6 a: j0 X+ d3 g! k
- #include <mach/hardware.h>
" |' ?$ n8 l5 X! g5 M+ v+ b- E - #include <mach/irqs.h> z8 l+ e% S9 j
- #include <asm/hardware/edma.h>. ^ f/ U2 R1 i- o m6 h
/ z; [' c" A2 x" k$ A) e- @5 n) ^$ A1 ~- #undef EDMA3_DEBUG
4 A1 n: D+ Q1 R* B8 n1 a - /*#define EDMA3_DEBUG*/7 `( z$ l: M2 I1 G5 O8 L6 ^ b
- 0 j5 w, `# _, f5 I5 Q3 b
- #ifdef EDMA3_DEBUG* w$ u! n' `4 k9 W& ~, }, b+ @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 k5 O* K6 j( e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% P$ \4 S" H6 n) f) M0 K* E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 q% j+ X- U" x5 w& ^
- #else2 m3 h" y0 g$ B" w/ Z3 Y' k- z8 h
- #define DMA_PRINTK( x... )
9 ]3 N2 e j, ^0 P' ` - #define DMA_FN_IN
$ j* G8 |3 |& Y: `3 u - #define DMA_FN_OUT
) N3 ~6 M" E% t - #endif9 u9 f( c8 P" l: S1 z% ^' d
0 C# R+ V" C8 H/ s( E! C- #define MAX_DMA_TRANSFER_IN_BYTES (32768), l5 {5 P; B8 p; y: ^' U
- #define STATIC_SHIFT 3; T4 W- k Y6 @# `2 _% k4 T" ?! u
- #define TCINTEN_SHIFT 206 l# x, D1 {/ l8 `9 c9 r6 G
- #define ITCINTEN_SHIFT 21
8 `# V. B! X, b) \! ~9 ~9 q+ n& u( Y - #define TCCHEN_SHIFT 22! P2 w' l' H `
- #define ITCCHEN_SHIFT 23; F. X6 c9 R! [4 m1 K( ?. t
9 G9 u8 Q. D# |% P& ?% X0 h- static volatile int irqraised1 = 0;
9 c7 q7 T; n. U" m$ J$ m* } - static volatile int irqraised2 = 0;
4 |& w# u! l; U - # N& T' O8 s. A5 t' s8 h6 N l9 B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 M% X8 ?5 O. T. D9 z& m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- d7 N! n- A7 o r1 o7 m: ?+ q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
g5 i6 M- Q# g2 p3 v) j2 C - " F' ?1 O- ^ N6 T& W/ ]' S
- dma_addr_t dmaphyssrc1 = 0;/ b, E4 |2 V, C3 @
- dma_addr_t dmaphyssrc2 = 0;6 T0 s! D, g+ Z- v. l8 c/ H
- dma_addr_t dmaphysdest1 = 0;% p7 m) k! e' w7 f- |
- dma_addr_t dmaphysdest2 = 0;
8 R5 U2 L5 L- Q% @
- c. ^, }# _ ]8 N4 B# U- W) U7 ^- char *dmabufsrc1 = NULL;
$ b; l6 g/ V7 G, Z/ b( o - char *dmabufsrc2 = NULL;
6 U/ f" R) C% k' w1 b3 L - char *dmabufdest1 = NULL;" o R8 F# L- h& f- ~. v
- char *dmabufdest2 = NULL;% Z' C y' i8 S- j: o
- $ E/ H& l: q7 L7 w
- static int acnt = 512;
$ S: z( U2 E6 N$ D0 y - static int bcnt = 8;
- ^$ [3 R9 D) J5 z# n2 W' { - static int ccnt = 8;
- X7 @, i$ N8 D9 j! V: M; A - " `) d# I% A+ C6 K* l8 f# }
- module_param(acnt, int, S_IRUGO);% @* Y( G' S! K2 N! e
- module_param(bcnt, int, S_IRUGO);
; Z% P3 b, c( C - module_param(ccnt, int, S_IRUGO);
复制代码 * |2 }% E) }) h
2 C5 F4 J, |, `5 r7 x: B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 o5 p) Q2 I8 k8 i2 F& F. ~8 ?
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: v* t0 l: q- @ c5 ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( ~) O _: B- B6 B- \3 ]. V& N
: b, m9 _0 U: b" I/ g/ K. z( x7 f; E2 d
% Z3 @1 e, i- y( }. H |
|