Device Event Notification
A device driver sends events occurring in devices to the event notification message buffer (TDN_EVENT) as device event notification. When registering devices, whether the system specifies the default message buffer for event notification or not is implementation-defined.
The following event types are defined.
typedef enum tdevttyp {
TDE_unknown = 0, /* undefined */
TDE_MOUNT = 0x01, /* media mounted */
TDE_EJECT = 0x02, /* media ejected */
TDE_ILLMOUNT = 0x03, /* media illegally mounted */
TDE_ILLEJECT = 0x04, /* media illegally ejected */
TDE_REMOUNT = 0x05, /* media remounted */
TDE_CARDBATLOW = 0x06, /* card battery alarm */
TDE_CARDBATFAIL = 0x07, /* card battery failure */
TDE_REQEJECT = 0x08, /* media eject request */
TDE_PDBUT = 0x11, /* PD button state change */
TDE_PDMOVE = 0x12, /* PD move */
TDE_PDSTATE = 0x13, /* PD state change */
TDE_PDEXT = 0x14, /* PD extended event */
TDE_KEYDOWN = 0x21, /* key down */
TDE_KEYUP = 0x22, /* key up */
TDE_KEYMETA = 0x23, /* meta key state change */
TDE_POWEROFF = 0x31, /* power switch off */
TDE_POWERLOW = 0x32, /* low power alarm */
TDE_POWERFAIL = 0x33, /* power failure */
TDE_POWERSUS = 0x34, /* auto suspend */
TDE_POWERUPTM = 0x35, /* clock update */
TDE_CKPWON = 0x41 /* auto power on notification */
} TDEvttyp;
Device events are notified in the following format. The contents of event notification and size differ with each event type.
typedef struct t_devevt {
TDEvttyp evttyp; /* event type */
/* Information specific to each event type is appended here. */
} T_DEVEVT;
The format of device event notification with device ID is as follows.
typedef struct t_devevt_id {
TDEvttyp evttyp; /* event type */
ID devid; /* device ID */
/* Information specific to each event type is appended here. */
} T_DEVEVT_ID;
See the device driver specifications for event details.
Measures must be taken so that if event notification cannot be sent because the message buffer is full, the lack of notification will not adversely affect operation on the receiving end. One option is to hold the notification until space becomes available in the message buffer, but in that case other device driver processing should not, as a rule, be allowed to fall behind as a result. Processing on the receiving end should be designed to the extent possible to avoid message buffer overflow.

Comments
Click here to Post a Comment