|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & o: S1 `( }; x6 D c$ D
- [code]EDMA sample test application& j% f3 i; h; V# _) t8 _; P
- /*
# C& F+ f4 r; z! ? - * edma_test.c
1 T' f& X/ }2 s; H! { - *
2 M3 v2 H a4 y6 ~# | - * brief EDMA3 Test Application
! K8 Z! S* C8 e+ o9 c" \ - *. T; b! h, B- r5 V; V* y7 `- w
- * This file contains EDMA3 Test code.! E8 @; N7 [" x, ~) A
- *! Z& v/ x$ D% @+ Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! v& P# d2 m# X a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* {/ V9 R) k& A9 ? - * TO CHANGE.) m) R6 K( S; I: g
- *
" B8 a( e8 v8 J3 j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: N" _& v9 m: v" o5 O - *0 q& [( v( O" Q
- * This program is free software; you can redistribute it and/or! a' f1 ~$ o" F# f L2 K
- * modify it under the terms of the GNU General Public License as' c7 a) \: _: m# u$ g2 r
- * published by the Free Software Foundation version 2.
; h' w% Z) V: x$ K$ c6 c - *
3 Q7 l5 {- [" I' O/ g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% g0 f! q' Z1 b& ]8 F! W) {
- * kind, whether express or implied; without even the implied warranty
, R3 l$ T9 x6 b. g8 U4 | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: E" e, D4 m0 E3 o7 \8 ]
- * GNU General Public License for more details.4 n: q0 N- N) T, s
- */
9 G* I- a3 i% w
) B* \$ T# Y. ?; i) U1 e9 [- #include <linux/module.h>
9 j r2 Z' A3 i% N% p" S& F" M - #include <linux/init.h>5 \2 N3 t( `- \6 I/ R+ C. D
- #include <linux/errno.h>
/ K! z- D4 }3 M - #include <linux/types.h>( K% M5 A# @" C z2 F) x* o" |/ X1 R% j
- #include <linux/interrupt.h>, r& ^8 T9 c" z( R# e0 f2 b0 M& [& Z
- #include <asm/io.h>
2 \( Q& m3 k. Q9 q. O9 f* \ - #include <linux/moduleparam.h>
/ y# f' R1 m2 X+ V1 w - #include <linux/sysctl.h>/ B: a+ ]/ h! \
- #include <linux/mm.h>- m6 `& {8 K6 W9 b7 ^' n- q
- #include <linux/dma-mapping.h>+ i7 X6 _# H2 l K. j9 I
; Y8 a/ Q9 ?7 G7 _5 K- #include <mach/memory.h>% j' Y5 T' t3 h3 v( F
- #include <mach/hardware.h>
5 \0 x2 N9 d4 C' v% y! E' \5 s9 Z - #include <mach/irqs.h>/ Z+ _* z! d- _) Y; N( s% \/ D
- #include <asm/hardware/edma.h> `0 y2 i8 G, j2 M& G& B2 p, z7 n
- ' N" i/ ] r: r6 w o
- #undef EDMA3_DEBUG7 I. [0 i4 p, v
- /*#define EDMA3_DEBUG*/" T/ P& W% z3 K* M# v2 U
- 3 V7 J* E# D8 Z/ {" N2 f5 g |. |& l
- #ifdef EDMA3_DEBUG
$ A7 u0 v f' V1 @1 f7 ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 |9 B2 e6 |% ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). ^' l& }% ^; U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 h/ H$ W, ~6 I8 Z/ v2 ^! K - #else
1 F& x/ U5 \4 b. R) R - #define DMA_PRINTK( x... ); k, F2 \: [3 @. g) `& m- u
- #define DMA_FN_IN
" m7 m2 q9 g4 t0 c/ q" S: x3 P4 ^" x! @ - #define DMA_FN_OUT
Q+ Y2 ]5 m p5 k, m5 A! r k4 w1 ] - #endif% V9 g* b4 z/ i
6 I4 K: e. T g2 b0 D8 U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 w2 C5 y8 b( ~& N) {, p
- #define STATIC_SHIFT 3
& o5 v" C4 r! N# p - #define TCINTEN_SHIFT 20
7 c/ B) }' Q# F" m) D, e8 q - #define ITCINTEN_SHIFT 21% C4 ^, j* s# ]% M( p' }$ s
- #define TCCHEN_SHIFT 22
( X/ _- `* J0 e- K9 Z - #define ITCCHEN_SHIFT 239 E3 @) s2 S4 B. W4 a( v4 ]
- 7 g; k' a/ G8 }% w
- static volatile int irqraised1 = 0;
( B- f$ U& K( @ - static volatile int irqraised2 = 0;
- b+ E* I% a$ S5 @! U3 d
9 ^# r( g% }; s: y g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; n5 R( M5 w* L3 B5 v3 _. B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 q7 o ]; j7 c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 v X5 v4 r G9 ?/ ^) u$ s - $ S9 V- }# W7 m
- dma_addr_t dmaphyssrc1 = 0;
6 {0 T c; W2 S! I5 C9 T - dma_addr_t dmaphyssrc2 = 0;
0 I8 n/ m" |6 r! k4 m5 L4 K5 B( q - dma_addr_t dmaphysdest1 = 0;7 F9 X9 b @$ p- k7 n$ ~( ^. y
- dma_addr_t dmaphysdest2 = 0;
$ l' ]: l: {- d u- K - 1 {2 `8 k% a7 Y' J4 ]
- char *dmabufsrc1 = NULL;
$ L+ W/ ?( y% ?7 }' K - char *dmabufsrc2 = NULL;4 h" v* y- w j' o6 q2 f7 L
- char *dmabufdest1 = NULL;
8 }4 y) l; E2 n9 x# G2 ` - char *dmabufdest2 = NULL;
* T7 d7 B4 M6 I% P$ h8 b
6 ?/ F/ Y$ Y. `4 l/ B- static int acnt = 512;1 a( p! ?8 o0 X! [: ]+ h
- static int bcnt = 8;, s. ~' Z9 R. P$ T. H* v% j! c
- static int ccnt = 8;3 N: w2 F B/ z% Z
$ e3 f' m& z' I4 H2 A5 T2 G- module_param(acnt, int, S_IRUGO);2 w" @% s2 s1 M0 M
- module_param(bcnt, int, S_IRUGO);+ w+ a# W6 `6 w' a9 I
- module_param(ccnt, int, S_IRUGO);
复制代码
$ }, x# @- e" U- d4 ^4 s! |4 B4 h: L% y8 L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- {, W5 Z4 N2 A5 @- O( s" varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. s5 l4 g% {4 _% d) q# Z; k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 f& ^' b( ?4 a! \, H
) e8 ~ C# [* C$ ?: Q$ h5 G% w
% ~- b$ A0 I5 M' Q8 j |
|