|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: m* V! x: b7 n# u0 Q- [code]EDMA sample test application& T3 \8 C) _( D6 j/ b( J
- /*
3 p" e; l2 u' |: I - * edma_test.c
% j5 ~; `/ q$ {! u- F - *. D( b7 Z% A0 D( Z
- * brief EDMA3 Test Application
! @ }( P/ W. Q. F' K) u' S( a - *- R2 |0 y& q8 l/ x0 R/ {
- * This file contains EDMA3 Test code.
# p; w- Q }! H7 I, Q - *$ [7 ~5 s u: W% }0 ^. m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 }* M9 X) ?8 o Z% |. t) j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' P- y0 z7 |6 Z% h) C9 l* Q/ L. }0 z - * TO CHANGE.
1 S9 \/ J. l, k7 A0 s - */ B0 g. R. \2 Q- g$ j: H6 p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 P6 r& I# p' z- Z( S4 U, c - *2 ]7 E: ~4 }5 \1 k# `0 H$ m3 H
- * This program is free software; you can redistribute it and/or. B2 @7 V8 f+ [. ]' A
- * modify it under the terms of the GNU General Public License as
( n; @ k/ y3 H/ ] - * published by the Free Software Foundation version 2.0 h2 N* b+ e. T9 U' p# K9 b
- *
0 [8 h% n" V5 `- x0 C$ ?1 N" M! e* C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* Y8 j+ F! F% [) ] w
- * kind, whether express or implied; without even the implied warranty" n7 q" k" N# [6 C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 Z+ E& x& ?8 D. w
- * GNU General Public License for more details.( k P* s/ e2 d/ p X0 J8 R! Q
- */; N" T1 p4 M2 ^; @1 }
- / J* ?' E; B5 o- N' l9 _
- #include <linux/module.h>3 B9 Y( f$ o: x% @. S, R" t
- #include <linux/init.h>) Z/ i' j2 Y! ^& x9 H# D* u
- #include <linux/errno.h>
9 y# b# m/ n B" H7 a - #include <linux/types.h>
! D# M h0 x6 H% _ - #include <linux/interrupt.h>$ B8 w a: Z7 E/ V( ~5 C
- #include <asm/io.h>; p) ]9 p! j* g& O
- #include <linux/moduleparam.h>
; o- | A# l* } ~& d/ i5 c+ p - #include <linux/sysctl.h>4 |$ ` N, c+ ?: W' {4 D7 I
- #include <linux/mm.h>
0 ] I6 K8 y# {$ s4 J ]6 q - #include <linux/dma-mapping.h>; L G2 d: w) T. ]; U( c( l
3 R" H" l# q2 t8 D" U2 J- #include <mach/memory.h>
5 [9 X. k* s+ V# \$ C% j( @ - #include <mach/hardware.h>
) P: M3 n1 K0 p m, s1 c - #include <mach/irqs.h>
1 M" V& r& \1 K. w! [6 Q! |& I - #include <asm/hardware/edma.h>& T: G- X- A! E R9 o+ }; O1 G
/ }" f. @2 C( e* E& C' i/ y- #undef EDMA3_DEBUG
* p+ B" D5 g/ r, l, @3 @, s - /*#define EDMA3_DEBUG*/: @" D( z: X* l
- $ G8 [! o. u. ?7 {! I- M9 g
- #ifdef EDMA3_DEBUG
1 w8 O, ^7 j7 t5 r( c' H8 D - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' [3 R9 S* D9 m: E; @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ n) w. g9 b0 u. Z. |4 m: h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- L6 a1 Z4 g% e* Z. l. m# o P! I - #else7 V l8 s3 w- ^! A" A3 q6 b
- #define DMA_PRINTK( x... )+ i0 h4 }# U* [6 ^0 [* q6 q; T
- #define DMA_FN_IN* [9 M. t' ^0 P: x8 f" h) o
- #define DMA_FN_OUT
! [2 }6 n# c5 Y! ?! d0 c - #endif
( _% {4 M* m8 o. t$ _9 X - ! L" \) Z; t7 h7 s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% E% s' d s: o. [ {( `* a - #define STATIC_SHIFT 3* X1 [; V3 Q- o. G1 i% r" X
- #define TCINTEN_SHIFT 20% |; L3 U4 s. t. r! G- _
- #define ITCINTEN_SHIFT 21 }+ B3 _' O' t8 t
- #define TCCHEN_SHIFT 222 }! x8 `9 S8 x" X
- #define ITCCHEN_SHIFT 23
( Z2 L$ Q8 a& H! V9 a0 o& ~% [$ K
7 d1 ^' t; b; W- static volatile int irqraised1 = 0;& v( C3 X3 p3 f) b" S: f8 Y) V9 o
- static volatile int irqraised2 = 0;9 a; d, z% D, n3 Z$ h. x4 r1 v" x
- ) }( z) U' m1 e9 K8 d. b% k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- _* q- d' V I6 r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 K5 i9 O: f' T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 y0 m& D# Z6 U - ' r) s5 ]6 o7 f2 M
- dma_addr_t dmaphyssrc1 = 0;& Z8 a# a. \6 d9 {; ~# K
- dma_addr_t dmaphyssrc2 = 0;: \9 P- s% ]* R
- dma_addr_t dmaphysdest1 = 0;
* t' \! R" z+ `6 N - dma_addr_t dmaphysdest2 = 0;# ]" y9 O1 Q3 Z9 Q7 ]
! E5 N" C E; F( o9 `- char *dmabufsrc1 = NULL;9 O0 \: ]7 q. [8 ~9 A1 u! ]
- char *dmabufsrc2 = NULL;, k9 z' o; }+ N
- char *dmabufdest1 = NULL;
+ ~9 j+ `: Q" s+ J s; u - char *dmabufdest2 = NULL;& G$ q& x4 i' e' X
3 ~. _5 f( y' i- static int acnt = 512;
* ?! d/ u; ]) P$ z. Q- c - static int bcnt = 8;4 l( i) N3 V, G0 e# e: |* X: m0 s5 V# r
- static int ccnt = 8;
# Y3 g% U! a9 I% ` - 4 X+ I7 R& |5 z; Y) @
- module_param(acnt, int, S_IRUGO);3 E& @8 J+ R ^: u% W
- module_param(bcnt, int, S_IRUGO);
4 K* L& i3 j" d D9 S2 L- P - module_param(ccnt, int, S_IRUGO);
复制代码
, E$ h5 n# ]1 S9 @: i3 @6 j7 M- w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 ?' u6 m" Y, d' C2 S% w# t; |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- V" w( P& |( j+ m' F2 N% Q& j3 p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 Q5 d* t$ y: R2 m l- X5 k
" u. y$ ?: V$ J1 d) f# ?9 X" L& u; s3 o1 h
|
|