|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 @. r1 ?) v2 h/ P. Z3 S$ s- [code]EDMA sample test application
: m% c$ C0 n8 u - /*
3 y) |4 U- J8 X" P- Z0 Y# G! H, F - * edma_test.c9 n# e% _9 Y+ A
- *
) V8 j0 K5 T* z$ _% ~ - * brief EDMA3 Test Application
b; U3 }5 }0 q - *9 i4 c# l+ R) h3 i4 s0 \* V
- * This file contains EDMA3 Test code.
2 [6 L; L4 P% r5 [6 h - *4 I- i) `/ F+ D/ _( [+ E, \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
|# T- y3 J/ v4 o$ y' e8 v% F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* t6 v$ s# p; v0 F - * TO CHANGE.& [9 U% w7 o, q+ Y
- *; I" O0 `' r8 P: n; p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 E# U5 R! Z. i c - *
# N% h" P$ M1 w) Q- |" Y0 p: U4 u - * This program is free software; you can redistribute it and/or* A/ Y* k' u7 o# E
- * modify it under the terms of the GNU General Public License as
7 t6 b, k) p( ^1 t8 _' f' H - * published by the Free Software Foundation version 2.
& ^" Q# N( g C# m1 n0 f: C5 d - *" C3 v% O! f) {8 j- _0 E. G8 E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 f3 c. G- h: w) J% r% j( R: v% V
- * kind, whether express or implied; without even the implied warranty
% G' b. P3 d3 @4 E& C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# j! o- S, x* ~( Z% z+ s
- * GNU General Public License for more details.! F- s% M' ~( e+ L2 s( u& @+ E- E% v
- */
2 I, P! I* D: {0 o' c
' l s! R5 B$ I- Y% c% f$ m8 {0 k- #include <linux/module.h>7 j; k/ @/ D2 m6 [* e& u
- #include <linux/init.h>8 b, C. B5 N! f- Q6 @) S! R* \5 Q
- #include <linux/errno.h>
" ]; |3 ^* \+ q" y% M: z# I* } - #include <linux/types.h>' @1 |& @- E+ I
- #include <linux/interrupt.h>7 u" [* ]/ l2 P. Z% R
- #include <asm/io.h>& |; U$ `) P% C7 B6 J6 ]2 p+ @
- #include <linux/moduleparam.h># _7 {* j' T0 _. j$ b a/ ~" L
- #include <linux/sysctl.h>
7 |: _+ O1 _, N: M - #include <linux/mm.h>
2 e/ W7 o8 M* {' J - #include <linux/dma-mapping.h>
8 ?1 v* y7 y. @8 u8 F; J4 J
; p k5 W* y8 y- #include <mach/memory.h>* b7 a6 m8 Q& T% v9 j5 U
- #include <mach/hardware.h>
- M+ ?- g8 E2 E - #include <mach/irqs.h>
2 r9 {1 J, j- @6 \- i$ s" s - #include <asm/hardware/edma.h>9 q; f+ D! e2 V& g8 D" P
" o& a8 C1 x5 t: `- #undef EDMA3_DEBUG
, B* ]' Y5 J" x! Z0 K& Q+ u" ? - /*#define EDMA3_DEBUG*/# A' n- v B \% F
- ) H% U+ k5 c8 y# {$ h+ P! }5 F
- #ifdef EDMA3_DEBUG
6 j4 M# Q4 y; h' U/ C# y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 V! m7 F: l6 C8 C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 B0 U5 E- T/ \2 e8 ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ H$ G' g0 g8 p3 t) |' }% \; c
- #else+ F3 E% F/ E! H1 k9 J
- #define DMA_PRINTK( x... )
7 j% V' ^9 |( M - #define DMA_FN_IN
, o0 C8 d& d: A$ G2 b. B9 h( J - #define DMA_FN_OUT
3 `- R: v6 S9 H! v* Q - #endif: z, m9 w8 ?! u0 l5 n
- : s" C. P7 H* L1 b$ G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. `' C' V: F' s; w5 q - #define STATIC_SHIFT 30 C& [. f9 q$ v* N( s2 D l
- #define TCINTEN_SHIFT 20
) s) s% U3 M4 y. ~ u, G - #define ITCINTEN_SHIFT 21
/ P) G% w- B9 n* G: n - #define TCCHEN_SHIFT 22' o5 T. g( Y5 V+ |1 n& C
- #define ITCCHEN_SHIFT 232 S6 b/ r7 S" T0 S* L
- * J' A: A/ \' i! R
- static volatile int irqraised1 = 0;6 h/ {* d1 z. N/ v' s: v: ?* C
- static volatile int irqraised2 = 0;4 g3 c! V( ?8 P1 e C
- $ @2 O' z" `* Z x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! {9 j2 W# }) F. K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ u7 i' i! z% j2 u5 B) }+ P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; _' W+ _ m3 c
+ H4 d" X' [- B: {# f' J- dma_addr_t dmaphyssrc1 = 0;
% c! x- Z# s' j1 \3 i) m8 z3 G/ W/ c - dma_addr_t dmaphyssrc2 = 0;- t# p/ w% j" G
- dma_addr_t dmaphysdest1 = 0;. ~0 y3 A0 l2 k6 C2 F' D | q Z
- dma_addr_t dmaphysdest2 = 0;
' _. i% A" G t+ ~ - 7 c- W: t9 [: M! |7 _
- char *dmabufsrc1 = NULL;
0 e; C1 M$ J! u - char *dmabufsrc2 = NULL;
- d% t, G: Z3 ^4 b - char *dmabufdest1 = NULL;! X7 E* S; N: m8 d; y
- char *dmabufdest2 = NULL;
3 q1 M+ U: \' T6 n+ V! c, N/ I" x; p
% q7 b* F* t+ d! ^. C! |- static int acnt = 512;# V, E2 |9 |7 x7 U" K* l: w5 E- W' G
- static int bcnt = 8;; Q# W% t+ G% m& G+ D
- static int ccnt = 8;
$ L( ^( o4 ?0 x1 D0 t; x - # Y# ^4 O0 H5 p5 G
- module_param(acnt, int, S_IRUGO);, }+ d3 Q% o ?
- module_param(bcnt, int, S_IRUGO);
) P# o i/ ?+ ^; n+ X - module_param(ccnt, int, S_IRUGO);
复制代码
2 [- }/ V, P3 X( w3 Y7 Q. X' d# @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 u- W6 k% x( ?) D8 z, R) `9 D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; s$ z6 [; \6 n' z6 M" G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, @1 k6 Z8 N/ p$ ` W$ N
. _$ R. ^: l# P5 ^8 s. S0 v0 p' l% H2 `
|
|