refactor(freertos): Updated FreeRTOS component files to astyle format

This commit updates the FreeRTOS component source files (excluding
upstream source files) to the astyle coding format.
This commit is contained in:
Sudeep Mohanty 2024-01-26 15:07:54 +01:00 committed by BOT
parent b2b84f9b5c
commit 061da98124
34 changed files with 384 additions and 402 deletions

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2017-2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -35,7 +35,6 @@
#define DELAY_US_ITERATIONS 1000 #define DELAY_US_ITERATIONS 1000
static void tsk_self_del(void *param) static void tsk_self_del(void *param)
{ {
vTaskDelete(NULL); //Deleting self means deleting currently running task vTaskDelete(NULL); //Deleting self means deleting currently running task
@ -90,7 +89,6 @@ TEST_CASE("FreeRTOS Delete Tasks", "[freertos]")
} }
typedef struct { typedef struct {
SemaphoreHandle_t sem; SemaphoreHandle_t sem;
volatile bool deleted; // Check the deleted task doesn't keep running after being deleted volatile bool deleted; // Check the deleted task doesn't keep running after being deleted

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -85,7 +85,6 @@ TEST_CASE("Test freertos trace facility functions", "[freertos]")
vTaskDelay(10); //Give time for idle task to clean up vTaskDelay(10); //Give time for idle task to clean up
} }
#define MAX_TASKS 15 #define MAX_TASKS 15
#define TASKS_TO_CREATE 5 #define TASKS_TO_CREATE 5

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -31,7 +31,6 @@ static volatile bool flag;
#define MAX_YIELD_COUNT 17000 #define MAX_YIELD_COUNT 17000
#endif // CONFIG_FREERTOS_SMP #endif // CONFIG_FREERTOS_SMP
/* Task: /* Task:
- Waits for 'trigger' variable to be set - Waits for 'trigger' variable to be set
- Reads the cycle count on this CPU - Reads the cycle count on this CPU
@ -86,7 +85,6 @@ TEST_CASE("Yield from lower priority task, same CPU", "[freertos]")
} }
} }
#if (portNUM_PROCESSORS == 2) && !CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH #if (portNUM_PROCESSORS == 2) && !CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH
TEST_CASE("Yield from lower priority task, other CPU", "[freertos]") TEST_CASE("Yield from lower priority task, other CPU", "[freertos]")
{ {

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -144,7 +144,6 @@ static void test_vTaskDelayUntil(void *arg)
tick_end = xTaskGetTickCount(); tick_end = xTaskGetTickCount();
ref_clock_end = portTEST_REF_CLOCK_GET_TIME(); ref_clock_end = portTEST_REF_CLOCK_GET_TIME();
/* Check that elapsed ticks and ref clock is accurate. We allow TEST_VTASKDELAYUNTIL_DELTA_TICKS of error in /* Check that elapsed ticks and ref clock is accurate. We allow TEST_VTASKDELAYUNTIL_DELTA_TICKS of error in
* case vTaskDelayUntil() or portTEST_REF_CLOCK_GET_TIME() last long enough to cross a tick boundary */ * case vTaskDelayUntil() or portTEST_REF_CLOCK_GET_TIME() last long enough to cross a tick boundary */
#if ( configUSE_16_BIT_TICKS == 1 ) #if ( configUSE_16_BIT_TICKS == 1 )

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -17,7 +17,6 @@
#include "unity.h" #include "unity.h"
#include "test_utils.h" #include "test_utils.h"
static void counter_task(void *param) static void counter_task(void *param)
{ {
volatile uint32_t *counter = (volatile uint32_t *)param; volatile uint32_t *counter = (volatile uint32_t *)param;
@ -26,7 +25,6 @@ static void counter_task(void *param)
} }
} }
TEST_CASE("Get/Set Priorities", "[freertos]") TEST_CASE("Get/Set Priorities", "[freertos]")
{ {
/* Two tasks per processor */ /* Two tasks per processor */

View File

@ -69,7 +69,6 @@ static void test_suspend_resume(int target_core)
vTaskDelete(counter_task); vTaskDelete(counter_task);
} }
TEST_CASE("Suspend/resume task on same core", "[freertos]") TEST_CASE("Suspend/resume task on same core", "[freertos]")
{ {
test_suspend_resume(UNITY_FREERTOS_CPU); test_suspend_resume(UNITY_FREERTOS_CPU);
@ -119,7 +118,6 @@ TEST_CASE("Suspend the current running task", "[freertos]")
TEST_ASSERT_TRUE(resumed); TEST_ASSERT_TRUE(resumed);
} }
static volatile bool timer_isr_fired; static volatile bool timer_isr_fired;
static gptimer_handle_t gptimer = NULL; static gptimer_handle_t gptimer = NULL;
@ -146,7 +144,6 @@ static IRAM_ATTR void task_suspend_self_with_timer(void *vp_resumed)
vTaskDelete(NULL); vTaskDelete(NULL);
} }
/* Create a task which suspends itself, then resume it from a timer /* Create a task which suspends itself, then resume it from a timer
* interrupt. */ * interrupt. */
static void test_resume_task_from_isr(int target_core) static void test_resume_task_from_isr(int target_core)

View File

@ -637,7 +637,6 @@ TEST_CASE("Test xTaskResumeAll resumes pended tasks", "[freertos]")
vTaskDelay(10); vTaskDelay(10);
} }
/* --------------------------------------------------------------------------------------------------------------------- /* ---------------------------------------------------------------------------------------------------------------------
Test xTaskSuspendAll on both cores pends all tasks and xTaskResumeAll on both cores resumes all tasks Test xTaskSuspendAll on both cores pends all tasks and xTaskResumeAll on both cores resumes all tasks

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -44,7 +44,6 @@ TEST_CASE("Oneshot FreeRTOS timers", "[freertos]")
TEST_ASSERT(xTimerDelete(oneshot, 1)); TEST_ASSERT(xTimerDelete(oneshot, 1));
} }
TEST_CASE("Recurring FreeRTOS timers", "[freertos]") TEST_CASE("Recurring FreeRTOS timers", "[freertos]")
{ {
volatile int count = 0; volatile int count = 0;

View File

@ -42,8 +42,6 @@ static void tskTestRand(void *pvParameters)
vTaskDelete(NULL); vTaskDelete(NULL);
} }
// TODO: split this thing into separate orthogonal tests // TODO: split this thing into separate orthogonal tests
TEST_CASE("Test for per-task non-reentrant tasks", "[freertos]") TEST_CASE("Test for per-task non-reentrant tasks", "[freertos]")
{ {

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -25,7 +25,8 @@ typedef struct {
TaskHandle_t t1_handle; TaskHandle_t t1_handle;
} test_context_t; } test_context_t;
static void test_task_1(void *arg) { static void test_task_1(void *arg)
{
test_context_t *context = (test_context_t *)arg; test_context_t *context = (test_context_t *)arg;
for (;;) { for (;;) {
@ -36,7 +37,8 @@ static void test_task_1(void *arg) {
vTaskDelete(NULL); vTaskDelete(NULL);
} }
static void test_task_2(void *arg) { static void test_task_2(void *arg)
{
test_context_t *context = (test_context_t *)arg; test_context_t *context = (test_context_t *)arg;
uint64_t accumulator = 0; uint64_t accumulator = 0;

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -38,7 +38,8 @@ static uint32_t cycle_before_exit;
static uint32_t delta_enter_cycles = 0; static uint32_t delta_enter_cycles = 0;
static uint32_t delta_exit_cycles = 0; static uint32_t delta_exit_cycles = 0;
static void software_isr_using_parameter_vportyield(void *arg) { static void software_isr_using_parameter_vportyield(void *arg)
{
(void)arg; (void)arg;
BaseType_t yield; BaseType_t yield;
delta_enter_cycles += esp_cpu_get_cycle_count() - cycle_before_trigger; delta_enter_cycles += esp_cpu_get_cycle_count() - cycle_before_trigger;
@ -50,7 +51,8 @@ static void software_isr_using_parameter_vportyield(void *arg) {
cycle_before_exit = esp_cpu_get_cycle_count(); cycle_before_exit = esp_cpu_get_cycle_count();
} }
static void software_isr_using_no_argument_vportyield(void *arg) { static void software_isr_using_no_argument_vportyield(void *arg)
{
(void)arg; (void)arg;
BaseType_t yield; BaseType_t yield;
delta_enter_cycles += esp_cpu_get_cycle_count() - cycle_before_trigger; delta_enter_cycles += esp_cpu_get_cycle_count() - cycle_before_trigger;
@ -64,7 +66,8 @@ static void software_isr_using_no_argument_vportyield(void *arg) {
cycle_before_exit = esp_cpu_get_cycle_count(); cycle_before_exit = esp_cpu_get_cycle_count();
} }
static void test_task(void *arg) { static void test_task(void *arg)
{
(void) arg; (void) arg;
for (int i = 0; i < 10000; i++) { for (int i = 0; i < 10000; i++) {

View File

@ -21,7 +21,6 @@
* when the recursive function returns. * when the recursive function returns.
*/ */
/* See test_context_save_clober_func.S */ /* See test_context_save_clober_func.S */
extern void test_context_save_clober_func(void); extern void test_context_save_clober_func(void);

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -194,7 +194,6 @@ typedef struct {
TaskHandle_t main; TaskHandle_t main;
} ParamsFPU; } ParamsFPU;
/** /**
* @brief Function performing some simple calculation using several FPU registers. * @brief Function performing some simple calculation using several FPU registers.
* The goal is to be preempted by a task that also uses the FPU on the same core. * The goal is to be preempted by a task that also uses the FPU on the same core.
@ -206,8 +205,7 @@ void fpu_calculation(void* arg)
const float init = negative ? -1.f : 1.f; const float init = negative ? -1.f : 1.f;
float f = init; float f = init;
for(int i = 0; i < 10; i++) for (int i = 0; i < 10; i++) {
{
/* The following calculation doesn't really have any meaning, we try to use several FPU registers and operations */ /* The following calculation doesn't really have any meaning, we try to use several FPU registers and operations */
float delta = negative ? -1.1f : 1.1f; float delta = negative ? -1.1f : 1.1f;
for (int i = 0; i < 1000; i++) { for (int i = 0; i < 1000; i++) {
@ -233,8 +231,6 @@ void fpu_calculation(void* arg)
vTaskDelete(NULL); vTaskDelete(NULL);
} }
TEST_CASE("FPU: Unsolicited context switch between tasks using FPU", "[freertos]") TEST_CASE("FPU: Unsolicited context switch between tasks using FPU", "[freertos]")
{ {
/* Create two tasks that are on the same core and use the same FPU */ /* Create two tasks that are on the same core and use the same FPU */

View File

@ -41,7 +41,6 @@ static void other_task(void* arg)
vTaskDelete(NULL); vTaskDelete(NULL);
} }
TEST_CASE("FPU: Context save does not affect stack watermark", "[freertos]") TEST_CASE("FPU: Context save does not affect stack watermark", "[freertos]")
{ {
TaskHandle_t pvCreatedTask; TaskHandle_t pvCreatedTask;

View File

@ -24,7 +24,6 @@
static volatile int in_int_context, int_handled; static volatile int in_int_context, int_handled;
static void testint(void) static void testint(void)
{ {
esp_rom_printf("INT!\n"); esp_rom_printf("INT!\n");
@ -34,7 +33,6 @@ static void testint(void)
int_handled++; int_handled++;
} }
static void testthread(void *arg) static void testthread(void *arg)
{ {
in_int_context = 0; in_int_context = 0;
@ -49,7 +47,6 @@ static void testthread(void *arg)
vTaskDelete(NULL); vTaskDelete(NULL);
} }
TEST_CASE("xPortInIsrContext test", "[freertos]") TEST_CASE("xPortInIsrContext test", "[freertos]")
{ {
xTaskCreatePinnedToCore(testthread, "tst", 4096, NULL, 3, NULL, 0); xTaskCreatePinnedToCore(testthread, "tst", 4096, NULL, 3, NULL, 0);
@ -60,5 +57,4 @@ TEST_CASE("xPortInIsrContext test", "[freertos]")
#endif #endif
} }
#endif #endif

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */

View File

@ -25,7 +25,6 @@
#define GET_THREADPTR(tp_dest) do { register uint32_t _tp asm("tp"); tp_dest = _tp; } while(0) #define GET_THREADPTR(tp_dest) do { register uint32_t _tp asm("tp"); tp_dest = _tp; } while(0)
#endif #endif
static __thread int tl_test_var1; static __thread int tl_test_var1;
static __thread uint8_t tl_test_var2 = 55; static __thread uint8_t tl_test_var2 = 55;
static __thread uint16_t tl_test_var3 = 44; static __thread uint16_t tl_test_var3 = 44;

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */

View File

@ -38,7 +38,8 @@ components_not_formatted_temporary:
# To reformat the files: # To reformat the files:
# - Remove the directory from this exclude list # - Remove the directory from this exclude list
# - Run 'git add .astyle-rules.yml' # - Run 'git add .astyle-rules.yml'
# - Run 'pre-commit run --all-files' # - Run 'pre-commit run --all-files' to run all pre-commit hooks
# - Run 'pre-commit run astyle_py --all-files' to run only the astyle_py hook
# 2. If no, move it to 'components_not_formatted_permanent' section below. # 2. If no, move it to 'components_not_formatted_permanent' section below.
check: false check: false
include: include:
@ -74,7 +75,6 @@ components_not_formatted_temporary:
- "/components/espcoredump/" - "/components/espcoredump/"
- "/components/esptool_py/" - "/components/esptool_py/"
- "/components/fatfs/" - "/components/fatfs/"
- "/components/freertos/"
- "/components/hal/" - "/components/hal/"
- "/components/heap/" - "/components/heap/"
- "/components/idf_test/" - "/components/idf_test/"
@ -152,10 +152,13 @@ components_not_formatted_permanent:
- "/components/console/linenoise/" - "/components/console/linenoise/"
# Catch (upstream source code) # Catch (upstream source code)
- "/tools/catch/catch.hpp" - "/tools/catch/catch.hpp"
# FreeRTOS kernel files (upstream source code). # FreeRTOS kernel files (upstream source code)
- "/components/freertos/FreeRTOS-Kernel/" - "/components/freertos/FreeRTOS-Kernel/"
- "/components/freertos/FreeRTOS-Kernel-SMP/" - "/components/freertos/FreeRTOS-Kernel-SMP/"
- "/components/freertos/FreeRTOS-Kernel-V10.5.1/" # FreeRTOS additions to the upstream source code
- "/components/freertos/esp_additions/"
# FreeRTOS config files maintained in upstream format
- "/components/freertos/config/"
# Segger SystemView (upstream source code). # Segger SystemView (upstream source code).
# Could also try to find suitable astyle options, instead. # Could also try to find suitable astyle options, instead.
- "/components/app_trace/sys_view/Config/" - "/components/app_trace/sys_view/Config/"