/*
 * $Header: /smsa/bsd:include/dev/keyboard.h:bsd  1.7  $
 * $Source: /smsa/bsd:include/dev/keyboard.h: $
 *
 * Copyright (c) 1988 Acorn Computers Ltd., Cambridge, England
 *
 */

#ifndef	__dev_keyboard_h
#define	__dev_keyboard_h
/*
 *
 * facilities of the low level keyboard driver
 *
 */

typedef struct
{
    unsigned short  key_index;			/* index into base_key_table[] */
    short  rel_x, rel_y;			/* for mouse movement only */
    unsigned char event_type;			/* key-up/down, repeat, expansion */
} KBDEvent;

typedef struct
{
    unsigned char action;
    unsigned short param;
} KBDEventAction;

typedef KBDEventAction (*KBDEventProc) (KBDEvent);

/* values of action field in KBDEventAction (returned by KBDEventProc) */
#define KBD_ACTION_NONE      0  /* do nothing (param ignored) */
#define KBD_ACTION_EXPAND    1  /* generate expansion int in <param> msec (for
                                 * multi-character keys (e.g. cursor seq)
                                 */
#define KBD_ACTION_REPEAT    2  /* generate autorepeat int in <param> msec */

/* values of event_type field of KBDEvent */
#define KBD_EVENT_KEYDOWN	0		/* (effective) new key press */
#define KBD_EVENT_KEYUP		1		/* key release */
#define KBD_EVENT_EXPAND	2		/* expand last multi-char key */
#define KBD_EVENT_REPEAT	3		/* auto-repeat of last key */
#define KBD_EVENT_MOUSEPOS	4		/* mouse pos has changed */
#define KBD_EVENT__COUNT	5		/* how many different events */

#ifdef	_KERNEL
extern void KBD_initialise (KBDEventProc key_proc);
extern void KBD_mouse (bool mouse_on);
extern void KBD_scroll_lock (bool lit);
extern void KBD_print_home_action (int mode);
extern int  KBD_type (void);
#endif

/* Values for KBD_print_home_action mode parameter */
#define PH_NORMAL		0		/* generate KX_SPECIAL_xxx */
#define PH_SHIFT		1		/* generate KX_SHIFT_xxx */

#endif/*__dev_keyboard_h*/

/* EOF keyboard.h */
