|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' C6 b8 m6 [# T4 J) ?) H7 F- [code]EDMA sample test application
) K3 A8 @! k6 F0 s - /*
% [ K& K0 n, E8 N& u& {; M - * edma_test.c; N4 }+ ~& j+ W$ ?6 Q4 ^- ~. j( X! q
- *' ?3 ?( C9 l" P( j B6 \
- * brief EDMA3 Test Application
' Q% Y" t% E% u; W7 T7 F2 J - */ J5 R" ]) r: T; D" n+ X. P
- * This file contains EDMA3 Test code.: w1 {5 i/ M, L; o _8 } k
- *
) n0 a' H0 Y4 u" P! h, }2 R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ Z9 z, C! ^( z8 ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, ^ y* b5 ?3 u
- * TO CHANGE.4 u3 O* t- J, f" O
- *
* W2 Z1 T' W+ u& S" m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 `! G; s2 j7 c - *
$ ^$ |; t9 L, X- N9 }& d. I - * This program is free software; you can redistribute it and/or( V0 M) y5 H9 J; y
- * modify it under the terms of the GNU General Public License as
. b" T/ R! ], ^+ k2 `% J - * published by the Free Software Foundation version 2.
C8 q2 P; C! w6 @0 O - *
: x% e% E: @, R1 o4 K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ K0 _: t- d6 B% A$ T# n+ K
- * kind, whether express or implied; without even the implied warranty
8 i- |2 d" c9 P6 W# F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! Z4 d7 G) m$ R! j* P - * GNU General Public License for more details.
7 w$ f7 p# f% ]& G" P% \) U0 Z/ { - */
% n8 E- w$ J+ E, m# ?3 Y- p - - M0 U, V/ p; s: F0 J9 W7 D* J
- #include <linux/module.h>
7 C' h' f1 ~ A" t j& G - #include <linux/init.h>' \# }$ c( [( \! k
- #include <linux/errno.h>9 U2 }3 D" B) y* N7 ~2 e. r
- #include <linux/types.h>( w0 w* |& v+ `# K2 s h/ Z8 Z
- #include <linux/interrupt.h>
H0 w1 r5 K. c+ B; z% P - #include <asm/io.h>" P" g" z" X7 ]' Z5 ^
- #include <linux/moduleparam.h>
: F) ?% f3 Y5 ~7 s3 Z - #include <linux/sysctl.h>
' L) D5 |! g7 G- U5 C/ m/ y% d6 y2 s - #include <linux/mm.h>
0 X4 t9 v P& k$ D - #include <linux/dma-mapping.h> j% y3 h4 ~7 Y3 n' U7 l
8 x( ?+ A$ I+ _1 p) z" _, a- #include <mach/memory.h>
1 V- @% {3 a. j) r( d - #include <mach/hardware.h>" y4 k/ j1 C- P/ y# b, v
- #include <mach/irqs.h>3 r4 L. ~0 O: L3 Y# y; o8 r
- #include <asm/hardware/edma.h>, I4 q/ p3 ~3 _- p4 f" L
- : |6 h, t5 w1 I" r; G
- #undef EDMA3_DEBUG
$ d- }, i7 f1 }$ {6 l& P% B* i - /*#define EDMA3_DEBUG*/ t% L+ u; c) j. |
- 4 t$ V! R& t7 P0 E; f# C8 m, R0 ^1 y
- #ifdef EDMA3_DEBUG, B) f7 Y; c/ d& k" N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 R; b( u4 z# H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* F0 ]( c$ O# ]" W3 W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! s& e6 B& {# v+ {1 [& z
- #else
( }+ J0 y' H+ T8 Z( E& ~% S% j( v - #define DMA_PRINTK( x... )) V# ]& | Q6 K5 j- B; o# S7 c: [
- #define DMA_FN_IN A2 g+ D! t2 h4 F# t
- #define DMA_FN_OUT# @1 J% w1 R* b/ _
- #endif$ ]- }2 @4 y2 f
* y+ s# B5 `2 l4 t1 b) _# i* g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% N- G5 }+ W7 u- h- X
- #define STATIC_SHIFT 38 P+ Z! {* C; h7 u) r
- #define TCINTEN_SHIFT 208 c# G2 {( q) [2 Q+ P1 s
- #define ITCINTEN_SHIFT 21
, T6 a- k) Z0 g9 _. j5 N s - #define TCCHEN_SHIFT 22
; p: i0 {, c+ y4 d6 r- y - #define ITCCHEN_SHIFT 23 p9 ~& T0 B- `$ ^( u/ S+ D
! w% z9 Z0 t+ o0 X8 w3 t. ?5 P4 i- static volatile int irqraised1 = 0;
^7 S7 w+ }, |$ N - static volatile int irqraised2 = 0;' ?; v! r! ~8 o0 H3 A
- % _* k! u- E2 i5 `: {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 `; S: c# M6 w, t! X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& _, H7 E5 n, n1 I! i, n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 @% X; o/ J% F8 N1 W& t# B
- , P' O) Q0 _; H8 D
- dma_addr_t dmaphyssrc1 = 0;) X2 i& z3 _6 U% l3 q) x0 r! l
- dma_addr_t dmaphyssrc2 = 0;! Y& V- Q3 B+ T6 X, L% n, t9 }
- dma_addr_t dmaphysdest1 = 0;9 d/ L2 Q7 f6 F# x
- dma_addr_t dmaphysdest2 = 0;9 x+ f! p1 M% ~3 B
$ U( T$ W) o( c. c# b- char *dmabufsrc1 = NULL;: R- g( T+ ]! y. T7 U6 a
- char *dmabufsrc2 = NULL;
% y4 d4 `/ D# O5 j# i+ y! a - char *dmabufdest1 = NULL;
: N$ [$ K1 o3 j* }* E - char *dmabufdest2 = NULL;; t7 M: P6 M! y
3 }& s( q. b2 d r& H( Q- static int acnt = 512;' J5 V, {4 w8 `9 i7 V$ o% Y
- static int bcnt = 8;' y' `' c4 a X0 j. q3 y
- static int ccnt = 8;
. I- ^% U* o4 `0 ^ - " C0 f& }8 J9 L- x. E
- module_param(acnt, int, S_IRUGO);/ [' F! q5 U6 d
- module_param(bcnt, int, S_IRUGO);7 s6 c& A+ q O: p+ x* d+ l
- module_param(ccnt, int, S_IRUGO);
复制代码 - P; a; |5 {# V
4 x; Z( H- Z( Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 j) l3 s9 u9 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. K( J9 h/ U7 q, f8 k6 z3 d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 ?+ y# c ]/ n" B7 A" H9 k. h/ C. O4 D: O* _ y" p8 Q) A
& ` b" L, i- m8 m4 T9 u
|
|