|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' P1 ~- O5 O: c7 j1 T" ~9 k- [code]EDMA sample test application' l6 `1 F7 a6 m; f }# C
- /*
! W& g4 Q9 {5 G1 L - * edma_test.c9 \" S0 R' r' V8 w9 b+ ~ N. N
- *
$ g# H: ]- @$ U2 O W* |7 l8 @. ? - * brief EDMA3 Test Application
8 ]% _% Y' N5 x - */ Q: q, E* Y0 P K! b* f3 Z
- * This file contains EDMA3 Test code." y! _0 l N. @( L$ ]' m
- *
: h J/ v- |) W: z0 @5 c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& b; V& w i7 C; p) N W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 T, F. F8 ?* y' l+ P& @
- * TO CHANGE.( _1 s1 h( {! ~6 E; q- ?) u: \
- *
+ b+ e \% K" V0 f4 _8 P: t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ Y" u1 m/ f& r1 F- c. `, R, m
- *
; }9 k, m& g! ^# n( q2 v - * This program is free software; you can redistribute it and/or1 |5 a$ d j k5 s$ o' N! {& I
- * modify it under the terms of the GNU General Public License as$ U4 V+ e: M' d) ]+ K
- * published by the Free Software Foundation version 2.5 Z' f% t/ v( h
- *
. r' {& P! h$ i) l+ R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 W( Z9 K- k6 Z, w - * kind, whether express or implied; without even the implied warranty( Y+ P6 O a$ u2 S' e# B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' D: X1 C \: d; x" N4 Z' V3 W- Z - * GNU General Public License for more details.
" I/ G& q: i7 m+ u8 s$ _+ I - */
. c# Y. o7 H6 P- r
! G* h# [2 V0 R& {8 }" T. T- #include <linux/module.h>
* p; n9 Y+ j# { - #include <linux/init.h>
3 x3 B" D, C( d/ F - #include <linux/errno.h>
, U' V( m& K9 \6 q; g( v - #include <linux/types.h>
# ?+ s9 ]$ _4 a/ Q1 v; D- v5 N! J - #include <linux/interrupt.h>7 W/ e `' \3 w: {* V! P/ A+ Z
- #include <asm/io.h>6 R9 c1 \2 j4 B
- #include <linux/moduleparam.h>3 b ~) I1 t6 Q! J$ I& ]
- #include <linux/sysctl.h>1 l) N; ~3 M7 o2 q' _
- #include <linux/mm.h># j: l- z; \2 [4 [0 }) H
- #include <linux/dma-mapping.h>5 F# h8 Y. @. W3 V
- 3 v+ q# o4 i& j, W( U4 E
- #include <mach/memory.h>- C( d% |; F. i; {7 H) n# D
- #include <mach/hardware.h>* X6 ?9 M* `' a) |
- #include <mach/irqs.h>
4 V% u) s4 ^3 q$ z0 V - #include <asm/hardware/edma.h>
% ?# j9 H4 h" D5 A
5 e0 F# ^$ L- b7 B1 g1 |- #undef EDMA3_DEBUG- P, Q4 A( _8 C( C9 Q& ~9 V n, ~
- /*#define EDMA3_DEBUG*/
/ W8 S% W$ |# D, n6 o; z; T- P - ) D/ a% K1 k0 i0 n; t
- #ifdef EDMA3_DEBUG
0 x8 s5 a% [7 g+ z' l! S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 y! e; P7 [7 R8 q0 p5 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); a$ E3 h# W9 S" W. K- n6 K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 o$ u1 c. @, V2 e6 W- z6 m) \% o& A - #else
, J; L! `1 Z% D6 [& J - #define DMA_PRINTK( x... )/ d2 [% U$ o7 ?& N1 c5 H" _0 |+ ~
- #define DMA_FN_IN
9 u* {- e$ R9 @- V& v2 ]. o - #define DMA_FN_OUT
* ] S) n D/ T# Z* t - #endif! o4 U) |2 j: n5 N+ t
/ U% h F: b2 @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; C% s0 f8 A: [7 b- s; ^; w - #define STATIC_SHIFT 3
& u) p/ Q4 m+ l2 z - #define TCINTEN_SHIFT 20$ a1 }; D1 n A
- #define ITCINTEN_SHIFT 21
8 w! o( t X3 h1 g7 j: z9 F8 X+ O - #define TCCHEN_SHIFT 220 A- f1 A8 N) r, ?
- #define ITCCHEN_SHIFT 23
0 F7 N: D X3 z4 ~( _) Y
+ C( u' }- L3 ?0 i- static volatile int irqraised1 = 0;
; \9 L+ I" e: Y3 F. c' t - static volatile int irqraised2 = 0;
% X9 Y" N/ ~ {- M9 N
# |7 \6 t: Y1 X, I v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- x1 H. q: ~4 N/ ^, f; f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 N- q9 @( i" t" Z1 B& O& n5 H" U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 A! L3 P8 R' @# Q" z/ d: K& Z
5 o1 E0 E# H# Q( A, a$ m4 l7 F5 z% C- dma_addr_t dmaphyssrc1 = 0;& Z: o$ f' ^6 r# }0 g
- dma_addr_t dmaphyssrc2 = 0;
: f i. h6 G# O3 l& s - dma_addr_t dmaphysdest1 = 0;2 m/ \ q Y8 o/ O! @$ n
- dma_addr_t dmaphysdest2 = 0;1 \1 D& b: Z# U9 E0 I$ S2 Y. E
5 {5 ?( p. c& [: P" `! z- char *dmabufsrc1 = NULL;
5 i* Q: P+ }8 ^0 N( j' |" N - char *dmabufsrc2 = NULL;! b# S" N1 q0 k
- char *dmabufdest1 = NULL;4 X P; @; Y z7 I+ D, |( l
- char *dmabufdest2 = NULL;
( U' y* D% |5 a+ |: U8 I3 M - 5 V* }( U$ r; Q/ y4 S
- static int acnt = 512;4 ]5 c: K, r, m1 e: U1 I
- static int bcnt = 8;. ]/ o( n d$ S; { A' _2 }5 m
- static int ccnt = 8;
8 |& q! v! p: c$ \1 a8 E; x7 F9 K
5 I. x3 |+ r- `: _( `0 {+ ~, ~- module_param(acnt, int, S_IRUGO);+ d- b4 r* o4 U; G$ r: i% G
- module_param(bcnt, int, S_IRUGO);7 M4 k; a% ~% _5 u
- module_param(ccnt, int, S_IRUGO);
复制代码 8 z" x+ O% J) D5 ]; c. x
; O, {5 L8 ]$ Z7 _- Y( r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 ^) c3 r4 L* p) ~* i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; h# m( a0 z2 \8 a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# w" T* G: n/ Q
4 d5 _/ y/ u0 e8 H. g- T _' P8 |9 {& A4 C( E0 a4 x
|
|