@@ -652,10 +652,13 @@ static void usb_control(uint32_t stat) | |||
} | |||
#endif | |||
#ifdef SEREMU_INTERFACE | |||
if (setup.word1 == 0x03000921 && setup.word2 == ((4<<16)|SEREMU_INTERFACE) | |||
&& buf[0] == 0xA9 && buf[1] == 0x45 && buf[2] == 0xC2 && buf[3] == 0x6B) { | |||
usb_reboot_timer = 5; | |||
endpoint0_transmit(NULL, 0); | |||
if (setup.word1 == 0x03000921 && setup.word2 == ((4<<16)|SEREMU_INTERFACE)) { | |||
if (buf[0] == 0xA9 && buf[1] == 0x45 && buf[2] == 0xC2 && buf[3] == 0x6B) { | |||
usb_reboot_timer = 5; | |||
endpoint0_transmit(NULL, 0); | |||
} else { | |||
usb_seremu_online = 1; | |||
} | |||
} | |||
#endif | |||
#ifdef AUDIO_INTERFACE |
@@ -70,6 +70,7 @@ static inline uint32_t usb_rx_byte_count(uint32_t endpoint) | |||
#ifdef SEREMU_INTERFACE | |||
extern volatile uint8_t usb_seremu_transmit_flush_timer; | |||
extern void usb_seremu_flush_callback(void); | |||
extern volatile uint8_t usb_seremu_online; | |||
#endif | |||
#ifdef KEYBOARD_INTERFACE |
@@ -42,6 +42,7 @@ volatile uint8_t usb_seremu_transmit_flush_timer=0; | |||
static usb_packet_t *rx_packet=NULL; | |||
static usb_packet_t *tx_packet=NULL; | |||
static volatile uint8_t tx_noautoflush=0; | |||
volatile uint8_t usb_seremu_online=0; | |||
#define TRANSMIT_FLUSH_TIMEOUT 5 /* in milliseconds */ | |||
@@ -54,6 +54,7 @@ void usb_seremu_flush_output(void); | |||
void usb_seremu_flush_callback(void); | |||
extern volatile uint8_t usb_seremu_transmit_flush_timer; | |||
extern volatile uint8_t usb_configuration; | |||
extern volatile uint8_t usb_seremu_online; | |||
#ifdef __cplusplus | |||
} | |||
#endif | |||
@@ -86,7 +87,7 @@ public: | |||
uint8_t numbits(void) { return 8; } | |||
uint8_t dtr(void) { return 1; } | |||
uint8_t rts(void) { return 1; } | |||
operator bool() { return usb_configuration; } | |||
operator bool() { return usb_configuration && usb_seremu_online; } | |||
}; | |||
extern usb_seremu_class Serial; | |||
extern void serialEvent(void); |
@@ -775,12 +775,16 @@ static void endpoint0_complete(void) | |||
} | |||
#endif | |||
#ifdef SEREMU_INTERFACE | |||
if (setup.word1 == 0x03000921 && setup.word2 == ((4<<16)|SEREMU_INTERFACE) | |||
&& endpoint0_buffer[0] == 0xA9 && endpoint0_buffer[1] == 0x45 | |||
&& endpoint0_buffer[2] == 0xC2 && endpoint0_buffer[3] == 0x6B) { | |||
printf("seremu reboot request\n"); | |||
usb_start_sof_interrupts(NUM_INTERFACE); | |||
usb_reboot_timer = 80; // TODO: 10 if only 12 Mbit/sec | |||
if (setup.word1 == 0x03000921 && setup.word2 == ((4<<16)|SEREMU_INTERFACE)) { | |||
if (endpoint0_buffer[0] == 0xA9 && endpoint0_buffer[1] == 0x45 | |||
&& endpoint0_buffer[2] == 0xC2 && endpoint0_buffer[3] == 0x6B) { | |||
printf("seremu reboot request\n"); | |||
usb_start_sof_interrupts(NUM_INTERFACE); | |||
usb_reboot_timer = 80; // TODO: 10 if only 12 Mbit/sec | |||
} else { | |||
// any other feature report means Arduino Serial Monitor is open | |||
usb_seremu_online = 1; | |||
} | |||
} | |||
#endif | |||
#ifdef AUDIO_INTERFACE |
@@ -40,6 +40,7 @@ | |||
static volatile uint8_t tx_noautoflush=0; | |||
extern volatile uint8_t usb_high_speed; | |||
volatile uint8_t usb_seremu_online=0; | |||
// TODO: should be 2 different timeouts, high speed (480) vs full speed (12) | |||
#define TRANSMIT_FLUSH_TIMEOUT 75 /* in microseconds */ |
@@ -51,6 +51,7 @@ int usb_seremu_write(const void *buffer, uint32_t size); | |||
int usb_seremu_write_buffer_free(void); | |||
void usb_seremu_flush_output(void); | |||
extern volatile uint8_t usb_configuration; | |||
extern volatile uint8_t usb_seremu_online; | |||
#ifdef __cplusplus | |||
} | |||
#endif | |||
@@ -83,7 +84,7 @@ public: | |||
uint8_t numbits(void) { return 8; } | |||
uint8_t dtr(void) { return 1; } | |||
uint8_t rts(void) { return 1; } | |||
operator bool() { return usb_configuration; } | |||
operator bool() { return usb_configuration && usb_seremu_online; } | |||
}; | |||
extern usb_seremu_class Serial; | |||
extern void serialEvent(void); |