|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 H' W6 b5 k3 g3 I* G
- [code]EDMA sample test application* q4 e8 E) { a, d7 j$ _2 |* Q
- /*
0 G' @8 p" {4 H - * edma_test.c! l. m9 s* i+ B" ]1 t4 H
- *
$ v$ j D; q' R; f! I$ l2 K - * brief EDMA3 Test Application, u5 d2 C; M, I/ n
- *: m1 M7 N4 A \% F& K& @
- * This file contains EDMA3 Test code.
5 _5 _+ O% r0 [, Y! {# B4 ] - *
( R0 x. g) P( [8 o7 r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 M+ v- [# ?( G# i- s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 a$ W* j- t3 C9 M( e- E - * TO CHANGE.
$ `8 N3 I+ t0 r9 C1 ?+ }. T! E - *
5 V1 D) J, y4 j" b2 s! W! } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ s% K' z* G) ^5 u; z ]- v' e
- *+ r' W( t7 ?( e x9 l3 l
- * This program is free software; you can redistribute it and/or
6 m2 b0 h O0 t; G9 f r - * modify it under the terms of the GNU General Public License as
) G7 [& Z8 j2 o5 D - * published by the Free Software Foundation version 2.
/ N7 e8 g6 [. t+ j - *
$ p4 d. J$ y4 K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
J: [* o* I3 X/ p2 o& b - * kind, whether express or implied; without even the implied warranty9 J3 c; H- G9 f. @2 c! C: n3 _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 Z- Q8 p9 {$ x - * GNU General Public License for more details.
' \% s9 X. X8 m2 p, N - */
, O( G7 n" u# I" K; X- W9 T7 x; w+ l - * c9 [% g9 K1 e Z% _2 i* ?
- #include <linux/module.h>% b$ @8 N, c; N) l) K& w: C
- #include <linux/init.h>1 Q1 C' \, N7 G `- d" o, o, }5 X8 B! L3 K
- #include <linux/errno.h>
3 f0 m: m# x9 T% x: o0 a - #include <linux/types.h>
& o. Y# O O/ f5 \& N - #include <linux/interrupt.h>
: I; L0 e' j( [; h- z/ I0 B - #include <asm/io.h>
+ R" a9 e' n" B - #include <linux/moduleparam.h>
2 n2 A9 B" p2 i' f5 {. ? - #include <linux/sysctl.h>3 ^4 H; I! j. N- ]3 @8 p! {
- #include <linux/mm.h>9 z( d4 k5 a9 s( F
- #include <linux/dma-mapping.h>/ P& z1 J! n/ i: ]! ]+ z+ b* X
- ' i8 g: N) R" N* `$ ~
- #include <mach/memory.h>" s2 E4 D* t2 h
- #include <mach/hardware.h>, s- I7 a& H+ Q5 }! i! ^
- #include <mach/irqs.h>
% W* M0 V' \; D2 `1 q - #include <asm/hardware/edma.h>
% @( X( h7 O! F* i4 f8 b7 m9 w( P - 8 Y. D5 c2 A; o( Q
- #undef EDMA3_DEBUG
7 N7 X6 m: {" `* s# ~6 t - /*#define EDMA3_DEBUG*/- t2 T/ ^! D/ ^4 t1 A$ I6 z. G4 T
- 7 a+ W2 k$ _6 a' j
- #ifdef EDMA3_DEBUG
. E; y* ~3 S+ q% A2 D - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 ?, {3 @( u, G1 W0 n& {) b8 d0 Z _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" u! ^8 i+ [$ j1 G) e) w7 x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* o& j. w7 x9 r: o; C - #else
5 `/ O6 {, T+ v% D5 E - #define DMA_PRINTK( x... )
# j' i: { N1 L# p0 s" D - #define DMA_FN_IN7 K! C, v/ _: M
- #define DMA_FN_OUT
( t2 P- H$ V0 b2 d; n; N C - #endif7 W E, u4 y2 A ?( M4 Z6 A
8 b, T$ `! t, k: `; X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: K9 m. e# ~' {. M* d - #define STATIC_SHIFT 3
, g; r2 g' e* _! X - #define TCINTEN_SHIFT 20; U3 o7 T7 O5 U/ `/ }
- #define ITCINTEN_SHIFT 21
; T( e# `, x, O9 {, \. Q1 Q% R - #define TCCHEN_SHIFT 22$ ?9 y, s" t4 O& }
- #define ITCCHEN_SHIFT 23& P4 |1 i! k4 }( r# O/ f
- + k' o& E6 K* P+ O# n
- static volatile int irqraised1 = 0;
) E6 g4 T" y. i - static volatile int irqraised2 = 0;% z. d" H% [( { C
1 S9 N" F B% e9 C' ]" u" P. u7 F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& r* c. S; s _6 \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 |' p$ u8 L2 ]8 u, u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) e' J$ b3 w& `) \ H' p* n" m. s' O
4 k/ |7 d. v8 {8 |: f7 ?* N- dma_addr_t dmaphyssrc1 = 0;+ u5 ]6 b% y; G# ^8 U# s
- dma_addr_t dmaphyssrc2 = 0;$ O. v$ N2 N1 O1 Z5 U( m
- dma_addr_t dmaphysdest1 = 0;7 I8 H! \& W2 m3 @
- dma_addr_t dmaphysdest2 = 0;5 B* x7 _7 Y( a, Z7 w. f* D
- 7 @" k, ~6 b/ r: u2 @ e, s; _
- char *dmabufsrc1 = NULL;
1 j! @/ n/ T% b0 s; l+ I - char *dmabufsrc2 = NULL;
/ Z8 P$ j% u5 H7 \: Y4 T0 X - char *dmabufdest1 = NULL;
& m" }' x$ B' Q8 ^) [! G1 E - char *dmabufdest2 = NULL;
3 a0 l9 t5 W* I$ q0 r1 T6 q
0 Q t j7 ?5 B% a; F/ Z$ ^# A' s- static int acnt = 512;" I0 k6 c# w; D: r( L& C/ k" z
- static int bcnt = 8;
/ G# g- D, M% b, W, C - static int ccnt = 8;
% g7 H1 X# F: h+ s - / Y8 z a2 d; y; s( M% A+ [7 V: d& ^
- module_param(acnt, int, S_IRUGO);. ?/ o6 Q( Y; ?5 Z& `* F1 H
- module_param(bcnt, int, S_IRUGO);
! P" n$ W: W1 ]+ _5 | - module_param(ccnt, int, S_IRUGO);
复制代码 + R# Y* `* C$ S4 a# S q0 o
7 i, Y8 A$ g4 Z4 f1 }9 ]6 R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- o0 c9 z7 ~# Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# h+ F. J8 s4 O2 `! S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 g& e( r9 M* I6 @# x Y0 j
7 h- N1 A) x# V0 a) K! ~
. K9 s( s9 d; d$ G* k$ B |
|