|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
h% d/ M% }, c: Z* k( _7 L7 i! G- [code]EDMA sample test application
4 ]1 s" h) B3 x - /*, c) c8 Z5 w0 A* n
- * edma_test.c6 }2 K- |* G, Z! U6 S
- *. }" r% y5 h0 Y1 p7 w' @: ~7 D, r
- * brief EDMA3 Test Application' \& R5 S/ n6 |4 I5 \9 i
- *
& K5 b4 N7 w. o# c/ p+ q - * This file contains EDMA3 Test code.
4 @3 K9 x# m" j( P/ T9 e/ F! t - *
' w" ]: l% z' l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% w. t- g2 {6 a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ z! w9 @' h* U - * TO CHANGE.
- H9 i, V& r+ a; R9 H2 \1 P) L2 g - *. Q4 I( I# u* n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& K! b1 W5 o" r9 F! }8 l. d5 C - *
0 [9 w9 R2 p, j8 D; s6 o! c - * This program is free software; you can redistribute it and/or
( G4 [$ r2 E4 n) T0 @ - * modify it under the terms of the GNU General Public License as' A. U7 m7 N/ A% \% y& Y
- * published by the Free Software Foundation version 2.
& e! G- c t3 G- \ U) p' z" x - *! m3 I# l/ @' q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; s. B$ `) l+ h; v# X
- * kind, whether express or implied; without even the implied warranty
2 f" n/ L7 ^! z( m. I" [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 V6 H1 _( m/ M0 |* `
- * GNU General Public License for more details.; P* `5 U W3 R& J- N& s
- */8 t9 w9 r4 g1 C9 a6 |1 x% K7 q
3 j# j7 F# u+ Y% h- #include <linux/module.h>
8 {: P5 E; S: S$ \ - #include <linux/init.h>
& {4 j' Z" [9 u) S: x$ G1 | - #include <linux/errno.h>
; u8 u+ _) U, A5 A - #include <linux/types.h>
+ r/ V' @9 S6 v, H+ p: z - #include <linux/interrupt.h>0 x/ X9 P5 _ [2 v& @+ V
- #include <asm/io.h>4 F6 k! ~5 Y9 W, N* t0 O) p
- #include <linux/moduleparam.h>6 J4 R2 @6 a9 f- \2 ^6 N
- #include <linux/sysctl.h>) k3 L, Q- G: H. y4 a }2 f
- #include <linux/mm.h>
0 T, Y7 F1 \7 x - #include <linux/dma-mapping.h>
Z' |. ?( e* L# P* t# { - 9 k: E4 f3 z m' A( P
- #include <mach/memory.h>
) b6 H; a8 U7 I1 T - #include <mach/hardware.h>$ l& _1 k' s$ a2 B& l
- #include <mach/irqs.h>0 l" a! a, |- ] E: p) o: V
- #include <asm/hardware/edma.h>, m/ B& b& {- s# Z* o/ Y
! K9 G$ `5 \4 }5 {- #undef EDMA3_DEBUG
1 j. h" v8 O2 {# p4 o - /*#define EDMA3_DEBUG*/
5 l1 s/ t* {2 x }2 t; B! @ - $ s! ~% p9 u' c6 Y: a- o
- #ifdef EDMA3_DEBUG
2 H- K+ @; M e: T1 J; k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& [! s+ E' u$ }* V: [% p$ G; \' a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 k. c5 ]* P, K) f& l# b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# x C( ~% _, J5 m" X. ]3 _
- #else! q7 i* i% I) f$ ?
- #define DMA_PRINTK( x... )
, X) n% Q! q; w; a - #define DMA_FN_IN
6 j7 F# e5 S* @0 h) n7 Y - #define DMA_FN_OUT
. u4 d- _! a; S+ I2 e0 @ - #endif) N0 Q( x: P; P9 D* T; Y5 R5 |2 C, Q
- ; c4 }- e& x4 B: n; N- [% d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" |8 s# z# }5 j7 M6 ` - #define STATIC_SHIFT 3' e/ r& {. W/ Y
- #define TCINTEN_SHIFT 20! _" }& L3 S _ m( M/ ^
- #define ITCINTEN_SHIFT 213 ]% ?- D8 x4 V4 V
- #define TCCHEN_SHIFT 22
0 w, s( G! i1 | - #define ITCCHEN_SHIFT 23# d _5 [+ o0 K3 X* B1 F4 Z1 s, o1 `
1 J. U3 ^! } U- static volatile int irqraised1 = 0;* p2 K% k9 N+ }1 h) v
- static volatile int irqraised2 = 0;
' G9 C; _ C$ F4 i% Z) m - & M9 @8 v e1 w( l9 p* m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- l7 Q* H, j# h0 Q/ `5 r3 s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ m8 f. q; F) J. | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: G/ @$ L# }9 b# o
+ y$ }: q2 X; M7 V# b2 }- dma_addr_t dmaphyssrc1 = 0;+ N, P1 I( J2 c" u& W8 C4 H
- dma_addr_t dmaphyssrc2 = 0;
* r/ K9 e) t1 p% R# B - dma_addr_t dmaphysdest1 = 0;
8 W5 _9 C' C3 c$ c& T7 X - dma_addr_t dmaphysdest2 = 0;& _5 A+ n. m+ `8 [, @
) o5 h. { w4 y$ @- char *dmabufsrc1 = NULL;% ~: n! m' _, F3 b; v! u. v1 p
- char *dmabufsrc2 = NULL;
5 v; G$ r4 K, | - char *dmabufdest1 = NULL;
2 }, g% y0 I9 @- v - char *dmabufdest2 = NULL;- v. @' P0 W+ a! e/ A" g# i( r
- # Y0 X* a& s( S6 F
- static int acnt = 512;
, h6 z3 l x3 A W - static int bcnt = 8;
1 r1 J7 B3 B3 K# A4 R5 U* z - static int ccnt = 8;
+ Q1 f- }+ f/ H, ~ - " s3 P1 V, V* r4 {' K
- module_param(acnt, int, S_IRUGO);
8 G; \3 K5 K4 n9 a - module_param(bcnt, int, S_IRUGO);) Q; D4 _5 v2 Z, M9 {3 @
- module_param(ccnt, int, S_IRUGO);
复制代码
7 S8 Z* \. P" [ H" L5 G. \ i# _- B
9 E1 p, c* I: \+ n2 u4 ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 `5 C9 O# \5 j8 e8 J. F* S, g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* P+ D/ R! U) D; I- c" a& G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& }8 L4 h/ Y( k: h8 y8 s, `
% ]! G- B6 h) [9 q8 u: J, I
1 A9 b4 }' D1 _$ Y* p# o |
|