Fix USB suspend for Fraucheky.
authorNIIBE Yutaka <gniibe@fsij.org>
Thu, 18 Jan 2018 08:06:17 +0000 (17:06 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Thu, 18 Jan 2018 08:06:17 +0000 (17:06 +0900)
ChangeLog
src/main.c
src/stack-def.h

index 967a6c3..9b7ec5e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2018-01-18  NIIBE Yutaka  <gniibe@fsij.org>
 
 2018-01-18  NIIBE Yutaka  <gniibe@fsij.org>
 
+       * src/main.c (usb_main): USB suspend fix for Fraucheky.
+
+       * src/stack-def.h (SIZE_0, SIZE_1): Increase.
+
+2018-01-18  NIIBE Yutaka  <gniibe@fsij.org>
+
        * src/neug.c [GNU_LINUX_EMULATION] (crc32_rv_stop): Defined.
 
        * src/main.c (main, usb_main): Support USB suspend.
        * src/neug.c [GNU_LINUX_EMULATION] (crc32_rv_stop): Defined.
 
        * src/main.c (main, usb_main): Support USB suspend.
index e55a2ef..2110dd4 100644 (file)
@@ -862,14 +862,20 @@ usb_main (void *arg)
                break;
 
              case USB_EVENT_DEVICE_SUSPEND:
                break;
 
              case USB_EVENT_DEVICE_SUSPEND:
-               neug_fini ();
+#ifdef FRAUCHEKY_SUPPORT
+               if (running_neug)
+#endif
+                 neug_fini ();
                chopstx_conf_idle (2);
                bDeviceState |= USB_DEVICE_STATE_SUSPEND;
                break;
 
              case USB_EVENT_DEVICE_WAKEUP:
                chopstx_conf_idle (1);
                chopstx_conf_idle (2);
                bDeviceState |= USB_DEVICE_STATE_SUSPEND;
                break;
 
              case USB_EVENT_DEVICE_WAKEUP:
                chopstx_conf_idle (1);
-               neug_init (random_word, RANDOM_BYTES_LENGTH/sizeof (uint32_t));
+#ifdef FRAUCHEKY_SUPPORT
+               if (running_neug)
+#endif
+                 neug_init (random_word, RANDOM_BYTES_LENGTH/sizeof (uint32_t));
                bDeviceState &= ~USB_DEVICE_STATE_SUSPEND;
                break;
 
                bDeviceState &= ~USB_DEVICE_STATE_SUSPEND;
                break;
 
@@ -1127,7 +1133,11 @@ main (int argc, char **argv)
       bDeviceState = USB_DEVICE_STATE_UNCONNECTED;
     }
 
       bDeviceState = USB_DEVICE_STATE_UNCONNECTED;
     }
 
+  neug_init (random_word, RANDOM_BYTES_LENGTH/sizeof (uint32_t));
+
   running_neug = 1;
   running_neug = 1;
+#else
+  neug_init (random_word, RANDOM_BYTES_LENGTH/sizeof (uint32_t));
 #endif
 
   led_thread = chopstx_create (PRIO_LED, STACK_ADDR_LED, STACK_SIZE_LED,
 #endif
 
   led_thread = chopstx_create (PRIO_LED, STACK_ADDR_LED, STACK_SIZE_LED,
@@ -1136,8 +1146,6 @@ main (int argc, char **argv)
   usb_thd = chopstx_create (PRIO_USB, STACK_ADDR_USB, STACK_SIZE_USB,
                            usb_main, NULL);
 
   usb_thd = chopstx_create (PRIO_USB, STACK_ADDR_USB, STACK_SIZE_USB,
                            usb_main, NULL);
 
-  neug_init (random_word, RANDOM_BYTES_LENGTH/sizeof (uint32_t));
-
   chopstx_mutex_lock (&usb_mtx);
 
  not_configured:
   chopstx_mutex_lock (&usb_mtx);
 
  not_configured:
index 8885f88..bf1a6e7 100644 (file)
@@ -3,8 +3,8 @@
 #define SIZE_2 4096
 #define SIZE_3 4096
 #else
 #define SIZE_2 4096
 #define SIZE_3 4096
 #else
-#define SIZE_0 0x0140 /* Main */
-#define SIZE_1 0x00c0 /* LED */
+#define SIZE_0 0x0160 /* Main */
+#define SIZE_1 0x00e0 /* LED */
 #define SIZE_2 0x0180 /* RNG */
 #define SIZE_3 0x0140 /* USB */
 #endif
 #define SIZE_2 0x0180 /* RNG */
 #define SIZE_3 0x0140 /* USB */
 #endif