|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 D3 n9 c" A6 m: H( F5 J: E
- [code]EDMA sample test application
/ O* k7 ?4 O2 F/ `! M: ~ - /*( u& j5 j% ?- @/ w7 y
- * edma_test.c
& P4 I5 f! \( Y8 b: K - *. @" ?1 C8 b. l) \# n
- * brief EDMA3 Test Application
, ]6 m9 `4 ~! C: ]7 ^ - *$ k+ I$ O J Y$ J- g" a) B
- * This file contains EDMA3 Test code.
U ~3 p: R0 y3 L - *
+ ~$ B0 \0 t& ?0 } {9 _# a7 U. g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( l# ?, [ V k8 o0 o. O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 J6 }$ m4 @ d' N' m( ]4 }5 V' Z - * TO CHANGE.
% h6 e4 b4 v! k$ e/ U - *# l0 _- |8 O& X6 `: ^( u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 k1 u" w- W0 V7 W8 f v; V) `
- *" \' w) J3 \& T( @+ o2 P: ?5 I$ {
- * This program is free software; you can redistribute it and/or
: C" {7 n7 n1 w; d8 S4 O - * modify it under the terms of the GNU General Public License as" ~. p$ a+ `+ n" v7 U6 G3 }
- * published by the Free Software Foundation version 2.
: u/ S0 s6 j* W! y, Z7 t P - *
. O! f& p, L2 H3 l; Q4 t: w0 e2 S/ Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 e$ k# C: q: O9 ]: R
- * kind, whether express or implied; without even the implied warranty
; r; @, u% y9 W- J6 B$ k1 o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 @' x4 S1 m% s. [2 h2 n6 E7 z) p
- * GNU General Public License for more details.
& {( E }, e5 `5 M - */8 j9 T9 d. V5 Q- D6 J" c6 A$ K: m
7 t* @+ u6 L- |' k3 ]8 z- #include <linux/module.h>
0 [% w3 U8 S* \2 P3 ~1 F7 \8 j - #include <linux/init.h>
: U9 ^0 e6 _; f4 ?& D9 D1 F - #include <linux/errno.h>
5 b/ G- E6 \. K( K N% E- x* O$ t - #include <linux/types.h>% {6 v7 C, r1 h& b. R; n( r
- #include <linux/interrupt.h>
6 R" j1 a; C5 S% u9 @$ ?; D - #include <asm/io.h>
0 I* P% |+ O: W1 D' i6 w - #include <linux/moduleparam.h>
* ~7 b/ G A8 U - #include <linux/sysctl.h>
! u2 M0 J) T# P L9 e D# X - #include <linux/mm.h>
6 l6 }- y0 ^! ?+ \2 x3 i- l l - #include <linux/dma-mapping.h>
- S' g8 m* l, W3 P5 L7 H5 m1 w# p
8 b6 U; R5 N1 X8 t- #include <mach/memory.h>
) k f; v+ |3 Z+ w9 |0 k* ]# r, | - #include <mach/hardware.h>
e' V. t) ]. S( V- r* u - #include <mach/irqs.h>: S$ L1 K) i X& @- _8 H" R5 T
- #include <asm/hardware/edma.h>
$ m: J- k& M3 a- |5 V
- f* R9 s3 ]/ X% H! t5 }6 h! Q2 G* S- #undef EDMA3_DEBUG
9 r- b8 g7 O: [; l/ c - /*#define EDMA3_DEBUG*/
! n$ ]0 l) Q- M* c8 {% K - . }; a: p, b& Q* I
- #ifdef EDMA3_DEBUG
1 b+ {' Z' I6 h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) W; b1 P4 p7 \* u5 n) E" m. n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# O$ _0 ]6 z) W+ t& J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( w( d$ O& b+ K g - #else
4 H x9 r& I/ G& U4 c0 y" i( q% W3 q - #define DMA_PRINTK( x... )! t9 Y+ B& D( W8 x
- #define DMA_FN_IN' X0 q3 B0 K, d# H1 V! Y: W
- #define DMA_FN_OUT
+ k3 G$ Q/ G4 f8 E, G& Y - #endif' g0 x+ r) v5 v: @- ?( o4 P5 b' |- n# f) [
- 7 Q+ E0 f% P9 K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 X8 T% [/ E) K% o/ J2 q; A
- #define STATIC_SHIFT 3$ a+ g, ]* [& d; }! |/ t
- #define TCINTEN_SHIFT 20$ ]* |6 y* Z! j. V4 M1 L- w
- #define ITCINTEN_SHIFT 21
. E6 a8 h) L! E! Z - #define TCCHEN_SHIFT 22
$ z3 v5 n8 C/ ]& o7 }4 Q8 K% t# c, I7 U - #define ITCCHEN_SHIFT 23& ]3 P3 [& _' N
7 N5 h0 h+ |! X% W0 Z! T8 k- static volatile int irqraised1 = 0;; T4 ]2 N9 t5 R1 C* @7 }
- static volatile int irqraised2 = 0;
2 d: Q, \. {# x# _2 h. V+ a) y; p# M
$ d- Q, `2 j* z% s+ b: h8 F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 r7 Z) Y1 v& V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: E+ C. s- F: a8 C9 f* v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 u3 @. B7 N- }! B6 k
; q/ }0 N4 `8 [3 h' M- dma_addr_t dmaphyssrc1 = 0;
% ?) x H+ M/ q7 D2 W: [& ? - dma_addr_t dmaphyssrc2 = 0; W8 ~' L5 X; W2 k7 H
- dma_addr_t dmaphysdest1 = 0;
' I1 c5 o& J* S - dma_addr_t dmaphysdest2 = 0;
. m2 f u, ]1 a1 w. y - $ S9 x: I6 w1 f! s6 s
- char *dmabufsrc1 = NULL;
: u! N8 L- [# A( d- {. u: X) s - char *dmabufsrc2 = NULL;
# @& X9 Y$ b+ M# _3 U5 | - char *dmabufdest1 = NULL; E3 O Y, Y6 u+ D2 m; B- j
- char *dmabufdest2 = NULL;; s4 z! M9 k" C9 t* l+ J
2 L e. ~4 w# w* N% w% x" {- static int acnt = 512;
y$ |3 M8 c( w# ~+ r( ^ - static int bcnt = 8;
& U# G1 u+ M! E/ e! [, _6 ^ - static int ccnt = 8;
% e+ \+ k" Q- `; j: a6 z
6 h6 A: [5 p7 ~( V- module_param(acnt, int, S_IRUGO);
* ~( |; K: O" ?, Z+ W6 r+ L& p- q: l9 ? - module_param(bcnt, int, S_IRUGO);
& ^' z. p* ]" m. \: ?: D$ s - module_param(ccnt, int, S_IRUGO);
复制代码
9 x9 S1 V8 B. t" N5 L" j! [& d$ ~% `, P6 @; m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; s7 G7 C- t$ F& @3 x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ B6 E# e$ V$ Q0 V$ m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ b, n! _3 t: Y4 H# [) ^% @
0 T- j2 i# o# x: P
- V, c( `3 e5 T$ J% T( i: a0 q |
|