|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ H- I. V9 w) m& |* |- [code]EDMA sample test application
: J0 B v+ A1 V2 m; x/ H' X+ e4 y - /*
1 O3 F' S4 E, T D- h7 r& h/ r - * edma_test.c
; |1 q7 e7 Y5 ~; l - *
, \' b: e, L' ~) q - * brief EDMA3 Test Application' D+ f( |( Y, g
- * d0 T/ M' i2 x7 x, c8 O2 ^% T# B
- * This file contains EDMA3 Test code.6 H0 {/ d& e5 X1 g: ]" ^5 f
- *! f; Y" u! d. y2 {1 T9 Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' X) F( T' g c8 i8 \0 y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 G; n# i/ s- R
- * TO CHANGE.$ |2 Y% a: H* H; o
- *
! S4 x, m, O* `% ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 f p* J }2 T7 N - *
0 \6 W ?- h7 S) }& u4 x - * This program is free software; you can redistribute it and/or6 c5 k: N% n: `! y# ^
- * modify it under the terms of the GNU General Public License as8 M( I; H7 t1 k# {, I
- * published by the Free Software Foundation version 2.# E3 H4 {% H$ o, }0 B4 n& u
- *) [' Q- X- C4 Y9 Q# V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' ~$ v% j% y( j0 z: b - * kind, whether express or implied; without even the implied warranty
: K4 C3 D1 {5 j. T! N: E. v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" I: [; y! V6 d
- * GNU General Public License for more details.
: x1 c# ~6 R/ V6 I2 k# e! C9 d* \ - */) `$ w! h! b: G' a1 I
- ( I( T. R, L S% S5 B
- #include <linux/module.h>" t$ R; V7 N* M6 o; \
- #include <linux/init.h>. }7 d0 V3 p4 j& |
- #include <linux/errno.h>
- ?6 F7 V% F* A u* L' Z - #include <linux/types.h>
# }; Y o4 `; I - #include <linux/interrupt.h>3 C' Y% W6 Q* q. @# U; L* o9 x! V3 F
- #include <asm/io.h>
* |: N0 F& `2 m& k - #include <linux/moduleparam.h>
3 T! V+ G% J2 u% J - #include <linux/sysctl.h>
5 f6 B3 b7 W# I/ V - #include <linux/mm.h>$ E9 p" W V4 D* V% V
- #include <linux/dma-mapping.h>$ F. G: W3 U- I4 @, h* n* N% Y
- ! `* g2 n) N6 A% b4 } J
- #include <mach/memory.h>
, B9 r; {+ L, Y/ V - #include <mach/hardware.h>
" Y% w3 Q3 a! n' R/ [9 }& |+ {$ { - #include <mach/irqs.h>$ K2 t# Y6 e! T {/ t+ l
- #include <asm/hardware/edma.h>. j$ J/ ~, A. t* Q( }
- 3 l8 {# r& l* B9 X! S5 |
- #undef EDMA3_DEBUG
% |7 P6 v% I4 n |; j - /*#define EDMA3_DEBUG*/6 _1 M6 J$ T; \; \: W6 G
- . a1 q0 q5 X& w9 ~& Q9 ]: b$ I
- #ifdef EDMA3_DEBUG* _, r2 j$ J8 J! L$ ~% u @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. d" X1 Q6 Z3 }4 z U- P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ g! B: p! n( {' G# l2 n0 r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 s* H( h& j4 Y4 V* m1 B. ^
- #else
! r2 J9 i# ?, W9 H& Y7 y3 m - #define DMA_PRINTK( x... )
) m' h* w1 j& j$ K+ v$ b - #define DMA_FN_IN
. x0 e, u) k) U6 Q1 ^# A, b - #define DMA_FN_OUT
% C( X H8 s! s2 C6 z - #endif; x! b8 i+ A& ?$ f' W
" m" q" M* M9 r R6 F# t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ L1 }7 I! ~8 v, ~4 D9 G
- #define STATIC_SHIFT 3% ^* @! Y' J9 V) h( [" _* [1 r
- #define TCINTEN_SHIFT 20. G# ^8 H2 M; k) K# o1 M
- #define ITCINTEN_SHIFT 213 W" s/ b* L' n# W
- #define TCCHEN_SHIFT 22: s! Q/ b* T9 u8 ^6 b1 j7 r4 j* Z
- #define ITCCHEN_SHIFT 23; `3 x' S( ~9 ?7 W% o# i" H3 ^4 @- W
- 1 t6 N5 \+ I5 D' @# ~, g
- static volatile int irqraised1 = 0; F5 I1 [; N: N2 e( f5 ~8 _$ r0 F
- static volatile int irqraised2 = 0;9 o+ h' x/ C a- B, N3 c0 @# n1 |
% E! ]; U- _ n1 _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); ?, ^+ e: X2 J3 |6 ?) k6 C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! S* [& j4 d1 Q: i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 Y2 R& U8 r9 |- v - 8 Q/ M: F, @6 s7 {+ S2 V
- dma_addr_t dmaphyssrc1 = 0;
# ]; N; Y3 b3 d - dma_addr_t dmaphyssrc2 = 0;4 {- }" g8 l" @: w) w1 l6 e
- dma_addr_t dmaphysdest1 = 0;0 p; Y2 i5 O* a
- dma_addr_t dmaphysdest2 = 0;
3 ~' h5 b1 a4 `5 b2 k+ g - * d2 v3 {, p$ @3 S2 Y( n9 [
- char *dmabufsrc1 = NULL;
) W' y/ v0 Z) D" U3 ]/ N - char *dmabufsrc2 = NULL;
% o3 F K& [- `# u( C - char *dmabufdest1 = NULL;
: j$ c6 w& D- v* S, x, n4 g - char *dmabufdest2 = NULL; c" n% i! Q5 Y$ c5 F
) Q/ q) p, j- R$ A- s- static int acnt = 512;
, q3 j4 `( _4 y/ Z. { - static int bcnt = 8;
' H% o& O# V; g# D+ h* r - static int ccnt = 8;
2 C! S$ w; Z' r* m- J6 ^ - - ^$ i2 l. W$ g3 |7 J o# W
- module_param(acnt, int, S_IRUGO); V0 |( L* S% M1 S' P+ @# D$ [- n8 P9 B
- module_param(bcnt, int, S_IRUGO);7 R& t4 |) X4 _- C! x8 F! Q
- module_param(ccnt, int, S_IRUGO);
复制代码
; t4 x* C c5 Z) J8 R. E w) t1 ], `8 z2 r$ E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( l* s/ t. J% y0 g5 J$ zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: x8 j( j, G# k& p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 }! K& M7 d Y. t: U8 `8 r
. g$ S1 V# w0 l2 _% k0 n A/ W0 O7 Y; N4 w1 E6 O! m6 n8 O* t# j* [
|
|