|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( Y) P; Y- ^9 Y4 Z
- [code]EDMA sample test application5 `$ D: s0 o* n& }! l# j
- /*
( A* O4 ?2 V4 }. x - * edma_test.c# _* `8 _/ z L$ b
- *( {: ^+ K F! C$ b0 v* Z, h
- * brief EDMA3 Test Application4 N6 ^6 [ M9 G4 {2 F: r
- *# n" O0 T5 B7 V
- * This file contains EDMA3 Test code.
/ B7 H, @2 c* ^2 `7 I { - *
9 q& v/ T. ?; \+ a& t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 {' F0 ]3 G. k: G" I/ M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ q" m# {2 {. w+ L# c n- N3 Q6 X Y
- * TO CHANGE.
5 N8 x/ V7 R6 N6 o. V( i! V' s6 r - *
4 }( H/ S+ W0 l8 j2 D5 F: x - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- H, X6 W# a/ O z" [/ o2 B" @
- *& t! f, F: g9 R) s% c8 s
- * This program is free software; you can redistribute it and/or3 X+ N9 g' l- }# U$ [; g
- * modify it under the terms of the GNU General Public License as
0 x& v y4 F# ]+ D% G) Q - * published by the Free Software Foundation version 2.% L6 y+ q/ _; X* t- X/ i, K/ t
- *
9 i6 @* W/ ~+ e( |( O% D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 T6 i& W5 ~2 ?, S# Y - * kind, whether express or implied; without even the implied warranty) M. E: h5 O* O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( m5 V+ @0 E6 U4 y
- * GNU General Public License for more details.& Q" {& M$ I2 S2 c
- */# z( t% h9 c' Q9 I: y" Z
/ ~& o/ d! ^& c0 P2 @5 ^0 j/ m- #include <linux/module.h>
9 O6 U% }" v" L2 a* p - #include <linux/init.h>: z! {# H) O0 \9 }
- #include <linux/errno.h>
6 J+ P3 q/ m, |0 @ - #include <linux/types.h>, a( n. d9 f7 k9 g$ U( F
- #include <linux/interrupt.h>4 v9 {, a1 t/ ]+ C
- #include <asm/io.h>
1 q3 u/ R% U3 l9 W - #include <linux/moduleparam.h>) w5 }. ~, c$ Z2 d0 Z( D! I/ c/ ^
- #include <linux/sysctl.h>; v/ k5 s6 X) b1 W6 e0 |
- #include <linux/mm.h>
1 }& |7 Y# X6 F& q - #include <linux/dma-mapping.h>0 m- P8 R4 q7 {' M9 P% @4 ^$ j B
- ) O- c" E* r7 o" t/ p0 [: r
- #include <mach/memory.h>2 Q! W/ q) m5 c/ g* [4 c
- #include <mach/hardware.h>% T& Z5 n* i, |. W
- #include <mach/irqs.h>
|; y Y; G: H& R - #include <asm/hardware/edma.h>" \" `: `* B% x4 `1 K
6 j0 F! O4 ]& J' i$ @+ G" u$ r- #undef EDMA3_DEBUG' e6 E) C+ i, R. t
- /*#define EDMA3_DEBUG*/7 t* S- p- G8 |& H7 ^4 O) k
- 0 |: M" v9 C# g1 B: T
- #ifdef EDMA3_DEBUG0 j+ h. ~" e. b$ O+ E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ S9 r! T& X! g( [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; ^3 d# `+ ~$ X+ l. W) H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 W1 n+ w5 P3 \
- #else/ m& q% f5 C3 [
- #define DMA_PRINTK( x... )3 @2 k6 [) L4 L9 l. x" Z3 b2 f1 w
- #define DMA_FN_IN
6 U1 M4 q" L9 ` - #define DMA_FN_OUT# r. e: S5 o, I! b
- #endif2 V$ R$ H5 I$ U6 P; U
- . k* c( o2 ~4 `5 {; R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) L* u; C2 F6 {& }+ ^. l
- #define STATIC_SHIFT 3
6 n% x, \5 I1 w% u: a - #define TCINTEN_SHIFT 205 x# J: E! I* ]1 ]7 B$ I
- #define ITCINTEN_SHIFT 21
7 ?2 b4 ^" Q5 O- o5 o - #define TCCHEN_SHIFT 22+ o2 a+ m5 q3 y$ c8 F9 h) G: r
- #define ITCCHEN_SHIFT 23! O' P8 K A1 p. g- B
- 0 ^5 K B7 d* S. k# \8 Y3 L S, ~, x
- static volatile int irqraised1 = 0;
) I( R0 i, ~9 Q6 \ - static volatile int irqraised2 = 0;4 y$ U/ m6 r! l/ {0 @+ B
7 H6 L s: k5 m7 ~. u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 ?3 f/ L3 k) E0 @) G: H. y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ?7 P5 m5 x+ e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) E$ A* M/ h3 k* B q
) w- t3 B! y) t2 H$ }2 }# ]7 X: F- dma_addr_t dmaphyssrc1 = 0;
* g# _6 V2 R5 Z3 \* }# w1 h# q5 _ - dma_addr_t dmaphyssrc2 = 0;3 E% t; j, W/ U2 S5 q7 z
- dma_addr_t dmaphysdest1 = 0;- J# H/ T9 i6 A2 ] O& _1 n
- dma_addr_t dmaphysdest2 = 0;$ w" Q6 g' x2 s1 @/ @% y
- ( y3 p! E- Y# v. m1 |2 }
- char *dmabufsrc1 = NULL;+ z1 |5 T! z8 g+ j: K
- char *dmabufsrc2 = NULL;
+ S! Q. U% Q) o+ Y+ z - char *dmabufdest1 = NULL;
1 P, r2 I7 Y$ g - char *dmabufdest2 = NULL;+ f4 C) {! T( M' d; E; y6 o/ Q
! {% }1 j0 z( w% G/ h6 i; R+ Q( L, c- static int acnt = 512;
8 C, v/ o# m, ?& R# F - static int bcnt = 8;; e+ i5 O$ ]- L* k5 ?' n
- static int ccnt = 8;* }# i. K% {- A& {
8 C" j4 P. m& E* Y- module_param(acnt, int, S_IRUGO);
3 `+ R0 O0 f& M7 ?0 f - module_param(bcnt, int, S_IRUGO);2 ~( D$ C+ ^; b- F
- module_param(ccnt, int, S_IRUGO);
复制代码
4 x, m! `, A6 f+ L2 E; C% G% \2 L2 \9 Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 }" Q9 m5 ^& ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: I$ G$ v2 i6 u" |4 v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 @, K" g5 h- u# [* d* H4 A+ n1 k' o7 O" t8 E9 h
! n* ]6 \6 f0 A8 q* D$ j |
|