|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ u& Z, r$ J4 ?0 S
- [code]EDMA sample test application# }- R7 c* K: \( P+ K5 C7 x: L% S
- /*( Q/ R: P* F* F5 \9 W8 H/ p$ G
- * edma_test.c
/ R& s- l6 J4 s" D1 \ - *
; [& z* o. e/ v# Q& ^ - * brief EDMA3 Test Application8 r( o ]8 R" a
- *& W' [1 g! x: J6 p v5 d+ G# H
- * This file contains EDMA3 Test code.: c J; m, M5 n6 i
- *- o: o5 e m+ {" h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 Q, E# U3 m) u$ J& {% u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- r/ t+ ?# d5 [1 V
- * TO CHANGE.2 v( G0 y. I! ]4 r& q0 K% ~5 L
- *
; R: v; n5 X1 O/ A5 K- c7 c) W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' J; u s4 J* Q- @; H; A
- *
* h1 c1 N j7 X" {* z - * This program is free software; you can redistribute it and/or0 Z( r" ~! M1 T* D" ?. P
- * modify it under the terms of the GNU General Public License as
; ?6 H3 w+ }, P8 e9 L- C6 ~0 G3 s - * published by the Free Software Foundation version 2.
. d2 }' M4 c( F9 ^' ] - *; ~# k9 j5 X, j+ C& r/ T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 e1 h9 K% x- W Z' G& Q
- * kind, whether express or implied; without even the implied warranty
' ~1 c1 K3 O! A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. N, H% A! g+ q! n - * GNU General Public License for more details.% I9 n: v) N5 m, c! ^+ l$ d
- */" L9 S* g& @$ I
- ) |0 `4 r- h0 `# } @" Z
- #include <linux/module.h>
0 Q) g2 a8 i9 m3 z, O - #include <linux/init.h>( d! {6 G* ~8 |# U2 x
- #include <linux/errno.h>5 r$ }( f' d( d) X
- #include <linux/types.h>4 g/ f! y4 K# j* N
- #include <linux/interrupt.h>
) t8 U* ~2 G/ q( M/ s8 S: g0 { - #include <asm/io.h>" n6 p) o6 r+ h0 J4 i
- #include <linux/moduleparam.h>9 Q; |; n/ x& J- m8 G' O! p$ i
- #include <linux/sysctl.h>
d, v$ B( V5 h r - #include <linux/mm.h>
9 |& V! }" }% S3 e4 ]1 U4 {1 A6 e - #include <linux/dma-mapping.h>
- x# r6 V b3 Y; ?! \. p5 d - - e- N+ ?. s0 |. @
- #include <mach/memory.h>7 Y1 F7 U5 O6 T- x1 v
- #include <mach/hardware.h>: e5 W, i+ F6 \8 x9 X) k
- #include <mach/irqs.h>
$ ^/ b! m+ g0 f: w) \7 K" k/ D, @5 K - #include <asm/hardware/edma.h>0 J1 o0 j. v8 s0 ^
! N1 q/ C9 v7 c; O8 k0 V0 u# A- #undef EDMA3_DEBUG
3 ?) O# W5 x+ @, t1 ^* M - /*#define EDMA3_DEBUG*/1 m& h0 B Q! M2 \0 k( {
- ; C- P+ d' W& p
- #ifdef EDMA3_DEBUG4 f4 A8 _$ R5 c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 v9 F B9 p6 _: e9 L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# L8 R c9 F0 F. b1 X! b: y/ A3 I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ j, T/ e5 Y$ c: W' q9 t - #else* Y+ m; B- u! c$ L( a
- #define DMA_PRINTK( x... )1 [+ E* A9 K8 O. T2 f$ f8 `
- #define DMA_FN_IN% ^" [" ]% F7 a* `, O# R7 @
- #define DMA_FN_OUT: ]& Y1 P7 c6 d$ J, x
- #endif
" k& b2 G: D& _* J
: U$ K9 M( \4 z) @! n& |* S2 y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 |4 `" h$ l; L: w) W6 @
- #define STATIC_SHIFT 3
9 c3 u7 b6 Z* C9 }$ F, p - #define TCINTEN_SHIFT 20 E$ V! r( _. S0 G" J& m
- #define ITCINTEN_SHIFT 21
( n3 A/ H; U9 R- |# \- c - #define TCCHEN_SHIFT 223 a O/ H# w3 x3 h" M
- #define ITCCHEN_SHIFT 23; b3 x4 }0 J- w$ J/ r0 Y
^7 N4 w+ T; u% t- static volatile int irqraised1 = 0;
4 a, a% s) Y* N8 B) y+ I% K9 ~( A - static volatile int irqraised2 = 0;0 T/ n) U D o# b+ T8 w
- ' A% F) [% J' X, E6 a5 _! o% j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 [. j' g* N0 q+ O( c6 c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 U2 z. M8 ^+ l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ M1 z0 V5 G Y) F - $ C0 h* P$ h' s" b6 E+ I \0 R. B
- dma_addr_t dmaphyssrc1 = 0;; n/ @# j4 G- M
- dma_addr_t dmaphyssrc2 = 0;
) i0 [* V9 o" Z2 ], U( g - dma_addr_t dmaphysdest1 = 0;2 e% H; ?2 W% d- X# H
- dma_addr_t dmaphysdest2 = 0;( c1 x9 n( D+ e& b. v
- ( y& C, z4 M' ]6 J
- char *dmabufsrc1 = NULL;! ?3 q2 G! U( u
- char *dmabufsrc2 = NULL;' N, n$ F2 L4 i
- char *dmabufdest1 = NULL;9 ?! D- h. Q) u8 ~
- char *dmabufdest2 = NULL;" r/ b) v6 r9 j: ?% i8 V1 t
- 7 F8 ]1 w0 S7 ~2 w6 w9 d4 d. E9 C
- static int acnt = 512;( c' b" v9 S7 {+ [- O$ L4 {
- static int bcnt = 8;4 @/ l* z% l6 `( \
- static int ccnt = 8;1 f c5 r* Q1 `8 J) z: ]( e, L: m
- : Q: e+ |3 z) L7 w3 q- P1 A& `
- module_param(acnt, int, S_IRUGO);
8 B8 j: _4 H+ [: h$ R8 c+ | - module_param(bcnt, int, S_IRUGO);
) B+ Z$ p! K8 [2 U1 e# g) | - module_param(ccnt, int, S_IRUGO);
复制代码 0 B, Y% I. x3 K. A. G5 s$ y
6 V, l7 Q3 Y, L* z7 Q& k* w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- h! z, N6 ~0 f1 I, C
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 H. ?: n* F' b; Q9 o4 L5 S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 G1 T- f- ~* Z$ u; l8 C* D% E* `
8 M* I0 a4 A- f! R- Z q% |% c* y- B# T+ O
|
|