always break rule (#154)

This commit is contained in:
coreglitch 2020-10-02 09:32:11 +03:00 committed by GitHub
parent 12e319e6d9
commit ed76f702b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 135 additions and 120 deletions

View File

@ -1,5 +1,5 @@
AccessModifierOffset: -4 AccessModifierOffset: -4
AlignAfterOpenBracket: Align AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left AlignEscapedNewlines: Left

View File

@ -73,12 +73,13 @@ bool furi_create(const char* name, void* value, size_t size) {
return true; return true;
} }
FuriRecordSubscriber* furi_open(const char* name, FuriRecordSubscriber* furi_open(
bool solo, const char* name,
bool no_mute, bool solo,
FlipperRecordCallback value_callback, bool no_mute,
FlipperRecordStateCallback state_callback, FlipperRecordCallback value_callback,
void* ctx) { FlipperRecordStateCallback state_callback,
void* ctx) {
#ifdef FURI_DEBUG #ifdef FURI_DEBUG
printf("[FURI] opening %s record\n", name); printf("[FURI] opening %s record\n", name);
#endif #endif
@ -233,9 +234,10 @@ bool furi_write(FuriRecordSubscriber* handler, const void* value, size_t size) {
if(handler == NULL || handler->record == NULL || value == NULL) { if(handler == NULL || handler->record == NULL || value == NULL) {
#ifdef FURI_DEBUG #ifdef FURI_DEBUG
printf("[FURI] write: null param %x %x\n", printf(
(uint32_t)(size_t)handler, "[FURI] write: null param %x %x\n",
(uint32_t)(size_t)value); (uint32_t)(size_t)handler,
(uint32_t)(size_t)value);
#endif #endif
return false; return false;

View File

@ -109,12 +109,13 @@ When appication has exited or record has closed, all handlers is unmuted.
It may be useful for concurrently acces to resources like framebuffer or beeper. It may be useful for concurrently acces to resources like framebuffer or beeper.
\param[in] no_mute if true, another applications cannot mute this handler. \param[in] no_mute if true, another applications cannot mute this handler.
*/ */
FuriRecordSubscriber* furi_open(const char* name, FuriRecordSubscriber* furi_open(
bool solo, const char* name,
bool no_mute, bool solo,
FlipperRecordCallback value_callback, bool no_mute,
FlipperRecordStateCallback state_callback, FlipperRecordCallback value_callback,
void* ctx); FlipperRecordStateCallback state_callback,
void* ctx);
/*! /*!

View File

@ -44,14 +44,14 @@ FuriApp* furiac_start(FlipperApplication app, const char* name, void* param) {
} }
// create task on static stack memory // create task on static stack memory
task_buffer[current_buffer_idx].handler = task_buffer[current_buffer_idx].handler = xTaskCreateStatic(
xTaskCreateStatic((TaskFunction_t)app, (TaskFunction_t)app,
(const char* const)name, (const char* const)name,
DEFAULT_STACK_SIZE / 4, // freertos specify stack size in words DEFAULT_STACK_SIZE / 4, // freertos specify stack size in words
(void* const)param, (void* const)param,
tskIDLE_PRIORITY + 3, // normal priority tskIDLE_PRIORITY + 3, // normal priority
stack_buffer[current_buffer_idx], stack_buffer[current_buffer_idx],
&task_info_buffer[current_buffer_idx]); &task_info_buffer[current_buffer_idx]);
// save task // save task
task_buffer[current_buffer_idx].application = app; task_buffer[current_buffer_idx].application = app;

View File

@ -41,14 +41,15 @@ bool register_tty_uart() {
return false; return false;
} }
FILE* fp = fopencookie(NULL, FILE* fp = fopencookie(
"w", NULL,
(cookie_io_functions_t){ "w",
.read = NULL, (cookie_io_functions_t){
.write = stdout_write, .read = NULL,
.seek = NULL, .write = stdout_write,
.close = NULL, .seek = NULL,
}); .close = NULL,
});
setvbuf(fp, NULL, _IONBF, 0); setvbuf(fp, NULL, _IONBF, 0);
stdout = fp; stdout = fp;

View File

@ -55,14 +55,16 @@
/* USER CODE END FunctionPrototypes */ /* USER CODE END FunctionPrototypes */
/* GetIdleTaskMemory prototype (linked to static allocation support) */ /* GetIdleTaskMemory prototype (linked to static allocation support) */
void vApplicationGetIdleTaskMemory(StaticTask_t** ppxIdleTaskTCBBuffer, void vApplicationGetIdleTaskMemory(
StackType_t** ppxIdleTaskStackBuffer, StaticTask_t** ppxIdleTaskTCBBuffer,
uint32_t* pulIdleTaskStackSize); StackType_t** ppxIdleTaskStackBuffer,
uint32_t* pulIdleTaskStackSize);
/* GetTimerTaskMemory prototype (linked to static allocation support) */ /* GetTimerTaskMemory prototype (linked to static allocation support) */
void vApplicationGetTimerTaskMemory(StaticTask_t** ppxTimerTaskTCBBuffer, void vApplicationGetTimerTaskMemory(
StackType_t** ppxTimerTaskStackBuffer, StaticTask_t** ppxTimerTaskTCBBuffer,
uint32_t* pulTimerTaskStackSize); StackType_t** ppxTimerTaskStackBuffer,
uint32_t* pulTimerTaskStackSize);
/* Hook prototypes */ /* Hook prototypes */
void vApplicationIdleHook(void); void vApplicationIdleHook(void);
@ -85,9 +87,10 @@ __weak void vApplicationIdleHook(void) {
static StaticTask_t xIdleTaskTCBBuffer; static StaticTask_t xIdleTaskTCBBuffer;
static StackType_t xIdleStack[configMINIMAL_STACK_SIZE]; static StackType_t xIdleStack[configMINIMAL_STACK_SIZE];
void vApplicationGetIdleTaskMemory(StaticTask_t** ppxIdleTaskTCBBuffer, void vApplicationGetIdleTaskMemory(
StackType_t** ppxIdleTaskStackBuffer, StaticTask_t** ppxIdleTaskTCBBuffer,
uint32_t* pulIdleTaskStackSize) { StackType_t** ppxIdleTaskStackBuffer,
uint32_t* pulIdleTaskStackSize) {
*ppxIdleTaskTCBBuffer = &xIdleTaskTCBBuffer; *ppxIdleTaskTCBBuffer = &xIdleTaskTCBBuffer;
*ppxIdleTaskStackBuffer = &xIdleStack[0]; *ppxIdleTaskStackBuffer = &xIdleStack[0];
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
@ -99,9 +102,10 @@ void vApplicationGetIdleTaskMemory(StaticTask_t** ppxIdleTaskTCBBuffer,
static StaticTask_t xTimerTaskTCBBuffer; static StaticTask_t xTimerTaskTCBBuffer;
static StackType_t xTimerStack[configTIMER_TASK_STACK_DEPTH]; static StackType_t xTimerStack[configTIMER_TASK_STACK_DEPTH];
void vApplicationGetTimerTaskMemory(StaticTask_t** ppxTimerTaskTCBBuffer, void vApplicationGetTimerTaskMemory(
StackType_t** ppxTimerTaskStackBuffer, StaticTask_t** ppxTimerTaskTCBBuffer,
uint32_t* pulTimerTaskStackSize) { StackType_t** ppxTimerTaskStackBuffer,
uint32_t* pulTimerTaskStackSize) {
*ppxTimerTaskTCBBuffer = &xTimerTaskTCBBuffer; *ppxTimerTaskTCBBuffer = &xTimerTaskTCBBuffer;
*ppxTimerTaskStackBuffer = &xTimerStack[0]; *ppxTimerTaskStackBuffer = &xTimerStack[0];
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;

View File

@ -154,18 +154,19 @@ uint32_t SystemCoreClock = 4000000U;
const uint8_t AHBPrescTable[16] = {0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U, 6U, 7U, 8U, 9U}; const uint8_t AHBPrescTable[16] = {0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U, 6U, 7U, 8U, 9U};
const uint8_t APBPrescTable[8] = {0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U}; const uint8_t APBPrescTable[8] = {0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U};
const uint32_t MSIRangeTable[12] = {100000U, const uint32_t MSIRangeTable[12] = {
200000U, 100000U,
400000U, 200000U,
800000U, 400000U,
1000000U, 800000U,
2000000U, 1000000U,
4000000U, 2000000U,
8000000U, 4000000U,
16000000U, 8000000U,
24000000U, 16000000U,
32000000U, 24000000U,
48000000U}; 32000000U,
48000000U};
/** /**
* @} * @}
*/ */

View File

@ -139,10 +139,8 @@ static int8_t CDC_Receive_FS(uint8_t* pbuf, uint32_t* Len);
* @} * @}
*/ */
USBD_CDC_ItfTypeDef USBD_Interface_fops_FS = {CDC_Init_FS, USBD_CDC_ItfTypeDef USBD_Interface_fops_FS =
CDC_DeInit_FS, {CDC_Init_FS, CDC_DeInit_FS, CDC_Control_FS, CDC_Receive_FS};
CDC_Control_FS,
CDC_Receive_FS};
/* Private functions ---------------------------------------------------------*/ /* Private functions ---------------------------------------------------------*/
/** /**

View File

@ -135,16 +135,17 @@ uint8_t* USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t* length);
* @{ * @{
*/ */
USBD_DescriptorsTypeDef FS_Desc = {USBD_FS_DeviceDescriptor, USBD_DescriptorsTypeDef FS_Desc = {
USBD_FS_LangIDStrDescriptor, USBD_FS_DeviceDescriptor,
USBD_FS_ManufacturerStrDescriptor, USBD_FS_LangIDStrDescriptor,
USBD_FS_ProductStrDescriptor, USBD_FS_ManufacturerStrDescriptor,
USBD_FS_SerialStrDescriptor, USBD_FS_ProductStrDescriptor,
USBD_FS_ConfigStrDescriptor, USBD_FS_SerialStrDescriptor,
USBD_FS_InterfaceStrDescriptor USBD_FS_ConfigStrDescriptor,
USBD_FS_InterfaceStrDescriptor
#if(USBD_LPM_ENABLED == 1) #if(USBD_LPM_ENABLED == 1)
, ,
USBD_FS_USR_BOSDescriptor USBD_FS_USR_BOSDescriptor
#endif /* (USBD_LPM_ENABLED == 1) */ #endif /* (USBD_LPM_ENABLED == 1) */
}; };

View File

@ -55,14 +55,16 @@
/* USER CODE END FunctionPrototypes */ /* USER CODE END FunctionPrototypes */
/* GetIdleTaskMemory prototype (linked to static allocation support) */ /* GetIdleTaskMemory prototype (linked to static allocation support) */
void vApplicationGetIdleTaskMemory(StaticTask_t** ppxIdleTaskTCBBuffer, void vApplicationGetIdleTaskMemory(
StackType_t** ppxIdleTaskStackBuffer, StaticTask_t** ppxIdleTaskTCBBuffer,
uint32_t* pulIdleTaskStackSize); StackType_t** ppxIdleTaskStackBuffer,
uint32_t* pulIdleTaskStackSize);
/* GetTimerTaskMemory prototype (linked to static allocation support) */ /* GetTimerTaskMemory prototype (linked to static allocation support) */
void vApplicationGetTimerTaskMemory(StaticTask_t** ppxTimerTaskTCBBuffer, void vApplicationGetTimerTaskMemory(
StackType_t** ppxTimerTaskStackBuffer, StaticTask_t** ppxTimerTaskTCBBuffer,
uint32_t* pulTimerTaskStackSize); StackType_t** ppxTimerTaskStackBuffer,
uint32_t* pulTimerTaskStackSize);
/* Hook prototypes */ /* Hook prototypes */
void vApplicationIdleHook(void); void vApplicationIdleHook(void);
@ -85,9 +87,10 @@ __weak void vApplicationIdleHook(void) {
static StaticTask_t xIdleTaskTCBBuffer; static StaticTask_t xIdleTaskTCBBuffer;
static StackType_t xIdleStack[configMINIMAL_STACK_SIZE]; static StackType_t xIdleStack[configMINIMAL_STACK_SIZE];
void vApplicationGetIdleTaskMemory(StaticTask_t** ppxIdleTaskTCBBuffer, void vApplicationGetIdleTaskMemory(
StackType_t** ppxIdleTaskStackBuffer, StaticTask_t** ppxIdleTaskTCBBuffer,
uint32_t* pulIdleTaskStackSize) { StackType_t** ppxIdleTaskStackBuffer,
uint32_t* pulIdleTaskStackSize) {
*ppxIdleTaskTCBBuffer = &xIdleTaskTCBBuffer; *ppxIdleTaskTCBBuffer = &xIdleTaskTCBBuffer;
*ppxIdleTaskStackBuffer = &xIdleStack[0]; *ppxIdleTaskStackBuffer = &xIdleStack[0];
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
@ -99,9 +102,10 @@ void vApplicationGetIdleTaskMemory(StaticTask_t** ppxIdleTaskTCBBuffer,
static StaticTask_t xTimerTaskTCBBuffer; static StaticTask_t xTimerTaskTCBBuffer;
static StackType_t xTimerStack[configTIMER_TASK_STACK_DEPTH]; static StackType_t xTimerStack[configTIMER_TASK_STACK_DEPTH];
void vApplicationGetTimerTaskMemory(StaticTask_t** ppxTimerTaskTCBBuffer, void vApplicationGetTimerTaskMemory(
StackType_t** ppxTimerTaskStackBuffer, StaticTask_t** ppxTimerTaskTCBBuffer,
uint32_t* pulTimerTaskStackSize) { StackType_t** ppxTimerTaskStackBuffer,
uint32_t* pulTimerTaskStackSize) {
*ppxTimerTaskTCBBuffer = &xTimerTaskTCBBuffer; *ppxTimerTaskTCBBuffer = &xTimerTaskTCBBuffer;
*ppxTimerTaskStackBuffer = &xTimerStack[0]; *ppxTimerTaskStackBuffer = &xTimerStack[0];
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;

View File

@ -156,18 +156,19 @@ uint32_t SystemCoreClock = 4000000U;
const uint8_t AHBPrescTable[16] = {0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U, 6U, 7U, 8U, 9U}; const uint8_t AHBPrescTable[16] = {0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U, 6U, 7U, 8U, 9U};
const uint8_t APBPrescTable[8] = {0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U}; const uint8_t APBPrescTable[8] = {0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U};
const uint32_t MSIRangeTable[12] = {100000U, const uint32_t MSIRangeTable[12] = {
200000U, 100000U,
400000U, 200000U,
800000U, 400000U,
1000000U, 800000U,
2000000U, 1000000U,
4000000U, 2000000U,
8000000U, 4000000U,
16000000U, 8000000U,
24000000U, 16000000U,
32000000U, 24000000U,
48000000U}; 32000000U,
48000000U};
/** /**
* @} * @}
*/ */

View File

@ -139,10 +139,8 @@ static int8_t CDC_Receive_FS(uint8_t* pbuf, uint32_t* Len);
* @} * @}
*/ */
USBD_CDC_ItfTypeDef USBD_Interface_fops_FS = {CDC_Init_FS, USBD_CDC_ItfTypeDef USBD_Interface_fops_FS =
CDC_DeInit_FS, {CDC_Init_FS, CDC_DeInit_FS, CDC_Control_FS, CDC_Receive_FS};
CDC_Control_FS,
CDC_Receive_FS};
/* Private functions ---------------------------------------------------------*/ /* Private functions ---------------------------------------------------------*/
/** /**

View File

@ -135,16 +135,17 @@ uint8_t* USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t* length);
* @{ * @{
*/ */
USBD_DescriptorsTypeDef FS_Desc = {USBD_FS_DeviceDescriptor, USBD_DescriptorsTypeDef FS_Desc = {
USBD_FS_LangIDStrDescriptor, USBD_FS_DeviceDescriptor,
USBD_FS_ManufacturerStrDescriptor, USBD_FS_LangIDStrDescriptor,
USBD_FS_ProductStrDescriptor, USBD_FS_ManufacturerStrDescriptor,
USBD_FS_SerialStrDescriptor, USBD_FS_ProductStrDescriptor,
USBD_FS_ConfigStrDescriptor, USBD_FS_SerialStrDescriptor,
USBD_FS_InterfaceStrDescriptor USBD_FS_ConfigStrDescriptor,
USBD_FS_InterfaceStrDescriptor
#if(USBD_LPM_ENABLED == 1) #if(USBD_LPM_ENABLED == 1)
, ,
USBD_FS_USR_BOSDescriptor USBD_FS_USR_BOSDescriptor
#endif /* (USBD_LPM_ENABLED == 1) */ #endif /* (USBD_LPM_ENABLED == 1) */
}; };

View File

@ -30,13 +30,14 @@ void* pthread_wrapper(void* p) {
return NULL; return NULL;
} }
TaskHandle_t xTaskCreateStatic(TaskFunction_t pxTaskCode, TaskHandle_t xTaskCreateStatic(
const char* const pcName, TaskFunction_t pxTaskCode,
const uint32_t ulStackDepth, const char* const pcName,
void* const pvParameters, const uint32_t ulStackDepth,
UBaseType_t uxPriority, void* const pvParameters,
StackType_t* const puxStackBuffer, UBaseType_t uxPriority,
StaticTask_t* const pxTaskBuffer) { StackType_t* const puxStackBuffer,
StaticTask_t* const pxTaskBuffer) {
TaskHandle_t thread = malloc(sizeof(TaskHandle_t)); TaskHandle_t thread = malloc(sizeof(TaskHandle_t));
PthreadTask* task = malloc(sizeof(PthreadTask)); PthreadTask* task = malloc(sizeof(PthreadTask));
@ -93,10 +94,11 @@ BaseType_t xQueueReceive(QueueHandle_t xQueue, void* pvBuffer, TickType_t xTicks
static uint32_t queue_global_id = 0; static uint32_t queue_global_id = 0;
QueueHandle_t xQueueCreateStatic(UBaseType_t uxQueueLength, QueueHandle_t xQueueCreateStatic(
UBaseType_t uxItemSize, UBaseType_t uxQueueLength,
uint8_t* pucQueueStorageBuffer, UBaseType_t uxItemSize,
StaticQueue_t* pxQueueBuffer) { uint8_t* pucQueueStorageBuffer,
StaticQueue_t* pxQueueBuffer) {
// TODO: check this implementation // TODO: check this implementation
int* msgid = malloc(sizeof(int)); int* msgid = malloc(sizeof(int));
@ -108,9 +110,10 @@ QueueHandle_t xQueueCreateStatic(UBaseType_t uxQueueLength,
return (QueueHandle_t)msgid; return (QueueHandle_t)msgid;
} }
SemaphoreHandle_t xSemaphoreCreateCountingStatic(UBaseType_t uxMaxCount, SemaphoreHandle_t xSemaphoreCreateCountingStatic(
UBaseType_t uxInitialCount, UBaseType_t uxMaxCount,
StaticSemaphore_t* pxSemaphoreBuffer) { UBaseType_t uxInitialCount,
StaticSemaphore_t* pxSemaphoreBuffer) {
pxSemaphoreBuffer->type = SemaphoreTypeCounting; pxSemaphoreBuffer->type = SemaphoreTypeCounting;
pxSemaphoreBuffer->take_counter = 0; pxSemaphoreBuffer->take_counter = 0;
pxSemaphoreBuffer->give_counter = 0; pxSemaphoreBuffer->give_counter = 0;