11.11Sandvar/*	$NetBSD: amsvar.h,v 1.11 2025/06/27 21:36:24 andvar Exp $	*/
21.1Stsubai
31.1Stsubai/*
41.1Stsubai * Copyright (C) 1998	Colin Wood
51.1Stsubai * All rights reserved.
61.1Stsubai *
71.1Stsubai * Redistribution and use in source and binary forms, with or without
81.1Stsubai * modification, are permitted provided that the following conditions
91.1Stsubai * are met:
101.1Stsubai * 1. Redistributions of source code must retain the above copyright
111.1Stsubai *    notice, this list of conditions and the following disclaimer.
121.1Stsubai * 2. Redistributions in binary form must reproduce the above copyright
131.1Stsubai *    notice, this list of conditions and the following disclaimer in the
141.1Stsubai *    documentation and/or other materials provided with the distribution.
151.1Stsubai * 3. All advertising materials mentioning features or use of this software
161.1Stsubai *    must display the following acknowledgement:
171.1Stsubai *	This product includes software developed by Colin Wood.
181.1Stsubai * 4. The name of the author may not be used to endorse or promote products
191.1Stsubai *    derived from this software without specific prior written permission.
201.1Stsubai *
211.1Stsubai * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
221.1Stsubai * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
231.1Stsubai * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
241.1Stsubai * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
251.1Stsubai * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
261.1Stsubai * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
271.1Stsubai * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
281.1Stsubai * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
291.1Stsubai * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
301.1Stsubai * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
311.1Stsubai */
321.1Stsubai
331.2Stsubai#ifndef _MACPPC_AMSVAR_H_
341.2Stsubai#define _MACPPC_AMSVAR_H_
351.1Stsubai
361.1Stsubai/*
371.1Stsubai * State info, per mouse instance.
381.1Stsubai */
391.2Stsubaistruct ams_softc {
401.10Schs	device_t	sc_dev;
411.1Stsubai
421.1Stsubai	/* ADB info */
431.3Stsubai	int		origaddr;	/* ADB device type (ADBADDR_MS) */
441.3Stsubai	int		adbaddr;	/* current ADB address */
451.3Stsubai	int		handler_id;	/* type of mouse */
461.1Stsubai
471.1Stsubai	/* Extended Mouse Protocol info, faked for non-EMP mice */
481.1Stsubai	u_int8_t	sc_class;	/* mouse class (mouse, trackball) */
491.1Stsubai	u_int8_t	sc_buttons;	/* number of buttons */
501.1Stsubai	u_int32_t	sc_res;		/* mouse resolution (dpi) */
511.11Sandvar	char		sc_devid[5];	/* device identifier */
521.1Stsubai
531.1Stsubai	int		sc_mb;		/* current button state */
541.10Schs	device_t	sc_wsmousedev;
551.5Smacallan	/* helpers for trackpads */
561.5Smacallan	int		sc_down;
571.6Smacallan	int		sc_tapping;	/* 1 - tapping causes button event */
581.5Smacallan	/*
591.5Smacallan	 * trackpad protocol variant. Known so far:
601.5Smacallan	 * 2 buttons - PowerBook 3400, single events on button 3 and 4 indicate
611.5Smacallan	 *             finger down and up
621.5Smacallan	 * 4 buttons - iBook G4, button 6 indicates finger down, button 4 is
631.5Smacallan	 *             always down
641.5Smacallan	 */
651.5Smacallan	int		sc_x, sc_y;
661.1Stsubai};
671.1Stsubai
681.1Stsubai/* EMP device classes */
691.1Stsubai#define MSCLASS_TABLET		0
701.1Stsubai#define MSCLASS_MOUSE		1
711.4Stsubai#define MSCLASS_TRACKBALL	2
721.4Stsubai#define MSCLASS_TRACKPAD	3
731.1Stsubai
741.9Sdslvoid ms_adbcomplete(uint8_t *buffer, uint8_t *data_area, int adb_command);
751.9Sdslvoid ms_handoff(adb_event_t *event, struct ams_softc *);
761.1Stsubai
771.2Stsubai#endif /* _MACPPC_AMSVAR_H_ */
78