|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - a9 {* Q6 V0 d% p0 m' y, D
- [code]EDMA sample test application
( d5 C- `- L/ L J; V - /*
- k# L% m& D5 @# ]2 } R+ d9 p - * edma_test.c: @4 G3 M) {5 s# t5 l4 b
- *5 x" V8 R# }* q% r) E# _
- * brief EDMA3 Test Application) s( O' ~5 r/ Z- ~ P
- *1 v" e6 h- m, M- V
- * This file contains EDMA3 Test code.
r; K' L: J8 s - *
. ]$ L- h; ?4 Z" C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, z! {) K6 O& K: d g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# E- W( J, ^. d. |# i
- * TO CHANGE.- J4 r6 H$ y% Q' |( }2 R
- */ ~7 C* m9 `, `' [. w8 h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; S2 t% h& X6 u. x
- *' \ N4 t9 n7 \/ R% l$ m: W; A
- * This program is free software; you can redistribute it and/or
+ d0 [, {1 R% ~& n7 l4 V6 j r - * modify it under the terms of the GNU General Public License as
/ D& p" h$ t7 h6 g, O - * published by the Free Software Foundation version 2., t& o2 Q! `) J d3 n1 P
- *4 @8 F% W' m3 s/ ^/ I B2 t3 w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any |4 f* [. O3 W+ I! A
- * kind, whether express or implied; without even the implied warranty
: m" r' U0 C6 z3 r1 S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, m5 ]* K/ X) g$ N - * GNU General Public License for more details., |% V; f) `- x0 t9 d/ y+ Y
- */
4 d- Y/ K! f6 b! y: U" o
D5 D n# O! ?/ G- #include <linux/module.h>* ]" ~2 P; L( @% T1 Q9 ]' c
- #include <linux/init.h>
5 g, Z0 N v" Z6 l" l/ ~7 T# u - #include <linux/errno.h>
. ]' b3 e# ]% m5 E* w7 u - #include <linux/types.h>
% u/ t9 I4 J2 h% F - #include <linux/interrupt.h># M& _" O+ ]: q( T4 w5 u' J6 V
- #include <asm/io.h>
8 A" G" b5 ]6 E6 C - #include <linux/moduleparam.h>( g' ?( C D, |
- #include <linux/sysctl.h>
7 P4 i9 h4 j- G - #include <linux/mm.h>% [% @+ q, \) G8 q2 l" }5 n
- #include <linux/dma-mapping.h>
9 ~1 J( y ]9 j% |7 X
* S' I! q; u. C+ N3 J- #include <mach/memory.h>
3 z6 j1 u. h2 Y: U - #include <mach/hardware.h>
0 W. i3 E1 l( g1 r0 _" k! ^3 _) t9 q% m - #include <mach/irqs.h>
; e* J% H% |* [3 F - #include <asm/hardware/edma.h>
: K% @. [+ ]6 o) L9 T% M
5 ~7 a9 J, X/ ?5 m: O [2 q- #undef EDMA3_DEBUG( U1 o3 U/ Z5 ~8 h5 B1 V! ~
- /*#define EDMA3_DEBUG*/- [$ B: U! o/ }+ t
- - H& A5 R5 T3 ~4 L8 v5 o3 ~1 p1 D
- #ifdef EDMA3_DEBUG' r2 g- a) H' `' n) P* q, s3 ?7 T& X% m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 \4 p# x% k- X q+ ^; D' r1 d5 t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) V6 U9 s' R! o3 x* @$ G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' r% T; r; y7 M7 e - #else
( Z8 ~3 w# d# a. t; Q - #define DMA_PRINTK( x... )8 r, c3 r q" ?+ r; J: Y
- #define DMA_FN_IN
) o) O3 m: @- k( m6 F - #define DMA_FN_OUT& h9 K+ {. B9 D& l
- #endif
$ C& f+ v0 A3 K. R( w% T- x
8 [& ^0 P" c$ l. k3 j3 z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 C6 q) Q3 i% Q* W
- #define STATIC_SHIFT 3) o- [+ |/ B- _$ r4 Q, }7 P! O
- #define TCINTEN_SHIFT 209 y* y k) Y# c: q
- #define ITCINTEN_SHIFT 21 T9 N) m$ ` l8 p: Z
- #define TCCHEN_SHIFT 22
' b8 f: d& }2 b3 Z - #define ITCCHEN_SHIFT 23' l. H3 K: o8 X! {
# D2 Q3 N1 n$ W; Z8 h- static volatile int irqraised1 = 0;
% G# Z/ m/ x$ J - static volatile int irqraised2 = 0;/ \3 |1 R" y/ Z; ?& r
! v/ `3 x8 p& W' a, W8 ?5 |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% e D' K8 t2 P% x& {9 T5 p% z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' S! y$ a B5 F, [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 R3 s, s. w. Q8 W- p; k& Y# S
$ @- J6 E& _( r2 N* z. a( }; i- dma_addr_t dmaphyssrc1 = 0;
! y; @2 I, G" q6 k/ X t - dma_addr_t dmaphyssrc2 = 0;
( S3 M8 k+ @- u- `, w* v - dma_addr_t dmaphysdest1 = 0;
& a" J1 y8 ]; V, L - dma_addr_t dmaphysdest2 = 0;5 U9 s( m& |( D6 v
- " F& m+ L4 A4 O: q* w" C( B
- char *dmabufsrc1 = NULL;3 z% }+ S4 U* M4 C
- char *dmabufsrc2 = NULL;- c) o/ w/ n3 G4 B( m
- char *dmabufdest1 = NULL;0 f! c& \ J0 i9 Z& t
- char *dmabufdest2 = NULL;
- Z+ j$ H% X' n I# q! G/ C3 h
5 A3 G* ?; o% p' l6 E- static int acnt = 512;
1 j% l. ^7 M1 V - static int bcnt = 8;6 Z# G, _. z e4 h% ~
- static int ccnt = 8;( t1 A5 M7 x3 l5 K9 {' b' W
- ' Q& ]8 i) ]' p# a1 _8 _
- module_param(acnt, int, S_IRUGO);
" p$ f1 d, i: D" E8 m* f - module_param(bcnt, int, S_IRUGO);0 k- v/ E% E* I7 J
- module_param(ccnt, int, S_IRUGO);
复制代码
5 d# x" t* [+ o) R) R4 k2 n* Y; \ y& z9 i+ \4 Q$ y: v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 `4 Z. I2 W$ E& X2 E! Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ U* Z+ E; k# p/ Y) J3 d! a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 ^& g3 d/ d' H6 H
' Q) n" I* I1 x% y7 s# x7 C1 ^: [# z6 @1 y# C+ T- t, n
|
|