|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. ~( m% g* J+ j- c7 J- [code]EDMA sample test application
- h8 o" x2 ^! }- J# i7 B/ ] - /*# Q* @; ~5 G/ @. G* j. C
- * edma_test.c# O3 c+ h) u. I, ^& z5 i
- *
0 \4 t5 k8 _5 W+ w - * brief EDMA3 Test Application: v. e+ V' V3 N7 q% @9 m" u! @5 E
- *0 w& b( \1 v2 r2 [, L, L
- * This file contains EDMA3 Test code.1 j8 x# ]6 _ u4 c# D0 w& B7 C
- *+ I% n* g2 X" M4 s7 N. |: [- K: S% ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 p; E P g6 Q3 r6 M2 A& Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 d$ q4 }: U" h# \" X+ e - * TO CHANGE.
! k; u2 Z3 X. n) h - *
. N" D8 w% l& P2 ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ l8 ~3 C7 q& I r- m - *6 t+ X' ~1 `% H/ L& g
- * This program is free software; you can redistribute it and/or
; O( `* A. I) |' }* { - * modify it under the terms of the GNU General Public License as; b& v3 I5 J; R! h! D& O' C7 W. k( s! W9 V
- * published by the Free Software Foundation version 2./ [3 M8 h9 i( A2 |9 }& H l- k" V
- *
; c( ]. V) u& R" ]/ M* i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) n6 N' I2 `+ j
- * kind, whether express or implied; without even the implied warranty2 x \! d1 w& B8 j- u' J
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) h! Z- b. q. y2 W' S; c - * GNU General Public License for more details.
, s P* Z: D2 i6 Z; h- @; T& K - */
# e9 R4 d: X3 K( G9 U0 A
/ B) i( B# K9 l$ L- #include <linux/module.h>
& F! R' S" X2 w - #include <linux/init.h>0 b: p. _! R. W. q1 y' ^8 P) v
- #include <linux/errno.h> ?0 ^% P. ~ L' J0 F* ?- G
- #include <linux/types.h>
) I+ q# ? T: F( @8 U - #include <linux/interrupt.h>
; }2 x, F, ?- T8 |' _ - #include <asm/io.h>
: y( `- @* g9 \% K. ~! D - #include <linux/moduleparam.h>
6 ^2 E3 ~6 Z% U% X4 G7 t - #include <linux/sysctl.h>
/ v* Q+ P( l2 o% n8 T - #include <linux/mm.h>( A( w, O6 U: F; n( s% }( N
- #include <linux/dma-mapping.h>/ K, I- k, Z6 I, A
7 g& Q( A* z* t: m- #include <mach/memory.h>
: p; ^$ h3 k1 H. F( W! P - #include <mach/hardware.h>
" L* Z* K5 i( ?% c O - #include <mach/irqs.h>! q1 Z2 r$ p5 q/ Q+ k
- #include <asm/hardware/edma.h>+ Y' U' J, ~, a1 S, o) ^# D
- . l( r; e; S/ E: y
- #undef EDMA3_DEBUG: {, j w; `: {& l0 W% g$ F% n
- /*#define EDMA3_DEBUG*/9 ], b& G, W. T1 K& b
- 4 l/ l, f( e ~/ B- a( J) |# @5 T
- #ifdef EDMA3_DEBUG+ L* Y* Z" W# \% H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ @ M& k* |& x/ F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ x3 C: t5 R3 O3 X# X! ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 B. s7 O ^& y& u" N - #else" F6 f( o" ?2 d
- #define DMA_PRINTK( x... ); |- g: G4 ~! r2 r
- #define DMA_FN_IN
* ~1 t6 p w ?8 `& R - #define DMA_FN_OUT
- _- m* m# H" C: q! c+ c4 w - #endif
Y: ~7 k( W& b! Q' b( W# p X, ]1 w - ) m! i9 m' i1 s1 ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), e+ Z: P6 T. f1 a y. M5 Z. `
- #define STATIC_SHIFT 3/ q$ b) N8 s9 s! n/ F
- #define TCINTEN_SHIFT 203 I4 \5 o7 P* m i+ a5 i0 ]
- #define ITCINTEN_SHIFT 21
& X/ j4 s- U, u8 g - #define TCCHEN_SHIFT 22. K8 C( G5 J! z' K3 v
- #define ITCCHEN_SHIFT 23* J4 x3 i+ J/ z9 M! K$ W6 y( d
$ g8 x( M5 E Z2 \- T3 [- static volatile int irqraised1 = 0;5 k3 Q5 P0 Q# \5 u
- static volatile int irqraised2 = 0;
! l, @$ k( ~0 v* U
( }4 w. Y9 g: i4 R: E$ ^5 D" y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( E8 E3 m0 h6 N2 H- ?' @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Q) l n& Q5 _! U" l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 i& O0 @8 Z' l, ]1 ~; n3 F
) |0 M* G2 F. N5 q- dma_addr_t dmaphyssrc1 = 0;
" v- c: H) U) u5 x b' j - dma_addr_t dmaphyssrc2 = 0;
+ G: E. j4 g& P; j - dma_addr_t dmaphysdest1 = 0;
# D" h0 j% D5 f8 Q2 C+ N - dma_addr_t dmaphysdest2 = 0;
$ B' } w+ w/ f# t, q
, A$ x. t/ e' {' e7 `- char *dmabufsrc1 = NULL;
/ o# x9 h! c* o* O: _7 k1 A; h - char *dmabufsrc2 = NULL;, K Z) v, w& e9 F$ v6 H
- char *dmabufdest1 = NULL;: I* D0 J( u! H
- char *dmabufdest2 = NULL;
5 y/ D b, K5 n! j. f: T
* T# N; h' b9 d9 R$ E; V3 Z- static int acnt = 512;
" i/ e1 }2 z) N$ g0 i - static int bcnt = 8;* J( j6 C) l. A9 q( E
- static int ccnt = 8;+ f. { h" x9 d3 N+ l
- , ^3 @8 [" D9 P8 h- k- I
- module_param(acnt, int, S_IRUGO);
' X+ t; x5 N; Y+ P' n - module_param(bcnt, int, S_IRUGO);. v1 `7 }# x7 z' k& m( M+ W
- module_param(ccnt, int, S_IRUGO);
复制代码
/ q$ V: n+ W$ e9 [5 }5 d% k8 a7 t& [
/ F- a4 S$ t+ b. ^ w- h. P: p9 Z$ G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ @; P3 \# t- P" p0 R. Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! G5 M$ ~) `9 w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, h7 t: ^5 Z0 K) J
" {0 e D$ p* h, ~# m7 J; H1 W$ j6 f9 i1 @4 F5 d- f2 a2 A
|
|