|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 j( _8 h1 |; n: s" A0 S5 E- [code]EDMA sample test application u. C# {* s0 M& L
- /* A( \2 ]/ K' _ w' T1 N( Y; A2 U
- * edma_test.c. U: p6 M- T* q: d$ j9 `
- *
- ]2 t ?& C' y6 M9 B - * brief EDMA3 Test Application
- W+ @4 y" V7 V3 [3 f3 T* ~1 ^4 f - *
9 ^4 p- k& L' @/ D: ]7 Z% C8 H - * This file contains EDMA3 Test code.
1 l- S; c, L8 T! ` - *6 j; D! \: z, ], b# H6 |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. [/ C+ I/ s1 _) P/ R6 b% Q/ X, R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 a6 T& B7 k1 t$ J' ]6 e6 R
- * TO CHANGE.
7 I6 R% q5 h' U9 y+ v, w - *6 |- n& I" ^$ B' n3 ^9 ?: U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// }. \& V" S! D2 R
- *: x# a( q# P& u" i' |! m
- * This program is free software; you can redistribute it and/or
0 j! j% C& U( F7 B1 ? - * modify it under the terms of the GNU General Public License as$ I' {3 [ [. b3 q/ e+ {6 q+ j: Z
- * published by the Free Software Foundation version 2.
' K4 _% J9 r4 l+ y$ G; T - *7 |* b, i9 |4 D- w6 v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any w! }6 k- p& Z* P4 g+ X" D
- * kind, whether express or implied; without even the implied warranty
+ ]9 g- @- Z9 l% n) P$ E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& S( T6 x) F2 n& Q0 o
- * GNU General Public License for more details.
2 L# _% L' z/ \) i% |- F - */
- ^, o2 p" X9 {+ O. B! c7 | - . ^) r7 i+ m- k k
- #include <linux/module.h>5 u; c& a+ ]) p( E& X
- #include <linux/init.h>
: A: J$ t7 T- n - #include <linux/errno.h>0 f9 a+ x j1 I: T# f. m
- #include <linux/types.h>; n/ R. Y% z+ F5 n, ?0 n
- #include <linux/interrupt.h>$ @2 M( w }5 O5 u* d i, S+ c1 ^( f
- #include <asm/io.h>
" T2 L& K0 r6 l; d- O: e2 t - #include <linux/moduleparam.h>* h) L- p) C0 i- ~! z& _6 ?' C4 X& ?
- #include <linux/sysctl.h># O* w2 q! U/ p+ F
- #include <linux/mm.h>5 l7 S3 l/ {" |7 ?9 z
- #include <linux/dma-mapping.h>+ F4 |$ k" ?% G, W' I# b4 w* j3 D
- $ n6 U$ ^- i0 R7 x1 m% A
- #include <mach/memory.h>8 k8 o4 l; J% ]. _: {
- #include <mach/hardware.h>' x0 l( y4 s1 p B5 i4 v3 ?# V
- #include <mach/irqs.h>3 ]' Y' Z4 [/ s
- #include <asm/hardware/edma.h> d0 {. m! q6 v/ d) F# @0 H
- ( }' G8 m8 F; R* y/ O, N% ^6 @7 o# k6 y
- #undef EDMA3_DEBUG$ U. l. K8 I. u) {) u9 q) n, ]9 E
- /*#define EDMA3_DEBUG*/
0 H7 p; n! u! n# j3 R7 s" |
2 @7 M+ j9 t M$ Q$ [- #ifdef EDMA3_DEBUG% l4 K/ h/ J. A, P- F/ y( B6 {0 e3 Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): c' q U# K8 Y/ [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 x3 r, G) D0 \. N: H- E4 @2 v. \* n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# O$ ~, ]2 c, l7 D5 Z - #else
9 t; z9 f* ^# I" @$ J% c5 R3 P - #define DMA_PRINTK( x... )$ ?" x: S- e$ B% t# b4 S
- #define DMA_FN_IN( ~9 v% x* O0 k# K6 h; F: T6 w
- #define DMA_FN_OUT [2 H" r8 A& x) q, `8 | A
- #endif
; N- j0 p. g+ {: [' r$ J
! g3 l6 z+ o6 [/ s6 Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ y+ V) z$ d- K2 \ - #define STATIC_SHIFT 3# [ C$ d9 M5 @. U* L
- #define TCINTEN_SHIFT 20& e' D# A! t3 u: |% l* N5 l
- #define ITCINTEN_SHIFT 21$ S: z' Q* A i" P$ ]
- #define TCCHEN_SHIFT 22
m% i6 C. g1 T, ?- n0 V4 | - #define ITCCHEN_SHIFT 23( h8 `9 ~) j2 Y' p
- # S% z" m; W0 J7 G6 |; R
- static volatile int irqraised1 = 0;) ?( J$ Q K8 ]3 ^- C, Q5 \) W8 k
- static volatile int irqraised2 = 0;
* q$ w! Q' H9 Y$ H$ P - # y( ` y0 c4 i, r7 v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 [# ^; v( Z3 h7 {& U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 w. d' D" C- x5 _ D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, u3 L& k' j0 ]/ Q) m. m; v) ?
* @' E7 T) v- d, m7 ~4 c' Q! g- dma_addr_t dmaphyssrc1 = 0;
( o! Z* J/ T5 g0 M; [% p P - dma_addr_t dmaphyssrc2 = 0;7 F4 W# b" w" Z4 G+ P/ x; V
- dma_addr_t dmaphysdest1 = 0;0 u7 w/ X% e. G% J
- dma_addr_t dmaphysdest2 = 0;5 j- k* D1 _, \+ L2 S+ i+ ?
- : |2 |! j% z- C( ]( O5 T
- char *dmabufsrc1 = NULL;- v1 m0 l9 P! f# E) u
- char *dmabufsrc2 = NULL;- ^) G0 N( U# F# K# n+ N$ B
- char *dmabufdest1 = NULL;$ h# K/ W* y- }0 f
- char *dmabufdest2 = NULL;
$ }3 y8 Z' I; w0 |' N - 8 C L A: L! H; V6 e. N
- static int acnt = 512;: w7 O D5 E# r8 F/ V
- static int bcnt = 8;
* d- b# K9 N( h - static int ccnt = 8;* s! F, I6 u+ I' m# f
- 5 H! W! M( ~' E# G
- module_param(acnt, int, S_IRUGO);
4 ^7 K [2 d, b+ {4 D# N" G2 o - module_param(bcnt, int, S_IRUGO);
* w2 u U. g% t - module_param(ccnt, int, S_IRUGO);
复制代码 ! o* c; L1 g$ {
0 @* ]% P9 G* U- V8 I/ p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
\8 p* [0 w$ P' oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 C3 c5 k1 v- O6 V' p7 \; ~ N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 G- u5 U1 p0 Z0 {3 s3 {
# }, Y8 ]0 P# n6 Z+ N. x8 _+ h- a
, M, A! W7 h) t( Q1 i7 ~ |
|