|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 n+ B* c' Q# A8 _
- [code]EDMA sample test application6 Z0 J0 ~( i/ z" @& ]
- /*
# l* H2 M# Y) R) r6 ?) Q - * edma_test.c
4 C8 f" e$ ?% u" a. x - *2 c5 Q5 j9 m2 e6 F8 ?2 l* [7 }
- * brief EDMA3 Test Application
0 V# Z# z- l D9 W6 D - */ Y' m* j- ]0 R! E/ i
- * This file contains EDMA3 Test code.2 y+ R& Q [2 g; L" w/ i7 r2 [
- * k3 N2 }/ L+ n9 R+ R' `' |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. b( X, {( K( |3 h; z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT {, W( {1 \# n c6 |0 |% B* G
- * TO CHANGE.
. p) J' l: k- s1 Y) k3 F/ z - *
4 y9 E, X; N4 d O* J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ s2 _" N$ A% y- H V! @
- *
) C# C2 Q( H2 F% Y - * This program is free software; you can redistribute it and/or: \7 j- V( s6 f/ a- q% |& B' n
- * modify it under the terms of the GNU General Public License as' u$ U1 w6 U. ]/ ^8 P2 P! a
- * published by the Free Software Foundation version 2.) ~# w* S8 e- ?
- *
2 x9 P, O7 C/ V) E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- b- K6 i/ d! `* }7 r
- * kind, whether express or implied; without even the implied warranty
$ a+ H- W& E. Q2 b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* L- q( q& T5 O" {3 _ - * GNU General Public License for more details.- v8 r7 U% M5 X/ v. H2 b9 T# f V( y
- */
4 }8 s) s5 x4 }& p* J+ P/ y# U% F - - @& p! C( r3 I+ d
- #include <linux/module.h>
4 C( H3 g. u, F9 r, n1 r7 i( r - #include <linux/init.h>
# o& D6 ?4 R( J h- t8 j/ @ - #include <linux/errno.h>0 D- _% g0 \5 S- {/ d1 a. C
- #include <linux/types.h>- H3 Y0 w$ @- `" _7 ~6 @2 I& H
- #include <linux/interrupt.h>
7 P; d$ [( p5 c. n0 }: ^ - #include <asm/io.h> u* l9 U6 g1 z8 t% F$ X' q
- #include <linux/moduleparam.h>: }3 ^! G$ |8 \( ^
- #include <linux/sysctl.h>
) u5 V) U ]2 U9 A" O - #include <linux/mm.h>$ r; u6 C, q0 j5 S5 |
- #include <linux/dma-mapping.h> ~! E8 g! p. E
- 6 b9 i8 ]: C* y' X
- #include <mach/memory.h>/ D7 F" [8 L' K
- #include <mach/hardware.h>
+ k) f! }: v* _ - #include <mach/irqs.h>
& Z' j5 M: A% ~8 i* S' j0 x: ^4 L - #include <asm/hardware/edma.h>
% D, `" ?6 d6 x' y1 _& q - 8 K! E9 W% n5 m3 Q& m. {
- #undef EDMA3_DEBUG
, A/ M8 _2 h& l4 I' w9 M2 V' O3 R - /*#define EDMA3_DEBUG*/
6 Y r: z0 G d& | _% v( C5 ] - * ]& b) H, F9 f5 ]. x- V
- #ifdef EDMA3_DEBUG
8 P- X2 M2 P/ }3 I% F4 n5 q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# F& I" c* U' W, N) j; b' \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 y6 _) t% l* o; L3 U' E% E4 k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 J7 |# i5 Q5 L8 {% u6 U. |
- #else7 e6 v5 ?0 `" h9 |1 v6 r3 D9 k8 u
- #define DMA_PRINTK( x... )+ _! C! B7 i8 r8 |$ v4 [
- #define DMA_FN_IN$ S: E' v# A# G; s" K
- #define DMA_FN_OUT+ \/ ~/ ?! ]: O( S7 y
- #endif
' q/ ^0 G6 \0 E9 f4 V# C, } - $ t8 z4 S) ^0 n4 p& u* P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* Y- E- \+ q. q+ C, K/ \$ A0 V - #define STATIC_SHIFT 31 _( C2 V* k# b4 i
- #define TCINTEN_SHIFT 20+ t0 a( o! E% w* M/ [/ M
- #define ITCINTEN_SHIFT 21: ?5 w9 K% w$ P
- #define TCCHEN_SHIFT 22( m; z* ^- s' E) m. e3 r+ z0 C+ a4 z! f
- #define ITCCHEN_SHIFT 23
5 A$ z& w3 H- R) R+ Y - 2 `9 |4 j8 d% h$ n; Y# q8 G8 @+ [9 w
- static volatile int irqraised1 = 0;5 E& b2 |! T" ~' N
- static volatile int irqraised2 = 0;
% w/ G# C" w) \ - . M4 g* Q5 l5 K8 ?0 l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! T2 w/ e. w6 j' @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 r# B. {. S( i ?! k0 R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# b; y8 G2 z% Y, { - # }! O+ n7 {- {% Z
- dma_addr_t dmaphyssrc1 = 0;& |1 R6 ]/ H9 }4 |! u
- dma_addr_t dmaphyssrc2 = 0;8 x9 V4 D4 P# H& \& h9 o
- dma_addr_t dmaphysdest1 = 0;
, g4 H8 m9 t; ? - dma_addr_t dmaphysdest2 = 0;( B6 S. o f! D$ {$ U9 D/ T5 k
- " y/ d& U* d7 X7 C- {
- char *dmabufsrc1 = NULL;
- r. Z3 G9 a* h% @3 Q; t) | - char *dmabufsrc2 = NULL;
. j# q( _) G% w - char *dmabufdest1 = NULL;. Z+ r+ E: [: W
- char *dmabufdest2 = NULL;7 x8 @; B# D- g, L4 v
8 a9 e, ?/ c* ~- static int acnt = 512;! y! h; S8 F, i( g" ]) g/ ^
- static int bcnt = 8;
7 F+ y0 H1 s7 X5 l5 ? - static int ccnt = 8;
! A2 f# u% [% B- `8 m& e+ J
# }! N. x2 C, t4 K- module_param(acnt, int, S_IRUGO);
$ |" m* [ e( z7 ]0 d$ C: b - module_param(bcnt, int, S_IRUGO);+ D3 Q& C6 h4 a" v4 w" v5 n' B
- module_param(ccnt, int, S_IRUGO);
复制代码 9 p. X& s7 _, w: q7 y. _, |4 u
1 G6 d* A. Y0 e0 R2 e9 p: ^/ e4 q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 q* s. L+ r, 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 I6 V( d0 E+ L+ a- S+ e2 H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: M8 `5 c2 ]: H+ s2 ]4 A* o' N0 d2 X! J
% f% p" S! `; k3 l# k
8 v0 u' }: _# [( V/ f |
|