|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( t9 [0 r7 m# ?: v$ |; G: E7 C
- [code]EDMA sample test application
1 R) E* I0 o5 m" m - /*
5 j6 w" c2 }8 m* _; o7 { - * edma_test.c
3 o) k) G( B* e( x6 \ D4 b - *
/ @' C. |! K; R7 X7 C) P+ @, c7 A' H - * brief EDMA3 Test Application7 v R* \0 g$ ^3 F1 u
- *
$ [2 b( e+ k0 o( P% M - * This file contains EDMA3 Test code.
3 Y# U! R! Z# W5 D; ?' I - *0 ^- r6 t/ k2 \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 _8 F; c k& V- S. {5 l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 v5 d! ?3 I- x6 t6 t& Z0 ~7 R2 ] - * TO CHANGE.
4 a: O3 S* O' e9 q9 ^( h, s1 X - *8 S: Y9 V% g; E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% e. T' O5 A. a3 N
- *
/ O. {: E) A# D$ x8 { - * This program is free software; you can redistribute it and/or' M7 R$ R4 x; G" ?$ Z2 U: \
- * modify it under the terms of the GNU General Public License as
# V: H" m( O1 c& a1 E5 n7 O% l - * published by the Free Software Foundation version 2.
3 O: R# Q% ~* V0 Z; } - *- W# ^! m$ v7 ^) g H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' h/ g9 F. l. Y6 J; t+ H( F3 r2 e# L - * kind, whether express or implied; without even the implied warranty
1 q3 D' B. S7 q' S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 j* r9 O+ ]+ s# T& l& S+ J5 C, S0 R
- * GNU General Public License for more details.
3 E8 T. j K$ [& o+ ^# Z - */
# h& \, s. V! C. i: a, n C
3 g' l2 Y. @9 n; M- #include <linux/module.h>
7 M3 b, q7 D& } - #include <linux/init.h>6 i9 O2 G7 r. {
- #include <linux/errno.h>
2 P. {+ t2 H! {$ a$ T; a - #include <linux/types.h>: P8 m! Y, ?1 c. n
- #include <linux/interrupt.h>
. X2 A' X* t' e i - #include <asm/io.h>
, u6 |' k1 n L" V - #include <linux/moduleparam.h>& Q3 T( W3 a: G1 k" f$ y9 V
- #include <linux/sysctl.h>
( b" g* i5 t9 X: a7 n! K% E( t - #include <linux/mm.h>
a5 {+ p0 ]- S7 o% R& K/ B - #include <linux/dma-mapping.h>, O7 `0 k' u) \) l% T( k" X5 A
- ]: ]" \" F8 G0 s! R% q
- #include <mach/memory.h>
. @6 e% `/ c! \' c* \9 H - #include <mach/hardware.h>
6 m( n0 c& {4 K1 } - #include <mach/irqs.h>
# C w& x' h( k- { - #include <asm/hardware/edma.h>
8 ?' H2 M4 Y* K( d3 g: D$ D& l+ {' Q& i
^0 F4 k, P: L, g3 c- #undef EDMA3_DEBUG0 z8 n5 p) q- ?, w: v/ D
- /*#define EDMA3_DEBUG*/
; c) t: E' i0 `% ]4 m1 e - 5 s0 E) f$ }( ^, ?0 p
- #ifdef EDMA3_DEBUG6 ~2 x/ y! G) L" v* p7 {5 U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' y S0 `5 W, U+ x$ G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) v& J H1 t: K1 d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- m5 j1 e' o& _: N" H
- #else
& u# ^% u3 H6 X! M1 D* k - #define DMA_PRINTK( x... )% t6 }; @! U! T
- #define DMA_FN_IN
7 R1 q/ Y; F. j$ {! _+ V' k - #define DMA_FN_OUT
- F0 b: A8 N$ h% b$ }3 M4 [ - #endif
8 @3 B. U6 c7 P- W/ Y7 R - ' q4 a& D, K8 o7 u8 w( r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 W+ g8 a% E3 }3 G
- #define STATIC_SHIFT 3, J( Z- J. k& a* C' k& Z
- #define TCINTEN_SHIFT 20
1 E) ^) G( T1 i5 Y - #define ITCINTEN_SHIFT 216 E- e$ ?- l* `& C8 z
- #define TCCHEN_SHIFT 22
Z' ?& P; G" U% K& O. T - #define ITCCHEN_SHIFT 23
: i: J ?2 ?- ~- Z5 j - 5 v. N* | c$ Z# m0 `5 i$ E, r
- static volatile int irqraised1 = 0;" J* u7 o7 N( O6 }* A `
- static volatile int irqraised2 = 0;& T; V3 s3 @6 N4 M+ n
- ' F, [) E9 |- [/ a. c6 s- n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 y% M% I3 ~: F" Y8 G/ E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 b: v1 I4 |' k& H& m- Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ f2 ]/ y" `: r8 |( n - ! A; n" j: U% s$ C
- dma_addr_t dmaphyssrc1 = 0;* B2 B0 Z( n& w5 }. o7 y) {4 @
- dma_addr_t dmaphyssrc2 = 0;
0 h- {/ A7 G9 j2 N" g a' y - dma_addr_t dmaphysdest1 = 0;' v3 D+ B/ }. D
- dma_addr_t dmaphysdest2 = 0;% W! X2 z: f; h+ t
- - @3 [5 w: C$ h9 a, o
- char *dmabufsrc1 = NULL;
) F6 \/ [1 B; H& f - char *dmabufsrc2 = NULL;
5 B1 i# B$ z, K* H - char *dmabufdest1 = NULL;1 d% ~1 C2 C) R' ^9 N' o
- char *dmabufdest2 = NULL;. `; H# e) `6 ^/ r; l, g
- ; C* M# R2 D9 c* a- C0 z
- static int acnt = 512;
' T& Q2 _1 y0 q. G% a - static int bcnt = 8;
6 d7 @+ j3 ?) q: r6 i" _- n - static int ccnt = 8;
9 x- N- k4 k8 |8 k; _' x& y$ m8 y3 @ - - m+ ]0 g4 ?8 c7 W- U6 s: y' j3 i/ F
- module_param(acnt, int, S_IRUGO);
6 l% y- F# ]3 Y( ^$ M. {' ~ - module_param(bcnt, int, S_IRUGO);
" G! i4 o5 ^ U. q - module_param(ccnt, int, S_IRUGO);
复制代码 ; B4 i j x- H) I2 E2 Z9 `
: X4 y, b+ Q7 m, f; w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 G9 ?; }9 q% a. i, y' k- z: r2 _
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- j- Q' a; I( a1 I+ i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" }9 w3 n3 f1 H- Q2 L% O) r% \/ ?5 P3 l4 i$ K
5 {# s; C5 e) A, p6 t+ o# U8 x) r
|
|