|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% r6 V+ K) k! v- [code]EDMA sample test application
& B" r! O$ g, c( ]3 S - /*
9 n- E, |/ i( F- P9 C6 r - * edma_test.c
4 ~ ~: r" O R8 m( |; d5 o - *
- r2 w7 g3 k" F# F# ~ - * brief EDMA3 Test Application
9 Q0 d. `! u# E; r - *
4 b+ D2 x( l8 ?' a - * This file contains EDMA3 Test code.2 s' o# n" O- S' \5 M
- *
- ?. L5 u- t# b8 C# C' i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- `6 o2 C+ H6 P0 @/ t4 @' L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: w( e7 x' I+ W - * TO CHANGE.
l0 |: O7 A. }- O* {0 H6 y - *
- ]& E4 m$ b/ Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' | W0 E8 \9 B! [ - *
" g; O4 \ J6 p9 y/ h- c' ^+ z4 p - * This program is free software; you can redistribute it and/or
, T: Z4 @8 o& p7 ?& h# c7 n - * modify it under the terms of the GNU General Public License as/ ? H& i" J s
- * published by the Free Software Foundation version 2." |& X* {# c7 u4 }' \
- *
" ~5 y; V1 V3 t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 G7 p5 o* a( f* B( b. F4 h9 Q8 P
- * kind, whether express or implied; without even the implied warranty
4 \3 K( d7 a! A! ?: k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& F2 s# o$ |; ?& P8 j( @ - * GNU General Public License for more details.
0 J6 ^0 Y; z" a$ u$ x$ G5 a - */3 v4 o0 i( M9 M3 O- n6 `$ E
3 n# Q/ T4 o, M- #include <linux/module.h>
' c! b+ h( ?6 f/ a% R - #include <linux/init.h>
( h' x" C5 v- R/ P1 Q - #include <linux/errno.h>- J) k: w6 ]% v* v% T, u9 u
- #include <linux/types.h>
7 F5 ?* S, G# K# h - #include <linux/interrupt.h>
$ q* t/ b* |. F( x7 C: w6 c - #include <asm/io.h>
. L t8 O! X- A - #include <linux/moduleparam.h>% m1 {, H: g( `& |4 Z& q
- #include <linux/sysctl.h>
, i3 [+ K+ W! o; D1 B - #include <linux/mm.h>
% u1 T; S$ C& q6 C - #include <linux/dma-mapping.h>8 J0 ?, \- k0 s7 W; f
4 F2 J( Q8 I6 Y5 d0 [0 q- #include <mach/memory.h>
u* Z2 N, B/ ` \$ P* C- h% D - #include <mach/hardware.h>9 ^* y5 V1 ~/ h) O0 [
- #include <mach/irqs.h>* V1 l0 R+ [; s* B' s$ o. r& j
- #include <asm/hardware/edma.h>
( g2 C8 h( x- Z7 B }/ R
K4 [4 l" e2 X3 s: r9 u( w' J- #undef EDMA3_DEBUG
& @& S2 x' E2 C+ Y5 t - /*#define EDMA3_DEBUG*/- p: k2 f- K1 r
+ W- p$ o; w0 @3 `, r4 \- #ifdef EDMA3_DEBUG3 P. @& {5 P3 D$ c4 B& J1 \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). }2 i+ {& K" y6 U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 o: y. a* M$ k3 [+ a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' M( l3 _5 b, \# L l! H - #else
) [2 b9 \5 a3 w - #define DMA_PRINTK( x... )1 D8 F% F% O1 K, D" P! L. b0 `
- #define DMA_FN_IN
! z, {* p J( a! m - #define DMA_FN_OUT' U% I: Y# ]( G
- #endif& |; {/ N3 @. \- g3 w
- ' }; Y5 W$ D1 G8 O+ ^$ G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" v4 h0 |; }- f g$ {- S, o
- #define STATIC_SHIFT 3
' T" u* Y0 a/ J# c( H& } - #define TCINTEN_SHIFT 20
6 _6 n4 B" H2 a5 _: v6 \ - #define ITCINTEN_SHIFT 21& b3 ]9 ?4 j5 B2 B
- #define TCCHEN_SHIFT 22
* @3 {4 e# ^$ H! b: A3 n% H P - #define ITCCHEN_SHIFT 23
' ]1 `" R1 n+ O5 v# @/ O8 U
' D! e1 C8 z8 \! k+ R- static volatile int irqraised1 = 0;! X! R& q' k1 ]8 u% h+ H7 [
- static volatile int irqraised2 = 0;
* X2 I9 p( e5 M" d. R! y- g - 4 |- ]5 Q/ K( m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 G& K! p4 J4 [! q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% H* L+ w F. q7 A7 V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% p" Z" ~0 E* C4 m. C
- & R9 B/ ?, @+ I' y6 I9 r. |) y4 M: E
- dma_addr_t dmaphyssrc1 = 0;
2 Y4 o# s* d T( p+ ~7 l& S' L - dma_addr_t dmaphyssrc2 = 0;
# c$ a# k/ H- ], ^5 H3 s - dma_addr_t dmaphysdest1 = 0;
) W* N# V, p, f - dma_addr_t dmaphysdest2 = 0;/ h5 {# [8 W& a% s: c
- 6 K2 `5 @) J4 g5 d# z* \" _
- char *dmabufsrc1 = NULL;
! g9 ~, n& K' a9 v/ o1 n; `2 H - char *dmabufsrc2 = NULL;* P% _. C# M: `1 X
- char *dmabufdest1 = NULL;* T7 G2 b7 P% j' V' g5 c9 l
- char *dmabufdest2 = NULL;& k" d7 q# g) G: _
- / `( C) |% H1 E! Q6 `" [
- static int acnt = 512;. _& F6 w* _8 i: N5 O* T) E: C+ v
- static int bcnt = 8;
" U9 b7 S& F1 m" T - static int ccnt = 8;
; {4 }8 x; c8 _- G+ K" X
! i5 c0 [2 V9 G. X1 D9 m/ b- module_param(acnt, int, S_IRUGO);8 ?7 Z; |5 N" C9 I- k' L
- module_param(bcnt, int, S_IRUGO);2 h9 g. O3 c$ \: f H
- module_param(ccnt, int, S_IRUGO);
复制代码
$ q; x" D" }* i( i, t. D: Z% \ b6 X% r) a" Q2 a/ z+ a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" Q9 r# e: h" [6 i. l: L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- s3 W+ N. Y7 d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 N# L4 t' p% s- E) H
. j4 A* F; A |9 J2 U0 x$ E. ~4 ~% u! f5 r9 \
|
|