|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* S- Y! J6 x9 M/ y2 h# V- [code]EDMA sample test application/ I: |* [+ ]0 g+ t4 B. f
- /*# w: g, J; \7 {
- * edma_test.c
$ r( n# O: k7 Y1 \% F - *
/ c6 d4 x8 C, P - * brief EDMA3 Test Application
7 A# W# {0 P- F" ?, h - * W+ O% \7 u6 V5 v! b5 t" ^
- * This file contains EDMA3 Test code.+ i. U5 f6 Q6 R2 e' i; X6 q6 `& c
- *0 Q( Q y7 E+ Z! s% `3 B' E. c6 u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 ?) b X4 p3 W" m- g8 `5 W2 j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT b) ~* `. e6 `! D, a( |
- * TO CHANGE.
. p( L) N7 W- w3 L( A/ z4 c - *
1 ? k3 d m4 H, q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 d4 Z# H/ k4 h) O$ L" R+ e
- *
- l/ M) F+ M! a4 b& D# W ~+ Q - * This program is free software; you can redistribute it and/or0 ~! Y9 F. M; V' V- r; w5 K9 [; r
- * modify it under the terms of the GNU General Public License as& b2 j5 V0 X( {4 C
- * published by the Free Software Foundation version 2.) q+ k) E( R/ `2 M8 q9 l, \
- *
6 H1 y# X* X3 q2 g6 p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# s! D2 L3 X+ d! Y9 K - * kind, whether express or implied; without even the implied warranty
! q [! i& L" h. a) a" ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: }+ \2 P; v6 G. {" O X7 Q - * GNU General Public License for more details.9 M, k: v n5 D' Q& p
- */, K4 p3 t/ K0 `0 \
- - c6 E% j3 J' G Z8 ~" j P' T
- #include <linux/module.h>
9 v$ |4 `# _$ }1 L - #include <linux/init.h>
& h1 ]! y5 J/ o% Q8 R* d% J7 k - #include <linux/errno.h># _# U/ f6 t. q( a
- #include <linux/types.h>
. t5 o" q. O4 D+ H - #include <linux/interrupt.h>
1 i5 H+ a. N+ ? r$ W: `/ S - #include <asm/io.h>
0 _, H. K r8 W$ {# E _ u' Q - #include <linux/moduleparam.h>$ B. G4 [; m) X" {; w
- #include <linux/sysctl.h>9 o/ t! a3 c, n4 k
- #include <linux/mm.h>
3 d1 U9 D3 `, S( w n# s! g G$ e - #include <linux/dma-mapping.h>
# h0 s, e. j$ w/ O8 @ r$ C
& ?2 Q* r# E: [# h9 z- #include <mach/memory.h>/ @' J8 {; ]4 g/ r- X
- #include <mach/hardware.h>* ?) N* k# v9 ]8 B3 \- {+ n
- #include <mach/irqs.h>
) }0 G% p/ N& [* U0 r7 Y6 O6 n - #include <asm/hardware/edma.h>2 [- y8 b9 n. p# j& i" J% s
' ?+ m2 ?% U2 s! g6 [- #undef EDMA3_DEBUG* w% H$ |, Y8 v) a7 e. Z4 n
- /*#define EDMA3_DEBUG*/
( R' x/ ~% N( b/ @1 P/ L& [ - - Z) T$ v4 t! m
- #ifdef EDMA3_DEBUG
* y8 G6 t8 K3 H. n( _5 o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& W0 w: V& ]- U* J& f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" D# v# |' c2 I! N! v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ E0 D. J. m% ^( }
- #else
' n' I$ `+ D- ]6 i& ?( C - #define DMA_PRINTK( x... )% ]6 B+ k8 T- ?/ @+ T8 Q! Q- j
- #define DMA_FN_IN
- E# Q* O8 e) y6 x9 J6 [3 t - #define DMA_FN_OUT
' M2 d% _" W% L, I - #endif
3 s7 Q6 f5 U+ w$ T# t' E% N - ( W# ^& j6 K- W6 G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* g3 G7 F- ~: D; d# v! Y) U - #define STATIC_SHIFT 3
9 u) r* l" x3 d2 x9 |; l+ k \ - #define TCINTEN_SHIFT 20- T# j0 ?" ^2 s: h. U
- #define ITCINTEN_SHIFT 21
5 f" _ N0 Y& r7 [4 O1 A - #define TCCHEN_SHIFT 22
: v3 T4 I% i" t C1 I' O( S - #define ITCCHEN_SHIFT 23. f) | j; v8 P! X$ ~$ Y8 H; j
- 7 P* }2 B( ?* G2 O
- static volatile int irqraised1 = 0;2 L$ k& m6 [' ?7 U D$ V6 b
- static volatile int irqraised2 = 0;4 F6 S" O9 U% W9 n$ a4 A
- 8 z$ S" K/ { Y3 L/ t; a. e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 o- Q( R9 k7 W: x o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; n% W! i# p. z% O6 g8 b+ [ e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
b4 q$ @9 ?! D8 I8 S - * A# j9 [' c B( M
- dma_addr_t dmaphyssrc1 = 0;
5 _' _. I! z# A K - dma_addr_t dmaphyssrc2 = 0;" n! r0 P. N8 o% b+ D& _3 N
- dma_addr_t dmaphysdest1 = 0;
& }$ |2 {, n! t( L( P - dma_addr_t dmaphysdest2 = 0; m2 x9 c8 X4 {/ T- {/ t
7 g/ {4 N2 N2 s7 R- char *dmabufsrc1 = NULL;2 K! j. a5 m' d) u, _" L, Q: U' v& ?
- char *dmabufsrc2 = NULL;" i0 W- D8 C% Q: v" ~$ R t
- char *dmabufdest1 = NULL;
# x( V, F5 b2 B( x - char *dmabufdest2 = NULL;
1 f% g: Q0 F1 g0 H - # W t7 c, N4 n, P- e6 q
- static int acnt = 512;5 f4 B% W9 Y8 v
- static int bcnt = 8;3 p6 b. ^" w L$ @( |) `. L3 q
- static int ccnt = 8;1 m" V) n, c! R, A3 f W
- 8 l1 J0 d) i) h6 b' R8 w( s+ L
- module_param(acnt, int, S_IRUGO);
$ ~0 L# L$ Q" Q$ U& w - module_param(bcnt, int, S_IRUGO);" z k# j6 Q3 Z/ J5 A' o9 I
- module_param(ccnt, int, S_IRUGO);
复制代码
( h' r: r4 @" |( S. f# \, {0 h1 M+ F3 {" s+ v5 l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: D) j, U" u1 Y3 X+ ]" karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) o2 m7 |) p5 m- N9 p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" F3 J# Q, @, q j7 A5 E8 {* t+ U/ m) y' M( O' k4 f
! V, Q0 x: e, Q5 Q7 C+ @) H
|
|