1184299Snwhitehorn/*-
2184299Snwhitehorn * Copyright 2008 by Nathan Whitehorn. All rights reserved.
3184299Snwhitehorn *
4184299Snwhitehorn * Redistribution and use in source and binary forms, with or without
5184299Snwhitehorn * modification, are permitted provided that the following conditions
6184299Snwhitehorn * are met:
7184299Snwhitehorn * 1. Redistributions of source code must retain the above copyright
8184299Snwhitehorn *    notice, this list of conditions and the following disclaimer.
9184299Snwhitehorn * 2. Redistributions in binary form must reproduce the above copyright
10184299Snwhitehorn *    notice, this list of conditions and the following disclaimer in the
11184299Snwhitehorn *    documentation and/or other materials provided with the distribution.
12184299Snwhitehorn *
13184299Snwhitehorn * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14184299Snwhitehorn * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15184299Snwhitehorn * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16184299Snwhitehorn * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17184299Snwhitehorn * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
18184299Snwhitehorn * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19184299Snwhitehorn * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
20184299Snwhitehorn * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21184299Snwhitehorn * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22184299Snwhitehorn * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23184299Snwhitehorn * SUCH DAMAGE.
24184299Snwhitehorn *
25184299Snwhitehorn * $FreeBSD$
26184299Snwhitehorn */
27184299Snwhitehorn
28184299Snwhitehorn#ifndef _MACIO_MACGPIOVAR_H_
29184299Snwhitehorn#define _MACIO_MACGPIOVAR_H_
30184299Snwhitehorn
31185757Snwhitehorn/* relative offsets into gpio space */
32185757Snwhitehorn#define GPIO_EXTINT_BASE	0x08
33185757Snwhitehorn#define GPIO_BASE		0x1a
34184299Snwhitehorn
35260533Sjhibbits#define GPIO_EXTINT_COUNT	0x12
36260533Sjhibbits#define GPIO_COUNT		0x11
37260533Sjhibbits
38260533Sjhibbits#define GPIO_LEVELS_0	0x50
39260533Sjhibbits#define GPIO_LEVELS_1	0x54
40260533Sjhibbits
41185757Snwhitehorn/* gpio bit definitions */
42185757Snwhitehorn#define GPIO_DATA		0x01 /* GPIO data */
43185757Snwhitehorn#define GPIO_LEVEL_RO		0x02 /* read-only level on pin */
44185757Snwhitehorn#define GPIO_DDR_INPUT		0x00 /* use for input */
45185757Snwhitehorn#define GPIO_DDR_OUTPUT		0x04 /* use for output */
46184299Snwhitehorn
47184299Snwhitehornuint8_t	macgpio_read(device_t dev);
48184299Snwhitehornvoid	macgpio_write(device_t dev,uint8_t);
49184299Snwhitehorn
50184299Snwhitehorn#endif /* _MACIO_MACGPIOVAR_H_ */
51