|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ U1 J9 {2 D4 p4 i* [6 D5 M. K" R- [code]EDMA sample test application, l, H- e Y `3 J
- /*+ S. J3 T p- o ~& L1 k4 z2 Z
- * edma_test.c
5 E# n4 g, q: X- r( Y: N- I - *8 D* c" v5 }! {/ J2 r, d
- * brief EDMA3 Test Application5 y" q" O7 w' z* j4 p2 E! e
- *
# L" n6 P0 T, r6 k* K2 w - * This file contains EDMA3 Test code.; J% [$ k; w0 k
- *" J' q' U2 E; }& J/ B# V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- [! T4 e1 A# j0 m) C8 |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 s$ {! d( X2 K& z* B- w6 A& g/ j - * TO CHANGE.
7 k9 \7 f3 q/ J# J# J* E% ] - *
2 ^( v |0 B D6 h# Q# u; W5 I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* t7 H# Q. z' K/ z$ {
- *
$ B8 u. ?& e. Q# A: @; E3 ^ B! }/ S - * This program is free software; you can redistribute it and/or
, r P8 l$ h* p, y0 g* L K - * modify it under the terms of the GNU General Public License as0 }$ X) ~: w8 [/ C! B+ {2 B- p9 H
- * published by the Free Software Foundation version 2.. F# o( x# b- ^, |, Z
- *4 }# o7 F2 A6 x' R9 U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( p% p7 Z: C# y$ O9 x5 A9 s, J
- * kind, whether express or implied; without even the implied warranty
+ L5 `' f. O( J* B- ~9 j t s' E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- o4 S: v1 L8 J- D; I& {' Z: k( i7 p - * GNU General Public License for more details.
) n" l5 E1 s6 Q3 [' m5 U) H7 D4 \ - */# V$ W( w& o9 P2 \$ F. S( ?) |5 u
- % W5 R/ G2 H0 H. W" u
- #include <linux/module.h>
( S* p; ?7 t% g$ v - #include <linux/init.h>
6 N( }& u7 J7 @7 _, ?9 a) @ - #include <linux/errno.h>* q( x5 Q$ T7 u: z/ J& u
- #include <linux/types.h>; L, T' I5 Z. s$ q: B
- #include <linux/interrupt.h>$ m; I# u+ o3 s
- #include <asm/io.h>
4 a. F8 Y; W' `+ a - #include <linux/moduleparam.h>
) O6 q& f- b8 u/ P: ]! C% n - #include <linux/sysctl.h>
6 b. \/ F. L2 T+ v5 I - #include <linux/mm.h>( B5 c! x( a! x, Z( c/ F0 T! O0 o
- #include <linux/dma-mapping.h> L* t/ \- {3 t" @9 k
- ! V( \( S5 D- D8 v/ V! I" }" M
- #include <mach/memory.h>
6 Y+ l9 _, J/ }- O7 `, O - #include <mach/hardware.h>. p% O/ `. T+ i( u
- #include <mach/irqs.h>
. Z2 v$ @6 q6 B( }0 N - #include <asm/hardware/edma.h>
3 H9 o/ v. I1 q
1 z! b5 c, _( g3 x- #undef EDMA3_DEBUG/ H8 ^6 n# Q* K1 q+ f) E) _3 Q
- /*#define EDMA3_DEBUG*/
- _+ u# b' H" x( C, w
% @: z+ K$ b, |% R9 |6 v- #ifdef EDMA3_DEBUG- R8 [+ X. d, ~) S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ |( h# }* ^) l- T3 Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; J3 W h B, z- l1 w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. W: ]) P$ ?6 _ - #else
9 c' B3 N* E" a) U$ K - #define DMA_PRINTK( x... )+ T9 n' M7 [. z! I& n) H- B+ h
- #define DMA_FN_IN+ }7 T3 ]. R B( n6 q7 U2 I
- #define DMA_FN_OUT
3 B4 P3 N {& O, _9 Y: X - #endif# k4 g" Q+ H- S* N0 K3 {9 s* O. Q
- ! k& P' i9 K* R% ^$ z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* j- G2 t2 u' [" x$ ]) W% Z* N
- #define STATIC_SHIFT 32 y) {3 ?; g' ~9 l, B
- #define TCINTEN_SHIFT 20
3 a. {: z# E- a* _' C4 p; `& W - #define ITCINTEN_SHIFT 21+ G3 w6 c: D( l9 @( j( e5 a
- #define TCCHEN_SHIFT 22( P; S! L4 x# ^5 Y8 Y
- #define ITCCHEN_SHIFT 23' s% c* C0 G* z; \# _
- : C% `3 S3 {3 x1 @+ G! K% [" \8 _
- static volatile int irqraised1 = 0;4 _3 ?8 H: h4 u4 l! J3 u3 P
- static volatile int irqraised2 = 0;: t4 P% @, }5 R3 \# `
1 |, u2 @" ]5 ]+ [ v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. T/ C/ K2 t$ q% @- ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% I- J) w; _) u3 @- _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 h( j' `6 u, Y% X9 U7 S1 W
- " z# W# | p+ n& W J9 G
- dma_addr_t dmaphyssrc1 = 0;
# l$ c* n9 D6 K6 F+ P - dma_addr_t dmaphyssrc2 = 0;! m$ b: @( S1 |1 j$ j/ I* T
- dma_addr_t dmaphysdest1 = 0;
+ Y4 l6 T E3 \ j - dma_addr_t dmaphysdest2 = 0;
. |& ]& F1 H! x - % J4 z: y: X9 @0 p C$ b# B
- char *dmabufsrc1 = NULL;( P7 ^$ ~ Y: r* C6 J
- char *dmabufsrc2 = NULL;
- d+ l- M$ Q) P9 P1 p- m& u" g - char *dmabufdest1 = NULL;. [; H; x$ a; S' b% d. K
- char *dmabufdest2 = NULL;
; q' l4 G; }1 x
/ V7 T+ f( \2 E- static int acnt = 512;
# C/ V' e2 K" d - static int bcnt = 8;
. m. v7 I" w4 r - static int ccnt = 8;9 N0 i2 m+ I" u# R+ v3 Q* K
1 o0 _3 T0 B1 H( e/ o- module_param(acnt, int, S_IRUGO);+ M- N2 b) K: w K' _* z/ H% F# S$ I
- module_param(bcnt, int, S_IRUGO);/ m) G8 q6 g) m4 t
- module_param(ccnt, int, S_IRUGO);
复制代码 / e8 ~% g8 H9 n" O [
. M# K% c" f9 m8 V0 Z" P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- }/ J a, C1 b: aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* F* H+ X1 M# ?( {: |$ g# I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! n' A. j: r ?3 X
8 S1 j* q( ], O" U. t2 ]
: q5 _: t, |7 n4 o& C0 ` |
|