|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & {4 i# C% g& O8 i9 E& l
- [code]EDMA sample test application. K$ ?4 t% Q `, w
- /** z; k( Q+ F4 P+ B' T" I$ K
- * edma_test.c: d; h/ t! ^+ R* G8 k
- *2 v( f% B/ r; D( q# ?
- * brief EDMA3 Test Application( h% h% ?7 z* T7 N
- *- E. i! Y/ t, `7 T1 n) ^
- * This file contains EDMA3 Test code.- z J {8 L; N* w
- *
5 `3 a5 Q+ v, X) Z; n( E# W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. t# R. o* F, ]5 ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. ~- p, R* [* t
- * TO CHANGE.3 r7 o* M {1 ~' U
- *
7 |: S: t0 }8 t( e( W! @' { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 ~' }8 o! c& C: [: [6 s - */ z4 Q9 v7 }7 \( ~/ Q& Y8 h& k
- * This program is free software; you can redistribute it and/or. y/ d# }. d: p5 \/ U
- * modify it under the terms of the GNU General Public License as
2 {% c: {+ ~( W5 j( x - * published by the Free Software Foundation version 2.7 f+ t# Q; F4 |8 [- D. C
- *$ _1 S( a: v/ x$ L( ^* h3 y4 }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ |$ i0 d$ V5 Q+ v" ]0 S ?" s
- * kind, whether express or implied; without even the implied warranty) ]( B5 w$ s$ [/ Y8 [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ a8 P4 R$ a( {7 ^) _. }+ Y' F - * GNU General Public License for more details.5 G; a0 v% Q2 \: k' Z. k, [
- *// w) A( y& I1 v0 A- u: L3 K
- 8 Y2 c7 W2 V: \* Z# s
- #include <linux/module.h>
! S5 K7 d6 M1 u - #include <linux/init.h>/ y- ]: ]4 J8 j A: D0 E# Q7 M; w
- #include <linux/errno.h>
8 O" C! a. }. L( b3 M2 L' T: d - #include <linux/types.h>. s" p$ @+ F$ a, C
- #include <linux/interrupt.h>0 G+ I; T+ [2 c* v' F! M q
- #include <asm/io.h>
& t- m& t% l& F+ } - #include <linux/moduleparam.h>
+ [* ?: m6 Y" E2 B- S; G9 i) g - #include <linux/sysctl.h>
R( K7 L' ^9 s- R2 w - #include <linux/mm.h>
. M) x8 T4 ^' W6 X- B - #include <linux/dma-mapping.h> J+ L+ t' V/ T4 L
4 u/ ^( y; `9 j- #include <mach/memory.h>
7 I& F; u5 p; J4 C' Z' t - #include <mach/hardware.h>. j/ u; b6 w! P
- #include <mach/irqs.h>
& q, G* r( I9 b1 P x3 V - #include <asm/hardware/edma.h>: h" y7 S8 Z3 @5 w" _4 X$ _
- . P. _: G" o; w6 y; R+ b* ]4 A
- #undef EDMA3_DEBUG
9 l7 G7 y# l2 M3 t% `# `0 @- B - /*#define EDMA3_DEBUG*/
1 e4 G" Y0 o" B6 K( z6 [6 K9 n: n4 I - * b" T0 d. p/ E; }8 g: V
- #ifdef EDMA3_DEBUG
* i5 W6 A4 h# ^9 T v5 Q- M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; i/ R% d% k6 S6 Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! K" ]. B0 h- C/ m; }% q5 F8 d; L4 ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 ?( Y) j& }( q9 J - #else$ ]4 m+ D$ c1 A6 c0 q
- #define DMA_PRINTK( x... )0 o! E1 l; M& \( ]5 G
- #define DMA_FN_IN
0 j1 m; N2 l3 S3 A( d - #define DMA_FN_OUT) a8 X5 j/ W% S
- #endif
/ w+ B, H4 z' V1 U f7 k9 _. l1 y
2 L/ ^4 U+ p$ M" `0 M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 z0 `4 |4 D4 Q5 y
- #define STATIC_SHIFT 3# @5 q' f# r0 A$ Q
- #define TCINTEN_SHIFT 20
1 a1 b$ ?$ U& t: y* T d$ O" w - #define ITCINTEN_SHIFT 21# n- s9 g5 v* _# i7 f
- #define TCCHEN_SHIFT 229 F) |+ A% ?% \( o, x
- #define ITCCHEN_SHIFT 237 e' @1 j0 ]1 C7 }( L4 R& R
- - e7 k, J. z& ?* Z, T; U5 _9 ?
- static volatile int irqraised1 = 0;; V' [) l: P4 ~' U3 U: a$ |) d$ D
- static volatile int irqraised2 = 0;- f; _! w3 j8 [8 V+ \" V
- 5 R/ W/ D6 N3 r9 P3 q9 t) O X2 z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 t& G2 | w) _( ?' Z$ n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 t. }2 n9 f0 W6 \2 a7 y8 O1 I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Q) R" Z3 h3 l T( ^
- ) } m: i. _9 N% Q2 o; U% @
- dma_addr_t dmaphyssrc1 = 0;
' r6 F4 E# L( | R! |/ n. K0 a( f2 z - dma_addr_t dmaphyssrc2 = 0;
4 y- B5 c, R' Y/ Q& D7 ` - dma_addr_t dmaphysdest1 = 0;
5 \8 Q9 C1 _. \. v0 G# B5 N1 R - dma_addr_t dmaphysdest2 = 0;
! E2 q! R" R9 v; O- f: T1 M' v
. z7 @: J, z7 O$ ~9 I- char *dmabufsrc1 = NULL;; y: l8 Q4 n2 s. ^6 k% W
- char *dmabufsrc2 = NULL;
4 w( I9 ?+ |6 i - char *dmabufdest1 = NULL;
* c0 B2 ^6 p. P2 s - char *dmabufdest2 = NULL;) k7 Y% m# [% H
. M. V$ ^. U- ?3 L. ]3 ]# B- static int acnt = 512;
) ^+ J+ ]' x2 D, W+ h" j - static int bcnt = 8;# n# I( W1 t9 `0 x Y
- static int ccnt = 8;
" _' ?3 B3 N& j f* H% y
) T- k! @( u$ t' N" f2 l3 u- R- module_param(acnt, int, S_IRUGO);
) D0 U3 R) {9 v- _* E* P - module_param(bcnt, int, S_IRUGO);" Q0 V6 L+ L1 d$ U' G1 }
- module_param(ccnt, int, S_IRUGO);
复制代码
% H8 M, M, n( _. @% W6 r
% Z- b E# O: ]% `% J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; R, e; K- j' i7 e+ S5 zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; p! ~6 d/ I1 Q7 k2 |$ W, ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* t' I* T6 ~- \6 _3 _' i( a# s4 L
3 v" q" F P! v. p5 p, l$ u
h3 `8 W5 P( V, e1 r P6 j+ ] |
|