|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 ?7 I( ]5 u% g D- [code]EDMA sample test application
: V+ P9 n: S$ d6 Z. s - /*/ n/ ^! G, p8 L! V" S
- * edma_test.c
* X5 w0 X- L1 Q' X* r9 O4 I: v3 c# [ - *
) d7 T0 E* |' y - * brief EDMA3 Test Application
' A4 I" k4 p, @# q - ** f6 G! \* ^* P2 Q% H# G+ a
- * This file contains EDMA3 Test code.6 u1 o( C( f3 @% x6 v/ F
- *
! [" S1 k" ]% r1 I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 }0 L6 N" C; J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. g$ @& |# F6 j( _+ [; v/ S
- * TO CHANGE.& u2 n- X7 Y+ ~6 E
- *
" e: ~' M. F$ E: q1 D/ D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) e8 _/ m# k" W& m! e- q5 z& [ - *
( [$ w4 q3 }+ B8 X- [( @ - * This program is free software; you can redistribute it and/or M) Z9 w; x7 B0 T1 U; `: h
- * modify it under the terms of the GNU General Public License as: K- [4 q6 f8 c6 k2 t6 ^9 |
- * published by the Free Software Foundation version 2.
" w% S! A. W2 q! Y7 `- |0 D8 Q - *. G: l" ?. x0 T) g+ B- z) Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 @: R/ B. a% Y. f
- * kind, whether express or implied; without even the implied warranty7 N6 _% x6 M: {8 s0 M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 ?) g. j! o/ V& R1 I2 j - * GNU General Public License for more details.
& X% U$ \2 x# s2 [% G: ?1 K n - */, G0 S$ @4 O8 |2 I5 S& \
- 8 Z$ @* Q w% e2 s0 l8 w' g6 d) g
- #include <linux/module.h>0 [* F# P4 _) n$ G% g
- #include <linux/init.h>
' ^7 C7 V: N6 @. P - #include <linux/errno.h>- W, Z4 g j" W, l7 Q. t
- #include <linux/types.h>
! x9 H: T4 t7 m$ s- \4 N9 S4 S - #include <linux/interrupt.h>
4 ^! p$ n5 L% m! O2 I4 _ - #include <asm/io.h>
9 \$ A! N' B5 ^) r0 V, |* s$ y( S# t - #include <linux/moduleparam.h>
' h* w* g! V3 M/ X1 D, U4 z - #include <linux/sysctl.h>( y3 T) V, T" `6 ]! h) Z: Q& {) P
- #include <linux/mm.h>
. z# W6 y, O9 D& [/ ~- k8 L - #include <linux/dma-mapping.h>
/ Z. h. ~/ k8 C4 q- E) h* @6 U& |0 Z
2 C6 f, Q) `# g0 Y' \) ]) z- #include <mach/memory.h>
( F) @; ^. b/ O6 v - #include <mach/hardware.h>
' v8 I0 t0 q W+ c$ Q* ^ - #include <mach/irqs.h>
+ ] L. Q4 r( `$ G7 h - #include <asm/hardware/edma.h>
( r1 o2 f% I- L7 E! {
0 [- E" e. `2 f0 Q- #undef EDMA3_DEBUG2 ~- z. |9 W- C9 U) @9 E! q
- /*#define EDMA3_DEBUG*/
( Q5 X) P: j! }: S6 Z) f! \
3 a0 k7 z! f) F& I+ x E7 y. ?# q- #ifdef EDMA3_DEBUG, v7 x; D/ E: g4 Y; [4 p" Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 Q9 h! u& b3 _- u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 e `& H! Z( S! G3 Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 J1 B: W8 L1 s
- #else, E' ?! x8 Y6 ?' u G
- #define DMA_PRINTK( x... ): B( s5 R* S$ p8 B: d; l7 S& u7 S
- #define DMA_FN_IN, j8 ]5 l6 f8 ~6 d0 y) d |
- #define DMA_FN_OUT
4 f! N0 c$ e- [, ^2 R$ _* a" r7 v$ u' Q - #endif
5 L/ C# t/ T* R: j8 w6 } - - ]( \ l2 ^+ b0 C0 O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), p k. X0 t- A& _9 U2 `
- #define STATIC_SHIFT 3& Z; E7 k" T3 g1 ^" R
- #define TCINTEN_SHIFT 20( C) w5 I. ^2 u2 y* S
- #define ITCINTEN_SHIFT 21: ~8 }3 W+ d. w
- #define TCCHEN_SHIFT 22
8 q4 v. \' K/ n - #define ITCCHEN_SHIFT 23! M3 [$ c# V7 w2 q9 O
- ( ?8 R' n! q7 ~" O) W4 w% ]! s9 H
- static volatile int irqraised1 = 0;
6 T/ [+ S g9 ]3 P' n% d" { - static volatile int irqraised2 = 0;
5 n8 U3 [' E9 s2 s - 2 N+ N4 M7 T: B" A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; O' H* \" M' J3 g6 u' M* u( f* x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
o' J0 a. L% u v |( { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! _6 z" P" {) |* n - 0 z' o l* n, d9 U y9 V
- dma_addr_t dmaphyssrc1 = 0; B& `1 p# n) f' Q$ L' W
- dma_addr_t dmaphyssrc2 = 0;
f/ P5 Y( x" t* k* h, Y% h - dma_addr_t dmaphysdest1 = 0;. l9 k8 e% r3 I- w: a
- dma_addr_t dmaphysdest2 = 0;
/ t; _- |$ [" X& ^3 q/ _
: U1 H- L( u8 g- char *dmabufsrc1 = NULL;; g$ ]4 F1 t+ `& X, O; E" T
- char *dmabufsrc2 = NULL;
! i! J- j% u8 v' p* ? - char *dmabufdest1 = NULL;
; X- M+ @- v% Q6 G7 d - char *dmabufdest2 = NULL;- H6 [' S2 x( ?' }
- 7 @/ @) j, X* b9 _
- static int acnt = 512;
5 C8 r$ y( ]3 W+ H, d% c: O - static int bcnt = 8;
, ]5 g1 }! x! c ? - static int ccnt = 8;
1 w l+ W+ ^( C
1 f/ h) L P5 I4 f2 z- module_param(acnt, int, S_IRUGO);
3 e$ o3 X0 t; E* K - module_param(bcnt, int, S_IRUGO);
- J' Y+ z7 g$ K. P, T; Y - module_param(ccnt, int, S_IRUGO);
复制代码
: \* ~" p0 y5 t; K$ |
8 f3 W9 B1 F" F: K2 I: S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ {! P4 j3 n+ e/ M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 N7 `* d" H* A% C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 \" I5 t; K y
% i" S; l( Z* F" I
2 Q, Y1 ~4 i& m
|
|