|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ s! ~: v' d5 b# c- [code]EDMA sample test application
: Z! t0 z- e: O3 t - /*4 X! J- K+ J( |, I
- * edma_test.c( T; \$ O6 _5 V/ e
- *8 y7 T9 g* A( j9 h" i e- a( o
- * brief EDMA3 Test Application! B( G8 z3 c& v
- *- C9 [& d, ]% x3 u7 s& K
- * This file contains EDMA3 Test code.
5 ~0 F2 P/ }: g, W( I+ a" C; u# } - *2 Y2 _6 B" x5 R6 H7 U, M( o& L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ _! p' C# h/ u1 Z8 L/ O' t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, q$ G7 m' n2 ~' E; W4 Q7 n2 l - * TO CHANGE.6 C' m9 B1 e+ l! {3 R3 o
- *" T6 w3 X) @& p- o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 P6 Y7 {+ L7 S$ ~, E$ N1 e
- *
8 s5 [( U7 T0 |$ X$ o# l - * This program is free software; you can redistribute it and/or
; U0 K6 C8 } H - * modify it under the terms of the GNU General Public License as8 X: b/ ^0 D1 R1 C
- * published by the Free Software Foundation version 2.% M0 p, l1 k" H) d
- *
8 v3 g% a5 k' g: F7 N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" t* \) c% G; s2 a
- * kind, whether express or implied; without even the implied warranty4 A1 ~' i" S) t0 H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# |% o( `9 F8 k( J
- * GNU General Public License for more details.( W) ^+ [+ n% Y3 V
- */
, j' c8 D$ R+ @, q. D- `. W
! T7 P) O* f. z- #include <linux/module.h>
2 j2 c+ z' O" X! T4 T$ N2 a6 K - #include <linux/init.h>
0 y, b8 z& \, T; B2 Q q - #include <linux/errno.h>
! {- J. A- e3 E0 s6 r( g9 p - #include <linux/types.h>
( U2 J+ B: k) q* _3 K - #include <linux/interrupt.h>
/ Z) |. }, @# D! {# w) S' Q$ ] - #include <asm/io.h>
. n- ^$ s/ b! F - #include <linux/moduleparam.h>/ R0 V: Y. g- M% W- S, c; ]& Z" R
- #include <linux/sysctl.h>3 z2 Y2 y8 c' _: Y9 n; l
- #include <linux/mm.h>
9 L( R; F8 p' O* A: A$ p - #include <linux/dma-mapping.h>
! x. G( p! f# B0 e; t) t. L: i - / B$ N4 W \3 p v$ \! L K
- #include <mach/memory.h>* y5 x. w$ ]$ x5 S
- #include <mach/hardware.h>5 Y- w, ?" S3 G4 j4 }$ F! V
- #include <mach/irqs.h>' V( H6 v4 V# z" S
- #include <asm/hardware/edma.h># ~- h0 l+ L9 n- h- }8 O
- c/ m2 C4 u3 D3 O- #undef EDMA3_DEBUG
) r1 g2 e! p8 d8 t7 e4 ?. @) \ - /*#define EDMA3_DEBUG*/
A$ \( w5 F. G# G9 B
7 `: U. t7 U% W! `% [; u- #ifdef EDMA3_DEBUG
0 W4 Z: O8 l4 h; n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 L* [6 t; I) c, {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 |+ J* T7 B& v$ W6 g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 l" c6 j, A- S/ \2 I/ x- `
- #else
% J3 d. \% P/ A: S/ |; U7 b ^ - #define DMA_PRINTK( x... )& J0 w8 e9 K+ g* B$ k7 g; b3 S6 m: w
- #define DMA_FN_IN# X6 W$ k) j. E& D: b7 p" m
- #define DMA_FN_OUT
8 O& y+ u5 k# L - #endif* V: b: ~$ y X. g) H( L
- + P @7 ~; L9 y4 q- N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' {6 C$ O0 l; ]1 C7 x, W1 y9 e - #define STATIC_SHIFT 3- _# q' R& P+ G: ~1 m
- #define TCINTEN_SHIFT 20( m. s( F4 K9 j; i4 y$ R1 k4 }7 S& D
- #define ITCINTEN_SHIFT 21 I( B# \6 ^) S: j' N9 j) A5 A
- #define TCCHEN_SHIFT 22
! ^7 G# n8 i4 t. k+ ? - #define ITCCHEN_SHIFT 23
$ \2 q1 e) x( O! I/ F - 3 W; j7 f) s, R! v: K
- static volatile int irqraised1 = 0;
4 r8 V2 f+ I$ Q5 {; p, i - static volatile int irqraised2 = 0;& b- n! d/ Q$ c% ~# ~
- A( n; {, ~/ x1 u0 D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( o+ g8 ^2 X" Y1 B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ O) ?# I- T) }9 P' g' @4 l4 O6 ?) K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
i d. s% `7 k
! B) k( H1 f3 b \: z( \- dma_addr_t dmaphyssrc1 = 0;
* P1 ~9 w+ R) D5 i5 | - dma_addr_t dmaphyssrc2 = 0;0 D( E1 O- s9 w- j) C0 e- J5 J
- dma_addr_t dmaphysdest1 = 0;5 Z" _2 g' z3 b# W$ o3 }
- dma_addr_t dmaphysdest2 = 0;7 \, _; p0 D' B! I4 }' U" p
- : @( P: e" W' v# ?* E7 f: z
- char *dmabufsrc1 = NULL;
) N& U3 E& h+ I4 D! c: X% U - char *dmabufsrc2 = NULL;
$ }# X# G9 C" k8 I. N3 E4 r" }3 d - char *dmabufdest1 = NULL;
0 O+ n* M! C. i6 Z9 ? - char *dmabufdest2 = NULL;! A* Z# P5 l" m# t- O
- 1 M8 @& m, y% x. v: ~: {* \+ W: |# Z
- static int acnt = 512;5 _' @0 {% L2 J1 E* m
- static int bcnt = 8;: z( `2 V( A& K
- static int ccnt = 8;
j" m" M% N# {( C7 F; g* ? - ) J5 w! o8 Z! ^) @/ q& j* Q0 {& t
- module_param(acnt, int, S_IRUGO);6 y) M$ y! @: ?) G. E; v$ z
- module_param(bcnt, int, S_IRUGO);
8 ]# Z* M: r$ P - module_param(ccnt, int, S_IRUGO);
复制代码 ( J8 z n) J X' D8 z0 L
. B: j2 N9 [4 } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 p5 h; L* K) L4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 Z( k U0 [5 ^# `* m' B [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: M- Y( @8 Z5 ~9 W
( c/ E- ~* ^1 j+ J/ s3 ]7 d
# U: G" d; K& Q; K S! L |
|