|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 l/ }9 I5 R( ~$ s. b5 q: |
- [code]EDMA sample test application) I: j( u" f* r$ D% n9 P, a, g4 B
- /*$ ?- \9 \! \6 M: P+ K8 B1 g, t5 I
- * edma_test.c
% f* q. F, [7 f4 P3 P; P - *
9 {3 m) ~4 \, J& X V - * brief EDMA3 Test Application! w t! M3 p: `( u. U F' h1 h
- *6 L% I! m' \/ {: U) ], g
- * This file contains EDMA3 Test code.
, F; u9 D' P* G' h - *
: u" q0 S9 H* v5 d) x a1 s& L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 m9 l: H0 `( j) D' i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 ?$ p/ A: ^5 [, y& }, W ~
- * TO CHANGE.1 C4 x5 [' p+ @4 _; Y0 l
- *
+ t. p% Q! V' l, K$ t% u6 }# ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 [! R( A7 I4 T
- *
# m2 \% v. v* h+ c) C8 a! B - * This program is free software; you can redistribute it and/or
0 ~8 z& U- T6 d! ? - * modify it under the terms of the GNU General Public License as. O( J/ o( l+ \- w% p4 y5 w- L
- * published by the Free Software Foundation version 2.
3 X! I5 P: U3 j* X5 c1 d& z$ d - *
1 T/ f% Q V/ z' D) R. ?) r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. t6 Z% Z/ D! }0 `, ~
- * kind, whether express or implied; without even the implied warranty* l1 V3 v2 P, R5 w& s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: G, a2 Q/ [% a* i( U
- * GNU General Public License for more details.: D$ n& c; l/ m
- */" a4 z J' h5 b" \; g0 w% X: y. Z2 g
& C/ g2 ?. l; I+ t9 ]# V- #include <linux/module.h>
+ `+ Q" p% k1 f( P: L! V( v; f) O - #include <linux/init.h>
8 l8 |+ M3 T. H+ g - #include <linux/errno.h>
! R# Y) O8 F# O- w0 T - #include <linux/types.h>
& ` a; p8 E @4 `6 \4 ?! E8 N' j5 X - #include <linux/interrupt.h>
- o4 S& O9 r, o- D! f3 I - #include <asm/io.h>; ^3 E$ x$ K: {# r2 F2 e+ j' @
- #include <linux/moduleparam.h>
$ E4 [: V+ r+ b% c1 }3 O - #include <linux/sysctl.h>
; z8 C5 P8 i9 y - #include <linux/mm.h>
# c2 b( L W8 E/ I9 Q - #include <linux/dma-mapping.h>
3 w) G5 h: z* @) J - 1 g: z# t$ |9 M& l! n0 O
- #include <mach/memory.h>! e4 {# z# Y% k: V0 P4 w
- #include <mach/hardware.h>
" [7 K U7 k, C% V/ I - #include <mach/irqs.h>
, o* P, A, \# W& o - #include <asm/hardware/edma.h>
3 u- l8 y' {; q" m y - 0 J$ S/ R' ?8 w! B
- #undef EDMA3_DEBUG
. |( f5 W% H( s) O7 ] - /*#define EDMA3_DEBUG*/
/ u# ^( Q/ U( B _ - 6 U0 E# i% u% f& p9 e. _
- #ifdef EDMA3_DEBUG
- M. N } [9 L: w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& ~: @# ^ t; J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 U( ]4 k6 o# K6 O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# b3 c! E# d# q; A - #else8 Z [' B' E! U+ a
- #define DMA_PRINTK( x... ), j7 D- X6 Z: I% Y2 H/ v1 ?: q0 J! l
- #define DMA_FN_IN
{6 t) q/ |) }3 C C9 s5 ^; ^ - #define DMA_FN_OUT
2 b, l6 I2 H& y6 l" y1 e2 `) c, @ - #endif
" O0 @2 a! M, j7 k p - ' W) C, E: ]- U" R2 E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' T h- A3 e4 @' K* d4 I0 Q9 {. v - #define STATIC_SHIFT 3
" m M, t' Q9 o" ~# Z4 m - #define TCINTEN_SHIFT 20" u4 B0 Y5 Z6 Z, K( d
- #define ITCINTEN_SHIFT 21. U7 u- u; [' k/ c! d% N4 C9 R
- #define TCCHEN_SHIFT 22; Z B. O3 y. T0 |! W+ B7 p
- #define ITCCHEN_SHIFT 23
" e% S. \8 c1 D& j+ e6 U3 \# Y
+ h" S# n; R( u3 N* @5 s- static volatile int irqraised1 = 0;7 \: a/ u' N4 n* o
- static volatile int irqraised2 = 0;
+ f9 H( J$ E6 h0 D, O9 T
( `3 I5 H" i) W9 I; F5 \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 W/ f! Q3 q5 j1 c" M* k Q ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' b5 I$ z( g9 F8 \$ T$ l" Q @: v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: o4 D, E( y5 Q9 _* X# } o5 @ - S2 q% z) h3 b/ J V# p
- dma_addr_t dmaphyssrc1 = 0;
$ _" S% k0 v# \" Z) Y' H - dma_addr_t dmaphyssrc2 = 0;
: j/ F) D, N$ K+ D+ m - dma_addr_t dmaphysdest1 = 0;9 f* ^0 q# E0 ~: _, O! D5 c
- dma_addr_t dmaphysdest2 = 0;) Y* ^6 z) s! Q) h* F/ y7 ~* D, m r
5 ?% G% [7 ~' n- P" Z7 o2 a- char *dmabufsrc1 = NULL;
# t' _+ V% U; j - char *dmabufsrc2 = NULL;
+ i# {8 V) Z% {# y$ s. e - char *dmabufdest1 = NULL;
; Z; V0 ~& _: y. ]$ h0 E- H, W - char *dmabufdest2 = NULL;
# ~: t1 D6 Q; l$ ?
, b% B l# k7 f: h- {5 E- static int acnt = 512;
9 L% x; T7 Z* U - static int bcnt = 8;
' Q1 \. k1 n+ n7 _2 Q0 ~. r - static int ccnt = 8;$ W$ }% o" {8 Y4 L1 \& |
4 {* ]8 U6 v! N) j9 j- module_param(acnt, int, S_IRUGO);; a5 S& v+ B3 {* P2 b/ c
- module_param(bcnt, int, S_IRUGO);
2 x! ]4 t- C/ `% D) z* h0 ` - module_param(ccnt, int, S_IRUGO);
复制代码 $ E) K3 ^* a" {: C5 Y- q- T; K
/ g, Q; a6 H6 K ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) L* I1 m" P& J. E+ ^3 k# I; P, Y/ U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 H$ |- } I1 H7 c+ c* k8 F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% q* l: ^* E0 [6 ^, g- e' h1 R# w; l7 A' o7 B
) ~; u% }* r! n
|
|