|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 y1 u7 y& r" F( _9 ~5 _
- [code]EDMA sample test application
) ] f, c. K, A - /*
- h+ z7 i( i5 V7 ^ - * edma_test.c
( E6 w! Z2 D1 _' e - *! q9 P& Q% q7 E$ ]- G2 }! u4 w
- * brief EDMA3 Test Application
* _3 @. d0 _+ [1 G: e - *9 p1 S9 N m* ?! }8 p
- * This file contains EDMA3 Test code.
: ~! \" b! D v! ` - *
4 b4 Y: |& k6 ` N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# S; n6 ^' ~# o, C! o" D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT p- W, o# T, f9 b1 `' ~
- * TO CHANGE.
+ G* f6 U) ?9 B8 h4 h - *
' s' Y6 U3 e' p3 E+ {( D7 l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 K# ^* f5 F0 ~& H( O - *9 i+ j' b8 @) F$ S# _) z( E; s. o0 D
- * This program is free software; you can redistribute it and/or1 @) q' b/ X' Z0 n8 Z. q, F
- * modify it under the terms of the GNU General Public License as
% ^# ^- y7 b' D* X9 K) i& |4 [* ]/ l - * published by the Free Software Foundation version 2./ }- A2 A9 x3 t" d' h. a8 m
- *
0 ^2 q0 X8 z' A1 B& h6 ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: _( s9 O3 e; A7 j - * kind, whether express or implied; without even the implied warranty" N% @7 Y$ R5 C+ I T% B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 t. t! T/ Z) X! | - * GNU General Public License for more details.
4 V7 O8 \5 y1 H6 m - */
( `( L. z, J" G/ }. n - 3 n8 I, }; ~9 `% S/ ~& k
- #include <linux/module.h>; X' U. A5 b2 \) [
- #include <linux/init.h>+ O4 e+ A+ c, k! u0 }. u+ P
- #include <linux/errno.h>
' Z8 O5 C9 N. z - #include <linux/types.h>
0 k" @5 O2 X9 ?8 `1 q1 z - #include <linux/interrupt.h>
, X8 x- t; S: B1 y7 ]$ r& N - #include <asm/io.h>
* a) H) e0 v- B - #include <linux/moduleparam.h>
0 X, C5 ~. N9 A$ y - #include <linux/sysctl.h>8 I3 E0 h3 z# V
- #include <linux/mm.h>
/ z9 A9 }8 a; [/ j* x1 j: U# h - #include <linux/dma-mapping.h>- \' U* N+ r0 Z7 d$ {- r
- # `9 q8 k7 x5 C' g6 S7 Q) x# r
- #include <mach/memory.h>2 p1 z7 k% |' K( b
- #include <mach/hardware.h>/ V8 }, ]( z( P; Y. I
- #include <mach/irqs.h>- d4 Q* P% H' S
- #include <asm/hardware/edma.h>
: {! l& R$ D8 H1 \# D& L
6 E" f5 `0 v/ y/ [- #undef EDMA3_DEBUG9 M1 G5 n8 G! `2 w& f& F, ]
- /*#define EDMA3_DEBUG*/% P: K& F' d+ E8 E
- ; {; q- p7 l* X" x4 H% H+ k
- #ifdef EDMA3_DEBUG$ A2 J# ~6 K2 {; v' `7 ^" {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: w& Z/ y/ D, ]8 X+ U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 ~3 P1 O; ^* H; l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), c6 C) |. R+ T" P7 |& b
- #else( k9 d& h4 c3 G0 _. y9 I" R) @
- #define DMA_PRINTK( x... )4 n# d' w# U3 U
- #define DMA_FN_IN- R* k: b: @0 b" V: c9 w
- #define DMA_FN_OUT
* ]$ C/ D; C4 y" Z - #endif7 _9 o5 ]) y* X/ g3 g" U8 a* b
- ' w/ v, M; L y' Q% P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- @! G8 k7 k, W7 _ a) x8 g+ E+ t
- #define STATIC_SHIFT 3
% d" ?- ?$ L ^! `4 j& j6 [8 v9 t - #define TCINTEN_SHIFT 20# C6 a1 x+ [, I4 k; m9 K$ z8 R* q2 p4 d
- #define ITCINTEN_SHIFT 21; j) s9 D0 V: n* I, H
- #define TCCHEN_SHIFT 227 ^; j. q! O( ^- l& W( ~ U
- #define ITCCHEN_SHIFT 23
# W; ]) i1 b. o
5 k \* u$ v' `. g% r& j- static volatile int irqraised1 = 0;# w$ h I; _* Y* E' ]
- static volatile int irqraised2 = 0;
* {3 J; Q+ A ^" n
: i- o0 r2 R$ T- ]9 ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) p, n8 m, W9 g' B8 C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" k# o; A! D+ x8 l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# W5 P1 D8 r/ m0 |( V/ [
3 G! X7 B9 O+ W; d# h5 M2 |% w2 C5 J! o- dma_addr_t dmaphyssrc1 = 0;
5 g9 a1 {/ f; M P7 _ - dma_addr_t dmaphyssrc2 = 0;& b" d+ a9 e, b4 x/ b" Q, V
- dma_addr_t dmaphysdest1 = 0;! k9 i* W$ N# K) Y" E
- dma_addr_t dmaphysdest2 = 0;
. N5 s' l# X0 r. q |2 f - ( S4 [8 J2 s6 v4 W7 b) j$ W
- char *dmabufsrc1 = NULL;" [1 L( m; ?& ]) G
- char *dmabufsrc2 = NULL;; d$ d" J* D- S- @6 E9 w K) M
- char *dmabufdest1 = NULL;! w9 {7 N$ e' c: ~
- char *dmabufdest2 = NULL;
2 r$ B+ `" x/ @, }8 {( q
( b1 ]$ K- y- }- static int acnt = 512;
i6 D2 C& [! D+ @ - static int bcnt = 8;1 c( a7 t: z0 K8 p! C; }$ k
- static int ccnt = 8;
. `' } H# j5 j0 z8 X" r6 W8 t
% `" }: ]/ P) J) G9 S- Z" M( S- module_param(acnt, int, S_IRUGO);
0 V$ p P( B% B - module_param(bcnt, int, S_IRUGO);4 F+ G4 F, F! ^4 D6 b5 r3 _
- module_param(ccnt, int, S_IRUGO);
复制代码 ( {$ x2 @; E8 z7 T: `, W' _2 z; i
( c# C, y& {4 M H) @; s& `3 k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 J/ ^; ^$ v- z, X A# _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 `" c+ s, s5 [! ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 z' z; _0 j H( v) X
% ]! \( H- i2 m
; x r9 P2 _ t0 d/ }7 l
|
|