|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ k% V& W7 H/ \- [code]EDMA sample test application, G U) C: F9 q! I% Y3 i
- /* Q# K, f' Q5 ~: ?6 h
- * edma_test.c
9 u$ ]% N' T i& x7 I - *
) S4 D W) U1 ]5 ~8 C - * brief EDMA3 Test Application" {3 X% u" y9 y9 G, v$ G
- *
- f: `; p9 y! C' E - * This file contains EDMA3 Test code.
- T0 W+ g* a2 G. v1 ^ - *
% \4 }$ n+ `- h* {' y$ R3 y* g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) S5 n. { E) w; E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) J* `7 K2 A" Z. C# f0 g# b - * TO CHANGE.
4 p1 R% F5 b" x, o- ~ - *( }6 O9 X, t& W+ ^! r: l! k8 p9 Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% `# z# Y5 M" c1 @! `7 r - *
5 G, z/ }& \& \! @7 G+ @4 W - * This program is free software; you can redistribute it and/or
~ h' \; u$ J' O; b- _7 |5 H - * modify it under the terms of the GNU General Public License as
" P2 h) W$ X9 D* I7 E+ c( S$ _ - * published by the Free Software Foundation version 2.
7 p7 h0 B! }& A3 {4 f1 W - *
2 Z0 y- ?+ \# n/ n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ q% n2 ]% K2 D0 }% L
- * kind, whether express or implied; without even the implied warranty
2 f( v( ]3 w5 \" B5 Z' U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# X2 M+ `2 L) g b
- * GNU General Public License for more details.
4 \, s' y1 v# ?$ P- r' V - */; h9 o5 f2 s# X% s; `
- " l% j0 [+ N5 I! G% J9 L p+ t# M! k
- #include <linux/module.h>
+ _3 A6 P6 M2 A" C! D - #include <linux/init.h>
% I4 d1 y3 y0 g0 W! N n - #include <linux/errno.h>
! E+ q. t& l" p$ ~: T, D! n" a - #include <linux/types.h>
) [$ u; R# K u y4 y - #include <linux/interrupt.h>
! o3 W9 B! e0 V: ?/ ] - #include <asm/io.h>2 J6 G/ P* k8 c& s7 ]
- #include <linux/moduleparam.h>- |9 e' _0 c \7 {# B0 O
- #include <linux/sysctl.h>
) N5 i U, D, e, i- D - #include <linux/mm.h>; d) o# G, i4 R, _
- #include <linux/dma-mapping.h>
+ O k3 P8 z: b
. ^5 S7 `1 G* f- #include <mach/memory.h>& l, J j; `4 V& Z% ]7 f7 Y/ I
- #include <mach/hardware.h>" v, E$ j0 V( x
- #include <mach/irqs.h>
' r. n- }+ g& J - #include <asm/hardware/edma.h>$ a7 Z# q# I" k4 b- Z' w
- ( h7 P4 \: L8 q
- #undef EDMA3_DEBUG8 d2 f5 ^* G, y: K+ N
- /*#define EDMA3_DEBUG*/8 ?1 J! y; D9 c1 n
- , p- `: a; K# }, E- x: Y5 V3 ~) l) F
- #ifdef EDMA3_DEBUG
; V. [; v- e, n' {- N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 z- n1 R$ B9 f' C4 S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" b' o" @: \7 V$ J/ b3 t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* p2 e9 H* f( k$ G8 | - #else
4 F* H) E% j7 v9 G2 [* I - #define DMA_PRINTK( x... )
5 M# T6 ^. P9 s: {' l: r4 Q7 r# X$ F - #define DMA_FN_IN$ C E3 J' l; p- ~
- #define DMA_FN_OUT- h( T5 h; f, f7 R
- #endif
2 y) E( l% f' F: z/ o/ g( t1 x
# H3 M9 s7 A7 n8 k& X r$ p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 K# @+ B5 C& ]* H# b) q - #define STATIC_SHIFT 3
, v+ h! I( P7 [3 C* H2 s - #define TCINTEN_SHIFT 20; c6 f( J. V2 N& f
- #define ITCINTEN_SHIFT 213 ^ h/ S; K/ C
- #define TCCHEN_SHIFT 22
" ~- c1 }4 j$ I1 F2 S# B2 t - #define ITCCHEN_SHIFT 23
T9 Q9 i( S; d8 o; ?8 \; W
; m! {! b8 g2 w; h: c- static volatile int irqraised1 = 0;
) q' }% M, D( t+ H3 ^6 G+ Y; s3 S; @ - static volatile int irqraised2 = 0;' \1 n8 T, v1 k, e/ p2 a9 m
8 K) N( r, I$ c* `- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' @( L) _' }- m' h7 i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# T9 \: Y* Z" H x# A. j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ |& |6 H& b1 E+ r
- 2 n' A* B, U3 I+ I: p4 [. u. h' D
- dma_addr_t dmaphyssrc1 = 0;. s$ I/ j1 e4 t1 \! ~
- dma_addr_t dmaphyssrc2 = 0;
+ [3 i+ m; ?- t, x - dma_addr_t dmaphysdest1 = 0;
H' @1 ~9 q' e2 N, H: w - dma_addr_t dmaphysdest2 = 0;
* l3 L9 R' f2 f6 F8 D - / h- y) D8 |8 [3 v1 H2 z* E5 Z4 K! v
- char *dmabufsrc1 = NULL;1 x4 u" f( C2 }! G7 b8 |& Q
- char *dmabufsrc2 = NULL;# F+ L* D5 C$ b+ O- Y8 ` i& O
- char *dmabufdest1 = NULL;, o7 R6 j3 [% t. ]* W
- char *dmabufdest2 = NULL;8 n+ Y8 B9 r( i p6 W' ~
- & }1 @. u' a" Q: U/ ~
- static int acnt = 512;
9 O9 m" q3 a r( [% e. I8 Q - static int bcnt = 8;8 G, {3 L! Q& j: \
- static int ccnt = 8;
; S8 s8 |7 W7 ] ?' O8 R
# y% \$ J, P; k1 e- module_param(acnt, int, S_IRUGO);
8 r, d' G3 q( O4 l/ t - module_param(bcnt, int, S_IRUGO);3 `" l$ S4 Q9 i4 H c- ?
- module_param(ccnt, int, S_IRUGO);
复制代码
+ n, H7 o5 {# H2 F, c' S5 Y' v2 `2 [7 W
8 A% {6 n; \* }: j0 O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ G! m( O- Q5 I: Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( j+ J$ r/ @" ~% T0 l9 S; ^3 E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 e4 A0 V5 d6 y0 m6 ?- q
$ r0 `5 q/ C5 i8 v
% Y' e7 M8 P/ @- u. ^/ T/ W |
|