|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, p0 W' @! c/ |- [code]EDMA sample test application' H: ^9 s6 n4 k0 ?) I
- /*6 A- b6 a+ l( n, ^& U
- * edma_test.c) E2 S% q. z! I0 X6 M
- */ q7 a% M3 S! H
- * brief EDMA3 Test Application
3 V0 P! C, q2 a6 k, _+ | - *4 D. c! ]" ~- \
- * This file contains EDMA3 Test code.
/ ^. N; X. l" j" e" K& b' ?, ? - * S; s, J) R2 N- s( b+ N$ r5 F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ E2 S( v4 a2 q2 a: _' U; [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. o" O1 l/ w7 a# n0 g
- * TO CHANGE.
* b7 O1 F4 L9 s `3 } - *
5 x" z% ?6 c5 K- c$ [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: E8 g7 B* C/ G, l5 _0 N% J( I
- *
, C+ L- ~1 H5 H. Q3 r- \ h2 x4 Z - * This program is free software; you can redistribute it and/or) m6 n& b% O: F. J
- * modify it under the terms of the GNU General Public License as! r) m# k# ~/ a
- * published by the Free Software Foundation version 2.
# p$ g% ?/ M- B" @2 B - *' ?8 M$ Z6 B+ H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: [/ |2 Z9 w: U) F5 ?5 j2 y1 `8 M* f
- * kind, whether express or implied; without even the implied warranty/ S: t ~' [: p: y d, r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% J8 P' N( r' r8 q
- * GNU General Public License for more details.2 r+ |" ]2 L: K" `6 v! E8 i
- */: X5 Y7 x- e9 o8 y
- % H/ e) j' a- _) |, C; b1 O7 x
- #include <linux/module.h>. T5 d Y- u' L
- #include <linux/init.h>% t: k" u1 n0 L
- #include <linux/errno.h>
$ S' S- [% B% y" M( ]" d - #include <linux/types.h>" ^/ _9 j% X2 Y5 W! D5 u
- #include <linux/interrupt.h>1 @3 m! B* a7 j
- #include <asm/io.h>& K* `0 Q% c( I0 ?% _' I! K
- #include <linux/moduleparam.h>
. L; C) @0 ^1 ] - #include <linux/sysctl.h>
, R) a, O- A/ @1 @6 } - #include <linux/mm.h>
& t5 w5 _! j4 P! U, i - #include <linux/dma-mapping.h>9 s- U! y w( U6 z p& ]: F
- ! m# P1 c1 ]2 E: ~+ p. c B- D
- #include <mach/memory.h>7 w+ X5 u2 F" _$ s" W: V R
- #include <mach/hardware.h>
; ]9 w. e0 Q% d% c# p - #include <mach/irqs.h>1 b% e9 ^3 ?9 ?( n: Q6 V6 C0 p
- #include <asm/hardware/edma.h># Q* _$ C# d9 C3 r$ x% J
) l C9 D2 `$ t9 H- #undef EDMA3_DEBUG. |/ l: d) v6 }5 P( o H
- /*#define EDMA3_DEBUG*/5 }7 N3 ?7 n: e( a, |
- 0 ~9 h: m% v! o" c
- #ifdef EDMA3_DEBUG' S' R8 |2 U" |' d6 ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% C) t1 ]% G# ? i8 k9 U% G- w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 Y# ~4 i9 |# n2 s. K1 i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 J" h7 R" e1 _ - #else
" y2 u: e+ A: B - #define DMA_PRINTK( x... )- G: M/ M/ w9 @$ Y
- #define DMA_FN_IN
0 n, g0 H/ {) h1 Y; B, A1 p - #define DMA_FN_OUT+ L( Y$ a0 n! H7 R- k
- #endif
& ~5 D4 Y3 h" l8 ?4 M7 ~
! H6 G. r }# b( E3 i8 p' p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 [, u, M0 j" t( b, ^' I2 o - #define STATIC_SHIFT 3$ p, |: g: S( F
- #define TCINTEN_SHIFT 20
" e) X* ] \4 V3 @2 k+ L - #define ITCINTEN_SHIFT 21
: k0 R9 A9 o7 T& k - #define TCCHEN_SHIFT 22
& q0 G; L k& q' j7 D9 M+ Q - #define ITCCHEN_SHIFT 23
, {. x, p4 l- `7 ~- w* w
" |! E( @( P. w, p- static volatile int irqraised1 = 0;, L% e# K# D9 f+ h+ m) t) {
- static volatile int irqraised2 = 0;
0 g+ v, c, V# ~' I2 I - 5 P2 c# A O/ B& s6 ^6 }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 s. \4 a. y3 n) G# _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 X2 h3 k+ }! ^; d) P( b" ^4 p& { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% T% y9 ]% F, M0 x% E$ n% {: Z- J - ( c) a4 Q$ i. f
- dma_addr_t dmaphyssrc1 = 0;
& R, Y d" W7 Y& ?: q9 B' o8 e. { - dma_addr_t dmaphyssrc2 = 0;+ b; W8 N7 V4 _- n
- dma_addr_t dmaphysdest1 = 0;* Y& t5 _- _* j3 q- o4 d. r5 {+ r* c
- dma_addr_t dmaphysdest2 = 0;
0 i" j$ {. {- j - ; Z, ?0 s+ Y) n& p2 X& I6 n( Z
- char *dmabufsrc1 = NULL;3 y, }& U: z4 B+ D# Z4 \! u, M
- char *dmabufsrc2 = NULL;1 S( `- f! N/ L0 F
- char *dmabufdest1 = NULL;
2 e0 E- v0 [" o( S8 T5 a$ K - char *dmabufdest2 = NULL; ~6 O* W K+ t- c: }* c
- 8 e9 e% ]/ J# H. A
- static int acnt = 512;
% X. g- i8 P2 q) S - static int bcnt = 8;
! @) |: ]: D! x& t - static int ccnt = 8;
9 D2 T9 L& u1 D7 C1 z: S% _
) `9 t/ u9 L8 u- module_param(acnt, int, S_IRUGO);: O2 F1 \! |6 E T1 Q
- module_param(bcnt, int, S_IRUGO);
$ [9 M/ e3 s v, B" y8 _* Y - module_param(ccnt, int, S_IRUGO);
复制代码 $ Q9 J$ Y' h6 ?0 [* S
3 ]) d, O7 _+ {1 p( V& C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 h. b3 ^0 M- `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% y; x; b% i( @0 j, p& ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, c; l+ ^7 }7 r' M5 P2 j" c d& y
2 F7 v4 w5 d3 I4 i2 n" r) `) n
( |4 A9 I7 p Y. r" Q- y U9 e |
|