|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 b8 x1 U' ~5 ^- l, L7 v/ z- [code]EDMA sample test application
6 t, p: ]1 z6 V, a! e - /*) o% @5 o6 {: U ]# H" C8 c
- * edma_test.c( Y3 o \- x$ W) u' R- i3 T3 \& o" t
- *+ {: V" A; w+ M% t4 I
- * brief EDMA3 Test Application
4 R$ t |( C* P. X - *6 {" L" s8 [1 x# P: J
- * This file contains EDMA3 Test code.- y( Y2 e+ e2 N1 [. t) o
- *
) R3 H" e3 j& R; S& Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, U& {* G* m j8 |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ ^8 M, y9 ?* E' d8 Z- L( R
- * TO CHANGE.
( O7 W7 B/ u) `: t2 X: _% z ~8 c - *
+ i0 ~" I, s: m9 A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ]* N! i3 o) P& Z* a
- *
) R3 c7 X5 j& K, t0 O - * This program is free software; you can redistribute it and/or" O" v. _- ^' w2 ~. O
- * modify it under the terms of the GNU General Public License as
6 B0 C9 ?3 C9 S, L - * published by the Free Software Foundation version 2.; s s1 q( Z9 E
- *. ~1 @. l0 l! ?, W% I( B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- L5 R; \* j2 @( e
- * kind, whether express or implied; without even the implied warranty
! Y3 |; h% t( e3 H' O- z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) \2 L7 z n8 N! v4 p m - * GNU General Public License for more details.
i q- p- b4 U) M* J# l2 q, u - */
) T0 v7 K8 }. m ^
( _- u7 m3 H! ]5 y& T- #include <linux/module.h>
$ ` [+ B# [0 h. ]# n - #include <linux/init.h>
* _; W) i2 y) N/ u$ [* n - #include <linux/errno.h> {6 c" Q3 M) H% M, A
- #include <linux/types.h>
9 j' b& Z) E8 z5 w; |; I& w* K - #include <linux/interrupt.h>/ S+ E5 g$ C0 A3 R/ c6 y
- #include <asm/io.h>3 Z* K C7 r& ~& S2 U$ [8 A
- #include <linux/moduleparam.h>
5 V& d+ R1 s' ~* E; a" A - #include <linux/sysctl.h>
5 e \3 X8 f8 I - #include <linux/mm.h>
0 _4 c% I# G3 E# f - #include <linux/dma-mapping.h>
; v/ _ v5 A d7 k - 9 C& W. H$ }% c( l3 H% Y
- #include <mach/memory.h>
7 _1 V( o. d8 ?+ @" i) I3 { - #include <mach/hardware.h>2 t& W1 c" Y+ K8 V" n, @# D+ l3 S
- #include <mach/irqs.h>
& m) r0 o9 {! P! C2 e4 D - #include <asm/hardware/edma.h>( t' ]. {/ c9 b4 Q$ I) E/ q- I5 R+ S
- - i/ [, B8 `8 @$ `
- #undef EDMA3_DEBUG% x6 D1 ]" A! i
- /*#define EDMA3_DEBUG*/
3 E3 Q' N k" E; @9 C; s - ) J1 V/ g/ c8 i2 D0 U/ S
- #ifdef EDMA3_DEBUG
) a$ X' D" c/ U6 [1 X6 z/ M f7 B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* f( }/ X7 S/ k# s3 {# m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ h4 r4 R' y7 T1 t3 l) Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 w1 R% u2 f/ ]& ?& e
- #else& `0 R! W4 Z2 i: V L
- #define DMA_PRINTK( x... )$ {8 Q- k6 V& s& d1 Y
- #define DMA_FN_IN
4 {9 u6 X" c* j E3 a+ c! W% K - #define DMA_FN_OUT
4 k# Y ?5 `+ q" ~ - #endif
* m( _9 z3 O4 @ - B/ w6 c& k$ f) [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 z# q. r: _) K/ [4 B! _
- #define STATIC_SHIFT 3( ?4 r- F( S n2 v! o) n
- #define TCINTEN_SHIFT 202 X. a" ~: j4 Q ^" s% F6 k' X
- #define ITCINTEN_SHIFT 210 h+ x& ^0 B) S* L O9 d8 C
- #define TCCHEN_SHIFT 22
1 f5 N1 T) X: x- F2 ?, K - #define ITCCHEN_SHIFT 23; a- B( W( z+ u" o) e
- 7 B* m4 D! O( x
- static volatile int irqraised1 = 0;$ H$ p: _2 L: T! A& G
- static volatile int irqraised2 = 0;: X! f2 E9 w5 P {! z% c4 C
2 T6 g" a1 s. ?" R8 T# U' t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( e# N1 ]. b$ @% K5 ~6 O$ I( N: l7 h6 ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! L" \, d6 G% j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ C2 ~: u* ~: g ]. ~9 m/ A7 J
- , O( O; s2 l+ i+ V- [$ V( U1 A
- dma_addr_t dmaphyssrc1 = 0;
' G0 [) u+ F# a0 a- K - dma_addr_t dmaphyssrc2 = 0;& D& x( y* a$ b G- ?
- dma_addr_t dmaphysdest1 = 0;$ B! l, p' @. O7 m& Q
- dma_addr_t dmaphysdest2 = 0;
X5 j1 I% P1 ?0 b - 9 i. s$ K/ U3 I6 m; i
- char *dmabufsrc1 = NULL;$ z4 R) s- C0 H( ~
- char *dmabufsrc2 = NULL;
, ]( x o& g d9 d0 A m - char *dmabufdest1 = NULL;
) [6 B' w, }. v: Z# S# k - char *dmabufdest2 = NULL;% r. a1 V' X/ Y% D- A/ ~/ z! W: C
- 4 j; t, d1 K5 v8 W
- static int acnt = 512;
& g! l+ }: D2 b0 {5 H8 a7 Q - static int bcnt = 8;
! F2 |# G# |6 X8 o6 x - static int ccnt = 8;. [$ P, T: g+ Q3 S E' n/ D7 _2 z+ j
3 T" s3 c/ F1 s- module_param(acnt, int, S_IRUGO);
5 z) \5 ?* c) [" s2 ]" o; m - module_param(bcnt, int, S_IRUGO);8 P) @7 p3 Y* w' @: a) B* u# m
- module_param(ccnt, int, S_IRUGO);
复制代码 7 Y5 A! `" U' s* b0 p9 t
T. e5 i. ]6 f, D2 j8 O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 |. d" J3 h, J2 W( {3 \& d9 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- j& j. H) q1 i' S2 g. O, b& E" A- P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# p# X7 v& O0 }$ `
, S* w! B- ^ k' {- J4 A
, ^1 j) F% ^( ~ |
|