|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' [1 W" ^' q: i. g2 q+ L5 L$ r9 D
- [code]EDMA sample test application3 Y) |& f" @8 N; d8 A G
- /*, b( U2 ~5 s- o$ {% D3 i
- * edma_test.c
: v! J2 C5 {9 x: Z - *$ A& J2 q9 b7 y' o# }5 v& D# _
- * brief EDMA3 Test Application
N' Y7 A+ J6 R8 [9 Z - *
" o! x6 H5 P# H* C - * This file contains EDMA3 Test code.
( s3 j* x3 V% X- i X3 L4 \1 y - *3 F' j7 {; q2 ^# N: U$ Q! y6 ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 \6 r7 l+ P( ]. o+ o d; k$ H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- Z) Z$ T9 z( G p2 q; c; b - * TO CHANGE.
+ x; q3 A% W" ?9 h9 z - *
) Z% v# i& q9 F( Y' f" O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 d a) y% V9 O9 F2 v
- *
9 w3 c! a% e. l9 t - * This program is free software; you can redistribute it and/or
# O7 V# `3 O' u2 g2 T/ v6 D* _ - * modify it under the terms of the GNU General Public License as
7 p0 {3 A& _- B, C - * published by the Free Software Foundation version 2.! a! t4 x. E7 u# ~$ y9 y J+ [2 E
- *
: x" g- c* u! `1 g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 B( a4 ?0 H' {: N! q - * kind, whether express or implied; without even the implied warranty
3 Q9 T+ C% a |: L/ x; T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 t0 `) ? a! P( ]+ C& S
- * GNU General Public License for more details.
1 U: W: U k3 j2 ?. I - */
3 \9 k. {( t3 t7 Y; |( P& F* b
9 ^# t0 g& [/ h8 {( ^; N5 F- #include <linux/module.h>/ m4 ~6 b: ?3 M6 F
- #include <linux/init.h>
2 a8 F1 p& g M2 z) y% x- L - #include <linux/errno.h>
( s% q9 u& T8 p* I% u - #include <linux/types.h>& X! z- O; z0 g" Q4 {
- #include <linux/interrupt.h>
& l$ z% m, o4 Y - #include <asm/io.h>
' A/ \; a3 z0 B4 z5 \! }* q% b - #include <linux/moduleparam.h>
/ v$ k0 z6 u0 }8 M7 h; U& h8 Z - #include <linux/sysctl.h>
+ E: a" M7 t( u" f' x - #include <linux/mm.h>' |, [% n7 i% c
- #include <linux/dma-mapping.h>1 @ u. c. q4 |4 A U& G2 m+ C
- 7 l u9 U _" w8 M/ _2 k
- #include <mach/memory.h>
) c- {! |2 \. x5 f% g! G% w - #include <mach/hardware.h>
) m% a) X$ u! h- y/ P1 E - #include <mach/irqs.h>
! m1 q9 d2 n% p) {: N - #include <asm/hardware/edma.h>
/ ?0 n& J2 i" F% B2 T/ b
5 \' |: K+ g2 n- #undef EDMA3_DEBUG
& p2 j6 B* T, }0 l - /*#define EDMA3_DEBUG*/) B) T1 i2 B- M7 |* @, e
- : r# I; w* o8 j
- #ifdef EDMA3_DEBUG
6 _+ R' u5 g8 I: v' q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: |6 o1 P9 d" Q6 Y. r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% h T6 p6 g) e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). v/ a$ c N1 ]
- #else6 u$ F6 V$ R: x1 k
- #define DMA_PRINTK( x... )' Q: l2 n: O; V+ I: L" U6 K
- #define DMA_FN_IN1 M% b; t& c9 k8 N
- #define DMA_FN_OUT9 _9 U( k3 l2 ?3 l( J7 E3 V6 E
- #endif
! j. k% \9 [5 ~9 x! K D0 ^
b8 W7 V1 z) L# p5 n6 o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 w8 O: {( @/ E6 K - #define STATIC_SHIFT 3* i/ T( `3 ~) N: i( _0 T2 q" c
- #define TCINTEN_SHIFT 20+ B4 g2 ~& q, ^* d: `2 B
- #define ITCINTEN_SHIFT 21 i! ?, }, ?- G
- #define TCCHEN_SHIFT 227 o3 `. J/ L: h6 j+ {0 F
- #define ITCCHEN_SHIFT 23
1 u9 O) O2 s2 C" h - ' v9 _2 e/ w0 J# X8 m) s. S
- static volatile int irqraised1 = 0;
. F" d3 c }% L4 ^ - static volatile int irqraised2 = 0;
, L( e( v6 E% X; A- H X - U- n" x2 g6 f1 z% O7 U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 V2 K3 ~8 T. k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- o7 u+ S3 `) @) [+ y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# c/ C5 m0 _: ^9 D - $ f4 X+ N% B: P
- dma_addr_t dmaphyssrc1 = 0;4 u" W5 Y1 [ _- i! f) C) \4 I
- dma_addr_t dmaphyssrc2 = 0;
) N8 |2 f5 G/ Q - dma_addr_t dmaphysdest1 = 0;
6 x) [- B" x# h3 U; h+ o - dma_addr_t dmaphysdest2 = 0;
7 z: I( v" {3 k) S" O4 i; @1 a' ~
2 } H: m- S; k* F- char *dmabufsrc1 = NULL;8 w. ^" g, E' L( p6 \0 R
- char *dmabufsrc2 = NULL;
1 B) P0 Q: g0 _% c/ N7 q2 H - char *dmabufdest1 = NULL;; V0 w. \( ^0 i* B5 ^% n0 A8 w8 Y
- char *dmabufdest2 = NULL;
. | [; T8 [; o' s5 y* N! Q - ) ?' _& D! W# S( Y) L
- static int acnt = 512;9 v, ~7 b' z+ Y) i7 l
- static int bcnt = 8;
. s F7 D! ]8 `# z, S: v ^- B1 l3 [ - static int ccnt = 8;" \3 v" D/ ^1 C: O% a" z
5 a$ a9 ]7 G' y+ z& }- module_param(acnt, int, S_IRUGO);% Y/ i% e+ s8 ]; x. Q j& W0 i3 L
- module_param(bcnt, int, S_IRUGO);
* b* ~% w! E# x* V' g' I/ G' O - module_param(ccnt, int, S_IRUGO);
复制代码
1 o7 ?4 P1 n( ]3 d: I7 [+ p' [4 v/ l x8 U/ k3 M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ~5 e5 R2 T: B% T( p- W# X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. I! g) M0 W, q' W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ E7 Y7 [' S, _5 b" r3 `
1 o" c' d5 l+ @
+ [. K5 t$ ]: X( d$ d& n: L* B Q |
|