|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# X. j9 v* M5 } v! w7 Q& ]( A- [code]EDMA sample test application1 U, ^/ \& b, J7 _0 w. M& h
- /*
5 I9 ~9 q) Y7 W. c V - * edma_test.c
; v- s+ j7 R+ ]+ ?& Q8 T - *
T7 P% X1 q3 `0 t8 T8 J - * brief EDMA3 Test Application& y6 ?2 X' q# }; j A: m& N
- *& p# L9 K4 ^( S! n) [+ F
- * This file contains EDMA3 Test code.
4 J# P7 q1 V/ N7 T, X - *2 V/ ?9 b& y' V* L0 ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 Y7 ~0 o u: a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 i" [" j% d+ ~8 |" o. N. Y3 ^
- * TO CHANGE.
, T& e) l- M/ z; f T# R0 e - *9 \6 i& V' E. Y7 m r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 |8 V: n4 [9 s/ s+ G' n - *! @5 i! ]# u/ F2 ~" B: ~" R3 X
- * This program is free software; you can redistribute it and/or4 B/ T) j# |# W9 b
- * modify it under the terms of the GNU General Public License as B: ^2 G# u+ S: m/ i
- * published by the Free Software Foundation version 2.
- k& N! ~9 L3 F9 V7 C3 P w, z - *
1 ]+ q. I" J+ V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, T( c) [4 G9 r
- * kind, whether express or implied; without even the implied warranty% A& g3 Q) b$ a$ Y/ |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) x5 `, m# [: H' ~7 r, p" ? - * GNU General Public License for more details.
. ~, S/ f }/ i# [% @ - */
, r; _! V) {' e9 {1 c+ I
. V- e( E- g6 V5 P; D6 o% ~- #include <linux/module.h>; R: j$ e, h, g& d
- #include <linux/init.h>
8 X M3 Z$ t ]* F, ?6 {. E' L$ ? - #include <linux/errno.h>, Y2 j6 f. M6 m0 C- N) _
- #include <linux/types.h>( s$ b5 ?. ^3 z9 {3 _
- #include <linux/interrupt.h>
4 i; l0 s$ n, a+ P- i* X - #include <asm/io.h>% U- A% k# p! s
- #include <linux/moduleparam.h>% w3 C9 T' Y0 z$ @
- #include <linux/sysctl.h>
- F& a. n. T9 |2 Q) c6 t2 ~* W1 b& y - #include <linux/mm.h>
) b+ a6 O9 w/ S! q/ C) d - #include <linux/dma-mapping.h>' M% J/ V" ^' c8 N3 j7 p5 n
! r$ t$ v7 |5 K7 | t- #include <mach/memory.h>1 V! d3 p& E6 U7 Q
- #include <mach/hardware.h>: k. K1 u/ i+ V0 m2 f* }
- #include <mach/irqs.h>4 c1 |: m3 ^7 a' {" w; c; _: ^" g8 G: K
- #include <asm/hardware/edma.h>
Q: G+ Y- o( e0 |3 N
) \1 q) S- @! \ M/ K4 c& q5 J+ E- #undef EDMA3_DEBUG! e! u, q. J7 p' B( S$ p) b
- /*#define EDMA3_DEBUG*/, Z- G4 X. o2 H5 \
- / w8 v R) K1 [9 _
- #ifdef EDMA3_DEBUG
& Q7 m! S" T: \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& g Z0 h8 ~7 u9 \4 p) I# ^( A1 v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 d) ]/ g$ e2 A6 A" I, V ]+ p# ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# A5 }0 f* h6 N' @$ G
- #else
* o4 k' _' m+ K! Z$ m - #define DMA_PRINTK( x... )7 t7 S t0 h& V q$ ~# J# ]
- #define DMA_FN_IN# j: Q9 o+ b+ T
- #define DMA_FN_OUT
" j: n( [# K2 B. Y - #endif
9 o0 Q3 G* O0 Z' D0 r - ) l1 ~% U. W* c, n7 Z9 ~8 J# A$ [. C- v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) P( M4 P' b$ i3 T% S - #define STATIC_SHIFT 3& c. U5 e: m( R
- #define TCINTEN_SHIFT 208 L. J7 U& T4 H# v0 w$ W' a4 @
- #define ITCINTEN_SHIFT 215 j6 V* _- F$ p8 `
- #define TCCHEN_SHIFT 22( f5 f* r7 o/ T4 |8 S
- #define ITCCHEN_SHIFT 23
7 O& j) w% G' [7 _, s8 `# R - G- t# H5 S0 t2 O. h
- static volatile int irqraised1 = 0;2 o/ r0 n: j' N) S7 _/ P
- static volatile int irqraised2 = 0;0 L& m2 h& x* Q- k
- 5 q3 j* M _) G( f' S6 [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 A' Y o, j3 B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( f* d. A3 Q9 Y+ \6 O: Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; g* C( _- m! ^* F6 F/ r
- / [* w$ b6 M* O! ^
- dma_addr_t dmaphyssrc1 = 0;
/ Z. B t7 `& R+ w5 H/ t$ D5 ? - dma_addr_t dmaphyssrc2 = 0;
; w3 X2 M% |4 p/ y, l' f - dma_addr_t dmaphysdest1 = 0;
# G% ~# F, S# l! K) [4 h. n - dma_addr_t dmaphysdest2 = 0;- x5 F& K8 \8 h
- 8 M6 A9 L* h' }/ i5 d6 ]& t
- char *dmabufsrc1 = NULL;( D) Z9 ^4 p0 B! ~/ N
- char *dmabufsrc2 = NULL;
|; h" x/ Q% ?. z - char *dmabufdest1 = NULL;% w- D2 ^& b. E6 e' o; a
- char *dmabufdest2 = NULL;0 `' j q& {- A9 o" U! v- u
$ w/ e p+ `9 Y5 U- static int acnt = 512;: D: _2 ^5 ^$ X4 ?3 i. ]' D
- static int bcnt = 8;0 q* {+ h" i9 l4 y3 U
- static int ccnt = 8;3 X: W4 {( x; X# M$ B
- 5 L6 x5 v$ @- ?/ W9 c( R* [
- module_param(acnt, int, S_IRUGO);
9 R1 A l q1 ?3 m; u2 K# N" @ L - module_param(bcnt, int, S_IRUGO);7 A {$ m1 O6 R6 h+ G% X6 {! w
- module_param(ccnt, int, S_IRUGO);
复制代码 2 h; E2 z% \2 z d, x1 s2 Z
7 V- w# \4 S3 j R% U) y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" |; d1 L+ y. y( ]0 m' j0 Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; p1 j$ T5 b w; C. ]2 P& v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 P, `9 H$ H p: l, b) d
0 q6 X, B+ ?$ T0 [3 E
/ j; n6 j" s) p7 Y* W+ M
|
|