|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " m6 A- j) o% N" P" K1 `
- [code]EDMA sample test application
& H- n: R: B1 c: n! M6 ?" ` - /*1 U0 ]8 ]: D0 R9 Y" _
- * edma_test.c( O9 I( ?3 h% g+ H
- *
d7 |; u" W1 J* j: E$ A, s - * brief EDMA3 Test Application
& R( ~# u! |/ m! D: D4 w1 X - *
0 C/ D' ^- D7 Q! P0 B - * This file contains EDMA3 Test code.
! E& P& q1 I! [: {1 R; u - *
6 N8 \6 {! _) L$ x( ]* U1 h# Y" r) L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 e$ t0 m. T7 M& u( E, k& }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 h- z: d8 v$ B, |$ U/ U
- * TO CHANGE.
1 [6 |! @# Q7 l! P4 \ S: L - *6 {* k( q% G! [: t; i; U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" p5 U' y, z; X/ [' X0 C
- *
) s# N" H: n- n5 v9 a, m* P4 } - * This program is free software; you can redistribute it and/or. `, X, g, v1 @9 J) I1 A% l: S9 @% Q
- * modify it under the terms of the GNU General Public License as0 V" } f F( Z# r2 q& V
- * published by the Free Software Foundation version 2.; I& v1 C5 O- ?1 F+ E
- *% |6 d r; j! m! Y% K" c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; F: x/ v' l4 H5 V; ^+ W5 `/ l/ R - * kind, whether express or implied; without even the implied warranty, f+ w' i' L# s4 Q: q4 B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ ~( ~7 u. x" T0 o5 f1 O - * GNU General Public License for more details.
7 n* @1 t* E; t, h9 z - */, G2 \5 j: c* x2 y; }3 O
# E9 V. `3 S! e4 Q# d' d6 t- #include <linux/module.h>
4 C+ @( P% ]4 U6 w - #include <linux/init.h>
8 F1 j0 }+ k! \) B - #include <linux/errno.h>
y; h$ n3 K& J - #include <linux/types.h>
" i, C8 p- D8 c4 u( _! t - #include <linux/interrupt.h>
]/ }! @! \, P! M& N - #include <asm/io.h>
5 _! j5 U6 L8 E - #include <linux/moduleparam.h>- O2 E. v5 d4 _$ C( p
- #include <linux/sysctl.h>
; i9 w1 q) u) |' x* N - #include <linux/mm.h>: w: }4 y; n9 U/ r
- #include <linux/dma-mapping.h>5 I5 }* X( R0 S% l/ b
- $ Q% j/ ?- H8 H/ J& `( H( i- }
- #include <mach/memory.h>
+ m. R/ L$ b; K& `; x3 a& p - #include <mach/hardware.h>
: F+ E" z" i' t - #include <mach/irqs.h>% f5 Q5 ~% r- M. x8 j0 N) w
- #include <asm/hardware/edma.h>
, P- ~( P5 \6 _# A - % p, E& U+ y6 a" T, R
- #undef EDMA3_DEBUG
# D% L/ h8 p$ V7 M - /*#define EDMA3_DEBUG*/% d+ b3 X0 `" c5 s" j P
0 _7 f* _0 E% J0 R4 S( R# G- #ifdef EDMA3_DEBUG
4 _% c0 R$ J. G% P$ R/ X+ o# v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& |' A7 K9 ^3 Z$ j& t d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, X6 y, G# h$ `+ d2 O. h* ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), a+ @# D$ _! e5 N! d5 J a
- #else
9 h# a6 G9 t, Y: n - #define DMA_PRINTK( x... ). k% k' Q+ y Q D
- #define DMA_FN_IN# z/ h4 c1 T" E3 @) u8 J0 z
- #define DMA_FN_OUT
& R- u: Q) c1 h) M" \ - #endif
8 e8 O: d' B' ~; K O) X - + D D$ M7 _5 T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) z7 ~3 @& z) U3 L
- #define STATIC_SHIFT 3
' y* Y+ _" A9 x* I5 e4 ] - #define TCINTEN_SHIFT 20
0 K# Y3 u; I% S( ?" a0 l - #define ITCINTEN_SHIFT 21' ]4 R! Y3 C6 z
- #define TCCHEN_SHIFT 22 b. s6 p3 ?# v0 {: H; f$ }
- #define ITCCHEN_SHIFT 23
! s) W6 y6 |- Z; v
; }# P; ?/ Z% V- static volatile int irqraised1 = 0;/ m2 @* W* Q- r& L( t; ]6 i) P
- static volatile int irqraised2 = 0;9 b% O2 C- U* i
- 1 N% L' z9 w2 c$ i6 D4 v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ w3 M2 ^: F, c/ b8 X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: R' T" O. N- S5 C A; T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 I( n/ v# o2 k0 n; t7 {6 \9 m- [
" {* w1 e3 v1 j/ z- dma_addr_t dmaphyssrc1 = 0;/ d0 k( `' G. P; F, O: ?
- dma_addr_t dmaphyssrc2 = 0;
j5 a4 d: N+ A3 S - dma_addr_t dmaphysdest1 = 0;
: u# y. _8 S4 I3 q# \ - dma_addr_t dmaphysdest2 = 0;
8 W6 N4 c1 L- n# h+ c7 E
! S3 i5 ^ u0 Z9 {) K. ^- char *dmabufsrc1 = NULL;
4 \- P, s) h Z) V0 t - char *dmabufsrc2 = NULL;
7 [1 g# r1 [ Q) Y - char *dmabufdest1 = NULL;
/ B3 w$ H3 t, n6 g* G0 S - char *dmabufdest2 = NULL; d7 M9 ]8 u7 s6 s/ y% e" _5 Y
- % O2 E1 B' W Q
- static int acnt = 512;
4 Y( y6 C6 a& N! g. v - static int bcnt = 8;
$ S5 |" C- ?: t( w! r - static int ccnt = 8;
2 o: E) a+ n6 V4 i4 m& H
* @. y% z! T1 U- module_param(acnt, int, S_IRUGO);2 N. c) `/ N4 X* ]0 }. H
- module_param(bcnt, int, S_IRUGO);
. {5 w- W* H* m: p - module_param(ccnt, int, S_IRUGO);
复制代码
9 H& Y$ _( Y7 Y/ C9 K' X2 P) ]7 y; Q! \9 P0 c g( V* q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, `+ k3 U% U- k' darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& t8 c/ j( u5 p" p5 w2 T, Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ A; n k' r- F: X5 z3 P s3 x; ~/ @: ^3 V& v9 c, E/ f' P
; e. B1 q: K7 T+ h4 G, ^
|
|