diff --git a/Sming/Arch/Rp2040/Components/rp2040/src/.cs b/Sming/Arch/Rp2040/Components/rp2040/src/.cs new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Sming/Arch/Rp2040/Components/rp2040/src/include/esp_systemapi.h b/Sming/Arch/Rp2040/Components/rp2040/src/include/esp_systemapi.h index b3b9dc7a59..071ee8ecfe 100644 --- a/Sming/Arch/Rp2040/Components/rp2040/src/include/esp_systemapi.h +++ b/Sming/Arch/Rp2040/Components/rp2040/src/include/esp_systemapi.h @@ -32,7 +32,6 @@ extern void ets_wdt_enable(void); extern void ets_wdt_disable(void); extern void wdt_feed(void); - /** @brief Disable interrupts * @retval Current interrupt level * @note Hardware timer is unaffected if operating in non-maskable mode diff --git a/Sming/Arch/Rp2040/Components/rp2040/src/tasks.cpp b/Sming/Arch/Rp2040/Components/rp2040/src/tasks.cpp index cabd0903fe..64fd7b6164 100644 --- a/Sming/Arch/Rp2040/Components/rp2040/src/tasks.cpp +++ b/Sming/Arch/Rp2040/Components/rp2040/src/tasks.cpp @@ -4,17 +4,17 @@ #include #include -namespace { - +namespace +{ class TaskQueue { public: static void init() { - spinlock = spin_lock_claim_unused(true); + spinlock = spin_lock_claim_unused(true); } - TaskQueue(os_task_t callback, uint8_t length): callback(callback) + TaskQueue(os_task_t callback, uint8_t length) : callback(callback) { queue_init_with_spinlock(&queue, sizeof(os_event_t), length, spinlock); } @@ -26,7 +26,7 @@ class TaskQueue bool __forceinline post(os_signal_t sig, os_param_t par) { - os_event_t event {sig, par}; + os_event_t event{sig, par}; return queue_try_add(&queue, &event); } @@ -60,7 +60,7 @@ const uint8_t SYSTEM_TASK_QUEUE_LENGTH = 8; TaskQueue* task_queues[SYSTEM_TASK_PRIO + 1]; -}; +}; // namespace bool system_os_task(os_task_t callback, os_task_priority_t prio, os_event_t* events, uint8_t qlen) { diff --git a/Sming/Arch/Rp2040/Components/rp2040/src/wifi.cpp b/Sming/Arch/Rp2040/Components/rp2040/src/wifi.cpp index 3f4bc29f78..d048995da7 100644 --- a/Sming/Arch/Rp2040/Components/rp2040/src/wifi.cpp +++ b/Sming/Arch/Rp2040/Components/rp2040/src/wifi.cpp @@ -19,12 +19,13 @@ extern "C" { IMPORT_FSTR_ARRAY_LOCAL(cyw43_firmware, uint8_t, CYW43_FIRMWARE) #endif -namespace { - +namespace +{ #define BUFFER_SIZE 16384 #define DICT_SIZE 32767 -class Decompressor { +class Decompressor +{ public: explicit Decompressor(const FSTR::ObjectBase& data) : stream(new FlashMemoryStream(data)) { @@ -39,24 +40,24 @@ class Decompressor { uzlib_init(); uzlib_uncompress_init(&state, dict, DICT_SIZE); state.source_read_cb = read_source; - int res = uzlib_gzip_parse_header(&state); - if (res != TINF_OK) { + int res = uzlib_gzip_parse_header(&state); + if(res != TINF_OK) { debug_e("[CYW] bad GZIP header %d", res); return false; } - return true; + return true; } bool read(void* dest, size_t length) { - state.dest = static_cast(dest); - state.dest_limit = state.dest + length; - int res = uzlib_uncompress_chksum(&state); + state.dest = static_cast(dest); + state.dest_limit = state.dest + length; + int res = uzlib_uncompress_chksum(&state); if(res != TINF_OK) { debug_e("[CYW] Decompress error %d", res); return false; } - return true; + return true; } private: @@ -75,15 +76,16 @@ class Decompressor { return *self->state.source++; } - struct uzlib_uncomp state{}; + struct uzlib_uncomp state { + }; uint8_t src_buffer[BUFFER_SIZE]{}; - uint8_t dict[DICT_SIZE]; + uint8_t dict[DICT_SIZE]; std::unique_ptr stream; }; std::unique_ptr decompressor; -} +} // namespace int cyw43_storage_init() { @@ -98,12 +100,12 @@ int cyw43_storage_init() } #endif - if (!decompressor || !decompressor->init()) { + if(!decompressor || !decompressor->init()) { decompressor.reset(); - return -1; - } + return -1; + } - return 0; + return 0; } uint32_t cyw43_storage_read(void* dest, uint32_t length) @@ -115,9 +117,9 @@ uint32_t cyw43_storage_read(void* dest, uint32_t length) if(!decompressor->read(dest, length)) { decompressor.reset(); return 0; - } + } - return length; + return length; } void cyw43_storage_cleanup()