|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , \0 z1 O3 K' @8 P% U3 I
- [code]EDMA sample test application0 W, ^- u, f( O) {
- /*
2 H) {- [0 f f3 r& P8 p$ K - * edma_test.c$ S' i# r- b' e" V1 A
- * {. y- ~/ r4 l0 D) H, u
- * brief EDMA3 Test Application6 _. ~7 Q+ ]4 t u0 W. p" `
- *7 a, x$ q) p: v
- * This file contains EDMA3 Test code.9 v0 i$ L$ ^2 F# P. w d
- *! w4 d; r1 }7 |" j9 w5 g% Q3 W' t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 Y4 U8 Q0 q- u' T4 }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 M. i) l7 J8 E3 t
- * TO CHANGE.
( ~6 z- F/ e3 k$ ? - *9 w8 `" W8 X! I# D; M8 r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 n; X5 b. D& U( S
- *1 q- o: \, z9 N# A, h* D. k9 t
- * This program is free software; you can redistribute it and/or
6 a0 d; t, F7 w" w% k, t) U+ a - * modify it under the terms of the GNU General Public License as
% J [; U& y3 X/ `/ Z" s' p - * published by the Free Software Foundation version 2.. a1 p( I* Z, [( C# ]+ ]
- *
: P4 G8 S8 w# w$ N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, o- u' h4 _0 M7 I( @
- * kind, whether express or implied; without even the implied warranty- w; i1 @: W0 I# L9 s& e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! Y. x& t0 i4 h4 Y' B! B, s
- * GNU General Public License for more details./ u' s: x7 D: h5 s& g8 e
- */8 z- d/ B0 L! x! b8 }
`7 y0 N6 F f& ?. X- H( g# @- #include <linux/module.h>
% W% e4 P* D+ q! Y5 E0 S/ ` - #include <linux/init.h>
' g2 |7 z% A( F, A* N7 y - #include <linux/errno.h>
& E: r3 p. m3 k7 m - #include <linux/types.h>. F7 C8 w" p$ G0 h2 C) M4 W
- #include <linux/interrupt.h>2 @' G- j. P1 @( R7 T. c: ]) _8 q
- #include <asm/io.h>
: g: h' @: ~$ n$ g9 L - #include <linux/moduleparam.h>
) d( \ Q- n9 J- v. h9 V - #include <linux/sysctl.h>
) K' N5 ]: d6 ?! f4 Y - #include <linux/mm.h>2 `7 ?/ f% L8 V m
- #include <linux/dma-mapping.h># S% o3 N" W& \4 P
- 5 c/ Q$ ^& g! D: u
- #include <mach/memory.h>9 x9 p# C- `! }; z, g5 f, y
- #include <mach/hardware.h>' K5 l; _/ x" `6 j' _& X1 A$ V
- #include <mach/irqs.h>4 A- z) j0 M' W, Y7 c4 X% v3 ]
- #include <asm/hardware/edma.h>1 H( E( p+ Y5 R( L0 x! y) U
- o5 i2 |5 L& z# R( A- ?1 \- #undef EDMA3_DEBUG
4 q2 N' p5 x6 P4 M% w: k - /*#define EDMA3_DEBUG*/
. v2 @ i( O" Y
/ P6 m0 k& M2 h _/ @+ U- #ifdef EDMA3_DEBUG
$ @1 ?& A) \8 T. R, j3 R0 K7 ?$ `2 ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! C9 F+ L9 ^/ u* d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 h2 X2 J% U% \7 H. y: k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 A% z$ h$ ~+ E- q& x( F - #else
" K U0 C$ @6 e - #define DMA_PRINTK( x... )- E# Z R: b- D. }. J5 `
- #define DMA_FN_IN0 P3 P% H4 I' @9 z
- #define DMA_FN_OUT7 ?: I) {6 C7 _7 }% e4 g
- #endif
h! B- @! P5 e6 i6 D S. b
) ~7 Q( Y0 V6 w; C9 Y% \+ N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 ], r, e' p% @, g- u - #define STATIC_SHIFT 3. ?$ w, d! n3 Q* d- W! n% u
- #define TCINTEN_SHIFT 20
4 w" z* V$ x9 ^* D& R - #define ITCINTEN_SHIFT 21
& c& H; C! n# d# i - #define TCCHEN_SHIFT 220 e$ _' r9 |4 w. F" {2 R- x) c
- #define ITCCHEN_SHIFT 23
- b% ?# f2 Z+ L7 c0 U! h5 _4 T9 E - / N0 E' T0 e) ^
- static volatile int irqraised1 = 0;5 D% B8 Q4 F0 }8 W- H
- static volatile int irqraised2 = 0;, W$ {0 z1 A ]+ H5 P+ a4 u
5 |9 {0 b6 t3 y" }1 a3 ?4 J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 J X9 a) _3 r1 ~& Z! N7 L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ]0 X9 n4 d L& N& P5 a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% s" {( v+ ]" r( f( s5 L4 `0 z
- ( v2 a/ d5 s3 p+ S8 d
- dma_addr_t dmaphyssrc1 = 0;8 j/ X3 H- D# J
- dma_addr_t dmaphyssrc2 = 0;3 \) }3 v% c) p8 e& {
- dma_addr_t dmaphysdest1 = 0;
[- C! ]+ l- u - dma_addr_t dmaphysdest2 = 0;
; |1 f( U& J9 ~9 P8 e - , i2 l; A! U" S0 s& m5 M, P( @
- char *dmabufsrc1 = NULL;
! N* b* v) k0 g2 c6 f! v0 p - char *dmabufsrc2 = NULL;: a% z- t) Y$ E# O
- char *dmabufdest1 = NULL;
; e- n. g7 J# @9 {, b- k* } - char *dmabufdest2 = NULL;/ g+ G" s% G& _# b/ L
- + l/ U5 |4 ?' M: ?5 I7 |
- static int acnt = 512;9 k" W" [' j2 [1 L
- static int bcnt = 8;2 X; c9 X! ~! `4 k, ^# A
- static int ccnt = 8;
( n4 m! S' n5 v8 e9 V - & B. l( c4 G" ~6 q8 F8 X
- module_param(acnt, int, S_IRUGO);1 {7 t7 g# h9 X2 ~) b9 h" Q9 \
- module_param(bcnt, int, S_IRUGO);
/ ]8 N1 y" ^3 m9 ~ - module_param(ccnt, int, S_IRUGO);
复制代码 8 c/ J# D8 E; ~! \+ l$ x
' {2 d2 G9 a' |' b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* e' X- G5 O K4 Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- p( N$ X' P9 l% d" S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' z- i2 F( K* e* E& I6 f7 x& c: x8 ]& [
& t: U( D/ u% F4 \ |
|