|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 a# j" g. B% |6 R) U2 l- [code]EDMA sample test application. s8 T, s2 }; z4 V- V, y0 S
- /*) G# A1 r( M9 c# H( r. S
- * edma_test.c/ t$ O. T9 @6 e; C: m- i
- *
( S: s& \" S C4 }0 e% Q# [# ]0 E - * brief EDMA3 Test Application2 ^: H/ L0 b/ `. I
- *
0 i. F5 N6 z5 I3 k+ T - * This file contains EDMA3 Test code.
2 ] r* S( n# A2 K - *" @) R% P- |& p5 v$ f7 T8 n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 R, S: |2 x( ^3 T% x$ E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) L5 l+ R7 v1 k8 m2 e* ~ - * TO CHANGE.
0 a" P* @2 S& _+ a6 T2 L; W - *, K U1 h. ^! ^0 c p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- | X+ w7 ]$ C; w! ~! H8 v6 r
- *6 _4 M0 p% W/ D
- * This program is free software; you can redistribute it and/or! _8 {) F3 D; j0 \1 t% x
- * modify it under the terms of the GNU General Public License as9 f8 K* X7 Y2 ~ ]
- * published by the Free Software Foundation version 2.
. e$ h0 z1 z$ p5 N - *
& g3 K8 ` Q$ _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 K' {( S8 K5 F3 i
- * kind, whether express or implied; without even the implied warranty
' K9 E) B: L+ S2 i( w( e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. K/ c- s0 Q/ O% i; C- h* ~& q, m
- * GNU General Public License for more details.
, k. J ? p4 R" O" \4 T - */3 M7 l% m1 C$ B; ~8 m" V
- : @& T1 I; D1 T! _4 Q+ z# n
- #include <linux/module.h>
! r$ G d. C( z$ V - #include <linux/init.h>0 X! s! D9 @) @- x
- #include <linux/errno.h>" H% y1 E6 Z: G* Y
- #include <linux/types.h>
1 T" F* V" I% O- h - #include <linux/interrupt.h>
: n( g k$ U! c5 u - #include <asm/io.h>' e% l6 z: K- s+ W1 k
- #include <linux/moduleparam.h>
; t }' n" Z% q( N, \$ k! H9 o - #include <linux/sysctl.h>/ |* [. H8 M9 O: ~; {' i4 U
- #include <linux/mm.h>+ i, p9 q1 X$ ?5 r9 I8 h0 K+ A& }4 i
- #include <linux/dma-mapping.h>, `! B8 `7 Q% \ Y* u
o6 T: s. m9 @; p) ~! ~# J- #include <mach/memory.h>1 M2 N) U2 C; Z$ S. G+ I2 o
- #include <mach/hardware.h>7 T# q- P5 f/ K
- #include <mach/irqs.h>9 v5 v j! B$ J4 @4 V6 V
- #include <asm/hardware/edma.h>! W* U! S ^& k' |7 V. N' G
% V: P. ]. r" U5 ^" d6 }9 Q- R- #undef EDMA3_DEBUG( W7 S. k {1 p" m
- /*#define EDMA3_DEBUG*/; @7 O% ]# T6 ]# q' }: K. ?: C% h/ D
; X* ^# u; N* d0 `: F- #ifdef EDMA3_DEBUG
% s" |0 x; o& Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 _7 X9 p) Z) C+ L0 _) e4 e# O L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& ?" U5 }# p2 [; y1 ^, K, o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# O2 o @- ]% h W- [ - #else
0 N3 k- N. j. R - #define DMA_PRINTK( x... )
, T* @. ?, T, d6 s" N/ A - #define DMA_FN_IN
. E/ W4 y* W0 L0 q0 e - #define DMA_FN_OUT
3 i% `3 Z7 @% a3 z - #endif5 o/ a4 E( b# S o/ `+ g R
/ e- K9 t5 @$ r+ @0 T- W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 E* e8 g* g% v, D7 f - #define STATIC_SHIFT 3
8 @5 B: k7 |. H: G7 Y" {8 ], ^ - #define TCINTEN_SHIFT 20: \0 l* @& M* r5 Z2 h: e
- #define ITCINTEN_SHIFT 21
6 Y! h; a- E/ `& X f5 V - #define TCCHEN_SHIFT 22
, X3 e9 |( }* O+ v3 ~- r - #define ITCCHEN_SHIFT 23
9 T0 k0 R1 a8 V, b; N0 T* T. T
) z5 p$ q. R- U9 v. }' h" E- static volatile int irqraised1 = 0;
3 b" O7 A; q5 |1 y - static volatile int irqraised2 = 0;& v0 e! {, Y8 |5 y2 G0 D8 w
- 8 }) @1 c6 p( L( _$ Z( {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* M1 ?% C$ P( I- a v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% H7 I* J' ^7 |8 r: J, n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ]4 Y( [ Q( E* h d
- & O& s! }1 G& h% v+ ]
- dma_addr_t dmaphyssrc1 = 0;3 h$ d& n$ R2 g7 T, ^$ y! g
- dma_addr_t dmaphyssrc2 = 0;
: Z# _7 b9 T+ t. G# x - dma_addr_t dmaphysdest1 = 0;
( x- L X" B, M5 P( [! w - dma_addr_t dmaphysdest2 = 0;
* L' z3 l) _/ ^& c
# \$ D: n4 G+ b- char *dmabufsrc1 = NULL;/ N# z e4 |1 D2 h% r8 h. F7 Z
- char *dmabufsrc2 = NULL; c% C( Q/ T7 E V2 |
- char *dmabufdest1 = NULL;
6 S5 V# C3 F5 I7 }. X; ^! v8 [# G+ i - char *dmabufdest2 = NULL;
$ i! |7 u" R8 j! i9 F5 M! z
8 Q% @. t( I7 o: F* A# Y- static int acnt = 512;
7 A$ F, Q0 L& k5 ?% r5 X9 R9 V - static int bcnt = 8;2 U( A3 q \0 Z* Z( O9 V3 X9 Y
- static int ccnt = 8;9 P2 a' d$ m+ k
- 7 h- d2 Q: J# W0 P1 i( M
- module_param(acnt, int, S_IRUGO);
4 w- _; [. n. s: S& N. b5 [! \) M - module_param(bcnt, int, S_IRUGO); V. u% o4 }$ m- Q( P- ?2 Y$ h* G
- module_param(ccnt, int, S_IRUGO);
复制代码 ) y( y2 S. j. m" E( U u* }+ f7 J7 v
, m/ ?% k$ w9 a% Y( x3 K2 y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: R6 n# t h6 C' D, t% Y/ P* Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% x9 h( t, C; j2 |' N& ]2 { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! Q( L: p1 C! m- t# t( V4 _: f
' T& e5 M% b2 c6 {3 W3 V5 M/ E
: E# k, _" i" R( |- u |
|