Blocking USB driver API (#2009)
* invalidate memmgt thread dict * Core: rollback memmgt thread dict invalidation * Dialogs: move api lock to toolbox * HAL: blocking usb API * HAL usb: fix api return data * HAL usb: api optimization * api lock: test results * Fix build errors * DAP Link: fix imports * Crash when malloc in ISR * Fix dap-link copypaste error * Moar memory management crashes. * Crash when malloc in IRQ, not ISR * USB-UART: Blocking VCP mode switch Co-authored-by: nminaylov <nm29719@gmail.com> Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
@@ -247,7 +247,6 @@ static int32_t dap_process(void* p) {
|
||||
|
||||
// deinit usb
|
||||
furi_hal_usb_set_config(usb_config_prev, NULL);
|
||||
dap_common_wait_for_deinit();
|
||||
dap_common_usb_free_name();
|
||||
dap_deinit_gpio(swd_pins_prev);
|
||||
return 0;
|
||||
|
@@ -618,23 +618,12 @@ static void hid_init(usbd_device* dev, FuriHalUsbInterface* intf, void* ctx) {
|
||||
if(dap_state.semaphore_v2 == NULL) dap_state.semaphore_v2 = furi_semaphore_alloc(1, 1);
|
||||
if(dap_state.semaphore_cdc == NULL) dap_state.semaphore_cdc = furi_semaphore_alloc(1, 1);
|
||||
|
||||
usb_hid.dev_descr->idVendor = DAP_HID_VID;
|
||||
usb_hid.dev_descr->idProduct = DAP_HID_PID;
|
||||
|
||||
usbd_reg_config(dev, hid_ep_config);
|
||||
usbd_reg_control(dev, hid_control);
|
||||
|
||||
usbd_connect(dev, true);
|
||||
}
|
||||
|
||||
static bool deinit_flag = false;
|
||||
|
||||
void dap_common_wait_for_deinit() {
|
||||
while(!deinit_flag) {
|
||||
furi_delay_ms(50);
|
||||
}
|
||||
}
|
||||
|
||||
static void hid_deinit(usbd_device* dev) {
|
||||
dap_state.usb_dev = NULL;
|
||||
|
||||
@@ -647,12 +636,6 @@ static void hid_deinit(usbd_device* dev) {
|
||||
|
||||
usbd_reg_config(dev, NULL);
|
||||
usbd_reg_control(dev, NULL);
|
||||
|
||||
free(usb_hid.str_manuf_descr);
|
||||
free(usb_hid.str_prod_descr);
|
||||
|
||||
FURI_SW_MEMBARRIER();
|
||||
deinit_flag = true;
|
||||
}
|
||||
|
||||
static void hid_on_wakeup(usbd_device* dev) {
|
||||
|
@@ -51,5 +51,3 @@ void dap_common_usb_set_state_callback(DapStateCallback callback);
|
||||
void dap_common_usb_alloc_name(const char* name);
|
||||
|
||||
void dap_common_usb_free_name();
|
||||
|
||||
void dap_common_wait_for_deinit();
|
Reference in New Issue
Block a user