|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 b3 {1 M" I5 w% s# B: [
- [code]EDMA sample test application
% \2 j, L2 x" Y" x+ T! S+ N3 h - /*
: M7 I7 B. J) g- B+ k& [8 z - * edma_test.c _! q- H% p' X U- b8 U. |+ [
- *
8 ]8 h) B- a& m( Q9 Z/ f3 L - * brief EDMA3 Test Application+ p% ~" s0 P' e; G& C. E- a, z
- *% B1 g# L5 p2 }0 N6 w9 c( |
- * This file contains EDMA3 Test code.
9 U) j" t8 P* n( p% X - *2 M, f+ @: l- u7 a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ U8 c/ f+ ^ G; a6 C0 H) Y5 N2 p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% X V/ Z0 Q0 n$ u& D. ? - * TO CHANGE.
9 R1 |3 ~( y0 v4 l1 C# ^* Q& I - *
+ Q& w% F3 h8 C5 c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& h3 J8 K9 W8 o - ** ?" F7 G1 `9 Y8 y/ t
- * This program is free software; you can redistribute it and/or
5 d, W2 q" y2 I/ r+ e1 a2 T - * modify it under the terms of the GNU General Public License as: P, s$ I7 L8 o/ j! i
- * published by the Free Software Foundation version 2." _( Z( M% \: E0 V
- *' D1 E |! |0 y& A4 E& r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ o! N6 _4 |) N0 U& J# W
- * kind, whether express or implied; without even the implied warranty
1 y+ r: Q7 Z& d1 Y4 R; a5 l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- C; q9 U, u. P. N7 _
- * GNU General Public License for more details.+ P+ e( ~& }! e W
- */- {: k' M& y/ N- B) J K
2 G0 k2 W8 j; H- #include <linux/module.h>
/ ^! I2 C3 g) [; H! G3 {5 k - #include <linux/init.h>: J; ^9 M' y6 w9 x# j! }, p9 z& M
- #include <linux/errno.h>
, M* \- N8 ~% ^ - #include <linux/types.h>
4 R; m# ~; R* l" e" V: X - #include <linux/interrupt.h>
* g6 R* _8 L% ` - #include <asm/io.h>5 _5 @$ a5 I5 E n, }9 I& \# `: O: g
- #include <linux/moduleparam.h>" J- N+ F M0 N( ? k
- #include <linux/sysctl.h>9 h- c8 ?2 k/ t2 c0 |4 `
- #include <linux/mm.h>- v7 A$ R, H6 w$ B3 H
- #include <linux/dma-mapping.h>
$ a' g! t4 u7 W0 f - 7 R2 m" b2 w2 F1 @; e% A8 O: a
- #include <mach/memory.h>
6 K% ~2 c- r p8 V; @% W - #include <mach/hardware.h>
* L& [ y" A Y* f - #include <mach/irqs.h>
6 u6 I* y, U8 X. ^; [ - #include <asm/hardware/edma.h>
9 T" N2 Z& T! H; j - $ ~2 F- X7 h* b% g4 B! _
- #undef EDMA3_DEBUG6 j' z. ^" E& z) D# q& `) `( c
- /*#define EDMA3_DEBUG*/
& K/ @6 x" d* K+ q0 V2 Y+ ]& A8 B5 P' {
: ?6 h6 k. Z9 T1 f4 `- #ifdef EDMA3_DEBUG6 M- G' {+ _3 Y4 |2 _2 L& I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 M* q$ x: r. c- s5 S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 h, d6 m( N; U4 m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 s8 v3 `2 r) } u# N* X - #else
. G M2 a) W% N. { Y, [ - #define DMA_PRINTK( x... )
1 O1 D& ~; F [4 q4 x6 ~ - #define DMA_FN_IN6 c' v, y: H+ J: ]# N# Y
- #define DMA_FN_OUT& }( S- M3 [5 s2 c2 E# Z( h( A
- #endif( I0 A6 i. N) V* L3 ~8 g4 h- @# z
) ?: t+ C: F7 O8 j( _- #define MAX_DMA_TRANSFER_IN_BYTES (32768). [; X( F! u# m+ G' N
- #define STATIC_SHIFT 3% |6 s7 e+ d8 A0 S5 I' s5 C
- #define TCINTEN_SHIFT 20
8 o* J) |( q" C" h! h, Z; I9 ] - #define ITCINTEN_SHIFT 217 h9 J, `8 M* Q n/ O- N* s# Q
- #define TCCHEN_SHIFT 220 V7 r9 s7 c) o, m
- #define ITCCHEN_SHIFT 23
( q. o- L$ ]+ A z# s' L - # W' N- m$ m7 B" u- p
- static volatile int irqraised1 = 0;* `- {6 Q& u7 p, m' I
- static volatile int irqraised2 = 0;
" X/ C# x7 q2 q7 v7 ~
1 ? d% Z& ~8 c' c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& J3 _$ O# f% u9 x: F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( f9 }8 W7 |5 O$ w1 S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Y9 S8 y/ ^" d [; L# Z4 [0 b
- f! E, Q! g. T. C
- dma_addr_t dmaphyssrc1 = 0;
1 u h* m! b8 A$ m, l' A; C - dma_addr_t dmaphyssrc2 = 0;, T: H0 Z+ P* v$ s8 h0 ~; _6 B
- dma_addr_t dmaphysdest1 = 0;+ f9 l: M8 n# h i. f
- dma_addr_t dmaphysdest2 = 0;" H; }1 m6 S. D2 J8 b! d
& F m7 Z4 s1 C- char *dmabufsrc1 = NULL;$ J, s# x) x& g, s( b
- char *dmabufsrc2 = NULL;3 O: V6 w+ T: P) h
- char *dmabufdest1 = NULL;
% G8 v j& [/ O# f1 B2 p - char *dmabufdest2 = NULL;
- {6 t: j4 i" g/ O* r8 C
: {, v2 X3 h4 x$ d0 ^2 ~- static int acnt = 512;8 S6 a' J5 Y8 {
- static int bcnt = 8;" w; e9 H X% b5 D* H5 z* Q
- static int ccnt = 8;9 R: E( V: [( P: X) l
% l5 Z& }2 H* ]9 i# c O. }; }3 v- module_param(acnt, int, S_IRUGO);( M9 e- j8 `4 |# R2 @
- module_param(bcnt, int, S_IRUGO);0 P5 p- O6 w) i" Q4 ]+ i4 d$ Z3 m8 h: A7 a
- module_param(ccnt, int, S_IRUGO);
复制代码 # o9 H( w$ V& i
3 \" ^5 h0 n0 h/ h# }& ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 b7 E( \3 O' e% N! z1 {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 V) _8 s5 C+ D) L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: E. T, U9 b8 k! T9 o i! l2 R' L/ |7 Y" \# l
M5 B9 u1 U* D6 w |
|