|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 V! C: N9 P u. s* k- q" g* ]6 o
- [code]EDMA sample test application
2 W- A1 n7 r9 m) O& K. ? - /*7 v( b1 j9 s7 T- S
- * edma_test.c: I8 ~$ ^' ]1 E
- *- i0 p$ R: E: t. b+ ^2 F4 C: I" L
- * brief EDMA3 Test Application
: R& e3 p* Z9 Z; R/ n - *
- X5 W2 h2 K& K4 s5 t' o! v& ^* G - * This file contains EDMA3 Test code.
4 p' F8 c1 M8 o. R, t8 b - *9 s1 @$ _! C! s4 u) F1 \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' y" ~- }. o/ W/ I& {; K8 a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 O. D9 D3 l7 ?. d
- * TO CHANGE.* k2 t8 S9 u* I" O- X+ H
- *- E: t* [, E$ _$ ~6 c! f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// h) _# K K! a# W [9 v
- *1 j# M- v, t& K. w5 A" _9 W: r
- * This program is free software; you can redistribute it and/or
r' x$ u+ O! n/ {* L - * modify it under the terms of the GNU General Public License as7 h* ?/ O: E. p
- * published by the Free Software Foundation version 2." Y2 T8 ] I/ ?
- *
+ M; T0 s: X* k3 `9 h# v' n& H. q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- a: w& l/ a4 i6 G5 N# v* i - * kind, whether express or implied; without even the implied warranty/ k5 R! L% B7 ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 E6 ~! f# i* E - * GNU General Public License for more details.* S' w z7 ~. D& c9 p
- */
3 g' h$ s6 [; p5 S: J - : j* t6 \; y |2 T! v* [: U
- #include <linux/module.h>
3 S, J E9 B" i1 R; y - #include <linux/init.h>" g* k& t1 }' E3 c
- #include <linux/errno.h>7 D8 h, L" |0 q% ~
- #include <linux/types.h>5 L5 x2 i% {) s' X1 M. \ b
- #include <linux/interrupt.h>
8 T) y- u5 n. N) D. S7 V - #include <asm/io.h>
3 F8 l) W- b0 ?& `) z0 S2 Q f - #include <linux/moduleparam.h>
( _0 H# s: A2 U- s - #include <linux/sysctl.h>. c% F1 q' x4 m% N7 D8 C
- #include <linux/mm.h>* t+ f! Q1 C1 F; N5 s& ^
- #include <linux/dma-mapping.h>
. A2 D2 `3 R% c% h; C - 0 L7 y( _ t6 y
- #include <mach/memory.h>
: r4 T" z; w6 F( p7 U - #include <mach/hardware.h>
( B. l! G. d9 s8 G+ y- ~; c - #include <mach/irqs.h>
6 O2 N2 `. n/ u! z. x( O, \. V1 Q - #include <asm/hardware/edma.h>
$ J8 l8 }& o, Y6 b4 r% Z- o4 F$ |5 T
; [% P/ W8 T2 O" Z5 W2 J- #undef EDMA3_DEBUG& j; K4 b+ `1 M* J- A
- /*#define EDMA3_DEBUG*/$ m( A0 ?. i- k7 N4 v
W3 ^8 \; D* {# T0 n( a- L( r- n8 c- #ifdef EDMA3_DEBUG
, @9 R# {! I' O+ X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) B4 P) Q; ^6 F3 c) i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 h& D7 G; H' F' O. c j5 |5 P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' ^- h5 }) i0 J
- #else
" |9 U' z$ O y6 G - #define DMA_PRINTK( x... )* i: |" q1 m9 X" b( p/ ?5 ^
- #define DMA_FN_IN( E8 V( m. d& e' z9 |* J
- #define DMA_FN_OUT
3 U7 q- Q; l5 _ - #endif
, e+ |3 ~) o% u+ t8 `4 H - ( F' \- K# D3 y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- b8 D9 B4 T Y5 E - #define STATIC_SHIFT 39 Q( j! J" U, Z; `7 ]0 X% x9 Y
- #define TCINTEN_SHIFT 20
; J4 H" l2 k4 L1 ~# y D4 L% q# L - #define ITCINTEN_SHIFT 21
3 ~ C# k$ o: f- Y - #define TCCHEN_SHIFT 22
$ q, n/ J2 D7 \/ D - #define ITCCHEN_SHIFT 23
8 n& f$ Z) e9 i' e8 g+ @( z
- ?1 \7 ~7 \$ W1 O! J0 M- static volatile int irqraised1 = 0;
( C, k) A/ {% I: F; R - static volatile int irqraised2 = 0;6 h" L; T6 B+ U: p1 u* o
- ; T5 ^# x& c* g k0 _+ |4 a" J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 U7 n: W1 H# j4 P$ w& M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 k+ T! e; [ ]1 F1 p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; z2 C5 E. s# h2 e& V8 Z- B - 1 T' B6 f- G4 m- Z( J. A5 y8 ~
- dma_addr_t dmaphyssrc1 = 0;
& z; K' n7 Z! f4 r - dma_addr_t dmaphyssrc2 = 0;( K! L2 m0 K0 Y' _
- dma_addr_t dmaphysdest1 = 0;0 A" U1 u, G/ v, F! f; x. }
- dma_addr_t dmaphysdest2 = 0;1 [' p" `9 [5 `% a9 \6 s% |, f& @; Q
- ' d. z! e" [) m( l1 ~
- char *dmabufsrc1 = NULL;* U( `1 D! o* e2 {5 [8 e/ Z
- char *dmabufsrc2 = NULL;# N6 [- n3 L1 G: h! g
- char *dmabufdest1 = NULL;
4 V% n7 S6 S9 d+ K/ W9 P - char *dmabufdest2 = NULL;
! |1 o4 a2 ~( _9 S9 s0 ?6 i9 ?4 f - ) m( X* |2 H0 k3 D% Z! _6 U& F
- static int acnt = 512;
/ T! r$ z/ k e1 P+ o - static int bcnt = 8;2 m, w) J1 p4 k% i
- static int ccnt = 8;* l/ ?8 M' k! L+ R, `2 x
. H2 R- G( r# E- n! l" @7 i4 _- module_param(acnt, int, S_IRUGO);
9 H _3 T s& z7 f4 f) |2 `' B - module_param(bcnt, int, S_IRUGO);
- P0 v0 W2 P( n9 \ - module_param(ccnt, int, S_IRUGO);
复制代码
. f# `3 G T. Y- e+ y+ p* a/ c- V% ~5 K* Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, c8 @; t. f$ m6 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 L+ x2 o! `! T& E% x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 e: K$ r1 w; s9 d
. D$ f0 `4 x0 J& L
" q! a: C% I8 h+ E0 Y) z2 p6 O
|
|