]> git.saurik.com Git - apple/xnu.git/blame - iokit/IOKit/hidsystem/IOHIDTypes.h
xnu-124.13.tar.gz
[apple/xnu.git] / iokit / IOKit / hidsystem / IOHIDTypes.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/******************************************************************************
23 ev_types.h
24 Data types for the events status driver.
25 This file contains public API.
26 mpaque 11Oct91
27
28 Copyright 1991 NeXT Computer, Inc.
29
30 Modified:
31
32******************************************************************************/
33
34#ifndef _DEV_EV_TYPES_H
35#define _DEV_EV_TYPES_H
36
37#include <mach/boolean.h>
38#include <IOKit/IOSharedLock.h>
39#include <IOKit/graphics/IOGraphicsTypes.h>
40
41/* Shared memory versions */
42#define EVENT_SYSTEM_VERSION 2
43
44/* Maximum length of SetMouseScaling arrays */
45#define NX_MAXMOUSESCALINGS 20
46
47typedef struct evsioKeymapping /* Match old struct names in kernel */
48{
49 int size;
50 char *mapping;
51} NXKeyMapping;
52
53typedef struct evsioMouseScaling /* Match old struct names in kernel */
54{
55 int numScaleLevels;
56 short scaleThresholds[NX_MAXMOUSESCALINGS];
57 short scaleFactors[NX_MAXMOUSESCALINGS];
58} NXMouseScaling;
59
60typedef enum {
61 NX_OneButton,
62 NX_LeftButton,
63 NX_RightButton
64} NXMouseButton;
65
66/*
67 * NXEventSystemInfo() information structures. These are designed to
68 * allow for expansion.
69 *
70 * The current implementation of NXEventSystemInfo() uses an ioctl call.
71 * THIS WILL CHANGE.
72 */
73
74/*
75 * Generic query max size and typedefs.
76 *
77 * The maximum size is selected to support anticipated future extensions
78 * of request flavors. Certain flavors planned for future releases may
79 * require roughtly 800 ints to represent. We allow a little extra, in
80 * case further growth is needed.
81 */
82typedef int *NXEventSystemInfoType;
83#define NX_EVS_INFO_MAX (1024) /* Max array size */
84typedef int NXEventSystemInfoData[NX_EVS_INFO_MAX];
85
86/* Event System Devices query */
87#define NX_EVS_DEVICE_MAX 16
88
89 /* Interface types */
90#define NX_EVS_DEVICE_INTERFACE_OTHER 0
91#define NX_EVS_DEVICE_INTERFACE_NeXT 1 // NeXT custom, in older sys
92#define NX_EVS_DEVICE_INTERFACE_ADB 2 // NeXT/fruit keybds/mice
93#define NX_EVS_DEVICE_INTERFACE_ACE 3 // For x86 PC keyboards
94#define NX_EVS_DEVICE_INTERFACE_SERIAL_ACE 4 // For PC serial mice
95#define NX_EVS_DEVICE_INTERFACE_BUS_ACE 5 // For PC bus mice
96#define NX_EVS_DEVICE_INTERFACE_HIL 6 // For HIL hp keyboard
97#define NX_EVS_DEVICE_INTERFACE_TYPE5 7 // For Sun Type5 keyboard
98
99/*
100 * Note! if any new interface types are added above, the following
101 * definition of the number of interfaces supported must reflect this.
102 * This is used in the libkeymap project (storemap.c module) which needs
103 * to be cognizant of the number of new devices coming online
104 * via support for heterogeneous architecture platforms.
105 * e.g., PCs, HP's HIL, Sun's Type5 keyboard,...
106 */
107#define NUM_SUPPORTED_INTERFACES (NX_EVS_DEVICE_INTERFACE_TYPE5 + 1)
108 // Other, NeXT, ADB, ACE,...
109
110 /* Device types */
111#define NX_EVS_DEVICE_TYPE_OTHER 0
112#define NX_EVS_DEVICE_TYPE_KEYBOARD 1
113#define NX_EVS_DEVICE_TYPE_MOUSE 2 // Relative position devices
114#define NX_EVS_DEVICE_TYPE_TABLET 3 // Absolute position devices
115
116typedef struct {
117 int interface; /* NeXT, ADB, other */
118 int interface_addr; /* Device address on the interface */
119 int dev_type; /* Keyboard, mouse, tablet, other */
120 int id; /* manufacturer's device handler ID */
121} NXEventSystemDevice;
122
123typedef struct {
124 NXEventSystemDevice dev[NX_EVS_DEVICE_MAX];
125} NXEventSystemDeviceList;
126
127#define __OLD_NX_EVS_DEVICE_INFO 1
128#define NX_EVS_DEVICE_INFO "Evs_EventDeviceInfo"
129#define NX_EVS_DEVICE_INFO_COUNT \
130 (sizeof (NXEventSystemDeviceList) / sizeof (int))
131
132/*
133 * Types used in evScreen protocol compliant operations.
134 */
135
136typedef enum {EVNOP, EVHIDE, EVSHOW, EVMOVE, EVLEVEL} EvCmd; /* Cursor state */
137
138#define EV_SCREEN_MIN_BRIGHTNESS 0
139#define EV_SCREEN_MAX_BRIGHTNESS 64
140/* Scale should lie between MIN_BRIGHTNESS and MAX_BRIGHTNESS */
141#define EV_SCALE_BRIGHTNESS( scale, datum ) \
142 ((((unsigned long)(datum))*((unsigned long)scale)) >> 6)
143
144/*
145 * Definition of a tick, as a time in milliseconds. This controls how
146 * often the event system periodic jobs are run. All actual tick times
147 * are derived from the nanosecond timer. These values are typically used
148 * as part of computing mouse velocity for acceleration purposes.
149 */
150#define EV_TICK_TIME 16 /* 16 milliseconds */
151#define EV_TICKS_PER_SEC (1000/EV_TICK_TIME) /* ~ 62 Hz */
152
153/* Mouse Button bits, as passed from an EventSrc to the Event Driver */
154#define EV_RB (0x01)
155#define EV_LB (0x04)
156#define EV_MOUSEBUTTONMASK (EV_LB | EV_RB)
157
158/* Tablet Pressure Constants, as passed from an EventSrc to the Event Driver */
159#define EV_MINPRESSURE 0
160#define EV_MAXPRESSURE 255
161
162/* Cursor size in pixels */
163#define EV_CURSOR_WIDTH 16
164#define EV_CURSOR_HEIGHT 16
165
166
167#define kAppleOnboardGUID 0x0610000000000000ULL
168
169#endif /* !_DEV_EV_TYPES_H */
170