|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ x4 F* ^ ^$ O
- [code]EDMA sample test application; S9 F' f% g' [" W- ]
- /*) D) c: v' v# Y7 k% ~* D- B
- * edma_test.c B7 {. K) B( H
- *+ A6 P7 c5 Y1 s6 ~
- * brief EDMA3 Test Application6 K8 }- G( w' v t7 v$ G
- *
0 q& p e3 z: j - * This file contains EDMA3 Test code.2 n b2 t& h; i" }' S5 E) K; R3 G
- *
4 Y' p/ G9 y/ p+ { D; Q9 X/ w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 ]8 w- p4 w5 y, t& N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( V: N/ }/ B9 `) B3 @ - * TO CHANGE.
G; p; E! t7 J7 H/ R" M - *
# n/ w: k8 l# X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: @& |' n8 z$ R' w; H7 r - *
/ S4 M0 L( X! y8 }' L9 \5 k - * This program is free software; you can redistribute it and/or
2 O0 @* U& c1 c; g9 x - * modify it under the terms of the GNU General Public License as6 `! p' _6 Z" A3 J7 r! }1 o5 H
- * published by the Free Software Foundation version 2.
; s5 m) j0 g i5 u o - *1 Y1 X( C5 C$ k" K/ f( }( U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" P) Q1 A0 Z& {
- * kind, whether express or implied; without even the implied warranty
, o* k, i0 U K# A ]# a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 j+ d7 D; _, ]; ?7 ], H' v9 z
- * GNU General Public License for more details.! n( P0 ]6 l" g3 a
- */
& k, r2 g7 h! n% I; l% R! @* n, L - % K' a" M9 d! ^4 E8 @6 X z
- #include <linux/module.h>( c8 l S% q) o/ d4 G# n( d
- #include <linux/init.h>9 e: ?+ j6 P3 @5 q4 Z# K( j
- #include <linux/errno.h>
: F' E7 _% U& W( K. z) @ - #include <linux/types.h>
# B6 F: X7 f# b2 F! V - #include <linux/interrupt.h>
1 p+ h& n; T& m - #include <asm/io.h>! W+ V8 D( F3 q- h' W
- #include <linux/moduleparam.h>
% e! y2 B+ L$ }% s" `2 h8 | - #include <linux/sysctl.h>
; x3 R; |/ {4 j- C; E7 @ - #include <linux/mm.h>, ~2 I9 H* B( s. o; h# U! C
- #include <linux/dma-mapping.h>/ t* m, l) I N3 o, f# ^
- 0 }1 T5 |7 a* f3 H! p y; D) x
- #include <mach/memory.h>
6 c$ S/ T2 |. V0 J$ A - #include <mach/hardware.h>
9 q& J0 h$ f4 T/ @$ Z - #include <mach/irqs.h>
5 K. T6 s5 x! Z* t3 S) F; `( n - #include <asm/hardware/edma.h>: p# m$ A7 B, C/ |1 W
- # O/ _/ m8 h& T- q' K
- #undef EDMA3_DEBUG$ v8 x$ K$ s) w, V2 m2 H
- /*#define EDMA3_DEBUG*/3 M% M% k3 A$ M! c: M% O+ \# c
- 5 o3 n" H% d+ [. o6 g
- #ifdef EDMA3_DEBUG7 h- T, g6 _/ {; f
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& l9 B0 T4 E2 ~ }* C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ z% c7 u7 y# }6 w8 I1 B: o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& ^+ E- }1 v9 K" N6 s7 F- ]6 ^ - #else
" T: _5 I% B9 q - #define DMA_PRINTK( x... )
3 `' H9 h. W) v) r* M4 G/ d - #define DMA_FN_IN
" @# B2 O3 U& Z3 S& A/ p2 d- ?+ a - #define DMA_FN_OUT
& t) c& s( x* w; m# ?" _( [, s - #endif
1 Y$ N* F# `! Z- d
) ?3 G; M( c5 ^* w' x- C7 h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 O: a# e; A6 G
- #define STATIC_SHIFT 3" w# B% r% j& g$ |! ~
- #define TCINTEN_SHIFT 20
+ h% H% I8 u( B9 ?+ I/ P( B - #define ITCINTEN_SHIFT 21
0 h1 @- F" j, z) K: L7 n/ G4 T - #define TCCHEN_SHIFT 228 M0 _/ N" P) r8 o R
- #define ITCCHEN_SHIFT 23
* l, U, O1 A8 {
5 t! @0 q& z2 M6 z9 g* ^; H- static volatile int irqraised1 = 0;
2 W6 l/ B( K7 A; z7 m: f3 K: c - static volatile int irqraised2 = 0;) s+ x" M+ T+ r, D6 s2 V3 |% N6 q
- 8 O, @( ~6 J, ~' p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; L l# a$ `) N5 F3 V- C8 E- I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 S+ `6 a1 m r: M" i/ c2 Q6 W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' }" M& D+ T: y
8 f5 g/ b8 ^7 E1 q0 C; }- dma_addr_t dmaphyssrc1 = 0;
' P% K% H5 B& K7 W+ Q' p - dma_addr_t dmaphyssrc2 = 0;
: d+ s) I& V# i6 H5 O4 F - dma_addr_t dmaphysdest1 = 0;# L4 O5 Y( k- J5 r. C
- dma_addr_t dmaphysdest2 = 0;
+ c6 r2 N' ^+ B; H- u) a `3 E
! S6 C8 N+ z1 }( C" g- char *dmabufsrc1 = NULL;+ S6 s- A- Y$ y$ H6 a' s2 e
- char *dmabufsrc2 = NULL;' A: d* G7 Z( S Z% }) L9 b" | R) ^' L
- char *dmabufdest1 = NULL;+ P$ n8 d; G# A% y
- char *dmabufdest2 = NULL;
* u. C) D; n! J: a" B2 ]
0 _8 M$ Z8 ?% l& S7 u/ ]- static int acnt = 512;# A, Z, q; h7 c0 J3 w! v" u5 X. ?
- static int bcnt = 8;8 B+ |$ \" E8 r; q8 t( }
- static int ccnt = 8;
" o( O, q d( m5 ?8 X3 r8 c
' U3 R# ^- u) p- K4 E8 G' M- module_param(acnt, int, S_IRUGO);8 n- [5 L! S4 J- G7 f' C) H
- module_param(bcnt, int, S_IRUGO);$ n! T+ A& d* W, z8 b
- module_param(ccnt, int, S_IRUGO);
复制代码
N5 ~0 i. ?" I6 [, P0 G* [8 W- D
& W+ ~; ^# W( v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 z% G, V+ o" } q' Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' B- i- R1 m; p5 q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* p9 N' |5 X4 G& E, ~, y: g; d# S9 z; U
' q2 I/ j0 ^* A0 w; e
|
|