|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( X* r! d# q6 i. N" {& Y# a
- [code]EDMA sample test application" b% U" d5 w6 W# T. P
- /*
$ L2 R: @0 @0 y# h* h% _! b1 q - * edma_test.c; \3 {# `* q% @9 o! V1 f. ^
- *) S+ X) K; F3 S4 r5 o$ j' H# t
- * brief EDMA3 Test Application2 v9 S( c) \# f
- *7 M1 X) H' z7 W. U V; M* N" ~
- * This file contains EDMA3 Test code." Z8 M# e3 X5 J6 D8 g3 _
- *+ b( k* r* B/ l7 C) C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% w: h$ B ~9 h3 }6 q( d! X# W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 g I7 [3 p; \6 }: ^; W$ \- u5 L - * TO CHANGE.
4 u* c" ?* Q% e6 H) Y& [+ s% o6 d - *
! S4 [8 |2 e/ a+ O3 J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 J1 |% }4 k+ C* h' j5 g
- *
% T4 w- J. p! E# A - * This program is free software; you can redistribute it and/or
* u/ h5 s1 Z: N - * modify it under the terms of the GNU General Public License as
8 Q6 Y: c! e6 B+ o4 V3 x - * published by the Free Software Foundation version 2.# m' a- k& O) h) ~7 t
- *
! C* B3 Y7 O+ Z8 q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ G C% s0 _* I! T' J - * kind, whether express or implied; without even the implied warranty
) ^; M/ x' P7 m- x; | Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 h. T: d/ }" ]8 X; v - * GNU General Public License for more details.+ u2 r ]+ W1 F
- */
[( m+ w) t6 W/ U0 O" c" N t( L - # `4 B7 G# N0 I% o/ D- I N, F
- #include <linux/module.h>
& s: a6 F% j. i: t( s8 ~ - #include <linux/init.h>+ P2 r7 p, j. p! t2 v% P5 [+ L
- #include <linux/errno.h>
" a( _" x! u; a - #include <linux/types.h>
4 w3 q( C% ?+ M5 V - #include <linux/interrupt.h>
4 r2 [% s) _, q. ?/ W9 X6 N - #include <asm/io.h>+ U. t' f- N& u+ b; z5 ^8 L
- #include <linux/moduleparam.h>
9 u2 i- F \/ ^; ]- x# a - #include <linux/sysctl.h> W" P5 q* _7 F% } e
- #include <linux/mm.h>
$ n7 g# A1 x# ? y( m3 d c: _+ Y - #include <linux/dma-mapping.h>% R8 X& ]6 R& U6 q$ c. h0 ~% t: j
- 3 \, Z4 w" E9 s3 K2 k. n; b4 Q
- #include <mach/memory.h>% L1 j$ p5 x) V( I j! g. T. K+ U
- #include <mach/hardware.h>! z. @$ f/ o$ ?- V7 |/ N @
- #include <mach/irqs.h>5 q* G% a8 O+ u9 A8 V3 E
- #include <asm/hardware/edma.h>
. p8 t& \* p" b, U0 U5 H
* a% r. y+ i0 X" `' [5 M$ _' M: E- #undef EDMA3_DEBUG2 k2 @% t' v* K9 @4 Z
- /*#define EDMA3_DEBUG*/5 N* O2 Q; ~0 c# z2 i$ d! J4 Z. E
/ u' l/ G9 Q$ v4 s( p' I& ~- #ifdef EDMA3_DEBUG i1 C/ y* A* ]! A7 k: R B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ v: ~2 n- o( ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. Y8 _1 f1 L+ F% E8 t# g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 M' {9 j5 e9 R
- #else
3 l% ]1 a, Z! p/ ~ - #define DMA_PRINTK( x... )
; ~8 i! r- Q7 ]& A3 i- [ - #define DMA_FN_IN U l( }' }4 ^ m
- #define DMA_FN_OUT
5 q9 B% H. Z3 y% X' O7 M6 _ Z5 O - #endif
0 ?$ v6 L2 Z( _% C% O8 Y
3 Z# e: z. S, p8 V) B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 U0 V$ Q, s# z* d$ A8 y - #define STATIC_SHIFT 3
( `$ i0 n; o9 _/ e& p - #define TCINTEN_SHIFT 20
2 A; b/ t0 L5 \; o' x5 U - #define ITCINTEN_SHIFT 21* ~4 L, T3 y) ?( h
- #define TCCHEN_SHIFT 22
: Y4 `2 z5 |8 G$ U! p - #define ITCCHEN_SHIFT 237 ]& O; K# K% z/ t- w' L
# [3 t. R; @; {1 F* @- static volatile int irqraised1 = 0;' K+ E5 G' a! ~* d4 E
- static volatile int irqraised2 = 0;
4 q* O1 C0 i. j, _: x: Y9 u
# a$ l$ h- L$ E% _9 f K; }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ~: T6 j7 M: n- a$ Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( F2 l p% z2 ]7 i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ?, @0 \8 U2 S! L
- : ~' J( u* i0 q% K
- dma_addr_t dmaphyssrc1 = 0;
8 l1 [0 {, W/ j - dma_addr_t dmaphyssrc2 = 0;3 A/ m! a* @0 @# L5 K6 E& ` `7 L! v6 f
- dma_addr_t dmaphysdest1 = 0;
' f& a" L$ |$ j- W - dma_addr_t dmaphysdest2 = 0;
+ k6 e" p9 y1 p6 C$ @7 }
& T# @, Q8 m4 q$ j- char *dmabufsrc1 = NULL;1 ?' o. J) v% w; \. \
- char *dmabufsrc2 = NULL;8 u" @* V* [4 Y, [6 M6 {
- char *dmabufdest1 = NULL;/ w" V/ R# i2 `
- char *dmabufdest2 = NULL;
/ d9 s' Z \4 b$ @) i w! ^ - 8 y k- ?& D0 T8 i4 {% Z, I9 i! l
- static int acnt = 512;
8 K/ h& F% z7 u5 ]4 V7 Q6 Y - static int bcnt = 8;
3 h2 V8 h, R, j3 u. q - static int ccnt = 8;
2 U4 P5 g7 ~+ U! {
; P' [8 c6 \* Y# R4 Q0 ^/ S$ I& b- module_param(acnt, int, S_IRUGO);; @2 f6 t! W3 b
- module_param(bcnt, int, S_IRUGO);) K3 T' d8 y! Q6 n2 E+ |
- module_param(ccnt, int, S_IRUGO);
复制代码
' u( l: |+ P- G F) m3 ^, q% c: W( O# a3 e( k0 s* V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& d# C B8 z8 s) k6 K. c4 w; varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ c4 E$ k2 n7 y6 O" q& a. K0 _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 m2 X4 E: P0 s' K) J) H& k4 C$ `
) V7 s$ S h) \6 z# H5 O7 L# W/ Z) p: f l3 P* v0 ?$ C
|
|