|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; w {6 f. S1 z9 l$ s* l: p
- [code]EDMA sample test application
& D2 Y8 P, D( T! ?* o1 _! C - /*
/ f% ~4 |1 K& h! c4 u& u8 U9 f9 h - * edma_test.c
( j4 w, d. ^) _ Q( J - *
+ Y0 u1 o8 [! F6 l8 @" A - * brief EDMA3 Test Application' k4 D. L. Q0 ~; `$ o. n+ b9 F
- *" |1 k& X+ }0 U4 s3 h: K9 `4 y) I9 N
- * This file contains EDMA3 Test code.& z' P! E( u2 |, M+ E& D
- *
- q! ]1 b# S% Z# E4 y; i* x9 u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 `( t- c7 T, O7 d! D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 [2 Y( Q' t, A$ }( P8 W# s
- * TO CHANGE." h9 o7 D; _' M9 I) R4 t5 R
- *$ O7 L3 w" ^* O1 K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) ?1 ]$ p4 i. {: ?. W
- *- b1 H$ ~) t! C! C
- * This program is free software; you can redistribute it and/or. _. a1 @5 @6 m
- * modify it under the terms of the GNU General Public License as" C- |/ S5 B0 y8 |
- * published by the Free Software Foundation version 2.
% a. \, B& W0 h4 e. t- W6 g* K/ r" U - *
6 }4 \. J/ L( T4 q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! ?. f. L2 h/ K$ B1 v7 ] - * kind, whether express or implied; without even the implied warranty) C0 a8 h, p a7 z& h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 b s: b" |$ ~' z
- * GNU General Public License for more details.
; M" M. r7 p+ x% j0 U - */
7 @ u: g8 d* o( p9 S0 w - 9 ~; O9 s0 A0 x4 ?( {
- #include <linux/module.h>
% w( C- ~ ]6 o# _+ P - #include <linux/init.h>
0 C$ t+ P: c% s: L0 J. } - #include <linux/errno.h>9 |5 `! }$ O8 u) R! D
- #include <linux/types.h>
- Z3 ]5 o5 d; Q5 l - #include <linux/interrupt.h># C& a7 ?' l/ U" Z9 ?6 W
- #include <asm/io.h>
9 W6 j2 H) [% g$ b) `, K - #include <linux/moduleparam.h>
% G2 O6 l% X7 p$ z - #include <linux/sysctl.h>
* ?8 W: N3 @% ?7 v+ d - #include <linux/mm.h>2 I9 E$ Y( u- ]3 x
- #include <linux/dma-mapping.h>! H4 Q# u! ^$ s( {' T+ p& d3 z
- 2 c. k7 u3 N2 S. H; J
- #include <mach/memory.h>
* I/ C& c7 J R3 S! D! X8 ? - #include <mach/hardware.h>
( Q8 x7 r9 g1 }$ P9 o$ k' N. G" n - #include <mach/irqs.h>5 @2 s% | ? T ]' |+ C0 ?5 ?
- #include <asm/hardware/edma.h>
% D: j; V# m0 t7 ^! Z! k# V/ ?
" ]) m' i/ F; x+ Y1 E- #undef EDMA3_DEBUG
# \: a# P. F6 e1 J) [% @, ` - /*#define EDMA3_DEBUG*/
6 w$ p2 L1 \' O7 s! @1 Q" e
+ S: O% n0 b2 U1 _- {- #ifdef EDMA3_DEBUG
D x+ q2 d4 M2 z$ z5 v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" V& S3 I8 P6 ~$ E4 F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 @# Q5 i0 s- L/ ?: n5 x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) b/ B4 e% @% z
- #else
4 Z+ R; P" ]% E+ O. ? - #define DMA_PRINTK( x... )* m4 p( T; E* F0 d
- #define DMA_FN_IN
) {' k- k6 `; R! d. T - #define DMA_FN_OUT
1 e& B: r: X0 T* H2 H - #endif
/ d$ U- l3 f+ X! h" Y) x - 3 A! r* K$ E9 b# Q" K1 T7 ~+ K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 {6 X$ _8 t) U) ^* |
- #define STATIC_SHIFT 33 n# H6 u4 C$ i/ Z- y
- #define TCINTEN_SHIFT 20! n, w2 O% ~2 c# i
- #define ITCINTEN_SHIFT 21
2 S- Y( B. {( H, S$ h8 H' x - #define TCCHEN_SHIFT 22
- h3 _2 s% u! H$ S4 L - #define ITCCHEN_SHIFT 23
) x$ \8 Z# z- `0 r, Q - 4 l* i! G& |7 y6 i$ r" o; \
- static volatile int irqraised1 = 0;+ } T$ o+ a+ m( ` K
- static volatile int irqraised2 = 0;5 \4 d* `! I& N: o" J: _
2 Y! |# G' }3 E" G* J1 l( N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Y5 G7 @- C f4 W3 k4 g! D8 o7 |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 O9 |2 K9 }6 R9 o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, J1 z6 T/ Q8 X; X
- ) y1 G0 v8 K/ g4 e, [4 M L) ?% p
- dma_addr_t dmaphyssrc1 = 0;
2 y6 F; d* f) C: j# R* l - dma_addr_t dmaphyssrc2 = 0;; C# u s2 _4 s7 ?& D/ l g
- dma_addr_t dmaphysdest1 = 0;& Y% H; C- v" @ I+ ^
- dma_addr_t dmaphysdest2 = 0;1 `# Q+ E( u: C/ {8 P5 n
" N- u h5 D% \5 t5 \- char *dmabufsrc1 = NULL;
H5 R5 t- n) Y& r; f* ~ - char *dmabufsrc2 = NULL;
1 M/ p% F7 E3 m/ M/ N: }% B5 L - char *dmabufdest1 = NULL;7 n) o5 e7 Q- g8 _
- char *dmabufdest2 = NULL;
% H! h- f9 _& l, k+ w* G/ m
( y2 K* s( { H W+ x, `( _0 X7 n/ h- static int acnt = 512;
2 L9 y0 Q/ _# y2 U6 L- |3 K - static int bcnt = 8;
& n- Z9 U4 s/ s - static int ccnt = 8;* k9 z7 S7 p1 Y9 {/ s+ @% f
( I* w$ y8 o. m! D- module_param(acnt, int, S_IRUGO);
4 @2 S8 r# e7 V, p9 t* t# j7 ~ - module_param(bcnt, int, S_IRUGO);+ w5 z; s0 ~! a1 P
- module_param(ccnt, int, S_IRUGO);
复制代码
% o3 b" {) X0 i- A& `: \/ S H5 x, `7 [5 q) p$ X$ F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" E, d7 e. V& \! H1 ^% ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: k% ?% {6 z" S! A! h1 E& S! ]9 _; X+ g1 b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; l1 x! R3 d' R) ~
( I' c# O. I5 i! D* s/ v" D5 U& ]
|
|