|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& O6 i3 N" U9 \& r) F- [code]EDMA sample test application7 n/ q; p6 }; _) [! k$ [/ S2 _
- /*- [( Y2 Y4 K% K6 y- s3 m7 r
- * edma_test.c
( @4 y, R% o# T- U( R, k - *4 R9 C* c# A4 b8 P6 A5 C
- * brief EDMA3 Test Application5 c; z$ m: B3 a t
- *8 ?2 v. W$ C# K3 b% b& C
- * This file contains EDMA3 Test code.* M5 k& @: n1 n! s
- *3 @$ u9 a) B, |+ T; [7 U Z$ D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
h+ L& x) ^7 N. M7 R( X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 O# L- P" o, S8 ~* ?8 P o
- * TO CHANGE.
8 C8 @! \3 b8 n. u0 b+ b8 V - *& m& \7 D" o% e* |7 n( s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; x. }- V3 ?$ j6 a$ Q2 M: U* C
- *
7 k" M! U* u3 A$ \0 N8 W3 A - * This program is free software; you can redistribute it and/or
# p' h0 }% X7 l1 w - * modify it under the terms of the GNU General Public License as! G1 ]. ~3 h0 Z) O9 U, g4 u+ U$ Q
- * published by the Free Software Foundation version 2.
/ g8 Q0 a: N T8 ?" w - *( ]& ?) o1 r0 N6 v, e6 B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# V+ S, C, H/ r0 v; o - * kind, whether express or implied; without even the implied warranty
, V6 p/ I1 b4 ~' \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 ~' Y" t. y# }4 i3 t6 @
- * GNU General Public License for more details.; k0 D4 `- f" a2 }, B( F* Q
- */4 e! F: j( W/ V4 o/ R$ F+ S7 J
% ?) k) R) S: `& u- #include <linux/module.h>
* V) c, [1 s0 e$ i, z7 { D3 F6 A - #include <linux/init.h>
1 w2 i5 |) S; E& M J' E& e A - #include <linux/errno.h>* P/ H" q, _( J
- #include <linux/types.h>" L$ A6 O S' g- H- G6 }
- #include <linux/interrupt.h>
. J4 q- ]; G9 a - #include <asm/io.h>8 c- a2 |2 y5 z0 g& D5 `
- #include <linux/moduleparam.h>' B" l, H' G2 G5 I
- #include <linux/sysctl.h>
# t+ y# O( j/ _. [) F& g7 }7 [ - #include <linux/mm.h>
i+ A2 ?7 K3 U - #include <linux/dma-mapping.h>7 V9 F) w* S9 I$ E* [9 F; s e* N
. w& s# \# X% |8 R$ u1 n% g- p4 D- #include <mach/memory.h>
, D/ \# O$ L( L; ], G% D0 K - #include <mach/hardware.h>
4 |7 R+ f, P0 P$ H - #include <mach/irqs.h>
6 K2 F3 c# a, y3 _8 ~! f! p! y( W - #include <asm/hardware/edma.h>
5 P n( Z z" Y; |. ?3 u9 m: S
: V4 E5 D8 u" R, I0 b/ l3 _- #undef EDMA3_DEBUG$ v3 l6 @+ ?2 D0 k, R! J0 A
- /*#define EDMA3_DEBUG*/' P' _0 B# i3 C# d5 z- Q
" k5 }( g* J% V$ }7 z8 R) n" C$ ^- #ifdef EDMA3_DEBUG
( ?6 g! D0 _+ Z& f9 p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 \" B- S0 c- O8 V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) b! I7 p/ V$ q" o/ B$ K* N+ Y* d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): Z" m1 g9 u/ |# U
- #else
2 y& n, Y/ W- Q - #define DMA_PRINTK( x... )* P4 I, d \ A, D$ z/ T" n. ^
- #define DMA_FN_IN8 K+ j3 A, W5 k D k% J
- #define DMA_FN_OUT
6 W' e' @( \) V0 L, F% ^; w - #endif
% M: r, }$ |8 R# ^# ], H - 6 j9 G4 {5 U' J2 |# {- A7 g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
r4 T" Z) F! S; w3 W8 B - #define STATIC_SHIFT 3
R$ A* K% } L1 Z' o - #define TCINTEN_SHIFT 20
5 ]1 j9 T# U. G% f( u0 U( L - #define ITCINTEN_SHIFT 21$ l$ v# D- a: U. l, K
- #define TCCHEN_SHIFT 22
+ h( D5 H' w$ F3 F - #define ITCCHEN_SHIFT 23
1 v3 L! S) N" K - 8 f! b7 ~& L- U" f7 V- D; q: `
- static volatile int irqraised1 = 0;: S$ F6 R l+ x, [$ n R3 y
- static volatile int irqraised2 = 0;; Q6 J2 N" o/ [/ z& L! B3 p8 x( b
- 6 y# g3 p9 d: @0 T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ w+ z `( }, Y/ P; R. I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# H Q. `& n6 R, C0 ?5 m+ z3 U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; I1 ?8 G# q* X6 m# v& K% o - - R% U! ?" P- M# U9 u: w
- dma_addr_t dmaphyssrc1 = 0;
) l5 P" ?+ ]2 b - dma_addr_t dmaphyssrc2 = 0;
- l% F2 _9 ~$ j% ^+ r - dma_addr_t dmaphysdest1 = 0;+ H5 n; I' G* g- y8 V
- dma_addr_t dmaphysdest2 = 0;% A" X- Y E3 x& p5 Q* P
- : H3 D% k7 U" U# `1 X. t4 p2 j
- char *dmabufsrc1 = NULL;% W1 T9 i! E3 y& R5 g5 }; x# s: J
- char *dmabufsrc2 = NULL;
3 u' z x4 H/ b8 e0 ] - char *dmabufdest1 = NULL;, {' a2 j) T0 B! [9 }. h$ t
- char *dmabufdest2 = NULL;* H9 x8 j z: Q# C2 Y2 C
- " Q3 H, |, _# F# s- F9 L6 k; i$ B* S
- static int acnt = 512;* f% s4 x1 T F9 b1 O
- static int bcnt = 8;
5 q- k! n9 p4 n1 k+ [ - static int ccnt = 8;
0 `# Y- }) M! ^5 `$ }
3 q% h; H1 k) X- module_param(acnt, int, S_IRUGO);
5 t+ k1 m& R4 i - module_param(bcnt, int, S_IRUGO);! ~1 j$ J6 d0 S" ~
- module_param(ccnt, int, S_IRUGO);
复制代码 u. Y4 e) `+ Q# [
* ?9 h. A+ g+ o$ k& @& Q: Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% ~, v; p% }/ x8 i* Y* e G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 w# s! s1 H# J; H- L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* ~. i( X2 X0 F u$ V1 j5 P. V0 L6 d& ^3 o( i1 t
1 \( {1 j2 p% A r/ i$ R |
|