|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 i6 b9 G" n# p& I- [code]EDMA sample test application
' Z: ^0 a: M$ F, K- c( M - /*
- F- r1 F0 o$ V/ x/ R* @ - * edma_test.c( p. F* u! l$ V9 ?! q) |+ j
- *: ~- g c1 n/ v( j2 n3 _- |
- * brief EDMA3 Test Application
2 V* H& }- L: X6 N' P9 n { - *
0 V$ U! N0 z" T* @ - * This file contains EDMA3 Test code.5 B/ c! p$ }: p$ C2 F3 Y; ?& Y
- *
4 f& ~# C6 B% @# `6 ~: I2 ?/ m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' g$ \# Q+ W, ?/ K9 D8 y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 m0 Q: m" ]9 u- J+ T3 u! I
- * TO CHANGE.3 I4 {: s& {! T% r1 p1 P
- *
% X" x. Z) U% F4 N5 \9 @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( @* v% `, a: s( ?0 N5 C
- *$ j1 Y1 l* P! X: q9 l
- * This program is free software; you can redistribute it and/or
3 y5 ]2 I( o" d r: H: w - * modify it under the terms of the GNU General Public License as- Y( V) O! ^( K6 H p, {
- * published by the Free Software Foundation version 2.
- q& y$ N8 ]6 b8 o6 H; | - *
/ w! L! \, J( t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) N5 c8 [7 U8 L9 ]: ^* N, b& S - * kind, whether express or implied; without even the implied warranty
0 [! G3 x, D: t% C9 G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& }( l% u9 }0 N
- * GNU General Public License for more details.
5 s4 |2 ?+ N% [; _5 `, n - */* t( U8 h2 p9 P x2 A2 Q
- 7 n! Q3 H1 N$ L" V- d
- #include <linux/module.h>3 C2 X ^( J: |1 m8 W. s, L
- #include <linux/init.h>) i; x6 r0 M7 K( i1 @
- #include <linux/errno.h>
# r* u" |8 @8 Y9 B% c- q0 | - #include <linux/types.h>
8 d* D7 q, H5 I/ l - #include <linux/interrupt.h>0 B7 U! }& E4 e# {. T6 v
- #include <asm/io.h>
2 z, F7 H6 g7 w# M" ~ - #include <linux/moduleparam.h>
3 W8 N. Y' F0 t, w3 o" H - #include <linux/sysctl.h>' S/ z) L1 f O$ T( D0 Q; G9 D
- #include <linux/mm.h>
0 [2 l& u$ }) A; m U1 O - #include <linux/dma-mapping.h>
3 g1 t- D* r. X% i: e0 E5 |; Y - 8 \: }9 j: X, _( s8 Z3 `0 P
- #include <mach/memory.h>2 u3 O6 B9 |2 A" e' R h; ^
- #include <mach/hardware.h>
' U3 @( L/ O% n( V) H3 h - #include <mach/irqs.h>( e4 f+ g! k( p; C! e( k( U
- #include <asm/hardware/edma.h>8 n# c+ o: J0 i0 N
5 | f/ a1 J% z: v- #undef EDMA3_DEBUG6 Y5 @" m* O; p+ o( Z
- /*#define EDMA3_DEBUG*/. v$ y3 _" m2 s! f1 t1 n, [2 a0 N
) x3 _; r- M: z/ s" b7 K( |- #ifdef EDMA3_DEBUG
1 @: e: ^6 c1 l) m7 p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' K/ X C$ `+ U# {9 { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' R+ y" }2 G1 \. o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" U" w# H9 P6 k$ I. f _. F2 }$ V - #else
! _0 t, `% M' Y0 o& w4 Y - #define DMA_PRINTK( x... )$ W# r& ^, q' o3 V2 n5 U
- #define DMA_FN_IN
: F2 h3 k+ `6 D0 v! f - #define DMA_FN_OUT
5 ]% t/ j [& `6 R; b/ b6 T7 R6 a6 @ - #endif% z$ ~! j+ Z% F+ b( d
$ m7 [: k5 U. g) z2 ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 |$ M4 K, \: }) ~; A$ Q - #define STATIC_SHIFT 3
# u% g5 m% S4 A4 M - #define TCINTEN_SHIFT 20
, Z7 R: [, ^: z - #define ITCINTEN_SHIFT 21
' \6 \$ }4 L% H7 i - #define TCCHEN_SHIFT 22
W! V; z+ O' Z& F3 [0 ^ t1 X - #define ITCCHEN_SHIFT 23+ U: j$ _; M: p8 x
' t7 b: a# f d8 Q3 C- static volatile int irqraised1 = 0;8 l# P1 {2 m; D) j4 `3 G- S
- static volatile int irqraised2 = 0;
! B0 i8 d C0 Y+ j
, [4 A7 \) e1 P# P9 y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 ~; D8 ~; i/ j u, p( t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ F4 N; _" c8 k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' s5 Q2 c+ q3 W) [3 y - 6 ]4 n) ~ V" p/ V3 t ^9 z% b
- dma_addr_t dmaphyssrc1 = 0;6 T6 H9 l l2 u
- dma_addr_t dmaphyssrc2 = 0;
6 s3 l/ q* c3 C* ?3 V - dma_addr_t dmaphysdest1 = 0;
0 D/ p1 e' K8 g& k) V6 c" [% a - dma_addr_t dmaphysdest2 = 0;0 m" x9 a$ k1 Y( e3 ?# j( F
- ! U. R u/ w. L/ q# \, R
- char *dmabufsrc1 = NULL;
/ E" ?# d1 z; |+ e2 @ - char *dmabufsrc2 = NULL;/ v* l' Z' @1 j9 c" O
- char *dmabufdest1 = NULL;
- [+ d+ Z* }/ s - char *dmabufdest2 = NULL;
5 H! n1 S% \8 ^/ W. d - / o: e8 {4 F/ }. x2 ]9 w) w
- static int acnt = 512;
6 O! E( U. K+ l7 X - static int bcnt = 8;
6 h4 L6 c& F: _" p$ ~; s, b - static int ccnt = 8;/ P W) C/ q7 i7 I3 S# E" s
% {3 P6 k) j7 k0 ?+ E, @& |6 r- module_param(acnt, int, S_IRUGO);: T+ Q3 F: p7 D. Q5 K# h
- module_param(bcnt, int, S_IRUGO);+ G9 m9 c4 c3 z, _
- module_param(ccnt, int, S_IRUGO);
复制代码
7 m3 M( H& g Z" ?8 U1 {# r: n: p
7 v, {" U/ R! L4 \ r' {: E/ M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 I3 {0 e& G# T0 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* `: J }2 B8 F7 ]! `& I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- X, f/ m0 ]5 k* _& `, v
- u f, x. {: `; S4 O7 S+ q L H3 u4 q1 X- L
|
|