1247496Sgonzo/*
2247496Sgonzo * Copyright (c) 2013 Daisuke Aoyama <aoyama@peach.ne.jp>
3247496Sgonzo * Copyright (c) 2013 Oleksandr Tymoshenko <gonzo@bluezbox.com>
4247496Sgonzo *
5247496Sgonzo * Redistribution and use in source and binary forms, with or without
6247496Sgonzo * modification, are permitted provided that the following conditions
7247496Sgonzo * are met:
8247496Sgonzo * 1. Redistributions of source code must retain the above copyright
9247496Sgonzo *    notice, this list of conditions and the following disclaimer.
10247496Sgonzo * 2. Redistributions in binary form must reproduce the above copyright
11247496Sgonzo *    notice, this list of conditions and the following disclaimer in the
12247496Sgonzo *    documentation and/or other materials provided with the distribution.
13247496Sgonzo *
14247496Sgonzo * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15247496Sgonzo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16247496Sgonzo * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17247496Sgonzo * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18247496Sgonzo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19247496Sgonzo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20247496Sgonzo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21247496Sgonzo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22247496Sgonzo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23247496Sgonzo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24247496Sgonzo * SUCH DAMAGE.
25247496Sgonzo *
26247496Sgonzo * $FreeBSD: releng/10.3/sys/arm/broadcom/bcm2835/bcm2835_dma.h 247496 2013-02-28 19:48:19Z gonzo $
27247496Sgonzo */
28247496Sgonzo
29247496Sgonzo#ifndef	_BCM2835_DMA_H_
30247496Sgonzo#define	_BCM2835_DMA_H_
31247496Sgonzo
32247496Sgonzo#define	BCM_DMA_BLOCK_SIZE	512
33247496Sgonzo
34247496Sgonzo/* DMA0-DMA15 but DMA15 is special */
35247496Sgonzo#define	BCM_DMA_CH_MAX		12
36247496Sgonzo
37247496Sgonzo/* request CH for any nubmer */
38247496Sgonzo#define	BCM_DMA_CH_INVALID	(-1)
39247496Sgonzo#define	BCM_DMA_CH_ANY		(-1)
40247496Sgonzo#define	BCM_DMA_CH_FAST1	(2)
41247496Sgonzo#define	BCM_DMA_CH_FAST2	(3)
42247496Sgonzo
43247496Sgonzo/* Peripheral DREQ Signals (4.2.1.3) */
44247496Sgonzo#define	BCM_DMA_DREQ_NONE	0
45247496Sgonzo#define	BCM_DMA_DREQ_EMMC	11
46247496Sgonzo#define	BCM_DMA_DREQ_SDHOST	13
47247496Sgonzo
48247496Sgonzo#define	BCM_DMA_SAME_ADDR	0
49247496Sgonzo#define	BCM_DMA_INC_ADDR	1
50247496Sgonzo
51247496Sgonzo#define	BCM_DMA_32BIT		0
52247496Sgonzo#define	BCM_DMA_128BIT		1
53247496Sgonzo
54247496Sgonzoint bcm_dma_allocate(int req_ch);
55247496Sgonzoint bcm_dma_free(int ch);
56247496Sgonzoint bcm_dma_setup_intr(int ch, void (*func)(int, void *), void *arg);
57247496Sgonzoint bcm_dma_setup_src(int ch, int dreq, int inc_addr, int width);
58247496Sgonzoint bcm_dma_setup_dst(int ch, int dreq, int inc_addr, int width);
59247496Sgonzoint bcm_dma_start(int ch, vm_paddr_t src, vm_paddr_t dst, int len);
60247496Sgonzouint32_t bcm_dma_length(int ch);
61247496Sgonzo
62247496Sgonzo#endif	/* _BCM2835_DMA_H_ */
63