|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( l9 ]! \; D& E' v- [code]EDMA sample test application1 M- v# W5 W: l* {
- /*" ^% ]3 h0 E, i0 G- ]9 L
- * edma_test.c
1 M$ }: {/ m, V; q - *4 c1 w1 B/ x( m5 M4 b
- * brief EDMA3 Test Application
4 f3 Z0 j! R: H6 ?) _7 y1 x - *) o# n7 v3 T4 y- a W1 b
- * This file contains EDMA3 Test code.
" E* W/ I- G' q( i! q - *
8 T( e4 q, m$ a! f# g0 D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 S. L3 v% u# n! a% m) O. o g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ o! L" P6 ~, @$ J
- * TO CHANGE.
% D+ b3 C* B- [$ U; Z5 ~+ Y - *& |6 Q9 Q5 @+ A! W' f4 ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% a6 g9 g3 `/ l4 i
- *
! i. L+ |, X8 ?, T - * This program is free software; you can redistribute it and/or
9 v" g4 F; c! P9 l - * modify it under the terms of the GNU General Public License as! s O' ^" X1 x- k Y
- * published by the Free Software Foundation version 2.
$ `( e1 h7 a: ~* I9 O1 V - *
. |' ~- \2 r& n O8 c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: { R! O" Z7 i) N
- * kind, whether express or implied; without even the implied warranty
( l/ f& i3 d. {2 f- n, l2 Q# c# E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ E- E m3 e- i5 [8 m9 q
- * GNU General Public License for more details.9 q* P2 h8 R! N# _% h0 y
- */
4 Q/ |# }8 k; M& V9 ^1 U# ]! n
) V& ^: l) f0 K' g" V4 h- #include <linux/module.h>4 z5 [0 U. j' m9 R- Q+ r
- #include <linux/init.h>
6 r4 V, }+ p4 g1 @- C% g; q - #include <linux/errno.h>( Q* M5 r3 U4 F4 z6 l: T/ }* Y3 W
- #include <linux/types.h>$ ~ B% w& t& e
- #include <linux/interrupt.h>$ k' O& [# G1 ~
- #include <asm/io.h>
: n6 i9 I* g2 o) R: P4 g - #include <linux/moduleparam.h>
5 A, v4 j& @' P, Z& L j - #include <linux/sysctl.h>
/ A; j; X! j% z' B/ W - #include <linux/mm.h>" J3 D Z, D$ z
- #include <linux/dma-mapping.h>2 _' N% a' A6 \2 ?9 r1 j
) i5 K8 t& }8 E ?- #include <mach/memory.h>0 J/ J0 B6 q/ c% g
- #include <mach/hardware.h>- ?/ F7 t' [6 T J4 F
- #include <mach/irqs.h>
$ z& e" n8 C: y' r4 {- d - #include <asm/hardware/edma.h>- ^3 p- O7 A" e0 a9 A6 }
( l2 a- y1 w+ Y! r0 k% f6 Y- #undef EDMA3_DEBUG1 s, W, o5 ~: h% e% k: I: J. Z) D
- /*#define EDMA3_DEBUG*/% v2 t$ K$ z9 R A% h6 I0 p
- . ^0 _: z# s0 w8 Y0 [1 H
- #ifdef EDMA3_DEBUG$ e: C+ R" v3 d9 b/ s3 \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 Z5 z4 i Z- I3 _( J0 i! A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ _/ S# j% a$ g/ K8 z6 x3 E6 {3 q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 j0 v0 D: z/ }" E! Y2 B# ]' e - #else
2 K9 Q8 {' W# V9 i' Z: m+ p- m7 A - #define DMA_PRINTK( x... )
0 B) T. B6 F4 s - #define DMA_FN_IN3 y6 c6 A" b& M/ K' r
- #define DMA_FN_OUT! k! G; T$ J6 ^" r8 P8 a! t4 L8 [
- #endif. t% \0 ~! E: p, X
- - s, `# v! i; x6 M( m9 O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" F! j3 D, h' A - #define STATIC_SHIFT 3
4 C8 G2 k& H4 w8 F. e - #define TCINTEN_SHIFT 20/ [' Q$ d* \: O+ e0 M
- #define ITCINTEN_SHIFT 21. k, \ B O' @8 [
- #define TCCHEN_SHIFT 220 ?- T) O" X! i. w' g
- #define ITCCHEN_SHIFT 23$ \; M# C. U9 q) c6 J4 \
, a$ b! b% S5 X0 `2 P( v- static volatile int irqraised1 = 0;9 R9 f3 d- Z) w, I" ` |$ B
- static volatile int irqraised2 = 0;
J( ^# l0 Q* P/ V) B' {" { - 3 x: B# y( |2 V1 n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! S; T. {. w$ _7 ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ C" W O% w+ i/ h( ~- f7 p. s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Q4 J, A- Y4 X
- ! S. g i) J. z# [
- dma_addr_t dmaphyssrc1 = 0;1 z0 R2 q6 f2 S9 F2 r6 F! h
- dma_addr_t dmaphyssrc2 = 0;
0 y4 l3 F. v ?5 ]1 ^4 E6 X - dma_addr_t dmaphysdest1 = 0;
; r+ x% X( w) N& P - dma_addr_t dmaphysdest2 = 0;
8 U' O- u( G- ?7 X0 j - ) ?4 w- ~' V0 W M' u
- char *dmabufsrc1 = NULL;% f( q+ M0 ~+ N
- char *dmabufsrc2 = NULL;8 q/ P# ?% g% N- g% P! X
- char *dmabufdest1 = NULL;
$ m( E- K8 Z' d3 o- e - char *dmabufdest2 = NULL;9 u% |5 ?# d9 t" Q w4 `& E$ x
- ! ?- N9 E0 S! j0 h' M$ V1 j) b
- static int acnt = 512;
1 O7 }8 m# R' a2 b1 B3 C; K: q - static int bcnt = 8;$ u6 ]3 u8 P: d+ g0 b
- static int ccnt = 8;
]' `+ r7 p% f9 P/ B9 T8 p
' o5 b* N( A- @ N- module_param(acnt, int, S_IRUGO);) I$ E+ B/ d% I3 j$ g& z
- module_param(bcnt, int, S_IRUGO);
, j0 i" t& l0 g+ s! X - module_param(ccnt, int, S_IRUGO);
复制代码 + i- [3 `, E9 \; v1 @4 G
6 M4 q. c! P7 ~$ _5 E8 G b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* r% R9 x4 T2 U. b0 r5 C! S: uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& q1 N5 Q' `- \% Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 d, }) C: v2 N+ b& H+ s/ S' d
- R9 ^1 n' G4 U8 I. O! I% F
|
|