|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # F: |4 v2 [7 M" A0 l; o2 b
- [code]EDMA sample test application- I% F3 }: D5 b0 [7 X
- /*, j4 U5 \& Y3 B, b! s5 k3 X
- * edma_test.c6 j1 F9 A/ o6 g' y
- *1 Z) B1 P% L8 F$ }% b) |2 @
- * brief EDMA3 Test Application. ~+ q3 g6 Q- V1 A1 @ ]5 @) @" E
- *8 L# x3 M) M7 I; O1 {
- * This file contains EDMA3 Test code.
3 v: I" L/ u* V6 T x - *
( H4 l6 {# A% L: G/ U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 W, ~* X- v5 d) v6 U# o" `% e( H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) n+ E9 Q, C" v6 N- N* \; M# f
- * TO CHANGE.
' ~0 N% M3 p3 ~2 k2 W0 U. o( ` - *. ` \ _: k+ k4 @4 [' K9 E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 n! _4 J, R( v, P# L! U! I
- *8 [2 t2 f' W% |" g$ E
- * This program is free software; you can redistribute it and/or+ q2 j$ U- T) Q6 x: B
- * modify it under the terms of the GNU General Public License as# j. W$ c( Z. Q5 N
- * published by the Free Software Foundation version 2.1 i! Y' H5 B9 y9 u: T% K( B
- *+ |- V7 o7 u8 E0 ?4 P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# b' S, J. O' d; f) D) X# o( p - * kind, whether express or implied; without even the implied warranty2 k, e' i( _) G/ X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 w3 [1 a$ n) J
- * GNU General Public License for more details.
6 E8 y+ V" \- E* c - */, D5 }7 { h" ~2 ~/ {; l( s
- ; [1 l8 b5 @# T# O+ r
- #include <linux/module.h>
7 z. T9 W6 B0 u1 @9 q - #include <linux/init.h># p3 Y3 }4 [1 t3 E
- #include <linux/errno.h>+ X2 x1 e4 F1 o: i' c
- #include <linux/types.h>
3 K1 }" M7 i8 S - #include <linux/interrupt.h>
# _ @$ v% ], N1 O1 J - #include <asm/io.h>
# [2 N* _) i) u. Q" U1 P( K5 N2 m - #include <linux/moduleparam.h>
7 ] V- e1 d# F& `( } - #include <linux/sysctl.h> y# _: |9 v" C; i
- #include <linux/mm.h>& U6 a' M2 F- t6 h
- #include <linux/dma-mapping.h>$ N/ M% U( [; v% W# }# F
- + a, K# ?3 T' L2 V, n& t
- #include <mach/memory.h>
; P* n7 Y# t8 c, p! r - #include <mach/hardware.h>3 o( [6 A+ P L, f: }3 i
- #include <mach/irqs.h>
: p) o1 D Q @- P* C) o - #include <asm/hardware/edma.h>7 S& f6 A6 x# m8 x
: Z8 Q8 R& }% F `- [- #undef EDMA3_DEBUG
$ K& F/ ^% U! P4 ?# t+ ]! @ - /*#define EDMA3_DEBUG*/
5 _4 r3 _2 V9 A/ O# e
: }, h* O% _0 |9 H- #ifdef EDMA3_DEBUG
" z$ I. j3 r1 ~: [, C: K T& D6 z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, r2 Q( n2 z, f# ^# m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) g- o9 f" t: d7 `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 I- f- S5 a7 n7 e3 K8 k
- #else
, f% q- O- P8 x$ h0 ^+ F3 u% d* r - #define DMA_PRINTK( x... )
' `3 K* R% ?* f' U* B) F - #define DMA_FN_IN
; Z7 ~6 ?* `9 S" F+ H+ ~+ ` - #define DMA_FN_OUT
0 p( T) \% `9 }, S) w0 @( g' W9 L - #endif, [ |6 z! J1 u6 V9 k2 I5 U
- - e: i5 t8 S* l! b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# X, `3 O# O; ?9 S7 E - #define STATIC_SHIFT 3% J' V, O8 K+ j% ]8 O
- #define TCINTEN_SHIFT 20
* J# F9 M/ X9 k" j$ m8 A: L7 k - #define ITCINTEN_SHIFT 21
# M7 [1 `" H( F' L: ] - #define TCCHEN_SHIFT 224 d6 m1 P0 X) a. ?+ g: s3 [; H2 w
- #define ITCCHEN_SHIFT 23, {! V4 N- g" E3 Y4 H
- ( N" F i* t+ q8 O( @$ C7 `
- static volatile int irqraised1 = 0;
" ~; i, V5 w0 l. V, e& d4 z+ U - static volatile int irqraised2 = 0;# e; b* g% p3 \1 x! A
. V% \4 N% n* E& l7 e* s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# ]8 Z+ a: H1 A' B' Q2 t4 W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ }! {; R- S! B) x O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Y. A! t# ?( `+ R2 m$ y) [: t
2 T* e" }5 ?) D9 U" t5 ?: q- dma_addr_t dmaphyssrc1 = 0;5 _. Y# B9 e" d/ G3 e$ w
- dma_addr_t dmaphyssrc2 = 0;: I+ P5 Z( M; _- _! I
- dma_addr_t dmaphysdest1 = 0;
2 W! }2 t0 g; @) D% V4 i: X - dma_addr_t dmaphysdest2 = 0;! v4 t D4 X$ H
- 6 t/ f& s/ X- w% p: q7 ?
- char *dmabufsrc1 = NULL;. j4 B3 ?1 i7 M% [7 P; R, d
- char *dmabufsrc2 = NULL;
7 D9 w9 H2 B2 o/ O+ L4 g/ F5 f/ X/ h9 e - char *dmabufdest1 = NULL;
4 u( L0 l1 ~! U/ n9 h6 \ - char *dmabufdest2 = NULL;
! t8 }0 i# m$ ?" c r. [
2 @4 j! M" U# L* ~; n- static int acnt = 512;( k2 i, U( S# L) G
- static int bcnt = 8;
6 M: {! k" z7 u9 m, }) p; E - static int ccnt = 8;" R. k9 Y S; }
# P1 Y- g# z+ E' g- module_param(acnt, int, S_IRUGO);8 I/ r3 r1 c6 a4 h: b
- module_param(bcnt, int, S_IRUGO);. C% D @5 U) b9 P
- module_param(ccnt, int, S_IRUGO);
复制代码
) t- Z3 d2 [3 p+ s4 ^: ^7 O
& t8 Q4 }* N1 @) f) I: A8 q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 v' Z2 D% w$ L2 y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 [$ W& m) G& G: v! [) W0 ~/ Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& L# \6 q8 ~) e: E2 i, G* j7 b# G0 s9 }& s; b' w/ U
& @# V4 y# U* Y" g
|
|