|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 r/ m9 j2 M4 ^. d* Y' ^' G
- [code]EDMA sample test application* N+ @1 q# A; ]0 l9 L
- /*
' D+ d8 W8 u6 [* f - * edma_test.c
0 J- a; t" i" C) j" ]8 W( x - *
$ @ E( P' W& G1 d - * brief EDMA3 Test Application9 W2 U3 P9 M8 y7 L
- ** a/ W2 C" \7 Z- `' p3 o
- * This file contains EDMA3 Test code.
; e' |+ l+ Z( ]1 y - *
& \/ F6 j5 _. H5 j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- d7 X1 |6 V) Q4 T; a* G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 L. n0 v$ h. M2 V - * TO CHANGE.6 Q" K$ H& e) a: z3 a+ ^
- *7 [; [. R# ?' S" v' o+ D3 T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) u( H0 m6 b, I( s
- *
- X- B. `6 g( c5 J; S0 ~' v - * This program is free software; you can redistribute it and/or/ U% \3 I3 L7 H2 Q8 v7 ~! k
- * modify it under the terms of the GNU General Public License as3 [4 d: j% h* ]/ i# K+ D2 p5 A
- * published by the Free Software Foundation version 2.
6 a9 ^& G9 \2 `1 v. } - *
/ p# `( f4 {% y2 o' d* C4 G6 O& \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ E, D7 y @6 P - * kind, whether express or implied; without even the implied warranty
2 _% V3 T+ h% |1 j; [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- G+ J3 z6 F8 U b4 a - * GNU General Public License for more details.# Z2 X* U/ B3 R+ N0 \9 N0 R. K
- */
: G6 w c: ]* D2 K - * j* u+ D# h2 W
- #include <linux/module.h>
' b" {# s; P1 q! m4 R" c. P - #include <linux/init.h>" f* E. y9 k8 J& m+ u# X7 V
- #include <linux/errno.h>" C' q# _: F. f& _: B& q1 l
- #include <linux/types.h>; C; p: ]# W% Z+ f" h
- #include <linux/interrupt.h>
' r! ] h3 C+ q4 s1 g Y4 k - #include <asm/io.h>
6 q X* F! Z. K: n - #include <linux/moduleparam.h>
3 W/ }$ C/ p; Z - #include <linux/sysctl.h> S. F$ l$ r8 { z
- #include <linux/mm.h>5 D, ]* v p, `2 S$ w" y
- #include <linux/dma-mapping.h>
% W" n/ _6 a' m" ? - B7 y% k1 l' q2 V
- #include <mach/memory.h>
' R: i) @( W0 o% c; H$ s2 X) d - #include <mach/hardware.h>
& J5 `# c1 Z% p1 ?7 _( L+ y - #include <mach/irqs.h>
% B' S5 o- T* i* |2 D - #include <asm/hardware/edma.h>5 b8 @8 P# E Y. J
7 j% a2 a, H2 e+ O. _( Q- #undef EDMA3_DEBUG# w4 H; s" s' A: N( n) |& s
- /*#define EDMA3_DEBUG*/
9 k' Q. c- x9 g. ~% @ c - 0 x5 D# N# ^5 V6 e
- #ifdef EDMA3_DEBUG
5 N" Q* u* o& c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); Q4 `2 U/ k& r! s! Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 N( M6 u B& K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! u# |8 j8 k! O; g8 D
- #else6 \/ S! ?$ r. d9 Z5 b! U
- #define DMA_PRINTK( x... )+ Z: L* r$ O, G" A/ [: h6 A
- #define DMA_FN_IN
) Z8 x# S! j6 ]6 U9 J( V - #define DMA_FN_OUT
; p1 i( H: i, { - #endif
) ~: s+ Y! F+ j. R( H; r H$ F: \ - % Q6 q' M3 z/ _( b4 v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" H6 J2 e' B* d1 Z P - #define STATIC_SHIFT 3% e4 `6 c! m$ ]" G) x j
- #define TCINTEN_SHIFT 20
2 H" ^& M' p; B; R - #define ITCINTEN_SHIFT 21
+ m% @8 J8 ]0 Q) x# k8 c - #define TCCHEN_SHIFT 22) a- z G" u; d& B) ^
- #define ITCCHEN_SHIFT 23, U! X. @' [, \' k* A
7 Q3 n$ N$ |7 e" e6 p7 o$ a3 w- static volatile int irqraised1 = 0;+ y+ n! ^% Y% F6 N& u# u5 W
- static volatile int irqraised2 = 0;: i6 ^/ s; K4 @& j8 A
- 0 l4 p \$ N6 u; p7 T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ e5 ?- t9 n# V" ~$ O V' M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 R8 Z6 M! \. H# r& O# H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. H. d3 C9 o0 X. ^ p
- 9 L7 Z: Z6 s# N# u4 }2 d
- dma_addr_t dmaphyssrc1 = 0;8 V9 P5 L7 W, I* E$ N
- dma_addr_t dmaphyssrc2 = 0;8 h6 s( J( x& W
- dma_addr_t dmaphysdest1 = 0;# Y0 T+ I. l& {3 F( L' |( [- t
- dma_addr_t dmaphysdest2 = 0;
& {; {4 I2 g7 [; Y7 q f/ ?! i - , z# r& s% q4 p# r3 b/ |: ]( c
- char *dmabufsrc1 = NULL;, L/ H9 f* E. u4 w- N% x/ X
- char *dmabufsrc2 = NULL;
/ \, s# z1 G# n b6 H: p: A - char *dmabufdest1 = NULL;: R$ x/ y( c h' D- P7 H
- char *dmabufdest2 = NULL;
7 v: V6 O; w: g! C/ R& t% K/ ? P - " C+ ]; b, g; G7 x# k) |* T. u
- static int acnt = 512;
' ?7 p' [5 B% S - static int bcnt = 8;/ K7 Q9 u5 L3 f j: ?
- static int ccnt = 8;
" f( P+ X a& e/ N/ ]+ Y - % _$ |( l* \4 Y# o7 R
- module_param(acnt, int, S_IRUGO); J0 j- v! q$ C( r
- module_param(bcnt, int, S_IRUGO);7 v* L$ O- Q* H' ` W8 g' f
- module_param(ccnt, int, S_IRUGO);
复制代码 ' W* l- B% z/ n) K- S
* f) m# U2 J2 z4 a+ Z |' r* ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ |2 l7 B6 j. M; X% h+ C4 x2 v; yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- {- r; E8 [! @. O! `6 }# n9 a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! o# r. Z+ }8 r" h) ^6 s2 r# M/ f
* x2 H4 y7 T) [7 q6 Y
0 p6 |- u1 u' H' P% K+ |: F0 K1 X |
|