[FL-2591] Furi: remove CMSIS thread api, migrate to FuriThread, remove unused CMSIS APIs (#1333)

* Furi: remove CMSIS thread api, migrate to FuriThread, remove unused CMSIS APIs
* Furi: magic thread catcher validating thread completion; backtrace improver
* Furi: allow furi_thread_get_current_id outside of thread context
* Furi: use IRQ instead of ISR for core primitives
This commit is contained in:
あく
2022-06-20 17:54:48 +03:00
committed by GitHub
parent 7618c8ba6f
commit 839e52ac32
61 changed files with 1467 additions and 2784 deletions

View File

@@ -101,7 +101,7 @@ bool furi_hal_usb_set_config(FuriHalUsbInterface* new_if, void* ctx) {
return true;
}
furi_assert(usb.thread);
osThreadFlagsSet(furi_thread_get_thread_id(usb.thread), EventModeChange);
furi_thread_flags_set(furi_thread_get_id(usb.thread), EventModeChange);
return true;
}
@@ -125,17 +125,17 @@ bool furi_hal_usb_is_locked() {
void furi_hal_usb_disable() {
furi_assert(usb.thread);
osThreadFlagsSet(furi_thread_get_thread_id(usb.thread), EventDisable);
furi_thread_flags_set(furi_thread_get_id(usb.thread), EventDisable);
}
void furi_hal_usb_enable() {
furi_assert(usb.thread);
osThreadFlagsSet(furi_thread_get_thread_id(usb.thread), EventEnable);
furi_thread_flags_set(furi_thread_get_id(usb.thread), EventEnable);
}
void furi_hal_usb_reinit() {
furi_assert(usb.thread);
osThreadFlagsSet(furi_thread_get_thread_id(usb.thread), EventReinit);
furi_thread_flags_set(furi_thread_get_id(usb.thread), EventReinit);
}
/* Get device / configuration descriptors */
@@ -148,7 +148,7 @@ static usbd_respond usb_descriptor_get(usbd_ctlreq* req, void** address, uint16_
switch(dtype) {
case USB_DTYPE_DEVICE:
osThreadFlagsSet(furi_thread_get_thread_id(usb.thread), EventRequest);
furi_thread_flags_set(furi_thread_get_id(usb.thread), EventRequest);
if(usb.callback != NULL) {
usb.callback(FuriHalUsbStateEventDescriptorRequest, usb.cb_ctx);
}
@@ -192,7 +192,7 @@ static void reset_evt(usbd_device* dev, uint8_t event, uint8_t ep) {
UNUSED(dev);
UNUSED(event);
UNUSED(ep);
osThreadFlagsSet(furi_thread_get_thread_id(usb.thread), EventReset);
furi_thread_flags_set(furi_thread_get_id(usb.thread), EventReset);
if(usb.callback != NULL) {
usb.callback(FuriHalUsbStateEventReset, usb.cb_ctx);
}
@@ -236,11 +236,11 @@ static int32_t furi_hal_usb_thread(void* context) {
FuriHalUsbInterface* if_ctx_new = NULL;
if(usb.if_next != NULL) {
osThreadFlagsSet(furi_thread_get_thread_id(usb.thread), EventModeChange);
furi_thread_flags_set(furi_thread_get_id(usb.thread), EventModeChange);
}
while(true) {
uint32_t flags = osThreadFlagsWait(USB_SRV_ALL_EVENTS, osFlagsWaitAny, 500);
uint32_t flags = furi_thread_flags_wait(USB_SRV_ALL_EVENTS, osFlagsWaitAny, 500);
if((flags & osFlagsError) == 0) {
if(flags & EventModeChange) {
if(usb.if_next != usb.if_cur) {