|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 P$ c' i/ W4 [; Y# |# t0 W
- [code]EDMA sample test application: g0 ]: V6 F! z- c4 J8 E5 R1 s
- /*% p) C6 |$ P5 r8 x. t
- * edma_test.c' ?' c1 p0 }: B. j+ M U
- *4 r% J6 o# P7 f% U
- * brief EDMA3 Test Application0 A$ V. s' s' F h3 n+ B4 k$ n
- *
3 {9 e) ~. u/ Z8 x( _" @) q0 J - * This file contains EDMA3 Test code.: j$ o/ R$ \$ Q1 E2 z
- *
( \) i$ M3 ?5 W* a3 c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ b! @5 E" x" J- @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 w ~" G, k8 {2 R$ R - * TO CHANGE.7 U/ d6 C k: E: }
- *
# w |; h7 [' J0 N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 s/ Y& _/ B: p( | Q; d; ]
- *
@( x$ I( |4 F/ f' { - * This program is free software; you can redistribute it and/or! k$ T7 B+ V% i! w* y- A
- * modify it under the terms of the GNU General Public License as
6 B5 o& U" q3 h" _( \* c7 k - * published by the Free Software Foundation version 2.1 f. O* {" H2 [
- *! [* P& ]* Z! E1 s" S. q( c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 k. J8 Y. Y6 X: f' P. c D) @ - * kind, whether express or implied; without even the implied warranty
1 V( o& n- H- _' M+ H. W9 a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ e$ H' t, k7 Y5 U3 { - * GNU General Public License for more details.1 a: S5 h5 {) W7 c6 H
- */
- w, K, X% \2 t
9 G2 Z$ a) |: [; t! ?5 `3 i- #include <linux/module.h>9 }# B" c z3 t o( U
- #include <linux/init.h>) l4 a# H% m/ D% ?, ]# f: G: e
- #include <linux/errno.h>( P" }0 g8 d; Z/ r' L
- #include <linux/types.h>. |+ w% z" }3 e+ Y# f# W. ^
- #include <linux/interrupt.h>
$ G2 S7 F! M5 U3 e - #include <asm/io.h>/ L K9 u" l- G
- #include <linux/moduleparam.h>- y. @ d3 P% T# G- b
- #include <linux/sysctl.h>% S2 c% h# Q6 ?: k. Z( C
- #include <linux/mm.h>8 s2 p) a+ ^9 b( K2 a8 x9 ]
- #include <linux/dma-mapping.h>
& K, H; c; L0 {% u6 d
' k7 l& Z4 j2 l2 A: L- R' A- #include <mach/memory.h>
& @1 V( }" @) t; {" |8 @/ ~ L$ o3 S - #include <mach/hardware.h>! c0 P) e- h" B* U. x
- #include <mach/irqs.h>
" y" k/ ]+ ?# a+ I - #include <asm/hardware/edma.h>- B4 Y; h" q# }( A& @& ^) u% R
- + A5 x v' W7 f$ J& m, T6 D
- #undef EDMA3_DEBUG" }8 R$ T6 P7 A/ d; [9 w' Z
- /*#define EDMA3_DEBUG*/& J6 L0 M( Z/ u8 j( {; W3 |
- ' W8 B" i& s- `0 Q- D6 r
- #ifdef EDMA3_DEBUG
7 M v5 {; Q. h/ g( Y: A) g( ~- Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! x9 u6 D2 k2 t) p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 F3 N8 k" y% w5 j U! H( N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& l# v0 U$ |6 e. X8 {# [+ P - #else4 I$ r& {4 X7 E o& F* T
- #define DMA_PRINTK( x... )0 w$ \1 v6 A8 f; E. E
- #define DMA_FN_IN/ P8 N6 X. X) W8 R" R+ u
- #define DMA_FN_OUT
8 M7 s- e9 b) P. P - #endif1 X6 `( J s& m8 G0 X! p5 E
- ! u, t- |( t4 Q0 n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& ` ?6 w( h7 e. }- b$ ? - #define STATIC_SHIFT 3
' ^* b/ v* H% a. Z* K - #define TCINTEN_SHIFT 20* q/ v5 ^7 J7 X! D1 R G8 @
- #define ITCINTEN_SHIFT 21. T) _8 m) J2 `8 |- y+ ^
- #define TCCHEN_SHIFT 22$ u* N' S, D* a# C8 i) x4 o
- #define ITCCHEN_SHIFT 23; {! W; i5 @' s( ^& H& G
' D' F2 S% ]# n$ v1 P( Y7 ?- static volatile int irqraised1 = 0;# g6 \0 k5 k5 f1 E" A5 `
- static volatile int irqraised2 = 0;7 W7 _+ Q) t# s5 G4 x
% J; |5 k+ u' ?# M+ i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); l- z" s- B' Y* @2 ] u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 H) D" D6 N) @7 u* Q, |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ g' f9 }( S" ?5 ]3 t+ Z
- . X% O7 r) ~- F8 ^
- dma_addr_t dmaphyssrc1 = 0;/ \; r6 V# i/ e0 f; d+ P
- dma_addr_t dmaphyssrc2 = 0;, Y4 g$ L p& h+ U9 K3 ]
- dma_addr_t dmaphysdest1 = 0;
, t& Y* ]8 T9 k# u - dma_addr_t dmaphysdest2 = 0;
+ |0 a: e0 L. T$ o- X( l- `2 e
% ~; n3 V$ A3 a- char *dmabufsrc1 = NULL;: |6 q) _4 @! w+ J2 a: q$ Y: ?4 N
- char *dmabufsrc2 = NULL;2 A) ~3 I, r Y! P2 w5 _% ~! z
- char *dmabufdest1 = NULL;8 Z" u; W$ Z- V. e
- char *dmabufdest2 = NULL;
8 P; l* Y* B. ?4 v4 D; W; ] - / i4 T7 q* w1 o0 I+ p/ [; f5 V
- static int acnt = 512;3 a. A/ s) t: A. O4 F
- static int bcnt = 8;5 P; R {# q8 h$ h3 q# J/ b
- static int ccnt = 8;3 F4 @# ^6 ^6 L$ R' n
- ) k3 g' X3 {) D9 `4 L" G7 r/ A2 y
- module_param(acnt, int, S_IRUGO);
[5 ] N* T) A6 k/ a% @/ c - module_param(bcnt, int, S_IRUGO);
' t {% w6 G& [: Y: _ - module_param(ccnt, int, S_IRUGO);
复制代码 / B" U* { P! Y# I) n/ X
. {( V9 y V4 u3 C7 l2 H' \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 E4 }/ P$ ]* F+ _9 m0 K; J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 G# Z( _ `8 n' }" P7 @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 J4 O4 ~, r: O; G: ]+ _) b& z5 K
/ w0 b6 Y b1 M
' `/ K' ^7 i) y7 e; N7 X- f
|
|