|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( c. n6 b: G/ a5 f- [code]EDMA sample test application' I! }6 W. {2 D) h# A( D6 z; f6 h$ ?
- /*
, _* L2 ~, W4 f7 F- Y - * edma_test.c) E g: h' C9 I% X
- *! N- P' p. i+ p( q2 {' C
- * brief EDMA3 Test Application4 `' r6 ]. H: Y' O4 o
- *; e2 q" |5 W( A9 u; w2 V" s
- * This file contains EDMA3 Test code.( A, {( i+ S+ s# p0 }+ {
- * l6 N) u* S* I& F- I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: M% k5 r9 i+ _8 n3 V" R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 Q4 C& P" k" i2 l( t% i" @
- * TO CHANGE.# e2 Z% U1 W' k* e5 M' t" u
- *7 {* j+ |$ G/ E) T! k8 X" r M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 [) m0 l' M9 E# R) b4 Q' z - * c8 O9 R+ _) f& K
- * This program is free software; you can redistribute it and/or
6 C/ W* o: N6 E( ?! ] S2 X- B- h - * modify it under the terms of the GNU General Public License as! D! B! |/ t) O# I1 Y' U6 H
- * published by the Free Software Foundation version 2.
G Q" l0 k" I - *( L: j8 M' O- U3 H' B, u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% @1 F1 t1 a' E2 l0 Y$ w3 m" T - * kind, whether express or implied; without even the implied warranty) Y; [" S* h# H, T# x% t9 l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
l& l6 J v/ ?! c. N7 j - * GNU General Public License for more details.% Y$ ~1 H; Q' M+ F
- */
/ Y" b& U' t) A0 ~% O! v/ H3 o
3 Y& p$ y$ W0 K7 L! S5 F7 h- #include <linux/module.h>
6 C4 g3 [( O% g( W - #include <linux/init.h>
+ | L }% f. |3 i+ t3 d8 ? - #include <linux/errno.h>
( O: ^2 V; \3 {& N- h- w) J2 m - #include <linux/types.h>0 ?* O! R c# M% W2 g/ T
- #include <linux/interrupt.h>
( y' b5 x; Y' y3 D - #include <asm/io.h>
3 e: l3 I- ?9 ?7 O2 z - #include <linux/moduleparam.h>+ x. }# A. `% C7 r
- #include <linux/sysctl.h>
4 U) L& d8 i# v3 \4 M, u& N - #include <linux/mm.h>+ A" q! T9 E& F# `; H4 A. B
- #include <linux/dma-mapping.h>
1 Q+ j8 e; N# r) ?! H4 G8 D: |
" R8 t$ s7 G0 C- #include <mach/memory.h>5 d4 x7 K0 u! }4 Z: Q+ x
- #include <mach/hardware.h>; `0 J9 V: j( M* X: V
- #include <mach/irqs.h>
( M0 h* i6 K( a - #include <asm/hardware/edma.h>
( W$ I& I4 U4 r5 }; g# F$ b
+ m8 E7 A( B5 _; F- #undef EDMA3_DEBUG3 ~* e! h5 }% o' n9 O3 x9 i% {- Z
- /*#define EDMA3_DEBUG*/
; |7 z8 J9 L* a) y+ t" W# \
6 q6 f2 x3 M+ T$ `( ~, Y, R- #ifdef EDMA3_DEBUG
$ R7 W n! {; u6 r9 w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) ^! J2 a, |: ~9 r3 y+ e h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 l4 ?8 e$ c! Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! \0 Q; X1 t2 F
- #else
% v$ K% r% ?% Z8 W - #define DMA_PRINTK( x... )
! N4 g1 ]2 H% K% \) _/ g' | - #define DMA_FN_IN
- a9 V' R6 ]! _" g5 I3 {! S0 f4 ` - #define DMA_FN_OUT/ G+ |* ]7 U% R% M1 L* C
- #endif- a; [. c) s. g7 \: d, ~# L; x
- : P' }: \' M# n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 Y. ^5 Y" T4 y0 E5 ?4 b - #define STATIC_SHIFT 32 v3 \! {& a% h7 B2 n6 y
- #define TCINTEN_SHIFT 20# [* B, V, M4 F" M, s+ a1 s7 \
- #define ITCINTEN_SHIFT 21/ _8 Z9 X) q' n' m
- #define TCCHEN_SHIFT 22
% t7 A3 o- Q9 a. G! \+ B) w - #define ITCCHEN_SHIFT 239 ?" Q1 o5 V7 O$ r
- 0 G4 _( I) l4 N) d7 m3 p
- static volatile int irqraised1 = 0;! n7 W' K- ^; h( S% [8 y
- static volatile int irqraised2 = 0;
' V. s+ j+ i- Y* V+ G - 6 } }/ L3 ]. Y6 ^* b" j5 x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 N( a$ h& L( Y% p- G& x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& y% h1 x( R3 A2 i+ m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
q& v9 D+ |! m P% m2 \% I - 5 H1 O* F4 x% f. ]( Z+ O. _9 ]
- dma_addr_t dmaphyssrc1 = 0;2 T6 e0 I2 v$ q+ }' h0 K# l
- dma_addr_t dmaphyssrc2 = 0;
6 q. D, G" r* {) N - dma_addr_t dmaphysdest1 = 0;
. d5 r1 g1 J( t& X9 U+ F1 [ - dma_addr_t dmaphysdest2 = 0;
5 j8 n3 f9 P; E" _ - - P% ^) i$ P' E
- char *dmabufsrc1 = NULL;, `7 f0 I+ P/ z. k* a
- char *dmabufsrc2 = NULL;2 o! b: v& i# F1 S8 c6 J6 F& X9 v! F: e
- char *dmabufdest1 = NULL;& t% _: _4 u- k$ v* V1 l9 d
- char *dmabufdest2 = NULL;
/ |( t( J( @7 U - 3 V& `) ^5 |' E
- static int acnt = 512;* ~* d8 a: m$ [+ _
- static int bcnt = 8;) T S, S! C! n: C4 K( F' u8 ^
- static int ccnt = 8;
! \' j& y/ y3 @% b9 ~( w7 O/ L - , a7 `/ v7 l# |$ `5 W0 D
- module_param(acnt, int, S_IRUGO);4 c6 N1 J: R; W5 D
- module_param(bcnt, int, S_IRUGO);4 s0 O0 \! y- h6 R* Z5 w( \) k
- module_param(ccnt, int, S_IRUGO);
复制代码
+ Y& h4 W: g$ N% l) X w3 G$ U% ?( \/ I: h- G2 b) J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ s9 x# `6 N8 Y o4 y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( }6 o. N) ^# a( q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' K4 J( J4 @3 ~* r; I6 d2 p
0 x& k0 G! I6 y# N' a8 r
# `3 t# W {2 l" P8 B) H* t |
|