1b4dbc599SNathan Whitehorn /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 3718cf2ccSPedro F. Giffuni * 4b4dbc599SNathan Whitehorn * Copyright (C) 2008 Nathan Whitehorn 5b4dbc599SNathan Whitehorn * All rights reserved. 6b4dbc599SNathan Whitehorn * 7b4dbc599SNathan Whitehorn * Redistribution and use in source and binary forms, with or without 8b4dbc599SNathan Whitehorn * modification, are permitted provided that the following conditions 9b4dbc599SNathan Whitehorn * are met: 10b4dbc599SNathan Whitehorn * 1. Redistributions of source code must retain the above copyright 11b4dbc599SNathan Whitehorn * notice, this list of conditions and the following disclaimer. 12b4dbc599SNathan Whitehorn * 2. Redistributions in binary form must reproduce the above copyright 13b4dbc599SNathan Whitehorn * notice, this list of conditions and the following disclaimer in the 14b4dbc599SNathan Whitehorn * documentation and/or other materials provided with the distribution. 15b4dbc599SNathan Whitehorn * 16b4dbc599SNathan Whitehorn * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17b4dbc599SNathan Whitehorn * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18b4dbc599SNathan Whitehorn * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19b4dbc599SNathan Whitehorn * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20b4dbc599SNathan Whitehorn * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21b4dbc599SNathan Whitehorn * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 22b4dbc599SNathan Whitehorn * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 23b4dbc599SNathan Whitehorn * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 24b4dbc599SNathan Whitehorn * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 25b4dbc599SNathan Whitehorn * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26b4dbc599SNathan Whitehorn */ 27b4dbc599SNathan Whitehorn 28b4dbc599SNathan Whitehorn #ifndef _POWERPC_ADB_H_ 29b4dbc599SNathan Whitehorn #define _POWERPC_ADB_H_ 30b4dbc599SNathan Whitehorn 31b4dbc599SNathan Whitehorn #include "adb_hb_if.h" 32b4dbc599SNathan Whitehorn #include "adb_if.h" 33b4dbc599SNathan Whitehorn 34b4dbc599SNathan Whitehorn enum { 35b4dbc599SNathan Whitehorn ADB_COMMAND_FLUSH = 0, 36b4dbc599SNathan Whitehorn ADB_COMMAND_LISTEN = 2, 37b4dbc599SNathan Whitehorn ADB_COMMAND_TALK = 3, 38b4dbc599SNathan Whitehorn }; 39b4dbc599SNathan Whitehorn 40b4dbc599SNathan Whitehorn enum { 41b4dbc599SNathan Whitehorn ADB_DEVICE_DONGLE = 0x01, 42b4dbc599SNathan Whitehorn ADB_DEVICE_KEYBOARD = 0x02, 43b4dbc599SNathan Whitehorn ADB_DEVICE_MOUSE = 0x03, 44b4dbc599SNathan Whitehorn ADB_DEVICE_TABLET = 0x04, 45b4dbc599SNathan Whitehorn ADB_DEVICE_MODEM = 0x05, 46b4dbc599SNathan Whitehorn 47b4dbc599SNathan Whitehorn ADB_DEVICE_MISC = 0x07 48b4dbc599SNathan Whitehorn }; 49b4dbc599SNathan Whitehorn 50b4dbc599SNathan Whitehorn struct adb_devinfo { 51b4dbc599SNathan Whitehorn uint8_t address; 52b4dbc599SNathan Whitehorn uint8_t default_address; 53b4dbc599SNathan Whitehorn uint8_t handler_id; 54b4dbc599SNathan Whitehorn 55b4dbc599SNathan Whitehorn uint16_t register3; 56b4dbc599SNathan Whitehorn }; 57b4dbc599SNathan Whitehorn 58b4dbc599SNathan Whitehorn /* Pass packets down through the bus manager */ 59b4dbc599SNathan Whitehorn u_int adb_send_packet(device_t dev, u_char command, u_char reg, int len, 60b4dbc599SNathan Whitehorn u_char *data); 61b4dbc599SNathan Whitehorn u_int adb_set_autopoll(device_t dev, u_char enable); 62b4dbc599SNathan Whitehorn 63b4dbc599SNathan Whitehorn /* Pass packets up from the interface */ 64b4dbc599SNathan Whitehorn u_int adb_receive_raw_packet(device_t dev, u_char status, u_char command, 65b4dbc599SNathan Whitehorn int len, u_char *data); 66b4dbc599SNathan Whitehorn 67b4dbc599SNathan Whitehorn uint8_t adb_get_device_type(device_t dev); 68b4dbc599SNathan Whitehorn uint8_t adb_get_device_handler(device_t dev); 69b4dbc599SNathan Whitehorn uint8_t adb_set_device_handler(device_t dev, uint8_t newhandler); 70b4dbc599SNathan Whitehorn 71582434bdSNathan Whitehorn size_t adb_read_register(device_t dev, u_char reg, void *data); 72f697a802SNathan Whitehorn size_t adb_write_register(device_t dev, u_char reg, size_t len, void *data); 73b4dbc599SNathan Whitehorn 74b4dbc599SNathan Whitehorn /* Bits for implementing ADB host bus adapters */ 75b4dbc599SNathan Whitehorn extern driver_t adb_driver; 76b4dbc599SNathan Whitehorn 77b4dbc599SNathan Whitehorn #endif 78