|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 }' g) a5 }( I# P8 p# Z/ C- [code]EDMA sample test application) U! ]/ f6 p' ^( t
- /*
7 k& {0 o$ i, k) d5 |! D - * edma_test.c8 Z% w) d7 E9 \" q, O
- *) L6 v; U6 r# u' ^( u
- * brief EDMA3 Test Application" ~7 H; w$ @% ]/ Z( R1 P! p1 _
- *
g1 C% ?+ u4 P4 r, {- e - * This file contains EDMA3 Test code.5 X% w3 p6 S4 c A, V& |3 u
- *
4 A0 ]% Q) D* W( `' l7 R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! G0 Q! [2 {4 n3 m t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ c, I7 g& |1 {! P - * TO CHANGE.8 D& l$ e8 d$ J/ T" Z, i1 L
- *. l# j3 ` `; t# m- x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. K* w4 g8 D8 n* g) W; M* @
- *
' f( N" s5 H1 h - * This program is free software; you can redistribute it and/or; J8 z7 K* ~, @4 l, @0 v
- * modify it under the terms of the GNU General Public License as
5 e9 E; {" i) h1 e - * published by the Free Software Foundation version 2.
3 y) w8 d% p3 y% _" h( f0 Z* K - *
, r9 H, w" E1 X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) _' d2 J; F( E
- * kind, whether express or implied; without even the implied warranty
! Q- Q' {% K ~1 B: @5 ?+ p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, ~& p `: w! X7 T' E* d/ l5 ]
- * GNU General Public License for more details.
" A$ Q0 _8 \, C+ c3 i" j* ?* d - */
" p" x; g4 v8 l c
$ m" W4 X& u0 O& g& O, R- #include <linux/module.h>
X" j4 S ^8 E - #include <linux/init.h>
( f. w3 L- Q! r8 \ - #include <linux/errno.h>
& O% ^4 a$ D$ ?) k4 D - #include <linux/types.h>' k1 k: `3 |& t' Y" |0 x
- #include <linux/interrupt.h>
. v1 ^. t- \# @1 B- _ - #include <asm/io.h>6 N" C R! ^, r1 o
- #include <linux/moduleparam.h>8 L F4 j! |; b& K
- #include <linux/sysctl.h>) Y4 t" J( p6 e; o
- #include <linux/mm.h>3 J; \% Q9 n: M1 J3 S- Q# y
- #include <linux/dma-mapping.h>8 q, d: M: r8 V( Q& s# x6 U+ L
3 A4 m' G) q' {- C& a- #include <mach/memory.h>$ z) f& X# h* B7 n" Y& h
- #include <mach/hardware.h>
3 J7 E" Q/ i. z6 ]- r3 L - #include <mach/irqs.h>
0 A0 F( G/ b3 q) u2 H, \, L - #include <asm/hardware/edma.h>
. D7 q ?' [; {( ]9 c% J
- |% V- R# h& E/ K- #undef EDMA3_DEBUG0 S7 _: v: o& \* p
- /*#define EDMA3_DEBUG*/, J% k$ z! o9 P( f/ j; v
- 6 U2 i) | w9 y
- #ifdef EDMA3_DEBUG6 `. z! Q, ~4 @1 }! c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ T6 S8 z+ Q; p7 G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ K* f6 t2 K& k3 v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! m. v0 b$ u% y8 i( e - #else9 P! V1 i4 Y! B' A
- #define DMA_PRINTK( x... )
6 F7 Q% |1 A. q1 \' n0 f - #define DMA_FN_IN% J$ h- M2 L8 Z$ O
- #define DMA_FN_OUT
" x* R/ K- k, M0 F* g& } - #endif$ Z8 ~' K, a; P4 b( E' ?
; n+ n! }( ~3 N# A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 R& Q+ _' g7 c. @
- #define STATIC_SHIFT 3, N" m( r/ L- [, g3 o0 u6 M
- #define TCINTEN_SHIFT 20
: e6 h( N6 Z4 G8 | - #define ITCINTEN_SHIFT 21
" ^& w/ [ B/ C0 E8 y( Z9 u9 n - #define TCCHEN_SHIFT 22" Q! _5 |4 i. U2 H% A/ h5 k0 K: s
- #define ITCCHEN_SHIFT 23; _, x7 _/ }! x; d! {0 q
- a+ {- N# f* H) U& C( h- static volatile int irqraised1 = 0;7 _8 D, }4 d$ _4 R5 Y
- static volatile int irqraised2 = 0;
# W/ W' d. Q7 }' l - 8 w1 ?, a$ N! h( w; t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ?3 R$ G2 V4 A n+ o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 O& W) b" |% d5 \/ H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# u+ V3 v: ^( ?8 {$ F
8 r$ S1 f+ Z9 U% l+ Y6 B5 {. u- dma_addr_t dmaphyssrc1 = 0;0 @5 @: E1 L* d3 h
- dma_addr_t dmaphyssrc2 = 0;' x3 p- |" }. v) y8 E/ `5 g
- dma_addr_t dmaphysdest1 = 0;
. M+ P4 F9 \4 y$ Q; ~) h" o - dma_addr_t dmaphysdest2 = 0;
: ^4 C9 d/ Z( o! W, d! i2 h
/ O! r% n. ~) g; \; T' u8 o% d- char *dmabufsrc1 = NULL;
+ f5 J; w. v/ I# F/ ]4 A7 S% m - char *dmabufsrc2 = NULL;9 Q- a4 b8 I k6 H
- char *dmabufdest1 = NULL;
7 ]! B! K# e4 I' x6 d1 m2 d - char *dmabufdest2 = NULL;
0 H# s: S) G! L- J - 9 o6 A: e% E. N! {7 [6 O/ N
- static int acnt = 512;3 j+ Z2 |0 N3 }1 `% f
- static int bcnt = 8;
3 Q! C2 w4 `0 g, `" v& q9 d# p - static int ccnt = 8; [' A6 m$ b# q v2 ]* b) E
0 M2 |8 n. Q8 T3 M* `0 u- module_param(acnt, int, S_IRUGO);
8 W3 G {" R! \/ `1 l7 `2 B - module_param(bcnt, int, S_IRUGO);( T: V$ m3 l- m D' T* ]' K
- module_param(ccnt, int, S_IRUGO);
复制代码 - O8 P3 ~# p2 @- U
* {' i+ P4 [1 z3 T- R$ F( P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 n" Y' ^( a7 i U7 k0 L, @3 zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' o; G$ H1 @3 {" L; V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, q3 i* I* _4 M& z9 N
) H& v# I/ h6 n+ s5 |$ z& k3 e* t
4 E5 F8 }$ x# `* m' U/ Z0 o |
|