|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + z4 R7 o% g9 E& G1 ^
- [code]EDMA sample test application
' O3 T7 o, {9 N - /*+ f: p9 f8 N7 S' m. M6 Z
- * edma_test.c& `: \/ U* h) E, i9 x( y4 R
- *
5 D5 C# \ q# ?$ g7 ~ - * brief EDMA3 Test Application9 F4 O9 a0 l, n: }9 G2 D6 {: x
- *, a; {0 }3 w2 ]% o F. R
- * This file contains EDMA3 Test code.! n) l; u( `" L! |. E: e' F
- *4 E" K* g, T; P8 G' F4 z1 I+ g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" n8 H0 |( S. \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, X7 E* J. x/ s
- * TO CHANGE.
, R- f/ l, }% e - *. f. B; d! M3 H7 z( R! I# s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( M2 _6 F' h, A
- *
E2 \' ~, O4 z1 W6 |/ b0 U - * This program is free software; you can redistribute it and/or
7 ~& a D$ f' s" ?7 i" _ - * modify it under the terms of the GNU General Public License as
0 @# P8 x8 z) B# |8 r$ ~ - * published by the Free Software Foundation version 2.
# v! E) A/ p. ?2 H4 ?9 N4 K! X) i - */ P9 l5 ~$ w: F3 C% n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 e+ H' }2 P0 v# X
- * kind, whether express or implied; without even the implied warranty U& D: W/ R# @0 t% b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- |, t: c+ u s1 \- n
- * GNU General Public License for more details.
0 E; _ B; @ S- P - */" R! K( L) _4 H% g, F
& |5 F3 a7 ]- \/ k- #include <linux/module.h>% H. X' P1 p2 ?8 e! d% J
- #include <linux/init.h>
; @. X! V( H' P Z6 g! I - #include <linux/errno.h>3 ~: ~0 l- g) T* L- F9 M
- #include <linux/types.h>" ^, Q4 v! w. ?" Z
- #include <linux/interrupt.h>
! C# E4 x# r6 H. }+ T/ [ - #include <asm/io.h>. x1 V0 r& q% t* M% \
- #include <linux/moduleparam.h>
9 n+ g8 e4 D' R3 H( ?6 B - #include <linux/sysctl.h>
6 J. V+ T; w* `# y5 { - #include <linux/mm.h>0 i' M" y, F/ o* v ~7 L
- #include <linux/dma-mapping.h>
2 J, m ]5 M7 `. ?( G$ t" @
5 l5 I* }9 ^3 z6 t3 N K6 g- #include <mach/memory.h>% X3 _6 ~: g* m! O5 c2 |
- #include <mach/hardware.h>" T( F, L: Z. h3 x) }8 `
- #include <mach/irqs.h>
% ^' Y. s6 ]/ i) s- K - #include <asm/hardware/edma.h>
+ @: h: { L. y" f
. K! k3 R5 L1 A$ h, A& d( B& \. s- #undef EDMA3_DEBUG" ?) [! q; `6 S- i8 Y: s3 w
- /*#define EDMA3_DEBUG*/
, L' P5 g" r/ |" E. V9 z9 K - ; n' Q1 D; @0 U% N$ F7 @
- #ifdef EDMA3_DEBUG
1 y' D- C8 a- ~7 i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' f) B8 d0 E: V. O1 ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 Q# l; a/ d1 e& U3 w4 s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 W5 b3 f/ e; x7 k3 D( e, {& s" G$ h
- #else
$ ]! i% _) k- m. W* @0 G c - #define DMA_PRINTK( x... )6 t' `1 k* M9 Q; N, r9 P* s% @( f
- #define DMA_FN_IN q/ ~2 {" R- F- y
- #define DMA_FN_OUT
' s/ ^* m% H; O1 U7 W' \9 H: g9 M6 N - #endif9 T, p* v) m1 R* d' |
$ U- j' l' r; T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& B' n. g a! b
- #define STATIC_SHIFT 33 R- {* O0 I' V2 l' J% [' U
- #define TCINTEN_SHIFT 20
/ \( Z2 L6 O" x) i0 I7 k% Y - #define ITCINTEN_SHIFT 21
2 N7 @. q, I6 ^/ Y - #define TCCHEN_SHIFT 22* u5 ^# Q( ?9 u& i' P9 \
- #define ITCCHEN_SHIFT 23
1 E8 S6 c" y4 M9 P - I. d7 Z) T$ r1 Z4 s
- static volatile int irqraised1 = 0;9 n" y$ Y; p" F& }' S
- static volatile int irqraised2 = 0;
$ H. N/ s. x' [+ \" y2 s: g. e! f) | - # H8 N! I. u d" t5 c8 O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( H% s: }/ P+ q! G; s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 }3 d2 ^) ~! N2 Q/ E. N4 j0 k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: t2 f, n, |# Q# Q! l% b! `
. f) U1 i& I# Z, U& ?; i- dma_addr_t dmaphyssrc1 = 0;
! x* p3 E( O0 h+ Z$ B# P( ` - dma_addr_t dmaphyssrc2 = 0;
$ v0 }* z8 X }& R7 Y- R5 @5 B3 l - dma_addr_t dmaphysdest1 = 0;3 O: ]; e% k- c
- dma_addr_t dmaphysdest2 = 0;
! X- V0 ^6 L+ j' F6 _! k
1 F0 ? N: F! F- char *dmabufsrc1 = NULL;' L7 n& w! i3 J: h. J/ B
- char *dmabufsrc2 = NULL;4 A' L0 E# x% V* P9 h9 H
- char *dmabufdest1 = NULL;. W' C5 V: } ^# S; o) X) {! K
- char *dmabufdest2 = NULL;! K* U' q' T5 y
8 j3 s! z2 [* Y# C- static int acnt = 512;( L/ j8 J3 A- \1 |1 \6 \
- static int bcnt = 8;
; E5 t: ~" C9 i i, W- k3 { X& b - static int ccnt = 8;
* Y8 U% F4 o+ _! @- _2 O% A
- P* T6 B! I) H p* Z- module_param(acnt, int, S_IRUGO);0 p/ @8 j$ Y' n4 t- u3 e2 z
- module_param(bcnt, int, S_IRUGO);
5 _! p) }9 k4 I - module_param(ccnt, int, S_IRUGO);
复制代码
6 R- V7 m7 C% l' ?# j
. s3 k9 T. r8 p6 i7 h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. e& ~2 Y) R9 q) {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# O5 O$ B0 b( I# u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 I# @ p0 ?$ \* Q: C4 m& P: y/ q3 a! j! w0 j
5 F! d9 d9 m# `- a$ i4 F& ] |
|