fixed usb serial not working after reconnect (#2196)

* fixed usb serial not working after reconnect

* added restart for sd over usb disconnect

* improved usb serial fix

* fixed formatting
This commit is contained in:
Bernd Herzog
2024-07-17 11:17:42 +02:00
committed by GitHub
parent 048359fb0e
commit 19eb6b44d5
6 changed files with 25 additions and 5 deletions

View File

@@ -22,13 +22,23 @@
#include "ch.h"
#include "hal.h"
#include <libopencm3/lpc43xx/usb.h>
extern "C" {
void start_usb(void);
void irq_usb(void);
void usb_transfer(void);
extern volatile bool scsi_running;
CH_IRQ_HANDLER(Vector60) {
const uint32_t status = USB0_USBSTS_D & USB0_USBINTR_D;
if (status & USB0_USBSTS_D_SLI) {
// USB reset received.
if (scsi_running) {
LPC_RGU->RESET_CTRL[0] = (1 << 0);
}
}
irq_usb();
}
}

View File

@@ -23,7 +23,7 @@
#include "sd_over_usb.h"
#include "scsi.h"
bool scsi_running = false;
volatile bool scsi_running = false;
usb_request_status_t report_max_lun(
usb_endpoint_t* const endpoint,