|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ n [* u5 B. y q# W- [code]EDMA sample test application' N% \% y/ v4 F' S) H% k
- /*
# u/ C V! I/ z) `5 O" ~& q - * edma_test.c( V1 Q0 \. `( l) ~' a
- *' b; h/ k% |: g) B
- * brief EDMA3 Test Application0 z0 [+ P% B# ~/ g" \5 z4 |
- *
" M# d9 @4 A# R( [. G- Q" M6 ?7 [ - * This file contains EDMA3 Test code., o& _2 D! Q# p4 o9 T8 K
- *( d) e" ?) V7 O( e1 k* S* p3 A4 s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! |" }, c& ]" c# C3 q k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 p4 t' _5 x z) C4 i - * TO CHANGE.
3 i! d2 n. y# G( N3 b - *
* @/ u' H% [+ B3 w, W+ V. [5 s2 @- y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 W, z( p- K/ q5 V- a2 x+ n- D - *
j5 I2 e/ \( f1 w1 x - * This program is free software; you can redistribute it and/or) j, V2 s8 A, |3 f7 d6 t0 N
- * modify it under the terms of the GNU General Public License as
8 K, s% P6 i( s2 {; M! h - * published by the Free Software Foundation version 2./ Q$ J, M# D% w6 V$ L
- */ k3 p) T# g/ F! Z" R; v( N( o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
z6 X9 f. F, o' o5 v - * kind, whether express or implied; without even the implied warranty, H1 L" p2 i8 v: j& j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- L% Q! l* Z7 ]4 q% E) U
- * GNU General Public License for more details.
: [$ _1 F6 n1 u+ D1 W - */ J2 m. I2 }0 Q E9 f' R
) g6 G9 Y- q8 y' `- V w# Q- #include <linux/module.h>
; w1 g, `( C8 j) ]! G$ i - #include <linux/init.h>7 e) I9 V+ _) P; g' w. T7 ?
- #include <linux/errno.h>( ?# S: Z3 ?1 H: `* _ a$ Y
- #include <linux/types.h>* l7 |5 {9 I6 w: J3 K4 F4 o. ]( w T
- #include <linux/interrupt.h>
/ \% O1 l, g3 E( X0 F) Q; Q) L$ e - #include <asm/io.h>- Z3 i- k( h& a" t' V# o& `7 q7 z* W0 _
- #include <linux/moduleparam.h>( t* K n9 U& s- p$ K/ j
- #include <linux/sysctl.h>
' L' {7 a+ X4 R5 _5 _& N - #include <linux/mm.h>8 w% G1 G# K) D8 {
- #include <linux/dma-mapping.h>5 ]$ E9 Z% `& a( g- {
7 b' S R% r% z' r- #include <mach/memory.h>
3 B- R' @# |1 u* U G) j - #include <mach/hardware.h>6 p& z- J% k0 H k7 J" f9 h
- #include <mach/irqs.h>' w0 [1 t' F# M/ v5 t4 N
- #include <asm/hardware/edma.h>2 `* }# o! \( T, `+ ?
1 R) u: }" n* j7 z* B5 e9 p- #undef EDMA3_DEBUG) Q. P- j9 [- ]$ c6 f0 R0 u) x# T
- /*#define EDMA3_DEBUG*/: I B" P6 o9 N- U
- $ N0 ^0 p) t: u9 R- U2 Y E
- #ifdef EDMA3_DEBUG* t2 V# }& z: S6 c2 ]5 ~3 W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
[' G; _0 ~; I! ?8 i% M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 B* B! K7 x/ x4 q. g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 b9 ~7 B" k7 `5 E- t9 y: E4 a - #else
; Y4 U. H7 f. ~ - #define DMA_PRINTK( x... )
/ ]6 t' n2 D+ i9 _) f2 _ - #define DMA_FN_IN
. Y2 X9 d4 j! F - #define DMA_FN_OUT
. E) a+ y7 v5 g - #endif Q r# t: {# T1 L
- ) D' a4 M; D8 b5 c$ P1 e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). H2 N; L+ G5 y1 i
- #define STATIC_SHIFT 3: V. x- @/ U. k7 ?0 [5 `9 M
- #define TCINTEN_SHIFT 205 @1 ^3 L) q; A9 h3 _
- #define ITCINTEN_SHIFT 21% x, F# k+ W# F3 F7 q% e3 u$ W
- #define TCCHEN_SHIFT 22
( E2 U* t9 v5 Z8 q. r - #define ITCCHEN_SHIFT 23
+ c7 Q- Y" [, F1 e/ [ \
$ J+ ~- u/ n8 ?5 v- static volatile int irqraised1 = 0;
# A [" R1 [ ^/ {# a - static volatile int irqraised2 = 0;: k, a3 s! b B a+ E9 ?! |
- " v# ^- e/ {) E3 |1 o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 _" y! Q2 c: r; a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ S h9 {. r% j6 ]3 o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ ?- i7 t# k- n/ W5 V- x; O3 f
9 O$ K9 V' T" I& u- dma_addr_t dmaphyssrc1 = 0;
! i5 J* S; R3 @ - dma_addr_t dmaphyssrc2 = 0;4 j/ \/ Q( V- k& [7 O! h6 l
- dma_addr_t dmaphysdest1 = 0;
& U9 S& n0 M2 i& S$ \1 m - dma_addr_t dmaphysdest2 = 0;, v' }; A& A7 u2 e
- ' P) E+ p5 `5 H+ o
- char *dmabufsrc1 = NULL;
7 W3 B2 C) L& G" v, U" Z1 p/ z' p0 h - char *dmabufsrc2 = NULL;1 W7 u# T9 o2 i! r
- char *dmabufdest1 = NULL;
/ ^ N+ {( d# l; Y. q; | - char *dmabufdest2 = NULL;
/ Q! V3 ^2 n# y; J/ m - . w8 U1 U9 }# l9 r7 g
- static int acnt = 512;8 m; d5 A5 z8 p8 ~$ X, ^% E% G% A; H
- static int bcnt = 8;1 Z. L' X3 I: p# `( }( n
- static int ccnt = 8;) D8 B. C! [+ Y+ V( \4 U7 x
2 q" s$ i& D# c8 e; o- module_param(acnt, int, S_IRUGO);& b+ D v2 o/ ]$ _' x& t; k, Y
- module_param(bcnt, int, S_IRUGO);* N3 S( s$ y L" ~+ a4 t
- module_param(ccnt, int, S_IRUGO);
复制代码
) b: a; a# w# Y3 o8 i! ~2 J9 r. l# A2 U5 d3 ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 e" Q- R# m+ M" L" B7 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 a! n& U3 ? a% U+ ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 ]4 d/ W9 h" l3 n5 U% o A( Q) B! ~( O% H/ O" O! o
4 q* `9 b" Y1 V9 T
|
|