1/*	$NetBSD$	*/
2
3/*-
4 * Copyright (c) 2012 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Nick Hudson
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 *    notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _BCM2835_MBOXREG_H_
33#define	_BCM2835_MBOXREG_H_
34
35/* mailbox 0 (from VC) and mailbox 1 (to VC) */
36#define	BCM2835_MBOX_SIZE	0x80
37
38#define	BCM2835_MBOX_READ	0x00
39#define	BCM2835_MBOX_WRITE	0x00
40#define	BCM2835_MBOX_POLL	0x10	/* read without popping the fifo */
41#define	BCM2835_MBOX_ID		0x14	/* sender ID (bottom two bits) */
42#define	BCM2835_MBOX_STATUS	0x18	/* status */
43#define	 BCM2835_MBOX_STATUS_FULL	0x80000000
44#define	 BCM2835_MBOX_STATUS_EMPTY	0x40000000
45#define	 BCM2835_MBOX_STATUS_LEVEL	0x400000FF
46#define	BCM2835_MBOX_CFG	0x1C	/* configuration */
47#define	 BCM2835_MBOX_CFG_DATAIRQEN		0x00000001
48#define	 BCM2835_MBOX_CFG_SPACEIRQEN		0x00000002
49#define	 BCM2835_MBOX_CFG_EMPTYOPIRQEN		0x00000004
50#define	 BCM2835_MBOX_CFG_MAILCLEAR		0x00000008
51#define	 BCM2835_MBOX_CFG_DATAPENDING		0x00000010
52#define	 BCM2835_MBOX_CFG_SPACEPENDING		0x00000020
53#define	 BCM2835_MBOX_CFG_EMPTYOPPENDING	0x00000040
54#define	 BCM2835_MBOX_CFG_ENOOWN		0x00000100
55#define	 BCM2835_MBOX_CFG_EOVERFLOW		0x00000200
56#define	 BCM2835_MBOX_CFG_EUNDERFLOW		0x00000400
57
58#define	BCM2835_MBOX0_BASE	0x00
59#define	BCM2835_MBOX1_BASE	0x20
60
61#define	BCM2835_MBOX0_READ	(BCM2835_MBOX0_BASE + BCM2835_MBOX_READ)
62#define	BCM2835_MBOX0_WRITE	(BCM2835_MBOX0_BASE + BCM2835_MBOX_WRITE)
63#define	BCM2835_MBOX0_POLL	(BCM2835_MBOX0_BASE + BCM2835_MBOX_POLL)
64#define	BCM2835_MBOX0_ID	(BCM2835_MBOX0_BASE + BCM2835_MBOX_ID)
65#define	BCM2835_MBOX0_STATUS	(BCM2835_MBOX0_BASE + BCM2835_MBOX_STATUS)
66#define	BCM2835_MBOX0_CFG	(BCM2835_MBOX0_BASE + BCM2835_MBOX_READ)
67
68#define	BCM2835_MBOX1_READ	(BCM2835_MBOX1_BASE + BCM2835_MBOX_READ)
69#define	BCM2835_MBOX1_WRITE	(BCM2835_MBOX1_BASE + BCM2835_MBOX_WRITE)
70#define	BCM2835_MBOX1_POLL	(BCM2835_MBOX1_BASE + BCM2835_MBOX_POLL)
71#define	BCM2835_MBOX1_ID	(BCM2835_MBOX1_BASE + BCM2835_MBOX_ID)
72#define	BCM2835_MBOX1_STATUS	(BCM2835_MBOX1_BASE + BCM2835_MBOX_STATUS)
73#define	BCM2835_MBOX1_CFG	(BCM2835_MBOX1_BASE + BCM2835_MBOX_READ)
74
75#endif /* _BCM2835_MBOXREG_H_ */
76