165310Sarchie/*-
265310Sarchie * Copyright (C) 2008 Nathan Whitehorn
365310Sarchie * All rights reserved.
465310Sarchie *
565310Sarchie * Redistribution and use in source and binary forms, with or without
665310Sarchie * modification, are permitted provided that the following conditions
765310Sarchie * are met:
865310Sarchie * 1. Redistributions of source code must retain the above copyright
965310Sarchie *    notice, this list of conditions and the following disclaimer.
1065310Sarchie * 2. Redistributions in binary form must reproduce the above copyright
1165310Sarchie *    notice, this list of conditions and the following disclaimer in the
1265310Sarchie *    documentation and/or other materials provided with the distribution.
1365310Sarchie *
1465310Sarchie * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1565310Sarchie * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1665310Sarchie * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1765310Sarchie * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1865310Sarchie * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
1965310Sarchie * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
2065310Sarchie * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
2165310Sarchie * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
2265310Sarchie * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
2365310Sarchie * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2465310Sarchie *
2565310Sarchie * $FreeBSD: releng/10.2/sys/dev/adb/adb.h 199888 2009-11-28 17:48:25Z nwhitehorn $
2665310Sarchie */
2765310Sarchie
2865310Sarchie#ifndef	_POWERPC_ADB_H_
2965310Sarchie#define	_POWERPC_ADB_H_
3065310Sarchie
3165310Sarchie#include "adb_hb_if.h"
3265310Sarchie#include "adb_if.h"
3365310Sarchie
3465310Sarchieenum {
3565310Sarchie	ADB_COMMAND_FLUSH	= 0,
3665310Sarchie	ADB_COMMAND_LISTEN	= 2,
3765310Sarchie	ADB_COMMAND_TALK	= 3,
3865310Sarchie};
3965310Sarchie
4065310Sarchieenum {
4165310Sarchie	ADB_DEVICE_DONGLE	= 0x01,
4265310Sarchie	ADB_DEVICE_KEYBOARD	= 0x02,
4365310Sarchie	ADB_DEVICE_MOUSE	= 0x03,
4465310Sarchie	ADB_DEVICE_TABLET	= 0x04,
4565310Sarchie	ADB_DEVICE_MODEM	= 0x05,
4665310Sarchie
4765310Sarchie	ADB_DEVICE_MISC		= 0x07
4865310Sarchie};
4965310Sarchie
5065310Sarchiestruct adb_devinfo {
5165310Sarchie	uint8_t address;
5265310Sarchie	uint8_t default_address;
5365310Sarchie	uint8_t handler_id;
5465310Sarchie
5565310Sarchie	uint16_t register3;
5665310Sarchie};
5765310Sarchie
5865310Sarchie/* Pass packets down through the bus manager */
5965310Sarchieu_int adb_send_packet(device_t dev, u_char command, u_char reg, int len,
6065310Sarchie    u_char *data);
6165310Sarchieu_int adb_set_autopoll(device_t dev, u_char enable);
6265310Sarchie
6365310Sarchie/* Pass packets up from the interface */
6465310Sarchieu_int adb_receive_raw_packet(device_t dev, u_char status, u_char command,
6565310Sarchie    int len, u_char *data);
6665310Sarchie
6765310Sarchieuint8_t adb_get_device_type(device_t dev);
6865310Sarchieuint8_t adb_get_device_handler(device_t dev);
6965310Sarchieuint8_t adb_set_device_handler(device_t dev, uint8_t newhandler);
7065310Sarchie
7165310Sarchiesize_t	adb_read_register(device_t dev, u_char reg, void *data);
7265310Sarchiesize_t	adb_write_register(device_t dev, u_char reg, size_t len, void *data);
7365310Sarchie
7465310Sarchie/* Bits for implementing ADB host bus adapters */
7565310Sarchieextern devclass_t adb_devclass;
7665310Sarchieextern driver_t adb_driver;
7765310Sarchie
7865310Sarchie#endif
7965310Sarchie
8065310Sarchie