|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 b# v& }4 O, y# D( M8 Q' \
- [code]EDMA sample test application8 \+ M! B% S2 L, J
- /*, d3 g) m" g9 i3 g$ {- y z
- * edma_test.c
0 e+ \, r' i& r* E( M3 ~/ e8 ? - *# E! |2 [( N$ {( O7 h) ^% c
- * brief EDMA3 Test Application( Z1 b" o+ b9 q G; J% N# ^
- *
- m+ R. R6 X9 ~ - * This file contains EDMA3 Test code.4 s. O& y/ N1 M" }; k% }" `) H1 i
- *+ m- |0 ~& K b6 F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* N8 T5 |- P M. Z a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% \: }; A3 |, D, s: P$ P0 | - * TO CHANGE.1 S8 D% l, S6 b6 _( U7 K
- *8 E! @2 U2 ~+ B- ^6 S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 N6 s3 Z, m$ E
- *
- I1 l6 ~+ f7 V4 s8 A- ?% n& r: I - * This program is free software; you can redistribute it and/or
+ m v; W u- E- F7 b/ ]* o - * modify it under the terms of the GNU General Public License as6 J8 \7 ?, H; @- G
- * published by the Free Software Foundation version 2.4 s, Q0 H2 B( ~- c' E9 N% n1 P; M
- *
3 t+ q9 X2 H4 L% P& R, h! T7 m4 A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( j6 a: _- f9 m6 w8 J9 U
- * kind, whether express or implied; without even the implied warranty
5 \. Q* j1 \1 e# s& j1 q+ H* i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- X7 n7 C. t0 m. M
- * GNU General Public License for more details.4 p! @6 g1 T6 H& ?' O0 f
- */
2 R% u; r, ?! g) r0 U9 H- Y' N" x
5 X. w3 N+ y7 U1 @* N1 s. g* G) R- #include <linux/module.h>' f4 y% u1 J; U$ Y% k' q
- #include <linux/init.h>
; T5 J$ f, K6 D. W - #include <linux/errno.h>% F; P% {+ i- x$ B
- #include <linux/types.h>0 j1 y0 @6 \9 y4 k% k# x! Z
- #include <linux/interrupt.h>
) S; u" @ w* J* _1 m5 \, V6 H - #include <asm/io.h>
Z- Z9 X6 ?8 z9 r2 x$ I8 v, s+ p - #include <linux/moduleparam.h>
( Z* ]$ j; k2 M- T6 y- L# L/ X0 m - #include <linux/sysctl.h>
4 s( Y1 R6 ~, t - #include <linux/mm.h>/ T) n4 k i: y. w/ `9 }
- #include <linux/dma-mapping.h>
6 T- K7 v+ K- I. a1 M U" w
3 Y5 R; o; t C: V- #include <mach/memory.h>
! b" b* Z! I& f: b- a - #include <mach/hardware.h>, v. K9 C2 n6 C' U. m5 w( |
- #include <mach/irqs.h>
' c7 F5 Q7 N+ S: f - #include <asm/hardware/edma.h>% h$ d4 I4 [2 @7 G4 l6 D
]& m `/ p$ h. f+ }8 v- #undef EDMA3_DEBUG4 W9 E" J0 S) G9 T( E- X
- /*#define EDMA3_DEBUG*/
9 z- R |( b3 _* {. P2 z - . D$ M+ l$ a2 I9 }7 M2 }" i" \
- #ifdef EDMA3_DEBUG
; W0 e- t8 K7 e( i3 `- ~2 [3 H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
^- X/ W: s- p! Y9 g! D& j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): W- U6 V# b# [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" h! x2 O W$ G0 m9 s4 A- ^- A
- #else7 v, i, v# U1 W- |+ t, _! ?, D
- #define DMA_PRINTK( x... )
, Z' H% F% ?2 ?& ~! @ - #define DMA_FN_IN2 _: R9 _3 ?- ~3 v" L9 Y) U
- #define DMA_FN_OUT
. M; F* {9 V* n7 U o - #endif
q( I3 j5 b5 R& G- R4 c N
$ F, F, x8 d2 j& I- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! l! `4 }, A- q6 F% \6 X
- #define STATIC_SHIFT 33 M! C2 M# {& f ]! b9 o/ n3 b
- #define TCINTEN_SHIFT 20
+ x; x2 _; k' N8 c6 E, B5 t. U0 C - #define ITCINTEN_SHIFT 21
( d5 W' p7 l4 ~" K - #define TCCHEN_SHIFT 22
4 X0 e( a* I+ B- Z - #define ITCCHEN_SHIFT 23
2 r+ ^3 |+ F+ H; I# h
7 Q2 J! E% W3 H8 C- static volatile int irqraised1 = 0;3 T! q' }% k( C* L, {: z1 R' N' a
- static volatile int irqraised2 = 0;
$ \# a3 I4 T+ J G) ~, o - # a- v- `" k9 E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ q3 [# u/ r- j7 R! I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( i# n9 C+ I o( q5 B& E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 B2 I0 }1 q0 d
9 v* l, M# g N0 g! K3 B- dma_addr_t dmaphyssrc1 = 0;* A+ U& m, @: B, E j" @+ q% c1 X
- dma_addr_t dmaphyssrc2 = 0;$ F& v3 |3 i- {% q* H
- dma_addr_t dmaphysdest1 = 0;! }5 d& i! o8 B5 L( K
- dma_addr_t dmaphysdest2 = 0;
/ H/ P" m& q) }1 G( s6 v; W
& T7 h1 h# R ~* R* v. @! D6 M+ ]- char *dmabufsrc1 = NULL;# b0 |4 i* H# f# A+ Z/ Q
- char *dmabufsrc2 = NULL;, \( ?, |/ M, s0 j
- char *dmabufdest1 = NULL;! k: T$ l- @: I
- char *dmabufdest2 = NULL;0 X+ l ?8 \1 g) w4 D
4 m0 E1 Z. W, S/ F- static int acnt = 512;
- s* k; {7 m( m; f1 n# I - static int bcnt = 8;+ S. |4 T2 x) B9 z' e
- static int ccnt = 8;
b- G! S p+ j x) z2 N - 6 K# E; @9 E: j; U% q
- module_param(acnt, int, S_IRUGO);; j- u) b8 U# l2 U/ C! J
- module_param(bcnt, int, S_IRUGO);
( U' m+ \: D: U# a2 @: t7 Q3 w- g - module_param(ccnt, int, S_IRUGO);
复制代码 0 s( C# E3 M/ \4 O- d
0 w/ x J& z7 F- ?9 q0 h( D( W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
Y0 G6 g+ U1 N! B2 rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 l7 z3 v8 v: J" ]7 o3 ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 t9 ~6 n# X7 f8 z. V: B
) z, I5 W/ \% K7 c5 N$ F) }0 g5 b0 ?. X# p
|
|