|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! I% U( X+ Q; |" F- [code]EDMA sample test application
% M+ E* P( I& r - /*; E. ]5 x& q5 g! y' x9 \
- * edma_test.c
" B1 P6 U% D2 J% N+ u - *. q% I$ m% G7 M; u$ Z1 S1 R
- * brief EDMA3 Test Application
' R2 g/ B/ R. s+ I - *0 S: R( W+ l, d
- * This file contains EDMA3 Test code.' h9 S5 P4 Q6 ^% ?. U9 j6 z
- *
2 m5 {" T( B, G5 W# v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. B9 t" |3 H, L7 I& M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 @: b5 ~* }# m+ \% P8 }0 T( s2 D6 a
- * TO CHANGE./ }0 Y% C7 B9 \, u
- *; p* z& r1 n/ D& v, p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ i, X8 z8 M) j0 H, }8 d - *5 D7 _% S" l: E H8 R
- * This program is free software; you can redistribute it and/or0 z+ ^0 S9 b0 L# I1 f4 x
- * modify it under the terms of the GNU General Public License as. I% W! S9 L2 [; u1 E5 S
- * published by the Free Software Foundation version 2.' U: y0 f0 m) J/ E& R1 u0 P! u5 j
- *2 o* Q2 Q3 P9 T3 M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 Z3 F3 o- z2 s) ~
- * kind, whether express or implied; without even the implied warranty
w0 w* I* F( ?9 {7 O. n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ c7 }5 E U5 [2 x - * GNU General Public License for more details.4 K% R Z4 q( [" L5 t! d. ^
- */% Q/ s3 q* ?5 u& ~
( _' T9 ^# ^8 @4 I% a4 y- #include <linux/module.h>% U: y% Y; {+ n4 a
- #include <linux/init.h>
8 z4 ^; n) u# |$ U/ U; } y - #include <linux/errno.h>
# y0 {- G5 {* a* g6 `/ Z2 [* e, s - #include <linux/types.h>
) ~) i, N1 ?0 s/ L$ e5 V3 ^( v - #include <linux/interrupt.h>
) I. C# q" }; S6 P, o! F$ L - #include <asm/io.h>
2 m9 W9 v$ \* h) p; J - #include <linux/moduleparam.h>
h) b3 v. I6 O n- y/ d - #include <linux/sysctl.h>
2 r+ C, V$ a% o- o$ J - #include <linux/mm.h>
9 r3 H k" A' D - #include <linux/dma-mapping.h>
/ H# [5 d2 X- S; y5 f" \
0 r6 u5 a8 g T/ V- #include <mach/memory.h>, e5 Z1 X8 s' B: |1 U
- #include <mach/hardware.h>
% }3 L: e9 Y R" T% Y, @- G - #include <mach/irqs.h>, f" a7 _; d: r6 `) V+ p
- #include <asm/hardware/edma.h>% S# L+ [' V7 _
- 6 T$ q7 G1 E7 [3 P- ]) E0 g' U
- #undef EDMA3_DEBUG
' `3 a3 M$ @( u* P% C5 E - /*#define EDMA3_DEBUG*/( v+ Z! B# X: A- D' d. P" I2 g
- . c' I" u) J% v2 u+ |, a" O, J
- #ifdef EDMA3_DEBUG
* [* y+ t1 s( b8 w# m* g. y! S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); O5 f/ A+ A* ], l4 r* H, h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 ?9 E% G1 ^( ~# n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% @0 } n6 K: f; k - #else
% Z( K4 N( b( d5 v7 c: D5 t' e, F - #define DMA_PRINTK( x... )( A- M, o5 ?' Z. [
- #define DMA_FN_IN
- O0 A4 i/ C; R& U - #define DMA_FN_OUT& t/ A2 O( b' R6 y% |. G
- #endif4 f+ p! `# i7 X$ w" N
1 W4 D& ` H8 \: s9 o. E- D- #define MAX_DMA_TRANSFER_IN_BYTES (32768), C+ x% f7 A- H! R' L
- #define STATIC_SHIFT 3 X/ I( ~6 } L7 Y5 ^( K7 @; Y9 d
- #define TCINTEN_SHIFT 202 Y% {9 z1 H3 A4 {
- #define ITCINTEN_SHIFT 21
! y# C- ]3 A2 Q - #define TCCHEN_SHIFT 22
. _, R) ^5 n$ U$ F - #define ITCCHEN_SHIFT 231 n, d4 n( V. T f l% d% X
- " y! J9 r& i; G
- static volatile int irqraised1 = 0;
, v) s& r( x5 m- _+ J - static volatile int irqraised2 = 0;
# [. I" @) \- s; } - : B# ^0 m+ B @ E$ L8 \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! X4 x% x0 c) j6 B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 {) Q( |0 L/ @' f5 d) i( B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' V$ ^) s3 g9 \3 y: m
- * r8 k& l! k6 k
- dma_addr_t dmaphyssrc1 = 0; z" y# b( p' C5 K4 K9 ?1 ]
- dma_addr_t dmaphyssrc2 = 0;
4 z) a- A$ p& q- W - dma_addr_t dmaphysdest1 = 0;0 w+ C# j1 U, w) i* \* `2 o$ Z
- dma_addr_t dmaphysdest2 = 0;/ N1 @: t1 y; _. E6 |% S5 L
1 X: A* @" D3 l5 i" p: F- char *dmabufsrc1 = NULL;/ D$ ]& R. Z* T8 t- O3 l: r
- char *dmabufsrc2 = NULL;
. F. |' ?% Q% s, ? - char *dmabufdest1 = NULL;8 W; h; n8 f5 L* d* j, }
- char *dmabufdest2 = NULL;
1 V! ~* D, O) ~0 G9 Z" Q - ! M5 o1 p: h* J3 d
- static int acnt = 512;1 i3 K2 v& R1 B1 I
- static int bcnt = 8;* H- ^$ ]( E+ ~( q) I/ j! g0 c: ?
- static int ccnt = 8;5 \) l: k# D1 n _! a5 R5 l
- * M0 v3 l$ t( b, i7 f5 F/ R
- module_param(acnt, int, S_IRUGO);
) \$ r2 \6 _0 d% O' m" P - module_param(bcnt, int, S_IRUGO);5 P, F; r6 H0 d% y
- module_param(ccnt, int, S_IRUGO);
复制代码 : F( P. @" D, x! D! p+ N" {
$ o+ B) G8 f. l% @$ v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 p% R8 x ^/ B- `- M; b! jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' ~4 [' r; E; I k* m1 y; G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 c; y$ r) U- N9 ~
1 f4 }/ M' a8 C8 C3 ]% T+ r; n3 L% e4 _4 ~1 w$ \
|
|