|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 q: j) l) f+ z- W* A
- [code]EDMA sample test application
5 D4 r' h% `5 q; | - /*3 t* W% ^( i2 ]$ Z( ^
- * edma_test.c% h! O4 F0 I. @" ?7 b- Q8 N2 ]0 f4 v
- *- U) A9 H. j/ A9 ^2 x3 h
- * brief EDMA3 Test Application% m/ ]9 Z1 s% f4 a
- *4 r% P/ d4 p. v& }& P
- * This file contains EDMA3 Test code.2 Q1 ^ H; Y2 [7 ~' N
- *& l, v7 w* Y5 J% {- x, p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 ^4 G d. l, G) k9 E; ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 y6 H, V. L3 j2 K r
- * TO CHANGE.3 p. s, [3 G! q/ z! z
- *( c+ j+ N$ _$ j2 R
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' d' P$ O7 i. {5 A d - *; a3 k+ x4 Q+ ]* w
- * This program is free software; you can redistribute it and/or
; n9 r/ T4 Y8 E8 B - * modify it under the terms of the GNU General Public License as- R" }5 j( J. ^1 o; k, Q! o& N$ W4 o
- * published by the Free Software Foundation version 2. t& ^3 n( u+ |! y
- *$ W( m# g6 Z& l$ D: _8 P7 \- u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 v9 g0 m& y8 l, E Q - * kind, whether express or implied; without even the implied warranty
4 v5 I5 ^# T% I0 h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 g2 H" N" m7 T, y8 h) y
- * GNU General Public License for more details.
0 r/ I+ d4 @; [0 U0 D - */+ R3 y' D9 ]2 ]$ X2 f3 O$ M
1 ~& P+ W/ D0 \; I4 D8 d% z- #include <linux/module.h>
) i9 E; ~. A" L* G+ ~ - #include <linux/init.h>* C9 h, n" W8 I! J
- #include <linux/errno.h>
9 @: u- r3 T7 G3 M6 c - #include <linux/types.h>
8 j, L3 \3 o. q6 F- M) g - #include <linux/interrupt.h>/ v4 z4 c1 d+ w$ b
- #include <asm/io.h>
( I+ c/ [6 j) a# e - #include <linux/moduleparam.h>
+ n) L/ ^8 h! y+ h+ o - #include <linux/sysctl.h>6 @, u0 l1 Y0 K6 P
- #include <linux/mm.h>3 x2 M/ G5 H6 z3 G$ G8 P! @
- #include <linux/dma-mapping.h>
, r$ b! g; r$ n/ b- x& a7 U - ! I+ V: ~8 l6 O3 j$ i* Y
- #include <mach/memory.h>) @5 W( k+ O6 d9 I! T& ?
- #include <mach/hardware.h>
% Z1 Y8 X1 u" \/ h b* ~ - #include <mach/irqs.h>
7 I9 w5 o9 {7 S: J+ _& K - #include <asm/hardware/edma.h>
; g6 [" h# ^& W) c& ]) a ]# O
# o- S* j- a7 J- #undef EDMA3_DEBUG$ v+ i% D3 K1 |2 f
- /*#define EDMA3_DEBUG*/
: d0 r4 g3 p9 X+ H8 I: |+ K+ F @ - ; k# ]" Q9 p/ c# S+ n& ?" R0 T3 j. w
- #ifdef EDMA3_DEBUG7 K8 N/ \" M0 z3 E( o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 H% v- f2 C4 ?7 W. c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# `4 n. j1 C( Q' P. e& e1 C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& {, f/ i3 S) y% w# g( Z - #else: ?, d. o5 S8 x
- #define DMA_PRINTK( x... )4 ?; h5 a/ k: ?) u) P
- #define DMA_FN_IN) @& I6 x$ d1 f/ h1 E
- #define DMA_FN_OUT
# L, O# g7 x" G9 t# c0 v - #endif; d4 L$ n; J2 r9 b& V4 U6 q
$ Q% h0 j9 F8 Y% W7 r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ [6 M/ a/ Y Q# F
- #define STATIC_SHIFT 37 [4 t9 f2 X5 h. ^% \& L
- #define TCINTEN_SHIFT 20
& b4 V5 c4 n) N - #define ITCINTEN_SHIFT 21# O9 U4 ]% k+ H9 m& M8 h0 w
- #define TCCHEN_SHIFT 22- C) }4 P! G# p/ f1 d f) x
- #define ITCCHEN_SHIFT 235 V# i; V( E, j1 M
- " r3 x# e& B, d9 r3 J; {8 P
- static volatile int irqraised1 = 0;3 p" X$ Y( b! z& F( k
- static volatile int irqraised2 = 0;
9 }' P6 n5 a, L - 8 G+ o9 i) c J, d# M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% P' ?# f! T. l/ N* }6 N6 F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, L4 _/ F2 \8 _, l/ W- ~. P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' n* ?: Z: `! `5 h, `% M) G8 k/ X" S
- 2 d* _2 P/ m- m
- dma_addr_t dmaphyssrc1 = 0;8 h8 n8 g. c# s# Z" n: y! j8 [
- dma_addr_t dmaphyssrc2 = 0;$ x( X5 T" u5 d6 N
- dma_addr_t dmaphysdest1 = 0;7 h4 }+ `6 c1 M
- dma_addr_t dmaphysdest2 = 0;
2 E( V" r* W0 O- e1 o s3 D o& T! h - . }0 T! N0 h3 C% ^; y
- char *dmabufsrc1 = NULL;& {: I2 e" T9 L D
- char *dmabufsrc2 = NULL;
3 r6 j) Y0 m V1 t* a - char *dmabufdest1 = NULL;
8 r) \; ]) f5 n$ R& z }5 G - char *dmabufdest2 = NULL;
' O# T" O! r/ {: C/ o6 \
' d8 C7 E$ h9 h- static int acnt = 512;
9 s7 `! |# X1 l' R& Q# E8 K8 E - static int bcnt = 8; c8 O' |, p8 z
- static int ccnt = 8;
4 W2 h, h: M# X: g - 9 `- h% G2 ~" y* Y4 h; p3 `
- module_param(acnt, int, S_IRUGO);$ _3 V. b1 {3 i
- module_param(bcnt, int, S_IRUGO);. R- h* ~. P$ Y! Y: x
- module_param(ccnt, int, S_IRUGO);
复制代码 $ e- I" S$ s& ^4 l
3 ]& n2 l& x& I0 ?+ L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) |& t% e, S& B5 t2 p: Y* r) U i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ H; N/ C, O/ Z( u3 P( k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) w$ N0 w3 _* A* v; `
2 c+ u6 ]8 a+ R' \) z. g/ V1 j
' K9 u# b' Q; p* {" ~
|
|