|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, s, m- F- u4 u$ N5 B' m- [code]EDMA sample test application Q# }: r' X1 R. A: d. n9 k
- /*4 q- `0 Q+ Z3 Y) \/ S e$ ~0 z6 r4 ~
- * edma_test.c
, v. r0 f. w0 _! ~. R - *
9 f. h; F6 [, `& H: p% J! |! e5 d - * brief EDMA3 Test Application1 o3 l" R9 Y$ x2 n# N% {4 D* ^, D
- *
& e$ J4 \4 \% y7 D" j" j2 }4 ?0 X5 i - * This file contains EDMA3 Test code.
4 l7 ?8 y h$ B - *
5 H$ v; f4 A- e4 V, A2 R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 i" G$ e, q2 v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 C# A+ c; _% c9 v& a+ } - * TO CHANGE.# k9 Q) ?3 W% ]
- *
4 j2 m6 z; E( w( z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, `6 t! v/ t W1 ~( {* [% L - *
& P# ^3 {) I5 H' f6 } - * This program is free software; you can redistribute it and/or
; s. X$ t1 y @" Z% Z- b! v - * modify it under the terms of the GNU General Public License as
0 q2 g$ S& ~7 s I - * published by the Free Software Foundation version 2.
+ L6 Z1 ^7 @' O9 x3 ]* o - *
5 s) s8 J! U6 v% ?9 \' c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 ~/ N' U/ w& ~( w - * kind, whether express or implied; without even the implied warranty
& f, X1 ?' I0 R* U) i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 }' {6 [1 q% {' k h
- * GNU General Public License for more details.
; B) a5 t X, S+ p( Z: q - */
: ]8 L8 L) z: X) V$ D6 u
' c( J+ r1 Q0 x3 n- #include <linux/module.h>
& h$ i+ @, _4 Z - #include <linux/init.h>, t- u9 t S# r
- #include <linux/errno.h>! t6 P4 ]+ }9 z$ z8 e( ~ j
- #include <linux/types.h>' G+ Q) _. n" e* |
- #include <linux/interrupt.h>2 n% O* }- F' m4 H/ W: X* Y- e
- #include <asm/io.h>5 E2 w& U5 q4 ]2 f2 m5 I3 ^
- #include <linux/moduleparam.h>$ `' A/ |- \: j) v) \1 u
- #include <linux/sysctl.h>$ G6 n8 b, e* P# h! v, J) u
- #include <linux/mm.h>0 D9 B6 O+ J1 x+ }
- #include <linux/dma-mapping.h>2 ~3 u% P: }: A2 q4 r; \3 C
* u: z5 |) e* ^- #include <mach/memory.h>$ z% J8 c8 A# X
- #include <mach/hardware.h>5 O; y3 p, k$ K: v" d
- #include <mach/irqs.h>
4 A* R& t9 a; c2 t: e m - #include <asm/hardware/edma.h>% k) M% C9 D! K: E3 I
- ' h) [4 w) s& d- q) T3 Z
- #undef EDMA3_DEBUG# q! J: d1 ]1 i: x
- /*#define EDMA3_DEBUG*/$ [+ {) P! T( `% y7 Q
- . g8 c) X1 S/ W# J ^" ]$ V
- #ifdef EDMA3_DEBUG
+ t" ^; r. m, `2 g. n8 O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 D8 R. t8 P2 h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- [( {. @' ^$ D2 u& k, A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), ^+ n& L* @6 M
- #else
; q$ ]7 U- {& E- c2 M: j$ J - #define DMA_PRINTK( x... )
" z! J- D0 F% o& k# V9 ^! _: E - #define DMA_FN_IN
& e' w- R3 F" j1 P- g/ L0 l3 T( _ - #define DMA_FN_OUT, _9 M( [7 _. u: d0 [6 M% _
- #endif9 e2 b, J# l+ P& a/ P1 S, X, ~
! u! G" H, R) J4 V5 Y$ w% j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# ~& E L4 ~) A2 J - #define STATIC_SHIFT 38 B- M, ?) O( M' e5 Z# O6 m
- #define TCINTEN_SHIFT 20) x" G1 i+ u; d9 `. J% G
- #define ITCINTEN_SHIFT 21
' y( x! m& B$ v7 q8 B$ ? - #define TCCHEN_SHIFT 22
8 U) s2 a0 s/ K# ?6 n. B - #define ITCCHEN_SHIFT 23& V9 C# s; v" F, O; }2 j B! F
- 5 M+ U- ^, ~2 B9 U1 n/ S9 G0 c4 e* X+ \9 @
- static volatile int irqraised1 = 0;
8 [. U( q' H h% y- ~7 V - static volatile int irqraised2 = 0;4 H8 B% F/ j) u5 y, C
- / w" I5 o- D s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' J0 c" f% W. }9 ~6 f6 t6 ?/ Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' F/ A4 l4 _5 j! R; Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' W& e$ ]% Q5 x8 D' m - * g8 x7 A: I! C5 W' } C
- dma_addr_t dmaphyssrc1 = 0;
$ f/ O; @2 j( h) k* } - dma_addr_t dmaphyssrc2 = 0;/ h7 |& E+ w% T, _; o' i6 w
- dma_addr_t dmaphysdest1 = 0;! ~8 }. L; ^+ @5 ?
- dma_addr_t dmaphysdest2 = 0;
2 u5 ]/ d# u$ g Z- M# d5 r& t
' i6 m& l2 L! m* n* }, Z3 A& V& ]- char *dmabufsrc1 = NULL;
( E" ~" n7 Z0 r) f - char *dmabufsrc2 = NULL;
6 l/ }9 [( H# N& q- L0 e- p: W2 J - char *dmabufdest1 = NULL;
3 K! n% D/ J1 ?/ R# q/ Q( L - char *dmabufdest2 = NULL;
7 O1 [2 E0 W5 _! w8 u2 u3 P2 S+ A
3 ~5 \4 x9 f* R4 X* k) J, U- static int acnt = 512;
' s2 d# @ H0 ?+ T \) d) Q8 R - static int bcnt = 8;4 F3 Q3 b. o" ?- o8 V
- static int ccnt = 8;9 d* V) F5 Z* g- |7 K
- 7 ~, P5 S8 \; `/ X/ D8 _
- module_param(acnt, int, S_IRUGO);
4 \0 Q, C/ l, _# E% A3 z - module_param(bcnt, int, S_IRUGO);$ A: ~. Q4 R' m
- module_param(ccnt, int, S_IRUGO);
复制代码
& c; n+ Y* W6 v' L; G8 B }8 \5 m& s& O3 h$ h/ R2 x( G3 G1 j" q! P: w( k1 ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 v: j! w, M+ T* Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) U" x" a7 k! Z5 } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 Z% @! F$ Z4 P- e
7 E: ~9 X6 |- \) v! U
! \3 D: }- ?5 g: A3 z |
|