Browse Source

Rename auto_off -> watchdog

Keir Fraser 4 years ago
parent
commit
de9c26d23f
4 changed files with 28 additions and 28 deletions
  1. 1 1
      inc/cdc_acm_protocol.h
  2. 5 5
      scripts/greaseweazle/tools/delays.py
  3. 8 8
      scripts/greaseweazle/usb.py
  4. 14 14
      src/floppy.c

+ 1 - 1
inc/cdc_acm_protocol.h

@@ -192,7 +192,7 @@ struct packed gw_delay {
     uint16_t step_delay;   /* usec */
     uint16_t seek_settle;  /* msec */
     uint16_t motor_delay;  /* msec */
-    uint16_t auto_off;     /* msec */
+    uint16_t watchdog;     /* msec */
 };
 
 /* CMD_SWITCH_FW_MODE */

+ 5 - 5
scripts/greaseweazle/tools/delays.py

@@ -27,8 +27,8 @@ def main(argv):
                         help="settle delay after seek (msecs)")
     parser.add_argument("--motor", type=int,
                         help="delay after motor on (msecs)")
-    parser.add_argument("--auto-off", type=int,
-                        help="quiescent time until auto deselect (msecs)")
+    parser.add_argument("--watchdog", type=int,
+                        help="quiescent time until drives reset (msecs)")
     parser.description = description
     parser.prog += ' ' + argv[1]
     args = parser.parse_args(argv[2:])
@@ -45,14 +45,14 @@ def main(argv):
             usb.seek_settle_delay = args.settle
         if args.motor:
             usb.motor_delay = args.motor
-        if args.auto_off:
-            usb.auto_off_delay = args.auto_off
+        if args.watchdog:
+            usb.watchdog_delay = args.watchdog
 
         print("Select Delay: %uus" % usb.select_delay)
         print("Step Delay: %uus" % usb.step_delay)
         print("Settle Time: %ums" % usb.seek_settle_delay)
         print("Motor Delay: %ums" % usb.motor_delay)
-        print("Auto Off: %ums" % usb.auto_off_delay)
+        print("Watchdog: %ums" % usb.watchdog_delay)
 
     except USB.CmdError as error:
         print("Command Failed: %s" % error)

+ 8 - 8
scripts/greaseweazle/usb.py

@@ -181,7 +181,7 @@ class Unit:
         self._send_cmd(struct.pack("4B", Cmd.GetParams, 4, Params.Delays, 10))
         (self._select_delay, self._step_delay,
          self._seek_settle_delay, self._motor_delay,
-         self._auto_off_delay) = struct.unpack("<5H", self.ser.read(10))
+         self._watchdog_delay) = struct.unpack("<5H", self.ser.read(10))
 
 
     ## reset:
@@ -485,7 +485,7 @@ class Unit:
     ##  step_delay:        Delay (usec) after issuing a head-step command
     ##  seek_settle_delay: Delay (msec) after completing a head-seek operation
     ##  motor_delay:       Delay (msec) after turning on drive spindle motor
-    ##  auto_off_delay:    Timeout (msec) since last command upon which all
+    ##  watchdog_delay:    Timeout (msec) since last command upon which all
     ##                     drives are deselected and spindle motors turned off
     ##
 
@@ -494,7 +494,7 @@ class Unit:
                                    3+5*2, Params.Delays,
                                    self._select_delay, self._step_delay,
                                    self._seek_settle_delay,
-                                   self._motor_delay, self._auto_off_delay))
+                                   self._motor_delay, self._watchdog_delay))
 
     @property
     def select_delay(self):
@@ -529,11 +529,11 @@ class Unit:
         self._set_delays()
 
     @property
-    def auto_off_delay(self):
-        return self._auto_off_delay
-    @auto_off_delay.setter
-    def auto_off_delay(self, auto_off_delay):
-        self._auto_off_delay = auto_off_delay
+    def watchdog_delay(self):
+        return self._watchdog_delay
+    @watchdog_delay.setter
+    def watchdog_delay(self, watchdog_delay):
+        self._watchdog_delay = watchdog_delay
         self._set_delays()
 
 # Local variables:

+ 14 - 14
src/floppy.c

@@ -42,7 +42,7 @@ static const struct gw_delay factory_delay_params = {
     .step_delay = 5000,
     .seek_settle = 15,
     .motor_delay = 750,
-    .auto_off = 10000
+    .watchdog = 10000
 };
 
 #if STM32F == 1
@@ -81,7 +81,7 @@ static struct dma_ring {
 static struct {
     time_t deadline;
     bool_t armed;
-} auto_off;
+} watchdog;
 
 /* Marshalling and unmarshalling of USB packets. */
 static struct {
@@ -226,7 +226,7 @@ static void quiesce_drives(void)
 
     drive_deselect();
 
-    auto_off.armed = FALSE;
+    watchdog.armed = FALSE;
 }
 
 static void _set_bus_type(uint8_t type)
@@ -293,20 +293,20 @@ struct gw_info gw_info = {
     .hw_model = STM32F
 };
 
-static void auto_off_nudge(void)
+static void watchdog_kick(void)
 {
-    auto_off.deadline = time_now() + time_ms(delay_params.auto_off);
+    watchdog.deadline = time_now() + time_ms(delay_params.watchdog);
 }
 
-static void auto_off_arm(void)
+static void watchdog_arm(void)
 {
-    auto_off.armed = TRUE;
-    auto_off_nudge();
+    watchdog.armed = TRUE;
+    watchdog_kick();
 }
 
 static void floppy_end_command(void *ack, unsigned int ack_len)
 {
-    auto_off_arm();
+    watchdog_arm();
     usb_write(EP_TX, ack, ack_len);
     u_cons = u_prod = 0;
     if (floppy_state == ST_command_wait)
@@ -358,9 +358,9 @@ static void rdata_encode_flux(void)
         u_buf[U_MASK(u_prod++)] = 0xff;
         u_buf[U_MASK(u_prod++)] = FLUXOP_INDEX;
         _write_28bit(ticks);
-        /* Defer auto-off while read is progressing (as measured by index
+        /* Defer watchdog while read is progressing (as measured by index
          * pulses).  */
-        auto_off_nudge();
+        watchdog_kick();
     }
 
     IRQ_global_enable();
@@ -1085,7 +1085,7 @@ static void process_command(void)
     uint8_t len = u_buf[1];
     uint8_t resp_sz = 2;
 
-    auto_off_arm();
+    watchdog_arm();
     act_led(TRUE);
 
     switch (cmd) {
@@ -1275,7 +1275,7 @@ bad_command:
 
 static void floppy_configure(void)
 {
-    auto_off_arm();
+    watchdog_arm();
     floppy_flux_end();
     floppy_state = ST_command_wait;
     u_cons = u_prod = 0;
@@ -1286,7 +1286,7 @@ void floppy_process(void)
 {
     int len;
 
-    if (auto_off.armed && (time_since(auto_off.deadline) >= 0)) {
+    if (watchdog.armed && (time_since(watchdog.deadline) >= 0)) {
         floppy_configure();
         quiesce_drives();
     }