|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 K$ Y4 t6 E/ a- [code]EDMA sample test application! X. G% E3 {, @- `
- /*
8 J7 s% n' h: N - * edma_test.c
]! L5 y8 x) k5 K1 H& v1 U - *
; [; f2 i* W: l d2 o& q: w1 y2 k - * brief EDMA3 Test Application" b1 w0 p5 j, r* J. X0 g ?
- *1 f' F6 x" ~( L
- * This file contains EDMA3 Test code.# H: k2 c+ F; o
- *( u# z5 e) H5 Z# w& ^' e/ C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) e! c/ p. B4 \( Z* b6 w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 V2 K8 ]% C9 _/ X
- * TO CHANGE.
5 s' T: H5 l) }. H - *
. |& S: J( u- E" Z0 O- y0 f5 { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ j3 T/ I. f0 l4 F
- *% M8 P$ C! p9 O
- * This program is free software; you can redistribute it and/or
) T) E3 p t* R) S* ]4 }7 K/ n ] - * modify it under the terms of the GNU General Public License as. N& B! i( q/ B8 ~+ _
- * published by the Free Software Foundation version 2.& F G9 g/ R4 {, K6 l
- ** J a) d& R' b3 l* X( Y; L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% r+ \. d+ E& H. k W- B+ r
- * kind, whether express or implied; without even the implied warranty! `" C7 Y% R# B) c$ h" O# @! \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; o+ W. \+ N( G' d! [ m - * GNU General Public License for more details.6 I# Y6 ]0 j4 [! S. ?
- */
2 W$ Y$ \" m0 m j; r
) A0 P" c- P* Y/ A6 N- #include <linux/module.h>
' l* B6 h! v% t3 I - #include <linux/init.h>; K4 k, y, z" r h- x" B2 ^) r* I
- #include <linux/errno.h>
0 O) O; l: P* @5 E9 [# c - #include <linux/types.h>; H8 t+ U, c$ [" P3 c8 d u4 t
- #include <linux/interrupt.h>
h1 I+ P8 z- O s g. @ - #include <asm/io.h>. o, K2 o1 M5 `0 g0 I; R: g6 U
- #include <linux/moduleparam.h>
7 L2 L) i% H: p6 e - #include <linux/sysctl.h>
) K0 x6 U0 j! } - #include <linux/mm.h>
* l+ {: F" }' }1 |* J9 d - #include <linux/dma-mapping.h>" C2 }2 m5 I- e1 A \
' }% m# H3 T4 W+ t' Z* m- #include <mach/memory.h>
0 X7 M4 E2 R% r$ M - #include <mach/hardware.h>' U o; A9 q* G5 C3 \
- #include <mach/irqs.h>/ P" e3 b; a+ |! K$ a( }
- #include <asm/hardware/edma.h>: X& [5 O5 ], n& z+ D
- 6 `. i8 `% S- Q, O9 A
- #undef EDMA3_DEBUG
- E# G) @# y! ^, p - /*#define EDMA3_DEBUG*/
! t* y7 n( O4 c$ `5 L
6 \9 Z& ?3 Z4 |$ A" W* V& Q) w+ \- #ifdef EDMA3_DEBUG9 F9 X( W, f+ u$ v W! C4 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 P2 K5 t9 i, E, j& H7 J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' g% P; b* p0 `- |% _8 i& {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 x, d; e' Y7 g' Y - #else
9 O8 O- P& s( v7 l e H - #define DMA_PRINTK( x... )$ [8 ?3 Y# `+ j+ e' z, [
- #define DMA_FN_IN
9 e s5 K; z1 `& O+ v; Q- @ - #define DMA_FN_OUT0 r; f: T2 m; _2 |& v% L+ @4 q/ {' ]
- #endif
& p2 w0 R- ~# x8 b5 u - 0 o% F4 G4 b7 j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& X5 w6 E v0 ]4 u2 b
- #define STATIC_SHIFT 3* |: k; [9 o6 J( ~& q$ f" z
- #define TCINTEN_SHIFT 20# @, F$ n* Z/ q, F D8 d' Z
- #define ITCINTEN_SHIFT 21
`5 ~" m& e0 t. Z" M9 E& a - #define TCCHEN_SHIFT 22
+ t- ~6 Z: a" O6 F0 {. c2 b - #define ITCCHEN_SHIFT 23
1 R) P) \# o1 ], b
6 w3 W2 ?$ \) s& Z( Y- static volatile int irqraised1 = 0;
4 [5 m+ [* F, T- T - static volatile int irqraised2 = 0;+ p8 a8 G$ y4 c6 V, t
- ' G7 a0 ]9 R! J" n q, W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( G/ w( S# g8 T, h9 k* R! T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ M- D# M* \& {' D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 m4 m! i2 X" K) S - % D, O' C5 Z% V3 y8 R! m$ \$ }' }
- dma_addr_t dmaphyssrc1 = 0;1 H, `2 i V$ S
- dma_addr_t dmaphyssrc2 = 0;# e5 x o8 w/ ]5 G a
- dma_addr_t dmaphysdest1 = 0;" A- `8 W5 V: L8 K1 ~/ V1 E" W) ]
- dma_addr_t dmaphysdest2 = 0;
! r9 A) Q1 P4 H# U9 w0 M
( {/ {4 v. T- ~- m7 X- char *dmabufsrc1 = NULL;
; v4 e: Y I1 H8 z& [ - char *dmabufsrc2 = NULL;
9 _+ L2 b% m0 X0 j3 p - char *dmabufdest1 = NULL;
0 {" i+ E$ m( C* G; v5 U - char *dmabufdest2 = NULL;$ k4 A1 r3 K6 f) }: o9 i/ d0 h9 Z
- 3 F! x3 G' G: o7 h
- static int acnt = 512;2 o+ J; Z1 R8 u/ Y2 y% X
- static int bcnt = 8;
% T7 k O4 ^. W4 V - static int ccnt = 8;
2 o% r1 c! a6 {
" b, A( v# s& V" \3 G, A3 r- module_param(acnt, int, S_IRUGO);. D _" a c% q
- module_param(bcnt, int, S_IRUGO);7 _2 ^7 t( i- @. \# D0 `- y
- module_param(ccnt, int, S_IRUGO);
复制代码
2 l6 C) a5 k9 A$ v- E, [. I' ~) ]# I3 i; [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 ~, l4 j* V; T+ t* Qarm-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 h6 \$ r0 t0 m5 A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 @% u* f( S# t0 x' g/ }. P) y1 z) @- N; g
' P& {% `/ f9 m V( l
|
|