|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 V% [( Y, l7 k6 h2 I4 B- [code]EDMA sample test application/ L' g3 g! l$ G( }) p, \5 V5 g
- /*
7 [% |) x1 |7 u' a6 j. g& D - * edma_test.c/ I7 G0 L: k5 h3 |6 o
- *
- e5 b7 F- ~7 m: | - * brief EDMA3 Test Application9 ?0 \% f9 G7 D/ M* f8 \
- *; s7 Q" V* ^# G8 a) d
- * This file contains EDMA3 Test code.) t3 e& n* M- t$ v
- *$ R! w; y D5 P1 F6 x6 c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 ?% y" r @& k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) @. o$ {1 C! h! F9 \( x5 _" |
- * TO CHANGE.9 @' V+ J3 O( ?' j Y! S
- *
7 q# g5 {* B, T( G1 u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% {1 d0 G/ b+ W/ K8 L, P" \/ e
- *+ q/ J$ y! A1 f! Y
- * This program is free software; you can redistribute it and/or
& m Q3 [0 g7 s% b" k2 @ - * modify it under the terms of the GNU General Public License as
' Z" S- u3 S/ I6 j - * published by the Free Software Foundation version 2.1 H, O( A+ F# f$ [3 j) d! T- V
- *
' o. U# W* D$ S+ X9 Y0 P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 J7 i* M; B, W; D; Y9 \4 n( ?& L+ W
- * kind, whether express or implied; without even the implied warranty5 @6 n% A' d- t# u. K) x D7 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" b5 j( Q5 w$ j+ O$ a
- * GNU General Public License for more details.
7 K- ?) \1 ?* `9 z7 } - */
8 j, [9 |" {" }+ l& Z - ) v. ], h9 ]( g
- #include <linux/module.h>: _1 t3 x7 G- G y8 Z
- #include <linux/init.h>
x& H3 m" f5 `& |- _# } - #include <linux/errno.h>2 ^5 G6 M6 C( e& p( n9 a
- #include <linux/types.h>
2 q! V, G2 y$ ~! Z! ^# Q/ @) R - #include <linux/interrupt.h>
3 x# Z9 B+ Z9 `1 P1 ~4 J! S- P - #include <asm/io.h>. ^: l) x6 [0 V* Y' |
- #include <linux/moduleparam.h>
+ O3 z m$ U) O, Z - #include <linux/sysctl.h>
( b$ s9 T3 O9 i1 i6 s - #include <linux/mm.h>
2 ~: n% l7 {$ [$ k" d1 m$ } - #include <linux/dma-mapping.h>* M+ O f- Q8 h7 r
" j' O* B8 P) y% a- #include <mach/memory.h>' V# J/ z: G4 M" H O# x! w) k4 C
- #include <mach/hardware.h>) o3 ?; a( F- f$ d# h7 E3 J
- #include <mach/irqs.h>; \0 g M7 S' }4 k) ]$ t
- #include <asm/hardware/edma.h>
* b/ Q. W+ ` L% R! y; A4 E& W
' O* [4 ?6 h M- #undef EDMA3_DEBUG
1 @; n# s8 X( a - /*#define EDMA3_DEBUG*/
6 L2 }1 o2 g- Q/ {9 C- d
* G& _ A9 p7 N2 b0 I( y- #ifdef EDMA3_DEBUG9 ?3 v4 q' v' E( n( I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ |4 L( |7 t) C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 t& S& Q) m+ ]0 o n! o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" B1 h9 @* U3 [
- #else6 h- P* e; ?/ p9 F* A4 N5 i; y! G. T
- #define DMA_PRINTK( x... )
4 y. {. a; {- G# Z+ K, A6 T+ e - #define DMA_FN_IN
2 l+ @1 B' t6 R- P" q n - #define DMA_FN_OUT$ L4 @6 T9 ]) q0 v7 Y! h8 t
- #endif
+ d& A# {/ w" d- W; M. V - $ K; n: Y G3 v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ R3 J/ C) r% E0 Y) [( e
- #define STATIC_SHIFT 3
j0 f4 H5 U! F4 x - #define TCINTEN_SHIFT 208 ~; h9 P) z( p8 L. p
- #define ITCINTEN_SHIFT 21
" o4 q, C( h% ?) r9 i1 R - #define TCCHEN_SHIFT 22 H4 d9 ~8 \; T2 Y1 a1 b
- #define ITCCHEN_SHIFT 23
) s y+ `& u5 f" `
' W1 c: _3 }3 h n! F/ c1 f- static volatile int irqraised1 = 0;
% V9 _( O+ m. w' h+ s - static volatile int irqraised2 = 0;2 s* m+ }% J- `& |4 z) c0 _
- : Y" @8 y" o0 V; `- ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 w! \' }# R% r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 m$ Y7 z- B- F! i* p1 z, P) l! s( o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Z( y0 @+ T5 c! R- ~3 m2 `
- / Q6 h! \0 j0 |% s2 X4 V. k: h
- dma_addr_t dmaphyssrc1 = 0;
. W8 F; K: W- {" ~2 A# P3 o - dma_addr_t dmaphyssrc2 = 0;0 `- X6 ]3 T' T5 V$ a! s
- dma_addr_t dmaphysdest1 = 0;
3 @. s/ R- r1 u+ F$ ^ - dma_addr_t dmaphysdest2 = 0;
# h9 M' b5 c5 a. u; _
3 l4 G ?% |9 a8 E7 Q- char *dmabufsrc1 = NULL;
9 B& V/ l' w$ h- j" x+ H - char *dmabufsrc2 = NULL;
$ p4 h, K! O! a( g$ Z3 q - char *dmabufdest1 = NULL;
- _7 m, r$ O7 A1 x$ V - char *dmabufdest2 = NULL;5 U+ n# }# }8 I6 X
- - E) ^- r! q5 N/ |# u$ ^4 F( U
- static int acnt = 512;8 P) J Z* `$ e; G
- static int bcnt = 8;0 U2 P/ M' G$ h/ [
- static int ccnt = 8;
( z2 [6 [1 B. J8 {4 X# N - ! b2 j, i. G; O3 e4 M# W8 x
- module_param(acnt, int, S_IRUGO);$ V) s& m2 z$ V4 y9 Z$ C, N! A
- module_param(bcnt, int, S_IRUGO);
6 M2 `1 j' k. q5 [ - module_param(ccnt, int, S_IRUGO);
复制代码
9 ?1 N6 B/ v) J2 t+ }4 U+ k* e* ?4 X. V" I4 A) R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 g; R4 g, e5 @, ^+ z; X. F* o: qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 E2 b/ i, Q2 y: ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 ?3 } l& M6 S4 I" p b( I$ a' O5 f: e; _# _" o
% `+ E ~2 A/ z# \" ]8 z. k
|
|