|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ G5 _: | H& I- [code]EDMA sample test application
( I. C/ b( b0 ^) O( v, x* j - /*2 ]+ l% E5 z% f `
- * edma_test.c
& `4 C" C4 R* g" k9 e - *" E. i+ E! B% ~, Q7 Q% h
- * brief EDMA3 Test Application% B* y: ^* j; O+ j+ j* |
- *
( I$ a% g" i" u x4 m% X6 P - * This file contains EDMA3 Test code.9 k% b, Y$ D8 @) E5 f$ f
- *' X6 i7 E+ Q3 z; U9 Q/ n/ A$ ^2 r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% A: \9 f# x$ R% d' o. A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ Z8 L! A. j3 ^0 l8 t3 |# |$ r4 }
- * TO CHANGE.6 p6 ` f! e. |4 V' b+ x6 v
- *$ M1 ~( x) n g* e4 B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( Q, w- k' ~" K/ _- v
- *
( _0 o+ U% k; v+ @! ~) s: [ - * This program is free software; you can redistribute it and/or
1 N& w7 t) x4 A - * modify it under the terms of the GNU General Public License as
, F6 r1 |- r. a - * published by the Free Software Foundation version 2.
# H4 l& n; u6 I1 K+ Y! ` - *6 X( N, L8 `/ d/ R0 E+ u$ F9 w' n: i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 i8 h. N ^' v' H8 Q k5 ] - * kind, whether express or implied; without even the implied warranty
; U* R9 }* K8 D, R5 `2 [1 N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 _" Y% v% t$ I; M2 O) ]( r - * GNU General Public License for more details.$ n! j q- u4 M% X Z6 ` T
- */
, c9 C0 i1 l1 D v/ {$ L - 6 M- M+ H7 P/ u7 T
- #include <linux/module.h>9 Q8 S* u ] j, }: d
- #include <linux/init.h>( K8 H! b( K* o7 L
- #include <linux/errno.h>
% o, c+ {) i9 o1 w5 A$ ^ - #include <linux/types.h>% _4 M8 M$ f" |/ W; G% Q! u
- #include <linux/interrupt.h>& W& y: z) ^9 X1 v- ?
- #include <asm/io.h>
6 @! S. ]5 ?* b# ^4 \3 f7 I - #include <linux/moduleparam.h>
$ q1 b7 H5 l" h* E; [# f - #include <linux/sysctl.h>, @4 n( b4 J6 f, |
- #include <linux/mm.h>
) I+ F2 k" j( m3 M, z7 k - #include <linux/dma-mapping.h>7 }1 v6 \2 @0 M; a" ]5 q) Q L
! s% Q+ Z. L( z/ J8 g# c. w- #include <mach/memory.h>5 ?( N, N0 w3 s) h
- #include <mach/hardware.h>: ~3 n4 o2 ^3 ?, K& U/ q, R6 W
- #include <mach/irqs.h>
% Z+ g6 {% l8 m0 O( @& m) V - #include <asm/hardware/edma.h>" m7 f% R% Q5 c7 z$ \
@( e! `6 E- v z; U- b, s- #undef EDMA3_DEBUG, }2 B Y, F9 P* S `
- /*#define EDMA3_DEBUG*// Q: t4 m6 `, S7 k
- ! D. z1 f) @! T5 O. o# M
- #ifdef EDMA3_DEBUG
; D" p5 J+ ]: }! _; Y% N$ {* w6 k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 G* d6 V9 G; z% x' e! l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), ]$ ~9 k4 K$ p& t/ }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 t' X3 s, u( j; K% A- Y2 ~
- #else* e0 L4 Y- r! }# ~, E1 r
- #define DMA_PRINTK( x... ), x$ t8 v5 w/ ]& B# r; i
- #define DMA_FN_IN
. V' { y8 c o9 `# S8 n/ i0 s - #define DMA_FN_OUT0 y4 |- g% {' q; _# _
- #endif
0 c5 ?4 |3 q# t# q
" l# t$ D. x2 D& k- #define MAX_DMA_TRANSFER_IN_BYTES (32768), w4 f9 V7 }( ~6 N$ d" Q8 r2 `0 D
- #define STATIC_SHIFT 3
( }! ^# ]# D' ] - #define TCINTEN_SHIFT 208 e( w. N$ t% ?' r4 w" X j3 F
- #define ITCINTEN_SHIFT 21; H! f# |/ r9 G$ {0 B1 `6 b
- #define TCCHEN_SHIFT 22' p& n# e+ e$ m, M; u
- #define ITCCHEN_SHIFT 23
# W _9 o8 v) c$ @8 a2 B - , `9 k+ {$ G/ D! r7 [) m
- static volatile int irqraised1 = 0;% ?3 m' ~' [' k% g- g. s
- static volatile int irqraised2 = 0;$ ]8 N* K2 P8 [# L, M
- ! l+ d+ E1 _3 r, v) z6 g/ ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ]7 c! j6 e! v8 t: @+ X7 c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& h& g! q5 b$ g1 z% z( N% F" o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ w" ]6 z+ X$ [& f) C) K# f* w - / Y' {2 z& q% \! I1 ?/ m
- dma_addr_t dmaphyssrc1 = 0;6 }& K# w4 y# F' i, V) i# X
- dma_addr_t dmaphyssrc2 = 0;: Q. n6 j- K( V( E3 v
- dma_addr_t dmaphysdest1 = 0;
9 B8 m1 _. r0 T" q - dma_addr_t dmaphysdest2 = 0;. G7 ~+ h: [' ~# ^9 t' e% s: J! E3 S
& C% B' L3 N& u1 O* c- char *dmabufsrc1 = NULL;
# F! C7 ~5 m5 m- H6 E9 n - char *dmabufsrc2 = NULL;; u& M1 H7 ~0 I
- char *dmabufdest1 = NULL;
8 v5 ]. ~* E: D# W% L - char *dmabufdest2 = NULL;5 J! z% C& b* A3 U$ N" N& A
- 8 ~7 x* d+ a. q8 Z5 N3 H
- static int acnt = 512;
! a) `- }+ t. Z1 S& s+ L/ O' p - static int bcnt = 8;. \% L' R$ D+ I# y8 m% p
- static int ccnt = 8;4 W6 G( S _2 X! u
! E8 _+ q8 p8 q" w- module_param(acnt, int, S_IRUGO);
3 y! g5 k( v- O0 z0 H( p% E - module_param(bcnt, int, S_IRUGO);
, Z8 a& X7 f- K" z - module_param(ccnt, int, S_IRUGO);
复制代码 ! _1 ?1 _4 a9 X3 S7 D0 |
- a' E* f1 W+ W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 o' @. [5 a. I& p2 I0 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( y0 W$ \1 W* S! ?, w& [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' ~/ `) R/ q8 A6 m+ f
0 C5 m5 i8 H- j p+ l% N# e; v$ e$ H# G9 c$ E# S _; L {8 j2 ]/ j
|
|