[FL-2010] furi-hal-vcp rework (#812)

* [FL-2010] furi-hal-vcp rework
* Fix connect state change on vcp enable
* New thread naming scheme and stack size adjustment.
* Applications: rename worker threads to match new naming scheme.

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
Nikolay Minaylov
2021-11-11 19:17:50 +03:00
committed by GitHub
parent ac8b1457f2
commit b564e8eb38
22 changed files with 364 additions and 263 deletions

View File

@@ -65,55 +65,55 @@ extern int32_t power_settings_app(void* p);
const FlipperApplication FLIPPER_SERVICES[] = {
/* Services */
#ifdef SRV_RPC
{.app = rpc_srv, .name = "RPC", .stack_size = 1024 * 4, .icon = NULL},
{.app = rpc_srv, .name = "RpcSrv", .stack_size = 1024 * 4, .icon = NULL},
#endif
#ifdef SRV_BT
{.app = bt_srv, .name = "BT", .stack_size = 1024, .icon = NULL},
{.app = bt_srv, .name = "BtSrv", .stack_size = 1024, .icon = NULL},
#endif
#ifdef SRV_CLI
{.app = cli_srv, .name = "Cli", .stack_size = 4096, .icon = NULL},
{.app = cli_srv, .name = "CliSrv", .stack_size = 4096, .icon = NULL},
#endif
#ifdef SRV_DIALOGS
{.app = dialogs_srv, .name = "Dialogs", .stack_size = 1024, .icon = NULL},
{.app = dialogs_srv, .name = "DialogsSrv", .stack_size = 1024, .icon = NULL},
#endif
#ifdef SRV_DOLPHIN
{.app = dolphin_srv, .name = "Dolphin", .stack_size = 1024, .icon = NULL},
{.app = dolphin_srv, .name = "DolphinSrv", .stack_size = 1024, .icon = NULL},
#endif
#ifdef SRV_DESKTOP
{.app = desktop_srv, .name = "Desktop", .stack_size = 1024, .icon = NULL},
{.app = desktop_srv, .name = "DesktopSrv", .stack_size = 2048, .icon = NULL},
#endif
#ifdef SRV_GUI
{.app = gui_srv, .name = "Gui", .stack_size = 8192, .icon = NULL},
{.app = gui_srv, .name = "GuiSrv", .stack_size = 2048, .icon = NULL},
#endif
#ifdef SRV_INPUT
{.app = input_srv, .name = "Input", .stack_size = 1024, .icon = NULL},
{.app = input_srv, .name = "InputSrv", .stack_size = 1024, .icon = NULL},
#endif
#ifdef SRV_LOADER
{.app = loader_srv, .name = "Loader", .stack_size = 1024, .icon = NULL},
{.app = loader_srv, .name = "LoaderSrv", .stack_size = 1024, .icon = NULL},
#endif
#ifdef SRV_NOTIFICATION
{.app = notification_srv, .name = "Notification", .stack_size = 1024, .icon = NULL},
{.app = notification_srv, .name = "NotificationSrv", .stack_size = 1536, .icon = NULL},
#endif
#ifdef SRV_POWER
{.app = power_srv, .name = "Power", .stack_size = 1024, .icon = NULL},
{.app = power_srv, .name = "PowerSrv", .stack_size = 1024, .icon = NULL},
#endif
#ifdef SRV_POWER_OBSERVER
{.app = power_observer_srv, .name = "PowerObserver", .stack_size = 1024, .icon = NULL},
{.app = power_observer_srv, .name = "PowerAuditSrv", .stack_size = 1024, .icon = NULL},
#endif
#ifdef SRV_STORAGE
{.app = storage_srv, .name = "Storage", .stack_size = 4096, .icon = NULL},
{.app = storage_srv, .name = "StorageSrv", .stack_size = 3072, .icon = NULL},
#endif
};

View File

@@ -8,11 +8,12 @@
#define USB_UART_RX_BUF_SIZE (USB_CDC_PKT_LEN * 5)
typedef enum {
WorkerEvtStop = (1 << 0),
WorkerEvtRxDone = (1 << 1),
WorkerEvtReserved = (1 << 0), // Reserved for StreamBuffer internal event
WorkerEvtStop = (1 << 1),
WorkerEvtRxDone = (1 << 2),
WorkerEvtTxStop = (1 << 2),
WorkerEvtCdcRx = (1 << 3),
WorkerEvtTxStop = (1 << 3),
WorkerEvtCdcRx = (1 << 4),
} WorkerEvtFlags;
#define WORKER_ALL_RX_EVENTS (WorkerEvtStop | WorkerEvtRxDone)
@@ -75,7 +76,7 @@ static int32_t usb_uart_worker(void* context) {
usb_uart->usb_mutex = osMutexNew(NULL);
usb_uart->tx_thread = furi_thread_alloc();
furi_thread_set_name(usb_uart->tx_thread, "usb_uart_tx");
furi_thread_set_name(usb_uart->tx_thread, "UsbUartTxWorker");
furi_thread_set_stack_size(usb_uart->tx_thread, 512);
furi_thread_set_context(usb_uart->tx_thread, NULL);
furi_thread_set_callback(usb_uart->tx_thread, usb_uart_tx_thread);
@@ -191,7 +192,7 @@ void usb_uart_enable(UsbUartConfig* cfg) {
usb_uart = furi_alloc(sizeof(UsbUartParams));
usb_uart->thread = furi_thread_alloc();
furi_thread_set_name(usb_uart->thread, "usb_uart");
furi_thread_set_name(usb_uart->thread, "UsbUartWorker");
furi_thread_set_stack_size(usb_uart->thread, 1024);
furi_thread_set_context(usb_uart->thread, cfg);
furi_thread_set_callback(usb_uart->thread, usb_uart_worker);

View File

@@ -10,7 +10,7 @@
NfcWorker* nfc_worker_alloc() {
NfcWorker* nfc_worker = furi_alloc(sizeof(NfcWorker));
// Worker thread attributes
nfc_worker->thread_attr.name = "nfc_worker";
nfc_worker->thread_attr.name = "NfcWorker";
nfc_worker->thread_attr.stack_size = 8192;
nfc_worker->callback = NULL;
nfc_worker->context = NULL;

View File

@@ -145,7 +145,7 @@ SubGhzFrequencyAnalyzerWorker* subghz_frequency_analyzer_worker_alloc() {
SubGhzFrequencyAnalyzerWorker* instance = furi_alloc(sizeof(SubGhzFrequencyAnalyzerWorker));
instance->thread = furi_thread_alloc();
furi_thread_set_name(instance->thread, "subghz_frequency_analyzer_worker");
furi_thread_set_name(instance->thread, "SubghzFAWorker");
furi_thread_set_stack_size(instance->thread, 2048);
furi_thread_set_context(instance->thread, instance);
furi_thread_set_callback(instance->thread, subghz_frequency_analyzer_worker_thread);