|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* o3 B) s* T& L P8 k- [code]EDMA sample test application
& @6 S5 \" r+ s7 Y - /*2 j+ D. |8 L0 |0 \1 o4 X3 R- ^
- * edma_test.c
+ y: F9 g" y9 }$ ?- p4 O- ? - *
3 D' B8 d Q3 c$ s ~0 E - * brief EDMA3 Test Application
( f+ w$ | x; E: f2 w - *
' ?; }: p/ r1 r. B" J - * This file contains EDMA3 Test code.6 a2 C% A3 q: g. a( ^
- *% T! R, Q" Z% ^2 [+ D: j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 U. _6 u `* w5 g1 E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ o$ E! d6 t! j9 {! m/ Q - * TO CHANGE.3 r g. \$ A: V1 G" F
- *
, J/ x; M; P6 T& E/ \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; \4 B& {4 ?) x) V
- *; b B$ z* F1 u9 P% K
- * This program is free software; you can redistribute it and/or
! V/ O# d% c* u/ b N9 n - * modify it under the terms of the GNU General Public License as2 r* d3 i& P* t p" W8 L& t
- * published by the Free Software Foundation version 2.1 A0 R9 X9 `. ?1 h- G$ o2 {8 N1 }
- *" u( p+ V% q; ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- {# ` o* I5 E2 Q - * kind, whether express or implied; without even the implied warranty
$ ]( X" C+ {/ Y! v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: e/ W3 H, Z- z+ q9 w9 X2 y7 Y
- * GNU General Public License for more details.
6 a+ ~; I1 V/ `7 [& H - */; P/ S* j( U* U% _# U0 r. e: H6 W5 o
$ C K1 K, t9 b- G! I1 O- #include <linux/module.h>
# t2 A6 J* M: c% E; {3 f8 \ - #include <linux/init.h>
0 _. ^3 Y- ?- y2 k1 {* Y - #include <linux/errno.h>4 }$ I0 v& X) x3 e
- #include <linux/types.h>
- Q7 W: H, V" j7 U3 G1 ?2 i8 D - #include <linux/interrupt.h>
+ ~( B G3 z' O. C! w. d - #include <asm/io.h>- P+ L0 B$ F5 Y3 K0 u
- #include <linux/moduleparam.h>1 o6 u; w. c, R) B. }: ?1 x+ j
- #include <linux/sysctl.h>. r9 R; n# i7 \
- #include <linux/mm.h>' w. j4 g$ y8 A
- #include <linux/dma-mapping.h>$ l! z; Y( F! t/ `
( {; t3 f' w8 z" B _8 ~2 g, }- #include <mach/memory.h>2 E8 K+ s+ w/ y0 i3 {: ?# [4 ^
- #include <mach/hardware.h>5 ^1 F. \! t j3 x& }! j( o
- #include <mach/irqs.h>) e% c8 Q1 B. p4 N7 {! Y
- #include <asm/hardware/edma.h>
. ~+ A! y N2 p8 k( J - 7 G: ~7 e b8 {# X W3 F `5 a& n, ^
- #undef EDMA3_DEBUG! c2 z; | M/ L
- /*#define EDMA3_DEBUG*/
! A- \- v8 ~, R% e/ g
4 D0 y& ]/ U& a+ h- #ifdef EDMA3_DEBUG5 x+ W/ @8 k5 x" |6 i8 \$ I0 I2 r7 F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 @7 V& n/ R4 \4 C! h4 h/ ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; Q4 w3 `8 U m2 ]1 [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 m8 s8 e+ s+ N4 i
- #else) X1 g8 u% U/ O4 ], i3 a5 r; a
- #define DMA_PRINTK( x... ): x5 h/ }6 ?3 _
- #define DMA_FN_IN
! p# X* o% _, i - #define DMA_FN_OUT' b8 F/ q$ R- n- i7 w
- #endif
g" ~9 f. [- q" p% F; \
' K$ A, g) P( K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 M, }* P& Q5 J- C6 y
- #define STATIC_SHIFT 3
* i! Z: X" A# [7 A, f - #define TCINTEN_SHIFT 207 K- v% R5 z1 p) h6 A
- #define ITCINTEN_SHIFT 21
$ f& e( H# A0 g3 N$ y' u; T - #define TCCHEN_SHIFT 22/ o3 l# i: m) _/ V/ k
- #define ITCCHEN_SHIFT 23
6 y: o/ ?. I/ M: G: Q9 F9 |
9 } L f; L$ {- static volatile int irqraised1 = 0;# j, a, g" T! V
- static volatile int irqraised2 = 0;) k; L" Z7 \3 S6 g! S, n
- * s4 [9 G1 Z' X* M1 y8 D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 t* c# R p- w6 R3 K& p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 {% q* ?# @9 b! K7 G- a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ Q! e& y& ^6 S" x
9 q, t* J7 r) d3 ^9 Y' E/ x6 B- dma_addr_t dmaphyssrc1 = 0;! V- U# U( L) X! R' C
- dma_addr_t dmaphyssrc2 = 0;* L5 \" o6 N, z
- dma_addr_t dmaphysdest1 = 0;, K' _5 X* a( ?+ u% b3 c3 q
- dma_addr_t dmaphysdest2 = 0;' a/ } E# m. [9 ^0 w0 I
- $ |9 d# P& m5 f) S+ O ~( A
- char *dmabufsrc1 = NULL;- K) p9 y |5 W4 Y# i
- char *dmabufsrc2 = NULL;
0 J+ e) W) ~- E8 H; t" n4 c- e - char *dmabufdest1 = NULL;
; R ~" ]1 e' S8 y) X/ q4 ?' K - char *dmabufdest2 = NULL;
; i. z3 L J0 r+ O4 G. i - ) L- B# h8 @( S$ _$ D
- static int acnt = 512;3 r; d5 o) Y* _/ b" T7 F
- static int bcnt = 8;& G5 h0 I* P2 t% R4 a
- static int ccnt = 8; n; h; r* ^2 k
; `% f- w9 |; a6 I+ e9 g; f- module_param(acnt, int, S_IRUGO);: i$ M% C; [2 D3 s, q: S
- module_param(bcnt, int, S_IRUGO);
6 o1 g- T! I0 j( r; H - module_param(ccnt, int, S_IRUGO);
复制代码 ) T2 l } `% v2 w5 l
3 j% ~3 @; U$ i5 T. V- P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 `' V1 V8 ]/ ^; \8 n+ b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) Q/ R0 u, l( i! S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( U9 ~- G( k" R* I, K" K1 D5 F
+ ~" E- P2 c5 Q7 {3 n
+ I( }" p! X1 v |
|