|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . S$ S6 @7 F* b2 l
- [code]EDMA sample test application
0 }7 p, e2 A; P V W - /*6 v$ P+ W r6 n o) L+ T& q. W
- * edma_test.c7 {! g+ ~ W, r- D
- *% v4 ?& b* ?( h" p9 y( o
- * brief EDMA3 Test Application* x8 b/ Z! |5 p
- *7 y2 O0 `2 h3 }
- * This file contains EDMA3 Test code.) ?' S9 J/ V. b# ~( }4 ]
- *
+ x: H# N" |# p1 T# R8 s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 g4 }0 d6 C+ U. R7 g0 c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% s1 X( [$ x* _( v# N4 x- C
- * TO CHANGE.
' P$ R0 ~3 s" r/ O8 q( r3 w) i: o - *
" \; H" c* [5 O$ ?* _) h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* o4 s0 F. t* M2 U - *3 R7 D3 T) z0 l1 s! n' ~7 {1 ~
- * This program is free software; you can redistribute it and/or
8 \/ `7 I& H& @3 }9 z! n( @ - * modify it under the terms of the GNU General Public License as9 Y. ?0 b1 T R, A$ H6 Q
- * published by the Free Software Foundation version 2.8 V+ \& y" e1 ~7 B
- *# I8 Y( Y1 G- w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 N9 U, T- V0 y, R' Q
- * kind, whether express or implied; without even the implied warranty
2 P. a' R1 A: C6 i* b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 m3 d4 V y5 `& B# Q0 b1 b
- * GNU General Public License for more details." ~- V3 Q" o) D1 S) `! k% z
- */
! ?* d l7 Y2 E C3 }5 |+ B' q - . Z7 x `1 n$ O- e' I' ]
- #include <linux/module.h>% {/ i5 {- \ x3 V( {
- #include <linux/init.h>% ~, m; z1 _/ c# |8 H
- #include <linux/errno.h>* G5 D7 E* f9 `; K& B
- #include <linux/types.h>
x9 e+ i) u5 i8 X1 t- X8 O) _ - #include <linux/interrupt.h>
! @6 o8 F/ \2 U' Y; g - #include <asm/io.h>3 X* j3 S0 u$ f
- #include <linux/moduleparam.h>
* v9 q( K- X& A% b' Y* U& h S( k& i - #include <linux/sysctl.h>* j4 p+ ]3 Z8 f: c% p' q
- #include <linux/mm.h>
. ~4 E$ ]4 g( g4 }0 p - #include <linux/dma-mapping.h>' X6 r& V# Q- m4 b
3 W2 |& {- O3 _- #include <mach/memory.h>4 X: s; {; `# X9 H) d) l
- #include <mach/hardware.h>( W4 d' M2 d5 Q7 X5 H+ D0 F
- #include <mach/irqs.h>
1 x- o% j% N; n, }, N - #include <asm/hardware/edma.h>" ]( s, s8 f, `; [- D, w& \9 j
0 n u) \! j9 R- #undef EDMA3_DEBUG
. C* m; x5 c8 s+ h' B - /*#define EDMA3_DEBUG*/
% Y* U9 q! h7 \ e3 H
2 X$ U* N4 i7 ]. B, n- #ifdef EDMA3_DEBUG3 B) b0 P# L/ X5 `$ W, ~6 g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. h' N4 n) T8 \! q( L V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); j3 q' \; K& d% t0 t9 @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) s+ z0 k1 P( ? o- p - #else1 z0 u. W. z. K5 K9 g W
- #define DMA_PRINTK( x... )
$ P9 D1 K$ W$ |# o - #define DMA_FN_IN
+ v# H: ?6 ]9 s$ @4 [' {" Y - #define DMA_FN_OUT
/ T0 M; M# k& \0 i4 ^* Q - #endif
/ c8 U. }4 i! F9 g5 ?0 |0 p C# C
/ `& c' ^. W5 }" c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 C! A g! Q2 N5 [/ D/ q- H5 Z R - #define STATIC_SHIFT 3' K' ?/ k: {- P7 a$ E" b% O6 C
- #define TCINTEN_SHIFT 20
; e3 J* V- z! ` H9 ` - #define ITCINTEN_SHIFT 21 t4 f6 X* V m+ F
- #define TCCHEN_SHIFT 22
! K6 s, l+ H) E8 o - #define ITCCHEN_SHIFT 23
. h( j; g0 ]: J' M# q
' |* g& r, _3 v' t4 @0 W- static volatile int irqraised1 = 0;
+ O4 N, E5 ~4 t3 P, o - static volatile int irqraised2 = 0;
& @2 g6 }/ x- S- d" { - $ r$ k5 u: e3 r. Q* x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( K) f4 x3 m; F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& L! @( c+ t- v9 U4 G5 [0 t: a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 X& l5 z- g! K% I8 {
- " v; L4 Z. i+ @' b3 v4 X
- dma_addr_t dmaphyssrc1 = 0;- p' c% g+ b! p1 i" X
- dma_addr_t dmaphyssrc2 = 0;: ? _3 {! T7 k# U9 r$ ]" k
- dma_addr_t dmaphysdest1 = 0;
& k$ C1 X0 ?) V" f' \ - dma_addr_t dmaphysdest2 = 0;( y1 m- Z. T. Q1 x% r' i6 m
- " q, U1 @) a- d6 k1 g9 K# S
- char *dmabufsrc1 = NULL;
& \' F9 ~* E& V+ } - char *dmabufsrc2 = NULL;2 d1 B( m' r" p6 n/ W
- char *dmabufdest1 = NULL;4 U: ^) g0 g O7 L5 K% k3 x
- char *dmabufdest2 = NULL;
; d0 C' m+ t" ?$ z9 [4 A4 {7 r, a
9 p( ~* H a+ i" A6 l$ l. _- static int acnt = 512;
% _+ o2 G( R, M! `* h - static int bcnt = 8;
/ p2 g( k2 D! L - static int ccnt = 8;
0 M) T+ a% A1 R, E: ?( N; T
% Y- }6 I2 p6 R0 J- module_param(acnt, int, S_IRUGO);$ V5 ~. I# ]. q+ g8 v" [/ n
- module_param(bcnt, int, S_IRUGO);. N% ~+ {4 q% O- D8 W: Z, e
- module_param(ccnt, int, S_IRUGO);
复制代码 ( n H5 S, h' w) R0 Y6 J
& v3 Y7 F- D' J/ n2 q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 b" M9 Z9 I, h3 D) parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- { s, o# m. g) P9 G7 }. w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 V" T3 j/ q4 I1 B5 Z& x
0 E) s' P5 n+ K( B
! d n7 \# j- O. {# s |
|