|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 j4 @% U& ?3 O$ f. t' E
- [code]EDMA sample test application8 a! L+ z8 q8 n0 N( G% h0 u. E2 P
- /*, z3 L. K. `0 T5 Q
- * edma_test.c
' q2 d) n X* F( ~# H9 q7 U, k% c - *
2 G9 S/ n' m/ X7 y( W - * brief EDMA3 Test Application
5 w* c# r1 l5 P* x; O - *
9 Q- J& G8 |9 I& y - * This file contains EDMA3 Test code.% O( W* f s6 z4 R( ~
- *
! j0 D8 M1 Q2 `) b3 R, y* L2 e" H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 L- k9 r% i4 X/ d2 q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- p# X1 o P3 g% G& g - * TO CHANGE.
H; {: J& ^4 \% y1 T% K8 e: _- i - *% V( H2 v2 L( \3 x% T# M9 ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, O# q6 n) R( z. f6 _ - *6 ^- g- w, u/ U- h/ L
- * This program is free software; you can redistribute it and/or
" e0 P9 `* \9 ]) Y - * modify it under the terms of the GNU General Public License as$ d& T" Y' S- {2 F6 q: m
- * published by the Free Software Foundation version 2.
o1 B7 ~0 e( R1 `% U E - *
, f$ p+ q8 r. j' ^% i+ c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. W1 q `, t. e5 F& g9 r' D - * kind, whether express or implied; without even the implied warranty3 t/ b6 W D* ^: ?3 s5 |3 j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% c+ P6 m, \9 z. ^5 [9 @
- * GNU General Public License for more details.
0 ]1 v: f) I a P. t5 B( }* S+ q - */
/ V+ a) j0 e5 u7 g5 G; H7 j2 Y4 u6 C
0 G5 h9 b1 j# F6 X- #include <linux/module.h>* m; n, V' i1 X8 k* G
- #include <linux/init.h>) o" j/ |9 [5 `: c5 @; ^
- #include <linux/errno.h>3 `" p0 W. R. D
- #include <linux/types.h>* x* h4 W9 C! |/ }! j
- #include <linux/interrupt.h>
; U) l ]0 k* z! x5 P - #include <asm/io.h>
( \) M1 M* M8 [; n: q - #include <linux/moduleparam.h>6 t( I3 M. ?, c" G5 J/ M
- #include <linux/sysctl.h>, d# D) A" {7 @
- #include <linux/mm.h>
- ]' l) T% r5 U5 ]3 Z8 J& ] - #include <linux/dma-mapping.h>+ n# a5 H9 e6 ]6 l8 L S1 @( K
4 F% T; q1 c d5 c9 n& }& f# z- #include <mach/memory.h>: W5 f: @" S+ b9 E7 a3 @1 Q
- #include <mach/hardware.h>
6 M* E; e4 _6 j6 R, z - #include <mach/irqs.h>/ o% [2 k% g: P# z* B. y
- #include <asm/hardware/edma.h># E8 L5 M' x3 H g' y
- . q9 H p* |- w" ]+ t9 x, Y
- #undef EDMA3_DEBUG. U5 T( j! D' s: G
- /*#define EDMA3_DEBUG*/
, [0 x7 u6 F8 N+ U
j! `0 P! d I4 t, X* v( \, i- #ifdef EDMA3_DEBUG" }& C7 G8 y' S, u, k/ h1 R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 |& C. H- G& s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: t q+ T2 k0 R4 j0 N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 f' @/ d4 u& C/ w* K
- #else" ?% T9 H- q, I; X* ^, ]
- #define DMA_PRINTK( x... )4 c3 N- G( D% R" D8 p
- #define DMA_FN_IN( C0 |1 F1 z3 M$ Q8 i v' G
- #define DMA_FN_OUT
7 E( ]4 N$ ]; F$ d. X3 Z - #endif% y* f* @ \4 [6 G
- # Q T" S5 X# P9 Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( `! u7 g2 B: v, N9 @: \0 U: C2 X2 ^! _7 T2 h
- #define STATIC_SHIFT 3
/ g \4 z) T% ^' o - #define TCINTEN_SHIFT 20( c* \/ \" Q& w" u3 O+ k; p% Z( P
- #define ITCINTEN_SHIFT 217 _; e8 {+ E3 g7 g) j
- #define TCCHEN_SHIFT 22
- R% U3 N2 B" ~' b$ R% S b - #define ITCCHEN_SHIFT 23
& ~* i& m1 [6 w5 U x. O - 6 S+ G- L) V9 T& F. m& h. d$ F0 ?
- static volatile int irqraised1 = 0;$ G! j" A2 ]4 I. X
- static volatile int irqraised2 = 0;2 d( ?8 K! d8 E1 N- n n
2 K6 e9 v4 y' s+ z$ D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! i* h/ T8 [ S) p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ w. r! H; j. ^" ^1 N: D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% X, ]' Z/ f- X9 F# x3 ~; E8 k - - ~0 R0 b. a3 K: z6 G
- dma_addr_t dmaphyssrc1 = 0;/ g- i; h A+ v: p7 R2 T2 a
- dma_addr_t dmaphyssrc2 = 0;
: n' U0 z8 {! G k( n - dma_addr_t dmaphysdest1 = 0;
/ e/ ?/ L( @3 ^& W, d, D - dma_addr_t dmaphysdest2 = 0;! `. r8 ]" ^7 l, `/ M: K
5 n8 B$ W$ N$ L* L- char *dmabufsrc1 = NULL;
& `. p4 e8 `5 L" Z) [7 m - char *dmabufsrc2 = NULL;2 y6 b1 r# b, R6 r* ~
- char *dmabufdest1 = NULL;
5 z$ z6 \1 n- D/ `+ i4 E8 i - char *dmabufdest2 = NULL;, @' T; {9 X3 w' W$ v z
- 4 e7 s2 J; p n4 k6 }+ q* M M1 d
- static int acnt = 512;
( n9 |( H9 f: k - static int bcnt = 8;
) W7 D8 p0 z& ?5 o, d. m' u - static int ccnt = 8;
& m+ y( D) Q& x2 C+ n- `
2 }/ v; b6 h! R8 {( W; ]1 L- module_param(acnt, int, S_IRUGO);
& y8 c5 c+ w0 D* L& D - module_param(bcnt, int, S_IRUGO);
* V+ q) ^( B' @$ V) | - module_param(ccnt, int, S_IRUGO);
复制代码 ( [# k" k# J' U. r* d1 _' v8 l
% t0 Y* B0 V$ _. Q- t$ R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' C8 g- x3 M. 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 D5 y% Z' [+ I' t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" i. ]8 G# n# s3 O+ S( s# m a
: J. f6 o4 e7 Z) y# [" t) y# T- X) Q- \7 r6 Q$ a
|
|