|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) m$ ~0 D9 R+ F0 ]/ ]' q# O. N
- [code]EDMA sample test application- S8 u$ V3 g' r W# p
- /*. ~6 C8 B2 `& [8 J/ c* d* f" }
- * edma_test.c* g7 Z* L7 N; ~) R/ P6 A+ y) j
- *
) X3 O* M4 J) a- f# c9 t - * brief EDMA3 Test Application8 @7 D9 w0 B/ }& P9 q* W$ P: Z+ d
- *3 ~& E F F) `6 q. o
- * This file contains EDMA3 Test code.; ]3 L7 a, R$ X/ [( O
- *- M. T/ L$ Y. y) V& r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" `0 c! o9 r$ i. X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 p4 u8 n' I6 O: j% T) l
- * TO CHANGE.
" s3 i# [' |" J, {; _/ i - *
. Z' R8 e3 R5 d7 z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ T* V, U' ^6 H
- * T( Z: M& J8 e- J$ w' S
- * This program is free software; you can redistribute it and/or6 \" k3 L2 ` _5 T- W
- * modify it under the terms of the GNU General Public License as' @3 m5 u3 R* M
- * published by the Free Software Foundation version 2.
( b m! @- J8 K0 b$ D5 M - *7 y+ B: ?" f; ~4 l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 {* u9 J; J" H8 N- d3 t. c# N; B. M* ^ - * kind, whether express or implied; without even the implied warranty( t( }6 C; ~3 V# P$ x% r4 {' D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 x: U' m8 z3 z$ ^9 l2 K - * GNU General Public License for more details.! k3 T$ g' C9 q3 }
- */, k( R9 H+ y8 J; @, `) v5 a0 _: ^
- + s, I/ E& D. L: ?3 _/ Y; W! D
- #include <linux/module.h>8 E7 J) X3 [( c/ O0 h: H. o+ | u5 f
- #include <linux/init.h>
; z: @8 t( }% u - #include <linux/errno.h>
+ s& f6 m9 d: T" o( \3 s" E* a - #include <linux/types.h>
: T3 a7 E( W: F- S( C: z# R - #include <linux/interrupt.h>
1 }' B4 ?5 N! Y( l3 V; _ - #include <asm/io.h>
! e: r8 S# a: S- ]4 R - #include <linux/moduleparam.h> c p" [3 j" T4 u
- #include <linux/sysctl.h>, k2 x' K5 J; G
- #include <linux/mm.h>
0 T; z k: K; s( ~, o {# q - #include <linux/dma-mapping.h>
$ V# K- n4 ^) z+ E q; l
" _, s) i7 c7 Z1 w1 [: H- #include <mach/memory.h>
7 g* L8 a; E0 _4 h+ \ - #include <mach/hardware.h>( T: u, h. g2 n G
- #include <mach/irqs.h>$ k7 U" Y0 d$ y: d- Z; ?7 G8 R
- #include <asm/hardware/edma.h>
3 k2 ~2 B; b8 U5 F* n+ R2 z3 g
$ r: @) G6 h" [* t/ t- W8 H; G% R2 P- #undef EDMA3_DEBUG
, o, B8 y: ~0 A4 Y - /*#define EDMA3_DEBUG*/ d% K1 |9 ~) ^9 W
# O2 V) q- U, r- E9 k {- #ifdef EDMA3_DEBUG
3 y, r0 E4 M. `) L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ G o0 N w0 }2 J7 s/ W' V/ k4 Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# _( \" o% z/ u, q5 f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 i9 W: x. E' T. b2 E4 s( E4 B1 H - #else
+ E9 }' t$ z. ]+ l2 g: h* e - #define DMA_PRINTK( x... )
! i5 f& f! G% b8 B - #define DMA_FN_IN1 E. o$ G2 L0 _
- #define DMA_FN_OUT
% S% u2 `$ K& X$ B - #endif A; Q1 X! Z4 m: |: G- m
- 2 j3 ~1 F* T2 s, z3 k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 C8 u: U. a" w/ L - #define STATIC_SHIFT 3
6 x2 {& z1 O5 i# U0 ~ - #define TCINTEN_SHIFT 20! n& p4 Y, j- t2 l3 W$ z6 w0 g
- #define ITCINTEN_SHIFT 21
+ W9 l$ E; Z& {' P - #define TCCHEN_SHIFT 22, [3 \& }# g2 [# l1 k
- #define ITCCHEN_SHIFT 23
# t1 v+ o% t( o5 E9 u2 b: |9 q - 4 ~9 O6 E0 W7 x5 L F) M. T
- static volatile int irqraised1 = 0;3 y- R6 I4 h {8 t. x0 s( N3 H+ A
- static volatile int irqraised2 = 0;
8 O3 ?8 C- P1 u& D/ O - - f: X. l5 y; X5 z; n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' L6 w% y5 ?0 z7 p4 S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 v' s2 N- G; x( m# d+ n7 I3 k) O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 E# q6 n' }7 O- C# |* p6 u
- & p( Q$ Y: V% Z( s) ]& S9 V% I8 U
- dma_addr_t dmaphyssrc1 = 0;4 t3 ]7 P3 f G- ?4 }8 r
- dma_addr_t dmaphyssrc2 = 0;
% @/ e6 a/ K% {& M" |3 ^: a - dma_addr_t dmaphysdest1 = 0;
2 P- g+ j' }3 o" _$ z% |" ~ - dma_addr_t dmaphysdest2 = 0;5 x* ]& ]: O' Y9 {4 t+ v7 A$ }/ Y# J
: d/ k7 a$ P. Z$ H3 x- char *dmabufsrc1 = NULL;
9 A2 B( _. {$ G ?2 l - char *dmabufsrc2 = NULL;
* Z# N$ \% r0 u* r- F1 ?5 l - char *dmabufdest1 = NULL;
( a6 m; ~5 J1 e. g* w. x+ b1 I, O$ { - char *dmabufdest2 = NULL;6 M4 R0 q2 `, R+ P$ z' w* u
- 3 A! \" g# O& A
- static int acnt = 512;, Q, i3 }" i* ^* k( q
- static int bcnt = 8;# Y' {% F* ]% j: _8 ^7 \5 O3 f
- static int ccnt = 8;1 ~5 |6 ]; |/ \/ W. @ O6 x0 Z
- 2 ^4 V3 a+ T/ [) H
- module_param(acnt, int, S_IRUGO);4 k8 U- L6 |8 J ^1 L# F
- module_param(bcnt, int, S_IRUGO);
/ W4 X* D; q! ~ ^ - module_param(ccnt, int, S_IRUGO);
复制代码 7 p0 D5 r) _7 b
! x' A7 B2 s4 b) @6 u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' p [, `: F; O- X: Carm-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$ {4 H5 T n5 q5 Y' R I% i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 u) Y/ w. H" g' t7 w* z* x7 H
- e7 `% u8 Q4 l5 k7 W% W# p5 _1 f' C0 B2 c; F* C2 \9 K4 a. E
|
|