Fixed drivers. HARD_STOP message no longer exists.
w_transfer, /* do the I/O */
nop_cleanup, /* nothing to clean up */
w_geometry, /* tell the geometry of the disk */
- nop_stop, /* no cleanup needed on shutdown */
- nop_alarm, /* ignore leftover alarms, function key presses, CANCELs, SELECTs */
- nop_fkey,
- nop_cancel,
- nop_select,
+ nop_signal, /* no cleanup needed on shutdown */
+ nop_alarm, /* ignore leftover alarms */
+ nop_cancel, /* ignore CANCELs */
+ nop_select, /* ignore selects */
w_other /* catch-all for unrecognized commands and ioctls */
};
PRIVATE timer_t f_tmr_timeout; /* timer for various timeouts */
PRIVATE timer_t *f_timers; /* queue of floppy timers */
PRIVATE clock_t f_next_timeout; /* the next timeout time */
-FORWARD _PROTOTYPE( void f_expire_tmrs, (struct driver *dp) );
+FORWARD _PROTOTYPE( void f_expire_tmrs, (struct driver *dp, message *m_ptr) );
FORWARD _PROTOTYPE( void f_set_timer, (timer_t *tp, clock_t delta,
tmr_func_t watchdog) );
FORWARD _PROTOTYPE( void stop_motor, (timer_t *tp) );
FORWARD _PROTOTYPE( int f_intr_wait, (void) );
FORWARD _PROTOTYPE( int read_id, (void) );
FORWARD _PROTOTYPE( int f_do_open, (struct driver *dp, message *m_ptr) );
-FORWARD _PROTOTYPE( void floppy_stop, (struct driver *dp) );
+FORWARD _PROTOTYPE( void floppy_stop, (struct driver *dp, message *m_ptr) );
FORWARD _PROTOTYPE( int test_read, (int density) );
FORWARD _PROTOTYPE( void f_geometry, (struct partition *entry));
f_geometry, /* tell the geometry of the diskette */
floppy_stop, /* floppy cleanup on shutdown */
f_expire_tmrs,/* expire all alarm timers */
- nop_fkey, /* ignore function keys and CANCELs */
nop_cancel,
nop_select,
NULL
/*===========================================================================*
* f_expire_tmrs *
*===========================================================================*/
-PRIVATE void f_expire_tmrs(struct driver *dp)
+PRIVATE void f_expire_tmrs(struct driver *dp, message *m_ptr)
{
/* A synchronous alarm message was received. Check if there are any expired
* timers. Possibly reschedule the next alarm.
do {
receive(ANY, &mess);
if (mess.m_type == SYN_ALARM) {
- f_expire_tmrs(NULL);
+ f_expire_tmrs(NULL, NULL);
} else {
f_busy = BSY_IDLE;
}
/*===========================================================================*
* floppy_stop *
*===========================================================================*/
-PRIVATE void floppy_stop(struct driver *dp)
+PRIVATE void floppy_stop(struct driver *dp, message *m_ptr)
{
/* Stop all activity and cleanly exit with the system. */
int s;
- if ((s=sys_outb(DOR, ENABLE_INT)) != OK)
- panic("FLOPPY","Sys_outb in floppy_stop() failed", s);
- sys_exit(0);
+ sigset_t sigset = m_ptr->NOTIFY_ARG;
+ if (sigismember(&sigset, SIGTERM) || sigismember(&sigset, SIGKSTOP)) {
+ if ((s=sys_outb(DOR, ENABLE_INT)) != OK)
+ panic("FLOPPY","Sys_outb in floppy_stop() failed", s);
+ exit(0);
+ }
}
do {
receive(ANY, &mess);
if (mess.m_type == SYN_ALARM) {
- f_expire_tmrs(NULL);
+ f_expire_tmrs(NULL, NULL);
} else {
f_busy = BSY_IDLE;
}
do {
receive(ANY, &mess);
if (mess.m_type == SYN_ALARM) {
- f_expire_tmrs(NULL);
+ f_expire_tmrs(NULL, NULL);
} else { /* expect HARD_INT */
f_busy = BSY_IDLE;
}
do {
receive(ANY, &mess);
if (mess.m_type == SYN_ALARM) {
- f_expire_tmrs(NULL);
+ f_expire_tmrs(NULL, NULL);
} else {
f_busy = BSY_IDLE;
}
/* This file contains device independent device driver interface.
- * Author: Kees J. Bot.
+ *
* Changes:
+ * Jul 25, 2005 added SYS_EVENT type for signals (Jorrit N. Herder)
* Sep 15, 2004 added SYN_ALARM type for timeouts (Jorrit N. Herder)
- * Aug 18, 2004 added HARD_STOP type for shutdown (Jorrit N. Herder)
* Jul 23, 2004 removed kernel dependencies (Jorrit N. Herder)
+ * Apr 02, 1992 constructed from AT wini and floppy driver (Kees J. Bot)
*
*
* The drivers support the following operations (using message format m2):
* The file contains one entry point:
*
* driver_task: called by the device dependent task entry
- *
- *
- * Constructed 92/04/02 by Kees J. Bot from the old AT wini and floppy driver.
*/
#include "../drivers.h"
case HARD_INT: /* leftover interrupt or expired timer. */
continue;
- case HARD_STOP: (*dp->dr_stop)(dp);
- continue; /* don't reply */
- case SYN_ALARM: (*dp->dr_alarm)(dp);
+ case SYS_EVENT: (*dp->dr_signal)(dp, &mess);
continue; /* don't reply */
- case FKEY_PRESSED: (*dp->dr_fkey)(dp, &mess);
+ case SYN_ALARM: (*dp->dr_alarm)(dp, &mess);
continue; /* don't reply */
default:
if(dp->dr_other)
}
/*============================================================================*
- * nop_stop *
+ * nop_signal *
*============================================================================*/
-PUBLIC void nop_stop(dp)
+PUBLIC void nop_signal(dp, mp)
struct driver *dp;
+message *mp;
{
-/* No cleanup needed on shutdown. */
- sys_exit(0);
+/* Default action for signal is to ignore. */
}
/*============================================================================*
* nop_alarm *
*============================================================================*/
-PUBLIC void nop_alarm(dp)
+PUBLIC void nop_alarm(dp, mp)
struct driver *dp;
+message *mp;
{
/* Ignore the leftover alarm. */
}
/* Nothing to clean up. */
}
-/*===========================================================================*
- * nop_fkey *
- *===========================================================================*/
-PUBLIC void nop_fkey(struct driver *dr, message *m)
-{
-/* Nothing to do for fkey. */
-}
/*===========================================================================*
* nop_cancel *
}
-/*===========================================================================*
- * nop_task *
- *===========================================================================*/
-PUBLIC void nop_task()
-{
-/* Unused controllers are "serviced" by this task. */
- struct driver nop_tab = {
- no_name,
- do_nop,
- do_nop,
- do_nop,
- nop_prepare,
- NULL,
- nop_cleanup,
- NULL,
- nop_stop,
- nop_alarm,
- };
- driver_task(&nop_tab);
-}
/*============================================================================*
#include <minix/config.h> /* MUST be first */
#include <ansi.h> /* MUST be second */
#include <minix/type.h>
+#include <minix/ipc.h>
#include <minix/com.h>
#include <minix/callnr.h>
#include <sys/types.h>
iovec_t *iov, unsigned nr_req) );
_PROTOTYPE( void (*dr_cleanup), (void) );
_PROTOTYPE( void (*dr_geometry), (struct partition *entry) );
- _PROTOTYPE( void (*dr_stop), (struct driver *dp) );
- _PROTOTYPE( void (*dr_alarm), (struct driver *dp) );
- _PROTOTYPE( void (*dr_fkey), (struct driver *dp, message *m_ptr) );
+ _PROTOTYPE( void (*dr_signal), (struct driver *dp, message *m_ptr) );
+ _PROTOTYPE( void (*dr_alarm), (struct driver *dp, message *m_ptr) );
_PROTOTYPE( int (*dr_cancel), (struct driver *dp, message *m_ptr) );
_PROTOTYPE( int (*dr_select), (struct driver *dp, message *m_ptr) );
_PROTOTYPE( int (*dr_other), (struct driver *dp, message *m_ptr) );
_PROTOTYPE( struct device *nop_prepare, (int device) );
_PROTOTYPE( void nop_cleanup, (void) );
_PROTOTYPE( void nop_task, (void) );
-_PROTOTYPE( void nop_stop, (struct driver *dp) );
-_PROTOTYPE( void nop_alarm, (struct driver *dp) );
-_PROTOTYPE( void nop_fkey, (struct driver *dp, message *m_ptr) );
+_PROTOTYPE( void nop_signal, (struct driver *dp, message *m_ptr) );
+_PROTOTYPE( void nop_alarm, (struct driver *dp, message *m_ptr) );
_PROTOTYPE( int nop_cancel, (struct driver *dp, message *m_ptr) );
_PROTOTYPE( int nop_select, (struct driver *dp, message *m_ptr) );
_PROTOTYPE( int do_diocntl, (struct driver *dp, message *m_ptr) );
log_transfer, /* do the I/O */
nop_cleanup, /* no need to clean up */
log_geometry, /* geometry */
- nop_stop, /* no need to clean up on shutdown */
+ nop_signal, /* no need to clean up on shutdown */
nop_alarm, /* no alarm */
- nop_fkey, /* no fkey registered */
log_cancel, /* CANCEL request */
log_select, /* DEV_SELECT request */
log_other /* Unrecognized messages */
FORWARD _PROTOTYPE( void m_init, (void) );
FORWARD _PROTOTYPE( int m_ioctl, (struct driver *dp, message *m_ptr) );
FORWARD _PROTOTYPE( void m_geometry, (struct partition *entry) );
-FORWARD _PROTOTYPE( void m_random, (struct driver *dp) );
+FORWARD _PROTOTYPE( void m_random, (struct driver *dp, message *m_ptr) );
/* Entry points to this driver. */
PRIVATE struct driver m_dtab = {
m_transfer, /* do the I/O */
nop_cleanup, /* no need to clean up */
m_geometry, /* memory device "geometry" */
- nop_stop, /* no need to clean up on shutdown */
+ nop_signal, /* system signals */
m_random, /* get randomness from kernel (alarm) */
- nop_fkey, /* ignore function key presses and CANCELs */
nop_cancel,
nop_select,
NULL
}
random_init();
- m_random(NULL); /* also set periodic timer */
+ m_random(NULL, NULL); /* also set periodic timer */
/* Set up memory ranges for /dev/mem. */
#if (CHIP == INTEL)
/*============================================================================*
* m_random *
*============================================================================*/
-PRIVATE void m_random(dp)
+PRIVATE void m_random(dp, m_ptr)
struct driver *dp; /* pointer to driver structure */
+message *m_ptr; /* pointer to alarm message */
{
/* Fetch random information from the kernel to update /dev/random. */
int i, s, r_next, r_size, r_high;
* -------------------------------------------------------
* | HARD_INT | | | | |
* |-------------+---------+---------+---------+---------|
- * | HARD_STOP | | | | |
+ * | SYS_EVENT | | | | |
* |-------------+---------+---------+---------+---------|
* | DEV_WRITE |minor dev| proc nr | count | buf ptr |
* |-------------+---------+---------+---------+---------|
#include "../drivers.h"
-#if ENABLE_PRINTER
-
/* Control bits (in port_base + 2). "+" means positive logic and "-" means
* negative logic. Most of the signals are negative logic on the pins but
* many are converted to positive logic in the ports. Some manuals are
case DEV_WRITE: do_write(&pr_mess); break;
case CANCEL : do_cancel(&pr_mess); break;
case HARD_INT : do_printer_output(); break;
- case HARD_STOP: sys_exit(0);
- /* never reached */
- break;
default:
reply(TASK_REPLY, pr_mess.m_source, pr_mess.PROC_NR, EINVAL);
}
}
-#endif /* ENABLE_PRINTER */
#if DEAD_CODE
notify(proc_nr, &m);
#else
+ printf("alerted %d \n", proc_nr);
alert(proc_nr);
#endif
}
message *m; /* request message to TTY */
{
/* Wait for keystrokes for printing debugging info and reboot. */
-
int quiet, code;
/* A panic! Allow debug dumps until user wants to shutdown. */
*/
while (nb_receive(ANY, m) == OK) {
switch(m->m_type) {
+ case FKEY_CONTROL: do_fkey_ctl(m); break;
case SYS_EVENT: do_new_kmess(m); break;
case DIAGNOSTICS: do_diagnostics(m); break;
default: ; /* do nothing */