|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 x* E, ]4 v# M1 i3 X7 J
- [code]EDMA sample test application
" w7 C1 H w' }1 T- a( I - /*( D* O! {& j& i, k$ n$ E3 N
- * edma_test.c
E7 U8 J# G/ i - *. j2 [6 v8 F- o" K; }8 S
- * brief EDMA3 Test Application$ W5 m' `% D1 k! ]1 l5 U/ L+ T9 T
- *
$ I" ~2 y; h" m5 e, @+ w+ d - * This file contains EDMA3 Test code.
6 y$ s: G. }3 B$ t# p - *7 R/ F8 Y; g( U7 ^/ t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" s! X1 E! {& C9 f# J6 x2 U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) {! w2 `$ {2 M( ? - * TO CHANGE.9 f' {4 I$ V- w3 P6 F
- *
6 x2 X0 J/ C* r1 A4 p3 J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" x9 W2 R5 K0 s$ O+ b
- *
6 }2 T5 I' `) Z* w0 s" C3 ^ - * This program is free software; you can redistribute it and/or
3 z. w ]/ X: g. k0 y( W - * modify it under the terms of the GNU General Public License as
( H" U' k0 K9 Y) q - * published by the Free Software Foundation version 2.- j6 K" h/ X t4 D
- *
' v+ j% B0 r. E. i; h& o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 s7 i/ K! m! A1 }: T
- * kind, whether express or implied; without even the implied warranty' d( c3 S; S% P/ `/ c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 |" ?! k' o q" w6 x
- * GNU General Public License for more details.( X3 n) e, _7 e1 C! a: b0 D/ E$ O, [
- */
- ?8 q% [; m( l" v% b _& l
) j- Y. d" a( F {/ y3 r- D- #include <linux/module.h>& T9 `+ g3 J y" i4 U" D
- #include <linux/init.h>1 h5 T! E: w8 y
- #include <linux/errno.h>
2 ^$ U: h3 G. d# W2 V6 v- p: H1 f( g - #include <linux/types.h>
` h; X- B& p+ [6 w - #include <linux/interrupt.h>* ^ N# r+ p* l' |) S9 j; x
- #include <asm/io.h>
3 `" B/ ^5 Y0 H - #include <linux/moduleparam.h>( Q* j5 {# X( `; y/ j& Z. z
- #include <linux/sysctl.h>* d' P. M9 K$ t: i0 _* k
- #include <linux/mm.h>" y4 q( r8 m. g
- #include <linux/dma-mapping.h>0 c P9 L/ ?3 Y8 k H0 I
; c" `9 f5 m2 t+ K- d, ?- #include <mach/memory.h>( W" d: u3 q! I
- #include <mach/hardware.h>
7 y. T4 i* C3 _. I. x. p1 m# L7 K - #include <mach/irqs.h>
/ _# s& Z9 q+ i2 P1 U. t9 C6 N - #include <asm/hardware/edma.h>) C* F3 c1 N6 {$ q7 G
- , f# U6 D1 y& t1 w3 i$ {. Q
- #undef EDMA3_DEBUG
$ M( T5 X# p/ C, L/ Y( o% S - /*#define EDMA3_DEBUG*/7 o. X$ }" i. e( L1 h$ ~" B, L- S% d9 g
- & y# y" E+ b+ p/ _6 T5 D7 L$ h" Q
- #ifdef EDMA3_DEBUG
: u5 X5 b$ T3 i, s, ]% d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) r G! S+ y. `# @# r( z* ]( c; o& M. g7 S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 B! R5 k. k7 @5 u9 S/ A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 t! F I( C8 P7 I: {" s
- #else
) E. i/ W5 b& ^* W# J - #define DMA_PRINTK( x... )" F- F2 x, }% U0 Q9 d% Q+ v
- #define DMA_FN_IN7 y7 E% m8 k' W. P/ J/ k
- #define DMA_FN_OUT
5 v; ^1 v7 q2 t/ l6 M6 Y - #endif+ j3 y1 l7 w+ E( u1 I& M
' U& `' m" l; ~3 k3 C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 x3 |# o( f) G
- #define STATIC_SHIFT 3
* t) V4 @; m0 B- I' V! K - #define TCINTEN_SHIFT 20
3 l$ l* p, }) l - #define ITCINTEN_SHIFT 214 Y( W, ?( p4 }" P& q
- #define TCCHEN_SHIFT 22
$ X3 \0 k8 S" v$ t" ]) w - #define ITCCHEN_SHIFT 23
2 R1 _* F! K. a3 Y
5 C2 A% E4 u$ i; ]2 E: O- static volatile int irqraised1 = 0;, H1 r& z) B& |( R3 @: g6 b. P+ d7 B
- static volatile int irqraised2 = 0;; r) ?+ ?7 c/ N4 `: }9 ]( \! C
# A& D0 \! F5 c4 z4 M4 N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 c, w( I; Q2 B2 b+ [- ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 r6 T, k' Y! W' n2 W9 A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; E- F2 u% y8 p$ E: |
+ _- H% Q+ F9 |# G+ h% H- dma_addr_t dmaphyssrc1 = 0;
3 o' @( Q2 Y( `' k5 q H - dma_addr_t dmaphyssrc2 = 0;
$ I9 i4 n( q& D4 [% { - dma_addr_t dmaphysdest1 = 0;( U: x' ?/ b! b- W2 [$ s. i
- dma_addr_t dmaphysdest2 = 0;, S6 o# o6 M4 q3 `
$ U5 M- p ~9 c' a2 {5 |# L- char *dmabufsrc1 = NULL;
4 Z6 Y5 q) a& ^ - char *dmabufsrc2 = NULL;
! @+ {$ g; D$ C3 \- K1 }1 r - char *dmabufdest1 = NULL;
( s% p J' |, G" v$ n: z, I3 [- ? - char *dmabufdest2 = NULL;
! o! } O4 [& R3 J f% ]9 D# `
" K- w; B+ Y. w) C* C1 n+ `6 @, h- static int acnt = 512;
) } u* c8 }( q3 C+ m: X - static int bcnt = 8;
! w% t/ H7 Z* ?) U, k - static int ccnt = 8;* @4 f, l# n' X( _$ q" v8 l
- . }6 w6 l5 o: p2 x9 U
- module_param(acnt, int, S_IRUGO);8 L7 F/ ^% t5 _8 B/ z
- module_param(bcnt, int, S_IRUGO);0 o. u( z" Q: h& _
- module_param(ccnt, int, S_IRUGO);
复制代码
& U+ ] `- |3 Z2 \+ g9 z7 [8 O5 C2 J" R9 w' B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 s' T! B" g9 S, M" 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( b6 K; S! ~; d0 ?' T5 v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, _/ \) V7 E* ?$ ], u9 ^
8 ~4 N! B5 f _* F M
( P% ]$ R" b) C2 W6 I- J |
|