|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. k% c6 H# G2 X/ j" D; _1 K- [code]EDMA sample test application8 k( e! ~! i* ^, `( d+ S3 I9 f. `' g# E
- /*
" R m4 |9 }2 l% H9 h' ] - * edma_test.c
* ?7 g, j6 N, }! d6 l. R6 { - *" y1 |- ~* q+ u' G: w: [/ Z
- * brief EDMA3 Test Application* p- x9 T0 }; I9 c
- *8 d& Q+ J1 l1 k' \( W& A1 a1 I9 w1 K
- * This file contains EDMA3 Test code.# j( j6 j. v: q% c6 B( C; e
- *& U% X* P& _! O) r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 O' J' C8 i0 ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( n' _5 {5 C7 p9 L; U) R - * TO CHANGE.1 J. ^# I. d- K; R# z; _- P
- *
$ ~7 R' s. h: p6 _$ a9 x s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 D- n# r2 y! P6 i/ w) u5 G
- *
7 T( k, p" J/ s0 V - * This program is free software; you can redistribute it and/or& x- F; [9 A/ m( z9 E }
- * modify it under the terms of the GNU General Public License as1 a; o1 k0 E1 {0 v
- * published by the Free Software Foundation version 2.( R2 }& I. F T7 I& c+ u
- *2 L( p" a, {) z5 P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 e2 ^/ t4 b. E& D8 o$ N4 P# G' d
- * kind, whether express or implied; without even the implied warranty1 `5 b- s9 o$ `7 ^" D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ~0 H; K; m% O0 T7 S& R# X7 {+ i% }
- * GNU General Public License for more details.
# Q9 {! k+ f6 e& A: V - */
/ T( ]5 y2 K5 e2 s
2 J* k$ w6 M$ z7 `) s- #include <linux/module.h>
) k3 K/ o8 Y& h - #include <linux/init.h>
7 M4 d1 L: a( h1 C0 { - #include <linux/errno.h>
0 O2 j9 `. ` R - #include <linux/types.h>
U$ i( ]2 D$ ^# X$ G+ o - #include <linux/interrupt.h>
' m; b3 `2 w1 Q+ C$ ^/ \ - #include <asm/io.h>1 k; p# P- o. m
- #include <linux/moduleparam.h>& B% z8 p p g
- #include <linux/sysctl.h>* w g5 y, R9 v7 k, \: L$ g
- #include <linux/mm.h>
; p- `, U5 c/ O0 _( `4 K8 W- q# ^ - #include <linux/dma-mapping.h>5 v- J x, P( j% v- D1 j3 p9 {
- 0 U- Q0 d2 E$ @6 k& P- G
- #include <mach/memory.h>
5 N" r8 S+ j% J' `" F* s3 N - #include <mach/hardware.h>. N4 s' G. H) n; c
- #include <mach/irqs.h>
. ^( w+ E7 L, A: b b. u3 E - #include <asm/hardware/edma.h>
. \ I% G# ]5 i( p7 h
+ l% i4 [' C9 w# Z2 n" O4 l- #undef EDMA3_DEBUG3 O. B4 o! O9 \: T' p! c f3 X
- /*#define EDMA3_DEBUG*/& U' k2 M. v3 M5 q0 f }
- ( [3 c9 {3 Q) d' k7 K
- #ifdef EDMA3_DEBUG: I. k# R- ^ n+ i& `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 N ^. ~- W( u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, e W8 i1 S, |: Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ ^. j/ ^/ ?: Q: \) y1 x, P6 x- e - #else
8 M) G) G6 j6 G& ?: B6 a - #define DMA_PRINTK( x... )- ^+ k4 h. F4 ?2 _. u
- #define DMA_FN_IN( E) V0 e1 g* D& z
- #define DMA_FN_OUT1 m9 M0 X5 N; {/ s0 a
- #endif
& c0 L5 i7 D# d" N8 \! q - & l4 m4 K1 Z! A: ]. V* t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: [7 \( p5 }' { F3 `' D& _ - #define STATIC_SHIFT 36 m) s8 X" z7 Y' n: |4 M8 r
- #define TCINTEN_SHIFT 20! W% t3 j0 q( f# E4 ^# b# @' k! I
- #define ITCINTEN_SHIFT 21
7 u+ q1 x( B8 l2 } - #define TCCHEN_SHIFT 22. C* S/ |% R7 X
- #define ITCCHEN_SHIFT 23- R0 t: m1 c1 A# i$ X
) T% s. i9 h$ T* m) ^- static volatile int irqraised1 = 0;
- \1 g3 ]' ^8 s6 q! I9 z9 _ - static volatile int irqraised2 = 0;
5 x& S& G7 k# H2 I `9 v1 n
2 V5 B( P4 ?$ T- Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ h* A0 Q) x& M9 A( Y. d/ | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 y: r0 C; v7 E q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! _+ h; F0 u3 o7 p0 A4 N - 3 b8 i# z2 y8 x& s7 q: H5 M7 r
- dma_addr_t dmaphyssrc1 = 0;$ K/ o4 F- n1 N/ B4 v
- dma_addr_t dmaphyssrc2 = 0;
) t! z3 q/ K" `/ }& o - dma_addr_t dmaphysdest1 = 0;% z5 X0 G4 O7 [6 h: C& }+ ?1 p
- dma_addr_t dmaphysdest2 = 0;
2 N0 s. j% J# y& ~9 H2 ] - 1 K3 y* `; n0 Z4 t" ~ {
- char *dmabufsrc1 = NULL;
2 p/ ?& C5 g( m% v. v7 a% D4 f - char *dmabufsrc2 = NULL;
1 F- X! Z, s& y, t6 j* f4 g$ F9 f - char *dmabufdest1 = NULL;& r" Z; k6 z) x% a6 L _6 o6 b
- char *dmabufdest2 = NULL;
7 V& q# d' ^2 N2 d3 H+ J6 ]
3 D6 c' P* }7 b* w2 J8 p- static int acnt = 512;
3 B, ~# s# K9 p5 u - static int bcnt = 8;& T0 @) q# ^, i* M: Z4 j
- static int ccnt = 8;- K3 z/ c* f$ r& J) r, B$ O$ @
4 _7 X) R* ]6 _# c- module_param(acnt, int, S_IRUGO);
" d- b0 s6 j1 Z( z/ t. Z% u: w$ N& q - module_param(bcnt, int, S_IRUGO);% k2 m" ^- }' B4 i7 u
- module_param(ccnt, int, S_IRUGO);
复制代码
; h# o' {4 o% a- ^$ A/ e5 e" d/ r- f, g1 f* X" o/ }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 k$ C3 ^- k: zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- Y7 i( A6 g: e" y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ }+ [& S8 p( a) R% O1 {4 y4 p
0 f$ U& T$ C7 |" @# w
2 C5 @4 I2 Q4 [' h |
|