|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & {' y& h# f& n) u5 O
- [code]EDMA sample test application
t' U$ a$ ~9 k - /*
0 ~8 L5 k8 s( R( P Z- P6 w3 r' _& o - * edma_test.c
3 c! |+ m. D, u - *
" I( G( p7 }) s. ] H1 S6 v8 ?9 j - * brief EDMA3 Test Application m& |- `5 o, C- Y% L
- *8 Y6 }1 v+ s2 Z1 y0 m# \% ]
- * This file contains EDMA3 Test code.# T6 h7 g$ U6 |
- *
/ ~) q+ [& w0 x+ p/ R% V7 ]; a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 R1 |* ?4 w2 o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- s4 ~6 A; q) Z2 y0 g- |
- * TO CHANGE.% F2 g' a0 z1 E) i8 D( s1 b
- *' y+ Q5 \6 T3 _( j) m" U# w: M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, J" }+ N- v; \; u! Y- N
- *
J! D8 Z0 [& F& X; b/ ?4 t - * This program is free software; you can redistribute it and/or/ n1 ]# d8 \; a6 B7 O4 {
- * modify it under the terms of the GNU General Public License as
! H5 \$ V4 _ i1 o - * published by the Free Software Foundation version 2.# }- X- J6 s5 K. Q' Q1 e8 R
- *
1 A F7 _+ [( f5 \$ v! L% p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 k0 H3 c' Z$ o3 D - * kind, whether express or implied; without even the implied warranty
9 \/ }5 ~; ^( O/ c2 z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 Y& X/ G" J5 @4 Y - * GNU General Public License for more details.+ _7 g1 ]$ P7 H7 {
- */
. s4 D% f" |2 x3 v- @ - * [! x3 f6 I3 c% Q* G, {( d* V
- #include <linux/module.h>
# ^6 ?, W! W: M: c - #include <linux/init.h>
5 n, A* _6 U$ J/ O - #include <linux/errno.h>" \" W; x* B# W- u' Y# i( l9 B3 R& G/ R
- #include <linux/types.h>
( v# I5 t3 b/ x) Y8 v - #include <linux/interrupt.h>
" x: O; r& `; q( `1 O - #include <asm/io.h>
; w5 t3 g9 J+ [$ ]- a3 X$ g - #include <linux/moduleparam.h>: h+ E" |7 G/ P5 t6 g8 A
- #include <linux/sysctl.h>
W g v4 [3 u* V8 h( Q - #include <linux/mm.h>
7 z; p" S! x- G# p0 Q - #include <linux/dma-mapping.h>
9 D5 p5 t) H: O - . O0 r5 y( u1 K# }% P
- #include <mach/memory.h>
9 @/ }0 v; |4 o* z - #include <mach/hardware.h>
0 t0 N1 V6 ], s4 y# W - #include <mach/irqs.h>6 E6 w7 z9 h- N3 V& u& _$ \
- #include <asm/hardware/edma.h>3 W5 n( N& v, }# D# ~
- # [. s" r* x6 `, U" `; k$ Q5 n
- #undef EDMA3_DEBUG
- h0 m1 C! x" B* N) n - /*#define EDMA3_DEBUG*/
- p: x, s# M* E3 ^) z - ' S, M. p3 x* l4 n
- #ifdef EDMA3_DEBUG
P' s, y; J: M5 A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) G7 I0 Q+ v1 n9 B3 C% g" Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 p; m+ ?2 z/ ]6 A {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 t _! x6 {% \; u# ] - #else
+ p: h0 W' H9 c" z4 F - #define DMA_PRINTK( x... )
( R7 y7 J* e2 {7 W( v$ ~ - #define DMA_FN_IN
% I. ^1 a: {: r$ k& Q) @ - #define DMA_FN_OUT
, ^8 n$ Q3 y( a - #endif
' ?" _6 H, n0 Y/ E& J
( o- ^' p" x8 q! H6 [8 t1 C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 O% u6 r6 t$ L9 u' E# P8 b8 K% ]
- #define STATIC_SHIFT 3
' p; @# }7 m0 Q - #define TCINTEN_SHIFT 20, U" ^$ `/ i: p
- #define ITCINTEN_SHIFT 211 Q! A+ |: h4 `$ G
- #define TCCHEN_SHIFT 22: d4 J8 W3 e3 c5 X. _( k
- #define ITCCHEN_SHIFT 23
- g8 M o, W- V' d+ w - 6 t3 E% M1 Q b4 L# n* I8 O* |9 h
- static volatile int irqraised1 = 0;
( v- n! F7 E9 _2 r - static volatile int irqraised2 = 0;
3 |9 s/ l; r0 A0 X' d- S
3 {4 _. _9 K- c# r: w. O; ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 U/ X, h% F0 q7 S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) V% C9 Z+ M) x: D# n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); x' u+ a" P1 o- @. c3 p3 [/ Z
- ; {2 v7 j3 i/ U1 ?8 u* D' \" h T, o
- dma_addr_t dmaphyssrc1 = 0;
' H6 c. L7 G; _! x' j, x5 m - dma_addr_t dmaphyssrc2 = 0;* {+ z$ j* ?# e2 |' Q1 b) w( u
- dma_addr_t dmaphysdest1 = 0;
. K0 b+ j6 g! E0 w- S7 P3 m - dma_addr_t dmaphysdest2 = 0;
% [& A! g! h9 E: d2 W/ |
/ E" F9 ^7 {% g: H- char *dmabufsrc1 = NULL; X" F2 R4 |8 ]# X
- char *dmabufsrc2 = NULL;
- A f; L( ?" B G" B- i/ ` J3 R- p' W - char *dmabufdest1 = NULL;0 i: g3 c6 R/ Y8 t4 l, O& o, a
- char *dmabufdest2 = NULL;
" |4 D& @& L) e; i; N+ d - $ `; h3 M. W' j" g+ h Q0 E
- static int acnt = 512;, [2 n! f5 N, S5 _! M3 {( P8 J
- static int bcnt = 8;
* N* }" l) H% |) d- | - static int ccnt = 8;7 J/ `6 I7 R2 R2 n' N) a" V
- 8 J( f1 O) C5 M* H: B4 p y4 ?
- module_param(acnt, int, S_IRUGO);; O5 L5 J7 v' F! d- b
- module_param(bcnt, int, S_IRUGO);) \' a H- |/ G
- module_param(ccnt, int, S_IRUGO);
复制代码
7 `2 a. Z: l/ b1 b7 c6 p* H
! H: @- ?! K' q u$ V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" y6 P: ^; f3 m5 a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 w, F( n) c- A' m; {" _% j: e9 U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* Y p D8 q9 F9 r4 k6 H8 |4 U! K6 u: a% S. [6 y
: Y U7 A& L. x. K
|
|