|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; {* m/ a5 S- w/ n5 x( I1 M9 r- [code]EDMA sample test application( K* _3 Y3 c! f& Y: {7 N! H+ S# g
- /*
7 B& c1 ~ H6 d4 d - * edma_test.c! P' {$ O2 _ f1 U. Y* g
- *1 w0 r; ?! I/ n+ v! {# {4 Q# B( L0 p8 x
- * brief EDMA3 Test Application1 ~; \: K. I2 W `9 O$ R
- *
- M9 V+ X+ ^* q - * This file contains EDMA3 Test code.
. g/ I. r; `6 U2 O - */ J7 E6 L% |( W7 V' t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 c# `- f% V% F1 m ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- {2 D9 g- K" O4 m& t$ _/ n - * TO CHANGE.
% [/ H* U$ N! ~# R# ~; N C - *
& j' } T/ o/ ]! k7 F/ @) F& C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ Y+ H8 P* v9 N1 I - *& Y1 {% f- ?7 r3 c1 J. A( o- ^( ?
- * This program is free software; you can redistribute it and/or
' b5 m2 |- `2 U# _1 V7 [, H - * modify it under the terms of the GNU General Public License as. `- o% N% _8 b7 r0 E: o" m2 C% |( Y
- * published by the Free Software Foundation version 2.
7 G* l' \/ z- ^+ x - */ s; w0 S1 D' x8 v! J5 u4 p: n2 \* _" G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ j4 E/ T- N. B5 |
- * kind, whether express or implied; without even the implied warranty
* O4 y1 n ~- K/ c$ w8 C/ t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- w3 B0 H5 r" S0 l - * GNU General Public License for more details., Y& M' T* n" x" P0 C
- */! t2 i5 g* e" E. y Q: o+ B& _) @
- $ y, k. q8 W0 s8 a: Q! V
- #include <linux/module.h>
5 w; K+ J. p0 j) S9 |1 J - #include <linux/init.h>
' {. {5 F/ L1 ^9 e - #include <linux/errno.h>$ P( a E: Y5 m( U5 T/ Y
- #include <linux/types.h>6 n: r' @0 c, o6 G0 C
- #include <linux/interrupt.h>
3 L0 y- L& i, n+ r - #include <asm/io.h>
3 n" V) `, T+ b - #include <linux/moduleparam.h>
0 x$ R% l2 P: i2 L8 y' T - #include <linux/sysctl.h>( l! w- U! }9 g3 S. E0 T; E
- #include <linux/mm.h>
7 \ z6 M) `1 u; [' C- m - #include <linux/dma-mapping.h>
1 X1 w$ D: R# x% w/ m+ E
, J; x3 H# F3 m+ N0 q) M- #include <mach/memory.h>
2 a$ }* ^! v% |' @! X: s - #include <mach/hardware.h>; a7 p2 ~: M$ \. V& O- q! r
- #include <mach/irqs.h>9 u( z7 r) i! M: d) X( r
- #include <asm/hardware/edma.h>
4 A7 T2 X' }+ g( ~& k
8 c2 q8 s; V8 [1 o9 b: U! g. k) r- #undef EDMA3_DEBUG
0 |- f) r, i4 d% t - /*#define EDMA3_DEBUG*/
1 @1 @8 i: I% Q
+ t: R3 G$ V9 m- #ifdef EDMA3_DEBUG+ o# z, x" ^ q H) Q2 P- a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 ]( D5 H) w I0 u: E8 ~; ?1 Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* s* Y# v0 e' h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* ~! d( x; L, D0 g' D: z _
- #else
5 P3 D9 X& u5 N9 W7 w - #define DMA_PRINTK( x... )
+ i4 P1 X3 M* n# | - #define DMA_FN_IN8 m; \9 J% a. A! u
- #define DMA_FN_OUT( D9 m) I$ _( Y) U
- #endif
$ ^0 c+ s8 ~9 i - + c5 k$ C9 `; o" V7 f4 j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- T/ m1 m& @1 B* G! q: Q J1 M9 y - #define STATIC_SHIFT 3( j9 @. o" @# [+ v+ C1 M3 l
- #define TCINTEN_SHIFT 20
j( P6 h* |4 G+ U. ~$ ^+ [ - #define ITCINTEN_SHIFT 214 O3 R. b6 y# ~/ p
- #define TCCHEN_SHIFT 22
9 V4 g% u) Y5 ?' X - #define ITCCHEN_SHIFT 23' l7 [. Y& z) {; s, W
- " d# e& c" c3 x# a0 D2 j4 p3 Y& Y- C
- static volatile int irqraised1 = 0;
$ j# v& h) y0 Y$ M- }( R" D - static volatile int irqraised2 = 0;
1 ^4 s6 c; @6 V$ Z5 s0 S - ' _( e& j1 @1 u" a5 Y5 B4 n6 y5 D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 m* f O) R: r/ H w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 J; l& Q8 J" ]- L& E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, ^+ a# ?) r- I( R1 n4 q& K - ; [6 `- Y) K/ e
- dma_addr_t dmaphyssrc1 = 0;" D* l9 U: z2 i! ~% h
- dma_addr_t dmaphyssrc2 = 0;
2 u/ J5 Q6 U# N# u - dma_addr_t dmaphysdest1 = 0;+ n u5 e6 s* B" Q
- dma_addr_t dmaphysdest2 = 0;
$ ]6 Q- c/ @6 ]% W' z. S' l, B
7 K. k9 `& p5 l; D3 x- char *dmabufsrc1 = NULL;+ w( c* g" r( E. W8 A
- char *dmabufsrc2 = NULL;
" f% @7 A/ \9 S - char *dmabufdest1 = NULL;
# \5 E; ?; u4 {1 X - char *dmabufdest2 = NULL;
& A2 P% [* U2 u2 }: C
/ j4 R5 L' s" X1 ]% g- static int acnt = 512;2 K1 U% ?3 \2 R" J* | q
- static int bcnt = 8;/ l0 V" _4 n5 P* Q- r$ |
- static int ccnt = 8;" H' ?8 @5 [: L* [/ ~7 l! J9 J
- ! M# h K8 h9 G5 {" x
- module_param(acnt, int, S_IRUGO);) y1 g, l/ e0 N9 H$ e
- module_param(bcnt, int, S_IRUGO);
& V9 L4 J: H& Y+ n }7 y - module_param(ccnt, int, S_IRUGO);
复制代码
& r9 n2 P6 e2 |* h. U! s2 b
0 L' ]% M) c9 R; m, u: r& J' k; v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, j: _& d$ e2 g* j; [' I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 Z% F3 t- N+ F9 [4 h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) x$ ]# X! y* t
& e6 k2 c! V2 E! [0 I) v2 r3 i$ H# f6 O
|
|