|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( C; r& o& Q; t& M' k# C- [code]EDMA sample test application& @# e/ Y2 s0 f2 ^' Q) U
- /*
G. m) s& }7 u; Z% \2 T4 A - * edma_test.c- S: D: E3 ?: @ Y9 R
- *
7 E/ m1 J% G# L- F" b - * brief EDMA3 Test Application
" F6 X$ R% \* [2 H8 Y - *
# \ N7 }1 N( g6 m+ R: I- w! a - * This file contains EDMA3 Test code.8 V- O1 e5 F; I: E! T5 i# s
- *
/ F+ N7 Z# v4 c8 i, B; Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" R4 O2 v5 Z. Q, w: g' u9 C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! q& w+ |: _: i9 B* ~" ?9 K - * TO CHANGE.. r$ X/ B" ]6 D& _
- *
5 Q$ C* J5 m5 q. T7 H9 J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 ?" g# u P# a2 I' e0 v& S
- *- I8 S$ w+ o1 U4 c; H' ?3 k
- * This program is free software; you can redistribute it and/or$ [! r1 Z/ O$ H; x3 T
- * modify it under the terms of the GNU General Public License as) s/ g. y9 F1 L5 C: W: f( M
- * published by the Free Software Foundation version 2.- }# `" f. k: i x4 U9 X1 h
- *0 W7 b9 E* [. P3 P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% M* U4 b2 B( A7 L7 f3 L! s# T) l2 P - * kind, whether express or implied; without even the implied warranty( w9 w7 U7 l- e5 i% L$ @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; V( |5 L+ E2 P$ y9 D - * GNU General Public License for more details.
# ], A" _$ i% m3 Y: w - */0 K8 @4 a5 y; { j
- 0 \% k: H# f- x
- #include <linux/module.h>
4 }) x. Z% C2 n% O) z I9 x4 e/ f6 E - #include <linux/init.h>. V" R; ~5 H# c v6 ~
- #include <linux/errno.h>: B2 `8 Y3 ?5 W: @: F: s
- #include <linux/types.h>% }( y u, Y' Z$ B5 H8 }0 s8 X) b
- #include <linux/interrupt.h>
) c) W2 _# U+ n- _" w% g5 X& r% e - #include <asm/io.h>
* E2 |& t9 n; P - #include <linux/moduleparam.h>
9 r( h3 w& u, ~; D - #include <linux/sysctl.h>, X7 r `) j2 ]$ @6 X0 ?
- #include <linux/mm.h>5 h. {! ]: a) b6 ]8 T6 C' V
- #include <linux/dma-mapping.h>
2 g( p8 r; ^6 L - 1 A- J5 H& P% C" g, R
- #include <mach/memory.h>. A \4 r% b% l; |* h3 W- w
- #include <mach/hardware.h>4 S9 K5 k8 }2 x
- #include <mach/irqs.h>
8 O( q9 t( V/ Y6 L - #include <asm/hardware/edma.h>1 \8 e* G+ ~0 Q# Y8 Z, k0 P
( {! P; V* u2 l+ E& `- #undef EDMA3_DEBUG+ S: M. w& L2 A; w) a7 _5 G: L
- /*#define EDMA3_DEBUG*/
* H3 u7 `0 I( }4 m
- L& Z0 \0 l8 _8 i, L7 W- #ifdef EDMA3_DEBUG6 y. {5 U. T$ l& T$ h. a) T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- X' ^. T6 h. A! v6 [( H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; w" H. X0 Z5 R' Q7 b9 D6 G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 i, m( P, L* J% I- T - #else
( Z# E ^5 Z; A. b2 Q4 q - #define DMA_PRINTK( x... )6 O! a M' p d: Z$ V
- #define DMA_FN_IN
2 g$ Z$ F' y9 O( X+ c; A - #define DMA_FN_OUT) b* v( l4 \9 T0 L
- #endif
5 J% @* u3 a. T/ n; w4 e. O
! z( c r; s( `2 n6 w$ H7 \/ S* j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 L6 r& U* \9 J. @
- #define STATIC_SHIFT 3) t. _1 L% j* u' o# F; j$ u# N3 t
- #define TCINTEN_SHIFT 20: `; I8 p! [' ]* G1 |4 O1 E( U
- #define ITCINTEN_SHIFT 21! _/ @; o: e3 w
- #define TCCHEN_SHIFT 225 u" C* i! m- p+ R+ d% k4 v* y! Z
- #define ITCCHEN_SHIFT 23
6 R" D: ?1 m, v: G" ]! I5 @ - ; C$ B' v/ e3 S, E
- static volatile int irqraised1 = 0;7 ^: @, \8 l' v) ^1 h& G5 ~
- static volatile int irqraised2 = 0;
A7 D1 y3 \8 v# t) Y
" V& R* f6 P* Q) v! ]/ q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 M5 N% y4 p" |0 |$ Z( N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) e. H7 z) [: Q* j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ h+ W( ?+ B( s Q
% U4 y8 p0 ]/ y- dma_addr_t dmaphyssrc1 = 0;
5 G [: W7 F6 L) ?1 N1 R. K. W& t - dma_addr_t dmaphyssrc2 = 0;/ a8 ^% r/ B4 L- N0 f
- dma_addr_t dmaphysdest1 = 0;
' H" M) G9 I5 {* @* o - dma_addr_t dmaphysdest2 = 0;
/ c4 Q ~7 t8 ?4 l0 h; Q
; W$ [) g! h: Z2 U/ z, _4 N- char *dmabufsrc1 = NULL;0 a' U/ _9 {/ T# w. V
- char *dmabufsrc2 = NULL;
0 j. D, R- k8 M6 M7 V: _0 H! U& t - char *dmabufdest1 = NULL;
$ J4 u5 L% c5 l - char *dmabufdest2 = NULL;2 p6 E3 x F' @/ Z) @6 p- d
- & R$ l' F8 h9 ^
- static int acnt = 512;
! m: P6 ~4 f* y" W - static int bcnt = 8;
5 t" t# n: L4 n0 z9 [+ H - static int ccnt = 8;) ]7 t/ e7 N7 \, N
& r# f: Z5 `# B1 A4 F- module_param(acnt, int, S_IRUGO);7 @* ^" y8 E3 u
- module_param(bcnt, int, S_IRUGO);% k0 l2 I' u& y4 p8 N
- module_param(ccnt, int, S_IRUGO);
复制代码
+ G4 ~$ V' Q2 d2 N. R z' G* e% l& D/ l) D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ i, P5 [0 g4 \$ \4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 I( B1 Y, ?$ T! ?7 u* b$ G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" J( s! B% M; ?- Y' v8 y
1 ^5 v' f$ {1 f; X/ i. N: R7 Z* O# O8 ?2 i- y* m" p8 n0 P
|
|