|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 h3 j! D% q9 q; ?1 a( n- [code]EDMA sample test application9 x, g* y. f! X: S: p8 R3 p
- /*
8 S3 T" ]/ ^- R- M/ |! F - * edma_test.c9 q$ R5 L! E$ }) f
- *
% X% a0 V( n$ ?$ `+ M5 b7 q - * brief EDMA3 Test Application, i$ c4 T' ~/ u4 T7 {1 E
- *
; K+ a0 q# \. W6 W6 g1 j* q4 ?& L - * This file contains EDMA3 Test code.
) a6 o( e; S$ v C8 \) }+ r: m% N" c - *8 z) y! F" X0 b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* @6 ^+ t2 L+ ^- H7 I, Y7 A" v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! v6 A* L+ t4 M: E+ g* _7 b/ O - * TO CHANGE.
, ]; b, p. ?1 u - *
" V' m4 ?! X+ k9 ? - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ |6 G! o& j. u8 S( | - *
7 W, B; t% C% D9 y# o - * This program is free software; you can redistribute it and/or! G b2 n! {: O; J' {1 u& V5 W' `5 }
- * modify it under the terms of the GNU General Public License as2 }! D& k3 e9 P5 y3 f
- * published by the Free Software Foundation version 2.
! b4 k0 `' ^- M2 o; T$ _ - *
* U% Y+ d* }' m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 E7 v: Q7 ? y, S" I% N - * kind, whether express or implied; without even the implied warranty4 w2 o& l; p( k0 L& K/ e/ b: k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: n0 I% H9 Q: ~) ~. w1 ?
- * GNU General Public License for more details.
6 x" |' @" f3 A& E - */
) V6 J! U* ` K0 S - 0 h9 E6 Q. K* y3 C
- #include <linux/module.h>+ s ^7 D7 _' i% M- P. C' v
- #include <linux/init.h>
8 v! V! q6 [4 ^. d$ T# E- c - #include <linux/errno.h>% n5 Z" I% J, M7 U4 H* S
- #include <linux/types.h>3 r$ B0 F! ]2 A, C* W, V
- #include <linux/interrupt.h>$ s- N0 ?& F# w4 J2 g; [" X% D
- #include <asm/io.h>
% D, \. B& w8 m. \. X0 n9 {3 { - #include <linux/moduleparam.h>
, m* k6 ^& {( _5 l - #include <linux/sysctl.h>
$ ^- D0 c/ j+ ]! y - #include <linux/mm.h>
3 W! ~1 i9 ^% o6 K7 ] z0 l - #include <linux/dma-mapping.h>
" _1 @3 X) B5 I; d5 F
+ k% q* Z4 E' w* W0 k! D, A2 @- #include <mach/memory.h>; F0 n; P" B$ K
- #include <mach/hardware.h>
C- ?# p6 c: ^4 f3 _$ D - #include <mach/irqs.h>: o# U1 c4 U5 u2 C7 Q
- #include <asm/hardware/edma.h>7 Y: n( i' d0 U Q! @- S% N' X
- # h: A+ P6 i) Y. R/ }+ Q
- #undef EDMA3_DEBUG% F3 J7 L5 F3 ]5 O
- /*#define EDMA3_DEBUG*/
d9 H8 b: c& |2 x. D+ r4 y
/ Q- f2 n, \0 X. j4 D8 T" _. ^5 z- #ifdef EDMA3_DEBUG
, }/ f& l! G7 s7 G1 C( @! m. q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 i" A! @! ^! Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ X- F6 R( C9 e5 w. d* f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" Q: l' R2 X! U6 @5 U& [ - #else
7 X6 E7 A) u |3 A4 } - #define DMA_PRINTK( x... )4 Y8 u/ A+ M" x' Y1 R+ j
- #define DMA_FN_IN
- l! T3 x* }/ T5 o4 z6 @ - #define DMA_FN_OUT1 e- D; A$ }% d- B
- #endif
' q/ a. }: s# k4 f6 Q$ m, v' ~
[ e" c, P4 o: ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 F% l, I% `+ C$ g; E! n$ g - #define STATIC_SHIFT 30 p; f0 f0 ^1 A; t/ I
- #define TCINTEN_SHIFT 20
3 [# M; |6 j* Z R( Y" D2 w1 c5 e - #define ITCINTEN_SHIFT 21 n& b6 G& {0 D0 [! ]
- #define TCCHEN_SHIFT 22& p) U1 S V$ w
- #define ITCCHEN_SHIFT 23
" W9 B0 k; ]1 v( n - ) j f/ t& O1 }
- static volatile int irqraised1 = 0;
" {2 d( |- C5 J; C& W9 c5 K - static volatile int irqraised2 = 0;
( E: Z# U K1 ~+ ^3 R0 v - / ]4 r2 w: b) v' i6 h4 \8 L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 }0 b- _5 [3 \* c! g8 N: o4 Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( w5 o0 ~% Y8 i9 N0 L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ G8 o: u9 |% S& ^( h* [: r
6 W9 |/ z% i% l) U( W1 J- dma_addr_t dmaphyssrc1 = 0;
9 d1 ~" D7 ` k0 B1 g+ @" a - dma_addr_t dmaphyssrc2 = 0;
3 w5 r. l( P) j$ H% H - dma_addr_t dmaphysdest1 = 0; M0 }7 _! `7 S Y# S" D& _) c8 S
- dma_addr_t dmaphysdest2 = 0;
; Z3 G+ z$ \7 Z* U) w4 ? - + z& S' }; H& V4 x- v N
- char *dmabufsrc1 = NULL;. Q M! N5 ~& {$ o8 y$ r9 ^+ o
- char *dmabufsrc2 = NULL;# W. q3 j, k+ J% o: M; c
- char *dmabufdest1 = NULL;
% u4 ~* D4 t5 v# ` - char *dmabufdest2 = NULL;
8 h5 }: q" f; K* u - : m! M5 E+ L1 ^- b
- static int acnt = 512;4 G- K0 i0 v# M# B: `
- static int bcnt = 8;2 F) f: i, a* i. k. Z
- static int ccnt = 8;2 x7 z3 L6 [6 D
7 G7 @( B& E+ d' X1 q0 |- module_param(acnt, int, S_IRUGO);. H N: c/ q5 _& D$ x) p" S3 k
- module_param(bcnt, int, S_IRUGO);
+ M, U5 ~8 R# o - module_param(ccnt, int, S_IRUGO);
复制代码 0 w q& [) X& E2 R% n
* |* s& k, w+ w) i$ \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* F8 I: A/ B! P" L3 c) t9 v3 R uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- |1 [: N( b0 I0 C& A" U/ K* b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# u; r0 r/ s: v4 l
0 _+ g+ a/ `- b" e1 ]
5 z! E; U% b/ x; R* ]( w |
|