|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- r) x0 Y" @3 ~8 w0 a: ?- [code]EDMA sample test application1 B. C- R* P; ?0 d; Z5 Q
- /*
2 h; n# q* F! ]# G4 M- D - * edma_test.c2 H. A: P6 H: Y' T' O* \* v
- *) r( B; q: S: ^9 }* H
- * brief EDMA3 Test Application' C& G# }! _. e
- */ l4 U3 P9 h* g+ Q) A
- * This file contains EDMA3 Test code.- D v# ?& u6 ?, o4 m. B+ U
- *7 C( }) t8 d7 l5 r* V' B6 p7 w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ h. Z* U' F' t9 r8 O e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! Q+ f7 ?0 s* c: |
- * TO CHANGE.
/ M- N$ J- ^) H0 z - *
- h9 }9 W! g+ ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" O ~! Z7 [! w: h! x
- *
8 g4 S! v6 G/ w4 f" H. [ - * This program is free software; you can redistribute it and/or
; l3 |% h0 j* f( N" p* Q* \% v5 c! Y k - * modify it under the terms of the GNU General Public License as, N4 B; }9 y) E" ]) f
- * published by the Free Software Foundation version 2.
! x7 z1 E% ]' S - *4 v( w; d' j4 z& I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; D9 Y6 a S# F - * kind, whether express or implied; without even the implied warranty
% \# l2 o0 ?# a! b: a5 T) K; f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# T. P+ g$ y+ L$ m! p! G. c; B - * GNU General Public License for more details./ W$ H& v2 Q4 M# C. z8 K1 \, T n
- */) N- H# Q& x* c; I0 i; B
- " s/ i/ y; n% x/ r
- #include <linux/module.h>
' Y7 n/ r# G0 Z# f - #include <linux/init.h>" j. _6 f! a. f1 w; v B! D
- #include <linux/errno.h>
D8 u; @$ T: r" N# B* B& t - #include <linux/types.h>% ?# k5 I' J& g
- #include <linux/interrupt.h>
* |5 f' [0 v* T7 O6 C z - #include <asm/io.h>
& D/ r5 ^/ v8 { - #include <linux/moduleparam.h>
3 v* W4 `+ E! F9 P - #include <linux/sysctl.h>
' y+ p' A; B g/ t, d* J - #include <linux/mm.h>+ s4 j% U& j5 ~7 x# ]% v$ }% K; r
- #include <linux/dma-mapping.h>
, d2 J7 K/ Y# Y; J2 B+ B7 @ - 5 b, o; J P5 x; ]; i7 r
- #include <mach/memory.h>
6 O8 R' L- p6 k - #include <mach/hardware.h>* a0 t j' ~" a/ |% e+ C
- #include <mach/irqs.h>
0 R/ ?0 ]5 d$ N: } - #include <asm/hardware/edma.h>9 M2 ^2 @2 J* m( `
- 9 L0 M" m' a. D" j; ?, f( B
- #undef EDMA3_DEBUG
& J% R: U& |$ A( Z - /*#define EDMA3_DEBUG*/; q0 l6 W; r& [- }
- % s/ s+ d3 i& u( V. K& @7 X O5 B
- #ifdef EDMA3_DEBUG+ n1 p1 _4 N: }% R& ]6 y! [* _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* ^: T( |8 E( n* I; y+ v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' ?- K: J3 S/ z8 _6 k: b( Z, ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 r* Q4 @' i& I1 s
- #else
0 w$ M7 x; V# z; b9 m* J% @& u - #define DMA_PRINTK( x... )
) B# I, W8 Q. k0 u% } - #define DMA_FN_IN
- D0 Q7 Y8 E% K6 l! ^. g - #define DMA_FN_OUT3 q* |. `+ Z6 s6 H; @& _7 A" H$ G" V
- #endif
* W0 C6 F; r# q - @. e6 n( F j D8 P. Z2 R5 ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) q/ `8 b2 T4 [4 a
- #define STATIC_SHIFT 3" q& a3 L9 y: V8 J$ ~6 Y
- #define TCINTEN_SHIFT 203 r2 [$ Q) s. y% {7 w" F& q. \
- #define ITCINTEN_SHIFT 21' N: s. F* F5 ^* w
- #define TCCHEN_SHIFT 22
- t1 L# h( ?. `9 p+ @8 }. \4 c - #define ITCCHEN_SHIFT 23
2 v# }. ~5 D! ^" G# `0 t8 e/ O - ( q+ v9 v3 E: f. h( G
- static volatile int irqraised1 = 0;% W" x6 T( b1 Z) O9 h
- static volatile int irqraised2 = 0;" D; ~ E# Q# R+ J3 Z
- & Q" y2 g; ]0 I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ @' n5 D+ ]$ W! X5 j, c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 v1 K Z9 y' p: o! H s4 L0 b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* [0 t0 O4 j4 W6 M8 e. C
- 3 z( u5 K$ p+ j+ D, k9 x+ z- H
- dma_addr_t dmaphyssrc1 = 0;" P/ K& Q1 _2 m* U1 [8 X: y U. e5 m
- dma_addr_t dmaphyssrc2 = 0;
% T* T1 S v6 h7 f1 t2 e - dma_addr_t dmaphysdest1 = 0;0 \/ m. q& j- p/ z8 a' P
- dma_addr_t dmaphysdest2 = 0;$ }: s& R6 T" c: A8 x" a
- K$ ?/ v/ E! Y |1 t$ k& ?" D3 Q2 `. _4 e
- char *dmabufsrc1 = NULL;
' A! Q/ G, ^0 n0 q! A - char *dmabufsrc2 = NULL;
. o2 @9 M9 l O+ W - char *dmabufdest1 = NULL;1 M+ {+ d( ~# J" q2 V
- char *dmabufdest2 = NULL;
* y$ L( E- f5 j2 e
+ `9 y% H C1 U8 F% U/ S$ a. E$ S- static int acnt = 512;* l1 u; z6 w# S
- static int bcnt = 8;
8 C) ~! B5 E* E, r/ w8 m3 j" q2 l - static int ccnt = 8;
3 b- x( N! F0 w
! I1 Q# u3 l# z& Z. }& Q+ s$ O- module_param(acnt, int, S_IRUGO);
8 K) H7 }0 U' }& ^ - module_param(bcnt, int, S_IRUGO);
# ? e7 Q+ b* H* E" {0 K$ ~ - module_param(ccnt, int, S_IRUGO);
复制代码 5 Z0 b- J/ q0 d
- M, L. [7 ~4 m0 q+ U3 W$ o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 l1 c$ s M- S2 v4 o" H# F( U+ ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 v' w4 i5 s4 g6 B: F$ z3 s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 ^- p& l3 [, B& a! ^+ |
, x* b& V, ~5 n( B2 [6 w. w
6 K% L" W7 ]/ s. p* p
|
|