|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" @; p. U% a7 I: b- [code]EDMA sample test application9 S1 ^# {9 D7 @
- /*
3 u& L* I q& _( n4 Q - * edma_test.c
8 m R: ]" g$ i1 ^ - *
; E6 W3 z7 W; E" I; w: J$ v - * brief EDMA3 Test Application
+ C/ V* H( n! C$ O - *
; y. r+ R. u7 A8 c. x - * This file contains EDMA3 Test code. G6 D5 g. K' t! J6 a3 @1 h: h
- *
3 f. V/ H. J" E- a2 N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 |' S/ m* F, K! }- o: ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" R3 [ C8 _: Z. J T
- * TO CHANGE.0 x- Y9 g2 i1 `2 j
- *
+ q7 w- l1 l3 ~9 W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- S/ m! ^7 v! t' Y8 N y& O
- *
' @" ?* _# i H/ K- F5 x - * This program is free software; you can redistribute it and/or& l* r0 S# k0 e7 I7 k- i# b8 e
- * modify it under the terms of the GNU General Public License as- z" Y: m, o: N( Q9 C. g& P( z! s$ n
- * published by the Free Software Foundation version 2.1 d& g e. n$ p- l- b
- *
3 A! \- | y0 o/ }! D. f' y6 G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! N& {$ A4 p6 C9 d& N# Q - * kind, whether express or implied; without even the implied warranty/ X; J R& J* _5 W% I+ ?9 A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 s% ]* J- w7 |7 J' p" ?* X, l
- * GNU General Public License for more details.
- W4 ?" @9 m; d p9 e8 v$ O - */3 L3 {- E5 p9 P" p; r0 D8 V
4 u; T3 u! Y+ I& Q# v2 u( [- #include <linux/module.h>
9 @$ w: c* P0 o3 q, Q% U/ n - #include <linux/init.h>
: ?7 C$ |/ a& W. _9 ^ e) b% t { U - #include <linux/errno.h>
! q# {0 A5 {. O9 B - #include <linux/types.h>
$ O# Y! W _% H ?/ V% P - #include <linux/interrupt.h># U4 q9 y8 z# }$ U2 _" G
- #include <asm/io.h>! S0 d p. K( U4 K
- #include <linux/moduleparam.h>% G% [' Q6 J/ Z4 y9 y- F q
- #include <linux/sysctl.h>
6 j2 T8 w5 D* \8 u/ g$ z - #include <linux/mm.h>
+ A, d. e, K5 `# u" w - #include <linux/dma-mapping.h>
X5 q9 X) q$ R7 f. A! J' O) l% K
q+ S& c+ g7 n7 K9 Q- #include <mach/memory.h># w! F8 }; k# I+ I" c/ ]7 l
- #include <mach/hardware.h>
) m6 s9 m% g& W: y - #include <mach/irqs.h>
5 z* w$ Q* J. e0 Y3 e7 c% k - #include <asm/hardware/edma.h>5 c+ V) v# c4 a
f/ d0 B8 l' m- #undef EDMA3_DEBUG
3 I2 C8 L2 N% U - /*#define EDMA3_DEBUG*/
. {8 s1 I1 |1 E' F- h% u
0 B m2 V5 Y2 z( m% a# Q; w- #ifdef EDMA3_DEBUG
, ~: S& h6 I# O2 c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 E1 M- @6 A; Z0 b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 h) L5 V; {9 {0 l o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): l% _5 T3 d& U% Z/ e! f# U
- #else" e0 c$ A; U7 U6 d1 S" [2 Q' i
- #define DMA_PRINTK( x... ); c4 ^( p2 w2 H
- #define DMA_FN_IN5 A# [% d i1 {' ?9 Z3 k
- #define DMA_FN_OUT$ i8 p ^" Y" j2 i
- #endif
1 a9 x" O- w Z- u- c8 F7 A" g - , O3 ?, @6 u) s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ j# {! v. T& d; ? - #define STATIC_SHIFT 3
1 y P: e( @* }5 o - #define TCINTEN_SHIFT 202 j* D+ Z3 ~$ `
- #define ITCINTEN_SHIFT 21
' ?1 c/ {9 ~& B4 u) ~" B$ V7 u - #define TCCHEN_SHIFT 22- k9 U" M8 z8 f
- #define ITCCHEN_SHIFT 23
: _8 o& @7 }" {) N. S- Z8 w - ! F- i9 U) L- l% m
- static volatile int irqraised1 = 0;8 ?) C3 k2 O8 p* J
- static volatile int irqraised2 = 0;2 h$ A3 v' H- V6 G
, ]% R% a+ V. ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: M9 w1 R. Y8 C$ A9 e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 A7 J, z0 u y! A5 G2 k$ [ E- h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- d. P6 `' g" P+ w) I% t: W0 f% ^ - ! |& d% V. C, a; ~. o1 d, D
- dma_addr_t dmaphyssrc1 = 0;! x3 ?3 w, | e8 o( N+ }( r
- dma_addr_t dmaphyssrc2 = 0;7 W0 Z0 D P0 D1 W. k S
- dma_addr_t dmaphysdest1 = 0;
7 I% ]9 H9 c, _& p8 B( Z9 _ - dma_addr_t dmaphysdest2 = 0;
5 `. x1 J5 u+ J" d% P
) H: P( F6 p" J- char *dmabufsrc1 = NULL;8 P9 t% k3 }" y+ n) X
- char *dmabufsrc2 = NULL;
( s8 n+ I. z# i! I( }! V - char *dmabufdest1 = NULL;
7 h. R% u3 f$ W$ m - char *dmabufdest2 = NULL;
: ]5 b+ X3 w6 [- `$ q& s/ _" n
1 X. p* I* [3 W- static int acnt = 512;- ^& a9 L; @1 X: O, F8 F" v) Z
- static int bcnt = 8;, m g) _$ v3 A% o& c ?
- static int ccnt = 8;
, M3 l1 b5 D+ V; P2 I1 P - 9 N. R5 T( e+ ^* ~4 E) u5 j
- module_param(acnt, int, S_IRUGO);
1 c, h2 S' C7 ^0 @8 ?5 W- h9 A - module_param(bcnt, int, S_IRUGO);
* O, _" K; ^% o - module_param(ccnt, int, S_IRUGO);
复制代码 & y* @( Z3 P, b" a7 V* M4 Z$ ^
A N7 m) N1 b5 x3 w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ ]$ J6 C. O! L4 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# f9 ^6 S) J" s$ i4 X7 \! S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( b* Q# d! u' r% J/ h4 [3 D5 o1 ?; R: |/ u5 B
- i g8 ?2 a, F8 s) d. |
|
|