|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 p) n( D m0 @/ ?9 [- [code]EDMA sample test application% {9 w0 {9 C4 f9 a8 E
- /*. Z4 K2 o& E; X7 M; s( B/ @# P
- * edma_test.c) D' U( l: x2 G
- *
. n; S V1 p6 }9 F \' [ - * brief EDMA3 Test Application! ]2 a) m3 c& L
- *% {: h' M, J2 x5 l8 d$ A2 D
- * This file contains EDMA3 Test code.
S2 d& Y% U1 O! x& n1 E - * [' p8 J1 n! _/ t' c- F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- u2 ?- @& [) U& K2 s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 W5 Z# r- _& I5 f - * TO CHANGE.
i$ k: ]8 ^+ W% Y. A* O2 ~ - *# A1 H+ P. d6 w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& Z8 N" @- K3 J2 u0 g& V
- *
4 B7 O$ R& s$ }6 v+ p7 I; r - * This program is free software; you can redistribute it and/or' n. e# R7 e+ U
- * modify it under the terms of the GNU General Public License as1 `6 ]5 Y- T8 G& Z
- * published by the Free Software Foundation version 2.
+ K, S1 N2 {- o ^9 R - *
( ^2 X) a( `2 g* i. }* E5 ~) M$ i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, j% u5 B: p( I
- * kind, whether express or implied; without even the implied warranty1 a( f9 C/ s' K/ H( e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; d2 P2 B3 i/ e1 x, K. P
- * GNU General Public License for more details.) X1 n* _& v) O% N+ c0 `
- *// G+ ? i* h& G; l9 `7 T, D
- 8 U: c. h/ N1 g
- #include <linux/module.h>1 J/ P1 f3 a* [9 C/ S( u
- #include <linux/init.h>+ G" p. t0 i2 H0 @9 F
- #include <linux/errno.h>
3 ^1 B, {+ a8 }$ S" k* B - #include <linux/types.h>
" n* _$ `# ?# s: K7 _ d% Z - #include <linux/interrupt.h>2 U0 b' M9 u, u3 t8 ^, g- f
- #include <asm/io.h>) V l8 U: r; _, w O. D* [: R. m
- #include <linux/moduleparam.h>
7 F. I$ l+ U# i4 G* ? K$ y - #include <linux/sysctl.h>
) q0 p. U. s+ \# h! M/ }0 H# K - #include <linux/mm.h>
9 ~3 `8 R8 L* Z0 o ` - #include <linux/dma-mapping.h>
3 Z5 W& o7 S- m
, o8 u- K. t4 d6 x) @, I- #include <mach/memory.h>% \7 m2 }& Q" ]8 g+ n% X. I! ~
- #include <mach/hardware.h>
0 D; p# l3 y; C' a v1 s - #include <mach/irqs.h>
& x$ X1 y3 c2 q& P) n. F - #include <asm/hardware/edma.h>
: _) ]; n" |. X0 W: x
8 A3 ~% `4 \; x' J7 z9 M& Z- #undef EDMA3_DEBUG" O. q+ e3 L" ]0 Z# y
- /*#define EDMA3_DEBUG*/% g k+ z" v% k" ~4 d
- / Q5 E) Q2 [5 \/ F
- #ifdef EDMA3_DEBUG$ a$ J# U+ C% P: v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 o2 x; C& P: `/ A2 w4 ^( v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 k5 _1 ~# G7 A- w0 E8 O2 V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- C1 R; D$ R; ^6 `3 A1 Y( \ - #else
" T: `- A8 d% b' a* ? - #define DMA_PRINTK( x... )
. w. B9 O6 H! ?# A* b; _/ l+ s - #define DMA_FN_IN
9 E4 [/ B9 ]# y3 @: k - #define DMA_FN_OUT
R9 M9 w1 F; f U2 t G3 w4 K - #endif
0 Q4 E q9 [- D4 V - - H$ f d* K8 t- }1 I9 ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 [9 S9 E# Z% i7 h& v+ I) ?0 e9 b - #define STATIC_SHIFT 32 S% \: Q' I0 K
- #define TCINTEN_SHIFT 20
8 P: [" @3 F8 ?- t2 \3 p5 `7 n+ {: ^ - #define ITCINTEN_SHIFT 21& H3 j. d/ Y0 ~* D9 `2 l1 l; M
- #define TCCHEN_SHIFT 22
' n6 ]4 N3 W5 g5 ^9 g - #define ITCCHEN_SHIFT 23
+ c9 J q9 c8 s# m
! Z" t. V: H9 a! v3 K k( _$ M- static volatile int irqraised1 = 0;1 v' w8 M- Z x' L
- static volatile int irqraised2 = 0;
7 u$ e S% q7 s
7 f/ M" d2 S+ }# l7 @2 T0 S! x3 t* w! J4 w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& T2 W7 \9 R6 I2 ^/ m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* q5 [! A" A" W! z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% B# E( H! q5 X8 n% i/ _
- % e B' E2 @+ {# U4 J! w* a( S- n
- dma_addr_t dmaphyssrc1 = 0;1 Z, e, Y' {+ X1 ~4 _5 ?
- dma_addr_t dmaphyssrc2 = 0;
F: o% w6 Z. v7 s - dma_addr_t dmaphysdest1 = 0;8 L3 X" S. ]6 _* G u
- dma_addr_t dmaphysdest2 = 0;
- y9 `3 d5 F2 I2 _" v - # D* X! X! G$ o
- char *dmabufsrc1 = NULL;; w6 q( Z P, o# x) m4 m( F' `
- char *dmabufsrc2 = NULL;
+ G) X1 T) k5 T* x& [9 A0 K @7 L - char *dmabufdest1 = NULL;: J; ~! E D% G6 N9 e# K5 a8 H) V
- char *dmabufdest2 = NULL;
0 X$ u* B# z2 N% U4 m, C6 N& ~7 K" `3 v9 W
# T% @7 Y& }4 w* t6 B8 o- static int acnt = 512;
5 k, c7 A- d; g& D - static int bcnt = 8;
" d) l+ p0 z4 o9 x7 C1 S) g - static int ccnt = 8;
; P! v/ Z; ? H: u R
, u2 i: `5 E/ y7 \, F+ x- module_param(acnt, int, S_IRUGO);
, \/ C. }& x W( Q- `. M% q' \ - module_param(bcnt, int, S_IRUGO);5 O# S+ C5 }1 x; o3 A P; Y
- module_param(ccnt, int, S_IRUGO);
复制代码
# t. i) [ Z% s6 w3 ~8 ]- n0 d% P( w7 \/ ?, P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# ^7 Y+ v4 o4 E I+ `2 Z+ Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 g, G1 o: i# R% f, K3 V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% ?) l4 D. o6 ]$ M8 d+ j
j+ T8 G' m. A5 x5 e9 _$ m
9 S" o2 K: u/ q6 r2 B2 `- h F( ` |
|