Furi, FuriHal: remove FreeRTOS headers leaks (#3179)

* Furi: remove direct FreeRTOS timers use
* Furi: eliminate FreeRTOS headers leak. What did it cost? Everything...
* SubGhz: proper public api for protocols. Format Sources.
* Furi: slightly less redundant declarations
* Desktop: proper types in printf
* Sync API Symbols
* Furi: add timer reset and fix dolphin service, fix unit tests
* Furi: proper timer restart method naming and correct behavior in timer stopped state.

---------

Co-authored-by: hedger <hedger@nanode.su>
This commit is contained in:
あく
2023-11-01 16:24:11 +09:00
committed by GitHub
parent 7bd3bd7ea4
commit aa06328516
68 changed files with 316 additions and 472 deletions
+3 -3
View File
@@ -165,7 +165,7 @@ static int32_t infrared_worker_rx_thread(void* thread_context) {
InfraredWorker* instance = thread_context;
uint32_t events = 0;
LevelDuration level_duration;
TickType_t last_blink_time = 0;
uint32_t last_blink_time = 0;
while(1) {
events = furi_thread_flags_wait(INFRARED_WORKER_ALL_RX_EVENTS, 0, FuriWaitForever);
@@ -173,8 +173,8 @@ static int32_t infrared_worker_rx_thread(void* thread_context) {
if(events & INFRARED_WORKER_RX_RECEIVED) {
if(!instance->rx.overrun && instance->blink_enable &&
((xTaskGetTickCount() - last_blink_time) > 80)) {
last_blink_time = xTaskGetTickCount();
((furi_get_tick() - last_blink_time) > 80)) {
last_blink_time = furi_get_tick();
notification_message(instance->notification, &sequence_blink_blue_10);
}
if(instance->signal.timings_cnt == 0)
+2 -2
View File
@@ -1,7 +1,7 @@
#include "lfrfid_worker_i.h"
#include <furi.h>
#include <furi_hal.h>
#include <atomic.h>
#include "lfrfid_worker_i.h"
typedef enum {
LFRFIDEventStopThread = (1 << 0),
@@ -43,8 +43,6 @@ struct Iso14443_4aPoller {
void* context;
};
Iso14443_4aError iso14443_4a_process_error(Iso14443_3aError error);
const Iso14443_4aData* iso14443_4a_poller_get_data(Iso14443_4aPoller* instance);
Iso14443_4aError iso14443_4a_poller_halt(Iso14443_4aPoller* instance);
@@ -40,8 +40,6 @@ struct Iso14443_4bPoller {
void* context;
};
Iso14443_4bError iso14443_4b_process_error(Iso14443_3bError error);
const Iso14443_4bData* iso14443_4b_poller_get_data(Iso14443_4bPoller* instance);
Iso14443_4bError iso14443_4b_poller_halt(Iso14443_4bPoller* instance);
+2 -1
View File
@@ -1,3 +1,5 @@
#pragma once
#include <stdio.h>
#include <stdint.h>
#include <string.h>
@@ -6,7 +8,6 @@
extern "C" {
#endif
void _putchar(char character);
int __wrap_printf(const char* format, ...);
int __wrap_vsnprintf(char* str, size_t size, const char* format, va_list args);
int __wrap_puts(const char* str);
+1
View File
@@ -12,6 +12,7 @@ env.Append(
File("subghz_tx_rx_worker.h"),
File("transmitter.h"),
File("protocols/raw.h"),
File("protocols/public_api.h"),
File("blocks/const.h"),
File("blocks/decoder.h"),
File("blocks/encoder.h"),
+1 -4
View File
@@ -1,6 +1,7 @@
#pragma once
#include "base.h"
#include "public_api.h"
#define SUBGHZ_PROTOCOL_BIN_RAW_NAME "BinRAW"
@@ -80,10 +81,6 @@ void subghz_protocol_decoder_bin_raw_feed(void* context, bool level, uint32_t du
*/
uint8_t subghz_protocol_decoder_bin_raw_get_hash_data(void* context);
void subghz_protocol_decoder_bin_raw_data_input_rssi(
SubGhzProtocolDecoderBinRAW* instance,
float rssi);
/**
* Serialize data SubGhzProtocolDecoderBinRAW.
* @param context Pointer to a SubGhzProtocolDecoderBinRAW instance
+1 -20
View File
@@ -1,6 +1,7 @@
#pragma once
#include "base.h"
#include "public_api.h"
#define SUBGHZ_PROTOCOL_KEELOQ_NAME "KeeLoq"
@@ -24,26 +25,6 @@ void* subghz_protocol_encoder_keeloq_alloc(SubGhzEnvironment* environment);
*/
void subghz_protocol_encoder_keeloq_free(void* context);
/**
* Key generation from simple data.
* @param context Pointer to a SubGhzProtocolEncoderKeeloq instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param serial Serial number, 28 bit
* @param btn Button number, 4 bit
* @param cnt Container value, 16 bit
* @param manufacture_name Name of manufacturer's key
* @param preset Modulation, SubGhzRadioPreset
* @return true On success
*/
bool subghz_protocol_keeloq_create_data(
void* context,
FlipperFormat* flipper_format,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
const char* manufacture_name,
SubGhzRadioPreset* preset);
/**
* Deserialize and generating an upload to send.
* @param context Pointer to a SubGhzProtocolEncoderKeeloq instance
+63
View File
@@ -0,0 +1,63 @@
#pragma once
#include "../types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* Key generation from simple data.
* @param context Pointer to a SubGhzProtocolEncoderSecPlus_v2 instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param serial Serial number, 32 bit
* @param btn Button number, 8 bit
* @param cnt Container value, 28 bit
* @param manufacture_name Name of manufacturer's key
* @param preset Modulation, SubGhzRadioPreset
* @return true On success
*/
bool subghz_protocol_secplus_v2_create_data(
void* context,
FlipperFormat* flipper_format,
uint32_t serial,
uint8_t btn,
uint32_t cnt,
SubGhzRadioPreset* preset);
/**
* Key generation from simple data.
* @param context Pointer to a SubGhzProtocolEncoderKeeloq instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param serial Serial number, 28 bit
* @param btn Button number, 4 bit
* @param cnt Container value, 16 bit
* @param manufacture_name Name of manufacturer's key
* @param preset Modulation, SubGhzRadioPreset
* @return true On success
*/
bool subghz_protocol_keeloq_create_data(
void* context,
FlipperFormat* flipper_format,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
const char* manufacture_name,
SubGhzRadioPreset* preset);
typedef struct SubGhzProtocolDecoderBinRAW SubGhzProtocolDecoderBinRAW;
void subghz_protocol_decoder_bin_raw_data_input_rssi(
SubGhzProtocolDecoderBinRAW* instance,
float rssi);
/**
* Validation of fixed parts SubGhzProtocolDecoderSecPlus_v1.
* @param fixed fixed parts
* @return true On success
*/
bool subghz_protocol_secplus_v1_check_fixed(uint32_t fixed);
#ifdef __cplusplus
}
#endif
+2 -7
View File
@@ -1,5 +1,7 @@
#pragma once
#include "base.h"
#include "public_api.h"
#define SUBGHZ_PROTOCOL_SECPLUS_V1_NAME "Security+ 1.0"
@@ -100,13 +102,6 @@ SubGhzProtocolStatus subghz_protocol_decoder_secplus_v1_serialize(
SubGhzProtocolStatus
subghz_protocol_decoder_secplus_v1_deserialize(void* context, FlipperFormat* flipper_format);
/**
* Validation of fixed parts SubGhzProtocolDecoderSecPlus_v1.
* @param fixed fixed parts
* @return true On success
*/
bool subghz_protocol_secplus_v1_check_fixed(uint32_t fixed);
/**
* Getting a textual representation of the received data.
* @param context Pointer to a SubGhzProtocolDecoderSecPlus_v1 instance
+2 -19
View File
@@ -1,5 +1,7 @@
#pragma once
#include "base.h"
#include "public_api.h"
#define SUBGHZ_PROTOCOL_SECPLUS_V2_NAME "Security+ 2.0"
@@ -45,25 +47,6 @@ void subghz_protocol_encoder_secplus_v2_stop(void* context);
*/
LevelDuration subghz_protocol_encoder_secplus_v2_yield(void* context);
/**
* Key generation from simple data.
* @param context Pointer to a SubGhzProtocolEncoderSecPlus_v2 instance
* @param flipper_format Pointer to a FlipperFormat instance
* @param serial Serial number, 32 bit
* @param btn Button number, 8 bit
* @param cnt Container value, 28 bit
* @param manufacture_name Name of manufacturer's key
* @param preset Modulation, SubGhzRadioPreset
* @return true On success
*/
bool subghz_protocol_secplus_v2_create_data(
void* context,
FlipperFormat* flipper_format,
uint32_t serial,
uint8_t btn,
uint32_t cnt,
SubGhzRadioPreset* preset);
/**
* Allocate SubGhzProtocolDecoderSecPlus_v2.
* @param environment Pointer to a SubGhzEnvironment instance
-23
View File
@@ -10,29 +10,6 @@ extern const SubGhzProtocolRegistry subghz_protocol_registry;
typedef struct SubGhzProtocolDecoderBinRAW SubGhzProtocolDecoderBinRAW;
bool subghz_protocol_secplus_v2_create_data(
void* context,
FlipperFormat* flipper_format,
uint32_t serial,
uint8_t btn,
uint32_t cnt,
SubGhzRadioPreset* preset);
bool subghz_protocol_keeloq_create_data(
void* context,
FlipperFormat* flipper_format,
uint32_t serial,
uint8_t btn,
uint16_t cnt,
const char* manufacture_name,
SubGhzRadioPreset* preset);
void subghz_protocol_decoder_bin_raw_data_input_rssi(
SubGhzProtocolDecoderBinRAW* instance,
float rssi);
bool subghz_protocol_secplus_v1_check_fixed(uint32_t fixed);
#ifdef __cplusplus
}
#endif
+1 -1
View File
@@ -112,7 +112,7 @@ bool buffer_stream_send_from_isr(BufferStream* buffer_stream, const uint8_t* dat
return result;
}
Buffer* buffer_stream_receive(BufferStream* buffer_stream, TickType_t timeout) {
Buffer* buffer_stream_receive(BufferStream* buffer_stream, uint32_t timeout) {
Buffer* buffer;
size_t size =
furi_stream_buffer_receive(buffer_stream->stream, &buffer, sizeof(Buffer*), timeout);
+1 -1
View File
@@ -69,7 +69,7 @@ bool buffer_stream_send_from_isr(BufferStream* buffer_stream, const uint8_t* dat
* @param timeout
* @return Buffer*
*/
Buffer* buffer_stream_receive(BufferStream* buffer_stream, TickType_t timeout);
Buffer* buffer_stream_receive(BufferStream* buffer_stream, uint32_t timeout);
/**
* @brief Get stream overrun count