|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 V% B4 a2 I! v; w' A) T: p
- [code]EDMA sample test application
4 B& w' Q% g% n8 A3 U! B: d% E - /*. v# E' l3 F$ ]! G+ Q+ G$ z9 s# \
- * edma_test.c
; G S% a" N$ Q- y! A9 @ - *! J4 M6 Q* G! i+ m( y: l
- * brief EDMA3 Test Application
% r r8 r/ H, `) W* x% K - *. \! A1 D! Y- b( q; q. `- T
- * This file contains EDMA3 Test code.
1 c' B) e+ f- Y, b% V$ Q - *
2 V B+ S! F/ T" v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 i6 ^) ~, T+ f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 I7 D U' D2 [3 C - * TO CHANGE.# L( x) r! w) p3 t0 b
- *
6 c' r. W* O8 a& r# j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- u' m$ D/ i, c+ y7 D - *% O. ^. ]# \6 z! ?9 n' @1 e( ]
- * This program is free software; you can redistribute it and/or- g# S, ^/ \0 H
- * modify it under the terms of the GNU General Public License as
3 p( Y9 y! J9 `/ y6 S0 e/ P- j" r - * published by the Free Software Foundation version 2.
7 e: Y5 _! ?8 W) a3 c% L - *
( j, s+ o& _+ T0 h/ `' Y$ O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ g% c) K" c$ q, b& T! l
- * kind, whether express or implied; without even the implied warranty+ [9 S9 K) Y4 E- y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 L5 O) k p/ j4 w$ Z - * GNU General Public License for more details.
4 C" |: Y5 a3 B. M, a - */
; [: X. t; q1 ~" d/ X( X - 2 d. O& R8 E" ^; A" d, g1 C- X
- #include <linux/module.h>5 J! K2 L+ r' q2 z4 D
- #include <linux/init.h>+ X- p* B, w2 c$ m8 [' ]- m
- #include <linux/errno.h>9 i- H* \0 m" P
- #include <linux/types.h>
3 a1 k' H8 n, p- [) T; b6 |2 \ - #include <linux/interrupt.h>! Y" l3 }# A0 P# V3 R1 t; Q* {
- #include <asm/io.h>
/ I' i7 f9 a9 S+ j - #include <linux/moduleparam.h>% J, y3 _. m/ [7 W) \8 }
- #include <linux/sysctl.h>
! h* ^, h* v- S y8 E+ j% p - #include <linux/mm.h>; G: ^+ g4 A- z9 I: z) k" V" ^
- #include <linux/dma-mapping.h>
% i6 J4 F9 E8 ^7 Y6 v - + M- k: I4 ~0 m
- #include <mach/memory.h>
( X" Y, l7 R9 p, c9 `, _" ] - #include <mach/hardware.h>
T7 J% X, r; S5 z' t - #include <mach/irqs.h>
9 h/ Y( \% U9 U: v6 z9 M5 v. U - #include <asm/hardware/edma.h>6 O! R" `9 i B0 W) D7 c+ g6 q$ g" t
- # @5 w! T8 K4 M7 V; r
- #undef EDMA3_DEBUG
: q% r2 @- O7 _. c! g - /*#define EDMA3_DEBUG*/0 `1 \ S4 w- Y( t
- / v; I# [. F1 N. j
- #ifdef EDMA3_DEBUG/ K" z" x. U% n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 P4 Z. N, i: U z5 _3 M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 |8 q2 ]6 p8 h+ @: Y% o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 S; U! r3 o) h( L# ~' f" f
- #else/ u# d1 a% V3 W5 |* j# Y
- #define DMA_PRINTK( x... )% h+ l& J& p0 f
- #define DMA_FN_IN/ I2 N8 `/ c' G! \. E
- #define DMA_FN_OUT
7 x* k( i$ ?- N5 [" ]) i - #endif
0 q& V- f6 ?/ ]. U, T E" L
1 H d# g( y Q5 ~; E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
]3 h. e8 c# K! I - #define STATIC_SHIFT 3/ d1 ?5 [- d+ Z
- #define TCINTEN_SHIFT 207 y7 a) V1 {+ F) x* P+ I; l. n! E
- #define ITCINTEN_SHIFT 211 Y/ ~0 r: f/ k
- #define TCCHEN_SHIFT 222 Y, p% g( Y# }- _* h4 s: x
- #define ITCCHEN_SHIFT 23+ _6 d X) `; G6 V! S
- + K5 E6 H9 e, A7 W
- static volatile int irqraised1 = 0;$ U) `- D f$ s9 {: P6 G' P
- static volatile int irqraised2 = 0;
" `8 p3 v- V" C9 h! r1 z
( b. U+ r# ^& K& G. ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; B" y! a6 K% G, ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ t' I1 q2 m: W( Z; c- N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ K6 |5 w) g2 L2 E) l. R' e - # J% u# a% H0 k% I( u
- dma_addr_t dmaphyssrc1 = 0;
8 j9 X3 p0 @7 J: _ H$ L - dma_addr_t dmaphyssrc2 = 0;
& I* P0 V% x, V9 Y7 m5 O0 R" R7 e) ] - dma_addr_t dmaphysdest1 = 0;! F- L; b; { ]
- dma_addr_t dmaphysdest2 = 0;8 U3 `/ x$ {' s) G: ]/ \
- 2 V: g* E n& C+ d
- char *dmabufsrc1 = NULL;0 g4 T% i* ^8 d. x I c
- char *dmabufsrc2 = NULL;
8 S3 \ L2 s+ \6 q- p; |) I - char *dmabufdest1 = NULL;6 Y# i2 Z* f& b$ u1 C: O2 i
- char *dmabufdest2 = NULL;1 p) i0 l& u, H6 C$ s- c: Q
- & u, Z( P7 Z8 X6 X K
- static int acnt = 512;
: A! x4 G s* J! ^ - static int bcnt = 8;7 `. Q8 o4 \6 j! W6 Z$ z R
- static int ccnt = 8;
* L6 ^; @2 p2 P* u$ s - - M' B1 T9 e: [1 c
- module_param(acnt, int, S_IRUGO);: m! {7 D$ M- j2 b4 S' y6 o0 a
- module_param(bcnt, int, S_IRUGO);1 c- L' A# y" a/ G8 W& D
- module_param(ccnt, int, S_IRUGO);
复制代码 % V1 ^ ?* h6 l4 o
) ?: K E! O: ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. [, Q! F9 n9 J/ T* [# ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ f3 l. G) j3 I9 M. L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* v9 G J7 b& ~) T. P! u
% N; U5 {1 w9 G9 x0 o# O
8 y |1 {+ ]( A2 c5 Q( ] y; N A% |
|
|