|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ n) p/ f+ A. Q9 ~- k% r, E- [code]EDMA sample test application1 g% Y. ?7 s" P3 k( b* ?+ ^
- /*
+ y/ R. ^1 ?+ H2 d$ B, Q3 Y - * edma_test.c
, G; T! _- _& H3 W" K( K - *
; v) c: D" [- q X - * brief EDMA3 Test Application
8 M% W* w# f g$ S - *! P6 W: X" O: X5 l6 Z) M
- * This file contains EDMA3 Test code.( l4 P$ ]6 F3 _/ S: r/ _. Q
- *5 t! W- _1 {5 }$ t0 }8 T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% h3 n3 N- U: `! H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ c0 Y7 s& x' s; D7 ?8 ?5 ~$ T
- * TO CHANGE.3 M) M' y# q$ U8 n( S
- *
1 x \2 y m1 I- m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 X2 h0 B% G& W2 E - *
$ X" T" {+ b7 S$ @ - * This program is free software; you can redistribute it and/or
# K' q* ~8 x' F& _7 U - * modify it under the terms of the GNU General Public License as
2 Z2 o+ G: v3 c0 ? - * published by the Free Software Foundation version 2.
/ U# D3 ]! F: y( X- W+ Q - *- I0 c7 z4 F+ F1 z& ^, W9 c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# }$ p L# N+ Z% H( |) k: S8 R - * kind, whether express or implied; without even the implied warranty2 U' w l: |! [7 P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% s8 ^' B2 X- ]3 P& H
- * GNU General Public License for more details.
* r7 E' o( G7 b2 i6 S N, S - */9 ^3 T6 d3 a3 K+ A" b: H
- # Z0 I0 {8 b- I+ F9 H9 R( ^' E2 P
- #include <linux/module.h>' D. {: I. }/ @
- #include <linux/init.h>1 t- e) ]6 m8 d: y
- #include <linux/errno.h>
3 ^7 ^' a5 Q) L- n3 [ - #include <linux/types.h>
F x5 _8 L( g8 z - #include <linux/interrupt.h>
& L. ?4 Y$ K! ?+ {0 t7 Q {; F5 P - #include <asm/io.h>
8 ^6 Q t/ ]* q8 e - #include <linux/moduleparam.h>. N6 B! u3 H3 e! _% D6 f
- #include <linux/sysctl.h>
( v+ d7 S* O# \# w - #include <linux/mm.h>8 }1 K8 `- b5 V9 k+ M+ {
- #include <linux/dma-mapping.h>
1 ^6 i# A; s) E! u7 d& Q
% P! ]/ `6 x! O2 K+ A: w' P$ a- #include <mach/memory.h>
) l- {/ g7 `" P | - #include <mach/hardware.h>
$ m; k: ?: T6 s - #include <mach/irqs.h>
( H& U7 _2 R% E3 v# b' M6 h) d - #include <asm/hardware/edma.h>
( C# B/ y; O. K1 W5 T6 h
; d/ W1 J1 Z7 G& ` c" o- #undef EDMA3_DEBUG! Z( @! Y. V5 o! a) e; [6 N
- /*#define EDMA3_DEBUG*/; R/ W* I! B; S% T8 _( X. W- @
- 9 X: x% m6 K; }9 X
- #ifdef EDMA3_DEBUG6 o5 O, F& L* `) ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 R D& B0 G, w6 z. ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
z$ s* b* v2 W$ X* I- b8 W! I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ ^3 W: O3 G, X/ f2 t" l @ - #else/ C' _! c9 b" o3 l+ p6 l6 h5 r
- #define DMA_PRINTK( x... )8 r1 l) t- Z8 \3 k$ S( }8 V2 O
- #define DMA_FN_IN K2 r" {, i) S$ {3 A- G0 X
- #define DMA_FN_OUT
" o' s5 H0 L- }- c$ Q - #endif
- @' @) v1 n, p% N# L# [& ?' _ H1 Q - ' O( y1 b. V v. i0 i( M0 [, _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* S5 Q" C8 }2 X5 {
- #define STATIC_SHIFT 3( N+ c6 Z- X5 o. Z
- #define TCINTEN_SHIFT 20- W" b" `+ `& k
- #define ITCINTEN_SHIFT 21
* A! t& M' G) u, _# ] - #define TCCHEN_SHIFT 22
! G# |2 v) p: R) C; h; L - #define ITCCHEN_SHIFT 23
2 X8 Y- \) G& N- ^9 a - ; `) |) D% g. A* |7 k6 Z( Q, t# W2 T
- static volatile int irqraised1 = 0;2 P* M& g+ Z4 o# _$ t. _- g, A
- static volatile int irqraised2 = 0;
* S$ g. p& c9 g1 _9 K# q1 A# ] - 5 _2 m. e* V+ O: f# X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. j& S0 ~' s7 R: y; Y; ^! C6 x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! i1 R: z& w( |& h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! V4 }. x+ K' Y: X# c - ! y; m8 I- U5 I+ ]5 G1 M/ `: Z
- dma_addr_t dmaphyssrc1 = 0;
1 U }% q; V0 y. [ - dma_addr_t dmaphyssrc2 = 0;
8 \8 ]5 V- {5 p. L* u& M - dma_addr_t dmaphysdest1 = 0;2 X% r5 A. D8 y
- dma_addr_t dmaphysdest2 = 0;; `/ X. p) w9 y9 r4 ~( M* n
- ! E# b; I" q' w+ i& @" g
- char *dmabufsrc1 = NULL;
+ b; Y3 A1 P% v+ W8 E - char *dmabufsrc2 = NULL;! x* Z4 \( ^" ?2 a8 H
- char *dmabufdest1 = NULL;2 q6 b/ |0 p/ r0 ?' H
- char *dmabufdest2 = NULL;
" u' k9 c F! Y1 a) r1 ~( `
: _- i: A& u" d" ?& _$ @. k- static int acnt = 512;
) x: T( l4 g. a+ x - static int bcnt = 8;
* v: R. Y$ e c/ X6 S5 _6 q$ ^7 F6 `+ c - static int ccnt = 8;
8 v& y' J _9 `& M7 C - _: ^- D& b" p
- module_param(acnt, int, S_IRUGO);
; |* X) d! g W) D4 K6 Q2 n - module_param(bcnt, int, S_IRUGO);% Y; `6 O& j* D3 d$ F$ A+ a
- module_param(ccnt, int, S_IRUGO);
复制代码
: G* e, D! Q6 _6 M: ?+ `: a0 R! M0 A& k$ G4 r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" ?* S7 w1 v$ A( }5 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 u$ D8 a* r) _6 }$ z& ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, ~( N: o( ~5 t, G( A* U
7 E' e, K+ r* H, T: G
. o1 v6 u+ y8 B# k |
|