minix/drivers/printer/liveupdate.c
David van Moolenbroek 6331e8f845 Retire the synchronous character driver protocol
- change all sync char drivers into async drivers;
- retire support for the sync protocol in libchardev;
- remove async dev style, as this is now the default;
- remove dev_status from VFS;
- clean up now-unused protocol messages.

Change-Id: I6aacff712292f6b29f2ccd51bc1e7d7003723e87
2014-02-18 11:25:02 +01:00

64 lines
2.1 KiB
C

#include <minix/drivers.h>
/* State management variables. */
EXTERN int writing;
/* Custom states definition. */
#define PR_STATE_WRITE_PROTOCOL_FREE (SEF_LU_STATE_CUSTOM_BASE + 0)
#define PR_STATE_IS_CUSTOM(s) ((s) == PR_STATE_WRITE_PROTOCOL_FREE)
/*===========================================================================*
* sef_cb_lu_prepare *
*===========================================================================*/
int sef_cb_lu_prepare(int state)
{
int is_ready;
/* Check if we are ready for the target state. */
is_ready = FALSE;
switch(state) {
/* Standard states. */
case SEF_LU_STATE_REQUEST_FREE:
is_ready = TRUE;
break;
case SEF_LU_STATE_PROTOCOL_FREE:
is_ready = (!writing);
break;
/* Custom states. */
case PR_STATE_WRITE_PROTOCOL_FREE:
is_ready = (!writing);
break;
}
/* Tell SEF if we are ready. */
return is_ready ? OK : ENOTREADY;
}
/*===========================================================================*
* sef_cb_lu_state_isvalid *
*===========================================================================*/
int sef_cb_lu_state_isvalid(int state)
{
return SEF_LU_STATE_IS_STANDARD(state) || PR_STATE_IS_CUSTOM(state);
}
/*===========================================================================*
* sef_cb_lu_state_dump *
*===========================================================================*/
void sef_cb_lu_state_dump(int state)
{
sef_lu_dprint("printer: live update state = %d\n", state);
sef_lu_dprint("printer: writing = %d\n", writing);
sef_lu_dprint("printer: SEF_LU_STATE_WORK_FREE(%d) reached = %d\n",
SEF_LU_STATE_WORK_FREE, TRUE);
sef_lu_dprint("printer: SEF_LU_STATE_REQUEST_FREE(%d) reached = %d\n",
SEF_LU_STATE_REQUEST_FREE, TRUE);
sef_lu_dprint("printer: SEF_LU_STATE_PROTOCOL_FREE(%d) reached = %d\n",
SEF_LU_STATE_PROTOCOL_FREE, (!writing));
sef_lu_dprint("printer: PR_STATE_WRITE_PROTOCOL_FREE(%d) reached = %d\n",
PR_STATE_WRITE_PROTOCOL_FREE, (!writing));
}