|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 ]) g+ `- ]5 V- w- [code]EDMA sample test application0 ~2 \( t) J0 _
- /*
* _- y( k- P+ {* `- U - * edma_test.c% F3 l4 J* ~# f- a( d
- *2 \, q$ x7 {, q0 ] u/ @4 ]! N6 Y
- * brief EDMA3 Test Application
: @* Z5 j# ?) D, S7 }; F2 j8 `4 b - *
' Y, q3 K" _; \* S% @: Q - * This file contains EDMA3 Test code.
/ I* @/ H# t! @4 |4 W/ a - * M2 ?2 P' u: z: ]# ?. e; J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 C& B6 o" ^# A' K( x) [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) Q0 n5 W1 K: F6 Y8 T* W+ M+ x8 S - * TO CHANGE.4 T, U, J$ K& ~! s. G! S2 R
- *
1 [% y) m- B2 y& h6 F: G- `# P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, c3 m5 d3 n9 N$ E9 s: R - *& c }4 |' g! \" ]/ {
- * This program is free software; you can redistribute it and/or; s& X/ x# b4 q. }* ~7 Y9 o V* |7 Y" Z+ G
- * modify it under the terms of the GNU General Public License as
3 u' u9 m( X: Y1 ^ A8 C - * published by the Free Software Foundation version 2.
8 l; { [* S7 p6 Z; g6 Y1 K; _ - *1 @5 v" s4 @' _' t, r3 ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% c0 Q K1 L# u4 N. x- u$ m& B
- * kind, whether express or implied; without even the implied warranty" Z h% P- C# V( j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# Z# F3 L6 x- y
- * GNU General Public License for more details.
& o7 J8 r8 s* c; k F$ I - */
3 x P. u3 [: W. i
5 K: E, O% V; p" d) C7 r |- #include <linux/module.h>
: E) Q6 N" E% |7 ^ - #include <linux/init.h>
, s- }0 r% C! D' ]+ q - #include <linux/errno.h>- }" f4 @8 U" g
- #include <linux/types.h>. s3 b1 _, o1 c) g. P
- #include <linux/interrupt.h>
$ j+ S+ K: b. E9 ?$ ?; U - #include <asm/io.h>1 O, E$ {8 K1 H) W) @# `3 P$ A; |
- #include <linux/moduleparam.h>
' @* B7 U/ a; [& [. H - #include <linux/sysctl.h>
: i( R; V+ V0 p3 Q% q8 `% N6 C - #include <linux/mm.h>+ N( x4 N( Y, `, ]3 Y# s2 e: Y1 ~4 k
- #include <linux/dma-mapping.h>
* a. W# q9 T' O! d7 V - + } v% u R, J3 [! h
- #include <mach/memory.h>* ]" J% r; @) n. o3 F
- #include <mach/hardware.h>
# H- S) J' p2 {! P - #include <mach/irqs.h>
1 L9 c8 z9 }. T - #include <asm/hardware/edma.h>
; J) ^5 |% H# U( s- T% `- K7 a' j
- o& I0 j, Y" T0 ]- #undef EDMA3_DEBUG
% j2 V& N2 d2 N$ I5 d - /*#define EDMA3_DEBUG*/" Y0 ]2 D$ f1 D i5 p9 A4 y0 m
- 0 n/ ~: j1 C8 x5 E! y
- #ifdef EDMA3_DEBUG+ s0 l$ p! x3 Z) L& V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% t& I+ F+ U. D) | i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- L* ~( `' B3 J4 m3 J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 \/ @/ Y& w) a! |
- #else) y$ T& f& o; Y8 q" z5 N6 g$ p% A, s
- #define DMA_PRINTK( x... )% o( m# A% H+ u1 Z; F) }" G
- #define DMA_FN_IN0 R3 ^3 G3 h8 b0 O
- #define DMA_FN_OUT
* A2 y" m( ~7 { - #endif; t: s) Y" s. G- W4 g6 Z
) Q! s4 K# F$ |6 q+ S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* j U/ X: `9 h: q
- #define STATIC_SHIFT 3+ {; \5 r. D# h. c
- #define TCINTEN_SHIFT 202 Q) _. `3 W8 b; m: H
- #define ITCINTEN_SHIFT 21, ]! W( c/ i# m
- #define TCCHEN_SHIFT 226 Q0 O1 n3 F. e' Q+ h6 b) ^
- #define ITCCHEN_SHIFT 23
; c9 c. y. z" z6 A) l5 F u1 {% F
! ~% Z* c& s( l. @9 x) x- static volatile int irqraised1 = 0;6 g% m4 F7 u. u0 q6 O6 u* C8 t
- static volatile int irqraised2 = 0;! q) M) b2 D2 X; F6 N/ l' G$ a
& N, E* O. F: }4 H" I# k+ p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ O% G, f) s: Z5 m2 |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: j7 H7 n0 t! Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); B; O* o5 {/ Q
0 m- p# W/ Q t; Z+ Q- dma_addr_t dmaphyssrc1 = 0;+ J' d6 f G5 [. ~
- dma_addr_t dmaphyssrc2 = 0;& Y' p; @" t/ F; T0 ?# _
- dma_addr_t dmaphysdest1 = 0;
6 p6 ^! |0 t# b - dma_addr_t dmaphysdest2 = 0;* ]+ F' z: ]$ ~ U0 m; O
! h* I. R) q+ ^' Y- char *dmabufsrc1 = NULL;
& w: s3 W3 s3 j W. Q L - char *dmabufsrc2 = NULL;
6 @+ u) u; ?4 d0 T& \7 |9 o - char *dmabufdest1 = NULL;# _1 C. }0 m" ^0 c
- char *dmabufdest2 = NULL;; l4 Y' z2 t9 K a
- 4 q# p5 \$ Q/ X1 f
- static int acnt = 512;; K' A1 D/ C3 B! A, m
- static int bcnt = 8;
4 I$ ^7 k3 ^) S/ F - static int ccnt = 8;7 v( R2 A, U+ z6 ~! \2 o
- ! c2 m/ @, G9 X7 x4 ]* ]" q
- module_param(acnt, int, S_IRUGO);
5 J1 l! ^8 t5 u& K- I! _0 p - module_param(bcnt, int, S_IRUGO);7 y# X$ O# g; z1 q5 y
- module_param(ccnt, int, S_IRUGO);
复制代码 1 y, q$ Y0 U" G/ [' D
% g9 J6 N+ ?- d. `' v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! @( ~$ ?0 t0 g3 l( J3 I x) harm-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" H% s( d/ ]- s1 B( c& _0 c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) Y; A t/ Z x. P
# i1 X3 T3 ~8 X7 {% j" X8 U: |5 z
& E9 K# b7 w( }& G& x/ F |
|