|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) t$ e' A ]4 d0 S
- [code]EDMA sample test application
0 f0 o+ X3 u% X$ L* r8 c4 `- H - /*
9 x" F+ d6 {. g1 B7 E - * edma_test.c( @ y! W. d' B4 {2 i n
- *2 X& U4 [/ A9 m; H) Q z
- * brief EDMA3 Test Application
/ E8 P; m* M" o, n' Z% T# o, [- e - *7 f: E& f# }7 O5 \
- * This file contains EDMA3 Test code.5 }& w, |! Z( E6 X. p( }6 ]- D# x
- *. H& p; k+ a3 x2 U# j% A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ o& ^# \( O8 h# p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 v S: b: i; v# I; Q' j - * TO CHANGE.
( e5 F: }% a/ b5 W$ c3 Q6 j - *& X9 t) s6 q; t; f H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 p& c. j- h5 {4 l, h: h$ d4 S
- *
+ t) \" l+ Z8 @( N0 y - * This program is free software; you can redistribute it and/or$ R% V: L* @0 C2 c2 N- w6 z# X
- * modify it under the terms of the GNU General Public License as
\( c$ w6 G: W- X0 d - * published by the Free Software Foundation version 2.
0 {. E/ B5 ^+ z - *
9 W, {& J" Y B- d6 P7 C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# g& K; y' o- s
- * kind, whether express or implied; without even the implied warranty
) S! v" S: A4 P. U2 k6 P+ q B+ o' C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) b! I4 e* n: F$ V( \ - * GNU General Public License for more details.; a: S1 ?1 f" k8 i
- */
9 m. I: t4 d/ P; }3 V
- O5 x, C3 m$ G% Y- #include <linux/module.h>
0 p U1 i3 e$ s0 U, H; H - #include <linux/init.h>
& R; A; r7 L0 }" @& f/ Q" E: T - #include <linux/errno.h>. R* ?; y# s: D# {+ H1 P
- #include <linux/types.h>
' e: n1 l& z. e; N8 v9 P6 I - #include <linux/interrupt.h>: d2 R0 L9 U x
- #include <asm/io.h>
! t1 a$ X, X0 }4 o- y/ P% s" Y - #include <linux/moduleparam.h>
, D, Q& a5 |$ D - #include <linux/sysctl.h>+ y+ ^9 x" r8 J1 s, D q: s' {# z5 x _
- #include <linux/mm.h>
# i" _* I; d1 H& |8 } - #include <linux/dma-mapping.h>5 g1 W! e( l8 Z% e3 A
- , ^: I. h6 p$ L' i: B; h* J0 K
- #include <mach/memory.h>
6 q3 I! o( w5 {# r - #include <mach/hardware.h>; S/ P1 L9 Q# \0 t1 w' i- |! y
- #include <mach/irqs.h>
: e% m+ v& J% M! m/ j; ~: {5 ? - #include <asm/hardware/edma.h>
$ Q/ f: p) \" o
4 f3 ?- ^' Q) K- #undef EDMA3_DEBUG
: k- x& |7 f8 z/ a x1 S - /*#define EDMA3_DEBUG*/
5 p1 U' d9 p; [7 I5 n, r+ u: {2 m ^ - * D& n) x; z0 N# m0 X
- #ifdef EDMA3_DEBUG; @) E: R1 ~3 B- o) y* x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 @" {2 o; r5 _! X/ A& I E
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), n/ ^3 L2 b' {! z n) R" G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% g% O+ k1 X" w# o; R. | - #else
0 R/ y- S, E* q" s1 K2 V9 f - #define DMA_PRINTK( x... ) s3 B! a7 k. r$ P: o- d1 P
- #define DMA_FN_IN
8 g T4 d' F" |0 o% b - #define DMA_FN_OUT+ l5 f+ T# }1 l5 z6 C
- #endif/ e G% v, R0 ]* L' {" f! h) |
- - R6 M: f, k2 s+ }/ t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ Z* F4 y+ } H4 Y G" c - #define STATIC_SHIFT 38 @/ f0 F% ?1 L2 H M
- #define TCINTEN_SHIFT 204 m+ _$ ^6 P/ D% z6 b5 b7 N! r
- #define ITCINTEN_SHIFT 21
' h- J1 p$ [/ T5 I - #define TCCHEN_SHIFT 224 r% |! Q- z% N t
- #define ITCCHEN_SHIFT 23
N7 z4 t5 s# L' k" Z3 S - 2 i! A' h* {& \. n0 m/ b# j3 Q( d! v
- static volatile int irqraised1 = 0;# k0 r: V6 q5 |( c
- static volatile int irqraised2 = 0;
2 G, v# N8 u" u% J# G
" m2 K G2 ^! K& o, L# `; P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 w) A8 z3 q3 n% {* y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 a, _6 {4 }" _! U& O9 F) F: i! G. L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); p# Z( j, g! p0 M- Z* V
8 L" o0 S: J$ j$ M- A3 p5 s# Z- dma_addr_t dmaphyssrc1 = 0;
$ q, ?* T; _+ n3 c - dma_addr_t dmaphyssrc2 = 0;
! p, p- U6 \# |' S - dma_addr_t dmaphysdest1 = 0;
* N: h' O Y' i4 j. M - dma_addr_t dmaphysdest2 = 0;2 b+ j# e; \$ V% N
- $ i) [0 k3 N# ~, B0 r- ]
- char *dmabufsrc1 = NULL;
9 p; m3 W# M% S3 q+ ` - char *dmabufsrc2 = NULL;" Y, b% o3 a7 c2 d9 c4 @4 p; ?
- char *dmabufdest1 = NULL;& z# O5 p5 C4 ?1 B, s6 B
- char *dmabufdest2 = NULL;
* H& B# T' }1 f. |+ D6 W - 0 W" n% ? ]$ M- D9 c/ f
- static int acnt = 512;
3 m9 v2 u( a+ }2 p5 X4 E - static int bcnt = 8;
7 |% n+ f. J5 \. O7 g- k. g - static int ccnt = 8;
4 g- Q: x2 u; }5 Q' U3 A2 u - $ c: m" a! A8 M; T" [ c9 J5 [3 {
- module_param(acnt, int, S_IRUGO);/ _6 U+ y, b) g' i& Q0 S2 |3 R7 Z
- module_param(bcnt, int, S_IRUGO);1 ?- I- o8 k4 ]9 c l8 e
- module_param(ccnt, int, S_IRUGO);
复制代码
2 k: d: l9 Y5 `+ y% Y" z9 R5 q% T
$ H- q$ Z- o+ F p. m$ B( z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& z; k# r! v$ e8 c# Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) h, v0 R4 {! ]8 j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ x* [$ o: Y1 U5 z, E
( C8 I6 z3 } j* w' s7 p3 Y8 c' s2 j1 v# v& G
|
|