|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 z+ w: r4 Q: o' s+ b2 w; X- [code]EDMA sample test application
2 j5 C7 i7 j9 B3 M - /*7 Z6 ~# d- V0 M* j3 E/ y7 ?% u
- * edma_test.c3 @9 P& W M3 _8 k
- *) L9 {4 S: M; c o; f( {3 \
- * brief EDMA3 Test Application
6 G9 j' w# O3 m! n2 V W6 U8 i - *$ ~: _$ G8 L' k( T
- * This file contains EDMA3 Test code./ ^; s# I' y- B# }2 g( q
- *0 k% u y& m) v# s- D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 |; r/ s u4 {. n3 O7 J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* q; H3 `/ c+ J$ Q9 @- `( J- A) b - * TO CHANGE./ g7 z% C4 a8 E( i' {. Q
- *
. ]( t2 j1 O' A3 T B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 B/ ^3 O- P/ I1 Q+ k. S - *' H* m. \( `+ s7 O: W; a
- * This program is free software; you can redistribute it and/or8 B7 q5 c1 w" j! T/ c
- * modify it under the terms of the GNU General Public License as8 \( a" R1 n6 l! \5 s
- * published by the Free Software Foundation version 2.
& L4 |( W/ A5 ^ - *
5 v C; B# e0 B- y9 m# w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 V$ w* ^3 L( i7 L2 d( d
- * kind, whether express or implied; without even the implied warranty
: D9 Y0 F' B4 Q! h( S; B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* ^* P0 K' r& r2 q3 C: G+ A
- * GNU General Public License for more details./ p' ?# p" a; X; R# ?& \' J8 t
- */6 M2 E- Y; n! Z8 z' Z D1 w+ P* \
, n [. R( Y: S7 S) O- #include <linux/module.h># B( o W) Y" E2 p6 h, Q" ~, M
- #include <linux/init.h>! `4 Q0 E4 q4 `% J4 T
- #include <linux/errno.h>7 i n B+ k0 @$ j: N( ]0 G- t
- #include <linux/types.h>
: f* H( J+ Z8 J, P5 Z t9 m - #include <linux/interrupt.h>
% k& i! b& _ y; N/ s! j - #include <asm/io.h>/ y: k. [* M( a( t/ L1 E
- #include <linux/moduleparam.h>' s4 S! l4 O5 }& _; P/ [
- #include <linux/sysctl.h>. r x1 V' g& G7 x4 I, @: a
- #include <linux/mm.h>& s+ ^- n8 ]0 ~1 |2 d' q
- #include <linux/dma-mapping.h>
8 F! W; n# v) E: _6 _/ ? - % b: o0 ?* O- r2 v: D
- #include <mach/memory.h>
& n/ [2 I/ p+ \& g# h0 X - #include <mach/hardware.h>
' F7 [5 |. @, Z - #include <mach/irqs.h>
7 c% }/ @/ g; X7 ?2 ~: ^ p - #include <asm/hardware/edma.h>
; d( U& J" i! H% [
* i! j* h* Q6 w: X3 ?& E: Y- #undef EDMA3_DEBUG" C/ s- E) e4 g, W/ w
- /*#define EDMA3_DEBUG*/0 ?, M( H+ m# Y8 c. ~6 @
- 9 A U: Y1 j5 n0 ?8 D7 {- \5 f w
- #ifdef EDMA3_DEBUG. X, Z0 Y5 B: v, ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% q% S# h6 ~4 R4 U. y# y/ U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ B2 A y K- c+ _/ c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 L& G4 m* ~& ^8 A8 X9 H. t - #else
! i6 A. A( P5 V9 [) d - #define DMA_PRINTK( x... )5 h% H7 B, G* x
- #define DMA_FN_IN, X' S" q* D$ c" D$ K- [8 r
- #define DMA_FN_OUT
" t/ H5 b2 x" @6 e - #endif
) _' h' A& ]1 W9 d - 0 g8 f S: e7 H6 V/ b5 w6 p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# t3 _$ k7 }$ u5 z$ H! [
- #define STATIC_SHIFT 3
Z( P, O/ {; q! I - #define TCINTEN_SHIFT 204 E7 b, u6 _ i; P( F+ n6 d9 E
- #define ITCINTEN_SHIFT 217 ~( O1 H* w7 N0 x
- #define TCCHEN_SHIFT 22
; X9 ]: R$ e# B+ x4 U L - #define ITCCHEN_SHIFT 23
) R8 A- h1 c8 M( \; t1 H+ } - * \2 Z, a' M) R# z) U7 K
- static volatile int irqraised1 = 0;% g5 T9 X% L; U4 z
- static volatile int irqraised2 = 0;
2 p7 i) H1 B5 I - 5 P1 K9 r; l* m0 o {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ L' K9 ] f3 E4 C: z; ^7 A1 j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& Y' ~- b, e+ W) Q7 y% G! @9 c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 U, u" m' H4 |6 Q) j - % Z0 H6 \- m+ j6 V4 f
- dma_addr_t dmaphyssrc1 = 0;$ [' V1 Y) j9 g
- dma_addr_t dmaphyssrc2 = 0;
& ~ J4 h! K1 }) t- r. c7 b - dma_addr_t dmaphysdest1 = 0;
; v; P+ \1 |4 y& U# U - dma_addr_t dmaphysdest2 = 0;
2 e Z/ w, s8 O: K - # [" R# K5 P0 I1 o
- char *dmabufsrc1 = NULL;, Y1 ^9 s2 a% _ y8 H) {; e
- char *dmabufsrc2 = NULL;: W) H$ _6 P- V$ M
- char *dmabufdest1 = NULL;& P( X. O' ~; p" m( Y' U
- char *dmabufdest2 = NULL;
3 W- D& L- I, g0 f! f - 6 o7 J `0 p% u; ~1 j
- static int acnt = 512;/ x% e$ p- `. B* _* O0 ^2 v. S" x7 j
- static int bcnt = 8;
. j3 @; g2 S n- I. h( e3 {5 e - static int ccnt = 8;
5 \& ]1 Q T$ w( \1 b
2 R& h& s# @5 K, ^8 ~% W5 |$ E- module_param(acnt, int, S_IRUGO);' }3 @2 ~. V( P& u8 P
- module_param(bcnt, int, S_IRUGO);
2 J- q3 B5 ]0 o7 m - module_param(ccnt, int, S_IRUGO);
复制代码
# T' ], G, c- E$ ^" f0 a+ ^- [, G" O9 @4 P$ ]* x; R1 L7 P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 ~; u( W% q3 X* j0 }# karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& T' R @8 V! a* k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 C6 S, P3 n4 ]% N2 [* H0 x
. j8 S2 C5 F& `( a" j1 x6 t) d2 b! L
) K+ h% h. G7 P
|
|