|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 w2 Q! |* p5 I; _' k, h: V
- [code]EDMA sample test application
6 {2 k2 Y& C% ?' d/ k - /*0 k1 u- C5 ~) @1 x
- * edma_test.c6 \, N0 C3 p0 e4 O
- * ], D% ~) j/ o$ c& K0 {
- * brief EDMA3 Test Application
V- e% V8 z4 [$ [3 q - *
: ^; f3 V3 G" e - * This file contains EDMA3 Test code.7 Q2 Q$ G- r- P* L5 g+ l6 n: v
- *7 D# b! c) _$ m( S( Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 \# C; |0 ^- ~9 l/ k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- Z& Y, Y3 p2 g8 h3 O9 R% E8 U$ F2 @4 N - * TO CHANGE.
5 Y4 h. q6 {; m8 L+ S3 Z* ] - *, @$ t y4 j: j8 I+ V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 M0 I- T e) g3 v6 i" y" Y K3 S" B - *, }9 S ^" W" b. p# v
- * This program is free software; you can redistribute it and/or# k8 }8 S6 v- ]7 T' r8 C
- * modify it under the terms of the GNU General Public License as: \# y4 ^: a( ]7 P# W+ \
- * published by the Free Software Foundation version 2.
$ b! r1 i/ c9 j+ l# Z - *
# ~) ~, ?/ G; U: N6 V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- H0 U% _+ A: ?
- * kind, whether express or implied; without even the implied warranty
Q4 r2 s1 g( h! L( H6 g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the k6 A, k. u, t- ^9 M
- * GNU General Public License for more details.$ X% B/ |$ B, O
- */0 D* a' v, F3 o9 r( r
- ; B5 }4 M4 r1 ?& E- o5 Z
- #include <linux/module.h>* j) ~6 L3 x( P' L# Y
- #include <linux/init.h>
8 e8 R8 ?1 n0 S6 f - #include <linux/errno.h>
) m! D6 O. [/ c - #include <linux/types.h>
/ O/ y0 R" n5 ]) x8 { - #include <linux/interrupt.h> S2 W# F2 m8 O2 {" v
- #include <asm/io.h>
( a8 X3 Z$ a" c0 d. ~ - #include <linux/moduleparam.h>* D& j6 Y- l. [6 x
- #include <linux/sysctl.h>
& h3 E# T+ c4 _ Q# c4 _7 [# Y - #include <linux/mm.h>
# N4 i! e) D% |% r1 r - #include <linux/dma-mapping.h>) D5 @7 e- ~1 g1 m! `! S/ U$ E4 |$ L
9 r7 S {+ `7 w" x ?5 L2 W- #include <mach/memory.h>4 m2 \" |" ~/ f7 G3 r7 r* O7 a
- #include <mach/hardware.h>9 v0 W: J* x$ {& @/ K
- #include <mach/irqs.h> ^5 H9 p( V- k3 K. S
- #include <asm/hardware/edma.h>
$ c& F( m/ n6 V4 H& i# P - " w6 b8 L7 z+ C7 K
- #undef EDMA3_DEBUG8 s4 H4 ?& {0 m! M4 H
- /*#define EDMA3_DEBUG*/1 f0 M4 [0 n3 C/ h* F! o
6 ?) k/ I/ f6 i! A2 L, y* S6 L3 ^- #ifdef EDMA3_DEBUG0 s; Q6 ^. q+ V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 r3 D0 h/ x5 p; L1 x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 c2 W$ I: H% w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 A3 J0 l' e5 E( }. h6 g - #else0 J5 ?' Z% u4 z- {& G+ x
- #define DMA_PRINTK( x... )
& \; V7 Z" S2 W6 `" O: ` - #define DMA_FN_IN6 F$ }' l, o! T9 _& p
- #define DMA_FN_OUT. L* J- D9 i7 c! g" z
- #endif
: X9 |8 ?2 U$ h. W5 o
( l; x2 E1 b1 N& U* i) E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 I4 r& w5 ^) J0 y - #define STATIC_SHIFT 3
* r$ _% S' |2 H5 Z |* A - #define TCINTEN_SHIFT 20/ B4 O/ f/ t5 c1 y8 q7 m" ]# i
- #define ITCINTEN_SHIFT 21- a: B/ c5 T) o9 ]0 M
- #define TCCHEN_SHIFT 22+ V+ e/ L- T" ]: Y- E0 x% l1 ]
- #define ITCCHEN_SHIFT 23! ]' X. r. {# S
7 {$ K }% G( h$ _8 H- static volatile int irqraised1 = 0; v5 e- M1 Y& |) h
- static volatile int irqraised2 = 0;, D% y! S. R4 d
- 7 U/ @0 y1 Z3 Q. E0 c, f6 `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! w2 \% N4 v" } m% ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 b; \1 H8 v G, S. J- [$ u
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 [: @8 r& s) r2 E$ ? - ' r" F. f0 f: U: Z" O1 `
- dma_addr_t dmaphyssrc1 = 0;
: D7 L" `! ~3 T0 J - dma_addr_t dmaphyssrc2 = 0;/ k. \7 Z, c* `- Y) B6 J) _4 N9 S
- dma_addr_t dmaphysdest1 = 0;3 x0 a/ ?$ `' q- a
- dma_addr_t dmaphysdest2 = 0;
; y; @1 s# v- M9 X2 u( t; ?
1 H8 s1 Z. H% C0 |4 K- char *dmabufsrc1 = NULL;: H! A' V* Q3 l
- char *dmabufsrc2 = NULL;! P/ U% ^+ X- |6 y; f
- char *dmabufdest1 = NULL; }8 r x7 C6 I2 J+ M* h
- char *dmabufdest2 = NULL;
) n( K8 r" R0 E - 0 k; t- v8 P2 v+ d9 W
- static int acnt = 512;* k j9 |* s9 f S# m# H
- static int bcnt = 8;6 @* v, ~6 {" D5 n5 V1 y0 W. E/ w
- static int ccnt = 8;
" ~% B3 V5 }" F$ W
1 C6 Z* D5 N# H$ z2 O% ~3 c) N- module_param(acnt, int, S_IRUGO);
1 t% Y9 F6 x) t4 R( G, d - module_param(bcnt, int, S_IRUGO);" \% w* r9 ` ~% u1 ~5 M- B
- module_param(ccnt, int, S_IRUGO);
复制代码 0 S; E. ~/ a# d8 `6 b
* T2 o& u1 a8 j/ a3 R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 Y) a/ T ~9 Z' e. j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 S# p. K8 i8 i4 ]3 G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
Y$ H- c6 N1 _# f% Q, q# V7 X
2 s+ e7 y; Y: `% ]; R$ R- p: ?& m- t5 e2 }$ M5 u
|
|