|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + R3 _! U7 }3 u, T' S. P
- [code]EDMA sample test application1 ~' n) l, k/ Y, q
- /*
' W8 M# l2 A4 l+ _3 p7 @: l - * edma_test.c8 I- ]# m$ }# R9 f+ U3 i4 E4 O
- *
) |6 Q D2 S' t# t - * brief EDMA3 Test Application9 f9 C6 E3 Z3 [# p2 \
- *
$ C8 P. Q0 Z- S! R) Y% ~ - * This file contains EDMA3 Test code.- d4 i* ?$ i8 N3 s% D4 G5 A
- *
" ^ o- Z- K6 `) b" I7 j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 }! u- V8 |3 w4 E2 V3 a8 C; u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' O$ x- A+ v/ K$ Q' N
- * TO CHANGE.+ C8 J0 R% k7 l
- *
' D% P, f& l' s& J* a# P# N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. @' g& K2 U( R8 X/ u+ f - *
8 X, o5 j; F: ~0 T8 z - * This program is free software; you can redistribute it and/or
2 s: a& [ L3 r0 @" l$ r; f$ J - * modify it under the terms of the GNU General Public License as
1 M* |. K0 @' _& y' E - * published by the Free Software Foundation version 2.
2 o% H2 j5 T0 U" |2 {2 h% Q% `% n - *
|8 M1 w1 Q! I2 q" S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 E4 m5 Y- V4 \ - * kind, whether express or implied; without even the implied warranty6 K- U9 j5 o& \2 F0 V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. p: q r2 q9 M) [, Q# W8 `. d4 D; d - * GNU General Public License for more details.
4 u% g, Y, ~: z6 _: M - */* s. [# z" T6 B2 K# c0 }
- ' x) f7 f6 U: V9 O& J& D2 ?9 U
- #include <linux/module.h>
+ l. V; [3 K2 p. T3 ]' h" T7 A1 j9 } - #include <linux/init.h># D F) u: V+ i' S1 { C. Z
- #include <linux/errno.h>5 _0 R6 c# i" X7 {: N! J
- #include <linux/types.h># {- k' v8 U9 l, i; }( n( [
- #include <linux/interrupt.h>* F1 Q- s; f/ A& R! Z9 x, b+ b
- #include <asm/io.h>
1 B" j+ a. X3 V1 `* k) k - #include <linux/moduleparam.h>, O7 s6 U3 g0 C9 T# J6 \
- #include <linux/sysctl.h>, \3 o0 F ^) W* _9 b9 Z# m) F
- #include <linux/mm.h>) m9 Q8 Y: Y: c1 |( U% V7 P
- #include <linux/dma-mapping.h>+ t q+ U! a3 J! o
- & u [7 m1 A+ {
- #include <mach/memory.h>
; q9 g: t6 v- |" k7 @ - #include <mach/hardware.h>
- y2 \! T! B8 B+ A% i - #include <mach/irqs.h>+ E. b) h7 l9 k( h, ]! B- f! Y8 o
- #include <asm/hardware/edma.h>
& q) H, j* x1 V. J$ m F - G$ d( H" ^$ n* e/ V
- #undef EDMA3_DEBUG
8 r8 o$ ]1 q, V$ f4 V' }, E - /*#define EDMA3_DEBUG*/3 p0 C4 C& t8 d! m* N
; {# P# [/ @! ~# B" b& f- #ifdef EDMA3_DEBUG
7 C8 g! g) @7 j- X( T, J- y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ d1 S2 D5 A0 \# Y$ C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* H! |3 u- ]$ y: m/ A+ ?9 e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 R3 w' [ n* M$ V6 x# a2 i - #else# g U$ ^2 v. S0 J$ j9 e4 M: i5 K L
- #define DMA_PRINTK( x... )
`( n# w3 r; L - #define DMA_FN_IN
P, k7 p8 N8 B: ?: K' C* A$ c - #define DMA_FN_OUT$ T3 j8 J# t& n* t4 W- R" {1 [( G
- #endif
* I( C2 X c- g0 q4 U
6 ]% a5 }' l) Q, r. w5 P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 U6 l$ d# |$ I' V
- #define STATIC_SHIFT 39 X7 X: [1 f5 [& o& F: H
- #define TCINTEN_SHIFT 209 C5 O& O, k: S9 M1 q; c
- #define ITCINTEN_SHIFT 216 E* {# \+ q1 j5 }6 r
- #define TCCHEN_SHIFT 22# J7 N' P/ P* J. V, J
- #define ITCCHEN_SHIFT 23
7 q5 I# z4 I, t! j3 B* D8 x7 [0 i
; y j6 p3 m; T& M- static volatile int irqraised1 = 0;8 \" s3 n' D1 Q- z/ a2 [" Z
- static volatile int irqraised2 = 0;) ]3 b7 ^* }4 @' t8 [: X
- " C/ R3 h% L& j/ M( ?
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 R! r% _7 U6 Z3 V* V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 ~, V2 N5 G! Q" x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# U# U. J* u& H! p; H: S1 N - 8 r$ x& e9 F% f- } t. ~
- dma_addr_t dmaphyssrc1 = 0;
- ^" y# P! K& r$ l3 R - dma_addr_t dmaphyssrc2 = 0;
. t7 z G( i9 w- {. n: ? - dma_addr_t dmaphysdest1 = 0;
# f2 m3 h0 B( V2 V4 y% b' q$ w - dma_addr_t dmaphysdest2 = 0;
% k2 h3 D1 J9 e4 b - + U+ L3 j) A4 d0 x" z; |3 ?0 _" l5 l
- char *dmabufsrc1 = NULL;3 Z: }% {9 D& B3 O. L7 x( ?
- char *dmabufsrc2 = NULL;/ P! p# t3 v2 x5 b' }
- char *dmabufdest1 = NULL;
9 H: ]$ \5 m& B" f/ ] H9 o8 U - char *dmabufdest2 = NULL;
1 g8 E3 h* j8 b {. r - + J" B% m$ z: k0 [/ A2 K" t
- static int acnt = 512;" X1 o0 l1 |. A2 V% F9 Q
- static int bcnt = 8;' t! g; c! C* }6 e
- static int ccnt = 8;; d4 \7 E7 @# S' O; Z4 i2 g
& |. f" h& `0 B( H* g4 `- module_param(acnt, int, S_IRUGO);
a* z* z2 [( d5 h4 R' D - module_param(bcnt, int, S_IRUGO);
/ J( Y, j- c. p4 @ - module_param(ccnt, int, S_IRUGO);
复制代码
* i: j1 O6 J' O3 |' p: h/ F' ?, y. x* q# g, {" ~( V: n# C# H5 ?* ]: U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, M3 C" \ \! I u7 i$ _& f1 e5 H" t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 z- {) [1 W7 R0 G; K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 b& ?3 ]2 i+ Q, R; X
. E3 q; W& z* p& Q0 N! i
6 r) o$ Z( J$ v- x |# p" w |
|