|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 a) M8 u! g& M) p9 V" u- y& K: {- [code]EDMA sample test application
) u4 l Y3 A8 ]1 [/ h$ f: V3 W - /*
# _8 O; Y1 o0 q& E! G8 I - * edma_test.c7 g- g. S, T/ P* O: T# C
- *. t# [# P! j! p* {
- * brief EDMA3 Test Application+ k# ~) S: [. b1 y
- *8 u" m4 E! _+ Z9 R. ]- O& b
- * This file contains EDMA3 Test code.
( C! m {: N1 z2 G" D% C! l1 o' k - *
9 L% p, y4 w) K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 |( \' k t( J1 i+ B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ B; Q- w0 v9 ?* H" Y1 S O) e: Q
- * TO CHANGE.$ k$ u: v6 y' |
- *7 Q z# ]% }" ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 @9 x7 f9 s. ~% c - *
@$ d( v$ @9 D3 { - * This program is free software; you can redistribute it and/or
( n3 b8 q. h/ h0 a- q: l, v - * modify it under the terms of the GNU General Public License as$ ~, z& b% @( B# [; h/ o. }
- * published by the Free Software Foundation version 2.
, T$ L( ^0 p O( |' @ O$ t - *; }+ G2 h' E4 Q T2 B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" v4 m Z: ?, \* ]4 K p: Y6 I - * kind, whether express or implied; without even the implied warranty; r' T a( t5 v( x' i+ p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. ?- A6 B2 s$ E- a; h( j- q. g
- * GNU General Public License for more details.
9 `- H. K* m! S) N1 [ - */6 Q5 L9 `- T% Q6 i
- * l; S8 P- k2 u& a+ E5 X4 E" ~
- #include <linux/module.h>- G1 v$ ]/ [3 h- _: `& Y! E
- #include <linux/init.h>) |5 m. K- M' w1 S2 i9 o. U& S
- #include <linux/errno.h>5 y& p+ M; u9 _
- #include <linux/types.h>8 |7 P" \% |. F. t# o+ z, J) u
- #include <linux/interrupt.h>% B+ T" `* ]5 @' t: ^
- #include <asm/io.h>) ^4 N, z( J( O* Q& L) t
- #include <linux/moduleparam.h>: M- h' w+ s/ K4 d
- #include <linux/sysctl.h>
0 Q$ j* W) q3 F+ r: J# o9 N, G* ? a - #include <linux/mm.h>1 Z9 n$ k8 Z/ G, a( D
- #include <linux/dma-mapping.h>( ?* z, O+ R$ g' D) ~9 ~7 C& E' _! B5 H
- % J; }' d- s. j
- #include <mach/memory.h>: q- d. t2 Q. Q
- #include <mach/hardware.h>- J3 [) L: O* b0 R q d7 E+ j
- #include <mach/irqs.h>
3 ~1 r- T5 v; I4 F! e4 f' ]9 q - #include <asm/hardware/edma.h>% b, d: H6 g8 O
- 9 w; ~% |8 x. }. T6 x. g- h
- #undef EDMA3_DEBUG: q( j4 l |! J, }, P
- /*#define EDMA3_DEBUG*/
% o: r9 _+ u3 g; c/ h+ j d - 8 G) n* t6 M+ R. d: j
- #ifdef EDMA3_DEBUG
- g, G5 m; r. U0 s: l9 b3 p* p0 c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- @- m9 Y: d. y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) F' W2 h+ W0 e9 X+ {5 Q6 U6 Q0 V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 B. g) Z- U$ u: C r0 s# R% L - #else4 b$ n- C. O: g4 ?4 I1 \3 V' _$ o4 S
- #define DMA_PRINTK( x... )2 }0 s" G6 F4 J! |) R4 Y
- #define DMA_FN_IN
- U8 \3 z: ?) U H* G% N Z - #define DMA_FN_OUT
9 q* w+ t# H. u3 q4 S& b; K - #endif
3 ~8 l" E# J/ i$ v% f$ C5 `7 M0 x( \' x - $ z' f/ H- o/ M. V% z3 f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' g- d8 ?- Q6 g4 I' i4 ]- v
- #define STATIC_SHIFT 30 [8 ^% C0 y. E( B. Z
- #define TCINTEN_SHIFT 208 T1 U! v- @/ h2 I: L' }6 p
- #define ITCINTEN_SHIFT 21$ {6 @& [( `4 K3 x
- #define TCCHEN_SHIFT 223 l/ D! X4 m" w. R2 I+ |
- #define ITCCHEN_SHIFT 23
0 K) n/ B6 v' c+ X0 G
5 p: E, F5 w5 ?- static volatile int irqraised1 = 0;
( y( x* P& m) O7 G - static volatile int irqraised2 = 0;6 ^4 s9 [5 r1 {" H/ }" W0 U/ c" U
. _! E4 P: v4 N# M5 `8 ~- H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: n4 }9 s3 U4 f: t5 V2 M; N# I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 `& ~8 i# H( P9 z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; s! H# ? d3 I# B' @8 K- @
1 h2 @+ ]% \* ]- f- dma_addr_t dmaphyssrc1 = 0;
5 q# r. i9 Z: C6 Q - dma_addr_t dmaphyssrc2 = 0;
4 @4 r: i" Z4 V! ^( _4 r& a9 [ - dma_addr_t dmaphysdest1 = 0;8 m1 g0 i/ |( @
- dma_addr_t dmaphysdest2 = 0;) j( x( }% d/ P7 g5 a
& K1 a8 s/ B! m; W. i* L1 `- char *dmabufsrc1 = NULL;
% X/ g4 u' r5 `; O9 e0 z( e" W - char *dmabufsrc2 = NULL;& y2 y: s' U5 ]2 C6 l; m, b; J
- char *dmabufdest1 = NULL;
% d4 g# Q% b: O* v6 R& [6 l. t3 F! z - char *dmabufdest2 = NULL;
; z0 \' c1 J9 L7 L* x+ r1 U3 m - % M6 P) u$ n6 d7 f$ K' [
- static int acnt = 512;7 v% u( _$ N5 _; ~
- static int bcnt = 8;
, q! f/ _3 m" t2 {( ~+ z1 W1 | - static int ccnt = 8;( A$ }6 U- K5 s0 Z
- ; \& a ~9 e/ |4 K' Z. }
- module_param(acnt, int, S_IRUGO);' O$ I0 q; O- h W- Z* I% x
- module_param(bcnt, int, S_IRUGO);. l) F6 Z3 C [6 q
- module_param(ccnt, int, S_IRUGO);
复制代码
! C/ l2 w7 M" ?% [0 S; s8 W& a: e+ C7 w# T' i' }- J6 }2 J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# Z9 g/ J. ?3 E4 ?. o! E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& l1 T3 K4 O7 ?! c. Q8 F" b3 \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. X* p2 [# h9 Q$ v b7 h+ o# k m1 E8 F8 f! z
2 O/ Z* W F7 s, f4 e# \+ A |
|