|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 H9 s8 W/ l; }. t% Y
- [code]EDMA sample test application: ?3 k* s2 s; {5 G; n
- /*
1 K R" n! O/ p: K( X - * edma_test.c+ H. ?' h! J1 N, ?' Z
- *: ]) s5 n& Y3 V
- * brief EDMA3 Test Application* W" j. S$ ^6 S8 J
- *- {" F" r6 w5 K- b, m4 M6 q
- * This file contains EDMA3 Test code.
& ?; G& [! ~7 Y4 O" O$ ` - *# z0 s; J3 r1 w% @7 g: f' J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, @$ B; I% f1 x; ?& q% j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ F' ^. C" C2 z( l R - * TO CHANGE.0 x2 z' T) r5 R, A
- *
* f* t9 k% M+ f& r6 R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 J) S- j; x5 Y' A
- *
) b$ |! K7 Z j0 Q6 |! g - * This program is free software; you can redistribute it and/or- r2 ^% \+ L, p+ c1 E
- * modify it under the terms of the GNU General Public License as! n& X' u6 m, m' R0 w- V
- * published by the Free Software Foundation version 2.0 G5 y9 H$ {/ M7 h& W9 N
- * B% _% `: e/ i1 X4 N I, x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, a; j+ n5 M% S - * kind, whether express or implied; without even the implied warranty
, K6 o( q% G) r! N9 Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 t- v3 x8 M0 y! a U/ V: I: q - * GNU General Public License for more details.2 T4 Q2 v+ F# x/ N$ R0 G& W
- */
+ ?/ }8 m) }6 A }) o& a" A - # F: I. r" p* b) E3 p' o$ F2 | E) n
- #include <linux/module.h>& S% _: ~2 h1 k
- #include <linux/init.h>, b+ z) t1 E% J# A1 N9 [0 y( J+ Z. z- V
- #include <linux/errno.h>
; O! P- w8 N5 v: i - #include <linux/types.h>
* N* `9 B5 V# P2 l! A - #include <linux/interrupt.h>
7 Z1 F) c% l2 w% a, E1 j. P - #include <asm/io.h>9 w& E- s6 C1 L$ C$ i1 c
- #include <linux/moduleparam.h>
, A' m+ q" _0 K7 g7 f# a - #include <linux/sysctl.h>1 r8 Y2 T9 J C e
- #include <linux/mm.h>
; p& w5 `# Q: R4 k1 t - #include <linux/dma-mapping.h>4 J4 @) v& C5 d1 V j
- 1 J3 \* ^+ _* e! l6 h
- #include <mach/memory.h>
) f. t% d9 [2 Y. L4 m: c9 F3 P - #include <mach/hardware.h>
% x8 G! W- j% V - #include <mach/irqs.h>8 s: e$ T8 p- [' `
- #include <asm/hardware/edma.h>8 H/ H; W+ \- }" K) ~# `" }
- - o9 w( t. ?( G& R) x: ?+ t) h
- #undef EDMA3_DEBUG
) j# o8 K3 m! @' ]7 ~' ~ - /*#define EDMA3_DEBUG*/6 p* j! T" U; k, H/ r
# H6 F6 ^* x- l# I& ?7 O- #ifdef EDMA3_DEBUG* N6 }, I! Q4 H6 r7 w* F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 F: p d9 @$ n0 E3 p# ?% K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 z! H# j' V. M% y$ H h- } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" K1 J' e2 Q) a, B( v! G8 H - #else: ]0 d( C/ d) ~/ h" e
- #define DMA_PRINTK( x... )
c1 a" r- L B+ ^6 f - #define DMA_FN_IN2 X" c' _6 F* v( n4 x% k
- #define DMA_FN_OUT& p* Y% [4 J* t& d. J' S; ~
- #endif/ P& s5 X+ ?, F" r( Q! q/ H
- , O8 |& n1 S/ h4 d# u8 }$ c( s# `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), ] F! u- O" Z; j& e$ d
- #define STATIC_SHIFT 3
; t6 @& f: y0 T) C/ y) Q - #define TCINTEN_SHIFT 20, O/ Z0 G A9 w! {* F' q* f
- #define ITCINTEN_SHIFT 21! E1 j% e1 N5 ?7 Y+ j9 y" y: Y9 c
- #define TCCHEN_SHIFT 22
0 r* l: ]0 g2 N+ g# { - #define ITCCHEN_SHIFT 23
2 l$ |/ o5 g' \; [& p$ i/ l
2 N, }, L1 F: @' c3 V/ o- static volatile int irqraised1 = 0;
/ c6 P& F/ Y- ~; r - static volatile int irqraised2 = 0;
* o$ Y8 Q0 S: B9 H - & O- d: L, ?, p8 I4 O9 Z3 ?/ @7 T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" Z. a3 H$ q5 z0 L2 q' K7 @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 G3 \. l7 K' q# K Q( E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) `" V' p; Q) ^5 G, \3 T
4 J7 D$ O4 z8 S, Q: _ E0 P' u- dma_addr_t dmaphyssrc1 = 0;
4 M5 j" E2 V: B0 p* F$ ?9 A& K: s$ t- b - dma_addr_t dmaphyssrc2 = 0;
" W2 o h Q5 ^; Z. e3 P1 h# n - dma_addr_t dmaphysdest1 = 0;
& Q( e! `7 H( ~0 t5 G - dma_addr_t dmaphysdest2 = 0;
5 A% b% A( ^8 [ - % w& r Y, d( P, v
- char *dmabufsrc1 = NULL;
8 w6 v6 K) L/ U; s0 `6 ~- n - char *dmabufsrc2 = NULL;3 O- q: e# M# R$ H
- char *dmabufdest1 = NULL;
: G, k; c, ]; j' F - char *dmabufdest2 = NULL;6 i4 e: Z a6 e, d
- - J l* q: T1 d0 R6 o
- static int acnt = 512;
- { r1 E& w8 P7 k/ y - static int bcnt = 8;
) b3 @4 r( y* N1 M - static int ccnt = 8;
9 m5 D& g3 N, ` y+ H
" d- t+ S0 h# R/ C+ f, P- module_param(acnt, int, S_IRUGO);
3 s; c; ?3 \( S/ G: o. O& y9 z' k! j - module_param(bcnt, int, S_IRUGO);
+ V) n# \" F9 M% [ ~1 p$ R" o - module_param(ccnt, int, S_IRUGO);
复制代码
0 f+ U: p0 A _/ G T1 o2 f8 N* E' I3 [" |/ l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- g+ d" p1 W: G; @% A" R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! g4 s8 l# Q0 S6 R$ W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, s$ ? J# q% q. V" s! [: O3 \% y# q0 u. W; r: S- D n5 P4 s
: f% i3 t% r* P! _* M |
|