|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 T# W0 i, U0 K5 z
- [code]EDMA sample test application/ s v8 Y! X* y& S
- /*5 c6 q# H: z g: w& ^) m8 k
- * edma_test.c a( s6 h) m( T7 ^
- *9 Y% Z$ ?. R4 R4 U: w% h
- * brief EDMA3 Test Application
) p+ b5 K) O! S/ c; I: R - *
% ^2 v/ C; c9 X( y0 Z) M: y8 V - * This file contains EDMA3 Test code.9 J0 I* g5 P: U# H, X: e
- *
9 X" w; N& S( p8 N. h% R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ c' \3 n Q- T4 Y+ Z) r - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 r3 o- p2 s- x, s+ n& A5 {
- * TO CHANGE.0 V8 ^* c2 N, e
- *9 z" w/ ?' K( W* I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ a& h7 u3 K: J. O - *! x$ W5 k g( k! G& d4 n9 h
- * This program is free software; you can redistribute it and/or9 W5 T8 `5 M# U+ R' I
- * modify it under the terms of the GNU General Public License as
: \) }: T0 K; ~' t) } A - * published by the Free Software Foundation version 2.- j( V6 @/ X4 j
- *
1 z; H) p" ~! T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 T f3 ]) l5 p6 x
- * kind, whether express or implied; without even the implied warranty
! \& a; ~ C; D7 j. S1 A% ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ q; |6 A5 W# c, X - * GNU General Public License for more details.
7 A* Q2 o* r6 H( a+ g' C$ w - */
5 C: R% c4 I5 l- ^
0 C& m% N9 ?1 y, y) @, f- #include <linux/module.h>1 \* b, c6 L! ~* j0 c
- #include <linux/init.h>
& O8 m; z m* y7 B: @# G$ L - #include <linux/errno.h>
) v' q. J5 x+ R Z' q+ U - #include <linux/types.h>
6 q6 H3 T8 I' k0 x7 |" A& |' [$ E; T$ K - #include <linux/interrupt.h>1 w8 s3 v' a$ ?3 H
- #include <asm/io.h>
7 |5 k1 N' ?( E$ J6 W6 E! r - #include <linux/moduleparam.h>
) m$ s# s* I0 U: C0 R y+ l - #include <linux/sysctl.h>! X* u$ p; i/ I; R: ^4 D
- #include <linux/mm.h>
+ l! g) w) K* y - #include <linux/dma-mapping.h>
! \" w$ s1 m3 E% m - , O( O( e/ {+ n
- #include <mach/memory.h>
5 _, E6 a8 `8 b; Y, D. z' M - #include <mach/hardware.h>
! i. @3 R0 [) u1 |2 h - #include <mach/irqs.h>& }: [6 |2 a1 Z' w% q/ z1 m( e. k+ m
- #include <asm/hardware/edma.h>1 P" t( l& d- e3 E
* O$ x9 h" b9 K3 K2 R- #undef EDMA3_DEBUG
5 }. D/ Y/ x) a$ v$ H- v' m* I - /*#define EDMA3_DEBUG*/
4 q+ v4 _8 Z! K+ x3 d: \% H - 0 d' o+ X% l+ R5 Y( K$ R8 _; S2 r4 X
- #ifdef EDMA3_DEBUG- F9 }5 z4 c$ m# O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& ^* x k2 o6 e2 n! \) L6 \& s6 J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 c+ ^0 S4 r8 Q: p3 z" ^0 l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* ^" Z' {/ I r9 o; k7 f - #else
% ?$ G* t' ?) S ~ F: b/ J1 w - #define DMA_PRINTK( x... )
% a% B' s7 w+ ^+ ]/ @ - #define DMA_FN_IN7 C# k) O7 F! v( Q7 U1 n" G( v
- #define DMA_FN_OUT
7 k0 ~* a/ i& @9 J: m y* u - #endif
9 F3 L9 |% X3 N' i, o' i* I6 ]4 Q - 8 O( O# `8 E3 V/ ?/ G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 p D1 L0 Z' v; @! o7 n& X; ?2 N* B. R
- #define STATIC_SHIFT 3
: d0 L" R$ x9 O( E% l - #define TCINTEN_SHIFT 20" z# D0 M2 u6 l Y
- #define ITCINTEN_SHIFT 21/ N; K) f% W" c* A" X
- #define TCCHEN_SHIFT 222 J; `5 R C$ P }% ^% i
- #define ITCCHEN_SHIFT 23
* D& q6 x# i. u; ~$ M
2 s* L% {( d3 _- C% F% N' D7 D- static volatile int irqraised1 = 0;5 d X6 f/ Y' z
- static volatile int irqraised2 = 0;
: b- |( |5 O; r" v* q - : u9 o8 {# B- y; p% ?
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& Y3 i0 D; P% L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 L/ ~8 B2 |: q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); G* r+ z2 B. e$ r$ ~
- ' C5 k8 I6 T# V- l; ?0 X
- dma_addr_t dmaphyssrc1 = 0;+ ^4 F0 y/ B1 I5 u/ _/ y' W; P/ R
- dma_addr_t dmaphyssrc2 = 0;
* @) e" Q# f$ R - dma_addr_t dmaphysdest1 = 0;/ l9 y B9 I: O
- dma_addr_t dmaphysdest2 = 0;
- g9 L4 `. W" U: c* L9 H$ | - ! k+ v, ~4 t8 ^+ L1 e& c' \
- char *dmabufsrc1 = NULL;
$ I+ x) e3 ]% _, d0 { - char *dmabufsrc2 = NULL;: i- v5 Y& E& `8 `& B$ n' s9 Y9 ]
- char *dmabufdest1 = NULL;4 r; W) I* ]$ x3 J
- char *dmabufdest2 = NULL;
, i4 K v7 p: `& f. X5 \! S! n8 n
- Z4 A, ?$ ~1 ^9 ^- L- static int acnt = 512;
) C; |( I+ v: g% {* S4 ?% S4 f1 j - static int bcnt = 8;
1 Z5 T, j4 c, V6 k' N6 B3 c: z - static int ccnt = 8;
5 H7 B6 P* }+ |, Z - ! y; ~, W$ ^1 E. |
- module_param(acnt, int, S_IRUGO);: h3 a! V; E* U
- module_param(bcnt, int, S_IRUGO);
2 ] F" b1 K) T0 Y - module_param(ccnt, int, S_IRUGO);
复制代码 * t6 a/ I9 i% u& M2 m; ]
$ ^- @! C+ D$ Q2 Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- F: n8 ?8 f2 h" b3 v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ u' }, O7 Q, v" D5 C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# S) R* P+ \: m1 d+ m2 u
1 ?7 n2 E, H* ~& D+ d; V6 D
& {7 @6 B+ W- ^ |
|