|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * I$ \/ Q9 S1 R5 h0 l% s: o) K3 d
- [code]EDMA sample test application
4 s$ P( a1 s: Z0 \ - /*" m$ B+ G) d; Y7 }+ a( F! ~4 K7 \
- * edma_test.c$ X4 x. G; U/ [: S% k* U
- *
- Y& I1 ~& @! F$ \5 q0 p; s - * brief EDMA3 Test Application
8 O) K, z6 ~, ? n+ G - *
# J# W& h6 @8 b- o - * This file contains EDMA3 Test code.8 _9 _. d6 L: \; `' B
- *; A, L# _2 O B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 t8 E0 O4 K& O4 D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, S; v. y; G( ~ - * TO CHANGE.+ f% m9 i) a+ ?! J$ `4 y
- *- f0 L0 F9 K. ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* x/ G% D: k3 F7 X
- *8 y5 _7 a3 z* |$ \( {
- * This program is free software; you can redistribute it and/or {: |6 y* g$ S
- * modify it under the terms of the GNU General Public License as
2 z: m( ?5 E# `1 Z( C* u0 w% y& z - * published by the Free Software Foundation version 2.
5 C+ K( S+ K+ `+ V0 A) x - *# {! W% J% G p$ t+ `/ i6 Q1 I7 e5 |. t( x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 h: {' A- p$ c; i W4 I5 F
- * kind, whether express or implied; without even the implied warranty, }4 g/ j; l) U' A; e( y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 r! K& j6 b, J2 Q5 w - * GNU General Public License for more details.
- V6 `" F/ j9 I: G - */
- k6 S0 W0 s: ` R
5 c' n! g w- }/ D# r; P( c1 i# n' U- #include <linux/module.h>
3 q! P7 S) T! U1 Q - #include <linux/init.h>
% e. R; A& c. b9 B6 e - #include <linux/errno.h>5 ]% g; J! X7 O# [
- #include <linux/types.h>
6 X6 D- v) \2 \, t - #include <linux/interrupt.h>7 K( Z+ F I9 [+ V: S. R3 t
- #include <asm/io.h>
% I, d' }: b, I5 D: |( d - #include <linux/moduleparam.h>
z; J# C n R/ g - #include <linux/sysctl.h>
8 K! T( k8 b" G! B" p& G3 D; K0 ^ - #include <linux/mm.h>
& d- D+ f% \0 \' u/ K3 ? - #include <linux/dma-mapping.h>
1 V- F" Z3 m* s) G - 6 T$ h" e6 t8 `3 h% B0 e( Z
- #include <mach/memory.h>/ E$ r9 K7 I/ u$ Q9 Q; @8 @4 f
- #include <mach/hardware.h>
' w" `* Q! L" ~. {3 R& K/ } - #include <mach/irqs.h>2 z0 D. @( L- L* V7 z1 \; z) @- Y* E
- #include <asm/hardware/edma.h>
% D9 m+ ^& C% Q' O# c2 N
8 g8 m- g5 ^+ _- o( s/ Z- #undef EDMA3_DEBUG& G6 p: M# J/ Z) s
- /*#define EDMA3_DEBUG*/
i+ Z8 [+ U8 w - " J3 F& ? @# x; p
- #ifdef EDMA3_DEBUG
$ ]3 ]$ `" _4 C Z$ e# U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 |8 N# Q k# B4 ^7 E- L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 U9 u9 v" Y" v" h& M9 `3 G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& ?# x- l/ n! d7 A
- #else8 q0 N6 \* A+ \1 x+ _3 L
- #define DMA_PRINTK( x... )! U. S) N2 ~' k9 y+ {/ e, |
- #define DMA_FN_IN
" o* w' s3 y& e! R - #define DMA_FN_OUT
/ S% \. _6 t' h5 @, l6 m - #endif
. @) S( x) m2 `& i/ H
6 k" K+ W `" n2 Z' _9 I- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: ^: Q8 _( b$ ] - #define STATIC_SHIFT 3# I6 g) `( s' o. M5 Z
- #define TCINTEN_SHIFT 20# b, U# u6 y& O0 d% A
- #define ITCINTEN_SHIFT 21
, i7 d' S- a4 \1 \1 j - #define TCCHEN_SHIFT 22
- F" }7 B& ?, D - #define ITCCHEN_SHIFT 23
- G; I' k( b# g8 t, z
! t. ^ x* \4 B4 P" P# u- static volatile int irqraised1 = 0;: Z# C( H- [* H) i9 l
- static volatile int irqraised2 = 0;0 s* J; l8 P: }9 W9 Y% M: Q8 C; l
5 N: F) T7 r& D( }2 L/ Y7 f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Y! u- z' V$ g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 `) n8 a! l* D8 D3 Y D% N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 B0 d' O# W1 b; C+ M
" I: C* H7 d2 F" c2 ?- dma_addr_t dmaphyssrc1 = 0;6 g! i, T7 t6 C: I+ A( v& J
- dma_addr_t dmaphyssrc2 = 0;" }. t$ d; |' \1 i; u) ^1 y5 {, k
- dma_addr_t dmaphysdest1 = 0;
! b2 p) Z* k& a/ w6 i7 h - dma_addr_t dmaphysdest2 = 0;* w7 {6 y0 `$ |1 ?+ F, H
- % i5 |, s$ a' X* H7 z
- char *dmabufsrc1 = NULL;
# l% Q/ n1 u" ~9 Z - char *dmabufsrc2 = NULL;
8 f* U. F2 L: T2 x7 o4 J5 I - char *dmabufdest1 = NULL;
7 G4 y' Z* @# \: `3 q8 j - char *dmabufdest2 = NULL;
% r8 e7 _9 V8 h c
& J, D4 b: d/ |: O* ]2 C' c- static int acnt = 512;* }) }% x! O5 g4 G# ?7 B
- static int bcnt = 8;* y8 b- T5 F% E% { _* q8 h
- static int ccnt = 8;" H7 }' Z% Z; t# u
- * t, Z6 P, V( P7 m# o& o/ Y/ c3 p$ h
- module_param(acnt, int, S_IRUGO);
$ c% w7 P# y: x, H8 Q( H/ |4 q - module_param(bcnt, int, S_IRUGO);8 ^$ t1 z! f7 `& c* V ?
- module_param(ccnt, int, S_IRUGO);
复制代码
& E; q2 V* u2 Z5 P& @
9 h7 ~+ S, L5 N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 p0 f$ c1 d% S! D" [8 Z( n. \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% v: X6 _# g) ^+ I# } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 T* {* t: L: @9 r0 v- i3 E# n( Y) P1 _
7 _5 B; `6 i A" e |
|