|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 d4 X" x7 K2 P5 x; T) l
- [code]EDMA sample test application
5 ^1 i- P3 e5 \; R4 o - /*: L8 |! f; Z) g9 _
- * edma_test.c
8 e4 c& l8 f1 p! Q3 f7 Q2 { - *
7 a$ g% }% e& t/ U - * brief EDMA3 Test Application x) U d- K! u9 C
- *! b; I/ P# Y& B9 T5 @# @/ t
- * This file contains EDMA3 Test code.( T! M& s+ ~) z
- *
}) W2 C) c1 @' \0 Z% ]0 T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ Q% H# B; L2 m, P @+ F7 I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 N1 b2 z- H- ~
- * TO CHANGE.
( y! G" I, I% [4 u! X - *
- p% `, h( V1 p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ v/ L: `8 w; _8 @; a9 i - *& b; Z0 W- o/ |6 C) \ Q6 m
- * This program is free software; you can redistribute it and/or( z* T9 c v7 R% W) R% b* m
- * modify it under the terms of the GNU General Public License as
# O4 b# Q3 F. ?, x# K$ d - * published by the Free Software Foundation version 2.5 y! M( ?- j- A( w8 W
- *, H& B/ p3 ] g# l4 v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# G1 e0 B8 }9 T - * kind, whether express or implied; without even the implied warranty$ I/ u' z. k% y5 P& n2 p9 E1 G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! r0 R% [8 [& b4 T
- * GNU General Public License for more details.
, ]1 U8 B0 _9 n- S0 Z- W - */
' r8 A& t, M4 x - $ @0 H( F7 r! Q7 g( M/ P
- #include <linux/module.h>- b) M# Y$ F! t# j
- #include <linux/init.h>
" R K% w4 p' M+ X7 [ - #include <linux/errno.h>6 M7 T; L4 |, p: v! f& `4 ^ O
- #include <linux/types.h>
( C$ a! n* K" A0 s. m2 }5 R - #include <linux/interrupt.h>8 g) F6 }! m$ G
- #include <asm/io.h>: v: b# g& n' s" e
- #include <linux/moduleparam.h>
q7 P. F3 a" \ M* A - #include <linux/sysctl.h>
; L- Y* G& }5 {7 K - #include <linux/mm.h>' ?2 N! w5 t/ v5 R: G% ~( f
- #include <linux/dma-mapping.h># T; f0 H- c' N
0 R" |" H1 F/ O+ e$ {' J# ~' h& h* j& D- #include <mach/memory.h>
# ^. U# e, o+ }- y5 {' @ - #include <mach/hardware.h>. v: f6 s o) p& ^
- #include <mach/irqs.h>) K3 a# k# |+ f! c# `
- #include <asm/hardware/edma.h>+ N2 o% Q) k# E' _
- " [: b j2 r+ e/ P0 E
- #undef EDMA3_DEBUG
$ E0 W K0 r8 f3 k P$ Y - /*#define EDMA3_DEBUG*/, }, h/ w( d7 F9 l1 x& {. V$ z
- . J5 `8 u; \, ]* G, @6 X* k
- #ifdef EDMA3_DEBUG7 n/ }& r# Q1 F% p, Q. j- D3 ]5 \& F: {: I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% \/ H, e$ P, t4 X- z4 D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 y5 a: E7 b' [9 G s8 N0 T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 h# z; M6 `- Q9 J1 { - #else
' ?- Y: ~/ D! R2 `3 L, g - #define DMA_PRINTK( x... )
4 `1 X0 O- n# D - #define DMA_FN_IN& u0 p' y& I% S% C. s
- #define DMA_FN_OUT2 T/ Q# D+ [3 E* w, _
- #endif
0 t# h% n. B7 V7 C) t
% U, e6 G3 }7 R1 ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ D9 G2 b: f$ v. ^+ V6 }7 x6 Q - #define STATIC_SHIFT 3
# d+ y7 m# I* e# u3 o Z - #define TCINTEN_SHIFT 20
# f# ^% A$ Y# s W1 ~ - #define ITCINTEN_SHIFT 21$ [6 _4 `& Z4 e" b
- #define TCCHEN_SHIFT 22) W6 w' A# O1 @" s2 V2 b0 g# B
- #define ITCCHEN_SHIFT 23/ q |/ i( C; z) L) j8 F) a
- 9 t: c" F% t4 u2 k% d
- static volatile int irqraised1 = 0;1 W! A J9 o/ Z1 K: }2 |
- static volatile int irqraised2 = 0;5 Y/ C2 M3 M" b. a4 p
5 N" G8 h3 }% J7 Q8 F4 S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 H( Y" W4 D. _& w4 u1 e `7 q/ S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% K; N8 t: z* \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
}4 u7 ?) m* P9 x4 y# c - 1 }! k8 d% l' A/ X
- dma_addr_t dmaphyssrc1 = 0;
% x- l" G- s" f8 K - dma_addr_t dmaphyssrc2 = 0;
4 D3 C7 P* g0 K$ d; H! { - dma_addr_t dmaphysdest1 = 0;
* D+ L( Q) J1 z$ p - dma_addr_t dmaphysdest2 = 0;( e2 [0 e6 B- C
- , h4 T6 n) V; Z! j: r8 V1 E
- char *dmabufsrc1 = NULL;% h+ a) r+ v; C( g# d: J
- char *dmabufsrc2 = NULL;! d' A; |. m, V- I" u" y5 u+ Z
- char *dmabufdest1 = NULL;
5 B! X, O# ^# R' w - char *dmabufdest2 = NULL;
9 O1 g9 }3 t. Y; `4 Y4 `
7 k$ k% q8 Q' q1 ?8 a! X2 f2 t I$ |- static int acnt = 512;0 S8 Q2 O7 e" v! P4 n
- static int bcnt = 8;0 P' Y5 Q1 \7 C; j2 ^
- static int ccnt = 8;8 ]( s) E5 u5 ], ?/ R9 s4 u
/ D- F, l7 h$ d- r' s( y l2 i- module_param(acnt, int, S_IRUGO);
! k0 ]1 S. X) k F0 r - module_param(bcnt, int, S_IRUGO);' {6 ]- g. U9 @7 x4 S
- module_param(ccnt, int, S_IRUGO);
复制代码 & _: ~9 g! k+ O
a5 h% Z2 m/ G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 c2 Z: f- u. K* q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
?: R: ~# i5 o+ C0 C5 d/ }9 T* V5 `9 l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' y8 ]; T5 D# v# |6 @6 F* \4 i' O# E
/ z! K j* _; S1 f1 U+ v7 I- q5 h5 Z8 G8 X
|
|