|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 e6 p& s# r, y+ ?
- [code]EDMA sample test application
4 o. Y+ w( F. C' Y6 n& N - /*! u( W+ D$ g1 P5 u
- * edma_test.c; y1 k1 w/ R5 J. e6 \' v1 G/ q
- *
! u7 ]" f8 `3 ~5 E& A - * brief EDMA3 Test Application
- e: S2 [ [! c* h - *
7 u6 P! o6 }& B! q, _: M - * This file contains EDMA3 Test code.2 [2 p4 F; l$ k0 ? H# y
- *% j" U+ {. O+ Y k: U
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ ? `$ L W: _: u5 U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* n+ E% }. l' P9 ? - * TO CHANGE.7 {4 W5 Q+ o. A% B
- *0 x# e. b0 H$ L: |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 [/ e! `/ P0 D/ q6 N8 p0 o( p
- *
' x4 p' N+ {$ `" A2 y - * This program is free software; you can redistribute it and/or
& Q* B- N& @" {/ i* }" K - * modify it under the terms of the GNU General Public License as
@4 _5 \5 e1 x; }. G6 e' _ a - * published by the Free Software Foundation version 2.
r `1 a3 y3 Q# M/ V - *
9 _) r" S/ x! o( ~7 J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 K+ G) U8 L2 D) w" C% z - * kind, whether express or implied; without even the implied warranty
0 ?- @7 o5 \4 l# D0 C1 d9 X( O3 X - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' @' r' {: N6 N2 d
- * GNU General Public License for more details.
/ T# |0 n& z; J) K" J/ ]1 } - */! g" D1 R/ [+ T2 F
- , n8 D ~1 s8 X
- #include <linux/module.h>
; w6 m; H; c* t. E. l9 x+ I - #include <linux/init.h>& N" z9 W g9 f1 s. R5 q3 K# N
- #include <linux/errno.h>! ]% u: a6 d) K. x/ m5 m
- #include <linux/types.h>( k8 a% q# g/ x0 q7 |0 T
- #include <linux/interrupt.h>
# _% Y0 W a* U' [: c - #include <asm/io.h>
9 | z+ L# D) G* g# o - #include <linux/moduleparam.h>( t3 E X% Q! S- q8 h5 u2 T& U
- #include <linux/sysctl.h>
& U$ O3 g( X, @" A2 m4 w - #include <linux/mm.h># L- H, a, E* m& K, m0 z
- #include <linux/dma-mapping.h>8 l' B3 @# \" y. z* M$ g
- / A. H3 T2 \. P5 p+ T/ y/ a
- #include <mach/memory.h>
* {& w7 u! H, h6 m% G( d1 o - #include <mach/hardware.h># B% C! X4 w2 [% p
- #include <mach/irqs.h>
& r4 S6 `( k: f( k - #include <asm/hardware/edma.h>, a, l8 ]$ ^% p3 ?: Q
- $ @2 Y- O$ }) x, v) H9 n
- #undef EDMA3_DEBUG
/ e( q$ W( M9 H6 M; a7 C3 t* k - /*#define EDMA3_DEBUG*/$ m }% R5 s& G2 ?) {9 f3 \
- % [4 E$ m% j* x, F0 ^" Z' M/ \' R
- #ifdef EDMA3_DEBUG- Z1 T2 f. p p% T. \5 x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! f d, ^5 l- s2 J4 X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& z7 N8 J" @, _" x3 G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) Q. T5 S4 C) l9 [2 f
- #else) p+ o2 E$ k$ O U. ?
- #define DMA_PRINTK( x... )' L) Q0 v9 o. y9 p; Z, ?
- #define DMA_FN_IN% ], w7 ]7 x9 u. ]- l. e
- #define DMA_FN_OUT
% E1 x N% L3 E - #endif. h( U x* {0 _: J
+ ]* b- q0 I/ N1 ` _4 A. V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 x8 g% M2 y! b9 H2 a/ T
- #define STATIC_SHIFT 3
) c: \3 l0 o* z/ D" E - #define TCINTEN_SHIFT 20
" O: }0 R0 A; H% O6 ~" j1 d - #define ITCINTEN_SHIFT 21
1 u, q3 p; y$ U4 f6 Z% k - #define TCCHEN_SHIFT 22
9 ^& L1 |0 ~% n! h% S6 m$ [ - #define ITCCHEN_SHIFT 23# y' ~; g2 T" P' f, T- t4 y
~4 h" f5 J7 I9 x) y- static volatile int irqraised1 = 0;6 U- g6 s8 Q, c6 F3 R
- static volatile int irqraised2 = 0;
! m7 b0 }: W! N7 r' r2 R7 h- H
# Z ^5 s# {' j1 ?4 r3 S4 ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" V+ v0 `! n+ r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& X$ W1 F' A$ `& E' w2 s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& U& |# J( ~! Z! i w: k - % w5 _* U# A( a- D3 M' j: O
- dma_addr_t dmaphyssrc1 = 0;. ], `# s8 @8 x. m
- dma_addr_t dmaphyssrc2 = 0;, q; M: ^( s c' S5 d% k
- dma_addr_t dmaphysdest1 = 0;
2 Z/ r2 O0 w4 q8 w: s* a& O, o - dma_addr_t dmaphysdest2 = 0;
# Z' j8 C0 x C. i- c2 \ - * O$ x: o1 U! d0 d' k
- char *dmabufsrc1 = NULL;
6 u4 x" n+ i I - char *dmabufsrc2 = NULL;8 Q0 u0 `5 Y. u. D
- char *dmabufdest1 = NULL;
& w1 v0 N8 ^: w* `1 J1 r* @ - char *dmabufdest2 = NULL;7 Y% H1 C4 y3 ~; ?6 r
- % s9 y4 w9 x7 m1 P1 u$ o
- static int acnt = 512;* v& z8 ?; B! E0 d; n, p8 C0 \* o
- static int bcnt = 8;" S$ L) C: d9 \! v3 M; S
- static int ccnt = 8;" r+ n; I, a' D* q. {# b
' ^7 j2 j y. ~- module_param(acnt, int, S_IRUGO);8 |/ l3 _/ Z; Y9 R1 E3 M: p
- module_param(bcnt, int, S_IRUGO);
6 z# Z7 P5 }% z0 u - module_param(ccnt, int, S_IRUGO);
复制代码 " q! s) |3 Y- _. e1 {7 M( x
" A6 J* O) x: r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: R4 l H& a; Y# X4 U# J: _6 V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" Z8 ]1 w3 w. D5 c' x g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 G2 r. Y. C l, ]+ }. s6 o
" Q. s) j. a6 k$ K0 @# m9 X+ X* `; Z. v c" v5 q
|
|