|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% i# U1 i8 \: T- [code]EDMA sample test application1 k1 M8 s6 y4 `6 \6 X) t0 w( _
- /*) k! Q+ g$ x2 R# c" A2 ^; D: F
- * edma_test.c
. Y% f' ?8 J+ T7 T# J - *8 O: u: O8 F+ o( Y: ^
- * brief EDMA3 Test Application
$ D v; i0 u# j2 h& J - *$ I$ j8 g1 p1 C1 i
- * This file contains EDMA3 Test code.; W; u+ o" y3 r M* J8 ?
- *2 {$ u" } e4 p; j2 j6 W4 I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 A$ v6 ?% w$ B% B3 O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! _% c# k5 H) p9 V- h6 S - * TO CHANGE.* [0 K+ V0 L3 e0 H' u
- *
4 X2 B3 V4 {+ t! d/ @, o# |7 W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! ]# O O" j7 V2 a - */ I( w1 F# E1 J- H' Z) e& X3 F
- * This program is free software; you can redistribute it and/or
/ M% S3 v. R; N7 r) N' y0 {8 B9 M$ H - * modify it under the terms of the GNU General Public License as3 ^) L5 Z) b9 d* Q
- * published by the Free Software Foundation version 2.5 a1 Q$ a* V' X
- *, w8 x c1 f5 V! q0 X4 O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 }2 w# J1 a, \4 d7 I; P
- * kind, whether express or implied; without even the implied warranty: f( ?' T1 [2 J0 p/ d9 f1 ~) K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ S V! W0 s, D: q4 H - * GNU General Public License for more details.( i/ b% r1 Z# {# q6 ?1 x
- */
0 d6 S7 w; F8 }" I. ~5 I
0 m6 ~& d( }# m! Q- #include <linux/module.h>) `+ m! N z( m& Q; g8 g6 D
- #include <linux/init.h>
; s* V- `, {6 E' O% \+ L! b - #include <linux/errno.h> ~, Y E3 G+ }: t1 t2 J
- #include <linux/types.h>2 r' E, b/ F" M+ E" g9 A
- #include <linux/interrupt.h>
3 s7 A/ U0 j* ~. { - #include <asm/io.h>/ \4 [+ {! x5 W+ q% ] q4 ~
- #include <linux/moduleparam.h>( k7 ?1 O1 b* n
- #include <linux/sysctl.h>4 g9 e& J: o' w" g% @: n
- #include <linux/mm.h>
9 j5 R# q/ n2 C7 p7 Q; l# Z - #include <linux/dma-mapping.h>
1 w z6 ~! D. Q v1 Z7 P( G H7 A$ u
4 H) R& b0 {& f- v G- #include <mach/memory.h>
) G! n) b$ D$ U# F - #include <mach/hardware.h>( \' t* o8 A: a1 Y, ?7 r
- #include <mach/irqs.h>
$ w$ y4 Z. ]. i8 ?# u1 x - #include <asm/hardware/edma.h>
/ I* N2 O) v+ J- o( k: ]
$ a- X& S2 i6 l1 p+ C- #undef EDMA3_DEBUG( Q7 K' w0 u) u! B G5 k
- /*#define EDMA3_DEBUG*/
( k& f' l4 N, R* ]+ ]0 [' A - " s+ Q4 n1 V/ V# J: l- e% v
- #ifdef EDMA3_DEBUG0 w1 J$ @8 p4 I& Z5 U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 g2 E" U# v3 g: X. r+ { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 g: s- E ^5 }# E' j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ l. u; Y* I! h8 _- ]1 z% W
- #else6 y+ Q8 X: Z. @! s, x ~
- #define DMA_PRINTK( x... )- }; x5 j0 a) A. U9 [2 w
- #define DMA_FN_IN
& L+ O: w Y& n1 Q! l3 L, F - #define DMA_FN_OUT
6 R+ G: ^7 W$ [5 { - #endif2 b7 u1 W' T% k; U; x
3 Q, ~) K# c4 V; l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" B3 c% |6 t( d
- #define STATIC_SHIFT 3. U( i7 X+ _8 H& D. y. |/ k: v
- #define TCINTEN_SHIFT 20+ J& O* b0 H( x% _% j
- #define ITCINTEN_SHIFT 21% l# H3 q* P8 H- e2 g2 b
- #define TCCHEN_SHIFT 22% f! y+ P# T# G4 y! y1 r+ ]
- #define ITCCHEN_SHIFT 23
- Y J- R& I* f5 u4 X) e* F6 C - , i% L9 {3 W+ |* X
- static volatile int irqraised1 = 0;/ _( l; q) E6 k. e2 {
- static volatile int irqraised2 = 0;
! g, ?4 X5 h4 M+ q5 l& f, \+ u
' \' d2 i B1 Q0 Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' {. E3 i- ^; D- z) N) u, v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% H. s: b3 t! b5 L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 l% S/ ]) g4 S! v7 S( d4 X - ! [' J, A* C1 {; E3 v
- dma_addr_t dmaphyssrc1 = 0;7 W! W6 P8 W* B$ S- e' D2 z
- dma_addr_t dmaphyssrc2 = 0;
9 p2 |8 V6 z4 m( p; ~, U- d. v - dma_addr_t dmaphysdest1 = 0;
- p$ I, U) }% }: X - dma_addr_t dmaphysdest2 = 0;
% d; E5 J: z1 D% S
1 v5 I' B# C" E+ ]- char *dmabufsrc1 = NULL;
# O$ \1 k# Z/ W7 b q - char *dmabufsrc2 = NULL;
4 d& p$ K) p& {2 e. c0 Y$ a# [+ R9 ] - char *dmabufdest1 = NULL;2 T# v3 ]2 ]" h" s) l
- char *dmabufdest2 = NULL;) Y* L( \" J4 \/ ]
. N; n+ f# A, u# v- static int acnt = 512;
5 o* T# N* Y' C3 H* G" v - static int bcnt = 8;
I' w* f" Y2 {. F - static int ccnt = 8;
( K/ ]0 R2 f- U7 ` - / P1 z# f& E4 a \* M
- module_param(acnt, int, S_IRUGO);' E; }5 }* j+ \$ N
- module_param(bcnt, int, S_IRUGO);
7 F. k$ m; h+ G( i4 X M - module_param(ccnt, int, S_IRUGO);
复制代码
% J/ J4 S. A7 I+ M( ]' m8 _* `% D
. n' }# ]" w. |1 j! t% O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) j+ u& N" R. O9 ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- x1 a6 w3 K/ r% M2 y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' F7 L$ \ o |! d+ ^0 L/ n% a/ k7 w7 q
" V; }! T: B3 w2 C$ i7 \ |
|