|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' |# p( {5 @5 _6 E
- [code]EDMA sample test application: w, e. d$ |; P) Q
- /*, x. {8 H7 i$ h' Y7 v, M
- * edma_test.c, L# j# w `. P; Y! g
- *
5 T( ~1 u: A* k, p$ y - * brief EDMA3 Test Application8 f q+ w+ C' z7 ]2 l5 P$ J
- *
# C2 G/ r5 g3 v; t+ A6 d - * This file contains EDMA3 Test code.+ T$ G. ~/ ~; ~6 Q
- *- P- ?! l6 D8 l0 @! e( u& `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; n) P g2 \' _0 g1 [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 F" y' \! x+ ^8 d0 h
- * TO CHANGE.( z& Z% Z9 S: e
- *+ h. Q/ |' h, C }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 u. K3 s3 D* P/ E$ } - *3 A4 U& Q% ~" T7 C# ?' L
- * This program is free software; you can redistribute it and/or
2 \8 K3 D' B- o; N# u - * modify it under the terms of the GNU General Public License as
9 _4 b4 Y0 c+ U( ^8 X - * published by the Free Software Foundation version 2.
. D2 u& V( o4 a h* m - *
8 E7 h; c4 n R) T/ C# v8 P7 n; y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# I5 x! F) L# _8 E
- * kind, whether express or implied; without even the implied warranty2 y! S& Y* @2 p) ~- [- L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the b# b0 y5 E8 f9 }
- * GNU General Public License for more details.
9 `- p5 h% d9 x' @2 }' ^ - */
+ [6 L& D9 s- Z - ( l/ ^0 ]* q. z% }/ Q
- #include <linux/module.h>& y1 W- X& q+ ?2 t- o
- #include <linux/init.h>$ z; s% \" _% {8 e$ @
- #include <linux/errno.h>
( `( @6 t' R! v5 d$ P- @ - #include <linux/types.h>+ E9 d0 W( n4 b% e' l# ~* {
- #include <linux/interrupt.h>7 c/ r9 [" m g/ [! S L. D- p
- #include <asm/io.h>0 R* f3 N) G& m- {) `
- #include <linux/moduleparam.h>
) q7 G2 @$ {, K0 c V; ?, d. Z - #include <linux/sysctl.h>: i% @( u. I1 q) x7 | q
- #include <linux/mm.h>$ E/ \. Z. N1 b0 p! M
- #include <linux/dma-mapping.h>
6 @7 W$ q2 f6 b* n
! _; x t4 L0 Y7 y" ]3 v( Q- #include <mach/memory.h>- r# ^ I: c7 o9 S
- #include <mach/hardware.h>+ c! X) S$ R* h% ?% t( u' D) [4 R
- #include <mach/irqs.h>: i* m( e% i7 l
- #include <asm/hardware/edma.h>
% Y; k* w j$ t - 6 T8 e0 l$ n c; l
- #undef EDMA3_DEBUG
' l$ C/ I# O) f7 R" D" R - /*#define EDMA3_DEBUG*/1 m- l: C4 e, l. v$ {8 o
- - F8 p3 [' T" d
- #ifdef EDMA3_DEBUG
/ C( x/ g# V: r' y1 N( j+ b5 Y6 G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 C& x9 Y+ ?: b2 _1 m0 }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 w5 I8 g" w1 F# e: ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) i, R! I" S# L
- #else
7 B' Q U7 }0 V/ W) i3 R) V' a - #define DMA_PRINTK( x... )
2 k( G$ x* j' R+ G2 @/ Y: x - #define DMA_FN_IN1 C9 U; K; l$ u2 B7 h1 w5 Y1 n
- #define DMA_FN_OUT
- t& q# X% r, q - #endif4 [& k1 G* d8 K; Z/ M
- - R% C) J& s/ a. ^5 \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, E4 U& B7 @' z! z# ^6 B/ \ - #define STATIC_SHIFT 3# ~2 k5 G" Y1 H
- #define TCINTEN_SHIFT 20
4 |, f; F6 _4 s. _, `' l - #define ITCINTEN_SHIFT 215 _ [: v7 p3 c& ]1 v
- #define TCCHEN_SHIFT 22
+ \- c2 [/ ~0 Z- a - #define ITCCHEN_SHIFT 232 w% f7 n( i. y6 n
9 C# @5 ]: p1 t/ I& |# b- static volatile int irqraised1 = 0;4 d8 B! v( v& t: g$ U$ K
- static volatile int irqraised2 = 0;
) k6 ^0 G+ A* c" ]. m, b7 Q: Q$ {
/ {2 Z8 s" m: U: {( H( M4 m1 N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& l5 ]1 z7 A# {' H' |7 L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 {' h! d( M2 Y3 m: K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* |8 p1 V1 `8 }& K8 O. C8 v
- T6 c# s) D) ^0 J: H- dma_addr_t dmaphyssrc1 = 0;7 O2 ]/ ~6 F& U$ W2 L
- dma_addr_t dmaphyssrc2 = 0;
6 c0 I9 V$ @" d - dma_addr_t dmaphysdest1 = 0;- W) C. d3 @" d8 O8 Y- o- `
- dma_addr_t dmaphysdest2 = 0;
! O4 x9 h& F3 l% W$ ]; N - : {4 ]2 z3 A( r# z0 o+ ]! A; O
- char *dmabufsrc1 = NULL;
|$ _0 Y, j- D" } - char *dmabufsrc2 = NULL;2 ~$ i" J9 q3 V, \, }0 u8 p/ I2 \
- char *dmabufdest1 = NULL;& B! t: [( u8 B3 S' F# H
- char *dmabufdest2 = NULL;
- e9 ] ` J; T; w - % i. A ?5 @6 Q: S/ A- `1 a4 J
- static int acnt = 512;
! D4 _5 \# D D' u0 ] - static int bcnt = 8;
0 F! g4 z5 |) V/ a; b, c8 t - static int ccnt = 8;
! n/ X Y$ t" i' U* E( N& O3 ]0 ^& L - ; ~1 p; ~7 H5 n7 |$ G$ O2 X# Y
- module_param(acnt, int, S_IRUGO);* D: ]) R. ?7 b
- module_param(bcnt, int, S_IRUGO);
( l4 T i# q( i3 z; m) k0 w, \8 p - module_param(ccnt, int, S_IRUGO);
复制代码
( V( ]9 x& W0 K1 D6 E% X. z# t, A; Q- Z+ c7 g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) A* o. W% ?* T7 D8 u0 \5 Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& S1 B, c! v! M2 S) D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- S+ X+ y) w+ A4 F. [1 f- @# g$ E6 T2 L1 h) j1 j# e8 `; v
6 Y" H! T9 k+ }! S$ b% X |
|