|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " s% L% w5 Z; [8 V5 S' |- Y
- [code]EDMA sample test application
8 y2 ]9 _& W2 r, t% c1 M8 K - /*; @, L+ V* `: g
- * edma_test.c1 `7 f2 `4 d7 F- v& [
- *- b9 R+ d( d$ o9 X' G
- * brief EDMA3 Test Application- T, J) D, [' D6 O1 ~2 U
- *" t$ Z" `% i! [; v9 L3 P! v F+ C' E
- * This file contains EDMA3 Test code.) c o4 M5 m$ D' x
- *) z& j- [2 {: n) C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ D5 q/ P/ S$ T; w/ \: |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* Y3 p! W) V& Z* I3 i - * TO CHANGE.4 j1 j8 H8 N& F! I6 X) @
- *5 W' |+ u1 e3 E6 A# z, J% l( @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* n8 q' r/ s5 w2 W2 } - *
. k. f; H4 z/ u/ | - * This program is free software; you can redistribute it and/or5 ~- g" }) F6 _
- * modify it under the terms of the GNU General Public License as
5 W4 a: b( F1 G2 a; ]+ y8 I3 ^6 j - * published by the Free Software Foundation version 2.
5 t8 t8 B5 `' K - *4 \5 z6 t$ Y/ S% |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 P0 S/ f! s. E0 o `; ~$ Y1 g( M! K - * kind, whether express or implied; without even the implied warranty
" s+ K2 m/ C6 a8 U4 Y3 ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 K3 [( D" L# H5 t; t! W
- * GNU General Public License for more details.+ w6 c& } \8 N
- */
/ [7 v7 }: j- R - # ^1 a. K' L0 d$ P' G. ~3 x+ c
- #include <linux/module.h>
' ]9 h) e# O( O' |& Y C; h - #include <linux/init.h>& V! M4 Q, f! m% D3 U9 \1 S$ E/ b
- #include <linux/errno.h>
' w( G& d9 h" d- v$ r" G# G - #include <linux/types.h>/ N' G f1 X0 I
- #include <linux/interrupt.h>
) i) O- F, E9 j3 E' | - #include <asm/io.h>1 V; P9 ]$ Y5 k0 h0 v( H; ]
- #include <linux/moduleparam.h>
0 |2 f4 ~" k4 {9 ^ - #include <linux/sysctl.h>
# o4 p9 j3 Q& U+ D% `, ^5 | - #include <linux/mm.h>
: A' S0 r# f( c# t3 i$ y3 E - #include <linux/dma-mapping.h>
1 p. n% `3 P! j - 1 u. z& }6 e8 v/ y
- #include <mach/memory.h>
, Q$ |3 z9 A _. I; a% c9 M - #include <mach/hardware.h>
8 l- n5 a! c) a$ R& e8 k! ~ - #include <mach/irqs.h># a* }0 N( ^, |% `; H
- #include <asm/hardware/edma.h>
+ d8 Z! S) ~: k% R2 h5 h# S
7 o" J+ P/ A8 I( X" r# z9 z- #undef EDMA3_DEBUG
: H$ Z( c9 y; f/ u* W* V; u - /*#define EDMA3_DEBUG*/6 k- j: o5 v% [+ t; R% N
' w( F2 B4 U! i7 B9 k8 A4 q( B- #ifdef EDMA3_DEBUG
' R. |) f G* L9 {) h- \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 T; p6 i9 l' s1 s% C* n" x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 H/ Q" u/ m- c8 U" T/ F' } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: ~8 Z: b: E2 D" V8 C& { - #else5 R* f9 a* n: V: C: W" e. f' b: s
- #define DMA_PRINTK( x... )* g6 i* ?9 Q" x' @9 ?# o
- #define DMA_FN_IN' y0 C! s, f' E0 G9 y0 [
- #define DMA_FN_OUT
+ N9 f( U5 B, ?& j; j - #endif
9 m9 ^% r1 o7 ~) _
7 l* p) M& K$ w0 z* b6 p o5 U: z6 e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) ?% w; K: S2 _# b: V - #define STATIC_SHIFT 3
0 ]- j* a0 B0 S/ `! \0 v. d - #define TCINTEN_SHIFT 20
9 t+ ^0 y* v2 A ?4 O5 L - #define ITCINTEN_SHIFT 21
. G7 a% S O) m - #define TCCHEN_SHIFT 22
! S* s2 m/ b H - #define ITCCHEN_SHIFT 23& {2 Y" A- i7 m7 h
) P3 F( _1 @( i x# K2 S- static volatile int irqraised1 = 0;% m! y4 O) [/ h; ?4 O
- static volatile int irqraised2 = 0;% p$ h5 A* A. p# L" \+ i
. d; ^. W7 H) e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( a! `; [/ l, M* T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, D8 \! u9 |9 [% c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ S4 x8 F( x$ a0 Q9 ^ - % G! c# S7 _0 o6 O5 w. x
- dma_addr_t dmaphyssrc1 = 0;& Q' Z t" a2 {. a+ l# a
- dma_addr_t dmaphyssrc2 = 0;' n5 c3 b4 y0 G- |' S
- dma_addr_t dmaphysdest1 = 0;
2 h& H8 [# t3 i# t - dma_addr_t dmaphysdest2 = 0;
3 e% U1 J, o5 O1 [1 q( v0 O - 3 K- `1 P# X: h8 b( W7 e5 P9 I$ p
- char *dmabufsrc1 = NULL;
1 ^3 m8 t7 J2 X5 H9 B! t - char *dmabufsrc2 = NULL;
3 n* L- L' G f$ ]2 c - char *dmabufdest1 = NULL;
- _# a9 H' J5 m& F& o E0 \ - char *dmabufdest2 = NULL;
+ ~3 j; o( x6 O1 I
$ u0 g; o X+ Q- f- static int acnt = 512;7 t1 @8 {6 d+ w9 k% B
- static int bcnt = 8; w1 B( f6 ~; Y! o# C. w
- static int ccnt = 8;
$ l. B; W E% w( [
- i8 J# X8 ~, G& H" Z$ v- module_param(acnt, int, S_IRUGO);
* a8 j% i& [) V5 L - module_param(bcnt, int, S_IRUGO);
. i) V4 a* N- G9 q2 y. P' ? - module_param(ccnt, int, S_IRUGO);
复制代码 0 E% t9 R3 B8 I" }/ {+ G: [. h
) u/ P6 s/ Y" F) V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ B- ~9 }+ K0 s0 s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 G2 F; w! z. Z" u* O& t' q" ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 Y& ~2 W; m2 l9 Q. H/ ~
$ `% Y. R" {( c
* o, `. C9 v! H4 P- _' E5 n, [! {
|
|