xref: /netbsd-src/sys/arch/macppc/dev/aedvar.h (revision cbab9cadce21ae72fac13910001079fff214cc29)
1*cbab9cadSchs /*	$NetBSD: aedvar.h,v 1.6 2012/10/27 17:18:00 chs Exp $	*/
27756c05cStsubai 
37756c05cStsubai /*
47756c05cStsubai  * Copyright (C) 1994	Bradley A. Grantham
57756c05cStsubai  * All rights reserved.
67756c05cStsubai  *
77756c05cStsubai  * Redistribution and use in source and binary forms, with or without
87756c05cStsubai  * modification, are permitted provided that the following conditions
97756c05cStsubai  * are met:
107756c05cStsubai  * 1. Redistributions of source code must retain the above copyright
117756c05cStsubai  *    notice, this list of conditions and the following disclaimer.
127756c05cStsubai  * 2. Redistributions in binary form must reproduce the above copyright
137756c05cStsubai  *    notice, this list of conditions and the following disclaimer in the
147756c05cStsubai  *    documentation and/or other materials provided with the distribution.
157756c05cStsubai  *
167756c05cStsubai  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
177756c05cStsubai  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
187756c05cStsubai  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
197756c05cStsubai  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
207756c05cStsubai  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
217756c05cStsubai  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
227756c05cStsubai  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
237756c05cStsubai  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
247756c05cStsubai  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
257756c05cStsubai  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
267756c05cStsubai  */
277756c05cStsubai 
287b918b40Sthorpej #include <sys/callout.h>
297756c05cStsubai #include <machine/adbsys.h>
307756c05cStsubai 
317756c05cStsubai /* Event queue definitions */
327756c05cStsubai #ifndef AED_MAX_EVENTS
337756c05cStsubai #define AED_MAX_EVENTS 200	/* Maximum events to be kept in queue */
347756c05cStsubai 				/* maybe should be higher for slower macs? */
357756c05cStsubai #endif				/* AED_MAX_EVENTS */
367756c05cStsubai 
377756c05cStsubai struct aed_softc {
387b918b40Sthorpej 	struct callout sc_repeat_ch;
397b918b40Sthorpej 
407756c05cStsubai 	/* ADB info */
417756c05cStsubai 	u_char		origaddr;	/* ADB device type (ADBADDR_AED) */
427756c05cStsubai 	u_char		adbaddr;	/* current ADB address */
437756c05cStsubai 	u_char		handler_id;	/* type of device */
447756c05cStsubai 
457756c05cStsubai 	/* ADB event queue */
467756c05cStsubai 	adb_event_t	sc_evq[AED_MAX_EVENTS];	/* the queue */
477756c05cStsubai 	int		sc_evq_tail;	/* event queue tail pointer */
487756c05cStsubai 	int		sc_evq_len;	/* event queue length */
497756c05cStsubai 
507756c05cStsubai 	/* Keyboard repeat state */
517756c05cStsubai 	int		sc_rptdelay;	/* ticks before auto-repeat */
527756c05cStsubai 	int		sc_rptinterval;	/* ticks between auto-repeat */
537756c05cStsubai 	int		sc_repeating;	/* key that is auto-repeating */
547756c05cStsubai 	adb_event_t	sc_rptevent;	/* event to auto-repeat */
557756c05cStsubai 
567756c05cStsubai 	int		sc_buttons;	/* mouse button state */
577756c05cStsubai 
587756c05cStsubai 	struct selinfo	sc_selinfo;	/* select() info */
597756c05cStsubai 	struct proc *	sc_ioproc;	/* process to wakeup */
607756c05cStsubai 
617756c05cStsubai 	int		sc_open;	/* Are we queuing events? */
627756c05cStsubai 	int		sc_options;	/* config options */
637756c05cStsubai };
647756c05cStsubai 
657756c05cStsubai /* Options */
667756c05cStsubai #define AED_MSEMUL	0x1		/* emulate mouse buttons */
677756c05cStsubai 
6802cdf4d2Sdsl void	aed_input(adb_event_t *event);
69