|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 C8 l1 B' M- n% N' M- G- [code]EDMA sample test application/ I0 w1 q }/ _; D8 q0 W4 q
- /*
9 E' i* \ L4 x+ S7 `$ ] - * edma_test.c
0 ]0 \" N0 j! D* j: c5 v! l5 J5 ]) R - *
, e \; |8 {7 I$ E9 M3 O1 w1 m6 s - * brief EDMA3 Test Application! ]- N8 @8 c0 i6 l2 u% Z! Y
- *
: @+ n X/ P0 d& Q, _- i - * This file contains EDMA3 Test code.
% \% A& F' |1 T+ _' x - *
: F# I5 |6 j4 u% u+ C/ @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: Y+ Z# S6 c( F E( w. v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, g& G2 |3 d5 A2 A* m - * TO CHANGE.
2 _: d! a6 J6 T. z - *# H9 |# a7 ?. ~7 n2 b4 z' U( l. \3 S- c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& W& s- y7 u$ E1 c! D
- *
d( l& w0 |6 f+ Z/ m% o& {& K3 Q - * This program is free software; you can redistribute it and/or- N$ ^3 C9 f3 h9 ?
- * modify it under the terms of the GNU General Public License as9 O9 o5 s1 ~# B1 ]
- * published by the Free Software Foundation version 2.
* y0 O, x. C" r5 E1 y - *1 [+ h) {# A1 L8 N' K/ L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- h$ Q2 x, c: M+ p$ n2 ]6 J( o% q Q - * kind, whether express or implied; without even the implied warranty! z( V7 o# ?& U6 |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 x% R3 X+ _% B8 Q: c! V
- * GNU General Public License for more details.
- `3 U/ l3 Z6 ~2 [ - */2 b( s0 d; \ ]" f/ U6 \+ b1 h5 G
6 M7 W# V; R# K8 F$ M- #include <linux/module.h>
+ D' d- D1 q4 c/ V - #include <linux/init.h>
% k, M8 @3 a, U: ?( m/ B& t- O& g - #include <linux/errno.h>5 `# C" n3 j9 E0 i- j9 z$ Z; W
- #include <linux/types.h>5 i* I0 A# D7 q9 F
- #include <linux/interrupt.h>7 G9 h4 Q- d# A4 J' ^
- #include <asm/io.h>
5 C& m1 Z& ]4 V, c! k& s/ a7 Y - #include <linux/moduleparam.h>1 t6 U+ G- @! T, t
- #include <linux/sysctl.h>
+ h F* ^- j3 z$ [ - #include <linux/mm.h>! g! B- y5 s2 x, ~" |& x
- #include <linux/dma-mapping.h>
0 G$ [; K, |8 D K& V
5 U0 D, ~8 y# \- M# U2 \- #include <mach/memory.h>
3 j# L P5 W5 U: l" O7 q - #include <mach/hardware.h>
4 L" _4 z. B/ f1 a6 ~- U& a9 j: \% G - #include <mach/irqs.h>7 u0 g: V i8 f6 @* g0 ?& u7 U
- #include <asm/hardware/edma.h>
9 X* j9 Z' E. E& u5 T% |
" w$ q! F8 B. i/ m- #undef EDMA3_DEBUG
" ^- g# |: z( g0 u - /*#define EDMA3_DEBUG*/ l1 K$ j; N* t, W. Z
7 F% k# a$ R4 }0 V% S/ P( o: G- #ifdef EDMA3_DEBUG, R+ v1 h* M* [# h4 z1 i1 y Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& t+ D# q. L# h* f2 F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 b" p: L+ b8 }6 ?0 \6 y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! h; k% W% O- r8 ?; x8 |
- #else5 a1 i. b$ X1 Q
- #define DMA_PRINTK( x... )
! a7 u# m2 A* w - #define DMA_FN_IN
- V: X. `% [& C9 B, ` - #define DMA_FN_OUT
, x) q3 j/ Y. k& _ - #endif
9 Q5 H8 c/ a: U1 G- Z - 8 J3 C- ?3 P& ]3 ^ W; ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 |# I: q9 y: W; h+ Z0 q# { - #define STATIC_SHIFT 3! |; X8 u) `: Q* o' P; p
- #define TCINTEN_SHIFT 20
8 C9 S, x) H( l$ ?( B5 r/ u - #define ITCINTEN_SHIFT 21+ G- G8 _5 W q/ \, I+ H+ h
- #define TCCHEN_SHIFT 22 b+ S% [. G8 m% ~( l- x# }
- #define ITCCHEN_SHIFT 23' D- y1 M6 R' |+ M s% E
8 ?$ j# b# F+ T' N1 Z- static volatile int irqraised1 = 0;
" {1 w% b% Y) @, b0 ^" n - static volatile int irqraised2 = 0;
( W3 N2 Z, c' D* |" R) D* F* O/ ? - | j: `) M+ m3 q3 C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 m- \3 z* Z3 K4 ]/ t- r0 F. w! V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! M/ l; }6 l6 `/ B7 P+ a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% P& [- G) q3 O0 h
# b' E+ w! d& F/ a- dma_addr_t dmaphyssrc1 = 0;
% F2 s# {, I1 a. _/ n& j0 C - dma_addr_t dmaphyssrc2 = 0;! _0 Y, T$ B/ |- e
- dma_addr_t dmaphysdest1 = 0;
0 d( c$ o3 L, C3 M - dma_addr_t dmaphysdest2 = 0;
3 w4 O5 N" `2 A
- e- h2 }+ Q8 f" ^- char *dmabufsrc1 = NULL;
; Y9 ~+ E" P' w - char *dmabufsrc2 = NULL;& A! u) ?- k1 n! I t
- char *dmabufdest1 = NULL;
% I/ X- j. [. H - char *dmabufdest2 = NULL;
9 P7 k# t7 J( a! r: e3 z% D" G - * q5 y% n' @/ V a
- static int acnt = 512;9 a0 C4 x2 K( j8 b
- static int bcnt = 8;' f! g7 x3 D$ n7 \
- static int ccnt = 8;
9 O7 `5 O: H3 G - * F+ W- r6 T) Y
- module_param(acnt, int, S_IRUGO);3 ~9 E* s7 A! c- ^( r% d
- module_param(bcnt, int, S_IRUGO);1 ]. n% \ f) U
- module_param(ccnt, int, S_IRUGO);
复制代码
/ l; g( t& f$ O3 S) w$ A" f4 F1 @9 @3 ^( K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, U3 {7 i% }6 I; H9 i+ j! Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' r' [9 @+ n+ f5 z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 k: |! }: R+ i8 `8 V0 ^; i* J, f8 H# X! b# }, U2 J# B
2 Y- _ v9 [. r! s5 c. S) s& t |
|