|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 h$ K% f; [: E5 N- [code]EDMA sample test application& j( z/ L3 E6 ~% ?5 i8 M0 f
- /*
$ t1 M) f2 D6 A4 B3 p4 D0 u; ? - * edma_test.c
9 C) S; s; i! w' G. [ - *" e* I1 g2 M3 c7 q1 X2 }7 f
- * brief EDMA3 Test Application7 Q _3 M0 f9 d7 U5 s
- ** ?* G8 z3 V: w: J/ g$ e
- * This file contains EDMA3 Test code.
7 f1 @" r2 ~+ u9 N, E5 b p - *
4 S, j/ [8 P, |) q7 I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 M2 T/ F# _* o& y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* Y( T0 X0 d3 z
- * TO CHANGE.9 s: s7 P) ~" ^' @( _9 | y8 K, ^$ k
- *6 z/ d6 {; e- k M2 U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 A; `2 ?' }9 y6 b" y7 T" x. |: s3 B
- *8 {) M: `! w: C; a
- * This program is free software; you can redistribute it and/or1 { \! ~8 D' k' q
- * modify it under the terms of the GNU General Public License as
7 f5 y8 W e% k& i: [ - * published by the Free Software Foundation version 2.
; I$ F4 Y; ^1 m - *, _7 k8 r R% g. ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, J. V3 }3 y/ G
- * kind, whether express or implied; without even the implied warranty3 w7 j* L& @" `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ ^( m& K4 o) H7 V2 e& J- ]4 k* j - * GNU General Public License for more details.% i' K' D0 K( e# \) V/ a6 v+ t8 a
- */. |9 r0 D% S% H: |* i+ \* I' n
- & j. R4 Z4 E3 H) Y4 n9 D
- #include <linux/module.h>
$ b# a$ l+ a3 n5 J# Y - #include <linux/init.h>0 t; t" a) |8 t3 t7 k
- #include <linux/errno.h>: u% \3 q+ j' `
- #include <linux/types.h>
+ \" {! G" K( \6 ` - #include <linux/interrupt.h>
- \( I1 e' _4 z6 I4 J4 @* d - #include <asm/io.h>( X$ W8 ?! z" l% v4 r
- #include <linux/moduleparam.h>5 U" S1 @; q b
- #include <linux/sysctl.h>( C' R" V1 [# q' A7 m5 Q
- #include <linux/mm.h>
5 m7 y Z# h1 ^: U - #include <linux/dma-mapping.h>
0 p$ f* e* J2 P- @ - & h) c. q8 ^# }% {! t
- #include <mach/memory.h>5 x5 D. ] ?! n2 a* T
- #include <mach/hardware.h>
% G8 h3 X7 u9 n' E4 s - #include <mach/irqs.h>% Q$ d# }! `' |) d" l3 {7 f& }
- #include <asm/hardware/edma.h>" h3 s3 y# G% x" j/ r2 {1 ?
- , t8 O, Z- z6 H, z ]! i" y
- #undef EDMA3_DEBUG
8 u) ]# `) w' b1 ?/ F- H - /*#define EDMA3_DEBUG*/& b/ G) l3 f2 t
0 |3 |, x6 N5 |4 `' c9 C- Z8 T- #ifdef EDMA3_DEBUG
# ]1 n: U4 X2 M1 x/ X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# M( H, f: O1 o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ c3 M0 ~5 v4 D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( q, q. n% {$ o: Y% w4 m - #else
" l9 U' F7 F8 i6 ?; p7 H* _3 }$ ~9 ` - #define DMA_PRINTK( x... ): k3 ]# a; G+ r: A7 q* }
- #define DMA_FN_IN
3 e/ ?2 v( Z7 X2 X/ t- W - #define DMA_FN_OUT
) ~4 R; m+ P' l9 |/ R4 v - #endif
# C/ |/ j" f5 S( {- e- J - 6 {) i6 v# H7 L5 q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# `; [6 @, h+ \% t4 T - #define STATIC_SHIFT 3( H& {& P+ n- k$ m, D
- #define TCINTEN_SHIFT 209 q$ \( m% g; T, s
- #define ITCINTEN_SHIFT 21
) K, a; ?6 \7 ` - #define TCCHEN_SHIFT 22
0 d& T& ?' h% x* a& W - #define ITCCHEN_SHIFT 23
/ ^! [8 b" n2 t5 n8 O
, i, [" K+ |0 ^: d- static volatile int irqraised1 = 0;: k# K6 L! d6 e8 J$ D9 D% W
- static volatile int irqraised2 = 0;3 S4 g' m4 x+ h/ \1 B( y& ~& D8 d
- 5 F' w" I' n" F. s4 e! C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ L3 p% P, I# Y& s7 O) b4 h: X f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& I* Z) z5 _: |0 e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. a9 c. Y/ ^9 m( v
- - w3 j2 i" k4 u3 j! P N: N3 k2 h
- dma_addr_t dmaphyssrc1 = 0;# l4 K5 p1 @1 N1 J
- dma_addr_t dmaphyssrc2 = 0;' E2 E `( L* M" S5 n! R! F: d+ o& e
- dma_addr_t dmaphysdest1 = 0;3 r8 T7 c3 k; B- _! J4 b6 P
- dma_addr_t dmaphysdest2 = 0;+ V( x S: p0 Z
- 3 {# W, ]4 t. r2 W( C* Q
- char *dmabufsrc1 = NULL;. x3 y& n# L! @2 b" d5 ^" S2 r
- char *dmabufsrc2 = NULL;5 a$ s) O% L9 b% W- ~ R3 C( e
- char *dmabufdest1 = NULL;
0 Z# @& x. C' m% x - char *dmabufdest2 = NULL;* n0 {* Y' ^- ~( w0 K; e6 b
. p& @" m8 _1 F- static int acnt = 512;
, f: O$ K/ n; X - static int bcnt = 8;
! Z! @7 p, p( \- W- F% j$ Q - static int ccnt = 8;" ]; P o! r4 W) @8 B
; u" h& `0 ]5 M+ V; F* [# H$ e6 N6 H- module_param(acnt, int, S_IRUGO);
( M/ s1 ]7 k4 I. M - module_param(bcnt, int, S_IRUGO);
; j7 k0 l1 ^" w0 U( I6 v - module_param(ccnt, int, S_IRUGO);
复制代码
4 N1 ^) ]; y; Y6 o4 J+ J- v1 |# ^% n
5 R4 O/ o+ e( F/ l( r1 I3 a. [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 m0 @, C5 m" w g2 \! K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: v; }+ E, D4 b8 F! j+ H* W, N( k: e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. q9 n! G- E. Q+ G+ W8 A: e: _
3 k/ P+ n5 y, h
& F$ s& Q) `; T2 E! z- n- h2 R |
|