NetBSD/sys/dev/adb/adbvar.h
2007-01-17 23:20:16 +00:00

69 lines
2.6 KiB
C

/* $NetBSD: adbvar.h,v 1.1 2007/01/17 23:20:16 macallan Exp $ */
/*-
* Copyright (c) 2006 Michael Lorenz
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: adbvar.h,v 1.1 2007/01/17 23:20:16 macallan Exp $");
#ifndef ADBVAR_H
#define ADBVAR_H
#define ADB_CMDADDR(cmd) ((u_int8_t)((cmd) & 0xf0) >> 4)
#define ADBFLUSH(dev) ((((u_int8_t)(dev) & 0x0f) << 4) | 0x01)
#define ADBLISTEN(dev, reg) ((((u_int8_t)(dev) & 0x0f) << 4) | 0x08 | (reg))
#define ADBTALK(dev, reg) ((((u_int8_t)(dev) & 0x0f) << 4) | 0x0c | (reg))
struct adb_bus_accessops {
void *cookie;
/* cookie, poll, address/command, length, data */
int (*send)(void *, int, int, int, uint8_t *);
void (*poll)(void *);
void (*autopoll)(void *, int); /* bitmask of ADB addresses to poll */
int (*set_handler)(void *, void (*)(void *, int, uint8_t *), void *);
};
struct adb_device {
void *cookie;
void (*handler)(void *, int, uint8_t *);
int current_addr;
int original_addr;
int handler_id;
};
struct adb_attach_args {
struct adb_bus_accessops *ops;
struct adb_device *dev;
};
int nadb_print(void *, const char *);
#endif /* ADBVAR_H */