|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 H* P r! |7 r/ G+ {/ i/ o- [code]EDMA sample test application5 r; o, J# o h9 z6 V6 e
- /*4 f* l7 g3 w l* f+ X
- * edma_test.c
) E, t C1 K5 r5 A: z - *
l; n$ z* x$ w" { - * brief EDMA3 Test Application6 l, [7 \ X( d4 H" H' Q5 K- W
- *3 Z+ O+ v; ? s6 `, R+ R- D
- * This file contains EDMA3 Test code.
4 @& }+ p) g0 M* B) g - *
3 g: I6 u9 [$ U$ s; t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: M/ \2 g G! y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( D3 I2 X) k; e! c3 H. ? P, L - * TO CHANGE.2 e. A2 T: t5 ?2 T/ ~
- *" x, }0 S9 v( p( y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. ~3 Z: G6 v% u& @ i7 }( D - *& S5 t; [! l7 q, [' E( J# _' f
- * This program is free software; you can redistribute it and/or
6 m. }5 \7 c: x0 |! U - * modify it under the terms of the GNU General Public License as8 ~/ L9 h* e, ]8 P
- * published by the Free Software Foundation version 2. [+ i$ C% H, Y8 n8 |5 Q2 O
- *( F. P8 E4 @- } B% H9 u/ q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" R; W4 U% ]" H2 j
- * kind, whether express or implied; without even the implied warranty* V. U' a5 n5 I: N( c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) j" h- W# p5 M& m9 u" T - * GNU General Public License for more details.
2 b' @/ d+ c Z( |7 s) p; _# \ - */
) l8 n- s% c& W4 B - 0 `/ X) J# P% x$ @3 |# p9 L
- #include <linux/module.h>, l2 m. Z0 v) T
- #include <linux/init.h>" z) w" u: ~2 e p
- #include <linux/errno.h>
* m+ g" t& ?9 d" w. w - #include <linux/types.h>- R) O _; d7 z u
- #include <linux/interrupt.h>
+ ~! _" m1 v1 u - #include <asm/io.h>/ K; o2 K! M0 A* n$ v
- #include <linux/moduleparam.h>. z% r; n0 Z- b0 X/ N2 T# a; u' O X
- #include <linux/sysctl.h>8 k# H/ ?; q7 ~
- #include <linux/mm.h>
9 v$ l5 Q/ n$ X, J - #include <linux/dma-mapping.h>; _/ G+ c# b8 e( b3 j1 q
- 0 h8 ]7 i) V; c) h5 F* n2 K% K
- #include <mach/memory.h> i/ S4 ^2 }. B1 l
- #include <mach/hardware.h>1 o. A5 F" w' G; y7 }
- #include <mach/irqs.h>
$ C' N, G0 k# b1 t; N% h - #include <asm/hardware/edma.h>9 L: o; j+ G; f5 p% k+ G' i4 o
& F3 S: ?8 d+ r; Q2 S, Z" s, _9 x- #undef EDMA3_DEBUG
: @3 u5 y8 x: y' A - /*#define EDMA3_DEBUG*/
' Z4 @7 q% o2 L: H' I: t! I. L$ Q
# j5 g' D% _6 `- #ifdef EDMA3_DEBUG
: q# \/ C5 z2 G2 L+ B5 H8 R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' k3 ~, ?7 W1 [6 u3 O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, H; E2 [7 G- r# x; [- L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# Z& E4 J0 d: i; v. f4 i# r" c; i3 F - #else9 d V8 y: G" Z9 N
- #define DMA_PRINTK( x... )
! _( C4 u o5 ^% |, L - #define DMA_FN_IN
. K0 U) B; Z) [. b6 x( V - #define DMA_FN_OUT
) k& a# F6 m' q( d [7 o" J0 Z - #endif
' h+ X' _9 q1 d5 W$ o) i/ M- v7 ~3 }& I - , A6 F" H0 Y4 F1 B6 H$ ~2 {) e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ F8 ?0 k# w Q( V - #define STATIC_SHIFT 3
4 W: \4 y$ X9 z, n - #define TCINTEN_SHIFT 20
1 @5 L+ @4 I# w( A1 u( U6 o - #define ITCINTEN_SHIFT 21, Y: B$ Z+ Y! S6 |
- #define TCCHEN_SHIFT 22& F A/ V/ K5 h) z" q: L" j
- #define ITCCHEN_SHIFT 23
5 r3 y1 l* @0 y
" Q1 ^- _0 s2 ?% ? q( B$ S% I- static volatile int irqraised1 = 0;
( l( H2 u6 J$ p' ]) @! a. ^ - static volatile int irqraised2 = 0;
6 E# T1 _& \! u* S, M/ D - # A; T+ s9 ~: B$ n+ I7 y# O+ C" d3 q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" v+ q; C2 l0 J- a6 q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 M0 {0 z! X; o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 Q* u) v: N% ?+ r
* A1 z4 z4 _/ Y- dma_addr_t dmaphyssrc1 = 0;5 b$ ~) J0 B9 D& o( r6 M4 F- w
- dma_addr_t dmaphyssrc2 = 0;
( j6 P! k5 I9 m! O - dma_addr_t dmaphysdest1 = 0;
[2 E/ T( V8 b3 U0 a - dma_addr_t dmaphysdest2 = 0;
9 L: n8 {! a% k1 v
7 `: g/ [) z& G6 [. q% A) e/ d- char *dmabufsrc1 = NULL;. c; X. z+ X& S: f4 Z( r! z
- char *dmabufsrc2 = NULL;
3 h& I9 H* Q0 q# J4 k' j' G - char *dmabufdest1 = NULL;6 e0 x' x9 u1 W7 Z$ ~
- char *dmabufdest2 = NULL;/ t& I( l7 B+ r: \) J4 V
4 G, x; ]; f2 F( O4 f7 M, b2 H- static int acnt = 512;9 G* S8 s3 x' Y
- static int bcnt = 8; ?2 o7 B* @% z0 l5 }9 F# B
- static int ccnt = 8;
$ \1 H7 a9 ^4 n( @# i - ; Y8 h8 U" ?: @3 C$ X
- module_param(acnt, int, S_IRUGO);
: y9 `$ \. {6 m4 f/ Y- @ - module_param(bcnt, int, S_IRUGO);5 {5 Z% [. t) j1 W- m0 P
- module_param(ccnt, int, S_IRUGO);
复制代码
( L* s' i' x" M* C5 w7 j, O1 ^+ C3 E# ~- u( `8 J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- b7 _6 c0 ^5 ], L9 s& `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 b. m/ c3 Y' U% R/ x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( U n8 T) x: ?0 B. b8 e3 X3 m- ^7 W1 Q% [# m" H7 } X3 d# B; C
, U7 d$ c3 W2 T* L4 i |
|