|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 Q' K9 W: r6 p+ y7 I8 u" a- [code]EDMA sample test application/ ]. M7 }6 b) U6 \9 [
- /*
+ X' B E0 a+ }+ h - * edma_test.c/ u. ]% b9 h0 e, D: @& D9 `5 I8 _
- *2 O( p8 x( A) I; ]0 h3 z
- * brief EDMA3 Test Application' q. \ R+ u5 x8 T( M3 G
- *, j7 @3 Z- B r# z# b3 V% N8 I
- * This file contains EDMA3 Test code.. Y$ @8 _7 O, n. q a$ V+ D
- *
. X, G9 f' U0 f; l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ ?3 M3 a5 n4 Q5 Y( k/ Z' q6 A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& }1 ~) C5 X& }( S - * TO CHANGE.8 a, x1 H$ n1 j, N `
- *0 O& k' h) t2 ^ M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& P' n" C6 D! z" l# n5 W9 W
- *0 b4 Q$ v, I N8 e0 W
- * This program is free software; you can redistribute it and/or! o3 m0 [- t8 S, |; \! t$ l' N6 ~
- * modify it under the terms of the GNU General Public License as1 H$ \% `- J5 d7 j; K, G7 h; g
- * published by the Free Software Foundation version 2.
$ V" W ^/ x8 f& r0 s+ y( h8 G% A8 N - *
! y- d' y' l" q/ V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 c2 {/ z: v# f0 k7 E. y% h# Z - * kind, whether express or implied; without even the implied warranty
8 ]/ v) g) o0 v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" F, N) |& Q3 O0 Z# C8 j& Z - * GNU General Public License for more details.
/ w( \ }: q3 \) c L& y - */
9 q. A( ]5 L9 s# u, \1 v) t0 x
4 K7 P9 c+ j8 B- x5 f; P- #include <linux/module.h>9 Y1 h' ^# \" y- w% o7 M7 j* Y
- #include <linux/init.h>
" Y0 r8 G& Q' y - #include <linux/errno.h>6 e& A/ m* A$ b+ h
- #include <linux/types.h>
' A" A: Y+ T( V - #include <linux/interrupt.h>' K- k7 {& O- J" g
- #include <asm/io.h>
# W# w& D# d- A# K - #include <linux/moduleparam.h>
& Y) u+ G' n6 y4 t# k( v4 u - #include <linux/sysctl.h>) [2 R) h" T7 U- f+ {
- #include <linux/mm.h>) h% U& A' E0 m
- #include <linux/dma-mapping.h>1 c" n9 c& s4 f8 A) n+ r
; Q1 P: t9 _! Q5 q% {- #include <mach/memory.h>
# Q6 d7 d; g) b7 f, J - #include <mach/hardware.h>
5 W& J) Y, U+ o! C+ F5 n: H - #include <mach/irqs.h>
: M3 C, y, k8 M( h' L3 `7 M: P# x; h) n! o - #include <asm/hardware/edma.h>
8 g: F8 D6 _5 ? - , K; E/ C7 A& A& N1 b( m( I0 [
- #undef EDMA3_DEBUG0 i1 v8 r, c8 [4 W$ q# n' t. Y
- /*#define EDMA3_DEBUG*/
% E- e: v B( E8 e: [ - : Z0 N ~5 S2 S' L% v3 K5 P
- #ifdef EDMA3_DEBUG
2 h$ h2 d8 Z' e( F1 F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) l5 p5 D; @/ g9 N9 u+ j' P7 s, e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( R: j, H# b- [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ f% Q$ J. W! ]- z' T4 p1 D! ]
- #else
1 B& E. w5 r& L5 G( a) a$ V: \ - #define DMA_PRINTK( x... )5 d2 L& |* @0 X4 E% o
- #define DMA_FN_IN# u5 p a# X/ r
- #define DMA_FN_OUT3 p. t0 V. Z/ u( D+ S
- #endif& L4 i G9 }0 l
7 u4 M& Q1 K, Q/ e# D, x' c0 }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' H! w5 v" p# j9 A# Y - #define STATIC_SHIFT 3
+ o" J; @6 M* q6 M - #define TCINTEN_SHIFT 20+ Z% S4 G/ M' q) t" r. n
- #define ITCINTEN_SHIFT 21
d1 W, [5 F2 [3 g - #define TCCHEN_SHIFT 222 H' O9 N; u. B$ x! W8 ^1 I, ~
- #define ITCCHEN_SHIFT 23- H- T! t0 O2 F1 K+ S- A- R
2 }+ @' W7 f6 g" u, U8 ]- static volatile int irqraised1 = 0;
/ M$ h3 M0 l, b- `; [ - static volatile int irqraised2 = 0;
& u2 X# J/ x) [8 q - 3 V. u! e7 @8 g( U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
j1 R8 @& l* M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# K7 u3 E, r0 t, p8 v! C1 M+ o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! z5 C2 y% ^2 X9 K# Q* l; G" {4 Q \" k
( T" v/ g! s- y- dma_addr_t dmaphyssrc1 = 0;
& O8 L) \2 `) i/ \ a, E# n - dma_addr_t dmaphyssrc2 = 0;2 {5 e& ~5 w: l# o
- dma_addr_t dmaphysdest1 = 0;9 V! x9 _4 O6 n% H8 w: L' F0 T. H
- dma_addr_t dmaphysdest2 = 0;: G4 L6 E: M8 p5 n+ o4 {2 l( T
6 e! `& _/ V3 ~1 e6 `- char *dmabufsrc1 = NULL;
' N- I! t( K, |; L7 v7 }) S4 _' \ - char *dmabufsrc2 = NULL;
) k& C C! a( q9 X% s6 s1 P - char *dmabufdest1 = NULL;3 P }+ Z0 s1 ~# W8 u5 P
- char *dmabufdest2 = NULL;6 Q, x% I$ f4 O, z$ F3 q, z
- 9 ]! Q4 d& C) e6 t F) ?
- static int acnt = 512;
" I& h3 e+ B. ^+ C i0 z3 A: Q5 T - static int bcnt = 8;
, K; B" x* h. B5 w- h - static int ccnt = 8;
7 T" S0 ~$ J9 C% q2 ]7 c - + @* ?9 f' Y, B; E. g* k2 |
- module_param(acnt, int, S_IRUGO);8 E5 z% {& d9 b# H% a# N0 L# T. T
- module_param(bcnt, int, S_IRUGO);6 X& }; ~- w+ t8 t9 \! c
- module_param(ccnt, int, S_IRUGO);
复制代码 9 j( C( W, N$ Y; r3 }
# H( A* k5 N( B+ O& y+ V1 [1 K6 u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 t; G6 x' A' v: E+ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 Q" I7 J L) [" t* S8 z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ K7 s. i" K4 \; S. z( X
* k0 s0 {4 r( M6 H, y: _2 ]) a) W" y. S1 g
|
|