|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! ?! I5 _! s/ K L4 B" C
- [code]EDMA sample test application: i7 p- ~) k, ~. C1 @! o+ |
- /*
- i3 H1 J+ x8 c" W2 f - * edma_test.c ]; ^; c X; ~4 U
- *
& R% t' h) k$ I - * brief EDMA3 Test Application4 z/ ?0 k: [0 Q' A3 L
- *
$ T i+ {3 d7 d0 T D* f2 F - * This file contains EDMA3 Test code.' X) e0 _1 k/ W. _5 o r8 {
- */ ^: O1 N) E. A3 n/ ~3 R- g9 D* m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& E4 J, i3 l3 g: ^! J7 W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ A3 l$ m3 y. }8 G! g4 W7 f7 U - * TO CHANGE.. N F7 Y) `$ E
- *
% N# T4 w+ O4 U5 v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 k1 J' R5 p7 _ - *, w# b. c, W5 k: X' t' X
- * This program is free software; you can redistribute it and/or% N: L% U3 J( c7 _7 E
- * modify it under the terms of the GNU General Public License as) i( t+ W! O8 {# S6 E: F. g Z! C. H
- * published by the Free Software Foundation version 2.
2 i r0 Q; }2 C7 z - *
4 K6 e' G: O# C/ q/ w6 f P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 M1 g( F4 `( w7 G2 @2 T' _/ {
- * kind, whether express or implied; without even the implied warranty4 L0 F" r8 g9 }' f# C2 |8 U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- f& O" z2 R. X; C - * GNU General Public License for more details.
$ q* k9 ^/ W4 E$ R9 P) j$ L! g2 ? - */3 n O4 X ]& Z5 B# ^0 C
. ^- ~7 N% ~$ k" Q5 M- #include <linux/module.h>
+ E- K4 n4 L6 n' e - #include <linux/init.h>
/ l' n$ P; B3 D O3 x$ y- w - #include <linux/errno.h>
6 B. K" C8 t, S4 g8 J! u/ N - #include <linux/types.h>
, Q) J: T% T; [1 e - #include <linux/interrupt.h>' n" ~- c3 ~! I8 g8 n; L7 M
- #include <asm/io.h>
2 x" ^: h- t$ }2 X" ]* O* N - #include <linux/moduleparam.h>
) D, @' K* Q9 j - #include <linux/sysctl.h>" U1 O, ~$ W k- ?
- #include <linux/mm.h>! x8 U R$ r8 m, D! N* S- l1 z
- #include <linux/dma-mapping.h>$ {& f- U8 Z* ^# q; d
) ^& S& h& C9 ~) c; P4 r, C# c9 |- #include <mach/memory.h>; O$ l$ S" V3 Z4 h' ^0 I1 G1 [
- #include <mach/hardware.h>
: A: r# o9 \6 {; ]& m" u' F - #include <mach/irqs.h>1 ]1 g6 h9 b, _% N; E* I
- #include <asm/hardware/edma.h>
$ k* H0 {6 y% s' h5 m - : G+ @3 J9 }) h. @5 a' [, L
- #undef EDMA3_DEBUG. S/ l' I) K. Q3 D1 a+ b( ^* O
- /*#define EDMA3_DEBUG*/
, u- j! c2 A, j. h2 H3 f% q - 3 T# _& [3 P" z' q: m4 R
- #ifdef EDMA3_DEBUG. o* X' o3 O( T' G( ?! ]/ Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' n) H4 `; f# e$ F( r9 W5 o6 [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 x. o( R( H% k1 {5 x% y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): m# j/ s6 }9 t' s, ^+ S, z
- #else+ w% M" a( d; u6 |2 s/ v/ t
- #define DMA_PRINTK( x... )
+ @! @* Z- Y, ` ] - #define DMA_FN_IN+ {' p0 k6 W! t1 v8 P
- #define DMA_FN_OUT
! @ k# g9 n o' J$ t: l - #endif
7 V1 D$ v. P6 f. ~ - . f+ W H/ U' ^" I8 C" e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
R, h. y0 @5 G! W E% X. E - #define STATIC_SHIFT 3
4 _- m- |; w2 @' p; K6 w* M - #define TCINTEN_SHIFT 205 K7 f1 m- P% G
- #define ITCINTEN_SHIFT 21
/ L: }: i3 M1 k0 A# D - #define TCCHEN_SHIFT 22
5 U1 S. l) J/ R3 T - #define ITCCHEN_SHIFT 23
+ \, H+ f5 X) t/ C z - 7 ?6 s8 K. e# W& E
- static volatile int irqraised1 = 0;
; N; x& _7 W6 z: }: }& G9 h3 V9 X - static volatile int irqraised2 = 0;
6 a; ?5 l |5 m - 7 P5 P( b; o4 n* v2 k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! A4 [7 q0 E% {+ C* |% c8 M! t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: u# t- b1 q5 M, c4 Y9 [3 Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: W a+ d. i! Z( p2 b5 R) p6 `8 O
0 b% [/ A- A- T. {) Q- dma_addr_t dmaphyssrc1 = 0;1 A7 ?/ N* `7 g" e2 u
- dma_addr_t dmaphyssrc2 = 0;. C0 F8 J" `1 Z+ D, w0 R1 }, ]
- dma_addr_t dmaphysdest1 = 0;
- p) u% Q# L' s! \ - dma_addr_t dmaphysdest2 = 0;
! a9 Y* Y* @3 u' q3 G: m h
+ S9 C2 M* w- V, R/ @# U- n) h- char *dmabufsrc1 = NULL;( f7 q- a) o$ K s' |+ F; y* ~1 e
- char *dmabufsrc2 = NULL;
% t; y2 j! R U7 A/ W7 g - char *dmabufdest1 = NULL;
, P, K% t+ i' x5 d) p9 D - char *dmabufdest2 = NULL;2 e* u" [; r# B2 ^
- $ J @9 R$ a! p3 ^9 v9 |9 h
- static int acnt = 512;
& D! }4 T \5 a0 g) E - static int bcnt = 8;2 T8 y4 o* e3 t; _ A0 A% g9 }" I; Y
- static int ccnt = 8;5 W' R R' j8 k6 Z4 J' U
- / i r: h9 @3 V1 }4 e
- module_param(acnt, int, S_IRUGO);; ]4 Y# T9 B: |( e: d
- module_param(bcnt, int, S_IRUGO);! ^. C, a1 c2 U$ K
- module_param(ccnt, int, S_IRUGO);
复制代码 2 q" w# i3 ^- f8 i
' V6 x- z9 `/ C9 U4 L! H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; q( h: r4 ~+ }/ R4 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ B, v5 V+ t$ w9 k* T4 H( ^6 X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ u4 B; j0 y8 R
; W2 ^& j6 M- L& H0 P1 R
, Q6 i; r( _. D( M7 D8 M |
|