static uint8_t fd_selected = 0xFF;
static uint8_t fd_tab[MAX_FD] = { 0xFF, 0xFF };
+void fd_motor_timer(void)
+{
+ if (motorct) {
+ motorct--;
+ if (motorct == 0) {
+ fd_motor_off();
+ fd_selected = 0xFF;
+ }
+ }
+}
+
/*
* We only support normal block I/O
*/
uint8_t err = 0;
uint8_t *driveptr = &fd_tab[minor & 1];
uint8_t cmd[6];
+ irqflags_t irq;
if(rawflag)
goto bad2;
+ irq = di();
if (fd_selected != minor) {
uint8_t err = fd_motor_on(minor|(minor > 1 ? 0: 0x10));
if (err)
goto bad;
+ motorct = 150; /* 3 seconds */
}
+ irqrestore(irq);
dptr = (uint16_t)udata.u_buf->bf_data;
block = udata.u_buf->bf_blk;
int fd_read(uint8_t minor, uint8_t rawflag, uint8_t flag);
int fd_write(uint8_t minor, uint8_t rawflag, uint8_t flag);
int fd_open(uint8_t minor, uint16_t flag);
+void fd_motor_timer(void);
/* low level interface */
uint16_t fd_reset(uint8_t *driveptr);
uint16_t fd_operation(uint8_t *cmd, uint8_t *driveptr);
uint16_t fd_motor_on(uint16_t drivesel);
-uint16_t fd_motor_off(uint16_t driveptr);
+uint16_t fd_motor_off(void);
#endif /* __DEVFD_DOT_H__ */