|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( S4 u4 }, z* Z- [code]EDMA sample test application
|2 T- ^& T! E: v4 p- ^/ Q. ~% M6 X0 | - /*0 b% q% A9 J$ G I; i7 t
- * edma_test.c
7 P2 P1 i4 [7 W( _7 {; q- t - *" A0 K$ l4 z2 p: y$ M4 K; i
- * brief EDMA3 Test Application3 }$ S6 G* K. E. L8 ~7 J: ^# v" [) D' I* _1 ~
- *% r7 [: \$ M1 u& S: E9 ?# ?
- * This file contains EDMA3 Test code.
3 j2 X' K7 ]8 q# {$ D - *
$ N1 N6 v% D6 } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 y4 Z3 |9 V$ P! b7 T3 d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% }4 A/ ^+ G# @# s$ Q. L" d+ U - * TO CHANGE.
7 B1 v* g& V5 ~1 f - ** T# f0 I7 C( T* s9 J# M' R" O! r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ?& {+ e+ c$ k/ d. V; J0 _9 n+ g
- *
( X3 B/ c1 V5 D+ }! _) e - * This program is free software; you can redistribute it and/or p" E* p4 Y W. Q, v1 m
- * modify it under the terms of the GNU General Public License as
* M |! _2 r' C - * published by the Free Software Foundation version 2.
! n: V& w! g" n7 }8 b - *- C' X) p& W6 ?) T0 T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. D0 t, c z# ]' ~( c3 l
- * kind, whether express or implied; without even the implied warranty) X7 w( ?2 z% l9 y) m0 w. y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 B }0 O" v! B( N
- * GNU General Public License for more details.
/ Z' u, S; K) z6 F4 n; l) j - */
* ]. E; D |, E$ ~* l0 K# ?( c
v! H5 p2 a0 P% O7 {% h- #include <linux/module.h>
5 i" P$ u/ W* I! p - #include <linux/init.h>
% R6 Y) i" F4 T/ N - #include <linux/errno.h>7 o Q! n# f1 o4 ~* q' ]
- #include <linux/types.h>
( I7 Z+ @3 H+ H+ o8 W$ @ - #include <linux/interrupt.h>' ] J/ l! Y2 F2 c
- #include <asm/io.h>5 U2 C! y& E/ X& K
- #include <linux/moduleparam.h>
, R* j) X* O$ J - #include <linux/sysctl.h>8 X& w) B% \0 ^" N* m: B* o
- #include <linux/mm.h>
9 v8 i: ?8 t$ v' @4 U0 L* | - #include <linux/dma-mapping.h>& O ~! ^1 b! [4 i
- $ }, \( u6 k- e" Z
- #include <mach/memory.h>7 r/ A9 L ] Y. z5 u2 A
- #include <mach/hardware.h>. T+ N% h: [+ C; q
- #include <mach/irqs.h>
6 s; R+ o! a/ } - #include <asm/hardware/edma.h>0 U4 v8 n1 W, @
7 Y7 y5 k$ T1 c" ~/ ~0 f" K- #undef EDMA3_DEBUG
5 {$ m% A* m, G( F! f2 M( l - /*#define EDMA3_DEBUG*/
9 h9 X6 A+ G& I$ D$ ?% ? - / T7 K& U6 V; T( r) R5 j# }( o7 ~
- #ifdef EDMA3_DEBUG
$ Q: O% U' B$ R' b: S% U/ ?* Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 ~, O+ A* P. O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( @ F u: m8 B; f4 X5 j0 H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: v$ k( c9 a3 H$ k- A - #else
( [0 _% J' u: O6 a4 h5 s - #define DMA_PRINTK( x... )
5 E: @# F! o: X/ C - #define DMA_FN_IN+ d0 S$ Y3 U/ w# Y! @9 I
- #define DMA_FN_OUT# t1 `( @ c& G$ R/ p# c) Q
- #endif
5 H. e8 E( I( D/ P5 @
0 {: @$ B2 O2 K# ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- K6 T1 F" L* b& H# C* Z - #define STATIC_SHIFT 36 g6 _+ a% u/ u1 U
- #define TCINTEN_SHIFT 20* U9 N: C L2 c5 _/ i5 E
- #define ITCINTEN_SHIFT 21
e5 E. N9 }) r, h: P0 _, n* b: m - #define TCCHEN_SHIFT 22) X* ?7 Z5 d* O7 w) j" K9 @
- #define ITCCHEN_SHIFT 23
6 i9 n$ Y" t% z) {- X; ]+ f - t' i# t, S/ T \) H
- static volatile int irqraised1 = 0;
( G/ J [ n9 O3 J9 M$ B - static volatile int irqraised2 = 0;/ R$ W0 F4 z4 r* O
& n% Q& c# X- l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 m! A- _8 {" ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ?7 N4 @ h+ E% r3 ^4 s" u- d! D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! n# _9 b6 u! g# `6 U: A! [6 g9 @
8 ~ I4 {+ t+ r% @* g- dma_addr_t dmaphyssrc1 = 0;
% w8 G/ y9 x+ Z% [ - dma_addr_t dmaphyssrc2 = 0;
+ ~+ Q+ k. E9 S3 f4 d( R% | - dma_addr_t dmaphysdest1 = 0;, N4 E6 h! L3 D" x9 i9 @& X
- dma_addr_t dmaphysdest2 = 0;1 v) h! i! Z+ v4 f3 ? P. \
$ D$ p! \5 {+ v! s h. x- U- char *dmabufsrc1 = NULL;4 @: a9 v+ E# [; h5 _- S, y
- char *dmabufsrc2 = NULL;
3 G4 B( M; p8 u1 u1 \ - char *dmabufdest1 = NULL; t) M! S- p, c; T* g% p- Y
- char *dmabufdest2 = NULL;
; A; Q8 G9 j) |% d7 P7 X k
4 W7 {2 t( j& S o- static int acnt = 512;
4 Y" \( o& W' N% I$ J7 K$ [4 G' e - static int bcnt = 8;
* j8 E, G' n0 A) R" w - static int ccnt = 8;1 q' H4 _& q8 O7 h& M2 a4 n, }
- 7 i2 X4 b* L8 L- V1 B
- module_param(acnt, int, S_IRUGO);
3 F, s- X) J6 I8 E - module_param(bcnt, int, S_IRUGO);0 v! j+ }( w; Q& _# U
- module_param(ccnt, int, S_IRUGO);
复制代码
8 E: ~: V {$ i' m* F. {
6 w1 ^% v' p# `7 O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 U/ i1 _: H+ s6 r+ @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 z# m3 a k5 C/ c0 X# V( b8 a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- { n: J/ B! p3 g( S5 R
. @1 z) r2 Z: a2 p2 h0 g* A- `
e( g% y4 a1 x* U- I" L2 }
|
|