Compare commits

...

8 Commits

Author SHA1 Message Date
Ben V. Brown
2e06b6c53e Merge 3a6a22c351 into 05158321ba 2025-02-24 09:40:33 +00:00
Ben V. Brown
3a6a22c351 Use indexed notifications for I2C
Some checks failed
CI / build (MHP30) (push) Has been cancelled
CI / build (Pinecil) (push) Has been cancelled
CI / build (Pinecilv2) (push) Has been cancelled
CI / build (S60) (push) Has been cancelled
CI / build (S60P) (push) Has been cancelled
CI / build (T55) (push) Has been cancelled
CI / build (TS100) (push) Has been cancelled
CI / build (TS101) (push) Has been cancelled
CI / build (TS80) (push) Has been cancelled
CI / build (TS80P) (push) Has been cancelled
CI / build_multi-lang (Pinecil) (push) Has been cancelled
CI / build_multi-lang (Pinecilv2) (push) Has been cancelled
CI / tests (push) Has been cancelled
CI / check_c-cpp (push) Has been cancelled
CI / check_python (push) Has been cancelled
CI / check_shell (push) Has been cancelled
CI / check_docs (push) Has been cancelled
CI / upload_metadata (push) Has been cancelled
2025-02-24 20:39:04 +11:00
Ben V. Brown
dd6c71a385 Merge branch 'update' into i2c-rework-2 2025-02-24 20:30:15 +11:00
Ben V. Brown
e8db6d5f4d Update FreeRTOSConfig.h 2025-02-24 20:26:53 +11:00
Ben V. Brown
f026e513fd Update GUIThread.cpp 2025-02-24 20:11:01 +11:00
Ben V. Brown
3e453f1363 Update FreeRTOS to latest release 2025-02-23 22:59:19 +11:00
Ben V. Brown
2794547817 Explicit cast 2025-02-23 20:18:46 +11:00
Ben V. Brown
7eee1b74d7 Update alpine 2025-02-23 18:47:50 +11:00
38 changed files with 28842 additions and 20419 deletions

View File

@@ -1,7 +1,7 @@
# Default Reference Distro for development env & deploy: # Default Reference Distro for development env & deploy:
# * Alpine Linux, version 3.19 * # * Alpine Linux, version 3.21 *
FROM alpine:3.19 FROM alpine:3.21
LABEL maintainer="Ben V. Brown <ralim@ralimtek.com>" LABEL maintainer="Ben V. Brown <ralim@ralimtek.com>"
# Default current dir when container starts # Default current dir when container starts

View File

@@ -105,12 +105,12 @@ extern uint32_t SystemCoreClock;
#define configMINIMAL_STACK_SIZE ((uint16_t)256) #define configMINIMAL_STACK_SIZE ((uint16_t)256)
#define configTOTAL_HEAP_SIZE ((size_t)1024 * 14) /*Currently use about 9000*/ #define configTOTAL_HEAP_SIZE ((size_t)1024 * 14) /*Currently use about 9000*/
#define configMAX_TASK_NAME_LEN (32) #define configMAX_TASK_NAME_LEN (32)
#define configUSE_16_BIT_TICKS 0
#define configUSE_MUTEXES 1 #define configUSE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 8 #define configQUEUE_REGISTRY_SIZE 8
#define configUSE_TIMERS 0 #define configUSE_TIMERS 0
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
#define configCHECK_FOR_STACK_OVERFLOW 2 /*Bump this to 2 during development and bug hunting*/ #define configCHECK_FOR_STACK_OVERFLOW 2 /*Bump this to 2 during development and bug hunting*/
#define configTICK_TYPE_WIDTH_IN_BITS TICK_TYPE_WIDTH_32_BITS
/* Co-routine definitions. */ /* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0 #define configUSE_CO_ROUTINES 0
@@ -156,11 +156,11 @@ extern uint32_t SystemCoreClock;
/* Normal assert() semantics without relying on the provision of an assert.h /* Normal assert() semantics without relying on the provision of an assert.h
header file. */ header file. */
/* USER CODE BEGIN 1 */ /* USER CODE BEGIN 1 */
#define configASSERT(x) \ #define configASSERT(x) \
if ((x) == 0) { \ if ((x) == 0) { \
taskDISABLE_INTERRUPTS(); \ taskDISABLE_INTERRUPTS(); \
for (;;) \ for (;;) \
; \ ; \
} }
/* USER CODE END 1 */ /* USER CODE END 1 */

View File

@@ -105,12 +105,12 @@ extern uint32_t SystemCoreClock;
#define configMINIMAL_STACK_SIZE ((uint16_t)256) #define configMINIMAL_STACK_SIZE ((uint16_t)256)
#define configTOTAL_HEAP_SIZE ((size_t)1024 * 14) /*Currently use about 9000*/ #define configTOTAL_HEAP_SIZE ((size_t)1024 * 14) /*Currently use about 9000*/
#define configMAX_TASK_NAME_LEN (32) #define configMAX_TASK_NAME_LEN (32)
#define configUSE_16_BIT_TICKS 0
#define configUSE_MUTEXES 1 #define configUSE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 8 #define configQUEUE_REGISTRY_SIZE 8
#define configUSE_TIMERS 0 #define configUSE_TIMERS 0
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
#define configCHECK_FOR_STACK_OVERFLOW 2 /*Bump this to 2 during development and bug hunting*/ #define configCHECK_FOR_STACK_OVERFLOW 2 /*Bump this to 2 during development and bug hunting*/
#define configTICK_TYPE_WIDTH_IN_BITS TICK_TYPE_WIDTH_32_BITS
/* Co-routine definitions. */ /* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0 #define configUSE_CO_ROUTINES 0
@@ -156,11 +156,11 @@ extern uint32_t SystemCoreClock;
/* Normal assert() semantics without relying on the provision of an assert.h /* Normal assert() semantics without relying on the provision of an assert.h
header file. */ header file. */
/* USER CODE BEGIN 1 */ /* USER CODE BEGIN 1 */
#define configASSERT(x) \ #define configASSERT(x) \
if ((x) == 0) { \ if ((x) == 0) { \
taskDISABLE_INTERRUPTS(); \ taskDISABLE_INTERRUPTS(); \
for (;;) \ for (;;) \
; \ ; \
} }
/* USER CODE END 1 */ /* USER CODE END 1 */

View File

@@ -11,7 +11,6 @@
#define configMAX_PRIORITIES (4) #define configMAX_PRIORITIES (4)
#define configMINIMAL_STACK_SIZE ((unsigned short)128) #define configMINIMAL_STACK_SIZE ((unsigned short)128)
#define configMAX_TASK_NAME_LEN 24 #define configMAX_TASK_NAME_LEN 24
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 0 #define configIDLE_SHOULD_YIELD 0
#define configUSE_TASK_NOTIFICATIONS 1 #define configUSE_TASK_NOTIFICATIONS 1
#define configUSE_MUTEXES 1 #define configUSE_MUTEXES 1
@@ -22,6 +21,7 @@
#define configUSE_TIME_SLICING 1 #define configUSE_TIME_SLICING 1
#define configUSE_NEWLIB_REENTRANT 0 #define configUSE_NEWLIB_REENTRANT 0
#define configENABLE_BACKWARD_COMPATIBILITY 0 #define configENABLE_BACKWARD_COMPATIBILITY 0
#define configTICK_TYPE_WIDTH_IN_BITS TICK_TYPE_WIDTH_32_BITS
#define INCLUDE_uxTaskGetStackHighWaterMark 1 #define INCLUDE_uxTaskGetStackHighWaterMark 1
#define INCLUDE_xTaskGetSchedulerState 1 #define INCLUDE_xTaskGetSchedulerState 1
@@ -62,11 +62,11 @@
#define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) #define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
/* Define to trap errors during development. */ /* Define to trap errors during development. */
#define configASSERT(x) \ #define configASSERT(x) \
if ((x) == 0) { \ if ((x) == 0) { \
taskDISABLE_INTERRUPTS(); \ taskDISABLE_INTERRUPTS(); \
for (;;) \ for (;;) \
; \ ; \
} }
#define INCLUDE_vTaskPrioritySet 1 #define INCLUDE_vTaskPrioritySet 1

View File

@@ -17,7 +17,6 @@
#define configTOTAL_HEAP_SIZE ((size_t)1024 * 8) #define configTOTAL_HEAP_SIZE ((size_t)1024 * 8)
#define configMAX_TASK_NAME_LEN (24) #define configMAX_TASK_NAME_LEN (24)
#define configUSE_TRACE_FACILITY 0 #define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 0 #define configIDLE_SHOULD_YIELD 0
#define configUSE_MUTEXES 1 #define configUSE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 8 #define configQUEUE_REGISTRY_SIZE 8
@@ -30,6 +29,9 @@
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
#define configUSE_STATS_FORMATTING_FUNCTIONS 0 #define configUSE_STATS_FORMATTING_FUNCTIONS 0
#define configUSE_TICKLESS_IDLE 0 #define configUSE_TICKLESS_IDLE 0
#define configTASK_NOTIFICATION_ARRAY_ENTRIES 2
#define configUSE_TASK_NOTIFICATIONS 1
#define configTICK_TYPE_WIDTH_IN_BITS TICK_TYPE_WIDTH_32_BITS
/* Co-routine definitions. */ /* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0 #define configUSE_CO_ROUTINES 0

View File

@@ -20,6 +20,7 @@ extern "C" {
SemaphoreHandle_t FRToSI2C::I2CSemaphore = nullptr; SemaphoreHandle_t FRToSI2C::I2CSemaphore = nullptr;
StaticSemaphore_t FRToSI2C::xSemaphoreBuffer; StaticSemaphore_t FRToSI2C::xSemaphoreBuffer;
#define I2C_TIME_OUT (uint16_t)(12000) #define I2C_TIME_OUT (uint16_t)(12000)
#define I2C_NOTIFY_INDEX 1
#define I2C_TX_FIFO_ADDR (0x4000A300 + 0x88) #define I2C_TX_FIFO_ADDR (0x4000A300 + 0x88)
#define I2C_RX_FIFO_ADDR (0x4000A300 + 0x8C) #define I2C_RX_FIFO_ADDR (0x4000A300 + 0x8C)
@@ -123,7 +124,7 @@ void FRToSI2C::CpltCallback() {
BaseType_t xHigherPriorityTaskWoken = pdFALSE; BaseType_t xHigherPriorityTaskWoken = pdFALSE;
xSemaphoreGiveFromISR(I2CSemaphore, &xHigherPriorityTaskWoken); xSemaphoreGiveFromISR(I2CSemaphore, &xHigherPriorityTaskWoken);
xTaskNotifyFromISR(IRQTaskWaitingHandle, IRQFailureMarker ? 2 : 1, eSetValueWithOverwrite, &xHigherPriorityTaskWoken); xTaskNotifyIndexedFromISR(IRQTaskWaitingHandle, I2C_NOTIFY_INDEX, IRQFailureMarker ? 2 : 1, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
portYIELD_FROM_ISR(xHigherPriorityTaskWoken); portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
} }
@@ -171,12 +172,14 @@ bool FRToSI2C::Mem_Read(uint16_t DevAddress, uint16_t read_address, uint8_t *p_b
// Wait for transfer in background // Wait for transfer in background
uint32_t result = 0; uint32_t result = 0;
xTaskNotifyWait(0xFFFFFFFF, 0xFFFFFFFF, &result, TICKS_100MS); xTaskNotifyWaitIndexed(I2C_NOTIFY_INDEX, 0xFFFFFFFF, 0xFFFFFFFF, &result, 0xFFFFFFFF);
CPU_Interrupt_Enable(BLE_IRQn); CPU_Interrupt_Enable(BLE_IRQn);
return result == 1; return result == 1;
} }
bool FRToSI2C::Mem_Write(uint16_t DevAddress, uint16_t MemAddress, uint8_t *p_buffer, uint16_t number_of_byte) { bool FRToSI2C::Mem_Write(uint16_t DevAddress, uint16_t MemAddress, uint8_t *p_buffer, uint16_t number_of_byte) {
if (!lock()) { if (!lock()) {
return false; return false;
} }
@@ -208,14 +211,15 @@ bool FRToSI2C::Mem_Write(uint16_t DevAddress, uint16_t MemAddress, uint8_t *p_bu
i2c_irq_tx_fifo_low(); i2c_irq_tx_fifo_low();
CPU_Interrupt_Disable(BLE_IRQn); CPU_Interrupt_Disable(BLE_IRQn); // Shut up BLE while we do the transfer
// Start // Start
I2C_Enable(I2C0_ID); I2C_Enable(I2C0_ID);
// Wait for transfer in background // Wait for transfer in background
uint32_t result = 0; uint32_t result = 0;
xTaskNotifyWait(0xFFFFFFFF, 0xFFFFFFFF, &result, TICKS_100MS); xTaskNotifyWaitIndexed(I2C_NOTIFY_INDEX, 0xFFFFFFFF, 0xFFFFFFFF, &result, 0xFFFFFFFF);
CPU_Interrupt_Enable(BLE_IRQn); CPU_Interrupt_Enable(BLE_IRQn); // Now BLE can run
return result == 1; return result == 1;
} }

View File

@@ -133,6 +133,8 @@ int ble_char_read_status_callback(struct bt_conn *conn, const struct bt_gatt_att
memcpy(buf, &temp, sizeof(temp)); memcpy(buf, &temp, sizeof(temp));
return sizeof(temp); return sizeof(temp);
break; break;
default:
break;
} }
MSG((char *)"Unhandled attr read %d | %d\n", (uint32_t)attr->uuid, uuid_value); MSG((char *)"Unhandled attr read %d | %d\n", (uint32_t)attr->uuid, uuid_value);
return 0; return 0;
@@ -150,7 +152,7 @@ int ble_char_read_bulk_value_callback(struct bt_conn *conn, const struct bt_gatt
// Bulk data // Bulk data
{ {
uint32_t bulkData[] = { uint32_t bulkData[] = {
TipThermoModel::getTipInC(), // 0 - Current temp (uint32_t)TipThermoModel::getTipInC(), // 0 - Current temp
getSettingValue(SettingsOptions::SolderingTemp), // 1 - Setpoint getSettingValue(SettingsOptions::SolderingTemp), // 1 - Setpoint
getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0), // 2 - Input voltage getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0), // 2 - Input voltage
getHandleTemperature(0), // 3 - Handle X10 Temp in C getHandleTemperature(0), // 3 - Handle X10 Temp in C
@@ -159,9 +161,9 @@ int ble_char_read_bulk_value_callback(struct bt_conn *conn, const struct bt_gatt
getTipResistanceX10(), // 6 - Tip resistance getTipResistanceX10(), // 6 - Tip resistance
xTaskGetTickCount() / TICKS_100MS, // 7 - uptime in deciseconds xTaskGetTickCount() / TICKS_100MS, // 7 - uptime in deciseconds
lastMovementTime / TICKS_100MS, // 8 - last movement time (deciseconds) lastMovementTime / TICKS_100MS, // 8 - last movement time (deciseconds)
TipThermoModel::getTipMaxInC(), // 9 - max temp (uint32_t)TipThermoModel::getTipMaxInC(), // 9 - max temp
TipThermoModel::convertTipRawADCTouV(getTipRawTemp(0), true), // 10 - Raw tip in μV TipThermoModel::convertTipRawADCTouV(getTipRawTemp(0), true), // 10 - Raw tip in μV
abs(getRawHallEffect()), // 11 - hall sensor (uint32_t)abs(getRawHallEffect()), // 11 - hall sensor
(uint32_t)currentOperatingMode, // 12 - Operating mode (uint32_t)currentOperatingMode, // 12 - Operating mode
x10WattHistory.average(), // 13 - Estimated Wattage *10 x10WattHistory.average(), // 13 - Estimated Wattage *10
}; };

View File

@@ -105,12 +105,12 @@ extern uint32_t SystemCoreClock;
#define configMINIMAL_STACK_SIZE ((uint16_t)256) #define configMINIMAL_STACK_SIZE ((uint16_t)256)
#define configTOTAL_HEAP_SIZE ((size_t)1024 * 14) /*Currently use about 9000*/ #define configTOTAL_HEAP_SIZE ((size_t)1024 * 14) /*Currently use about 9000*/
#define configMAX_TASK_NAME_LEN (32) #define configMAX_TASK_NAME_LEN (32)
#define configUSE_16_BIT_TICKS 0
#define configUSE_MUTEXES 1 #define configUSE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 8 #define configQUEUE_REGISTRY_SIZE 8
#define configUSE_TIMERS 0 #define configUSE_TIMERS 0
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
#define configCHECK_FOR_STACK_OVERFLOW 2 /*Bump this to 2 during development and bug hunting*/ #define configCHECK_FOR_STACK_OVERFLOW 2 /*Bump this to 2 during development and bug hunting*/
#define configTICK_TYPE_WIDTH_IN_BITS TICK_TYPE_WIDTH_32_BITS
/* Co-routine definitions. */ /* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0 #define configUSE_CO_ROUTINES 0
@@ -156,11 +156,11 @@ extern uint32_t SystemCoreClock;
/* Normal assert() semantics without relying on the provision of an assert.h /* Normal assert() semantics without relying on the provision of an assert.h
header file. */ header file. */
/* USER CODE BEGIN 1 */ /* USER CODE BEGIN 1 */
#define configASSERT(x) \ #define configASSERT(x) \
if ((x) == 0) { \ if ((x) == 0) { \
taskDISABLE_INTERRUPTS(); \ taskDISABLE_INTERRUPTS(); \
for (;;) \ for (;;) \
; \ ; \
} }
/* USER CODE END 1 */ /* USER CODE END 1 */

View File

@@ -186,7 +186,6 @@ void guiRenderLoop(void) {
} }
// Render done, draw it out // Render done, draw it out
OLED::refresh(); OLED::refresh();
osDelay(10);
} }
OperatingMode handle_post_init_state() { OperatingMode handle_post_init_state() {

File diff suppressed because it is too large Load Diff

View File

@@ -1,361 +1,405 @@
/* /*
* FreeRTOS Kernel V10.4.1 * FreeRTOS Kernel V11.1.0
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * SPDX-License-Identifier: MIT
* this software and associated documentation files (the "Software"), to deal in *
* the Software without restriction, including without limitation the rights to * Permission is hereby granted, free of charge, to any person obtaining a copy of
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * this software and associated documentation files (the "Software"), to deal in
* the Software, and to permit persons to whom the Software is furnished to do so, * the Software without restriction, including without limitation the rights to
* subject to the following conditions: * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* * the Software, and to permit persons to whom the Software is furnished to do so,
* The above copyright notice and this permission notice shall be included in all * subject to the following conditions:
* copies or substantial portions of the Software. *
* * The above copyright notice and this permission notice shall be included in all
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * copies or substantial portions of the Software.
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS *
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* https://www.FreeRTOS.org * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* https://github.com/FreeRTOS *
* * https://www.FreeRTOS.org
*/ * https://github.com/FreeRTOS
*
#include "FreeRTOS.h" */
#include "task.h"
#include "croutine.h" #include "FreeRTOS.h"
#include "task.h"
/* Remove the whole file is co-routines are not being used. */ #include "croutine.h"
#if ( configUSE_CO_ROUTINES != 0 )
/* Remove the whole file if co-routines are not being used. */
/* #if ( configUSE_CO_ROUTINES != 0 )
* Some kernel aware debuggers require data to be viewed to be global, rather
* than file scope. /*
*/ * Some kernel aware debuggers require data to be viewed to be global, rather
#ifdef portREMOVE_STATIC_QUALIFIER * than file scope.
#define static */
#endif #ifdef portREMOVE_STATIC_QUALIFIER
#define static
#endif
/* Lists for ready and blocked co-routines. --------------------*/
static List_t pxReadyCoRoutineLists[ configMAX_CO_ROUTINE_PRIORITIES ]; /*< Prioritised ready co-routines. */
static List_t xDelayedCoRoutineList1; /*< Delayed co-routines. */ /* Lists for ready and blocked co-routines. --------------------*/
static List_t xDelayedCoRoutineList2; /*< Delayed co-routines (two lists are used - one for delays that have overflowed the current tick count. */ static List_t pxReadyCoRoutineLists[ configMAX_CO_ROUTINE_PRIORITIES ]; /**< Prioritised ready co-routines. */
static List_t * pxDelayedCoRoutineList = NULL; /*< Points to the delayed co-routine list currently being used. */ static List_t xDelayedCoRoutineList1; /**< Delayed co-routines. */
static List_t * pxOverflowDelayedCoRoutineList = NULL; /*< Points to the delayed co-routine list currently being used to hold co-routines that have overflowed the current tick count. */ static List_t xDelayedCoRoutineList2; /**< Delayed co-routines (two lists are used - one for delays that have overflowed the current tick count. */
static List_t xPendingReadyCoRoutineList; /*< Holds co-routines that have been readied by an external event. They cannot be added directly to the ready lists as the ready lists cannot be accessed by interrupts. */ static List_t * pxDelayedCoRoutineList = NULL; /**< Points to the delayed co-routine list currently being used. */
static List_t * pxOverflowDelayedCoRoutineList = NULL; /**< Points to the delayed co-routine list currently being used to hold co-routines that have overflowed the current tick count. */
/* Other file private variables. --------------------------------*/ static List_t xPendingReadyCoRoutineList; /**< Holds co-routines that have been readied by an external event. They cannot be added directly to the ready lists as the ready lists cannot be accessed by interrupts. */
CRCB_t * pxCurrentCoRoutine = NULL;
static UBaseType_t uxTopCoRoutineReadyPriority = 0; /* Other file private variables. --------------------------------*/
static TickType_t xCoRoutineTickCount = 0, xLastTickCount = 0, xPassedTicks = 0; CRCB_t * pxCurrentCoRoutine = NULL;
static UBaseType_t uxTopCoRoutineReadyPriority = ( UBaseType_t ) 0U;
/* The initial state of the co-routine when it is created. */ static TickType_t xCoRoutineTickCount = ( TickType_t ) 0U;
#define corINITIAL_STATE ( 0 ) static TickType_t xLastTickCount = ( TickType_t ) 0U;
static TickType_t xPassedTicks = ( TickType_t ) 0U;
/*
* Place the co-routine represented by pxCRCB into the appropriate ready queue /* The initial state of the co-routine when it is created. */
* for the priority. It is inserted at the end of the list. #define corINITIAL_STATE ( 0 )
*
* This macro accesses the co-routine ready lists and therefore must not be /*
* used from within an ISR. * Place the co-routine represented by pxCRCB into the appropriate ready queue
*/ * for the priority. It is inserted at the end of the list.
#define prvAddCoRoutineToReadyQueue( pxCRCB ) \ *
{ \ * This macro accesses the co-routine ready lists and therefore must not be
if( pxCRCB->uxPriority > uxTopCoRoutineReadyPriority ) \ * used from within an ISR.
{ \ */
uxTopCoRoutineReadyPriority = pxCRCB->uxPriority; \ #define prvAddCoRoutineToReadyQueue( pxCRCB ) \
} \ do { \
vListInsertEnd( ( List_t * ) &( pxReadyCoRoutineLists[ pxCRCB->uxPriority ] ), &( pxCRCB->xGenericListItem ) ); \ if( ( pxCRCB )->uxPriority > uxTopCoRoutineReadyPriority ) \
} { \
uxTopCoRoutineReadyPriority = ( pxCRCB )->uxPriority; \
/* } \
* Utility to ready all the lists used by the scheduler. This is called vListInsertEnd( ( List_t * ) &( pxReadyCoRoutineLists[ ( pxCRCB )->uxPriority ] ), &( ( pxCRCB )->xGenericListItem ) ); \
* automatically upon the creation of the first co-routine. } while( 0 )
*/
static void prvInitialiseCoRoutineLists( void ); /*
* Utility to ready all the lists used by the scheduler. This is called
/* * automatically upon the creation of the first co-routine.
* Co-routines that are readied by an interrupt cannot be placed directly into */
* the ready lists (there is no mutual exclusion). Instead they are placed in static void prvInitialiseCoRoutineLists( void );
* in the pending ready list in order that they can later be moved to the ready
* list by the co-routine scheduler. /*
*/ * Co-routines that are readied by an interrupt cannot be placed directly into
static void prvCheckPendingReadyList( void ); * the ready lists (there is no mutual exclusion). Instead they are placed in
* in the pending ready list in order that they can later be moved to the ready
/* * list by the co-routine scheduler.
* Macro that looks at the list of co-routines that are currently delayed to */
* see if any require waking. static void prvCheckPendingReadyList( void );
*
* Co-routines are stored in the queue in the order of their wake time - /*
* meaning once one co-routine has been found whose timer has not expired * Macro that looks at the list of co-routines that are currently delayed to
* we need not look any further down the list. * see if any require waking.
*/ *
static void prvCheckDelayedList( void ); * Co-routines are stored in the queue in the order of their wake time -
* meaning once one co-routine has been found whose timer has not expired
/*-----------------------------------------------------------*/ * we need not look any further down the list.
*/
BaseType_t xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, static void prvCheckDelayedList( void );
UBaseType_t uxPriority,
UBaseType_t uxIndex ) /*-----------------------------------------------------------*/
{
BaseType_t xReturn; BaseType_t xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode,
CRCB_t * pxCoRoutine; UBaseType_t uxPriority,
UBaseType_t uxIndex )
/* Allocate the memory that will store the co-routine control block. */ {
pxCoRoutine = ( CRCB_t * ) pvPortMalloc( sizeof( CRCB_t ) ); BaseType_t xReturn;
CRCB_t * pxCoRoutine;
if( pxCoRoutine )
{ traceENTER_xCoRoutineCreate( pxCoRoutineCode, uxPriority, uxIndex );
/* If pxCurrentCoRoutine is NULL then this is the first co-routine to
* be created and the co-routine data structures need initialising. */ /* Allocate the memory that will store the co-routine control block. */
if( pxCurrentCoRoutine == NULL ) /* MISRA Ref 11.5.1 [Malloc memory assignment] */
{ /* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */
pxCurrentCoRoutine = pxCoRoutine; /* coverity[misra_c_2012_rule_11_5_violation] */
prvInitialiseCoRoutineLists(); pxCoRoutine = ( CRCB_t * ) pvPortMalloc( sizeof( CRCB_t ) );
}
if( pxCoRoutine )
/* Check the priority is within limits. */ {
if( uxPriority >= configMAX_CO_ROUTINE_PRIORITIES ) /* If pxCurrentCoRoutine is NULL then this is the first co-routine to
{ * be created and the co-routine data structures need initialising. */
uxPriority = configMAX_CO_ROUTINE_PRIORITIES - 1; if( pxCurrentCoRoutine == NULL )
} {
pxCurrentCoRoutine = pxCoRoutine;
/* Fill out the co-routine control block from the function parameters. */ prvInitialiseCoRoutineLists();
pxCoRoutine->uxState = corINITIAL_STATE; }
pxCoRoutine->uxPriority = uxPriority;
pxCoRoutine->uxIndex = uxIndex; /* Check the priority is within limits. */
pxCoRoutine->pxCoRoutineFunction = pxCoRoutineCode; if( uxPriority >= configMAX_CO_ROUTINE_PRIORITIES )
{
/* Initialise all the other co-routine control block parameters. */ uxPriority = configMAX_CO_ROUTINE_PRIORITIES - 1;
vListInitialiseItem( &( pxCoRoutine->xGenericListItem ) ); }
vListInitialiseItem( &( pxCoRoutine->xEventListItem ) );
/* Fill out the co-routine control block from the function parameters. */
/* Set the co-routine control block as a link back from the ListItem_t. pxCoRoutine->uxState = corINITIAL_STATE;
* This is so we can get back to the containing CRCB from a generic item pxCoRoutine->uxPriority = uxPriority;
* in a list. */ pxCoRoutine->uxIndex = uxIndex;
listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xGenericListItem ), pxCoRoutine ); pxCoRoutine->pxCoRoutineFunction = pxCoRoutineCode;
listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xEventListItem ), pxCoRoutine );
/* Initialise all the other co-routine control block parameters. */
/* Event lists are always in priority order. */ vListInitialiseItem( &( pxCoRoutine->xGenericListItem ) );
listSET_LIST_ITEM_VALUE( &( pxCoRoutine->xEventListItem ), ( ( TickType_t ) configMAX_CO_ROUTINE_PRIORITIES - ( TickType_t ) uxPriority ) ); vListInitialiseItem( &( pxCoRoutine->xEventListItem ) );
/* Now the co-routine has been initialised it can be added to the ready /* Set the co-routine control block as a link back from the ListItem_t.
* list at the correct priority. */ * This is so we can get back to the containing CRCB from a generic item
prvAddCoRoutineToReadyQueue( pxCoRoutine ); * in a list. */
listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xGenericListItem ), pxCoRoutine );
xReturn = pdPASS; listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xEventListItem ), pxCoRoutine );
}
else /* Event lists are always in priority order. */
{ listSET_LIST_ITEM_VALUE( &( pxCoRoutine->xEventListItem ), ( ( TickType_t ) configMAX_CO_ROUTINE_PRIORITIES - ( TickType_t ) uxPriority ) );
xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
} /* Now the co-routine has been initialised it can be added to the ready
* list at the correct priority. */
return xReturn; prvAddCoRoutineToReadyQueue( pxCoRoutine );
}
/*-----------------------------------------------------------*/ xReturn = pdPASS;
}
void vCoRoutineAddToDelayedList( TickType_t xTicksToDelay, else
List_t * pxEventList ) {
{ xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
TickType_t xTimeToWake; }
/* Calculate the time to wake - this may overflow but this is traceRETURN_xCoRoutineCreate( xReturn );
* not a problem. */
xTimeToWake = xCoRoutineTickCount + xTicksToDelay; return xReturn;
}
/* We must remove ourselves from the ready list before adding /*-----------------------------------------------------------*/
* ourselves to the blocked list as the same list item is used for
* both lists. */ void vCoRoutineAddToDelayedList( TickType_t xTicksToDelay,
( void ) uxListRemove( ( ListItem_t * ) &( pxCurrentCoRoutine->xGenericListItem ) ); List_t * pxEventList )
{
/* The list item will be inserted in wake time order. */ TickType_t xTimeToWake;
listSET_LIST_ITEM_VALUE( &( pxCurrentCoRoutine->xGenericListItem ), xTimeToWake );
traceENTER_vCoRoutineAddToDelayedList( xTicksToDelay, pxEventList );
if( xTimeToWake < xCoRoutineTickCount )
{ /* Calculate the time to wake - this may overflow but this is
/* Wake time has overflowed. Place this item in the * not a problem. */
* overflow list. */ xTimeToWake = xCoRoutineTickCount + xTicksToDelay;
vListInsert( ( List_t * ) pxOverflowDelayedCoRoutineList, ( ListItem_t * ) &( pxCurrentCoRoutine->xGenericListItem ) );
} /* We must remove ourselves from the ready list before adding
else * ourselves to the blocked list as the same list item is used for
{ * both lists. */
/* The wake time has not overflowed, so we can use the ( void ) uxListRemove( ( ListItem_t * ) &( pxCurrentCoRoutine->xGenericListItem ) );
* current block list. */
vListInsert( ( List_t * ) pxDelayedCoRoutineList, ( ListItem_t * ) &( pxCurrentCoRoutine->xGenericListItem ) ); /* The list item will be inserted in wake time order. */
} listSET_LIST_ITEM_VALUE( &( pxCurrentCoRoutine->xGenericListItem ), xTimeToWake );
if( pxEventList ) if( xTimeToWake < xCoRoutineTickCount )
{ {
/* Also add the co-routine to an event list. If this is done then the /* Wake time has overflowed. Place this item in the
* function must be called with interrupts disabled. */ * overflow list. */
vListInsert( pxEventList, &( pxCurrentCoRoutine->xEventListItem ) ); vListInsert( ( List_t * ) pxOverflowDelayedCoRoutineList, ( ListItem_t * ) &( pxCurrentCoRoutine->xGenericListItem ) );
} }
} else
/*-----------------------------------------------------------*/ {
/* The wake time has not overflowed, so we can use the
static void prvCheckPendingReadyList( void ) * current block list. */
{ vListInsert( ( List_t * ) pxDelayedCoRoutineList, ( ListItem_t * ) &( pxCurrentCoRoutine->xGenericListItem ) );
/* Are there any co-routines waiting to get moved to the ready list? These }
* are co-routines that have been readied by an ISR. The ISR cannot access
* the ready lists itself. */ if( pxEventList )
while( listLIST_IS_EMPTY( &xPendingReadyCoRoutineList ) == pdFALSE ) {
{ /* Also add the co-routine to an event list. If this is done then the
CRCB_t * pxUnblockedCRCB; * function must be called with interrupts disabled. */
vListInsert( pxEventList, &( pxCurrentCoRoutine->xEventListItem ) );
/* The pending ready list can be accessed by an ISR. */ }
portDISABLE_INTERRUPTS();
{ traceRETURN_vCoRoutineAddToDelayedList();
pxUnblockedCRCB = ( CRCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( ( &xPendingReadyCoRoutineList ) ); }
( void ) uxListRemove( &( pxUnblockedCRCB->xEventListItem ) ); /*-----------------------------------------------------------*/
}
portENABLE_INTERRUPTS(); static void prvCheckPendingReadyList( void )
{
( void ) uxListRemove( &( pxUnblockedCRCB->xGenericListItem ) ); /* Are there any co-routines waiting to get moved to the ready list? These
prvAddCoRoutineToReadyQueue( pxUnblockedCRCB ); * are co-routines that have been readied by an ISR. The ISR cannot access
} * the ready lists itself. */
} while( listLIST_IS_EMPTY( &xPendingReadyCoRoutineList ) == pdFALSE )
/*-----------------------------------------------------------*/ {
CRCB_t * pxUnblockedCRCB;
static void prvCheckDelayedList( void )
{ /* The pending ready list can be accessed by an ISR. */
CRCB_t * pxCRCB; portDISABLE_INTERRUPTS();
{
xPassedTicks = xTaskGetTickCount() - xLastTickCount; pxUnblockedCRCB = ( CRCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( ( &xPendingReadyCoRoutineList ) );
( void ) uxListRemove( &( pxUnblockedCRCB->xEventListItem ) );
while( xPassedTicks ) }
{ portENABLE_INTERRUPTS();
xCoRoutineTickCount++;
xPassedTicks--; ( void ) uxListRemove( &( pxUnblockedCRCB->xGenericListItem ) );
prvAddCoRoutineToReadyQueue( pxUnblockedCRCB );
/* If the tick count has overflowed we need to swap the ready lists. */ }
if( xCoRoutineTickCount == 0 ) }
{ /*-----------------------------------------------------------*/
List_t * pxTemp;
static void prvCheckDelayedList( void )
/* Tick count has overflowed so we need to swap the delay lists. If there are {
* any items in pxDelayedCoRoutineList here then there is an error! */ CRCB_t * pxCRCB;
pxTemp = pxDelayedCoRoutineList;
pxDelayedCoRoutineList = pxOverflowDelayedCoRoutineList; xPassedTicks = xTaskGetTickCount() - xLastTickCount;
pxOverflowDelayedCoRoutineList = pxTemp;
} while( xPassedTicks )
{
/* See if this tick has made a timeout expire. */ xCoRoutineTickCount++;
while( listLIST_IS_EMPTY( pxDelayedCoRoutineList ) == pdFALSE ) xPassedTicks--;
{
pxCRCB = ( CRCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedCoRoutineList ); /* If the tick count has overflowed we need to swap the ready lists. */
if( xCoRoutineTickCount == 0 )
if( xCoRoutineTickCount < listGET_LIST_ITEM_VALUE( &( pxCRCB->xGenericListItem ) ) ) {
{ List_t * pxTemp;
/* Timeout not yet expired. */
break; /* Tick count has overflowed so we need to swap the delay lists. If there are
} * any items in pxDelayedCoRoutineList here then there is an error! */
pxTemp = pxDelayedCoRoutineList;
portDISABLE_INTERRUPTS(); pxDelayedCoRoutineList = pxOverflowDelayedCoRoutineList;
{ pxOverflowDelayedCoRoutineList = pxTemp;
/* The event could have occurred just before this critical }
* section. If this is the case then the generic list item will
* have been moved to the pending ready list and the following /* See if this tick has made a timeout expire. */
* line is still valid. Also the pvContainer parameter will have while( listLIST_IS_EMPTY( pxDelayedCoRoutineList ) == pdFALSE )
* been set to NULL so the following lines are also valid. */ {
( void ) uxListRemove( &( pxCRCB->xGenericListItem ) ); pxCRCB = ( CRCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedCoRoutineList );
/* Is the co-routine waiting on an event also? */ if( xCoRoutineTickCount < listGET_LIST_ITEM_VALUE( &( pxCRCB->xGenericListItem ) ) )
if( pxCRCB->xEventListItem.pxContainer ) {
{ /* Timeout not yet expired. */
( void ) uxListRemove( &( pxCRCB->xEventListItem ) ); break;
} }
}
portENABLE_INTERRUPTS(); portDISABLE_INTERRUPTS();
{
prvAddCoRoutineToReadyQueue( pxCRCB ); /* The event could have occurred just before this critical
} * section. If this is the case then the generic list item will
} * have been moved to the pending ready list and the following
* line is still valid. Also the pvContainer parameter will have
xLastTickCount = xCoRoutineTickCount; * been set to NULL so the following lines are also valid. */
} ( void ) uxListRemove( &( pxCRCB->xGenericListItem ) );
/*-----------------------------------------------------------*/
/* Is the co-routine waiting on an event also? */
void vCoRoutineSchedule( void ) if( pxCRCB->xEventListItem.pxContainer )
{ {
/* Only run a co-routine after prvInitialiseCoRoutineLists() has been ( void ) uxListRemove( &( pxCRCB->xEventListItem ) );
* called. prvInitialiseCoRoutineLists() is called automatically when a }
* co-routine is created. */ }
if( pxDelayedCoRoutineList != NULL ) portENABLE_INTERRUPTS();
{
/* See if any co-routines readied by events need moving to the ready lists. */ prvAddCoRoutineToReadyQueue( pxCRCB );
prvCheckPendingReadyList(); }
}
/* See if any delayed co-routines have timed out. */
prvCheckDelayedList(); xLastTickCount = xCoRoutineTickCount;
}
/* Find the highest priority queue that contains ready co-routines. */ /*-----------------------------------------------------------*/
while( listLIST_IS_EMPTY( &( pxReadyCoRoutineLists[ uxTopCoRoutineReadyPriority ] ) ) )
{ void vCoRoutineSchedule( void )
if( uxTopCoRoutineReadyPriority == 0 ) {
{ traceENTER_vCoRoutineSchedule();
/* No more co-routines to check. */
return; /* Only run a co-routine after prvInitialiseCoRoutineLists() has been
} * called. prvInitialiseCoRoutineLists() is called automatically when a
* co-routine is created. */
--uxTopCoRoutineReadyPriority; if( pxDelayedCoRoutineList != NULL )
} {
/* See if any co-routines readied by events need moving to the ready lists. */
/* listGET_OWNER_OF_NEXT_ENTRY walks through the list, so the co-routines prvCheckPendingReadyList();
* of the same priority get an equal share of the processor time. */
listGET_OWNER_OF_NEXT_ENTRY( pxCurrentCoRoutine, &( pxReadyCoRoutineLists[ uxTopCoRoutineReadyPriority ] ) ); /* See if any delayed co-routines have timed out. */
prvCheckDelayedList();
/* Call the co-routine. */
( pxCurrentCoRoutine->pxCoRoutineFunction )( pxCurrentCoRoutine, pxCurrentCoRoutine->uxIndex ); /* Find the highest priority queue that contains ready co-routines. */
} while( listLIST_IS_EMPTY( &( pxReadyCoRoutineLists[ uxTopCoRoutineReadyPriority ] ) ) )
} {
/*-----------------------------------------------------------*/ if( uxTopCoRoutineReadyPriority == 0 )
{
static void prvInitialiseCoRoutineLists( void ) /* No more co-routines to check. */
{ return;
UBaseType_t uxPriority; }
for( uxPriority = 0; uxPriority < configMAX_CO_ROUTINE_PRIORITIES; uxPriority++ ) --uxTopCoRoutineReadyPriority;
{ }
vListInitialise( ( List_t * ) &( pxReadyCoRoutineLists[ uxPriority ] ) );
} /* listGET_OWNER_OF_NEXT_ENTRY walks through the list, so the co-routines
* of the same priority get an equal share of the processor time. */
vListInitialise( ( List_t * ) &xDelayedCoRoutineList1 ); listGET_OWNER_OF_NEXT_ENTRY( pxCurrentCoRoutine, &( pxReadyCoRoutineLists[ uxTopCoRoutineReadyPriority ] ) );
vListInitialise( ( List_t * ) &xDelayedCoRoutineList2 );
vListInitialise( ( List_t * ) &xPendingReadyCoRoutineList ); /* Call the co-routine. */
( pxCurrentCoRoutine->pxCoRoutineFunction )( pxCurrentCoRoutine, pxCurrentCoRoutine->uxIndex );
/* Start with pxDelayedCoRoutineList using list1 and the }
* pxOverflowDelayedCoRoutineList using list2. */
pxDelayedCoRoutineList = &xDelayedCoRoutineList1; traceRETURN_vCoRoutineSchedule();
pxOverflowDelayedCoRoutineList = &xDelayedCoRoutineList2; }
} /*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/
static void prvInitialiseCoRoutineLists( void )
BaseType_t xCoRoutineRemoveFromEventList( const List_t * pxEventList ) {
{ UBaseType_t uxPriority;
CRCB_t * pxUnblockedCRCB;
BaseType_t xReturn; for( uxPriority = 0; uxPriority < configMAX_CO_ROUTINE_PRIORITIES; uxPriority++ )
{
/* This function is called from within an interrupt. It can only access vListInitialise( ( List_t * ) &( pxReadyCoRoutineLists[ uxPriority ] ) );
* event lists and the pending ready list. This function assumes that a }
* check has already been made to ensure pxEventList is not empty. */
pxUnblockedCRCB = ( CRCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList ); vListInitialise( ( List_t * ) &xDelayedCoRoutineList1 );
( void ) uxListRemove( &( pxUnblockedCRCB->xEventListItem ) ); vListInitialise( ( List_t * ) &xDelayedCoRoutineList2 );
vListInsertEnd( ( List_t * ) &( xPendingReadyCoRoutineList ), &( pxUnblockedCRCB->xEventListItem ) ); vListInitialise( ( List_t * ) &xPendingReadyCoRoutineList );
if( pxUnblockedCRCB->uxPriority >= pxCurrentCoRoutine->uxPriority ) /* Start with pxDelayedCoRoutineList using list1 and the
{ * pxOverflowDelayedCoRoutineList using list2. */
xReturn = pdTRUE; pxDelayedCoRoutineList = &xDelayedCoRoutineList1;
} pxOverflowDelayedCoRoutineList = &xDelayedCoRoutineList2;
else }
{ /*-----------------------------------------------------------*/
xReturn = pdFALSE;
} BaseType_t xCoRoutineRemoveFromEventList( const List_t * pxEventList )
{
return xReturn; CRCB_t * pxUnblockedCRCB;
} BaseType_t xReturn;
#endif /* configUSE_CO_ROUTINES == 0 */ traceENTER_xCoRoutineRemoveFromEventList( pxEventList );
/* This function is called from within an interrupt. It can only access
* event lists and the pending ready list. This function assumes that a
* check has already been made to ensure pxEventList is not empty. */
pxUnblockedCRCB = ( CRCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList );
( void ) uxListRemove( &( pxUnblockedCRCB->xEventListItem ) );
vListInsertEnd( ( List_t * ) &( xPendingReadyCoRoutineList ), &( pxUnblockedCRCB->xEventListItem ) );
if( pxUnblockedCRCB->uxPriority >= pxCurrentCoRoutine->uxPriority )
{
xReturn = pdTRUE;
}
else
{
xReturn = pdFALSE;
}
traceRETURN_xCoRoutineRemoveFromEventList( xReturn );
return xReturn;
}
/*-----------------------------------------------------------*/
/*
* Reset state in this file. This state is normally initialized at start up.
* This function must be called by the application before restarting the
* scheduler.
*/
void vCoRoutineResetState( void )
{
/* Lists for ready and blocked co-routines. */
pxDelayedCoRoutineList = NULL;
pxOverflowDelayedCoRoutineList = NULL;
/* Other file private variables. */
pxCurrentCoRoutine = NULL;
uxTopCoRoutineReadyPriority = ( UBaseType_t ) 0U;
xCoRoutineTickCount = ( TickType_t ) 0U;
xLastTickCount = ( TickType_t ) 0U;
xPassedTicks = ( TickType_t ) 0U;
}
/*-----------------------------------------------------------*/
#endif /* configUSE_CO_ROUTINES == 0 */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,32 +1,34 @@
/* /*
* FreeRTOS Kernel V10.4.1 * FreeRTOS Kernel V11.1.0
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * SPDX-License-Identifier: MIT
* this software and associated documentation files (the "Software"), to deal in *
* the Software without restriction, including without limitation the rights to * Permission is hereby granted, free of charge, to any person obtaining a copy of
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * this software and associated documentation files (the "Software"), to deal in
* the Software, and to permit persons to whom the Software is furnished to do so, * the Software without restriction, including without limitation the rights to
* subject to the following conditions: * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* * the Software, and to permit persons to whom the Software is furnished to do so,
* The above copyright notice and this permission notice shall be included in all * subject to the following conditions:
* copies or substantial portions of the Software. *
* * The above copyright notice and this permission notice shall be included in all
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * copies or substantial portions of the Software.
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS *
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* https://www.FreeRTOS.org * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* https://github.com/FreeRTOS *
* * https://www.FreeRTOS.org
*/ * https://github.com/FreeRTOS
*
*/
#ifndef _MSC_VER /* Visual Studio doesn't support #warning. */
#warning The name of this file has changed to stack_macros.h. Please update your code accordingly. This source file (which has the original name) will be removed in future released.
#endif #ifndef _MSC_VER /* Visual Studio doesn't support #warning. */
#warning The name of this file has changed to stack_macros.h. Please update your code accordingly. This source file (which has the original name) will be removed in a future release.
#include "stack_macros.h" #endif
#include "stack_macros.h"

View File

@@ -1,417 +1,427 @@
/* /*
* FreeRTOS Kernel V10.4.1 * FreeRTOS Kernel V11.1.0
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * SPDX-License-Identifier: MIT
* this software and associated documentation files (the "Software"), to deal in *
* the Software without restriction, including without limitation the rights to * Permission is hereby granted, free of charge, to any person obtaining a copy of
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * this software and associated documentation files (the "Software"), to deal in
* the Software, and to permit persons to whom the Software is furnished to do so, * the Software without restriction, including without limitation the rights to
* subject to the following conditions: * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* * the Software, and to permit persons to whom the Software is furnished to do so,
* The above copyright notice and this permission notice shall be included in all * subject to the following conditions:
* copies or substantial portions of the Software. *
* * The above copyright notice and this permission notice shall be included in all
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * copies or substantial portions of the Software.
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS *
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* https://www.FreeRTOS.org * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* https://github.com/FreeRTOS *
* * https://www.FreeRTOS.org
*/ * https://github.com/FreeRTOS
*
/** */
* @file atomic.h
* @brief FreeRTOS atomic operation support. /**
* * @file atomic.h
* This file implements atomic functions by disabling interrupts globally. * @brief FreeRTOS atomic operation support.
* Implementations with architecture specific atomic instructions can be *
* provided under each compiler directory. * This file implements atomic functions by disabling interrupts globally.
*/ * Implementations with architecture specific atomic instructions can be
* provided under each compiler directory.
#ifndef ATOMIC_H *
#define ATOMIC_H * The atomic interface can be used in FreeRTOS tasks on all FreeRTOS ports. It
* can also be used in Interrupt Service Routines (ISRs) on FreeRTOS ports that
#ifndef INC_FREERTOS_H * support nested interrupts (i.e. portHAS_NESTED_INTERRUPTS is set to 1). The
#error "include FreeRTOS.h must appear in source files before include atomic.h" * atomic interface must not be used in ISRs on FreeRTOS ports that do not
#endif * support nested interrupts (i.e. portHAS_NESTED_INTERRUPTS is set to 0)
* because ISRs on these ports cannot be interrupted and therefore, do not need
/* Standard includes. */ * atomics in ISRs.
#include <stdint.h> */
/* *INDENT-OFF* */ #ifndef ATOMIC_H
#ifdef __cplusplus #define ATOMIC_H
extern "C" {
#endif #ifndef INC_FREERTOS_H
/* *INDENT-ON* */ #error "include FreeRTOS.h must appear in source files before include atomic.h"
#endif
/*
* Port specific definitions -- entering/exiting critical section. /* Standard includes. */
* Refer template -- ./lib/FreeRTOS/portable/Compiler/Arch/portmacro.h #include <stdint.h>
*
* Every call to ATOMIC_EXIT_CRITICAL() must be closely paired with /* *INDENT-OFF* */
* ATOMIC_ENTER_CRITICAL(). #ifdef __cplusplus
* extern "C" {
*/ #endif
#if defined( portSET_INTERRUPT_MASK_FROM_ISR ) /* *INDENT-ON* */
/* Nested interrupt scheme is supported in this port. */ /*
#define ATOMIC_ENTER_CRITICAL() \ * Port specific definitions -- entering/exiting critical section.
UBaseType_t uxCriticalSectionType = portSET_INTERRUPT_MASK_FROM_ISR() * Refer template -- ./lib/FreeRTOS/portable/Compiler/Arch/portmacro.h
*
#define ATOMIC_EXIT_CRITICAL() \ * Every call to ATOMIC_EXIT_CRITICAL() must be closely paired with
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxCriticalSectionType ) * ATOMIC_ENTER_CRITICAL().
*
#else */
#if ( portHAS_NESTED_INTERRUPTS == 1 )
/* Nested interrupt scheme is NOT supported in this port. */
#define ATOMIC_ENTER_CRITICAL() portENTER_CRITICAL() /* Nested interrupt scheme is supported in this port. */
#define ATOMIC_EXIT_CRITICAL() portEXIT_CRITICAL() #define ATOMIC_ENTER_CRITICAL() \
UBaseType_t uxCriticalSectionType = portSET_INTERRUPT_MASK_FROM_ISR()
#endif /* portSET_INTERRUPT_MASK_FROM_ISR() */
#define ATOMIC_EXIT_CRITICAL() \
/* portCLEAR_INTERRUPT_MASK_FROM_ISR( uxCriticalSectionType )
* Port specific definition -- "always inline".
* Inline is compiler specific, and may not always get inlined depending on your #else
* optimization level. Also, inline is considered as performance optimization
* for atomic. Thus, if portFORCE_INLINE is not provided by portmacro.h, /* Nested interrupt scheme is NOT supported in this port. */
* instead of resulting error, simply define it away. #define ATOMIC_ENTER_CRITICAL() portENTER_CRITICAL()
*/ #define ATOMIC_EXIT_CRITICAL() portEXIT_CRITICAL()
#ifndef portFORCE_INLINE
#define portFORCE_INLINE #endif /* portSET_INTERRUPT_MASK_FROM_ISR() */
#endif
/*
#define ATOMIC_COMPARE_AND_SWAP_SUCCESS 0x1U /**< Compare and swap succeeded, swapped. */ * Port specific definition -- "always inline".
#define ATOMIC_COMPARE_AND_SWAP_FAILURE 0x0U /**< Compare and swap failed, did not swap. */ * Inline is compiler specific, and may not always get inlined depending on your
* optimization level. Also, inline is considered as performance optimization
/*----------------------------- Swap && CAS ------------------------------*/ * for atomic. Thus, if portFORCE_INLINE is not provided by portmacro.h,
* instead of resulting error, simply define it away.
/** */
* Atomic compare-and-swap #ifndef portFORCE_INLINE
* #define portFORCE_INLINE
* @brief Performs an atomic compare-and-swap operation on the specified values. #endif
*
* @param[in, out] pulDestination Pointer to memory location from where value is #define ATOMIC_COMPARE_AND_SWAP_SUCCESS 0x1U /**< Compare and swap succeeded, swapped. */
* to be loaded and checked. #define ATOMIC_COMPARE_AND_SWAP_FAILURE 0x0U /**< Compare and swap failed, did not swap. */
* @param[in] ulExchange If condition meets, write this value to memory.
* @param[in] ulComparand Swap condition. /*----------------------------- Swap && CAS ------------------------------*/
*
* @return Unsigned integer of value 1 or 0. 1 for swapped, 0 for not swapped. /**
* * Atomic compare-and-swap
* @note This function only swaps *pulDestination with ulExchange, if previous *
* *pulDestination value equals ulComparand. * @brief Performs an atomic compare-and-swap operation on the specified values.
*/ *
static portFORCE_INLINE uint32_t Atomic_CompareAndSwap_u32( uint32_t volatile * pulDestination, * @param[in, out] pulDestination Pointer to memory location from where value is
uint32_t ulExchange, * to be loaded and checked.
uint32_t ulComparand ) * @param[in] ulExchange If condition meets, write this value to memory.
{ * @param[in] ulComparand Swap condition.
uint32_t ulReturnValue; *
* @return Unsigned integer of value 1 or 0. 1 for swapped, 0 for not swapped.
ATOMIC_ENTER_CRITICAL(); *
{ * @note This function only swaps *pulDestination with ulExchange, if previous
if( *pulDestination == ulComparand ) * *pulDestination value equals ulComparand.
{ */
*pulDestination = ulExchange; static portFORCE_INLINE uint32_t Atomic_CompareAndSwap_u32( uint32_t volatile * pulDestination,
ulReturnValue = ATOMIC_COMPARE_AND_SWAP_SUCCESS; uint32_t ulExchange,
} uint32_t ulComparand )
else {
{ uint32_t ulReturnValue;
ulReturnValue = ATOMIC_COMPARE_AND_SWAP_FAILURE;
} ATOMIC_ENTER_CRITICAL();
} {
ATOMIC_EXIT_CRITICAL(); if( *pulDestination == ulComparand )
{
return ulReturnValue; *pulDestination = ulExchange;
} ulReturnValue = ATOMIC_COMPARE_AND_SWAP_SUCCESS;
/*-----------------------------------------------------------*/ }
else
/** {
* Atomic swap (pointers) ulReturnValue = ATOMIC_COMPARE_AND_SWAP_FAILURE;
* }
* @brief Atomically sets the address pointed to by *ppvDestination to the value }
* of *pvExchange. ATOMIC_EXIT_CRITICAL();
*
* @param[in, out] ppvDestination Pointer to memory location from where a pointer return ulReturnValue;
* value is to be loaded and written back to. }
* @param[in] pvExchange Pointer value to be written to *ppvDestination. /*-----------------------------------------------------------*/
*
* @return The initial value of *ppvDestination. /**
*/ * Atomic swap (pointers)
static portFORCE_INLINE void * Atomic_SwapPointers_p32( void * volatile * ppvDestination, *
void * pvExchange ) * @brief Atomically sets the address pointed to by *ppvDestination to the value
{ * of *pvExchange.
void * pReturnValue; *
* @param[in, out] ppvDestination Pointer to memory location from where a pointer
ATOMIC_ENTER_CRITICAL(); * value is to be loaded and written back to.
{ * @param[in] pvExchange Pointer value to be written to *ppvDestination.
pReturnValue = *ppvDestination; *
*ppvDestination = pvExchange; * @return The initial value of *ppvDestination.
} */
ATOMIC_EXIT_CRITICAL(); static portFORCE_INLINE void * Atomic_SwapPointers_p32( void * volatile * ppvDestination,
void * pvExchange )
return pReturnValue; {
} void * pReturnValue;
/*-----------------------------------------------------------*/
ATOMIC_ENTER_CRITICAL();
/** {
* Atomic compare-and-swap (pointers) pReturnValue = *ppvDestination;
* *ppvDestination = pvExchange;
* @brief Performs an atomic compare-and-swap operation on the specified pointer }
* values. ATOMIC_EXIT_CRITICAL();
*
* @param[in, out] ppvDestination Pointer to memory location from where a pointer return pReturnValue;
* value is to be loaded and checked. }
* @param[in] pvExchange If condition meets, write this value to memory. /*-----------------------------------------------------------*/
* @param[in] pvComparand Swap condition.
* /**
* @return Unsigned integer of value 1 or 0. 1 for swapped, 0 for not swapped. * Atomic compare-and-swap (pointers)
* *
* @note This function only swaps *ppvDestination with pvExchange, if previous * @brief Performs an atomic compare-and-swap operation on the specified pointer
* *ppvDestination value equals pvComparand. * values.
*/ *
static portFORCE_INLINE uint32_t Atomic_CompareAndSwapPointers_p32( void * volatile * ppvDestination, * @param[in, out] ppvDestination Pointer to memory location from where a pointer
void * pvExchange, * value is to be loaded and checked.
void * pvComparand ) * @param[in] pvExchange If condition meets, write this value to memory.
{ * @param[in] pvComparand Swap condition.
uint32_t ulReturnValue = ATOMIC_COMPARE_AND_SWAP_FAILURE; *
* @return Unsigned integer of value 1 or 0. 1 for swapped, 0 for not swapped.
ATOMIC_ENTER_CRITICAL(); *
{ * @note This function only swaps *ppvDestination with pvExchange, if previous
if( *ppvDestination == pvComparand ) * *ppvDestination value equals pvComparand.
{ */
*ppvDestination = pvExchange; static portFORCE_INLINE uint32_t Atomic_CompareAndSwapPointers_p32( void * volatile * ppvDestination,
ulReturnValue = ATOMIC_COMPARE_AND_SWAP_SUCCESS; void * pvExchange,
} void * pvComparand )
} {
ATOMIC_EXIT_CRITICAL(); uint32_t ulReturnValue = ATOMIC_COMPARE_AND_SWAP_FAILURE;
return ulReturnValue; ATOMIC_ENTER_CRITICAL();
} {
if( *ppvDestination == pvComparand )
{
/*----------------------------- Arithmetic ------------------------------*/ *ppvDestination = pvExchange;
ulReturnValue = ATOMIC_COMPARE_AND_SWAP_SUCCESS;
/** }
* Atomic add }
* ATOMIC_EXIT_CRITICAL();
* @brief Atomically adds count to the value of the specified pointer points to.
* return ulReturnValue;
* @param[in,out] pulAddend Pointer to memory location from where value is to be }
* loaded and written back to.
* @param[in] ulCount Value to be added to *pulAddend.
* /*----------------------------- Arithmetic ------------------------------*/
* @return previous *pulAddend value.
*/ /**
static portFORCE_INLINE uint32_t Atomic_Add_u32( uint32_t volatile * pulAddend, * Atomic add
uint32_t ulCount ) *
{ * @brief Atomically adds count to the value of the specified pointer points to.
uint32_t ulCurrent; *
* @param[in,out] pulAddend Pointer to memory location from where value is to be
ATOMIC_ENTER_CRITICAL(); * loaded and written back to.
{ * @param[in] ulCount Value to be added to *pulAddend.
ulCurrent = *pulAddend; *
*pulAddend += ulCount; * @return previous *pulAddend value.
} */
ATOMIC_EXIT_CRITICAL(); static portFORCE_INLINE uint32_t Atomic_Add_u32( uint32_t volatile * pulAddend,
uint32_t ulCount )
return ulCurrent; {
} uint32_t ulCurrent;
/*-----------------------------------------------------------*/
ATOMIC_ENTER_CRITICAL();
/** {
* Atomic subtract ulCurrent = *pulAddend;
* *pulAddend += ulCount;
* @brief Atomically subtracts count from the value of the specified pointer }
* pointers to. ATOMIC_EXIT_CRITICAL();
*
* @param[in,out] pulAddend Pointer to memory location from where value is to be return ulCurrent;
* loaded and written back to. }
* @param[in] ulCount Value to be subtract from *pulAddend. /*-----------------------------------------------------------*/
*
* @return previous *pulAddend value. /**
*/ * Atomic subtract
static portFORCE_INLINE uint32_t Atomic_Subtract_u32( uint32_t volatile * pulAddend, *
uint32_t ulCount ) * @brief Atomically subtracts count from the value of the specified pointer
{ * pointers to.
uint32_t ulCurrent; *
* @param[in,out] pulAddend Pointer to memory location from where value is to be
ATOMIC_ENTER_CRITICAL(); * loaded and written back to.
{ * @param[in] ulCount Value to be subtract from *pulAddend.
ulCurrent = *pulAddend; *
*pulAddend -= ulCount; * @return previous *pulAddend value.
} */
ATOMIC_EXIT_CRITICAL(); static portFORCE_INLINE uint32_t Atomic_Subtract_u32( uint32_t volatile * pulAddend,
uint32_t ulCount )
return ulCurrent; {
} uint32_t ulCurrent;
/*-----------------------------------------------------------*/
ATOMIC_ENTER_CRITICAL();
/** {
* Atomic increment ulCurrent = *pulAddend;
* *pulAddend -= ulCount;
* @brief Atomically increments the value of the specified pointer points to. }
* ATOMIC_EXIT_CRITICAL();
* @param[in,out] pulAddend Pointer to memory location from where value is to be
* loaded and written back to. return ulCurrent;
* }
* @return *pulAddend value before increment. /*-----------------------------------------------------------*/
*/
static portFORCE_INLINE uint32_t Atomic_Increment_u32( uint32_t volatile * pulAddend ) /**
{ * Atomic increment
uint32_t ulCurrent; *
* @brief Atomically increments the value of the specified pointer points to.
ATOMIC_ENTER_CRITICAL(); *
{ * @param[in,out] pulAddend Pointer to memory location from where value is to be
ulCurrent = *pulAddend; * loaded and written back to.
*pulAddend += 1; *
} * @return *pulAddend value before increment.
ATOMIC_EXIT_CRITICAL(); */
static portFORCE_INLINE uint32_t Atomic_Increment_u32( uint32_t volatile * pulAddend )
return ulCurrent; {
} uint32_t ulCurrent;
/*-----------------------------------------------------------*/
ATOMIC_ENTER_CRITICAL();
/** {
* Atomic decrement ulCurrent = *pulAddend;
* *pulAddend += 1;
* @brief Atomically decrements the value of the specified pointer points to }
* ATOMIC_EXIT_CRITICAL();
* @param[in,out] pulAddend Pointer to memory location from where value is to be
* loaded and written back to. return ulCurrent;
* }
* @return *pulAddend value before decrement. /*-----------------------------------------------------------*/
*/
static portFORCE_INLINE uint32_t Atomic_Decrement_u32( uint32_t volatile * pulAddend ) /**
{ * Atomic decrement
uint32_t ulCurrent; *
* @brief Atomically decrements the value of the specified pointer points to
ATOMIC_ENTER_CRITICAL(); *
{ * @param[in,out] pulAddend Pointer to memory location from where value is to be
ulCurrent = *pulAddend; * loaded and written back to.
*pulAddend -= 1; *
} * @return *pulAddend value before decrement.
ATOMIC_EXIT_CRITICAL(); */
static portFORCE_INLINE uint32_t Atomic_Decrement_u32( uint32_t volatile * pulAddend )
return ulCurrent; {
} uint32_t ulCurrent;
/*----------------------------- Bitwise Logical ------------------------------*/ ATOMIC_ENTER_CRITICAL();
{
/** ulCurrent = *pulAddend;
* Atomic OR *pulAddend -= 1;
* }
* @brief Performs an atomic OR operation on the specified values. ATOMIC_EXIT_CRITICAL();
*
* @param [in, out] pulDestination Pointer to memory location from where value is return ulCurrent;
* to be loaded and written back to. }
* @param [in] ulValue Value to be ORed with *pulDestination.
* /*----------------------------- Bitwise Logical ------------------------------*/
* @return The original value of *pulDestination.
*/ /**
static portFORCE_INLINE uint32_t Atomic_OR_u32( uint32_t volatile * pulDestination, * Atomic OR
uint32_t ulValue ) *
{ * @brief Performs an atomic OR operation on the specified values.
uint32_t ulCurrent; *
* @param [in, out] pulDestination Pointer to memory location from where value is
ATOMIC_ENTER_CRITICAL(); * to be loaded and written back to.
{ * @param [in] ulValue Value to be ORed with *pulDestination.
ulCurrent = *pulDestination; *
*pulDestination |= ulValue; * @return The original value of *pulDestination.
} */
ATOMIC_EXIT_CRITICAL(); static portFORCE_INLINE uint32_t Atomic_OR_u32( uint32_t volatile * pulDestination,
uint32_t ulValue )
return ulCurrent; {
} uint32_t ulCurrent;
/*-----------------------------------------------------------*/
ATOMIC_ENTER_CRITICAL();
/** {
* Atomic AND ulCurrent = *pulDestination;
* *pulDestination |= ulValue;
* @brief Performs an atomic AND operation on the specified values. }
* ATOMIC_EXIT_CRITICAL();
* @param [in, out] pulDestination Pointer to memory location from where value is
* to be loaded and written back to. return ulCurrent;
* @param [in] ulValue Value to be ANDed with *pulDestination. }
* /*-----------------------------------------------------------*/
* @return The original value of *pulDestination.
*/ /**
static portFORCE_INLINE uint32_t Atomic_AND_u32( uint32_t volatile * pulDestination, * Atomic AND
uint32_t ulValue ) *
{ * @brief Performs an atomic AND operation on the specified values.
uint32_t ulCurrent; *
* @param [in, out] pulDestination Pointer to memory location from where value is
ATOMIC_ENTER_CRITICAL(); * to be loaded and written back to.
{ * @param [in] ulValue Value to be ANDed with *pulDestination.
ulCurrent = *pulDestination; *
*pulDestination &= ulValue; * @return The original value of *pulDestination.
} */
ATOMIC_EXIT_CRITICAL(); static portFORCE_INLINE uint32_t Atomic_AND_u32( uint32_t volatile * pulDestination,
uint32_t ulValue )
return ulCurrent; {
} uint32_t ulCurrent;
/*-----------------------------------------------------------*/
ATOMIC_ENTER_CRITICAL();
/** {
* Atomic NAND ulCurrent = *pulDestination;
* *pulDestination &= ulValue;
* @brief Performs an atomic NAND operation on the specified values. }
* ATOMIC_EXIT_CRITICAL();
* @param [in, out] pulDestination Pointer to memory location from where value is
* to be loaded and written back to. return ulCurrent;
* @param [in] ulValue Value to be NANDed with *pulDestination. }
* /*-----------------------------------------------------------*/
* @return The original value of *pulDestination.
*/ /**
static portFORCE_INLINE uint32_t Atomic_NAND_u32( uint32_t volatile * pulDestination, * Atomic NAND
uint32_t ulValue ) *
{ * @brief Performs an atomic NAND operation on the specified values.
uint32_t ulCurrent; *
* @param [in, out] pulDestination Pointer to memory location from where value is
ATOMIC_ENTER_CRITICAL(); * to be loaded and written back to.
{ * @param [in] ulValue Value to be NANDed with *pulDestination.
ulCurrent = *pulDestination; *
*pulDestination = ~( ulCurrent & ulValue ); * @return The original value of *pulDestination.
} */
ATOMIC_EXIT_CRITICAL(); static portFORCE_INLINE uint32_t Atomic_NAND_u32( uint32_t volatile * pulDestination,
uint32_t ulValue )
return ulCurrent; {
} uint32_t ulCurrent;
/*-----------------------------------------------------------*/
ATOMIC_ENTER_CRITICAL();
/** {
* Atomic XOR ulCurrent = *pulDestination;
* *pulDestination = ~( ulCurrent & ulValue );
* @brief Performs an atomic XOR operation on the specified values. }
* ATOMIC_EXIT_CRITICAL();
* @param [in, out] pulDestination Pointer to memory location from where value is
* to be loaded and written back to. return ulCurrent;
* @param [in] ulValue Value to be XORed with *pulDestination. }
* /*-----------------------------------------------------------*/
* @return The original value of *pulDestination.
*/ /**
static portFORCE_INLINE uint32_t Atomic_XOR_u32( uint32_t volatile * pulDestination, * Atomic XOR
uint32_t ulValue ) *
{ * @brief Performs an atomic XOR operation on the specified values.
uint32_t ulCurrent; *
* @param [in, out] pulDestination Pointer to memory location from where value is
ATOMIC_ENTER_CRITICAL(); * to be loaded and written back to.
{ * @param [in] ulValue Value to be XORed with *pulDestination.
ulCurrent = *pulDestination; *
*pulDestination ^= ulValue; * @return The original value of *pulDestination.
} */
ATOMIC_EXIT_CRITICAL(); static portFORCE_INLINE uint32_t Atomic_XOR_u32( uint32_t volatile * pulDestination,
uint32_t ulValue )
return ulCurrent; {
} uint32_t ulCurrent;
/* *INDENT-OFF* */ ATOMIC_ENTER_CRITICAL();
#ifdef __cplusplus {
} ulCurrent = *pulDestination;
#endif *pulDestination ^= ulValue;
/* *INDENT-ON* */ }
ATOMIC_EXIT_CRITICAL();
#endif /* ATOMIC_H */
return ulCurrent;
}
/* *INDENT-OFF* */
#ifdef __cplusplus
}
#endif
/* *INDENT-ON* */
#endif /* ATOMIC_H */

File diff suppressed because it is too large Load Diff

View File

@@ -1,40 +0,0 @@
/*
* FreeRTOS Kernel V10.4.1
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
#ifndef DEPRECATED_DEFINITIONS_H
#define DEPRECATED_DEFINITIONS_H
/* Each FreeRTOS port has a unique portmacro.h header file. Originally a
* pre-processor definition was used to ensure the pre-processor found the correct
* portmacro.h file for the port being used. That scheme was deprecated in favour
* of setting the compiler's include path such that it found the correct
* portmacro.h file - removing the need for the constant and allowing the
* portmacro.h file to be located anywhere in relation to the port being used. The
* definitions below remain in the code for backward compatibility only. New
* projects should not use them. */
#include "portmacro.h"
#endif /* DEPRECATED_DEFINITIONS_H */

View File

@@ -1,6 +1,8 @@
/* /*
* FreeRTOS Kernel V10.4.1 * FreeRTOS Kernel V11.1.0
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* SPDX-License-Identifier: MIT
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in * this software and associated documentation files (the "Software"), to deal in
@@ -34,6 +36,26 @@
/* FreeRTOS includes. */ /* FreeRTOS includes. */
#include "timers.h" #include "timers.h"
/* The following bit fields convey control information in a task's event list
* item value. It is important they don't clash with the
* taskEVENT_LIST_ITEM_VALUE_IN_USE definition. */
#if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
#define eventCLEAR_EVENTS_ON_EXIT_BIT ( ( uint16_t ) 0x0100U )
#define eventUNBLOCKED_DUE_TO_BIT_SET ( ( uint16_t ) 0x0200U )
#define eventWAIT_FOR_ALL_BITS ( ( uint16_t ) 0x0400U )
#define eventEVENT_BITS_CONTROL_BYTES ( ( uint16_t ) 0xff00U )
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
#define eventCLEAR_EVENTS_ON_EXIT_BIT ( ( uint32_t ) 0x01000000U )
#define eventUNBLOCKED_DUE_TO_BIT_SET ( ( uint32_t ) 0x02000000U )
#define eventWAIT_FOR_ALL_BITS ( ( uint32_t ) 0x04000000U )
#define eventEVENT_BITS_CONTROL_BYTES ( ( uint32_t ) 0xff000000U )
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS )
#define eventCLEAR_EVENTS_ON_EXIT_BIT ( ( uint64_t ) 0x0100000000000000U )
#define eventUNBLOCKED_DUE_TO_BIT_SET ( ( uint64_t ) 0x0200000000000000U )
#define eventWAIT_FOR_ALL_BITS ( ( uint64_t ) 0x0400000000000000U )
#define eventEVENT_BITS_CONTROL_BYTES ( ( uint64_t ) 0xff00000000000000U )
#endif /* if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS ) */
/* *INDENT-OFF* */ /* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -63,8 +85,6 @@
* be set and then tested atomically - as is the case where event groups are * be set and then tested atomically - as is the case where event groups are
* used to create a synchronisation point between multiple tasks (a * used to create a synchronisation point between multiple tasks (a
* 'rendezvous'). * 'rendezvous').
*
* \defgroup EventGroup
*/ */
@@ -84,8 +104,8 @@ typedef struct EventGroupDef_t * EventGroupHandle_t;
/* /*
* The type that holds event bits always matches TickType_t - therefore the * The type that holds event bits always matches TickType_t - therefore the
* number of bits it holds is set by configUSE_16_BIT_TICKS (16 bits if set to 1, * number of bits it holds is set by configTICK_TYPE_WIDTH_IN_BITS (16 bits if set to 0,
* 32 bits if set to 0. * 32 bits if set to 1, 64 bits if set to 2.
* *
* \defgroup EventBits_t EventBits_t * \defgroup EventBits_t EventBits_t
* \ingroup EventGroup * \ingroup EventGroup
@@ -94,36 +114,40 @@ typedef TickType_t EventBits_t;
/** /**
* event_groups.h * event_groups.h
* <pre> * @code{c}
* EventGroupHandle_t xEventGroupCreate( void ); * EventGroupHandle_t xEventGroupCreate( void );
* </pre> * @endcode
* *
* Create a new event group. * Create a new event group.
* *
* Internally, within the FreeRTOS implementation, event groups use a [small] * Internally, within the FreeRTOS implementation, event groups use a [small]
* block of memory, in which the event group's structure is stored. If an event * block of memory, in which the event group's structure is stored. If an event
* groups is created using xEventGropuCreate() then the required memory is * groups is created using xEventGroupCreate() then the required memory is
* automatically dynamically allocated inside the xEventGroupCreate() function. * automatically dynamically allocated inside the xEventGroupCreate() function.
* (see https://www.FreeRTOS.org/a00111.html). If an event group is created * (see https://www.FreeRTOS.org/a00111.html). If an event group is created
* using xEventGropuCreateStatic() then the application writer must instead * using xEventGroupCreateStatic() then the application writer must instead
* provide the memory that will get used by the event group. * provide the memory that will get used by the event group.
* xEventGroupCreateStatic() therefore allows an event group to be created * xEventGroupCreateStatic() therefore allows an event group to be created
* without using any dynamic memory allocation. * without using any dynamic memory allocation.
* *
* Although event groups are not related to ticks, for internal implementation * Although event groups are not related to ticks, for internal implementation
* reasons the number of bits available for use in an event group is dependent * reasons the number of bits available for use in an event group is dependent
* on the configUSE_16_BIT_TICKS setting in FreeRTOSConfig.h. If * on the configTICK_TYPE_WIDTH_IN_BITS setting in FreeRTOSConfig.h. If
* configUSE_16_BIT_TICKS is 1 then each event group contains 8 usable bits (bit * configTICK_TYPE_WIDTH_IN_BITS is 0 then each event group contains 8 usable bits (bit
* 0 to bit 7). If configUSE_16_BIT_TICKS is set to 0 then each event group has * 0 to bit 7). If configTICK_TYPE_WIDTH_IN_BITS is set to 1 then each event group has
* 24 usable bits (bit 0 to bit 23). The EventBits_t type is used to store * 24 usable bits (bit 0 to bit 23). If configTICK_TYPE_WIDTH_IN_BITS is set to 2 then
* event bits within an event group. * each event group has 56 usable bits (bit 0 to bit 53). The EventBits_t type
* is used to store event bits within an event group.
*
* The configUSE_EVENT_GROUPS configuration constant must be set to 1 for xEventGroupCreate()
* to be available.
* *
* @return If the event group was created then a handle to the event group is * @return If the event group was created then a handle to the event group is
* returned. If there was insufficient FreeRTOS heap available to create the * returned. If there was insufficient FreeRTOS heap available to create the
* event group then NULL is returned. See https://www.FreeRTOS.org/a00111.html * event group then NULL is returned. See https://www.FreeRTOS.org/a00111.html
* *
* Example usage: * Example usage:
* <pre> * @code{c}
* // Declare a variable to hold the created event group. * // Declare a variable to hold the created event group.
* EventGroupHandle_t xCreatedEventGroup; * EventGroupHandle_t xCreatedEventGroup;
* *
@@ -140,7 +164,7 @@ typedef TickType_t EventBits_t;
* { * {
* // The event group was created. * // The event group was created.
* } * }
* </pre> * @endcode
* \defgroup xEventGroupCreate xEventGroupCreate * \defgroup xEventGroupCreate xEventGroupCreate
* \ingroup EventGroup * \ingroup EventGroup
*/ */
@@ -150,29 +174,33 @@ typedef TickType_t EventBits_t;
/** /**
* event_groups.h * event_groups.h
* <pre> * @code{c}
* EventGroupHandle_t xEventGroupCreateStatic( EventGroupHandle_t * pxEventGroupBuffer ); * EventGroupHandle_t xEventGroupCreateStatic( EventGroupHandle_t * pxEventGroupBuffer );
* </pre> * @endcode
* *
* Create a new event group. * Create a new event group.
* *
* Internally, within the FreeRTOS implementation, event groups use a [small] * Internally, within the FreeRTOS implementation, event groups use a [small]
* block of memory, in which the event group's structure is stored. If an event * block of memory, in which the event group's structure is stored. If an event
* groups is created using xEventGropuCreate() then the required memory is * groups is created using xEventGroupCreate() then the required memory is
* automatically dynamically allocated inside the xEventGroupCreate() function. * automatically dynamically allocated inside the xEventGroupCreate() function.
* (see https://www.FreeRTOS.org/a00111.html). If an event group is created * (see https://www.FreeRTOS.org/a00111.html). If an event group is created
* using xEventGropuCreateStatic() then the application writer must instead * using xEventGroupCreateStatic() then the application writer must instead
* provide the memory that will get used by the event group. * provide the memory that will get used by the event group.
* xEventGroupCreateStatic() therefore allows an event group to be created * xEventGroupCreateStatic() therefore allows an event group to be created
* without using any dynamic memory allocation. * without using any dynamic memory allocation.
* *
* Although event groups are not related to ticks, for internal implementation * Although event groups are not related to ticks, for internal implementation
* reasons the number of bits available for use in an event group is dependent * reasons the number of bits available for use in an event group is dependent
* on the configUSE_16_BIT_TICKS setting in FreeRTOSConfig.h. If * on the configTICK_TYPE_WIDTH_IN_BITS setting in FreeRTOSConfig.h. If
* configUSE_16_BIT_TICKS is 1 then each event group contains 8 usable bits (bit * configTICK_TYPE_WIDTH_IN_BITS is 0 then each event group contains 8 usable bits (bit
* 0 to bit 7). If configUSE_16_BIT_TICKS is set to 0 then each event group has * 0 to bit 7). If configTICK_TYPE_WIDTH_IN_BITS is set to 1 then each event group has
* 24 usable bits (bit 0 to bit 23). The EventBits_t type is used to store * 24 usable bits (bit 0 to bit 23). If configTICK_TYPE_WIDTH_IN_BITS is set to 2 then
* event bits within an event group. * each event group has 56 usable bits (bit 0 to bit 53). The EventBits_t type
* is used to store event bits within an event group.
*
* The configUSE_EVENT_GROUPS configuration constant must be set to 1 for xEventGroupCreateStatic()
* to be available.
* *
* @param pxEventGroupBuffer pxEventGroupBuffer must point to a variable of type * @param pxEventGroupBuffer pxEventGroupBuffer must point to a variable of type
* StaticEventGroup_t, which will be then be used to hold the event group's data * StaticEventGroup_t, which will be then be used to hold the event group's data
@@ -182,7 +210,7 @@ typedef TickType_t EventBits_t;
* returned. If pxEventGroupBuffer was NULL then NULL is returned. * returned. If pxEventGroupBuffer was NULL then NULL is returned.
* *
* Example usage: * Example usage:
* <pre> * @code{c}
* // StaticEventGroup_t is a publicly accessible structure that has the same * // StaticEventGroup_t is a publicly accessible structure that has the same
* // size and alignment requirements as the real event group structure. It is * // size and alignment requirements as the real event group structure. It is
* // provided as a mechanism for applications to know the size of the event * // provided as a mechanism for applications to know the size of the event
@@ -195,7 +223,7 @@ typedef TickType_t EventBits_t;
* *
* // Create the event group without dynamically allocating any memory. * // Create the event group without dynamically allocating any memory.
* xEventGroup = xEventGroupCreateStatic( &xEventGroupBuffer ); * xEventGroup = xEventGroupCreateStatic( &xEventGroupBuffer );
* </pre> * @endcode
*/ */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 ) #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
EventGroupHandle_t xEventGroupCreateStatic( StaticEventGroup_t * pxEventGroupBuffer ) PRIVILEGED_FUNCTION; EventGroupHandle_t xEventGroupCreateStatic( StaticEventGroup_t * pxEventGroupBuffer ) PRIVILEGED_FUNCTION;
@@ -203,19 +231,22 @@ typedef TickType_t EventBits_t;
/** /**
* event_groups.h * event_groups.h
* <pre> * @code{c}
* EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, * EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
* const EventBits_t uxBitsToWaitFor, * const EventBits_t uxBitsToWaitFor,
* const BaseType_t xClearOnExit, * const BaseType_t xClearOnExit,
* const BaseType_t xWaitForAllBits, * const BaseType_t xWaitForAllBits,
* const TickType_t xTicksToWait ); * const TickType_t xTicksToWait );
* </pre> * @endcode
* *
* [Potentially] block to wait for one or more bits to be set within a * [Potentially] block to wait for one or more bits to be set within a
* previously created event group. * previously created event group.
* *
* This function cannot be called from an interrupt. * This function cannot be called from an interrupt.
* *
* The configUSE_EVENT_GROUPS configuration constant must be set to 1 for xEventGroupWaitBits()
* to be available.
*
* @param xEventGroup The event group in which the bits are being tested. The * @param xEventGroup The event group in which the bits are being tested. The
* event group must have previously been created using a call to * event group must have previously been created using a call to
* xEventGroupCreate(). * xEventGroupCreate().
@@ -241,7 +272,8 @@ typedef TickType_t EventBits_t;
* *
* @param xTicksToWait The maximum amount of time (specified in 'ticks') to wait * @param xTicksToWait The maximum amount of time (specified in 'ticks') to wait
* for one/all (depending on the xWaitForAllBits value) of the bits specified by * for one/all (depending on the xWaitForAllBits value) of the bits specified by
* uxBitsToWaitFor to become set. * uxBitsToWaitFor to become set. A value of portMAX_DELAY can be used to block
* indefinitely (provided INCLUDE_vTaskSuspend is set to 1 in FreeRTOSConfig.h).
* *
* @return The value of the event group at the time either the bits being waited * @return The value of the event group at the time either the bits being waited
* for became set, or the block time expired. Test the return value to know * for became set, or the block time expired. Test the return value to know
@@ -253,9 +285,9 @@ typedef TickType_t EventBits_t;
* pdTRUE. * pdTRUE.
* *
* Example usage: * Example usage:
* <pre> * @code{c}
#define BIT_0 ( 1 << 0 ) * #define BIT_0 ( 1 << 0 )
#define BIT_4 ( 1 << 4 ) * #define BIT_4 ( 1 << 4 )
* *
* void aFunction( EventGroupHandle_t xEventGroup ) * void aFunction( EventGroupHandle_t xEventGroup )
* { * {
@@ -289,7 +321,7 @@ typedef TickType_t EventBits_t;
* // without either BIT_0 or BIT_4 becoming set. * // without either BIT_0 or BIT_4 becoming set.
* } * }
* } * }
* </pre> * @endcode
* \defgroup xEventGroupWaitBits xEventGroupWaitBits * \defgroup xEventGroupWaitBits xEventGroupWaitBits
* \ingroup EventGroup * \ingroup EventGroup
*/ */
@@ -301,13 +333,16 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
/** /**
* event_groups.h * event_groups.h
* <pre> * @code{c}
* EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ); * EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear );
* </pre> * @endcode
* *
* Clear bits within an event group. This function cannot be called from an * Clear bits within an event group. This function cannot be called from an
* interrupt. * interrupt.
* *
* The configUSE_EVENT_GROUPS configuration constant must be set to 1 for xEventGroupClearBits()
* to be available.
*
* @param xEventGroup The event group in which the bits are to be cleared. * @param xEventGroup The event group in which the bits are to be cleared.
* *
* @param uxBitsToClear A bitwise value that indicates the bit or bits to clear * @param uxBitsToClear A bitwise value that indicates the bit or bits to clear
@@ -317,9 +352,9 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
* @return The value of the event group before the specified bits were cleared. * @return The value of the event group before the specified bits were cleared.
* *
* Example usage: * Example usage:
* <pre> * @code{c}
#define BIT_0 ( 1 << 0 ) * #define BIT_0 ( 1 << 0 )
#define BIT_4 ( 1 << 4 ) * #define BIT_4 ( 1 << 4 )
* *
* void aFunction( EventGroupHandle_t xEventGroup ) * void aFunction( EventGroupHandle_t xEventGroup )
* { * {
@@ -350,7 +385,7 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
* // Neither bit 0 nor bit 4 were set in the first place. * // Neither bit 0 nor bit 4 were set in the first place.
* } * }
* } * }
* </pre> * @endcode
* \defgroup xEventGroupClearBits xEventGroupClearBits * \defgroup xEventGroupClearBits xEventGroupClearBits
* \ingroup EventGroup * \ingroup EventGroup
*/ */
@@ -359,9 +394,9 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
/** /**
* event_groups.h * event_groups.h
* <pre> * @code{c}
* BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ); * BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet );
* </pre> * @endcode
* *
* A version of xEventGroupClearBits() that can be called from an interrupt. * A version of xEventGroupClearBits() that can be called from an interrupt.
* *
@@ -375,6 +410,12 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
* timer task to have the clear operation performed in the context of the timer * timer task to have the clear operation performed in the context of the timer
* task. * task.
* *
* @note If this function returns pdPASS then the timer task is ready to run
* and a portYIELD_FROM_ISR(pdTRUE) should be executed to perform the needed
* clear on the event group. This behavior is different from
* xEventGroupSetBitsFromISR because the parameter xHigherPriorityTaskWoken is
* not present.
*
* @param xEventGroup The event group in which the bits are to be cleared. * @param xEventGroup The event group in which the bits are to be cleared.
* *
* @param uxBitsToClear A bitwise value that indicates the bit or bits to clear. * @param uxBitsToClear A bitwise value that indicates the bit or bits to clear.
@@ -386,9 +427,9 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
* if the timer service queue was full. * if the timer service queue was full.
* *
* Example usage: * Example usage:
* <pre> * @code{c}
#define BIT_0 ( 1 << 0 ) * #define BIT_0 ( 1 << 0 )
#define BIT_4 ( 1 << 4 ) * #define BIT_4 ( 1 << 4 )
* *
* // An event group which it is assumed has already been created by a call to * // An event group which it is assumed has already been created by a call to
* // xEventGroupCreate(). * // xEventGroupCreate().
@@ -404,9 +445,10 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
* if( xResult == pdPASS ) * if( xResult == pdPASS )
* { * {
* // The message was posted successfully. * // The message was posted successfully.
* portYIELD_FROM_ISR(pdTRUE);
* } * }
* } * }
* </pre> * @endcode
* \defgroup xEventGroupClearBitsFromISR xEventGroupClearBitsFromISR * \defgroup xEventGroupClearBitsFromISR xEventGroupClearBitsFromISR
* \ingroup EventGroup * \ingroup EventGroup
*/ */
@@ -415,14 +457,14 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
const EventBits_t uxBitsToClear ) PRIVILEGED_FUNCTION; const EventBits_t uxBitsToClear ) PRIVILEGED_FUNCTION;
#else #else
#define xEventGroupClearBitsFromISR( xEventGroup, uxBitsToClear ) \ #define xEventGroupClearBitsFromISR( xEventGroup, uxBitsToClear ) \
xTimerPendFunctionCallFromISR( vEventGroupClearBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToClear, NULL ) xTimerPendFunctionCallFromISR( vEventGroupClearBitsCallback, ( void * ) ( xEventGroup ), ( uint32_t ) ( uxBitsToClear ), NULL )
#endif #endif
/** /**
* event_groups.h * event_groups.h
* <pre> * @code{c}
* EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ); * EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet );
* </pre> * @endcode
* *
* Set bits within an event group. * Set bits within an event group.
* This function cannot be called from an interrupt. xEventGroupSetBitsFromISR() * This function cannot be called from an interrupt. xEventGroupSetBitsFromISR()
@@ -431,6 +473,9 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
* Setting bits in an event group will automatically unblock tasks that are * Setting bits in an event group will automatically unblock tasks that are
* blocked waiting for the bits. * blocked waiting for the bits.
* *
* The configUSE_EVENT_GROUPS configuration constant must be set to 1 for xEventGroupSetBits()
* to be available.
*
* @param xEventGroup The event group in which the bits are to be set. * @param xEventGroup The event group in which the bits are to be set.
* *
* @param uxBitsToSet A bitwise value that indicates the bit or bits to set. * @param uxBitsToSet A bitwise value that indicates the bit or bits to set.
@@ -448,9 +493,9 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
* event group value before the call to xEventGroupSetBits() returns. * event group value before the call to xEventGroupSetBits() returns.
* *
* Example usage: * Example usage:
* <pre> * @code{c}
#define BIT_0 ( 1 << 0 ) * #define BIT_0 ( 1 << 0 )
#define BIT_4 ( 1 << 4 ) * #define BIT_4 ( 1 << 4 )
* *
* void aFunction( EventGroupHandle_t xEventGroup ) * void aFunction( EventGroupHandle_t xEventGroup )
* { * {
@@ -486,7 +531,7 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
* // cleared as the task left the Blocked state. * // cleared as the task left the Blocked state.
* } * }
* } * }
* </pre> * @endcode
* \defgroup xEventGroupSetBits xEventGroupSetBits * \defgroup xEventGroupSetBits xEventGroupSetBits
* \ingroup EventGroup * \ingroup EventGroup
*/ */
@@ -495,9 +540,9 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,
/** /**
* event_groups.h * event_groups.h
* <pre> * @code{c}
* BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken ); * BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken );
* </pre> * @endcode
* *
* A version of xEventGroupSetBits() that can be called from an interrupt. * A version of xEventGroupSetBits() that can be called from an interrupt.
* *
@@ -530,9 +575,9 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,
* if the timer service queue was full. * if the timer service queue was full.
* *
* Example usage: * Example usage:
* <pre> * @code{c}
#define BIT_0 ( 1 << 0 ) * #define BIT_0 ( 1 << 0 )
#define BIT_4 ( 1 << 4 ) * #define BIT_4 ( 1 << 4 )
* *
* // An event group which it is assumed has already been created by a call to * // An event group which it is assumed has already been created by a call to
* // xEventGroupCreate(). * // xEventGroupCreate().
@@ -561,7 +606,7 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,
* portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); * portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
* } * }
* } * }
* </pre> * @endcode
* \defgroup xEventGroupSetBitsFromISR xEventGroupSetBitsFromISR * \defgroup xEventGroupSetBitsFromISR xEventGroupSetBitsFromISR
* \ingroup EventGroup * \ingroup EventGroup
*/ */
@@ -571,17 +616,17 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,
BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION; BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
#else #else
#define xEventGroupSetBitsFromISR( xEventGroup, uxBitsToSet, pxHigherPriorityTaskWoken ) \ #define xEventGroupSetBitsFromISR( xEventGroup, uxBitsToSet, pxHigherPriorityTaskWoken ) \
xTimerPendFunctionCallFromISR( vEventGroupSetBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToSet, pxHigherPriorityTaskWoken ) xTimerPendFunctionCallFromISR( vEventGroupSetBitsCallback, ( void * ) ( xEventGroup ), ( uint32_t ) ( uxBitsToSet ), ( pxHigherPriorityTaskWoken ) )
#endif #endif
/** /**
* event_groups.h * event_groups.h
* <pre> * @code{c}
* EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, * EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup,
* const EventBits_t uxBitsToSet, * const EventBits_t uxBitsToSet,
* const EventBits_t uxBitsToWaitFor, * const EventBits_t uxBitsToWaitFor,
* TickType_t xTicksToWait ); * TickType_t xTicksToWait );
* </pre> * @endcode
* *
* Atomically set bits within an event group, then wait for a combination of * Atomically set bits within an event group, then wait for a combination of
* bits to be set within the same event group. This functionality is typically * bits to be set within the same event group. This functionality is typically
@@ -595,6 +640,9 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,
* this case all the bits specified by uxBitsToWait will be automatically * this case all the bits specified by uxBitsToWait will be automatically
* cleared before the function returns. * cleared before the function returns.
* *
* The configUSE_EVENT_GROUPS configuration constant must be set to 1 for xEventGroupSync()
* to be available.
*
* @param xEventGroup The event group in which the bits are being tested. The * @param xEventGroup The event group in which the bits are being tested. The
* event group must have previously been created using a call to * event group must have previously been created using a call to
* xEventGroupCreate(). * xEventGroupCreate().
@@ -620,13 +668,13 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,
* automatically cleared. * automatically cleared.
* *
* Example usage: * Example usage:
* <pre> * @code{c}
* // Bits used by the three tasks. * // Bits used by the three tasks.
#define TASK_0_BIT ( 1 << 0 ) * #define TASK_0_BIT ( 1 << 0 )
#define TASK_1_BIT ( 1 << 1 ) * #define TASK_1_BIT ( 1 << 1 )
#define TASK_2_BIT ( 1 << 2 ) * #define TASK_2_BIT ( 1 << 2 )
* *
#define ALL_SYNC_BITS ( TASK_0_BIT | TASK_1_BIT | TASK_2_BIT ) * #define ALL_SYNC_BITS ( TASK_0_BIT | TASK_1_BIT | TASK_2_BIT )
* *
* // Use an event group to synchronise three tasks. It is assumed this event * // Use an event group to synchronise three tasks. It is assumed this event
* // group has already been created elsewhere. * // group has already been created elsewhere.
@@ -694,7 +742,7 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,
* } * }
* } * }
* *
* </pre> * @endcode
* \defgroup xEventGroupSync xEventGroupSync * \defgroup xEventGroupSync xEventGroupSync
* \ingroup EventGroup * \ingroup EventGroup
*/ */
@@ -706,13 +754,16 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup,
/** /**
* event_groups.h * event_groups.h
* <pre> * @code{c}
* EventBits_t xEventGroupGetBits( EventGroupHandle_t xEventGroup ); * EventBits_t xEventGroupGetBits( EventGroupHandle_t xEventGroup );
* </pre> * @endcode
* *
* Returns the current value of the bits in an event group. This function * Returns the current value of the bits in an event group. This function
* cannot be used from an interrupt. * cannot be used from an interrupt.
* *
* The configUSE_EVENT_GROUPS configuration constant must be set to 1 for xEventGroupGetBits()
* to be available.
*
* @param xEventGroup The event group being queried. * @param xEventGroup The event group being queried.
* *
* @return The event group bits at the time xEventGroupGetBits() was called. * @return The event group bits at the time xEventGroupGetBits() was called.
@@ -720,16 +771,19 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup,
* \defgroup xEventGroupGetBits xEventGroupGetBits * \defgroup xEventGroupGetBits xEventGroupGetBits
* \ingroup EventGroup * \ingroup EventGroup
*/ */
#define xEventGroupGetBits( xEventGroup ) xEventGroupClearBits( xEventGroup, 0 ) #define xEventGroupGetBits( xEventGroup ) xEventGroupClearBits( ( xEventGroup ), 0 )
/** /**
* event_groups.h * event_groups.h
* <pre> * @code{c}
* EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ); * EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup );
* </pre> * @endcode
* *
* A version of xEventGroupGetBits() that can be called from an ISR. * A version of xEventGroupGetBits() that can be called from an ISR.
* *
* The configUSE_EVENT_GROUPS configuration constant must be set to 1 for xEventGroupGetBitsFromISR()
* to be available.
*
* @param xEventGroup The event group being queried. * @param xEventGroup The event group being queried.
* *
* @return The event group bits at the time xEventGroupGetBitsFromISR() was called. * @return The event group bits at the time xEventGroupGetBitsFromISR() was called.
@@ -741,23 +795,51 @@ EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ) PRIVILEG
/** /**
* event_groups.h * event_groups.h
* <pre> * @code{c}
* void xEventGroupDelete( EventGroupHandle_t xEventGroup ); * void xEventGroupDelete( EventGroupHandle_t xEventGroup );
* </pre> * @endcode
* *
* Delete an event group that was previously created by a call to * Delete an event group that was previously created by a call to
* xEventGroupCreate(). Tasks that are blocked on the event group will be * xEventGroupCreate(). Tasks that are blocked on the event group will be
* unblocked and obtain 0 as the event group's value. * unblocked and obtain 0 as the event group's value.
* *
* The configUSE_EVENT_GROUPS configuration constant must be set to 1 for vEventGroupDelete()
* to be available.
*
* @param xEventGroup The event group being deleted. * @param xEventGroup The event group being deleted.
*/ */
void vEventGroupDelete( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION; void vEventGroupDelete( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;
/**
* event_groups.h
* @code{c}
* BaseType_t xEventGroupGetStaticBuffer( EventGroupHandle_t xEventGroup,
* StaticEventGroup_t ** ppxEventGroupBuffer );
* @endcode
*
* Retrieve a pointer to a statically created event groups's data structure
* buffer. It is the same buffer that is supplied at the time of creation.
*
* The configUSE_EVENT_GROUPS configuration constant must be set to 1 for xEventGroupGetStaticBuffer()
* to be available.
*
* @param xEventGroup The event group for which to retrieve the buffer.
*
* @param ppxEventGroupBuffer Used to return a pointer to the event groups's
* data structure buffer.
*
* @return pdTRUE if the buffer was retrieved, pdFALSE otherwise.
*/
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
BaseType_t xEventGroupGetStaticBuffer( EventGroupHandle_t xEventGroup,
StaticEventGroup_t ** ppxEventGroupBuffer ) PRIVILEGED_FUNCTION;
#endif /* configSUPPORT_STATIC_ALLOCATION */
/* For internal use only. */ /* For internal use only. */
void vEventGroupSetBitsCallback( void * pvEventGroup, void vEventGroupSetBitsCallback( void * pvEventGroup,
const uint32_t ulBitsToSet ) PRIVILEGED_FUNCTION; uint32_t ulBitsToSet ) PRIVILEGED_FUNCTION;
void vEventGroupClearBitsCallback( void * pvEventGroup, void vEventGroupClearBitsCallback( void * pvEventGroup,
const uint32_t ulBitsToClear ) PRIVILEGED_FUNCTION; uint32_t ulBitsToClear ) PRIVILEGED_FUNCTION;
#if ( configUSE_TRACE_FACILITY == 1 ) #if ( configUSE_TRACE_FACILITY == 1 )

View File

@@ -1,417 +1,511 @@
/* /*
* FreeRTOS Kernel V10.4.1 * FreeRTOS Kernel V11.1.0
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * SPDX-License-Identifier: MIT
* this software and associated documentation files (the "Software"), to deal in *
* the Software without restriction, including without limitation the rights to * Permission is hereby granted, free of charge, to any person obtaining a copy of
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * this software and associated documentation files (the "Software"), to deal in
* the Software, and to permit persons to whom the Software is furnished to do so, * the Software without restriction, including without limitation the rights to
* subject to the following conditions: * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* * the Software, and to permit persons to whom the Software is furnished to do so,
* The above copyright notice and this permission notice shall be included in all * subject to the following conditions:
* copies or substantial portions of the Software. *
* * The above copyright notice and this permission notice shall be included in all
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * copies or substantial portions of the Software.
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS *
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* https://www.FreeRTOS.org * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* https://github.com/FreeRTOS *
* * https://www.FreeRTOS.org
*/ * https://github.com/FreeRTOS
*
/* */
* This is the list implementation used by the scheduler. While it is tailored
* heavily for the schedulers needs, it is also available for use by /*
* application code. * This is the list implementation used by the scheduler. While it is tailored
* * heavily for the schedulers needs, it is also available for use by
* list_ts can only store pointers to list_item_ts. Each ListItem_t contains a * application code.
* numeric value (xItemValue). Most of the time the lists are sorted in *
* descending item value order. * list_ts can only store pointers to list_item_ts. Each ListItem_t contains a
* * numeric value (xItemValue). Most of the time the lists are sorted in
* Lists are created already containing one list item. The value of this * ascending item value order.
* item is the maximum possible that can be stored, it is therefore always at *
* the end of the list and acts as a marker. The list member pxHead always * Lists are created already containing one list item. The value of this
* points to this marker - even though it is at the tail of the list. This * item is the maximum possible that can be stored, it is therefore always at
* is because the tail contains a wrap back pointer to the true head of * the end of the list and acts as a marker. The list member pxHead always
* the list. * points to this marker - even though it is at the tail of the list. This
* * is because the tail contains a wrap back pointer to the true head of
* In addition to it's value, each list item contains a pointer to the next * the list.
* item in the list (pxNext), a pointer to the list it is in (pxContainer) *
* and a pointer to back to the object that contains it. These later two * In addition to it's value, each list item contains a pointer to the next
* pointers are included for efficiency of list manipulation. There is * item in the list (pxNext), a pointer to the list it is in (pxContainer)
* effectively a two way link between the object containing the list item and * and a pointer to back to the object that contains it. These later two
* the list item itself. * pointers are included for efficiency of list manipulation. There is
* * effectively a two way link between the object containing the list item and
* * the list item itself.
* \page ListIntroduction List Implementation *
* \ingroup FreeRTOSIntro *
*/ * \page ListIntroduction List Implementation
* \ingroup FreeRTOSIntro
*/
#ifndef LIST_H
#define LIST_H
#ifndef LIST_H
#ifndef INC_FREERTOS_H #define LIST_H
#error "FreeRTOS.h must be included before list.h"
#endif #ifndef INC_FREERTOS_H
#error "FreeRTOS.h must be included before list.h"
/* #endif
* The list structure members are modified from within interrupts, and therefore
* by rights should be declared volatile. However, they are only modified in a /*
* functionally atomic way (within critical sections of with the scheduler * The list structure members are modified from within interrupts, and therefore
* suspended) and are either passed by reference into a function or indexed via * by rights should be declared volatile. However, they are only modified in a
* a volatile variable. Therefore, in all use cases tested so far, the volatile * functionally atomic way (within critical sections of with the scheduler
* qualifier can be omitted in order to provide a moderate performance * suspended) and are either passed by reference into a function or indexed via
* improvement without adversely affecting functional behaviour. The assembly * a volatile variable. Therefore, in all use cases tested so far, the volatile
* instructions generated by the IAR, ARM and GCC compilers when the respective * qualifier can be omitted in order to provide a moderate performance
* compiler's options were set for maximum optimisation has been inspected and * improvement without adversely affecting functional behaviour. The assembly
* deemed to be as intended. That said, as compiler technology advances, and * instructions generated by the IAR, ARM and GCC compilers when the respective
* especially if aggressive cross module optimisation is used (a use case that * compiler's options were set for maximum optimisation has been inspected and
* has not been exercised to any great extend) then it is feasible that the * deemed to be as intended. That said, as compiler technology advances, and
* volatile qualifier will be needed for correct optimisation. It is expected * especially if aggressive cross module optimisation is used (a use case that
* that a compiler removing essential code because, without the volatile * has not been exercised to any great extend) then it is feasible that the
* qualifier on the list structure members and with aggressive cross module * volatile qualifier will be needed for correct optimisation. It is expected
* optimisation, the compiler deemed the code unnecessary will result in * that a compiler removing essential code because, without the volatile
* complete and obvious failure of the scheduler. If this is ever experienced * qualifier on the list structure members and with aggressive cross module
* then the volatile qualifier can be inserted in the relevant places within the * optimisation, the compiler deemed the code unnecessary will result in
* list structures by simply defining configLIST_VOLATILE to volatile in * complete and obvious failure of the scheduler. If this is ever experienced
* FreeRTOSConfig.h (as per the example at the bottom of this comment block). * then the volatile qualifier can be inserted in the relevant places within the
* If configLIST_VOLATILE is not defined then the preprocessor directives below * list structures by simply defining configLIST_VOLATILE to volatile in
* will simply #define configLIST_VOLATILE away completely. * FreeRTOSConfig.h (as per the example at the bottom of this comment block).
* * If configLIST_VOLATILE is not defined then the preprocessor directives below
* To use volatile list structure members then add the following line to * will simply #define configLIST_VOLATILE away completely.
* FreeRTOSConfig.h (without the quotes): *
* "#define configLIST_VOLATILE volatile" * To use volatile list structure members then add the following line to
*/ * FreeRTOSConfig.h (without the quotes):
#ifndef configLIST_VOLATILE * "#define configLIST_VOLATILE volatile"
#define configLIST_VOLATILE */
#endif /* configSUPPORT_CROSS_MODULE_OPTIMISATION */ #ifndef configLIST_VOLATILE
#define configLIST_VOLATILE
/* *INDENT-OFF* */ #endif /* configSUPPORT_CROSS_MODULE_OPTIMISATION */
#ifdef __cplusplus
extern "C" { /* *INDENT-OFF* */
#endif #ifdef __cplusplus
/* *INDENT-ON* */ extern "C" {
#endif
/* Macros that can be used to place known values within the list structures, /* *INDENT-ON* */
* then check that the known values do not get corrupted during the execution of
* the application. These may catch the list data structures being overwritten in /* Macros that can be used to place known values within the list structures,
* memory. They will not catch data errors caused by incorrect configuration or * then check that the known values do not get corrupted during the execution of
* use of FreeRTOS.*/ * the application. These may catch the list data structures being overwritten in
#if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 0 ) * memory. They will not catch data errors caused by incorrect configuration or
/* Define the macros to do nothing. */ * use of FreeRTOS.*/
#define listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 0 )
#define listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE /* Define the macros to do nothing. */
#define listFIRST_LIST_INTEGRITY_CHECK_VALUE #define listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE
#define listSECOND_LIST_INTEGRITY_CHECK_VALUE #define listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE
#define listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ) #define listFIRST_LIST_INTEGRITY_CHECK_VALUE
#define listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ) #define listSECOND_LIST_INTEGRITY_CHECK_VALUE
#define listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList ) #define listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem )
#define listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList ) #define listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem )
#define listTEST_LIST_ITEM_INTEGRITY( pxItem ) #define listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList )
#define listTEST_LIST_INTEGRITY( pxList ) #define listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList )
#else /* if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 0 ) */ #define listTEST_LIST_ITEM_INTEGRITY( pxItem )
/* Define macros that add new members into the list structures. */ #define listTEST_LIST_INTEGRITY( pxList )
#define listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE TickType_t xListItemIntegrityValue1; #else /* if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 0 ) */
#define listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE TickType_t xListItemIntegrityValue2; /* Define macros that add new members into the list structures. */
#define listFIRST_LIST_INTEGRITY_CHECK_VALUE TickType_t xListIntegrityValue1; #define listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE TickType_t xListItemIntegrityValue1;
#define listSECOND_LIST_INTEGRITY_CHECK_VALUE TickType_t xListIntegrityValue2; #define listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE TickType_t xListItemIntegrityValue2;
#define listFIRST_LIST_INTEGRITY_CHECK_VALUE TickType_t xListIntegrityValue1;
/* Define macros that set the new structure members to known values. */ #define listSECOND_LIST_INTEGRITY_CHECK_VALUE TickType_t xListIntegrityValue2;
#define listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ) ( pxItem )->xListItemIntegrityValue1 = pdINTEGRITY_CHECK_VALUE
#define listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ) ( pxItem )->xListItemIntegrityValue2 = pdINTEGRITY_CHECK_VALUE /* Define macros that set the new structure members to known values. */
#define listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList ) ( pxList )->xListIntegrityValue1 = pdINTEGRITY_CHECK_VALUE #define listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ) ( pxItem )->xListItemIntegrityValue1 = pdINTEGRITY_CHECK_VALUE
#define listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList ) ( pxList )->xListIntegrityValue2 = pdINTEGRITY_CHECK_VALUE #define listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ) ( pxItem )->xListItemIntegrityValue2 = pdINTEGRITY_CHECK_VALUE
#define listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList ) ( pxList )->xListIntegrityValue1 = pdINTEGRITY_CHECK_VALUE
/* Define macros that will assert if one of the structure members does not #define listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList ) ( pxList )->xListIntegrityValue2 = pdINTEGRITY_CHECK_VALUE
* contain its expected value. */
#define listTEST_LIST_ITEM_INTEGRITY( pxItem ) configASSERT( ( ( pxItem )->xListItemIntegrityValue1 == pdINTEGRITY_CHECK_VALUE ) && ( ( pxItem )->xListItemIntegrityValue2 == pdINTEGRITY_CHECK_VALUE ) ) /* Define macros that will assert if one of the structure members does not
#define listTEST_LIST_INTEGRITY( pxList ) configASSERT( ( ( pxList )->xListIntegrityValue1 == pdINTEGRITY_CHECK_VALUE ) && ( ( pxList )->xListIntegrityValue2 == pdINTEGRITY_CHECK_VALUE ) ) * contain its expected value. */
#endif /* configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES */ #define listTEST_LIST_ITEM_INTEGRITY( pxItem ) configASSERT( ( ( pxItem )->xListItemIntegrityValue1 == pdINTEGRITY_CHECK_VALUE ) && ( ( pxItem )->xListItemIntegrityValue2 == pdINTEGRITY_CHECK_VALUE ) )
#define listTEST_LIST_INTEGRITY( pxList ) configASSERT( ( ( pxList )->xListIntegrityValue1 == pdINTEGRITY_CHECK_VALUE ) && ( ( pxList )->xListIntegrityValue2 == pdINTEGRITY_CHECK_VALUE ) )
#endif /* configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES */
/*
* Definition of the only type of object that a list can contain.
*/ /*
struct xLIST; * Definition of the only type of object that a list can contain.
struct xLIST_ITEM */
{ struct xLIST;
listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */ struct xLIST_ITEM
configLIST_VOLATILE TickType_t xItemValue; /*< The value being listed. In most cases this is used to sort the list in descending order. */ {
struct xLIST_ITEM * configLIST_VOLATILE pxNext; /*< Pointer to the next ListItem_t in the list. */ listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /**< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious; /*< Pointer to the previous ListItem_t in the list. */ configLIST_VOLATILE TickType_t xItemValue; /**< The value being listed. In most cases this is used to sort the list in ascending order. */
void * pvOwner; /*< Pointer to the object (normally a TCB) that contains the list item. There is therefore a two way link between the object containing the list item and the list item itself. */ struct xLIST_ITEM * configLIST_VOLATILE pxNext; /**< Pointer to the next ListItem_t in the list. */
struct xLIST * configLIST_VOLATILE pxContainer; /*< Pointer to the list in which this list item is placed (if any). */ struct xLIST_ITEM * configLIST_VOLATILE pxPrevious; /**< Pointer to the previous ListItem_t in the list. */
listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */ void * pvOwner; /**< Pointer to the object (normally a TCB) that contains the list item. There is therefore a two way link between the object containing the list item and the list item itself. */
}; struct xLIST * configLIST_VOLATILE pxContainer; /**< Pointer to the list in which this list item is placed (if any). */
typedef struct xLIST_ITEM ListItem_t; /* For some reason lint wants this as two separate definitions. */ listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE /**< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
};
struct xMINI_LIST_ITEM typedef struct xLIST_ITEM ListItem_t;
{
listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */ #if ( configUSE_MINI_LIST_ITEM == 1 )
configLIST_VOLATILE TickType_t xItemValue; struct xMINI_LIST_ITEM
struct xLIST_ITEM * configLIST_VOLATILE pxNext; {
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious; listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /**< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
}; configLIST_VOLATILE TickType_t xItemValue;
typedef struct xMINI_LIST_ITEM MiniListItem_t; struct xLIST_ITEM * configLIST_VOLATILE pxNext;
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;
/* };
* Definition of the type of queue used by the scheduler. typedef struct xMINI_LIST_ITEM MiniListItem_t;
*/ #else
typedef struct xLIST typedef struct xLIST_ITEM MiniListItem_t;
{ #endif
listFIRST_LIST_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
volatile UBaseType_t uxNumberOfItems; /*
ListItem_t * configLIST_VOLATILE pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */ * Definition of the type of queue used by the scheduler.
MiniListItem_t xListEnd; /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */ */
listSECOND_LIST_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */ typedef struct xLIST
} List_t; {
listFIRST_LIST_INTEGRITY_CHECK_VALUE /**< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
/* configLIST_VOLATILE UBaseType_t uxNumberOfItems;
* Access macro to set the owner of a list item. The owner of a list item ListItem_t * configLIST_VOLATILE pxIndex; /**< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */
* is the object (usually a TCB) that contains the list item. MiniListItem_t xListEnd; /**< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */
* listSECOND_LIST_INTEGRITY_CHECK_VALUE /**< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
* \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER } List_t;
* \ingroup LinkedList
*/ /*
#define listSET_LIST_ITEM_OWNER( pxListItem, pxOwner ) ( ( pxListItem )->pvOwner = ( void * ) ( pxOwner ) ) * Access macro to set the owner of a list item. The owner of a list item
* is the object (usually a TCB) that contains the list item.
/* *
* Access macro to get the owner of a list item. The owner of a list item * \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER
* is the object (usually a TCB) that contains the list item. * \ingroup LinkedList
* */
* \page listGET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER #define listSET_LIST_ITEM_OWNER( pxListItem, pxOwner ) ( ( pxListItem )->pvOwner = ( void * ) ( pxOwner ) )
* \ingroup LinkedList
*/ /*
#define listGET_LIST_ITEM_OWNER( pxListItem ) ( ( pxListItem )->pvOwner ) * Access macro to get the owner of a list item. The owner of a list item
* is the object (usually a TCB) that contains the list item.
/* *
* Access macro to set the value of the list item. In most cases the value is * \page listGET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER
* used to sort the list in descending order. * \ingroup LinkedList
* */
* \page listSET_LIST_ITEM_VALUE listSET_LIST_ITEM_VALUE #define listGET_LIST_ITEM_OWNER( pxListItem ) ( ( pxListItem )->pvOwner )
* \ingroup LinkedList
*/ /*
#define listSET_LIST_ITEM_VALUE( pxListItem, xValue ) ( ( pxListItem )->xItemValue = ( xValue ) ) * Access macro to set the value of the list item. In most cases the value is
* used to sort the list in ascending order.
/* *
* Access macro to retrieve the value of the list item. The value can * \page listSET_LIST_ITEM_VALUE listSET_LIST_ITEM_VALUE
* represent anything - for example the priority of a task, or the time at * \ingroup LinkedList
* which a task should be unblocked. */
* #define listSET_LIST_ITEM_VALUE( pxListItem, xValue ) ( ( pxListItem )->xItemValue = ( xValue ) )
* \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE
* \ingroup LinkedList /*
*/ * Access macro to retrieve the value of the list item. The value can
#define listGET_LIST_ITEM_VALUE( pxListItem ) ( ( pxListItem )->xItemValue ) * represent anything - for example the priority of a task, or the time at
* which a task should be unblocked.
/* *
* Access macro to retrieve the value of the list item at the head of a given * \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE
* list. * \ingroup LinkedList
* */
* \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE #define listGET_LIST_ITEM_VALUE( pxListItem ) ( ( pxListItem )->xItemValue )
* \ingroup LinkedList
*/ /*
#define listGET_ITEM_VALUE_OF_HEAD_ENTRY( pxList ) ( ( ( pxList )->xListEnd ).pxNext->xItemValue ) * Access macro to retrieve the value of the list item at the head of a given
* list.
/* *
* Return the list item at the head of the list. * \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE
* * \ingroup LinkedList
* \page listGET_HEAD_ENTRY listGET_HEAD_ENTRY */
* \ingroup LinkedList #define listGET_ITEM_VALUE_OF_HEAD_ENTRY( pxList ) ( ( ( pxList )->xListEnd ).pxNext->xItemValue )
*/
#define listGET_HEAD_ENTRY( pxList ) ( ( ( pxList )->xListEnd ).pxNext ) /*
* Return the list item at the head of the list.
/* *
* Return the next list item. * \page listGET_HEAD_ENTRY listGET_HEAD_ENTRY
* * \ingroup LinkedList
* \page listGET_NEXT listGET_NEXT */
* \ingroup LinkedList #define listGET_HEAD_ENTRY( pxList ) ( ( ( pxList )->xListEnd ).pxNext )
*/
#define listGET_NEXT( pxListItem ) ( ( pxListItem )->pxNext ) /*
* Return the next list item.
/* *
* Return the list item that marks the end of the list * \page listGET_NEXT listGET_NEXT
* * \ingroup LinkedList
* \page listGET_END_MARKER listGET_END_MARKER */
* \ingroup LinkedList #define listGET_NEXT( pxListItem ) ( ( pxListItem )->pxNext )
*/
#define listGET_END_MARKER( pxList ) ( ( ListItem_t const * ) ( &( ( pxList )->xListEnd ) ) ) /*
* Return the list item that marks the end of the list
/* *
* Access macro to determine if a list contains any items. The macro will * \page listGET_END_MARKER listGET_END_MARKER
* only have the value true if the list is empty. * \ingroup LinkedList
* */
* \page listLIST_IS_EMPTY listLIST_IS_EMPTY #define listGET_END_MARKER( pxList ) ( ( ListItem_t const * ) ( &( ( pxList )->xListEnd ) ) )
* \ingroup LinkedList
*/ /*
#define listLIST_IS_EMPTY( pxList ) ( ( ( pxList )->uxNumberOfItems == ( UBaseType_t ) 0 ) ? pdTRUE : pdFALSE ) * Access macro to determine if a list contains any items. The macro will
* only have the value true if the list is empty.
/* *
* Access macro to return the number of items in the list. * \page listLIST_IS_EMPTY listLIST_IS_EMPTY
*/ * \ingroup LinkedList
#define listCURRENT_LIST_LENGTH( pxList ) ( ( pxList )->uxNumberOfItems ) */
#define listLIST_IS_EMPTY( pxList ) ( ( ( pxList )->uxNumberOfItems == ( UBaseType_t ) 0 ) ? pdTRUE : pdFALSE )
/*
* Access function to obtain the owner of the next entry in a list. /*
* * Access macro to return the number of items in the list.
* The list member pxIndex is used to walk through a list. Calling */
* listGET_OWNER_OF_NEXT_ENTRY increments pxIndex to the next item in the list #define listCURRENT_LIST_LENGTH( pxList ) ( ( pxList )->uxNumberOfItems )
* and returns that entry's pxOwner parameter. Using multiple calls to this
* function it is therefore possible to move through every item contained in /*
* a list. * Access function to obtain the owner of the next entry in a list.
* *
* The pxOwner parameter of a list item is a pointer to the object that owns * The list member pxIndex is used to walk through a list. Calling
* the list item. In the scheduler this is normally a task control block. * listGET_OWNER_OF_NEXT_ENTRY increments pxIndex to the next item in the list
* The pxOwner parameter effectively creates a two way link between the list * and returns that entry's pxOwner parameter. Using multiple calls to this
* item and its owner. * function it is therefore possible to move through every item contained in
* * a list.
* @param pxTCB pxTCB is set to the address of the owner of the next list item. *
* @param pxList The list from which the next item owner is to be returned. * The pxOwner parameter of a list item is a pointer to the object that owns
* * the list item. In the scheduler this is normally a task control block.
* \page listGET_OWNER_OF_NEXT_ENTRY listGET_OWNER_OF_NEXT_ENTRY * The pxOwner parameter effectively creates a two way link between the list
* \ingroup LinkedList * item and its owner.
*/ *
#define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList ) \ * @param pxTCB pxTCB is set to the address of the owner of the next list item.
{ \ * @param pxList The list from which the next item owner is to be returned.
List_t * const pxConstList = ( pxList ); \ *
/* Increment the index to the next item and return the item, ensuring */ \ * \page listGET_OWNER_OF_NEXT_ENTRY listGET_OWNER_OF_NEXT_ENTRY
/* we don't return the marker used at the end of the list. */ \ * \ingroup LinkedList
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \ */
if( ( void * ) ( pxConstList )->pxIndex == ( void * ) &( ( pxConstList )->xListEnd ) ) \ #if ( configNUMBER_OF_CORES == 1 )
{ \ #define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList ) \
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \ do { \
} \ List_t * const pxConstList = ( pxList ); \
( pxTCB ) = ( pxConstList )->pxIndex->pvOwner; \ /* Increment the index to the next item and return the item, ensuring */ \
} /* we don't return the marker used at the end of the list. */ \
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
if( ( void * ) ( pxConstList )->pxIndex == ( void * ) &( ( pxConstList )->xListEnd ) ) \
/* { \
* Access function to obtain the owner of the first entry in a list. Lists ( pxConstList )->pxIndex = ( pxConstList )->xListEnd.pxNext; \
* are normally sorted in ascending item value order. } \
* ( pxTCB ) = ( pxConstList )->pxIndex->pvOwner; \
* This function returns the pxOwner member of the first item in the list. } while( 0 )
* The pxOwner parameter of a list item is a pointer to the object that owns #else /* #if ( configNUMBER_OF_CORES == 1 ) */
* the list item. In the scheduler this is normally a task control block.
* The pxOwner parameter effectively creates a two way link between the list /* This function is not required in SMP. FreeRTOS SMP scheduler doesn't use
* item and its owner. * pxIndex and it should always point to the xListEnd. Not defining this macro
* * here to prevent updating pxIndex.
* @param pxList The list from which the owner of the head item is to be */
* returned. #endif /* #if ( configNUMBER_OF_CORES == 1 ) */
*
* \page listGET_OWNER_OF_HEAD_ENTRY listGET_OWNER_OF_HEAD_ENTRY /*
* \ingroup LinkedList * Version of uxListRemove() that does not return a value. Provided as a slight
*/ * optimisation for xTaskIncrementTick() by being inline.
#define listGET_OWNER_OF_HEAD_ENTRY( pxList ) ( ( &( ( pxList )->xListEnd ) )->pxNext->pvOwner ) *
* Remove an item from a list. The list item has a pointer to the list that
/* * it is in, so only the list item need be passed into the function.
* Check to see if a list item is within a list. The list item maintains a *
* "container" pointer that points to the list it is in. All this macro does * @param uxListRemove The item to be removed. The item will remove itself from
* is check to see if the container and the list match. * the list pointed to by it's pxContainer parameter.
* *
* @param pxList The list we want to know if the list item is within. * @return The number of items that remain in the list after the list item has
* @param pxListItem The list item we want to know if is in the list. * been removed.
* @return pdTRUE if the list item is in the list, otherwise pdFALSE. *
*/ * \page listREMOVE_ITEM listREMOVE_ITEM
#define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( ( pxListItem )->pxContainer == ( pxList ) ) ? ( pdTRUE ) : ( pdFALSE ) ) * \ingroup LinkedList
*/
/* #define listREMOVE_ITEM( pxItemToRemove ) \
* Return the list a list item is contained within (referenced from). do { \
* /* The list item knows which list it is in. Obtain the list from the list \
* @param pxListItem The list item being queried. * item. */ \
* @return A pointer to the List_t object that references the pxListItem List_t * const pxList = ( pxItemToRemove )->pxContainer; \
*/ \
#define listLIST_ITEM_CONTAINER( pxListItem ) ( ( pxListItem )->pxContainer ) ( pxItemToRemove )->pxNext->pxPrevious = ( pxItemToRemove )->pxPrevious; \
( pxItemToRemove )->pxPrevious->pxNext = ( pxItemToRemove )->pxNext; \
/* /* Make sure the index is left pointing to a valid item. */ \
* This provides a crude means of knowing if a list has been initialised, as if( pxList->pxIndex == ( pxItemToRemove ) ) \
* pxList->xListEnd.xItemValue is set to portMAX_DELAY by the vListInitialise() { \
* function. pxList->pxIndex = ( pxItemToRemove )->pxPrevious; \
*/ } \
#define listLIST_IS_INITIALISED( pxList ) ( ( pxList )->xListEnd.xItemValue == portMAX_DELAY ) \
( pxItemToRemove )->pxContainer = NULL; \
/* ( ( pxList )->uxNumberOfItems ) = ( UBaseType_t ) ( ( ( pxList )->uxNumberOfItems ) - 1U ); \
* Must be called before a list is used! This initialises all the members } while( 0 )
* of the list structure and inserts the xListEnd item into the list as a
* marker to the back of the list. /*
* * Inline version of vListInsertEnd() to provide slight optimisation for
* @param pxList Pointer to the list being initialised. * xTaskIncrementTick().
* *
* \page vListInitialise vListInitialise * Insert a list item into a list. The item will be inserted in a position
* \ingroup LinkedList * such that it will be the last item within the list returned by multiple
*/ * calls to listGET_OWNER_OF_NEXT_ENTRY.
void vListInitialise( List_t * const pxList ) PRIVILEGED_FUNCTION; *
* The list member pxIndex is used to walk through a list. Calling
/* * listGET_OWNER_OF_NEXT_ENTRY increments pxIndex to the next item in the list.
* Must be called before a list item is used. This sets the list container to * Placing an item in a list using vListInsertEnd effectively places the item
* null so the item does not think that it is already contained in a list. * in the list position pointed to by pxIndex. This means that every other
* * item within the list will be returned by listGET_OWNER_OF_NEXT_ENTRY before
* @param pxItem Pointer to the list item being initialised. * the pxIndex parameter again points to the item being inserted.
* *
* \page vListInitialiseItem vListInitialiseItem * @param pxList The list into which the item is to be inserted.
* \ingroup LinkedList *
*/ * @param pxNewListItem The list item to be inserted into the list.
void vListInitialiseItem( ListItem_t * const pxItem ) PRIVILEGED_FUNCTION; *
* \page listINSERT_END listINSERT_END
/* * \ingroup LinkedList
* Insert a list item into a list. The item will be inserted into the list in */
* a position determined by its item value (descending item value order). #define listINSERT_END( pxList, pxNewListItem ) \
* do { \
* @param pxList The list into which the item is to be inserted. ListItem_t * const pxIndex = ( pxList )->pxIndex; \
* \
* @param pxNewListItem The item that is to be placed in the list. /* Only effective when configASSERT() is also defined, these tests may catch \
* * the list data structures being overwritten in memory. They will not catch \
* \page vListInsert vListInsert * data errors caused by incorrect configuration or use of FreeRTOS. */ \
* \ingroup LinkedList listTEST_LIST_INTEGRITY( ( pxList ) ); \
*/ listTEST_LIST_ITEM_INTEGRITY( ( pxNewListItem ) ); \
void vListInsert( List_t * const pxList, \
ListItem_t * const pxNewListItem ) PRIVILEGED_FUNCTION; /* Insert a new list item into ( pxList ), but rather than sort the list, \
* makes the new list item the last item to be removed by a call to \
/* * listGET_OWNER_OF_NEXT_ENTRY(). */ \
* Insert a list item into a list. The item will be inserted in a position ( pxNewListItem )->pxNext = pxIndex; \
* such that it will be the last item within the list returned by multiple ( pxNewListItem )->pxPrevious = pxIndex->pxPrevious; \
* calls to listGET_OWNER_OF_NEXT_ENTRY. \
* pxIndex->pxPrevious->pxNext = ( pxNewListItem ); \
* The list member pxIndex is used to walk through a list. Calling pxIndex->pxPrevious = ( pxNewListItem ); \
* listGET_OWNER_OF_NEXT_ENTRY increments pxIndex to the next item in the list. \
* Placing an item in a list using vListInsertEnd effectively places the item /* Remember which list the item is in. */ \
* in the list position pointed to by pxIndex. This means that every other ( pxNewListItem )->pxContainer = ( pxList ); \
* item within the list will be returned by listGET_OWNER_OF_NEXT_ENTRY before \
* the pxIndex parameter again points to the item being inserted. ( ( pxList )->uxNumberOfItems ) = ( UBaseType_t ) ( ( ( pxList )->uxNumberOfItems ) + 1U ); \
* } while( 0 )
* @param pxList The list into which the item is to be inserted.
* /*
* @param pxNewListItem The list item to be inserted into the list. * Access function to obtain the owner of the first entry in a list. Lists
* * are normally sorted in ascending item value order.
* \page vListInsertEnd vListInsertEnd *
* \ingroup LinkedList * This function returns the pxOwner member of the first item in the list.
*/ * The pxOwner parameter of a list item is a pointer to the object that owns
void vListInsertEnd( List_t * const pxList, * the list item. In the scheduler this is normally a task control block.
ListItem_t * const pxNewListItem ) PRIVILEGED_FUNCTION; * The pxOwner parameter effectively creates a two way link between the list
* item and its owner.
/* *
* Remove an item from a list. The list item has a pointer to the list that * @param pxList The list from which the owner of the head item is to be
* it is in, so only the list item need be passed into the function. * returned.
* *
* @param uxListRemove The item to be removed. The item will remove itself from * \page listGET_OWNER_OF_HEAD_ENTRY listGET_OWNER_OF_HEAD_ENTRY
* the list pointed to by it's pxContainer parameter. * \ingroup LinkedList
* */
* @return The number of items that remain in the list after the list item has #define listGET_OWNER_OF_HEAD_ENTRY( pxList ) ( ( &( ( pxList )->xListEnd ) )->pxNext->pvOwner )
* been removed.
* /*
* \page uxListRemove uxListRemove * Check to see if a list item is within a list. The list item maintains a
* \ingroup LinkedList * "container" pointer that points to the list it is in. All this macro does
*/ * is check to see if the container and the list match.
UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove ) PRIVILEGED_FUNCTION; *
* @param pxList The list we want to know if the list item is within.
/* *INDENT-OFF* */ * @param pxListItem The list item we want to know if is in the list.
#ifdef __cplusplus * @return pdTRUE if the list item is in the list, otherwise pdFALSE.
} */
#endif #define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( ( pxListItem )->pxContainer == ( pxList ) ) ? ( pdTRUE ) : ( pdFALSE ) )
/* *INDENT-ON* */
/*
#endif /* ifndef LIST_H */ * Return the list a list item is contained within (referenced from).
*
* @param pxListItem The list item being queried.
* @return A pointer to the List_t object that references the pxListItem
*/
#define listLIST_ITEM_CONTAINER( pxListItem ) ( ( pxListItem )->pxContainer )
/*
* This provides a crude means of knowing if a list has been initialised, as
* pxList->xListEnd.xItemValue is set to portMAX_DELAY by the vListInitialise()
* function.
*/
#define listLIST_IS_INITIALISED( pxList ) ( ( pxList )->xListEnd.xItemValue == portMAX_DELAY )
/*
* Must be called before a list is used! This initialises all the members
* of the list structure and inserts the xListEnd item into the list as a
* marker to the back of the list.
*
* @param pxList Pointer to the list being initialised.
*
* \page vListInitialise vListInitialise
* \ingroup LinkedList
*/
void vListInitialise( List_t * const pxList ) PRIVILEGED_FUNCTION;
/*
* Must be called before a list item is used. This sets the list container to
* null so the item does not think that it is already contained in a list.
*
* @param pxItem Pointer to the list item being initialised.
*
* \page vListInitialiseItem vListInitialiseItem
* \ingroup LinkedList
*/
void vListInitialiseItem( ListItem_t * const pxItem ) PRIVILEGED_FUNCTION;
/*
* Insert a list item into a list. The item will be inserted into the list in
* a position determined by its item value (ascending item value order).
*
* @param pxList The list into which the item is to be inserted.
*
* @param pxNewListItem The item that is to be placed in the list.
*
* \page vListInsert vListInsert
* \ingroup LinkedList
*/
void vListInsert( List_t * const pxList,
ListItem_t * const pxNewListItem ) PRIVILEGED_FUNCTION;
/*
* Insert a list item into a list. The item will be inserted in a position
* such that it will be the last item within the list returned by multiple
* calls to listGET_OWNER_OF_NEXT_ENTRY.
*
* The list member pxIndex is used to walk through a list. Calling
* listGET_OWNER_OF_NEXT_ENTRY increments pxIndex to the next item in the list.
* Placing an item in a list using vListInsertEnd effectively places the item
* in the list position pointed to by pxIndex. This means that every other
* item within the list will be returned by listGET_OWNER_OF_NEXT_ENTRY before
* the pxIndex parameter again points to the item being inserted.
*
* @param pxList The list into which the item is to be inserted.
*
* @param pxNewListItem The list item to be inserted into the list.
*
* \page vListInsertEnd vListInsertEnd
* \ingroup LinkedList
*/
void vListInsertEnd( List_t * const pxList,
ListItem_t * const pxNewListItem ) PRIVILEGED_FUNCTION;
/*
* Remove an item from a list. The list item has a pointer to the list that
* it is in, so only the list item need be passed into the function.
*
* @param uxListRemove The item to be removed. The item will remove itself from
* the list pointed to by it's pxContainer parameter.
*
* @return The number of items that remain in the list after the list item has
* been removed.
*
* \page uxListRemove uxListRemove
* \ingroup LinkedList
*/
UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove ) PRIVILEGED_FUNCTION;
/* *INDENT-OFF* */
#ifdef __cplusplus
}
#endif
/* *INDENT-ON* */
#endif /* ifndef LIST_H */

File diff suppressed because it is too large Load Diff

View File

@@ -1,263 +1,389 @@
/* /*
* FreeRTOS Kernel V10.4.1 * FreeRTOS Kernel V11.1.0
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * SPDX-License-Identifier: MIT
* this software and associated documentation files (the "Software"), to deal in *
* the Software without restriction, including without limitation the rights to * Permission is hereby granted, free of charge, to any person obtaining a copy of
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * this software and associated documentation files (the "Software"), to deal in
* the Software, and to permit persons to whom the Software is furnished to do so, * the Software without restriction, including without limitation the rights to
* subject to the following conditions: * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* * the Software, and to permit persons to whom the Software is furnished to do so,
* The above copyright notice and this permission notice shall be included in all * subject to the following conditions:
* copies or substantial portions of the Software. *
* * The above copyright notice and this permission notice shall be included in all
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * copies or substantial portions of the Software.
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS *
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* https://www.FreeRTOS.org * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* https://github.com/FreeRTOS *
* * https://www.FreeRTOS.org
*/ * https://github.com/FreeRTOS
*
/* */
* When the MPU is used the standard (non MPU) API functions are mapped to
* equivalents that start "MPU_", the prototypes for which are defined in this /*
* header files. This will cause the application code to call the MPU_ version * When the MPU is used the standard (non MPU) API functions are mapped to
* which wraps the non-MPU version with privilege promoting then demoting code, * equivalents that start "MPU_", the prototypes for which are defined in this
* so the kernel code always runs will full privileges. * header files. This will cause the application code to call the MPU_ version
*/ * which wraps the non-MPU version with privilege promoting then demoting code,
* so the kernel code always runs will full privileges.
*/
#ifndef MPU_PROTOTYPES_H
#define MPU_PROTOTYPES_H
#ifndef MPU_PROTOTYPES_H
/* MPU versions of tasks.h API functions. */ #define MPU_PROTOTYPES_H
BaseType_t MPU_xTaskCreate( TaskFunction_t pxTaskCode,
const char * const pcName, typedef struct xTaskGenericNotifyParams
const uint16_t usStackDepth, {
void * const pvParameters, TaskHandle_t xTaskToNotify;
UBaseType_t uxPriority, UBaseType_t uxIndexToNotify;
TaskHandle_t * const pxCreatedTask ) FREERTOS_SYSTEM_CALL; uint32_t ulValue;
TaskHandle_t MPU_xTaskCreateStatic( TaskFunction_t pxTaskCode, eNotifyAction eAction;
const char * const pcName, uint32_t * pulPreviousNotificationValue;
const uint32_t ulStackDepth, } xTaskGenericNotifyParams_t;
void * const pvParameters,
UBaseType_t uxPriority, typedef struct xTaskGenericNotifyWaitParams
StackType_t * const puxStackBuffer, {
StaticTask_t * const pxTaskBuffer ) FREERTOS_SYSTEM_CALL; UBaseType_t uxIndexToWaitOn;
BaseType_t MPU_xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition, uint32_t ulBitsToClearOnEntry;
TaskHandle_t * pxCreatedTask ) FREERTOS_SYSTEM_CALL; uint32_t ulBitsToClearOnExit;
BaseType_t MPU_xTaskCreateRestrictedStatic( const TaskParameters_t * const pxTaskDefinition, uint32_t * pulNotificationValue;
TaskHandle_t * pxCreatedTask ) FREERTOS_SYSTEM_CALL; TickType_t xTicksToWait;
void MPU_vTaskAllocateMPURegions( TaskHandle_t xTask, } xTaskGenericNotifyWaitParams_t;
const MemoryRegion_t * const pxRegions ) FREERTOS_SYSTEM_CALL;
void MPU_vTaskDelete( TaskHandle_t xTaskToDelete ) FREERTOS_SYSTEM_CALL; typedef struct xTimerGenericCommandFromTaskParams
void MPU_vTaskDelay( const TickType_t xTicksToDelay ) FREERTOS_SYSTEM_CALL; {
void MPU_vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, TimerHandle_t xTimer;
const TickType_t xTimeIncrement ) FREERTOS_SYSTEM_CALL; BaseType_t xCommandID;
BaseType_t MPU_xTaskAbortDelay( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; TickType_t xOptionalValue;
UBaseType_t MPU_uxTaskPriorityGet( const TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; BaseType_t * pxHigherPriorityTaskWoken;
eTaskState MPU_eTaskGetState( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; TickType_t xTicksToWait;
void MPU_vTaskGetInfo( TaskHandle_t xTask, } xTimerGenericCommandFromTaskParams_t;
TaskStatus_t * pxTaskStatus,
BaseType_t xGetFreeStackSpace, typedef struct xEventGroupWaitBitsParams
eTaskState eState ) FREERTOS_SYSTEM_CALL; {
void MPU_vTaskPrioritySet( TaskHandle_t xTask, EventGroupHandle_t xEventGroup;
UBaseType_t uxNewPriority ) FREERTOS_SYSTEM_CALL; EventBits_t uxBitsToWaitFor;
void MPU_vTaskSuspend( TaskHandle_t xTaskToSuspend ) FREERTOS_SYSTEM_CALL; BaseType_t xClearOnExit;
void MPU_vTaskResume( TaskHandle_t xTaskToResume ) FREERTOS_SYSTEM_CALL; BaseType_t xWaitForAllBits;
void MPU_vTaskStartScheduler( void ) FREERTOS_SYSTEM_CALL; TickType_t xTicksToWait;
void MPU_vTaskSuspendAll( void ) FREERTOS_SYSTEM_CALL; } xEventGroupWaitBitsParams_t;
BaseType_t MPU_xTaskResumeAll( void ) FREERTOS_SYSTEM_CALL;
TickType_t MPU_xTaskGetTickCount( void ) FREERTOS_SYSTEM_CALL; /* MPU versions of task.h API functions. */
UBaseType_t MPU_uxTaskGetNumberOfTasks( void ) FREERTOS_SYSTEM_CALL; void MPU_vTaskDelay( const TickType_t xTicksToDelay ) FREERTOS_SYSTEM_CALL;
char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xTaskDelayUntil( TickType_t * const pxPreviousWakeTime,
TaskHandle_t MPU_xTaskGetHandle( const char * pcNameToQuery ) FREERTOS_SYSTEM_CALL; const TickType_t xTimeIncrement ) FREERTOS_SYSTEM_CALL;
UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xTaskAbortDelay( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
configSTACK_DEPTH_TYPE MPU_uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; UBaseType_t MPU_uxTaskPriorityGet( const TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask, eTaskState MPU_eTaskGetState( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
TaskHookFunction_t pxHookFunction ) FREERTOS_SYSTEM_CALL; void MPU_vTaskGetInfo( TaskHandle_t xTask,
TaskHookFunction_t MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; TaskStatus_t * pxTaskStatus,
void MPU_vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet, BaseType_t xGetFreeStackSpace,
BaseType_t xIndex, eTaskState eState ) FREERTOS_SYSTEM_CALL;
void * pvValue ) FREERTOS_SYSTEM_CALL; void MPU_vTaskSuspend( TaskHandle_t xTaskToSuspend ) FREERTOS_SYSTEM_CALL;
void * MPU_pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, void MPU_vTaskResume( TaskHandle_t xTaskToResume ) FREERTOS_SYSTEM_CALL;
BaseType_t xIndex ) FREERTOS_SYSTEM_CALL; TickType_t MPU_xTaskGetTickCount( void ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask, UBaseType_t MPU_uxTaskGetNumberOfTasks( void ) FREERTOS_SYSTEM_CALL;
void * pvParameter ) FREERTOS_SYSTEM_CALL; UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
TaskHandle_t MPU_xTaskGetIdleTaskHandle( void ) FREERTOS_SYSTEM_CALL; configSTACK_DEPTH_TYPE MPU_uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
UBaseType_t MPU_uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask,
const UBaseType_t uxArraySize, TaskHookFunction_t pxHookFunction ) FREERTOS_SYSTEM_CALL;
uint32_t * const pulTotalRunTime ) FREERTOS_SYSTEM_CALL; TaskHookFunction_t MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
uint32_t MPU_ulTaskGetIdleRunTimeCounter( void ) FREERTOS_SYSTEM_CALL; void MPU_vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet,
void MPU_vTaskList( char * pcWriteBuffer ) FREERTOS_SYSTEM_CALL; BaseType_t xIndex,
void MPU_vTaskGetRunTimeStats( char * pcWriteBuffer ) FREERTOS_SYSTEM_CALL; void * pvValue ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, void * MPU_pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery,
UBaseType_t uxIndexToNotify, BaseType_t xIndex ) FREERTOS_SYSTEM_CALL;
uint32_t ulValue, TaskHandle_t MPU_xTaskGetIdleTaskHandle( void ) FREERTOS_SYSTEM_CALL;
eNotifyAction eAction, UBaseType_t MPU_uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray,
uint32_t * pulPreviousNotificationValue ) FREERTOS_SYSTEM_CALL; const UBaseType_t uxArraySize,
BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, configRUN_TIME_COUNTER_TYPE * const pulTotalRunTime ) FREERTOS_SYSTEM_CALL;
uint32_t ulBitsToClearOnEntry, configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetRunTimeCounter( const TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
uint32_t ulBitsToClearOnExit, configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetRunTimePercent( const TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
uint32_t * pulNotificationValue, configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetIdleRunTimeCounter( void ) FREERTOS_SYSTEM_CALL;
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetIdleRunTimePercent( void ) FREERTOS_SYSTEM_CALL;
uint32_t MPU_ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn, BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify,
BaseType_t xClearCountOnExit, UBaseType_t uxIndexToNotify,
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; uint32_t ulValue,
BaseType_t MPU_xTaskGenericNotifyStateClear( TaskHandle_t xTask, eNotifyAction eAction,
UBaseType_t uxIndexToClear ) FREERTOS_SYSTEM_CALL; uint32_t * pulPreviousNotificationValue ) FREERTOS_SYSTEM_CALL;
uint32_t MPU_ulTaskGenericNotifyValueClear( TaskHandle_t xTask, BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) FREERTOS_SYSTEM_CALL;
UBaseType_t uxIndexToClear, BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn,
uint32_t ulBitsToClear ) FREERTOS_SYSTEM_CALL; uint32_t ulBitsToClearOnEntry,
BaseType_t MPU_xTaskIncrementTick( void ) FREERTOS_SYSTEM_CALL; uint32_t ulBitsToClearOnExit,
TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void ) FREERTOS_SYSTEM_CALL; uint32_t * pulNotificationValue,
void MPU_vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) FREERTOS_SYSTEM_CALL; TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) FREERTOS_SYSTEM_CALL;
TickType_t * const pxTicksToWait ) FREERTOS_SYSTEM_CALL; uint32_t MPU_ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn,
void MPU_vTaskMissedYield( void ) FREERTOS_SYSTEM_CALL; BaseType_t xClearCountOnExit,
BaseType_t MPU_xTaskGetSchedulerState( void ) FREERTOS_SYSTEM_CALL; TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xTaskCatchUpTicks( TickType_t xTicksToCatchUp ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xTaskGenericNotifyStateClear( TaskHandle_t xTask,
UBaseType_t uxIndexToClear ) FREERTOS_SYSTEM_CALL;
/* MPU versions of queue.h API functions. */ uint32_t MPU_ulTaskGenericNotifyValueClear( TaskHandle_t xTask,
BaseType_t MPU_xQueueGenericSend( QueueHandle_t xQueue, UBaseType_t uxIndexToClear,
const void * const pvItemToQueue, uint32_t ulBitsToClear ) FREERTOS_SYSTEM_CALL;
TickType_t xTicksToWait, void MPU_vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) FREERTOS_SYSTEM_CALL;
const BaseType_t xCopyPosition ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut,
BaseType_t MPU_xQueueReceive( QueueHandle_t xQueue, TickType_t * const pxTicksToWait ) FREERTOS_SYSTEM_CALL;
void * const pvBuffer, TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void ) FREERTOS_SYSTEM_CALL;
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xTaskGetSchedulerState( void ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xQueuePeek( QueueHandle_t xQueue,
void * const pvBuffer, /* Privileged only wrappers for Task APIs. These are needed so that
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; * the application can use opaque handles maintained in mpu_wrappers.c
BaseType_t MPU_xQueueSemaphoreTake( QueueHandle_t xQueue, * with all the APIs. */
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xTaskCreate( TaskFunction_t pxTaskCode,
UBaseType_t MPU_uxQueueMessagesWaiting( const QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL; const char * const pcName,
UBaseType_t MPU_uxQueueSpacesAvailable( const QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL; const configSTACK_DEPTH_TYPE uxStackDepth,
void MPU_vQueueDelete( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL; void * const pvParameters,
QueueHandle_t MPU_xQueueCreateMutex( const uint8_t ucQueueType ) FREERTOS_SYSTEM_CALL; UBaseType_t uxPriority,
QueueHandle_t MPU_xQueueCreateMutexStatic( const uint8_t ucQueueType, TaskHandle_t * const pxCreatedTask ) PRIVILEGED_FUNCTION;
StaticQueue_t * pxStaticQueue ) FREERTOS_SYSTEM_CALL; TaskHandle_t MPU_xTaskCreateStatic( TaskFunction_t pxTaskCode,
QueueHandle_t MPU_xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount, const char * const pcName,
const UBaseType_t uxInitialCount ) FREERTOS_SYSTEM_CALL; const configSTACK_DEPTH_TYPE uxStackDepth,
QueueHandle_t MPU_xQueueCreateCountingSemaphoreStatic( const UBaseType_t uxMaxCount, void * const pvParameters,
const UBaseType_t uxInitialCount, UBaseType_t uxPriority,
StaticQueue_t * pxStaticQueue ) FREERTOS_SYSTEM_CALL; StackType_t * const puxStackBuffer,
TaskHandle_t MPU_xQueueGetMutexHolder( QueueHandle_t xSemaphore ) FREERTOS_SYSTEM_CALL; StaticTask_t * const pxTaskBuffer ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xQueueTakeMutexRecursive( QueueHandle_t xMutex, void MPU_vTaskDelete( TaskHandle_t xTaskToDelete ) PRIVILEGED_FUNCTION;
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; void MPU_vTaskPrioritySet( TaskHandle_t xTask,
BaseType_t MPU_xQueueGiveMutexRecursive( QueueHandle_t pxMutex ) FREERTOS_SYSTEM_CALL; UBaseType_t uxNewPriority ) PRIVILEGED_FUNCTION;
void MPU_vQueueAddToRegistry( QueueHandle_t xQueue, TaskHandle_t MPU_xTaskGetHandle( const char * pcNameToQuery ) PRIVILEGED_FUNCTION;
const char * pcName ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask,
void MPU_vQueueUnregisterQueue( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL; void * pvParameter ) PRIVILEGED_FUNCTION;
const char * MPU_pcQueueGetName( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL; char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION;
QueueHandle_t MPU_xQueueGenericCreate( const UBaseType_t uxQueueLength, BaseType_t MPU_xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition,
const UBaseType_t uxItemSize, TaskHandle_t * pxCreatedTask ) PRIVILEGED_FUNCTION;
const uint8_t ucQueueType ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xTaskCreateRestrictedStatic( const TaskParameters_t * const pxTaskDefinition,
QueueHandle_t MPU_xQueueGenericCreateStatic( const UBaseType_t uxQueueLength, TaskHandle_t * pxCreatedTask ) PRIVILEGED_FUNCTION;
const UBaseType_t uxItemSize, void MPU_vTaskAllocateMPURegions( TaskHandle_t xTaskToModify,
uint8_t * pucQueueStorage, const MemoryRegion_t * const xRegions ) PRIVILEGED_FUNCTION;
StaticQueue_t * pxStaticQueue, BaseType_t MPU_xTaskGetStaticBuffers( TaskHandle_t xTask,
const uint8_t ucQueueType ) FREERTOS_SYSTEM_CALL; StackType_t ** ppuxStackBuffer,
QueueSetHandle_t MPU_xQueueCreateSet( const UBaseType_t uxEventQueueLength ) FREERTOS_SYSTEM_CALL; StaticTask_t ** ppxTaskBuffer ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore, UBaseType_t MPU_uxTaskPriorityGetFromISR( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
QueueSetHandle_t xQueueSet ) FREERTOS_SYSTEM_CALL; UBaseType_t MPU_uxTaskBasePriorityGet( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore, UBaseType_t MPU_uxTaskBasePriorityGetFromISR( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
QueueSetHandle_t xQueueSet ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;
QueueSetMemberHandle_t MPU_xQueueSelectFromSet( QueueSetHandle_t xQueueSet, TaskHookFunction_t MPU_xTaskGetApplicationTaskTagFromISR( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
const TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify,
BaseType_t MPU_xQueueGenericReset( QueueHandle_t xQueue, UBaseType_t uxIndexToNotify,
BaseType_t xNewQueue ) FREERTOS_SYSTEM_CALL; uint32_t ulValue,
void MPU_vQueueSetQueueNumber( QueueHandle_t xQueue, eNotifyAction eAction,
UBaseType_t uxQueueNumber ) FREERTOS_SYSTEM_CALL; uint32_t * pulPreviousNotificationValue,
UBaseType_t MPU_uxQueueGetQueueNumber( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL; BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
uint8_t MPU_ucQueueGetQueueType( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL; void MPU_vTaskGenericNotifyGiveFromISR( TaskHandle_t xTaskToNotify,
UBaseType_t uxIndexToNotify,
/* MPU versions of timers.h API functions. */ BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
TimerHandle_t MPU_xTimerCreate( const char * const pcTimerName,
const TickType_t xTimerPeriodInTicks, /* MPU versions of queue.h API functions. */
const UBaseType_t uxAutoReload, BaseType_t MPU_xQueueGenericSend( QueueHandle_t xQueue,
void * const pvTimerID, const void * const pvItemToQueue,
TimerCallbackFunction_t pxCallbackFunction ) FREERTOS_SYSTEM_CALL; TickType_t xTicksToWait,
TimerHandle_t MPU_xTimerCreateStatic( const char * const pcTimerName, const BaseType_t xCopyPosition ) FREERTOS_SYSTEM_CALL;
const TickType_t xTimerPeriodInTicks, BaseType_t MPU_xQueueReceive( QueueHandle_t xQueue,
const UBaseType_t uxAutoReload, void * const pvBuffer,
void * const pvTimerID, TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
TimerCallbackFunction_t pxCallbackFunction, BaseType_t MPU_xQueuePeek( QueueHandle_t xQueue,
StaticTimer_t * pxTimerBuffer ) FREERTOS_SYSTEM_CALL; void * const pvBuffer,
void * MPU_pvTimerGetTimerID( const TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
void MPU_vTimerSetTimerID( TimerHandle_t xTimer, BaseType_t MPU_xQueueSemaphoreTake( QueueHandle_t xQueue,
void * pvNewID ) FREERTOS_SYSTEM_CALL; TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xTimerIsTimerActive( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; UBaseType_t MPU_uxQueueMessagesWaiting( const QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle( void ) FREERTOS_SYSTEM_CALL; UBaseType_t MPU_uxQueueSpacesAvailable( const QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xTimerPendFunctionCall( PendedFunction_t xFunctionToPend, TaskHandle_t MPU_xQueueGetMutexHolder( QueueHandle_t xSemaphore ) FREERTOS_SYSTEM_CALL;
void * pvParameter1, BaseType_t MPU_xQueueTakeMutexRecursive( QueueHandle_t xMutex,
uint32_t ulParameter2, TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xQueueGiveMutexRecursive( QueueHandle_t pxMutex ) FREERTOS_SYSTEM_CALL;
const char * MPU_pcTimerGetName( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; void MPU_vQueueAddToRegistry( QueueHandle_t xQueue,
void MPU_vTimerSetReloadMode( TimerHandle_t xTimer, const char * pcName ) FREERTOS_SYSTEM_CALL;
const UBaseType_t uxAutoReload ) FREERTOS_SYSTEM_CALL; void MPU_vQueueUnregisterQueue( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
UBaseType_t MPU_uxTimerGetReloadMode( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; const char * MPU_pcQueueGetName( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
TickType_t MPU_xTimerGetPeriod( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore,
TickType_t MPU_xTimerGetExpiryTime( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL; QueueSetHandle_t xQueueSet ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xTimerCreateTimerTask( void ) FREERTOS_SYSTEM_CALL; QueueSetMemberHandle_t MPU_xQueueSelectFromSet( QueueSetHandle_t xQueueSet,
BaseType_t MPU_xTimerGenericCommand( TimerHandle_t xTimer, const TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
const BaseType_t xCommandID, void MPU_vQueueSetQueueNumber( QueueHandle_t xQueue,
const TickType_t xOptionalValue, UBaseType_t uxQueueNumber ) FREERTOS_SYSTEM_CALL;
BaseType_t * const pxHigherPriorityTaskWoken, UBaseType_t MPU_uxQueueGetQueueNumber( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
const TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; uint8_t MPU_ucQueueGetQueueType( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
/* MPU versions of event_group.h API functions. */ /* Privileged only wrappers for Queue APIs. These are needed so that
EventGroupHandle_t MPU_xEventGroupCreate( void ) FREERTOS_SYSTEM_CALL; * the application can use opaque handles maintained in mpu_wrappers.c
EventGroupHandle_t MPU_xEventGroupCreateStatic( StaticEventGroup_t * pxEventGroupBuffer ) FREERTOS_SYSTEM_CALL; * with all the APIs. */
EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, void MPU_vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
const EventBits_t uxBitsToWaitFor, QueueHandle_t MPU_xQueueCreateMutex( const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
const BaseType_t xClearOnExit, QueueHandle_t MPU_xQueueCreateMutexStatic( const uint8_t ucQueueType,
const BaseType_t xWaitForAllBits, StaticQueue_t * pxStaticQueue ) PRIVILEGED_FUNCTION;
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; QueueHandle_t MPU_xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount,
EventBits_t MPU_xEventGroupClearBits( EventGroupHandle_t xEventGroup, const UBaseType_t uxInitialCount ) PRIVILEGED_FUNCTION;
const EventBits_t uxBitsToClear ) FREERTOS_SYSTEM_CALL; QueueHandle_t MPU_xQueueCreateCountingSemaphoreStatic( const UBaseType_t uxMaxCount,
EventBits_t MPU_xEventGroupSetBits( EventGroupHandle_t xEventGroup, const UBaseType_t uxInitialCount,
const EventBits_t uxBitsToSet ) FREERTOS_SYSTEM_CALL; StaticQueue_t * pxStaticQueue ) PRIVILEGED_FUNCTION;
EventBits_t MPU_xEventGroupSync( EventGroupHandle_t xEventGroup, QueueHandle_t MPU_xQueueGenericCreate( const UBaseType_t uxQueueLength,
const EventBits_t uxBitsToSet, const UBaseType_t uxItemSize,
const EventBits_t uxBitsToWaitFor, const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; QueueHandle_t MPU_xQueueGenericCreateStatic( const UBaseType_t uxQueueLength,
void MPU_vEventGroupDelete( EventGroupHandle_t xEventGroup ) FREERTOS_SYSTEM_CALL; const UBaseType_t uxItemSize,
UBaseType_t MPU_uxEventGroupGetNumber( void * xEventGroup ) FREERTOS_SYSTEM_CALL; uint8_t * pucQueueStorage,
StaticQueue_t * pxStaticQueue,
/* MPU versions of message/stream_buffer.h API functions. */ const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
size_t MPU_xStreamBufferSend( StreamBufferHandle_t xStreamBuffer, QueueSetHandle_t MPU_xQueueCreateSet( const UBaseType_t uxEventQueueLength ) PRIVILEGED_FUNCTION;
const void * pvTxData, BaseType_t MPU_xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore,
size_t xDataLengthBytes, QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xQueueGenericReset( QueueHandle_t xQueue,
size_t MPU_xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer, BaseType_t xNewQueue ) PRIVILEGED_FUNCTION;
void * pvRxData, BaseType_t MPU_xQueueGenericGetStaticBuffers( QueueHandle_t xQueue,
size_t xBufferLengthBytes, uint8_t ** ppucQueueStorage,
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL; StaticQueue_t ** ppxStaticQueue ) PRIVILEGED_FUNCTION;
size_t MPU_xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xQueueGenericSendFromISR( QueueHandle_t xQueue,
void MPU_vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL; const void * const pvItemToQueue,
BaseType_t MPU_xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL; BaseType_t * const pxHigherPriorityTaskWoken,
BaseType_t MPU_xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL; const BaseType_t xCopyPosition ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xQueueGiveFromISR( QueueHandle_t xQueue,
size_t MPU_xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL; BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
size_t MPU_xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xQueuePeekFromISR( QueueHandle_t xQueue,
BaseType_t MPU_xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer, void * const pvBuffer ) PRIVILEGED_FUNCTION;
size_t xTriggerLevel ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xQueueReceiveFromISR( QueueHandle_t xQueue,
StreamBufferHandle_t MPU_xStreamBufferGenericCreate( size_t xBufferSizeBytes, void * const pvBuffer,
size_t xTriggerLevelBytes, BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
BaseType_t xIsMessageBuffer ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xQueueIsQueueEmptyFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
StreamBufferHandle_t MPU_xStreamBufferGenericCreateStatic( size_t xBufferSizeBytes, BaseType_t MPU_xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
size_t xTriggerLevelBytes, UBaseType_t MPU_uxQueueMessagesWaitingFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
BaseType_t xIsMessageBuffer, TaskHandle_t MPU_xQueueGetMutexHolderFromISR( QueueHandle_t xSemaphore ) PRIVILEGED_FUNCTION;
uint8_t * const pucStreamBufferStorageArea, QueueSetMemberHandle_t MPU_xQueueSelectFromSetFromISR( QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
StaticStreamBuffer_t * const pxStaticStreamBuffer ) FREERTOS_SYSTEM_CALL;
/* MPU versions of timers.h API functions. */
void * MPU_pvTimerGetTimerID( const TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
void MPU_vTimerSetTimerID( TimerHandle_t xTimer,
#endif /* MPU_PROTOTYPES_H */ void * pvNewID ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xTimerIsTimerActive( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle( void ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer,
const BaseType_t xCommandID,
const TickType_t xOptionalValue,
BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) FREERTOS_SYSTEM_CALL;
const char * MPU_pcTimerGetName( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
void MPU_vTimerSetReloadMode( TimerHandle_t xTimer,
const BaseType_t uxAutoReload ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xTimerGetReloadMode( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
UBaseType_t MPU_uxTimerGetReloadMode( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
TickType_t MPU_xTimerGetPeriod( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
TickType_t MPU_xTimerGetExpiryTime( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
/* Privileged only wrappers for Timer APIs. These are needed so that
* the application can use opaque handles maintained in mpu_wrappers.c
* with all the APIs. */
TimerHandle_t MPU_xTimerCreate( const char * const pcTimerName,
const TickType_t xTimerPeriodInTicks,
const UBaseType_t uxAutoReload,
void * const pvTimerID,
TimerCallbackFunction_t pxCallbackFunction ) PRIVILEGED_FUNCTION;
TimerHandle_t MPU_xTimerCreateStatic( const char * const pcTimerName,
const TickType_t xTimerPeriodInTicks,
const UBaseType_t uxAutoReload,
void * const pvTimerID,
TimerCallbackFunction_t pxCallbackFunction,
StaticTimer_t * pxTimerBuffer ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xTimerGetStaticBuffer( TimerHandle_t xTimer,
StaticTimer_t ** ppxTimerBuffer ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xTimerGenericCommandFromISR( TimerHandle_t xTimer,
const BaseType_t xCommandID,
const TickType_t xOptionalValue,
BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
/* MPU versions of event_group.h API functions. */
EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
const EventBits_t uxBitsToWaitFor,
const BaseType_t xClearOnExit,
const BaseType_t xWaitForAllBits,
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) FREERTOS_SYSTEM_CALL;
EventBits_t MPU_xEventGroupClearBits( EventGroupHandle_t xEventGroup,
const EventBits_t uxBitsToClear ) FREERTOS_SYSTEM_CALL;
EventBits_t MPU_xEventGroupSetBits( EventGroupHandle_t xEventGroup,
const EventBits_t uxBitsToSet ) FREERTOS_SYSTEM_CALL;
EventBits_t MPU_xEventGroupSync( EventGroupHandle_t xEventGroup,
const EventBits_t uxBitsToSet,
const EventBits_t uxBitsToWaitFor,
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
#if ( configUSE_TRACE_FACILITY == 1 )
UBaseType_t MPU_uxEventGroupGetNumber( void * xEventGroup ) FREERTOS_SYSTEM_CALL;
void MPU_vEventGroupSetNumber( void * xEventGroup,
UBaseType_t uxEventGroupNumber ) FREERTOS_SYSTEM_CALL;
#endif /* ( configUSE_TRACE_FACILITY == 1 )*/
/* Privileged only wrappers for Event Group APIs. These are needed so that
* the application can use opaque handles maintained in mpu_wrappers.c
* with all the APIs. */
EventGroupHandle_t MPU_xEventGroupCreate( void ) PRIVILEGED_FUNCTION;
EventGroupHandle_t MPU_xEventGroupCreateStatic( StaticEventGroup_t * pxEventGroupBuffer ) PRIVILEGED_FUNCTION;
void MPU_vEventGroupDelete( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xEventGroupGetStaticBuffer( EventGroupHandle_t xEventGroup,
StaticEventGroup_t ** ppxEventGroupBuffer ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup,
const EventBits_t uxBitsToClear ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup,
const EventBits_t uxBitsToSet,
BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
EventBits_t MPU_xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;
/* MPU versions of message/stream_buffer.h API functions. */
size_t MPU_xStreamBufferSend( StreamBufferHandle_t xStreamBuffer,
const void * pvTxData,
size_t xDataLengthBytes,
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
size_t MPU_xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer,
void * pvRxData,
size_t xBufferLengthBytes,
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL;
size_t MPU_xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL;
size_t MPU_xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer,
size_t xTriggerLevel ) FREERTOS_SYSTEM_CALL;
size_t MPU_xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL;
/* Privileged only wrappers for Stream Buffer APIs. These are needed so that
* the application can use opaque handles maintained in mpu_wrappers.c
* with all the APIs. */
StreamBufferHandle_t MPU_xStreamBufferGenericCreate( size_t xBufferSizeBytes,
size_t xTriggerLevelBytes,
BaseType_t xStreamBufferType,
StreamBufferCallbackFunction_t pxSendCompletedCallback,
StreamBufferCallbackFunction_t pxReceiveCompletedCallback ) PRIVILEGED_FUNCTION;
StreamBufferHandle_t MPU_xStreamBufferGenericCreateStatic( size_t xBufferSizeBytes,
size_t xTriggerLevelBytes,
BaseType_t xStreamBufferType,
uint8_t * const pucStreamBufferStorageArea,
StaticStreamBuffer_t * const pxStaticStreamBuffer,
StreamBufferCallbackFunction_t pxSendCompletedCallback,
StreamBufferCallbackFunction_t pxReceiveCompletedCallback ) PRIVILEGED_FUNCTION;
void MPU_vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xStreamBufferGetStaticBuffers( StreamBufferHandle_t xStreamBuffers,
uint8_t * ppucStreamBufferStorageArea,
StaticStreamBuffer_t * ppxStaticStreamBuffer ) PRIVILEGED_FUNCTION;
size_t MPU_xStreamBufferSendFromISR( StreamBufferHandle_t xStreamBuffer,
const void * pvTxData,
size_t xDataLengthBytes,
BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
size_t MPU_xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer,
void * pvRxData,
size_t xBufferLengthBytes,
BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer,
BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xStreamBufferReceiveCompletedFromISR( StreamBufferHandle_t xStreamBuffer,
BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xStreamBufferResetFromISR( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
#endif /* MPU_PROTOTYPES_H */

View File

@@ -0,0 +1,105 @@
/*
* FreeRTOS Kernel V11.1.0
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
#ifndef MPU_SYSCALL_NUMBERS_H
#define MPU_SYSCALL_NUMBERS_H
/* Numbers assigned to various system calls. */
#define SYSTEM_CALL_xTaskGenericNotify 0
#define SYSTEM_CALL_xTaskGenericNotifyWait 1
#define SYSTEM_CALL_xTimerGenericCommandFromTask 2
#define SYSTEM_CALL_xEventGroupWaitBits 3
#define SYSTEM_CALL_xTaskDelayUntil 4
#define SYSTEM_CALL_xTaskAbortDelay 5
#define SYSTEM_CALL_vTaskDelay 6
#define SYSTEM_CALL_uxTaskPriorityGet 7
#define SYSTEM_CALL_eTaskGetState 8
#define SYSTEM_CALL_vTaskGetInfo 9
#define SYSTEM_CALL_xTaskGetIdleTaskHandle 10
#define SYSTEM_CALL_vTaskSuspend 11
#define SYSTEM_CALL_vTaskResume 12
#define SYSTEM_CALL_xTaskGetTickCount 13
#define SYSTEM_CALL_uxTaskGetNumberOfTasks 14
#define SYSTEM_CALL_ulTaskGetRunTimeCounter 15
#define SYSTEM_CALL_ulTaskGetRunTimePercent 16
#define SYSTEM_CALL_ulTaskGetIdleRunTimePercent 17
#define SYSTEM_CALL_ulTaskGetIdleRunTimeCounter 18
#define SYSTEM_CALL_vTaskSetApplicationTaskTag 19
#define SYSTEM_CALL_xTaskGetApplicationTaskTag 20
#define SYSTEM_CALL_vTaskSetThreadLocalStoragePointer 21
#define SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer 22
#define SYSTEM_CALL_uxTaskGetSystemState 23
#define SYSTEM_CALL_uxTaskGetStackHighWaterMark 24
#define SYSTEM_CALL_uxTaskGetStackHighWaterMark2 25
#define SYSTEM_CALL_xTaskGetCurrentTaskHandle 26
#define SYSTEM_CALL_xTaskGetSchedulerState 27
#define SYSTEM_CALL_vTaskSetTimeOutState 28
#define SYSTEM_CALL_xTaskCheckForTimeOut 29
#define SYSTEM_CALL_ulTaskGenericNotifyTake 30
#define SYSTEM_CALL_xTaskGenericNotifyStateClear 31
#define SYSTEM_CALL_ulTaskGenericNotifyValueClear 32
#define SYSTEM_CALL_xQueueGenericSend 33
#define SYSTEM_CALL_uxQueueMessagesWaiting 34
#define SYSTEM_CALL_uxQueueSpacesAvailable 35
#define SYSTEM_CALL_xQueueReceive 36
#define SYSTEM_CALL_xQueuePeek 37
#define SYSTEM_CALL_xQueueSemaphoreTake 38
#define SYSTEM_CALL_xQueueGetMutexHolder 39
#define SYSTEM_CALL_xQueueTakeMutexRecursive 40
#define SYSTEM_CALL_xQueueGiveMutexRecursive 41
#define SYSTEM_CALL_xQueueSelectFromSet 42
#define SYSTEM_CALL_xQueueAddToSet 43
#define SYSTEM_CALL_vQueueAddToRegistry 44
#define SYSTEM_CALL_vQueueUnregisterQueue 45
#define SYSTEM_CALL_pcQueueGetName 46
#define SYSTEM_CALL_pvTimerGetTimerID 47
#define SYSTEM_CALL_vTimerSetTimerID 48
#define SYSTEM_CALL_xTimerIsTimerActive 49
#define SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle 50
#define SYSTEM_CALL_pcTimerGetName 51
#define SYSTEM_CALL_vTimerSetReloadMode 52
#define SYSTEM_CALL_xTimerGetReloadMode 53
#define SYSTEM_CALL_uxTimerGetReloadMode 54
#define SYSTEM_CALL_xTimerGetPeriod 55
#define SYSTEM_CALL_xTimerGetExpiryTime 56
#define SYSTEM_CALL_xEventGroupClearBits 57
#define SYSTEM_CALL_xEventGroupSetBits 58
#define SYSTEM_CALL_xEventGroupSync 59
#define SYSTEM_CALL_uxEventGroupGetNumber 60
#define SYSTEM_CALL_vEventGroupSetNumber 61
#define SYSTEM_CALL_xStreamBufferSend 62
#define SYSTEM_CALL_xStreamBufferReceive 63
#define SYSTEM_CALL_xStreamBufferIsFull 64
#define SYSTEM_CALL_xStreamBufferIsEmpty 65
#define SYSTEM_CALL_xStreamBufferSpacesAvailable 66
#define SYSTEM_CALL_xStreamBufferBytesAvailable 67
#define SYSTEM_CALL_xStreamBufferSetTriggerLevel 68
#define SYSTEM_CALL_xStreamBufferNextMessageLengthBytes 69
#define NUM_SYSTEM_CALLS 70 /* Total number of system calls. */
#endif /* MPU_SYSCALL_NUMBERS_H */

View File

@@ -1,186 +1,276 @@
/* /*
* FreeRTOS Kernel V10.4.1 * FreeRTOS Kernel V11.1.0
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * SPDX-License-Identifier: MIT
* this software and associated documentation files (the "Software"), to deal in *
* the Software without restriction, including without limitation the rights to * Permission is hereby granted, free of charge, to any person obtaining a copy of
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * this software and associated documentation files (the "Software"), to deal in
* the Software, and to permit persons to whom the Software is furnished to do so, * the Software without restriction, including without limitation the rights to
* subject to the following conditions: * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* * the Software, and to permit persons to whom the Software is furnished to do so,
* The above copyright notice and this permission notice shall be included in all * subject to the following conditions:
* copies or substantial portions of the Software. *
* * The above copyright notice and this permission notice shall be included in all
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * copies or substantial portions of the Software.
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS *
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* https://www.FreeRTOS.org * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* https://github.com/FreeRTOS *
* * https://www.FreeRTOS.org
*/ * https://github.com/FreeRTOS
*
#ifndef MPU_WRAPPERS_H */
#define MPU_WRAPPERS_H
#ifndef MPU_WRAPPERS_H
/* This file redefines API functions to be called through a wrapper macro, but #define MPU_WRAPPERS_H
* only for ports that are using the MPU. */
#ifdef portUSING_MPU_WRAPPERS /* This file redefines API functions to be called through a wrapper macro, but
#error MPU * only for ports that are using the MPU. */
#if ( portUSING_MPU_WRAPPERS == 1 )
/* MPU_WRAPPERS_INCLUDED_FROM_API_FILE will be defined when this file is
* included from queue.c or task.c to prevent it from having an effect within /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE will be defined when this file is
* those files. */ * included from queue.c or task.c to prevent it from having an effect within
#ifndef MPU_WRAPPERS_INCLUDED_FROM_API_FILE * those files. */
#ifndef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
/*
* Map standard (non MPU) API functions to equivalents that start /*
* "MPU_". This will cause the application code to call the MPU_ * Map standard (non MPU) API functions to equivalents that start
* version, which wraps the non-MPU version with privilege promoting * "MPU_". This will cause the application code to call the MPU_
* then demoting code, so the kernel code always runs will full * version, which wraps the non-MPU version with privilege promoting
* privileges. * then demoting code, so the kernel code always runs will full
*/ * privileges.
*/
/* Map standard tasks.h API functions to the MPU equivalents. */
#define xTaskCreate MPU_xTaskCreate /* Map standard task.h API functions to the MPU equivalents. */
#define xTaskCreateStatic MPU_xTaskCreateStatic #define vTaskDelay MPU_vTaskDelay
#define xTaskCreateRestricted MPU_xTaskCreateRestricted #define xTaskDelayUntil MPU_xTaskDelayUntil
#define vTaskAllocateMPURegions MPU_vTaskAllocateMPURegions #define xTaskAbortDelay MPU_xTaskAbortDelay
#define vTaskDelete MPU_vTaskDelete #define uxTaskPriorityGet MPU_uxTaskPriorityGet
#define vTaskDelay MPU_vTaskDelay #define eTaskGetState MPU_eTaskGetState
#define vTaskDelayUntil MPU_vTaskDelayUntil #define vTaskGetInfo MPU_vTaskGetInfo
#define xTaskAbortDelay MPU_xTaskAbortDelay #define vTaskSuspend MPU_vTaskSuspend
#define uxTaskPriorityGet MPU_uxTaskPriorityGet #define vTaskResume MPU_vTaskResume
#define eTaskGetState MPU_eTaskGetState #define xTaskGetTickCount MPU_xTaskGetTickCount
#define vTaskGetInfo MPU_vTaskGetInfo #define uxTaskGetNumberOfTasks MPU_uxTaskGetNumberOfTasks
#define vTaskPrioritySet MPU_vTaskPrioritySet #define uxTaskGetStackHighWaterMark MPU_uxTaskGetStackHighWaterMark
#define vTaskSuspend MPU_vTaskSuspend #define uxTaskGetStackHighWaterMark2 MPU_uxTaskGetStackHighWaterMark2
#define vTaskResume MPU_vTaskResume #define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag
#define vTaskSuspendAll MPU_vTaskSuspendAll #define xTaskGetApplicationTaskTag MPU_xTaskGetApplicationTaskTag
#define xTaskResumeAll MPU_xTaskResumeAll #define vTaskSetThreadLocalStoragePointer MPU_vTaskSetThreadLocalStoragePointer
#define xTaskGetTickCount MPU_xTaskGetTickCount #define pvTaskGetThreadLocalStoragePointer MPU_pvTaskGetThreadLocalStoragePointer
#define uxTaskGetNumberOfTasks MPU_uxTaskGetNumberOfTasks #define xTaskGetIdleTaskHandle MPU_xTaskGetIdleTaskHandle
#define pcTaskGetName MPU_pcTaskGetName #define uxTaskGetSystemState MPU_uxTaskGetSystemState
#define xTaskGetHandle MPU_xTaskGetHandle #define ulTaskGetIdleRunTimeCounter MPU_ulTaskGetIdleRunTimeCounter
#define uxTaskGetStackHighWaterMark MPU_uxTaskGetStackHighWaterMark #define ulTaskGetIdleRunTimePercent MPU_ulTaskGetIdleRunTimePercent
#define uxTaskGetStackHighWaterMark2 MPU_uxTaskGetStackHighWaterMark2 #define xTaskGenericNotify MPU_xTaskGenericNotify
#define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag #define xTaskGenericNotifyWait MPU_xTaskGenericNotifyWait
#define xTaskGetApplicationTaskTag MPU_xTaskGetApplicationTaskTag #define ulTaskGenericNotifyTake MPU_ulTaskGenericNotifyTake
#define vTaskSetThreadLocalStoragePointer MPU_vTaskSetThreadLocalStoragePointer #define xTaskGenericNotifyStateClear MPU_xTaskGenericNotifyStateClear
#define pvTaskGetThreadLocalStoragePointer MPU_pvTaskGetThreadLocalStoragePointer #define ulTaskGenericNotifyValueClear MPU_ulTaskGenericNotifyValueClear
#define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook #define vTaskSetTimeOutState MPU_vTaskSetTimeOutState
#define xTaskGetIdleTaskHandle MPU_xTaskGetIdleTaskHandle #define xTaskCheckForTimeOut MPU_xTaskCheckForTimeOut
#define uxTaskGetSystemState MPU_uxTaskGetSystemState #define xTaskGetCurrentTaskHandle MPU_xTaskGetCurrentTaskHandle
#define vTaskList MPU_vTaskList #define xTaskGetSchedulerState MPU_xTaskGetSchedulerState
#define vTaskGetRunTimeStats MPU_vTaskGetRunTimeStats
#define ulTaskGetIdleRunTimeCounter MPU_ulTaskGetIdleRunTimeCounter #if ( configUSE_MPU_WRAPPERS_V1 == 0 )
#define xTaskGenericNotify MPU_xTaskGenericNotify #define ulTaskGetRunTimeCounter MPU_ulTaskGetRunTimeCounter
#define xTaskGenericNotifyWait MPU_xTaskGenericNotifyWait #define ulTaskGetRunTimePercent MPU_ulTaskGetRunTimePercent
#define ulTaskGenericNotifyTake MPU_ulTaskGenericNotifyTake #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */
#define xTaskGenericNotifyStateClear MPU_xTaskGenericNotifyStateClear
#define ulTaskGenericNotifyValueClear MPU_ulTaskGenericNotifyValueClear /* Privileged only wrappers for Task APIs. These are needed so that
#define xTaskCatchUpTicks MPU_xTaskCatchUpTicks * the application can use opaque handles maintained in mpu_wrappers.c
* with all the APIs. */
#define xTaskGetCurrentTaskHandle MPU_xTaskGetCurrentTaskHandle #define xTaskCreate MPU_xTaskCreate
#define vTaskSetTimeOutState MPU_vTaskSetTimeOutState #define xTaskCreateStatic MPU_xTaskCreateStatic
#define xTaskCheckForTimeOut MPU_xTaskCheckForTimeOut #define vTaskDelete MPU_vTaskDelete
#define xTaskGetSchedulerState MPU_xTaskGetSchedulerState #define vTaskPrioritySet MPU_vTaskPrioritySet
#define xTaskGetHandle MPU_xTaskGetHandle
/* Map standard queue.h API functions to the MPU equivalents. */ #define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook
#define xQueueGenericSend MPU_xQueueGenericSend
#define xQueueReceive MPU_xQueueReceive #if ( configUSE_MPU_WRAPPERS_V1 == 0 )
#define xQueuePeek MPU_xQueuePeek #define pcTaskGetName MPU_pcTaskGetName
#define xQueueSemaphoreTake MPU_xQueueSemaphoreTake #define xTaskCreateRestricted MPU_xTaskCreateRestricted
#define uxQueueMessagesWaiting MPU_uxQueueMessagesWaiting #define xTaskCreateRestrictedStatic MPU_xTaskCreateRestrictedStatic
#define uxQueueSpacesAvailable MPU_uxQueueSpacesAvailable #define vTaskAllocateMPURegions MPU_vTaskAllocateMPURegions
#define vQueueDelete MPU_vQueueDelete #define xTaskGetStaticBuffers MPU_xTaskGetStaticBuffers
#define xQueueCreateMutex MPU_xQueueCreateMutex #define uxTaskPriorityGetFromISR MPU_uxTaskPriorityGetFromISR
#define xQueueCreateMutexStatic MPU_xQueueCreateMutexStatic #define uxTaskBasePriorityGet MPU_uxTaskBasePriorityGet
#define xQueueCreateCountingSemaphore MPU_xQueueCreateCountingSemaphore #define uxTaskBasePriorityGetFromISR MPU_uxTaskBasePriorityGetFromISR
#define xQueueCreateCountingSemaphoreStatic MPU_xQueueCreateCountingSemaphoreStatic #define xTaskResumeFromISR MPU_xTaskResumeFromISR
#define xQueueGetMutexHolder MPU_xQueueGetMutexHolder #define xTaskGetApplicationTaskTagFromISR MPU_xTaskGetApplicationTaskTagFromISR
#define xQueueTakeMutexRecursive MPU_xQueueTakeMutexRecursive #define xTaskGenericNotifyFromISR MPU_xTaskGenericNotifyFromISR
#define xQueueGiveMutexRecursive MPU_xQueueGiveMutexRecursive #define vTaskGenericNotifyGiveFromISR MPU_vTaskGenericNotifyGiveFromISR
#define xQueueGenericCreate MPU_xQueueGenericCreate #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */
#define xQueueGenericCreateStatic MPU_xQueueGenericCreateStatic
#define xQueueCreateSet MPU_xQueueCreateSet /* Map standard queue.h API functions to the MPU equivalents. */
#define xQueueAddToSet MPU_xQueueAddToSet #define xQueueGenericSend MPU_xQueueGenericSend
#define xQueueRemoveFromSet MPU_xQueueRemoveFromSet #define xQueueReceive MPU_xQueueReceive
#define xQueueSelectFromSet MPU_xQueueSelectFromSet #define xQueuePeek MPU_xQueuePeek
#define xQueueGenericReset MPU_xQueueGenericReset #define xQueueSemaphoreTake MPU_xQueueSemaphoreTake
#define uxQueueMessagesWaiting MPU_uxQueueMessagesWaiting
#if (configQUEUE_REGISTRY_SIZE > 0) #define uxQueueSpacesAvailable MPU_uxQueueSpacesAvailable
#define vQueueAddToRegistry MPU_vQueueAddToRegistry #define xQueueGetMutexHolder MPU_xQueueGetMutexHolder
#define vQueueUnregisterQueue MPU_vQueueUnregisterQueue #define xQueueTakeMutexRecursive MPU_xQueueTakeMutexRecursive
#define pcQueueGetName MPU_pcQueueGetName #define xQueueGiveMutexRecursive MPU_xQueueGiveMutexRecursive
#endif #define xQueueAddToSet MPU_xQueueAddToSet
#define xQueueSelectFromSet MPU_xQueueSelectFromSet
/* Map standard timer.h API functions to the MPU equivalents. */
#define xTimerCreate MPU_xTimerCreate #if ( configQUEUE_REGISTRY_SIZE > 0 )
#define xTimerCreateStatic MPU_xTimerCreateStatic #define vQueueAddToRegistry MPU_vQueueAddToRegistry
#define pvTimerGetTimerID MPU_pvTimerGetTimerID #define vQueueUnregisterQueue MPU_vQueueUnregisterQueue
#define vTimerSetTimerID MPU_vTimerSetTimerID #define pcQueueGetName MPU_pcQueueGetName
#define xTimerIsTimerActive MPU_xTimerIsTimerActive #endif /* #if ( configQUEUE_REGISTRY_SIZE > 0 ) */
#define xTimerGetTimerDaemonTaskHandle MPU_xTimerGetTimerDaemonTaskHandle
#define xTimerPendFunctionCall MPU_xTimerPendFunctionCall /* Privileged only wrappers for Queue APIs. These are needed so that
#define pcTimerGetName MPU_pcTimerGetName * the application can use opaque handles maintained in mpu_wrappers.c
#define vTimerSetReloadMode MPU_vTimerSetReloadMode * with all the APIs. */
#define uxTimerGetReloadMode MPU_uxTimerGetReloadMode #define vQueueDelete MPU_vQueueDelete
#define xTimerGetPeriod MPU_xTimerGetPeriod #define xQueueCreateMutex MPU_xQueueCreateMutex
#define xTimerGetExpiryTime MPU_xTimerGetExpiryTime #define xQueueCreateMutexStatic MPU_xQueueCreateMutexStatic
#define xTimerGenericCommand MPU_xTimerGenericCommand #define xQueueCreateCountingSemaphore MPU_xQueueCreateCountingSemaphore
#define xQueueCreateCountingSemaphoreStatic MPU_xQueueCreateCountingSemaphoreStatic
/* Map standard event_group.h API functions to the MPU equivalents. */ #define xQueueGenericCreate MPU_xQueueGenericCreate
#define xEventGroupCreate MPU_xEventGroupCreate #define xQueueGenericCreateStatic MPU_xQueueGenericCreateStatic
#define xEventGroupCreateStatic MPU_xEventGroupCreateStatic #define xQueueGenericReset MPU_xQueueGenericReset
#define xEventGroupWaitBits MPU_xEventGroupWaitBits #define xQueueCreateSet MPU_xQueueCreateSet
#define xEventGroupClearBits MPU_xEventGroupClearBits #define xQueueRemoveFromSet MPU_xQueueRemoveFromSet
#define xEventGroupSetBits MPU_xEventGroupSetBits
#define xEventGroupSync MPU_xEventGroupSync #if ( configUSE_MPU_WRAPPERS_V1 == 0 )
#define vEventGroupDelete MPU_vEventGroupDelete #define xQueueGenericGetStaticBuffers MPU_xQueueGenericGetStaticBuffers
#define xQueueGenericSendFromISR MPU_xQueueGenericSendFromISR
/* Map standard message/stream_buffer.h API functions to the MPU #define xQueueGiveFromISR MPU_xQueueGiveFromISR
* equivalents. */ #define xQueuePeekFromISR MPU_xQueuePeekFromISR
#define xStreamBufferSend MPU_xStreamBufferSend #define xQueueReceiveFromISR MPU_xQueueReceiveFromISR
#define xStreamBufferReceive MPU_xStreamBufferReceive #define xQueueIsQueueEmptyFromISR MPU_xQueueIsQueueEmptyFromISR
#define xStreamBufferNextMessageLengthBytes MPU_xStreamBufferNextMessageLengthBytes #define xQueueIsQueueFullFromISR MPU_xQueueIsQueueFullFromISR
#define vStreamBufferDelete MPU_vStreamBufferDelete #define uxQueueMessagesWaitingFromISR MPU_uxQueueMessagesWaitingFromISR
#define xStreamBufferIsFull MPU_xStreamBufferIsFull #define xQueueGetMutexHolderFromISR MPU_xQueueGetMutexHolderFromISR
#define xStreamBufferIsEmpty MPU_xStreamBufferIsEmpty #define xQueueSelectFromSetFromISR MPU_xQueueSelectFromSetFromISR
#define xStreamBufferReset MPU_xStreamBufferReset #endif /* if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */
#define xStreamBufferSpacesAvailable MPU_xStreamBufferSpacesAvailable
#define xStreamBufferBytesAvailable MPU_xStreamBufferBytesAvailable /* Map standard timer.h API functions to the MPU equivalents. */
#define xStreamBufferSetTriggerLevel MPU_xStreamBufferSetTriggerLevel #define pvTimerGetTimerID MPU_pvTimerGetTimerID
#define xStreamBufferGenericCreate MPU_xStreamBufferGenericCreate #define vTimerSetTimerID MPU_vTimerSetTimerID
#define xStreamBufferGenericCreateStatic MPU_xStreamBufferGenericCreateStatic #define xTimerIsTimerActive MPU_xTimerIsTimerActive
#define xTimerGetTimerDaemonTaskHandle MPU_xTimerGetTimerDaemonTaskHandle
/* Remove the privileged function macro, but keep the PRIVILEGED_DATA #define xTimerGenericCommandFromTask MPU_xTimerGenericCommandFromTask
* macro so applications can place data in privileged access sections #define pcTimerGetName MPU_pcTimerGetName
* (useful when using statically allocated objects). */ #define vTimerSetReloadMode MPU_vTimerSetReloadMode
#define PRIVILEGED_FUNCTION #define uxTimerGetReloadMode MPU_uxTimerGetReloadMode
#define PRIVILEGED_DATA __attribute__((section("privileged_data"))) #define xTimerGetPeriod MPU_xTimerGetPeriod
#define FREERTOS_SYSTEM_CALL #define xTimerGetExpiryTime MPU_xTimerGetExpiryTime
#else /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */ /* Privileged only wrappers for Timer APIs. These are needed so that
* the application can use opaque handles maintained in mpu_wrappers.c
/* Ensure API functions go in the privileged execution section. */ * with all the APIs. */
#define PRIVILEGED_FUNCTION __attribute__((section("privileged_functions"))) #if ( configUSE_MPU_WRAPPERS_V1 == 0 )
#define PRIVILEGED_DATA __attribute__((section("privileged_data"))) #define xTimerGetReloadMode MPU_xTimerGetReloadMode
#define FREERTOS_SYSTEM_CALL __attribute__((section("freertos_system_calls"))) #define xTimerCreate MPU_xTimerCreate
#define xTimerCreateStatic MPU_xTimerCreateStatic
#endif /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */ #define xTimerGetStaticBuffer MPU_xTimerGetStaticBuffer
#define xTimerGenericCommandFromISR MPU_xTimerGenericCommandFromISR
#else /* portUSING_MPU_WRAPPERS */ #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */
#define PRIVILEGED_FUNCTION /* Map standard event_group.h API functions to the MPU equivalents. */
#define PRIVILEGED_DATA #define xEventGroupWaitBits MPU_xEventGroupWaitBits
#define FREERTOS_SYSTEM_CALL #define xEventGroupClearBits MPU_xEventGroupClearBits
#define portUSING_MPU_WRAPPERS 0 #define xEventGroupSetBits MPU_xEventGroupSetBits
#define xEventGroupSync MPU_xEventGroupSync
#endif /* portUSING_MPU_WRAPPERS */
#if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) )
#endif /* MPU_WRAPPERS_H */ #define uxEventGroupGetNumber MPU_uxEventGroupGetNumber
#define vEventGroupSetNumber MPU_vEventGroupSetNumber
#endif /* #if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) */
/* Privileged only wrappers for Event Group APIs. These are needed so that
* the application can use opaque handles maintained in mpu_wrappers.c
* with all the APIs. */
#define xEventGroupCreate MPU_xEventGroupCreate
#define xEventGroupCreateStatic MPU_xEventGroupCreateStatic
#define vEventGroupDelete MPU_vEventGroupDelete
#if ( configUSE_MPU_WRAPPERS_V1 == 0 )
#define xEventGroupGetStaticBuffer MPU_xEventGroupGetStaticBuffer
#define xEventGroupClearBitsFromISR MPU_xEventGroupClearBitsFromISR
#define xEventGroupSetBitsFromISR MPU_xEventGroupSetBitsFromISR
#define xEventGroupGetBitsFromISR MPU_xEventGroupGetBitsFromISR
#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */
/* Map standard message/stream_buffer.h API functions to the MPU
* equivalents. */
#define xStreamBufferSend MPU_xStreamBufferSend
#define xStreamBufferReceive MPU_xStreamBufferReceive
#define xStreamBufferIsFull MPU_xStreamBufferIsFull
#define xStreamBufferIsEmpty MPU_xStreamBufferIsEmpty
#define xStreamBufferSpacesAvailable MPU_xStreamBufferSpacesAvailable
#define xStreamBufferBytesAvailable MPU_xStreamBufferBytesAvailable
#define xStreamBufferSetTriggerLevel MPU_xStreamBufferSetTriggerLevel
#define xStreamBufferNextMessageLengthBytes MPU_xStreamBufferNextMessageLengthBytes
/* Privileged only wrappers for Stream Buffer APIs. These are needed so that
* the application can use opaque handles maintained in mpu_wrappers.c
* with all the APIs. */
#define xStreamBufferGenericCreate MPU_xStreamBufferGenericCreate
#define xStreamBufferGenericCreateStatic MPU_xStreamBufferGenericCreateStatic
#define vStreamBufferDelete MPU_vStreamBufferDelete
#define xStreamBufferReset MPU_xStreamBufferReset
#if ( configUSE_MPU_WRAPPERS_V1 == 0 )
#define xStreamBufferGetStaticBuffers MPU_xStreamBufferGetStaticBuffers
#define xStreamBufferSendFromISR MPU_xStreamBufferSendFromISR
#define xStreamBufferReceiveFromISR MPU_xStreamBufferReceiveFromISR
#define xStreamBufferSendCompletedFromISR MPU_xStreamBufferSendCompletedFromISR
#define xStreamBufferReceiveCompletedFromISR MPU_xStreamBufferReceiveCompletedFromISR
#define xStreamBufferResetFromISR MPU_xStreamBufferResetFromISR
#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */
#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) )
#define vGrantAccessToTask( xTask, xTaskToGrantAccess ) vGrantAccessToKernelObject( ( xTask ), ( int32_t ) ( xTaskToGrantAccess ) )
#define vRevokeAccessToTask( xTask, xTaskToRevokeAccess ) vRevokeAccessToKernelObject( ( xTask ), ( int32_t ) ( xTaskToRevokeAccess ) )
#define vGrantAccessToSemaphore( xTask, xSemaphoreToGrantAccess ) vGrantAccessToKernelObject( ( xTask ), ( int32_t ) ( xSemaphoreToGrantAccess ) )
#define vRevokeAccessToSemaphore( xTask, xSemaphoreToRevokeAccess ) vRevokeAccessToKernelObject( ( xTask ), ( int32_t ) ( xSemaphoreToRevokeAccess ) )
#define vGrantAccessToQueue( xTask, xQueueToGrantAccess ) vGrantAccessToKernelObject( ( xTask ), ( int32_t ) ( xQueueToGrantAccess ) )
#define vRevokeAccessToQueue( xTask, xQueueToRevokeAccess ) vRevokeAccessToKernelObject( ( xTask ), ( int32_t ) ( xQueueToRevokeAccess ) )
#define vGrantAccessToQueueSet( xTask, xQueueSetToGrantAccess ) vGrantAccessToKernelObject( ( xTask ), ( int32_t ) ( xQueueSetToGrantAccess ) )
#define vRevokeAccessToQueueSet( xTask, xQueueSetToRevokeAccess ) vRevokeAccessToKernelObject( ( xTask ), ( int32_t ) ( xQueueSetToRevokeAccess ) )
#define vGrantAccessToEventGroup( xTask, xEventGroupToGrantAccess ) vGrantAccessToKernelObject( ( xTask ), ( int32_t ) ( xEventGroupToGrantAccess ) )
#define vRevokeAccessToEventGroup( xTask, xEventGroupToRevokeAccess ) vRevokeAccessToKernelObject( ( xTask ), ( int32_t ) ( xEventGroupToRevokeAccess ) )
#define vGrantAccessToStreamBuffer( xTask, xStreamBufferToGrantAccess ) vGrantAccessToKernelObject( ( xTask ), ( int32_t ) ( xStreamBufferToGrantAccess ) )
#define vRevokeAccessToStreamBuffer( xTask, xStreamBufferToRevokeAccess ) vRevokeAccessToKernelObject( ( xTask ), ( int32_t ) ( xStreamBufferToRevokeAccess ) )
#define vGrantAccessToMessageBuffer( xTask, xMessageBufferToGrantAccess ) vGrantAccessToKernelObject( ( xTask ), ( int32_t ) ( xMessageBufferToGrantAccess ) )
#define vRevokeAccessToMessageBuffer( xTask, xMessageBufferToRevokeAccess ) vRevokeAccessToKernelObject( ( xTask ), ( int32_t ) ( xMessageBufferToRevokeAccess ) )
#define vGrantAccessToTimer( xTask, xTimerToGrantAccess ) vGrantAccessToKernelObject( ( xTask ), ( int32_t ) ( xTimerToGrantAccess ) )
#define vRevokeAccessToTimer( xTask, xTimerToRevokeAccess ) vRevokeAccessToKernelObject( ( xTask ), ( int32_t ) ( xTimerToRevokeAccess ) )
#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */
#endif /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
#define PRIVILEGED_FUNCTION __attribute__( ( section( "privileged_functions" ) ) )
#define PRIVILEGED_DATA __attribute__( ( section( "privileged_data" ) ) )
#define FREERTOS_SYSTEM_CALL __attribute__( ( section( "freertos_system_calls" ) ) )
#else /* portUSING_MPU_WRAPPERS */
#define PRIVILEGED_FUNCTION
#define PRIVILEGED_DATA
#define FREERTOS_SYSTEM_CALL
#endif /* portUSING_MPU_WRAPPERS */
#endif /* MPU_WRAPPERS_H */

View File

@@ -0,0 +1,62 @@
/*
* FreeRTOS Kernel V11.1.0
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
#ifndef INC_NEWLIB_FREERTOS_H
#define INC_NEWLIB_FREERTOS_H
/* Note Newlib support has been included by popular demand, but is not
* used by the FreeRTOS maintainers themselves. FreeRTOS is not
* responsible for resulting newlib operation. User must be familiar with
* newlib and must provide system-wide implementations of the necessary
* stubs. Be warned that (at the time of writing) the current newlib design
* implements a system-wide malloc() that must be provided with locks.
*
* See the third party link http://www.nadler.com/embedded/newlibAndFreeRTOS.html
* for additional information. */
#include <reent.h>
#define configUSE_C_RUNTIME_TLS_SUPPORT 1
#ifndef configTLS_BLOCK_TYPE
#define configTLS_BLOCK_TYPE struct _reent
#endif
#ifndef configINIT_TLS_BLOCK
#define configINIT_TLS_BLOCK( xTLSBlock, pxTopOfStack ) _REENT_INIT_PTR( &( xTLSBlock ) )
#endif
#ifndef configSET_TLS_BLOCK
#define configSET_TLS_BLOCK( xTLSBlock ) ( _impure_ptr = &( xTLSBlock ) )
#endif
#ifndef configDEINIT_TLS_BLOCK
#define configDEINIT_TLS_BLOCK( xTLSBlock ) _reclaim_reent( &( xTLSBlock ) )
#endif
#endif /* INC_NEWLIB_FREERTOS_H */

View File

@@ -0,0 +1,91 @@
/*
* FreeRTOS Kernel V11.1.0
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
#ifndef INC_PICOLIBC_FREERTOS_H
#define INC_PICOLIBC_FREERTOS_H
/* Use picolibc TLS support to allocate space for __thread variables,
* initialize them at thread creation and set the TLS context at
* thread switch time.
*
* See the picolibc TLS docs:
* https://github.com/picolibc/picolibc/blob/main/doc/tls.md
* for additional information. */
#include <picotls.h>
#define configUSE_C_RUNTIME_TLS_SUPPORT 1
#define configTLS_BLOCK_TYPE void *
#define picolibcTLS_SIZE ( ( portPOINTER_SIZE_TYPE ) _tls_size() )
#define picolibcSTACK_ALIGNMENT_MASK ( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK )
#if __PICOLIBC_MAJOR__ > 1 || __PICOLIBC_MINOR__ >= 8
/* Picolibc 1.8 and newer have explicit alignment values provided
* by the _tls_align() inline */
#define picolibcTLS_ALIGNMENT_MASK ( ( portPOINTER_SIZE_TYPE ) ( _tls_align() - 1 ) )
#else
/* For older Picolibc versions, use the general port alignment value */
#define picolibcTLS_ALIGNMENT_MASK ( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK )
#endif
/* Allocate thread local storage block off the end of the
* stack. The picolibcTLS_SIZE macro returns the size (in
* bytes) of the total TLS area used by the application.
* Calculate the top of stack address. */
#if ( portSTACK_GROWTH < 0 )
#define configINIT_TLS_BLOCK( xTLSBlock, pxTopOfStack ) \
do { \
xTLSBlock = ( void * ) ( ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) - \
picolibcTLS_SIZE ) & \
~picolibcTLS_ALIGNMENT_MASK ); \
pxTopOfStack = ( StackType_t * ) ( ( ( ( portPOINTER_SIZE_TYPE ) xTLSBlock ) - 1 ) & \
~picolibcSTACK_ALIGNMENT_MASK ); \
_init_tls( xTLSBlock ); \
} while( 0 )
#else /* portSTACK_GROWTH */
#define configINIT_TLS_BLOCK( xTLSBlock, pxTopOfStack ) \
do { \
xTLSBlock = ( void * ) ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack + \
picolibcTLS_ALIGNMENT_MASK ) & ~picolibcTLS_ALIGNMENT_MASK ); \
pxTopOfStack = ( StackType_t * ) ( ( ( ( ( portPOINTER_SIZE_TYPE ) xTLSBlock ) + \
picolibcTLS_SIZE ) + picolibcSTACK_ALIGNMENT_MASK ) & \
~picolibcSTACK_ALIGNMENT_MASK ); \
_init_tls( xTLSBlock ); \
} while( 0 )
#endif /* portSTACK_GROWTH */
#define configSET_TLS_BLOCK( xTLSBlock ) _set_tls( xTLSBlock )
#define configDEINIT_TLS_BLOCK( xTLSBlock )
#endif /* INC_PICOLIBC_FREERTOS_H */

View File

@@ -1,216 +1,259 @@
/* /*
* FreeRTOS Kernel V10.4.1 * FreeRTOS Kernel V11.1.0
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * SPDX-License-Identifier: MIT
* this software and associated documentation files (the "Software"), to deal in *
* the Software without restriction, including without limitation the rights to * Permission is hereby granted, free of charge, to any person obtaining a copy of
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * this software and associated documentation files (the "Software"), to deal in
* the Software, and to permit persons to whom the Software is furnished to do so, * the Software without restriction, including without limitation the rights to
* subject to the following conditions: * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* * the Software, and to permit persons to whom the Software is furnished to do so,
* The above copyright notice and this permission notice shall be included in all * subject to the following conditions:
* copies or substantial portions of the Software. *
* * The above copyright notice and this permission notice shall be included in all
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * copies or substantial portions of the Software.
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS *
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* https://www.FreeRTOS.org * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* https://github.com/FreeRTOS *
* * https://www.FreeRTOS.org
*/ * https://github.com/FreeRTOS
*
/*----------------------------------------------------------- */
* Portable layer API. Each function must be defined for each port.
*----------------------------------------------------------*/ /*-----------------------------------------------------------
* Portable layer API. Each function must be defined for each port.
#ifndef PORTABLE_H *----------------------------------------------------------*/
#define PORTABLE_H
#ifndef PORTABLE_H
/* Each FreeRTOS port has a unique portmacro.h header file. Originally a #define PORTABLE_H
* pre-processor definition was used to ensure the pre-processor found the correct
* portmacro.h file for the port being used. That scheme was deprecated in favour /* Each FreeRTOS port has a unique portmacro.h header file. Originally a
* of setting the compiler's include path such that it found the correct * pre-processor definition was used to ensure the pre-processor found the correct
* portmacro.h file - removing the need for the constant and allowing the * portmacro.h file for the port being used. That scheme was deprecated in favour
* portmacro.h file to be located anywhere in relation to the port being used. * of setting the compiler's include path such that it found the correct
* Purely for reasons of backward compatibility the old method is still valid, but * portmacro.h file - removing the need for the constant and allowing the
* to make it clear that new projects should not use it, support for the port * portmacro.h file to be located anywhere in relation to the port being used.
* specific constants has been moved into the deprecated_definitions.h header * Purely for reasons of backward compatibility the old method is still valid, but
* file. */ * to make it clear that new projects should not use it, support for the port
#include "deprecated_definitions.h" * specific constants has been moved into the deprecated_definitions.h header
* file. */
/* If portENTER_CRITICAL is not defined then including deprecated_definitions.h
* did not result in a portmacro.h header file being included - and it should be /* If portENTER_CRITICAL is not defined then including deprecated_definitions.h
* included here. In this case the path to the correct portmacro.h header file * did not result in a portmacro.h header file being included - and it should be
* must be set in the compiler's include path. */ * included here. In this case the path to the correct portmacro.h header file
#ifndef portENTER_CRITICAL * must be set in the compiler's include path. */
#include "portmacro.h" #ifndef portENTER_CRITICAL
#endif #include "portmacro.h"
#endif
#if portBYTE_ALIGNMENT == 32
#define portBYTE_ALIGNMENT_MASK ( 0x001f ) #if portBYTE_ALIGNMENT == 32
#endif #define portBYTE_ALIGNMENT_MASK (0x001f)
#elif portBYTE_ALIGNMENT == 16
#if portBYTE_ALIGNMENT == 16 #define portBYTE_ALIGNMENT_MASK (0x000f)
#define portBYTE_ALIGNMENT_MASK ( 0x000f ) #elif portBYTE_ALIGNMENT == 8
#endif #define portBYTE_ALIGNMENT_MASK (0x0007)
#elif portBYTE_ALIGNMENT == 4
#if portBYTE_ALIGNMENT == 8 #define portBYTE_ALIGNMENT_MASK (0x0003)
#define portBYTE_ALIGNMENT_MASK ( 0x0007 ) #elif portBYTE_ALIGNMENT == 2
#endif #define portBYTE_ALIGNMENT_MASK (0x0001)
#elif portBYTE_ALIGNMENT == 1
#if portBYTE_ALIGNMENT == 4 #define portBYTE_ALIGNMENT_MASK (0x0000)
#define portBYTE_ALIGNMENT_MASK ( 0x0003 ) #else /* if portBYTE_ALIGNMENT == 32 */
#endif #error "Invalid portBYTE_ALIGNMENT definition"
#endif /* if portBYTE_ALIGNMENT == 32 */
#if portBYTE_ALIGNMENT == 2
#define portBYTE_ALIGNMENT_MASK ( 0x0001 ) #ifndef portUSING_MPU_WRAPPERS
#endif #define portUSING_MPU_WRAPPERS 0
#endif
#if portBYTE_ALIGNMENT == 1
#define portBYTE_ALIGNMENT_MASK ( 0x0000 ) #ifndef portNUM_CONFIGURABLE_REGIONS
#endif #define portNUM_CONFIGURABLE_REGIONS 1
#endif
#ifndef portBYTE_ALIGNMENT_MASK
#error "Invalid portBYTE_ALIGNMENT definition" #ifndef portHAS_STACK_OVERFLOW_CHECKING
#endif #define portHAS_STACK_OVERFLOW_CHECKING 0
#endif
#ifndef portNUM_CONFIGURABLE_REGIONS
#define portNUM_CONFIGURABLE_REGIONS 1 #ifndef portARCH_NAME
#endif #define portARCH_NAME NULL
#endif
#ifndef portHAS_STACK_OVERFLOW_CHECKING
#define portHAS_STACK_OVERFLOW_CHECKING 0 #ifndef configSTACK_DEPTH_TYPE
#endif #define configSTACK_DEPTH_TYPE StackType_t
#endif
#ifndef portARCH_NAME
#define portARCH_NAME NULL #ifndef configSTACK_ALLOCATION_FROM_SEPARATE_HEAP
#endif /* Defaults to 0 for backward compatibility. */
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
/* *INDENT-OFF* */ #endif
#ifdef __cplusplus
extern "C" { /* *INDENT-OFF* */
#endif #ifdef __cplusplus
/* *INDENT-ON* */ extern "C" {
#endif
#include "mpu_wrappers.h" /* *INDENT-ON* */
/* #include "mpu_wrappers.h"
* Setup the stack of a new task so it is ready to be placed under the
* scheduler control. The registers have to be placed on the stack in /*
* the order that the port expects to find them. * Setup the stack of a new task so it is ready to be placed under the
* * scheduler control. The registers have to be placed on the stack in
*/ * the order that the port expects to find them.
#if ( portUSING_MPU_WRAPPERS == 1 ) *
#if ( portHAS_STACK_OVERFLOW_CHECKING == 1 ) */
StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack, #if (portUSING_MPU_WRAPPERS == 1)
StackType_t * pxEndOfStack, #if (portHAS_STACK_OVERFLOW_CHECKING == 1)
TaskFunction_t pxCode, StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, StackType_t *pxEndOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged,
void * pvParameters, xMPU_SETTINGS *xMPUSettings) PRIVILEGED_FUNCTION;
BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION; #else
#else StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged, xMPU_SETTINGS *xMPUSettings) PRIVILEGED_FUNCTION;
StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack, #endif /* if ( portHAS_STACK_OVERFLOW_CHECKING == 1 ) */
TaskFunction_t pxCode, #else /* if ( portUSING_MPU_WRAPPERS == 1 ) */
void * pvParameters, #if (portHAS_STACK_OVERFLOW_CHECKING == 1)
BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION; StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, StackType_t *pxEndOfStack, TaskFunction_t pxCode, void *pvParameters) PRIVILEGED_FUNCTION;
#endif #else
#else /* if ( portUSING_MPU_WRAPPERS == 1 ) */ StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters) PRIVILEGED_FUNCTION;
#if ( portHAS_STACK_OVERFLOW_CHECKING == 1 ) #endif
StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack, #endif /* if ( portUSING_MPU_WRAPPERS == 1 ) */
StackType_t * pxEndOfStack,
TaskFunction_t pxCode, /* Used by heap_5.c to define the start address and size of each memory region
void * pvParameters ) PRIVILEGED_FUNCTION; * that together comprise the total FreeRTOS heap space. */
#else typedef struct HeapRegion {
StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack, uint8_t *pucStartAddress;
TaskFunction_t pxCode, size_t xSizeInBytes;
void * pvParameters ) PRIVILEGED_FUNCTION; } HeapRegion_t;
#endif
#endif /* if ( portUSING_MPU_WRAPPERS == 1 ) */ /* Used to pass information about the heap out of vPortGetHeapStats(). */
typedef struct xHeapStats {
/* Used by heap_5.c to define the start address and size of each memory region size_t xAvailableHeapSpaceInBytes; /* The total heap size currently available - this is the sum of all the free blocks, not the largest block that can be allocated. */
* that together comprise the total FreeRTOS heap space. */ size_t xSizeOfLargestFreeBlockInBytes; /* The maximum size, in bytes, of all the free blocks within the heap at the time vPortGetHeapStats() is called. */
typedef struct HeapRegion size_t xSizeOfSmallestFreeBlockInBytes; /* The minimum size, in bytes, of all the free blocks within the heap at the time vPortGetHeapStats() is called. */
{ size_t xNumberOfFreeBlocks; /* The number of free memory blocks within the heap at the time vPortGetHeapStats() is called. */
uint8_t * pucStartAddress; size_t xMinimumEverFreeBytesRemaining; /* The minimum amount of total free memory (sum of all free blocks) there has been in the heap since the system booted. */
size_t xSizeInBytes; size_t xNumberOfSuccessfulAllocations; /* The number of calls to pvPortMalloc() that have returned a valid memory block. */
} HeapRegion_t; size_t xNumberOfSuccessfulFrees; /* The number of calls to vPortFree() that has successfully freed a block of memory. */
} HeapStats_t;
/* Used to pass information about the heap out of vPortGetHeapStats(). */
typedef struct xHeapStats /*
{ * Used to define multiple heap regions for use by heap_5.c. This function
size_t xAvailableHeapSpaceInBytes; /* The total heap size currently available - this is the sum of all the free blocks, not the largest block that can be allocated. */ * must be called before any calls to pvPortMalloc() - not creating a task,
size_t xSizeOfLargestFreeBlockInBytes; /* The maximum size, in bytes, of all the free blocks within the heap at the time vPortGetHeapStats() is called. */ * queue, semaphore, mutex, software timer, event group, etc. will result in
size_t xSizeOfSmallestFreeBlockInBytes; /* The minimum size, in bytes, of all the free blocks within the heap at the time vPortGetHeapStats() is called. */ * pvPortMalloc being called.
size_t xNumberOfFreeBlocks; /* The number of free memory blocks within the heap at the time vPortGetHeapStats() is called. */ *
size_t xMinimumEverFreeBytesRemaining; /* The minimum amount of total free memory (sum of all free blocks) there has been in the heap since the system booted. */ * pxHeapRegions passes in an array of HeapRegion_t structures - each of which
size_t xNumberOfSuccessfulAllocations; /* The number of calls to pvPortMalloc() that have returned a valid memory block. */ * defines a region of memory that can be used as the heap. The array is
size_t xNumberOfSuccessfulFrees; /* The number of calls to vPortFree() that has successfully freed a block of memory. */ * terminated by a HeapRegions_t structure that has a size of 0. The region
} HeapStats_t; * with the lowest start address must appear first in the array.
*/
/* void vPortDefineHeapRegions(const HeapRegion_t *const pxHeapRegions) PRIVILEGED_FUNCTION;
* Used to define multiple heap regions for use by heap_5.c. This function
* must be called before any calls to pvPortMalloc() - not creating a task, /*
* queue, semaphore, mutex, software timer, event group, etc. will result in * Returns a HeapStats_t structure filled with information about the current
* pvPortMalloc being called. * heap state.
* */
* pxHeapRegions passes in an array of HeapRegion_t structures - each of which void vPortGetHeapStats(HeapStats_t *pxHeapStats);
* defines a region of memory that can be used as the heap. The array is
* terminated by a HeapRegions_t structure that has a size of 0. The region /*
* with the lowest start address must appear first in the array. * Map to the memory management routines required for the port.
*/ */
void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) PRIVILEGED_FUNCTION; void *pvPortMalloc(size_t xWantedSize) PRIVILEGED_FUNCTION;
void *pvPortCalloc(size_t xNum, size_t xSize) PRIVILEGED_FUNCTION;
/* void vPortFree(void *pv) PRIVILEGED_FUNCTION;
* Returns a HeapStats_t structure filled with information about the current void vPortInitialiseBlocks(void) PRIVILEGED_FUNCTION;
* heap state. size_t xPortGetFreeHeapSize(void) PRIVILEGED_FUNCTION;
*/ size_t xPortGetMinimumEverFreeHeapSize(void) PRIVILEGED_FUNCTION;
void vPortGetHeapStats( HeapStats_t * pxHeapStats );
#if (configSTACK_ALLOCATION_FROM_SEPARATE_HEAP == 1)
/* void *pvPortMallocStack(size_t xSize) PRIVILEGED_FUNCTION;
* Map to the memory management routines required for the port. void vPortFreeStack(void *pv) PRIVILEGED_FUNCTION;
*/ #else
void * pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION; #define pvPortMallocStack pvPortMalloc
void vPortFree( void * pv ) PRIVILEGED_FUNCTION; #define vPortFreeStack vPortFree
void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION; #endif
size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;
size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION; /*
* This function resets the internal state of the heap module. It must be called
/* * by the application before restarting the scheduler.
* Setup the hardware ready for the scheduler to take control. This generally */
* sets up a tick interrupt and sets timers for the correct tick frequency. void vPortHeapResetState(void) PRIVILEGED_FUNCTION;
*/
BaseType_t xPortStartScheduler( void ) PRIVILEGED_FUNCTION; #if (configUSE_MALLOC_FAILED_HOOK == 1)
/* /**
* Undo any hardware/ISR setup that was performed by xPortStartScheduler() so * task.h
* the hardware is left in its original condition after the scheduler stops * @code{c}
* executing. * void vApplicationMallocFailedHook( void )
*/ * @endcode
void vPortEndScheduler( void ) PRIVILEGED_FUNCTION; *
* This hook function is called when allocation failed.
/* */
* The structures and methods of manipulating the MPU are contained within the void vApplicationMallocFailedHook(void);
* port layer. #endif
*
* Fills the xMPUSettings structure with the memory region information /*
* contained in xRegions. * Setup the hardware ready for the scheduler to take control. This generally
*/ * sets up a tick interrupt and sets timers for the correct tick frequency.
#if ( portUSING_MPU_WRAPPERS == 1 ) */
struct xMEMORY_REGION; BaseType_t xPortStartScheduler(void) PRIVILEGED_FUNCTION;
void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings,
const struct xMEMORY_REGION * const xRegions, /*
StackType_t * pxBottomOfStack, * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so
uint32_t ulStackDepth ) PRIVILEGED_FUNCTION; * the hardware is left in its original condition after the scheduler stops
#endif * executing.
*/
/* *INDENT-OFF* */ void vPortEndScheduler(void) PRIVILEGED_FUNCTION;
#ifdef __cplusplus
} /*
#endif * The structures and methods of manipulating the MPU are contained within the
/* *INDENT-ON* */ * port layer.
*
#endif /* PORTABLE_H */ * Fills the xMPUSettings structure with the memory region information
* contained in xRegions.
*/
#if (portUSING_MPU_WRAPPERS == 1)
struct xMEMORY_REGION;
void vPortStoreTaskMPUSettings(xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION *const xRegions, StackType_t *pxBottomOfStack, configSTACK_DEPTH_TYPE uxStackDepth) PRIVILEGED_FUNCTION;
#endif
/**
* @brief Checks if the calling task is authorized to access the given buffer.
*
* @param pvBuffer The buffer which the calling task wants to access.
* @param ulBufferLength The length of the pvBuffer.
* @param ulAccessRequested The permissions that the calling task wants.
*
* @return pdTRUE if the calling task is authorized to access the buffer,
* pdFALSE otherwise.
*/
#if (portUSING_MPU_WRAPPERS == 1)
BaseType_t xPortIsAuthorizedToAccessBuffer(const void *pvBuffer, uint32_t ulBufferLength, uint32_t ulAccessRequested) PRIVILEGED_FUNCTION;
#endif
/**
* @brief Checks if the calling task is authorized to access the given kernel object.
*
* @param lInternalIndexOfKernelObject The index of the kernel object in the kernel
* object handle pool.
*
* @return pdTRUE if the calling task is authorized to access the kernel object,
* pdFALSE otherwise.
*/
#if ((portUSING_MPU_WRAPPERS == 1) && (configUSE_MPU_WRAPPERS_V1 == 0))
BaseType_t xPortIsAuthorizedToAccessKernelObject(int32_t lInternalIndexOfKernelObject) PRIVILEGED_FUNCTION;
#endif
/* *INDENT-OFF* */
#ifdef __cplusplus
}
#endif
/* *INDENT-ON* */
#endif /* PORTABLE_H */

View File

@@ -1,120 +1,138 @@
/* /*
* FreeRTOS Kernel V10.4.1 * FreeRTOS Kernel V11.1.0
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * SPDX-License-Identifier: MIT
* this software and associated documentation files (the "Software"), to deal in *
* the Software without restriction, including without limitation the rights to * Permission is hereby granted, free of charge, to any person obtaining a copy of
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * this software and associated documentation files (the "Software"), to deal in
* the Software, and to permit persons to whom the Software is furnished to do so, * the Software without restriction, including without limitation the rights to
* subject to the following conditions: * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* * the Software, and to permit persons to whom the Software is furnished to do so,
* The above copyright notice and this permission notice shall be included in all * subject to the following conditions:
* copies or substantial portions of the Software. *
* * The above copyright notice and this permission notice shall be included in all
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * copies or substantial portions of the Software.
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS *
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* https://www.FreeRTOS.org * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* https://github.com/FreeRTOS *
* * https://www.FreeRTOS.org
*/ * https://github.com/FreeRTOS
*
#ifndef PROJDEFS_H */
#define PROJDEFS_H
#ifndef PROJDEFS_H
/* #define PROJDEFS_H
* Defines the prototype to which task functions must conform. Defined in this
* file to ensure the type is known before portable.h is included. /*
*/ * Defines the prototype to which task functions must conform. Defined in this
typedef void (* TaskFunction_t)( void * ); * file to ensure the type is known before portable.h is included.
*/
/* Converts a time in milliseconds to a time in ticks. This macro can be typedef void (* TaskFunction_t)( void * arg );
* overridden by a macro of the same name defined in FreeRTOSConfig.h in case the
* definition here is not suitable for your application. */ /* Converts a time in milliseconds to a time in ticks. This macro can be
#ifndef pdMS_TO_TICKS * overridden by a macro of the same name defined in FreeRTOSConfig.h in case the
#define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) ( ( ( TickType_t ) ( xTimeInMs ) * ( TickType_t ) configTICK_RATE_HZ ) / ( TickType_t ) 1000U ) ) * definition here is not suitable for your application. */
#endif #ifndef pdMS_TO_TICKS
#define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) ( ( ( uint64_t ) ( xTimeInMs ) * ( uint64_t ) configTICK_RATE_HZ ) / ( uint64_t ) 1000U ) )
#define pdFALSE ( ( BaseType_t ) 0 ) #endif
#define pdTRUE ( ( BaseType_t ) 1 )
/* Converts a time in ticks to a time in milliseconds. This macro can be
#define pdPASS ( pdTRUE ) * overridden by a macro of the same name defined in FreeRTOSConfig.h in case the
#define pdFAIL ( pdFALSE ) * definition here is not suitable for your application. */
#define errQUEUE_EMPTY ( ( BaseType_t ) 0 ) #ifndef pdTICKS_TO_MS
#define errQUEUE_FULL ( ( BaseType_t ) 0 ) #define pdTICKS_TO_MS( xTimeInTicks ) ( ( TickType_t ) ( ( ( uint64_t ) ( xTimeInTicks ) * ( uint64_t ) 1000U ) / ( uint64_t ) configTICK_RATE_HZ ) )
#endif
/* FreeRTOS error definitions. */
#define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 ) #define pdFALSE ( ( BaseType_t ) 0 )
#define errQUEUE_BLOCKED ( -4 ) #define pdTRUE ( ( BaseType_t ) 1 )
#define errQUEUE_YIELD ( -5 ) #define pdFALSE_SIGNED ( ( BaseType_t ) 0 )
#define pdTRUE_SIGNED ( ( BaseType_t ) 1 )
/* Macros used for basic data corruption checks. */ #define pdFALSE_UNSIGNED ( ( UBaseType_t ) 0 )
#ifndef configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES #define pdTRUE_UNSIGNED ( ( UBaseType_t ) 1 )
#define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 0
#endif #define pdPASS ( pdTRUE )
#define pdFAIL ( pdFALSE )
#if ( configUSE_16_BIT_TICKS == 1 ) #define errQUEUE_EMPTY ( ( BaseType_t ) 0 )
#define pdINTEGRITY_CHECK_VALUE 0x5a5a #define errQUEUE_FULL ( ( BaseType_t ) 0 )
#else
#define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5aUL /* FreeRTOS error definitions. */
#endif #define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 )
#define errQUEUE_BLOCKED ( -4 )
/* The following errno values are used by FreeRTOS+ components, not FreeRTOS #define errQUEUE_YIELD ( -5 )
* itself. */
#define pdFREERTOS_ERRNO_NONE 0 /* No errors */ /* Macros used for basic data corruption checks. */
#define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */ #ifndef configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES
#define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */ #define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 0
#define pdFREERTOS_ERRNO_EIO 5 /* I/O error */ #endif
#define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */
#define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */ #if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
#define pdFREERTOS_ERRNO_EAGAIN 11 /* No more processes */ #define pdINTEGRITY_CHECK_VALUE 0x5a5a
#define pdFREERTOS_ERRNO_EWOULDBLOCK 11 /* Operation would block */ #elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
#define pdFREERTOS_ERRNO_ENOMEM 12 /* Not enough memory */ #define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5aUL
#define pdFREERTOS_ERRNO_EACCES 13 /* Permission denied */ #elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS )
#define pdFREERTOS_ERRNO_EFAULT 14 /* Bad address */ #define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5a5a5a5a5aULL
#define pdFREERTOS_ERRNO_EBUSY 16 /* Mount device busy */ #else
#define pdFREERTOS_ERRNO_EEXIST 17 /* File exists */ #error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width.
#define pdFREERTOS_ERRNO_EXDEV 18 /* Cross-device link */ #endif
#define pdFREERTOS_ERRNO_ENODEV 19 /* No such device */
#define pdFREERTOS_ERRNO_ENOTDIR 20 /* Not a directory */ /* The following errno values are used by FreeRTOS+ components, not FreeRTOS
#define pdFREERTOS_ERRNO_EISDIR 21 /* Is a directory */ * itself. */
#define pdFREERTOS_ERRNO_EINVAL 22 /* Invalid argument */ #define pdFREERTOS_ERRNO_NONE 0 /* No errors */
#define pdFREERTOS_ERRNO_ENOSPC 28 /* No space left on device */ #define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */
#define pdFREERTOS_ERRNO_ESPIPE 29 /* Illegal seek */ #define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */
#define pdFREERTOS_ERRNO_EROFS 30 /* Read only file system */ #define pdFREERTOS_ERRNO_EIO 5 /* I/O error */
#define pdFREERTOS_ERRNO_EUNATCH 42 /* Protocol driver not attached */ #define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */
#define pdFREERTOS_ERRNO_EBADE 50 /* Invalid exchange */ #define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */
#define pdFREERTOS_ERRNO_EFTYPE 79 /* Inappropriate file type or format */ #define pdFREERTOS_ERRNO_EAGAIN 11 /* No more processes */
#define pdFREERTOS_ERRNO_ENMFILE 89 /* No more files */ #define pdFREERTOS_ERRNO_EWOULDBLOCK 11 /* Operation would block */
#define pdFREERTOS_ERRNO_ENOTEMPTY 90 /* Directory not empty */ #define pdFREERTOS_ERRNO_ENOMEM 12 /* Not enough memory */
#define pdFREERTOS_ERRNO_ENAMETOOLONG 91 /* File or path name too long */ #define pdFREERTOS_ERRNO_EACCES 13 /* Permission denied */
#define pdFREERTOS_ERRNO_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ #define pdFREERTOS_ERRNO_EFAULT 14 /* Bad address */
#define pdFREERTOS_ERRNO_ENOBUFS 105 /* No buffer space available */ #define pdFREERTOS_ERRNO_EBUSY 16 /* Mount device busy */
#define pdFREERTOS_ERRNO_ENOPROTOOPT 109 /* Protocol not available */ #define pdFREERTOS_ERRNO_EEXIST 17 /* File exists */
#define pdFREERTOS_ERRNO_EADDRINUSE 112 /* Address already in use */ #define pdFREERTOS_ERRNO_EXDEV 18 /* Cross-device link */
#define pdFREERTOS_ERRNO_ETIMEDOUT 116 /* Connection timed out */ #define pdFREERTOS_ERRNO_ENODEV 19 /* No such device */
#define pdFREERTOS_ERRNO_EINPROGRESS 119 /* Connection already in progress */ #define pdFREERTOS_ERRNO_ENOTDIR 20 /* Not a directory */
#define pdFREERTOS_ERRNO_EALREADY 120 /* Socket already connected */ #define pdFREERTOS_ERRNO_EISDIR 21 /* Is a directory */
#define pdFREERTOS_ERRNO_EADDRNOTAVAIL 125 /* Address not available */ #define pdFREERTOS_ERRNO_EINVAL 22 /* Invalid argument */
#define pdFREERTOS_ERRNO_EISCONN 127 /* Socket is already connected */ #define pdFREERTOS_ERRNO_ENOSPC 28 /* No space left on device */
#define pdFREERTOS_ERRNO_ENOTCONN 128 /* Socket is not connected */ #define pdFREERTOS_ERRNO_ESPIPE 29 /* Illegal seek */
#define pdFREERTOS_ERRNO_ENOMEDIUM 135 /* No medium inserted */ #define pdFREERTOS_ERRNO_EROFS 30 /* Read only file system */
#define pdFREERTOS_ERRNO_EILSEQ 138 /* An invalid UTF-16 sequence was encountered. */ #define pdFREERTOS_ERRNO_EUNATCH 42 /* Protocol driver not attached */
#define pdFREERTOS_ERRNO_ECANCELED 140 /* Operation canceled. */ #define pdFREERTOS_ERRNO_EBADE 50 /* Invalid exchange */
#define pdFREERTOS_ERRNO_EFTYPE 79 /* Inappropriate file type or format */
/* The following endian values are used by FreeRTOS+ components, not FreeRTOS #define pdFREERTOS_ERRNO_ENMFILE 89 /* No more files */
* itself. */ #define pdFREERTOS_ERRNO_ENOTEMPTY 90 /* Directory not empty */
#define pdFREERTOS_LITTLE_ENDIAN 0 #define pdFREERTOS_ERRNO_ENAMETOOLONG 91 /* File or path name too long */
#define pdFREERTOS_BIG_ENDIAN 1 #define pdFREERTOS_ERRNO_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
#define pdFREERTOS_ERRNO_EAFNOSUPPORT 97 /* Address family not supported by protocol */
/* Re-defining endian values for generic naming. */ #define pdFREERTOS_ERRNO_ENOBUFS 105 /* No buffer space available */
#define pdLITTLE_ENDIAN pdFREERTOS_LITTLE_ENDIAN #define pdFREERTOS_ERRNO_ENOPROTOOPT 109 /* Protocol not available */
#define pdBIG_ENDIAN pdFREERTOS_BIG_ENDIAN #define pdFREERTOS_ERRNO_EADDRINUSE 112 /* Address already in use */
#define pdFREERTOS_ERRNO_ETIMEDOUT 116 /* Connection timed out */
#define pdFREERTOS_ERRNO_EINPROGRESS 119 /* Connection already in progress */
#endif /* PROJDEFS_H */ #define pdFREERTOS_ERRNO_EALREADY 120 /* Socket already connected */
#define pdFREERTOS_ERRNO_EADDRNOTAVAIL 125 /* Address not available */
#define pdFREERTOS_ERRNO_EISCONN 127 /* Socket is already connected */
#define pdFREERTOS_ERRNO_ENOTCONN 128 /* Socket is not connected */
#define pdFREERTOS_ERRNO_ENOMEDIUM 135 /* No medium inserted */
#define pdFREERTOS_ERRNO_EILSEQ 138 /* An invalid UTF-16 sequence was encountered. */
#define pdFREERTOS_ERRNO_ECANCELED 140 /* Operation canceled. */
/* The following endian values are used by FreeRTOS+ components, not FreeRTOS
* itself. */
#define pdFREERTOS_LITTLE_ENDIAN 0
#define pdFREERTOS_BIG_ENDIAN 1
/* Re-defining endian values for generic naming. */
#define pdLITTLE_ENDIAN pdFREERTOS_LITTLE_ENDIAN
#define pdBIG_ENDIAN pdFREERTOS_BIG_ENDIAN
#endif /* PROJDEFS_H */

View File

@@ -1,6 +1,8 @@
/* /*
* FreeRTOS Kernel V10.4.1 * FreeRTOS Kernel V11.1.0
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* SPDX-License-Identifier: MIT
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in * this software and associated documentation files (the "Software"), to deal in
@@ -77,12 +79,12 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
/** /**
* queue. h * queue. h
* <pre> * @code{c}
* QueueHandle_t xQueueCreate( * QueueHandle_t xQueueCreate(
* UBaseType_t uxQueueLength, * UBaseType_t uxQueueLength,
* UBaseType_t uxItemSize * UBaseType_t uxItemSize
* ); * );
* </pre> * @endcode
* *
* Creates a new queue instance, and returns a handle by which the new queue * Creates a new queue instance, and returns a handle by which the new queue
* can be referenced. * can be referenced.
@@ -111,7 +113,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
* returned. * returned.
* *
* Example usage: * Example usage:
* <pre> * @code{c}
* struct AMessage * struct AMessage
* { * {
* char ucMessageID; * char ucMessageID;
@@ -139,7 +141,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
* *
* // ... Rest of task code. * // ... Rest of task code.
* } * }
* </pre> * @endcode
* \defgroup xQueueCreate xQueueCreate * \defgroup xQueueCreate xQueueCreate
* \ingroup QueueManagement * \ingroup QueueManagement
*/ */
@@ -149,14 +151,14 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
/** /**
* queue. h * queue. h
* <pre> * @code{c}
* QueueHandle_t xQueueCreateStatic( * QueueHandle_t xQueueCreateStatic(
* UBaseType_t uxQueueLength, * UBaseType_t uxQueueLength,
* UBaseType_t uxItemSize, * UBaseType_t uxItemSize,
* uint8_t *pucQueueStorageBuffer, * uint8_t *pucQueueStorage,
* StaticQueue_t *pxQueueBuffer * StaticQueue_t *pxQueueBuffer
* ); * );
* </pre> * @endcode
* *
* Creates a new queue instance, and returns a handle by which the new queue * Creates a new queue instance, and returns a handle by which the new queue
* can be referenced. * can be referenced.
@@ -180,11 +182,11 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
* that will be copied for each posted item. Each item on the queue must be * that will be copied for each posted item. Each item on the queue must be
* the same size. * the same size.
* *
* @param pucQueueStorageBuffer If uxItemSize is not zero then * @param pucQueueStorage If uxItemSize is not zero then
* pucQueueStorageBuffer must point to a uint8_t array that is at least large * pucQueueStorage must point to a uint8_t array that is at least large
* enough to hold the maximum number of items that can be in the queue at any * enough to hold the maximum number of items that can be in the queue at any
* one time - which is ( uxQueueLength * uxItemsSize ) bytes. If uxItemSize is * one time - which is ( uxQueueLength * uxItemsSize ) bytes. If uxItemSize is
* zero then pucQueueStorageBuffer can be NULL. * zero then pucQueueStorage can be NULL.
* *
* @param pxQueueBuffer Must point to a variable of type StaticQueue_t, which * @param pxQueueBuffer Must point to a variable of type StaticQueue_t, which
* will be used to hold the queue's data structure. * will be used to hold the queue's data structure.
@@ -193,7 +195,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
* returned. If pxQueueBuffer is NULL then NULL is returned. * returned. If pxQueueBuffer is NULL then NULL is returned.
* *
* Example usage: * Example usage:
* <pre> * @code{c}
* struct AMessage * struct AMessage
* { * {
* char ucMessageID; * char ucMessageID;
@@ -212,7 +214,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
* *
* void vATask( void *pvParameters ) * void vATask( void *pvParameters )
* { * {
* QueueHandle_t xQueue1; * QueueHandle_t xQueue1;
* *
* // Create a queue capable of containing 10 uint32_t values. * // Create a queue capable of containing 10 uint32_t values.
* xQueue1 = xQueueCreate( QUEUE_LENGTH, // The number of items the queue can hold. * xQueue1 = xQueueCreate( QUEUE_LENGTH, // The number of items the queue can hold.
@@ -225,7 +227,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
* *
* // ... Rest of task code. * // ... Rest of task code.
* } * }
* </pre> * @endcode
* \defgroup xQueueCreateStatic xQueueCreateStatic * \defgroup xQueueCreateStatic xQueueCreateStatic
* \ingroup QueueManagement * \ingroup QueueManagement
*/ */
@@ -235,13 +237,42 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
/** /**
* queue. h * queue. h
* <pre> * @code{c}
* BaseType_t xQueueSendToToFront( * BaseType_t xQueueGetStaticBuffers( QueueHandle_t xQueue,
* uint8_t ** ppucQueueStorage,
* StaticQueue_t ** ppxStaticQueue );
* @endcode
*
* Retrieve pointers to a statically created queue's data structure buffer
* and storage area buffer. These are the same buffers that are supplied
* at the time of creation.
*
* @param xQueue The queue for which to retrieve the buffers.
*
* @param ppucQueueStorage Used to return a pointer to the queue's storage
* area buffer.
*
* @param ppxStaticQueue Used to return a pointer to the queue's data
* structure buffer.
*
* @return pdTRUE if buffers were retrieved, pdFALSE otherwise.
*
* \defgroup xQueueGetStaticBuffers xQueueGetStaticBuffers
* \ingroup QueueManagement
*/
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
#define xQueueGetStaticBuffers( xQueue, ppucQueueStorage, ppxStaticQueue ) xQueueGenericGetStaticBuffers( ( xQueue ), ( ppucQueueStorage ), ( ppxStaticQueue ) )
#endif /* configSUPPORT_STATIC_ALLOCATION */
/**
* queue. h
* @code{c}
* BaseType_t xQueueSendToFront(
* QueueHandle_t xQueue, * QueueHandle_t xQueue,
* const void *pvItemToQueue, * const void *pvItemToQueue,
* TickType_t xTicksToWait * TickType_t xTicksToWait
* ); * );
* </pre> * @endcode
* *
* Post an item to the front of a queue. The item is queued by copy, not by * Post an item to the front of a queue. The item is queued by copy, not by
* reference. This function must not be called from an interrupt service * reference. This function must not be called from an interrupt service
@@ -264,14 +295,14 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
* @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL. * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.
* *
* Example usage: * Example usage:
* <pre> * @code{c}
* struct AMessage * struct AMessage
* { * {
* char ucMessageID; * char ucMessageID;
* char ucData[ 20 ]; * char ucData[ 20 ];
* } xMessage; * } xMessage;
* *
* uint32_t ulVar = 10UL; * uint32_t ulVar = 10U;
* *
* void vATask( void *pvParameters ) * void vATask( void *pvParameters )
* { * {
@@ -307,7 +338,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
* *
* // ... Rest of task code. * // ... Rest of task code.
* } * }
* </pre> * @endcode
* \defgroup xQueueSend xQueueSend * \defgroup xQueueSend xQueueSend
* \ingroup QueueManagement * \ingroup QueueManagement
*/ */
@@ -316,13 +347,13 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
/** /**
* queue. h * queue. h
* <pre> * @code{c}
* BaseType_t xQueueSendToBack( * BaseType_t xQueueSendToBack(
* QueueHandle_t xQueue, * QueueHandle_t xQueue,
* const void *pvItemToQueue, * const void *pvItemToQueue,
* TickType_t xTicksToWait * TickType_t xTicksToWait
* ); * );
* </pre> * @endcode
* *
* This is a macro that calls xQueueGenericSend(). * This is a macro that calls xQueueGenericSend().
* *
@@ -347,14 +378,14 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
* @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL. * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.
* *
* Example usage: * Example usage:
* <pre> * @code{c}
* struct AMessage * struct AMessage
* { * {
* char ucMessageID; * char ucMessageID;
* char ucData[ 20 ]; * char ucData[ 20 ];
* } xMessage; * } xMessage;
* *
* uint32_t ulVar = 10UL; * uint32_t ulVar = 10U;
* *
* void vATask( void *pvParameters ) * void vATask( void *pvParameters )
* { * {
@@ -390,7 +421,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
* *
* // ... Rest of task code. * // ... Rest of task code.
* } * }
* </pre> * @endcode
* \defgroup xQueueSend xQueueSend * \defgroup xQueueSend xQueueSend
* \ingroup QueueManagement * \ingroup QueueManagement
*/ */
@@ -399,13 +430,13 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
/** /**
* queue. h * queue. h
* <pre> * @code{c}
* BaseType_t xQueueSend( * BaseType_t xQueueSend(
* QueueHandle_t xQueue, * QueueHandle_t xQueue,
* const void * pvItemToQueue, * const void * pvItemToQueue,
* TickType_t xTicksToWait * TickType_t xTicksToWait
* ); * );
* </pre> * @endcode
* *
* This is a macro that calls xQueueGenericSend(). It is included for * This is a macro that calls xQueueGenericSend(). It is included for
* backward compatibility with versions of FreeRTOS.org that did not * backward compatibility with versions of FreeRTOS.org that did not
@@ -432,14 +463,14 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
* @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL. * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.
* *
* Example usage: * Example usage:
* <pre> * @code{c}
* struct AMessage * struct AMessage
* { * {
* char ucMessageID; * char ucMessageID;
* char ucData[ 20 ]; * char ucData[ 20 ];
* } xMessage; * } xMessage;
* *
* uint32_t ulVar = 10UL; * uint32_t ulVar = 10U;
* *
* void vATask( void *pvParameters ) * void vATask( void *pvParameters )
* { * {
@@ -475,7 +506,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
* *
* // ... Rest of task code. * // ... Rest of task code.
* } * }
* </pre> * @endcode
* \defgroup xQueueSend xQueueSend * \defgroup xQueueSend xQueueSend
* \ingroup QueueManagement * \ingroup QueueManagement
*/ */
@@ -484,12 +515,12 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
/** /**
* queue. h * queue. h
* <pre> * @code{c}
* BaseType_t xQueueOverwrite( * BaseType_t xQueueOverwrite(
* QueueHandle_t xQueue, * QueueHandle_t xQueue,
* const void * pvItemToQueue * const void * pvItemToQueue
* ); * );
* </pre> * @endcode
* *
* Only for use with queues that have a length of one - so the queue is either * Only for use with queues that have a length of one - so the queue is either
* empty or full. * empty or full.
@@ -513,7 +544,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
* to the queue even when the queue is already full. * to the queue even when the queue is already full.
* *
* Example usage: * Example usage:
* <pre> * @code{c}
* *
* void vFunction( void *pvParameters ) * void vFunction( void *pvParameters )
* { * {
@@ -559,7 +590,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
* *
* // ... * // ...
* } * }
* </pre> * @endcode
* \defgroup xQueueOverwrite xQueueOverwrite * \defgroup xQueueOverwrite xQueueOverwrite
* \ingroup QueueManagement * \ingroup QueueManagement
*/ */
@@ -569,14 +600,14 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
/** /**
* queue. h * queue. h
* <pre> * @code{c}
* BaseType_t xQueueGenericSend( * BaseType_t xQueueGenericSend(
* QueueHandle_t xQueue, * QueueHandle_t xQueue,
* const void * pvItemToQueue, * const void * pvItemToQueue,
* TickType_t xTicksToWait * TickType_t xTicksToWait
* BaseType_t xCopyPosition * BaseType_t xCopyPosition
* ); * );
* </pre> * @endcode
* *
* It is preferred that the macros xQueueSend(), xQueueSendToFront() and * It is preferred that the macros xQueueSend(), xQueueSendToFront() and
* xQueueSendToBack() are used in place of calling this function directly. * xQueueSendToBack() are used in place of calling this function directly.
@@ -605,14 +636,14 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
* @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL. * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.
* *
* Example usage: * Example usage:
* <pre> * @code{c}
* struct AMessage * struct AMessage
* { * {
* char ucMessageID; * char ucMessageID;
* char ucData[ 20 ]; * char ucData[ 20 ];
* } xMessage; * } xMessage;
* *
* uint32_t ulVar = 10UL; * uint32_t ulVar = 10U;
* *
* void vATask( void *pvParameters ) * void vATask( void *pvParameters )
* { * {
@@ -648,7 +679,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
* *
* // ... Rest of task code. * // ... Rest of task code.
* } * }
* </pre> * @endcode
* \defgroup xQueueSend xQueueSend * \defgroup xQueueSend xQueueSend
* \ingroup QueueManagement * \ingroup QueueManagement
*/ */
@@ -659,13 +690,13 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue,
/** /**
* queue. h * queue. h
* <pre> * @code{c}
* BaseType_t xQueuePeek( * BaseType_t xQueuePeek(
* QueueHandle_t xQueue, * QueueHandle_t xQueue,
* void * const pvBuffer, * void * const pvBuffer,
* TickType_t xTicksToWait * TickType_t xTicksToWait
* ); * );
* </pre> * @endcode
* *
* Receive an item from a queue without removing the item from the queue. * Receive an item from a queue without removing the item from the queue.
* The item is received by copy so a buffer of adequate size must be * The item is received by copy so a buffer of adequate size must be
@@ -696,7 +727,7 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue,
* otherwise pdFALSE. * otherwise pdFALSE.
* *
* Example usage: * Example usage:
* <pre> * @code{c}
* struct AMessage * struct AMessage
* { * {
* char ucMessageID; * char ucMessageID;
@@ -746,7 +777,7 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue,
* *
* // ... Rest of task code. * // ... Rest of task code.
* } * }
* </pre> * @endcode
* \defgroup xQueuePeek xQueuePeek * \defgroup xQueuePeek xQueuePeek
* \ingroup QueueManagement * \ingroup QueueManagement
*/ */
@@ -756,12 +787,12 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue,
/** /**
* queue. h * queue. h
* <pre> * @code{c}
* BaseType_t xQueuePeekFromISR( * BaseType_t xQueuePeekFromISR(
* QueueHandle_t xQueue, * QueueHandle_t xQueue,
* void *pvBuffer, * void *pvBuffer,
* ); * );
* </pre> * @endcode
* *
* A version of xQueuePeek() that can be called from an interrupt service * A version of xQueuePeek() that can be called from an interrupt service
* routine (ISR). * routine (ISR).
@@ -791,13 +822,13 @@ BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue,
/** /**
* queue. h * queue. h
* <pre> * @code{c}
* BaseType_t xQueueReceive( * BaseType_t xQueueReceive(
* QueueHandle_t xQueue, * QueueHandle_t xQueue,
* void *pvBuffer, * void *pvBuffer,
* TickType_t xTicksToWait * TickType_t xTicksToWait
* ); * );
* </pre> * @endcode
* *
* Receive an item from a queue. The item is received by copy so a buffer of * Receive an item from a queue. The item is received by copy so a buffer of
* adequate size must be provided. The number of bytes copied into the buffer * adequate size must be provided. The number of bytes copied into the buffer
@@ -825,7 +856,7 @@ BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue,
* otherwise pdFALSE. * otherwise pdFALSE.
* *
* Example usage: * Example usage:
* <pre> * @code{c}
* struct AMessage * struct AMessage
* { * {
* char ucMessageID; * char ucMessageID;
@@ -875,7 +906,7 @@ BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue,
* *
* // ... Rest of task code. * // ... Rest of task code.
* } * }
* </pre> * @endcode
* \defgroup xQueueReceive xQueueReceive * \defgroup xQueueReceive xQueueReceive
* \ingroup QueueManagement * \ingroup QueueManagement
*/ */
@@ -885,9 +916,9 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue,
/** /**
* queue. h * queue. h
* <pre> * @code{c}
* UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue ); * UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue );
* </pre> * @endcode
* *
* Return the number of messages stored in a queue. * Return the number of messages stored in a queue.
* *
@@ -902,9 +933,9 @@ UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue ) PRIVILEGED_FUNC
/** /**
* queue. h * queue. h
* <pre> * @code{c}
* UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue ); * UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue );
* </pre> * @endcode
* *
* Return the number of free spaces available in a queue. This is equal to the * Return the number of free spaces available in a queue. This is equal to the
* number of items that can be sent to the queue before the queue becomes full * number of items that can be sent to the queue before the queue becomes full
@@ -921,9 +952,9 @@ UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue ) PRIVILEGED_FUNC
/** /**
* queue. h * queue. h
* <pre> * @code{c}
* void vQueueDelete( QueueHandle_t xQueue ); * void vQueueDelete( QueueHandle_t xQueue );
* </pre> * @endcode
* *
* Delete a queue - freeing all the memory allocated for storing of items * Delete a queue - freeing all the memory allocated for storing of items
* placed on the queue. * placed on the queue.
@@ -937,13 +968,13 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
/** /**
* queue. h * queue. h
* <pre> * @code{c}
* BaseType_t xQueueSendToFrontFromISR( * BaseType_t xQueueSendToFrontFromISR(
* QueueHandle_t xQueue, * QueueHandle_t xQueue,
* const void *pvItemToQueue, * const void *pvItemToQueue,
* BaseType_t *pxHigherPriorityTaskWoken * BaseType_t *pxHigherPriorityTaskWoken
* ); * );
* </pre> * @endcode
* *
* This is a macro that calls xQueueGenericSendFromISR(). * This is a macro that calls xQueueGenericSendFromISR().
* *
@@ -964,7 +995,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
* @param pxHigherPriorityTaskWoken xQueueSendToFrontFromISR() will set * @param pxHigherPriorityTaskWoken xQueueSendToFrontFromISR() will set
* *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task * *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task
* to unblock, and the unblocked task has a priority higher than the currently * to unblock, and the unblocked task has a priority higher than the currently
* running task. If xQueueSendToFromFromISR() sets this value to pdTRUE then * running task. If xQueueSendToFrontFromISR() sets this value to pdTRUE then
* a context switch should be requested before the interrupt is exited. * a context switch should be requested before the interrupt is exited.
* *
* @return pdTRUE if the data was successfully sent to the queue, otherwise * @return pdTRUE if the data was successfully sent to the queue, otherwise
@@ -972,11 +1003,11 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
* *
* Example usage for buffered IO (where the ISR can obtain more than one value * Example usage for buffered IO (where the ISR can obtain more than one value
* per call): * per call):
* <pre> * @code{c}
* void vBufferISR( void ) * void vBufferISR( void )
* { * {
* char cIn; * char cIn;
* BaseType_t xHigherPrioritTaskWoken; * BaseType_t xHigherPriorityTaskWoken;
* *
* // We have not woken a task at the start of the ISR. * // We have not woken a task at the start of the ISR.
* xHigherPriorityTaskWoken = pdFALSE; * xHigherPriorityTaskWoken = pdFALSE;
@@ -998,7 +1029,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
* taskYIELD (); * taskYIELD ();
* } * }
* } * }
* </pre> * @endcode
* *
* \defgroup xQueueSendFromISR xQueueSendFromISR * \defgroup xQueueSendFromISR xQueueSendFromISR
* \ingroup QueueManagement * \ingroup QueueManagement
@@ -1009,13 +1040,13 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
/** /**
* queue. h * queue. h
* <pre> * @code{c}
* BaseType_t xQueueSendToBackFromISR( * BaseType_t xQueueSendToBackFromISR(
* QueueHandle_t xQueue, * QueueHandle_t xQueue,
* const void *pvItemToQueue, * const void *pvItemToQueue,
* BaseType_t *pxHigherPriorityTaskWoken * BaseType_t *pxHigherPriorityTaskWoken
* ); * );
* </pre> * @endcode
* *
* This is a macro that calls xQueueGenericSendFromISR(). * This is a macro that calls xQueueGenericSendFromISR().
* *
@@ -1044,7 +1075,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
* *
* Example usage for buffered IO (where the ISR can obtain more than one value * Example usage for buffered IO (where the ISR can obtain more than one value
* per call): * per call):
* <pre> * @code{c}
* void vBufferISR( void ) * void vBufferISR( void )
* { * {
* char cIn; * char cIn;
@@ -1070,7 +1101,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
* taskYIELD (); * taskYIELD ();
* } * }
* } * }
* </pre> * @endcode
* *
* \defgroup xQueueSendFromISR xQueueSendFromISR * \defgroup xQueueSendFromISR xQueueSendFromISR
* \ingroup QueueManagement * \ingroup QueueManagement
@@ -1080,13 +1111,13 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
/** /**
* queue. h * queue. h
* <pre> * @code{c}
* BaseType_t xQueueOverwriteFromISR( * BaseType_t xQueueOverwriteFromISR(
* QueueHandle_t xQueue, * QueueHandle_t xQueue,
* const void * pvItemToQueue, * const void * pvItemToQueue,
* BaseType_t *pxHigherPriorityTaskWoken * BaseType_t *pxHigherPriorityTaskWoken
* ); * );
* </pre> * @endcode
* *
* A version of xQueueOverwrite() that can be used in an interrupt service * A version of xQueueOverwrite() that can be used in an interrupt service
* routine (ISR). * routine (ISR).
@@ -1117,7 +1148,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
* the queue is already full. * the queue is already full.
* *
* Example usage: * Example usage:
* <pre> * @code{c}
* *
* QueueHandle_t xQueue; * QueueHandle_t xQueue;
* *
@@ -1154,12 +1185,15 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
* { * {
* // Writing to the queue caused a task to unblock and the unblocked task * // Writing to the queue caused a task to unblock and the unblocked task
* // has a priority higher than or equal to the priority of the currently * // has a priority higher than or equal to the priority of the currently
* // executing task (the task this interrupt interrupted). Perform a context * // executing task (the task this interrupt interrupted). Perform a context
* // switch so this interrupt returns directly to the unblocked task. * // switch so this interrupt returns directly to the unblocked task.
* portYIELD_FROM_ISR(); // or portEND_SWITCHING_ISR() depending on the port. * // The macro used is port specific and will be either
* // portYIELD_FROM_ISR() or portEND_SWITCHING_ISR() - refer to the documentation
* // page for the port being used.
* portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
* } * }
* } * }
* </pre> * @endcode
* \defgroup xQueueOverwriteFromISR xQueueOverwriteFromISR * \defgroup xQueueOverwriteFromISR xQueueOverwriteFromISR
* \ingroup QueueManagement * \ingroup QueueManagement
*/ */
@@ -1168,13 +1202,13 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
/** /**
* queue. h * queue. h
* <pre> * @code{c}
* BaseType_t xQueueSendFromISR( * BaseType_t xQueueSendFromISR(
* QueueHandle_t xQueue, * QueueHandle_t xQueue,
* const void *pvItemToQueue, * const void *pvItemToQueue,
* BaseType_t *pxHigherPriorityTaskWoken * BaseType_t *pxHigherPriorityTaskWoken
* ); * );
* </pre> * @endcode
* *
* This is a macro that calls xQueueGenericSendFromISR(). It is included * This is a macro that calls xQueueGenericSendFromISR(). It is included
* for backward compatibility with versions of FreeRTOS.org that did not * for backward compatibility with versions of FreeRTOS.org that did not
@@ -1206,7 +1240,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
* *
* Example usage for buffered IO (where the ISR can obtain more than one value * Example usage for buffered IO (where the ISR can obtain more than one value
* per call): * per call):
* <pre> * @code{c}
* void vBufferISR( void ) * void vBufferISR( void )
* { * {
* char cIn; * char cIn;
@@ -1229,11 +1263,14 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
* // Now the buffer is empty we can switch context if necessary. * // Now the buffer is empty we can switch context if necessary.
* if( xHigherPriorityTaskWoken ) * if( xHigherPriorityTaskWoken )
* { * {
* // Actual macro used here is port specific. * // As xHigherPriorityTaskWoken is now set to pdTRUE then a context
* portYIELD_FROM_ISR (); * // switch should be requested. The macro used is port specific and
* // will be either portYIELD_FROM_ISR() or portEND_SWITCHING_ISR() -
* // refer to the documentation page for the port being used.
* portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
* } * }
* } * }
* </pre> * @endcode
* *
* \defgroup xQueueSendFromISR xQueueSendFromISR * \defgroup xQueueSendFromISR xQueueSendFromISR
* \ingroup QueueManagement * \ingroup QueueManagement
@@ -1243,14 +1280,14 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
/** /**
* queue. h * queue. h
* <pre> * @code{c}
* BaseType_t xQueueGenericSendFromISR( * BaseType_t xQueueGenericSendFromISR(
* QueueHandle_t xQueue, * QueueHandle_t xQueue,
* const void *pvItemToQueue, * const void *pvItemToQueue,
* BaseType_t *pxHigherPriorityTaskWoken, * BaseType_t *pxHigherPriorityTaskWoken,
* BaseType_t xCopyPosition * BaseType_t xCopyPosition
* ); * );
* </pre> * @endcode
* *
* It is preferred that the macros xQueueSendFromISR(), * It is preferred that the macros xQueueSendFromISR(),
* xQueueSendToFrontFromISR() and xQueueSendToBackFromISR() be used in place * xQueueSendToFrontFromISR() and xQueueSendToBackFromISR() be used in place
@@ -1286,7 +1323,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
* *
* Example usage for buffered IO (where the ISR can obtain more than one value * Example usage for buffered IO (where the ISR can obtain more than one value
* per call): * per call):
* <pre> * @code{c}
* void vBufferISR( void ) * void vBufferISR( void )
* { * {
* char cIn; * char cIn;
@@ -1306,14 +1343,17 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
* *
* } while( portINPUT_BYTE( BUFFER_COUNT ) ); * } while( portINPUT_BYTE( BUFFER_COUNT ) );
* *
* // Now the buffer is empty we can switch context if necessary. Note that the * // Now the buffer is empty we can switch context if necessary.
* // name of the yield function required is port specific.
* if( xHigherPriorityTaskWokenByPost ) * if( xHigherPriorityTaskWokenByPost )
* { * {
* portYIELD_FROM_ISR(); * // As xHigherPriorityTaskWokenByPost is now set to pdTRUE then a context
* // switch should be requested. The macro used is port specific and
* // will be either portYIELD_FROM_ISR() or portEND_SWITCHING_ISR() -
* // refer to the documentation page for the port being used.
* portYIELD_FROM_ISR( xHigherPriorityTaskWokenByPost );
* } * }
* } * }
* </pre> * @endcode
* *
* \defgroup xQueueSendFromISR xQueueSendFromISR * \defgroup xQueueSendFromISR xQueueSendFromISR
* \ingroup QueueManagement * \ingroup QueueManagement
@@ -1327,13 +1367,13 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
/** /**
* queue. h * queue. h
* <pre> * @code{c}
* BaseType_t xQueueReceiveFromISR( * BaseType_t xQueueReceiveFromISR(
* QueueHandle_t xQueue, * QueueHandle_t xQueue,
* void *pvBuffer, * void *pvBuffer,
* BaseType_t *pxTaskWoken * BaseType_t *pxTaskWoken
* ); * );
* </pre> * @endcode
* *
* Receive an item from a queue. It is safe to use this function from within an * Receive an item from a queue. It is safe to use this function from within an
* interrupt service routine. * interrupt service routine.
@@ -1344,16 +1384,16 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
* @param pvBuffer Pointer to the buffer into which the received item will * @param pvBuffer Pointer to the buffer into which the received item will
* be copied. * be copied.
* *
* @param pxTaskWoken A task may be blocked waiting for space to become * @param pxHigherPriorityTaskWoken A task may be blocked waiting for space to
* available on the queue. If xQueueReceiveFromISR causes such a task to * become available on the queue. If xQueueReceiveFromISR causes such a task
* unblock *pxTaskWoken will get set to pdTRUE, otherwise *pxTaskWoken will * to unblock *pxTaskWoken will get set to pdTRUE, otherwise *pxTaskWoken will
* remain unchanged. * remain unchanged.
* *
* @return pdTRUE if an item was successfully received from the queue, * @return pdTRUE if an item was successfully received from the queue,
* otherwise pdFALSE. * otherwise pdFALSE.
* *
* Example usage: * Example usage:
* <pre> * @code{c}
* *
* QueueHandle_t xQueue; * QueueHandle_t xQueue;
* *
@@ -1398,17 +1438,17 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
* vOutputCharacter( cRxedChar ); * vOutputCharacter( cRxedChar );
* *
* // If removing the character from the queue woke the task that was * // If removing the character from the queue woke the task that was
* // posting onto the queue cTaskWokenByReceive will have been set to * // posting onto the queue xTaskWokenByReceive will have been set to
* // pdTRUE. No matter how many times this loop iterates only one * // pdTRUE. No matter how many times this loop iterates only one
* // task will be woken. * // task will be woken.
* } * }
* *
* if( cTaskWokenByPost != ( char ) pdFALSE; * if( xTaskWokenByReceive != ( char ) pdFALSE;
* { * {
* taskYIELD (); * taskYIELD ();
* } * }
* } * }
* </pre> * @endcode
* \defgroup xQueueReceiveFromISR xQueueReceiveFromISR * \defgroup xQueueReceiveFromISR xQueueReceiveFromISR
* \ingroup QueueManagement * \ingroup QueueManagement
*/ */
@@ -1418,12 +1458,14 @@ BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue,
/* /*
* Utilities to query queues that are safe to use from an ISR. These utilities * Utilities to query queues that are safe to use from an ISR. These utilities
* should be used only from witin an ISR, or within a critical section. * should be used only from within an ISR, or within a critical section.
*/ */
BaseType_t xQueueIsQueueEmptyFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; BaseType_t xQueueIsQueueEmptyFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
UBaseType_t uxQueueMessagesWaitingFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; UBaseType_t uxQueueMessagesWaitingFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
#if ( configUSE_CO_ROUTINES == 1 )
/* /*
* The functions defined above are for passing data to and from tasks. The * The functions defined above are for passing data to and from tasks. The
* functions below are the equivalents for passing data to and from * functions below are the equivalents for passing data to and from
@@ -1433,18 +1475,20 @@ UBaseType_t uxQueueMessagesWaitingFromISR( const QueueHandle_t xQueue ) PRIVILEG
* should not be called directly from application code. Instead use the macro * should not be called directly from application code. Instead use the macro
* wrappers defined within croutine.h. * wrappers defined within croutine.h.
*/ */
BaseType_t xQueueCRSendFromISR( QueueHandle_t xQueue, BaseType_t xQueueCRSendFromISR( QueueHandle_t xQueue,
const void * pvItemToQueue, const void * pvItemToQueue,
BaseType_t xCoRoutinePreviouslyWoken ); BaseType_t xCoRoutinePreviouslyWoken );
BaseType_t xQueueCRReceiveFromISR( QueueHandle_t xQueue, BaseType_t xQueueCRReceiveFromISR( QueueHandle_t xQueue,
void * pvBuffer, void * pvBuffer,
BaseType_t * pxTaskWoken ); BaseType_t * pxTaskWoken );
BaseType_t xQueueCRSend( QueueHandle_t xQueue, BaseType_t xQueueCRSend( QueueHandle_t xQueue,
const void * pvItemToQueue, const void * pvItemToQueue,
TickType_t xTicksToWait ); TickType_t xTicksToWait );
BaseType_t xQueueCRReceive( QueueHandle_t xQueue, BaseType_t xQueueCRReceive( QueueHandle_t xQueue,
void * pvBuffer, void * pvBuffer,
TickType_t xTicksToWait ); TickType_t xTicksToWait );
#endif /* if ( configUSE_CO_ROUTINES == 1 ) */
/* /*
* For internal use only. Use xSemaphoreCreateMutex(), * For internal use only. Use xSemaphoreCreateMutex(),
@@ -1452,21 +1496,34 @@ BaseType_t xQueueCRReceive( QueueHandle_t xQueue,
* these functions directly. * these functions directly.
*/ */
QueueHandle_t xQueueCreateMutex( const uint8_t ucQueueType ) PRIVILEGED_FUNCTION; QueueHandle_t xQueueCreateMutex( const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
QueueHandle_t xQueueCreateMutexStatic( const uint8_t ucQueueType,
StaticQueue_t * pxStaticQueue ) PRIVILEGED_FUNCTION; #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
QueueHandle_t xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount, QueueHandle_t xQueueCreateMutexStatic( const uint8_t ucQueueType,
const UBaseType_t uxInitialCount ) PRIVILEGED_FUNCTION; StaticQueue_t * pxStaticQueue ) PRIVILEGED_FUNCTION;
QueueHandle_t xQueueCreateCountingSemaphoreStatic( const UBaseType_t uxMaxCount, #endif
const UBaseType_t uxInitialCount,
StaticQueue_t * pxStaticQueue ) PRIVILEGED_FUNCTION; #if ( configUSE_COUNTING_SEMAPHORES == 1 )
QueueHandle_t xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount,
const UBaseType_t uxInitialCount ) PRIVILEGED_FUNCTION;
#endif
#if ( ( configUSE_COUNTING_SEMAPHORES == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
QueueHandle_t xQueueCreateCountingSemaphoreStatic( const UBaseType_t uxMaxCount,
const UBaseType_t uxInitialCount,
StaticQueue_t * pxStaticQueue ) PRIVILEGED_FUNCTION;
#endif
BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue, BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue,
TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
TaskHandle_t xQueueGetMutexHolder( QueueHandle_t xSemaphore ) PRIVILEGED_FUNCTION;
TaskHandle_t xQueueGetMutexHolderFromISR( QueueHandle_t xSemaphore ) PRIVILEGED_FUNCTION; #if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) )
TaskHandle_t xQueueGetMutexHolder( QueueHandle_t xSemaphore ) PRIVILEGED_FUNCTION;
TaskHandle_t xQueueGetMutexHolderFromISR( QueueHandle_t xSemaphore ) PRIVILEGED_FUNCTION;
#endif
/* /*
* For internal use only. Use xSemaphoreTakeMutexRecursive() or * For internal use only. Use xSemaphoreTakeRecursive() or
* xSemaphoreGiveMutexRecursive() instead of calling these functions directly. * xSemaphoreGiveRecursive() instead of calling these functions directly.
*/ */
BaseType_t xQueueTakeMutexRecursive( QueueHandle_t xMutex, BaseType_t xQueueTakeMutexRecursive( QueueHandle_t xMutex,
TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
@@ -1476,7 +1533,7 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex ) PRIVILEGED_FUNCTION;
* Reset a queue back to its original empty state. The return value is now * Reset a queue back to its original empty state. The return value is now
* obsolete and is always set to pdPASS. * obsolete and is always set to pdPASS.
*/ */
#define xQueueReset( xQueue ) xQueueGenericReset( xQueue, pdFALSE ) #define xQueueReset( xQueue ) xQueueGenericReset( ( xQueue ), pdFALSE )
/* /*
* The registry is provided as a means for kernel aware debuggers to * The registry is provided as a means for kernel aware debuggers to
@@ -1488,21 +1545,25 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex ) PRIVILEGED_FUNCTION;
* configQUEUE_REGISTRY_SIZE defines the maximum number of handles the * configQUEUE_REGISTRY_SIZE defines the maximum number of handles the
* registry can hold. configQUEUE_REGISTRY_SIZE must be greater than 0 * registry can hold. configQUEUE_REGISTRY_SIZE must be greater than 0
* within FreeRTOSConfig.h for the registry to be available. Its value * within FreeRTOSConfig.h for the registry to be available. Its value
* does not effect the number of queues, semaphores and mutexes that can be * does not affect the number of queues, semaphores and mutexes that can be
* created - just the number that the registry can hold. * created - just the number that the registry can hold.
* *
* If vQueueAddToRegistry is called more than once with the same xQueue
* parameter, the registry will store the pcQueueName parameter from the
* most recent call to vQueueAddToRegistry.
*
* @param xQueue The handle of the queue being added to the registry. This * @param xQueue The handle of the queue being added to the registry. This
* is the handle returned by a call to xQueueCreate(). Semaphore and mutex * is the handle returned by a call to xQueueCreate(). Semaphore and mutex
* handles can also be passed in here. * handles can also be passed in here.
* *
* @param pcName The name to be associated with the handle. This is the * @param pcQueueName The name to be associated with the handle. This is the
* name that the kernel aware debugger will display. The queue registry only * name that the kernel aware debugger will display. The queue registry only
* stores a pointer to the string - so the string must be persistent (global or * stores a pointer to the string - so the string must be persistent (global or
* preferably in ROM/Flash), not on the stack. * preferably in ROM/Flash), not on the stack.
*/ */
#if ( configQUEUE_REGISTRY_SIZE > 0 ) #if ( configQUEUE_REGISTRY_SIZE > 0 )
void vQueueAddToRegistry( QueueHandle_t xQueue, void vQueueAddToRegistry( QueueHandle_t xQueue,
const char * pcQueueName ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ const char * pcQueueName ) PRIVILEGED_FUNCTION;
#endif #endif
/* /*
@@ -1531,7 +1592,7 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex ) PRIVILEGED_FUNCTION;
* returned. * returned.
*/ */
#if ( configQUEUE_REGISTRY_SIZE > 0 ) #if ( configQUEUE_REGISTRY_SIZE > 0 )
const char * pcQueueGetName( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ const char * pcQueueGetName( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
#endif #endif
/* /*
@@ -1558,6 +1619,18 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex ) PRIVILEGED_FUNCTION;
const uint8_t ucQueueType ) PRIVILEGED_FUNCTION; const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
#endif #endif
/*
* Generic version of the function used to retrieve the buffers of statically
* created queues. This is called by other functions and macros that retrieve
* the buffers of other statically created RTOS objects that use the queue
* structure as their base.
*/
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
BaseType_t xQueueGenericGetStaticBuffers( QueueHandle_t xQueue,
uint8_t ** ppucQueueStorage,
StaticQueue_t ** ppxStaticQueue ) PRIVILEGED_FUNCTION;
#endif
/* /*
* Queue sets provide a mechanism to allow a task to block (pend) on a read * Queue sets provide a mechanism to allow a task to block (pend) on a read
* operation from multiple queues or semaphores simultaneously. * operation from multiple queues or semaphores simultaneously.
@@ -1572,7 +1645,7 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex ) PRIVILEGED_FUNCTION;
* or semaphores contained in the set is in a state where a queue read or * or semaphores contained in the set is in a state where a queue read or
* semaphore take operation would be successful. * semaphore take operation would be successful.
* *
* Note 1: See the documentation on http://wwwFreeRTOS.org/RTOS-queue-sets.html * Note 1: See the documentation on https://www.FreeRTOS.org/RTOS-queue-sets.html
* for reasons why queue sets are very rarely needed in practice as there are * for reasons why queue sets are very rarely needed in practice as there are
* simpler methods of blocking on multiple objects. * simpler methods of blocking on multiple objects.
* *
@@ -1606,7 +1679,9 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex ) PRIVILEGED_FUNCTION;
* @return If the queue set is created successfully then a handle to the created * @return If the queue set is created successfully then a handle to the created
* queue set is returned. Otherwise NULL is returned. * queue set is returned. Otherwise NULL is returned.
*/ */
QueueSetHandle_t xQueueCreateSet( const UBaseType_t uxEventQueueLength ) PRIVILEGED_FUNCTION; #if ( ( configUSE_QUEUE_SETS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
QueueSetHandle_t xQueueCreateSet( const UBaseType_t uxEventQueueLength ) PRIVILEGED_FUNCTION;
#endif
/* /*
* Adds a queue or semaphore to a queue set that was previously created by a * Adds a queue or semaphore to a queue set that was previously created by a
@@ -1630,8 +1705,10 @@ QueueSetHandle_t xQueueCreateSet( const UBaseType_t uxEventQueueLength ) PRIVILE
* queue set because it is already a member of a different queue set then pdFAIL * queue set because it is already a member of a different queue set then pdFAIL
* is returned. * is returned.
*/ */
BaseType_t xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore, #if ( configUSE_QUEUE_SETS == 1 )
QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION; BaseType_t xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore,
QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
#endif
/* /*
* Removes a queue or semaphore from a queue set. A queue or semaphore can only * Removes a queue or semaphore from a queue set. A queue or semaphore can only
@@ -1650,8 +1727,10 @@ BaseType_t xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore,
* then pdPASS is returned. If the queue was not in the queue set, or the * then pdPASS is returned. If the queue was not in the queue set, or the
* queue (or semaphore) was not empty, then pdFAIL is returned. * queue (or semaphore) was not empty, then pdFAIL is returned.
*/ */
BaseType_t xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore, #if ( configUSE_QUEUE_SETS == 1 )
QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION; BaseType_t xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore,
QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
#endif
/* /*
* xQueueSelectFromSet() selects from the members of a queue set a queue or * xQueueSelectFromSet() selects from the members of a queue set a queue or
@@ -1663,7 +1742,7 @@ BaseType_t xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore,
* See FreeRTOS/Source/Demo/Common/Minimal/QueueSet.c for an example using this * See FreeRTOS/Source/Demo/Common/Minimal/QueueSet.c for an example using this
* function. * function.
* *
* Note 1: See the documentation on http://wwwFreeRTOS.org/RTOS-queue-sets.html * Note 1: See the documentation on https://www.FreeRTOS.org/RTOS-queue-sets.html
* for reasons why queue sets are very rarely needed in practice as there are * for reasons why queue sets are very rarely needed in practice as there are
* simpler methods of blocking on multiple objects. * simpler methods of blocking on multiple objects.
* *
@@ -1687,13 +1766,17 @@ BaseType_t xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore,
* in the queue set that is available, or NULL if no such queue or semaphore * in the queue set that is available, or NULL if no such queue or semaphore
* exists before before the specified block time expires. * exists before before the specified block time expires.
*/ */
QueueSetMemberHandle_t xQueueSelectFromSet( QueueSetHandle_t xQueueSet, #if ( configUSE_QUEUE_SETS == 1 )
const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; QueueSetMemberHandle_t xQueueSelectFromSet( QueueSetHandle_t xQueueSet,
const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
#endif
/* /*
* A version of xQueueSelectFromSet() that can be used from an ISR. * A version of xQueueSelectFromSet() that can be used from an ISR.
*/ */
QueueSetMemberHandle_t xQueueSelectFromSetFromISR( QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION; #if ( configUSE_QUEUE_SETS == 1 )
QueueSetMemberHandle_t xQueueSelectFromSetFromISR( QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
#endif
/* Not public API functions. */ /* Not public API functions. */
void vQueueWaitForMessageRestricted( QueueHandle_t xQueue, void vQueueWaitForMessageRestricted( QueueHandle_t xQueue,
@@ -1701,11 +1784,22 @@ void vQueueWaitForMessageRestricted( QueueHandle_t xQueue,
const BaseType_t xWaitIndefinitely ) PRIVILEGED_FUNCTION; const BaseType_t xWaitIndefinitely ) PRIVILEGED_FUNCTION;
BaseType_t xQueueGenericReset( QueueHandle_t xQueue, BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
BaseType_t xNewQueue ) PRIVILEGED_FUNCTION; BaseType_t xNewQueue ) PRIVILEGED_FUNCTION;
void vQueueSetQueueNumber( QueueHandle_t xQueue,
UBaseType_t uxQueueNumber ) PRIVILEGED_FUNCTION;
UBaseType_t uxQueueGetQueueNumber( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
uint8_t ucQueueGetQueueType( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
#if ( configUSE_TRACE_FACILITY == 1 )
void vQueueSetQueueNumber( QueueHandle_t xQueue,
UBaseType_t uxQueueNumber ) PRIVILEGED_FUNCTION;
#endif
#if ( configUSE_TRACE_FACILITY == 1 )
UBaseType_t uxQueueGetQueueNumber( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
#endif
#if ( configUSE_TRACE_FACILITY == 1 )
uint8_t ucQueueGetQueueType( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
#endif
UBaseType_t uxQueueGetQueueItemSize( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
UBaseType_t uxQueueGetQueueLength( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
/* *INDENT-OFF* */ /* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus

File diff suppressed because it is too large Load Diff

View File

@@ -1,127 +1,141 @@
/* /*
* FreeRTOS Kernel V10.4.1 * FreeRTOS Kernel V11.1.0
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * SPDX-License-Identifier: MIT
* this software and associated documentation files (the "Software"), to deal in *
* the Software without restriction, including without limitation the rights to * Permission is hereby granted, free of charge, to any person obtaining a copy of
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * this software and associated documentation files (the "Software"), to deal in
* the Software, and to permit persons to whom the Software is furnished to do so, * the Software without restriction, including without limitation the rights to
* subject to the following conditions: * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* * the Software, and to permit persons to whom the Software is furnished to do so,
* The above copyright notice and this permission notice shall be included in all * subject to the following conditions:
* copies or substantial portions of the Software. *
* * The above copyright notice and this permission notice shall be included in all
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * copies or substantial portions of the Software.
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS *
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* https://www.FreeRTOS.org * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* https://github.com/FreeRTOS *
* * https://www.FreeRTOS.org
*/ * https://github.com/FreeRTOS
*
#ifndef STACK_MACROS_H */
#define STACK_MACROS_H
#ifndef STACK_MACROS_H
/* #define STACK_MACROS_H
* Call the stack overflow hook function if the stack of the task being swapped
* out is currently overflowed, or looks like it might have overflowed in the /*
* past. * Call the stack overflow hook function if the stack of the task being swapped
* * out is currently overflowed, or looks like it might have overflowed in the
* Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check * past.
* the current stack state only - comparing the current top of stack value to *
* the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1 * Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check
* will also cause the last few stack bytes to be checked to ensure the value * the current stack state only - comparing the current top of stack value to
* to which the bytes were set when the task was created have not been * the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1
* overwritten. Note this second test does not guarantee that an overflowed * will also cause the last few stack bytes to be checked to ensure the value
* stack will always be recognised. * to which the bytes were set when the task was created have not been
*/ * overwritten. Note this second test does not guarantee that an overflowed
* stack will always be recognised.
/*-----------------------------------------------------------*/ */
#if ( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) ) /*-----------------------------------------------------------*/
/* Only the current stack state is to be checked. */ /*
#define taskCHECK_FOR_STACK_OVERFLOW() \ * portSTACK_LIMIT_PADDING is a number of extra words to consider to be in
{ \ * use on the stack.
/* Is the currently saved stack pointer within the stack limit? */ \ */
if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \ #ifndef portSTACK_LIMIT_PADDING
{ \ #define portSTACK_LIMIT_PADDING 0
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ #endif
} \
} #if ( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) )
#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ /* Only the current stack state is to be checked. */
/*-----------------------------------------------------------*/ #define taskCHECK_FOR_STACK_OVERFLOW() \
do { \
#if ( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) ) /* Is the currently saved stack pointer within the stack limit? */ \
if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack + portSTACK_LIMIT_PADDING ) \
/* Only the current stack state is to be checked. */ { \
#define taskCHECK_FOR_STACK_OVERFLOW() \ char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \
{ \ vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \
\ } \
/* Is the currently saved stack pointer within the stack limit? */ \ } while( 0 )
if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \
{ \ #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ /*-----------------------------------------------------------*/
} \
} #if ( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) )
#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ /* Only the current stack state is to be checked. */
/*-----------------------------------------------------------*/ #define taskCHECK_FOR_STACK_OVERFLOW() \
do { \
#if ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) ) \
/* Is the currently saved stack pointer within the stack limit? */ \
#define taskCHECK_FOR_STACK_OVERFLOW() \ if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) \
{ \ { \
const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \ char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \
const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \ vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \
\ } \
if( ( pulStack[ 0 ] != ulCheckValue ) || \ } while( 0 )
( pulStack[ 1 ] != ulCheckValue ) || \
( pulStack[ 2 ] != ulCheckValue ) || \ #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
( pulStack[ 3 ] != ulCheckValue ) ) \ /*-----------------------------------------------------------*/
{ \
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ #if ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )
} \
} #define taskCHECK_FOR_STACK_OVERFLOW() \
do { \
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \
/*-----------------------------------------------------------*/ const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5U; \
\
#if ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) ) if( ( pulStack[ 0 ] != ulCheckValue ) || \
( pulStack[ 1 ] != ulCheckValue ) || \
#define taskCHECK_FOR_STACK_OVERFLOW() \ ( pulStack[ 2 ] != ulCheckValue ) || \
{ \ ( pulStack[ 3 ] != ulCheckValue ) ) \
int8_t * pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \ { \
static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ } \
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ } while( 0 )
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \
\ #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
\ /*-----------------------------------------------------------*/
pcEndOfStack -= sizeof( ucExpectedStackBytes ); \
\ #if ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) )
/* Has the extremity of the task stack ever been written over? */ \
if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \ #define taskCHECK_FOR_STACK_OVERFLOW() \
{ \ do { \
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ int8_t * pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \
} \ static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
} tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
/*-----------------------------------------------------------*/ tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \
\
/* Remove stack overflow macro if not being used. */ \
#ifndef taskCHECK_FOR_STACK_OVERFLOW pcEndOfStack -= sizeof( ucExpectedStackBytes ); \
#define taskCHECK_FOR_STACK_OVERFLOW() \
#endif /* Has the extremity of the task stack ever been written over? */ \
if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
{ \
char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \
#endif /* STACK_MACROS_H */ vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \
} \
} while( 0 )
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
/*-----------------------------------------------------------*/
/* Remove stack overflow macro if not being used. */
#ifndef taskCHECK_FOR_STACK_OVERFLOW
#define taskCHECK_FOR_STACK_OVERFLOW()
#endif
#endif /* STACK_MACROS_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,8 @@
/* /*
* FreeRTOS Kernel V10.4.1 * FreeRTOS Kernel V11.1.0
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* SPDX-License-Identifier: MIT
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in * this software and associated documentation files (the "Software"), to deal in
@@ -32,10 +34,8 @@
#error "include FreeRTOS.h must appear in source files before include timers.h" #error "include FreeRTOS.h must appear in source files before include timers.h"
#endif #endif
/*lint -save -e537 This headers are only multiply included if the application code
* happens to also be including task.h. */
#include "task.h" #include "task.h"
/*lint -restore */
/* *INDENT-OFF* */ /* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
@@ -86,13 +86,13 @@ typedef void (* TimerCallbackFunction_t)( TimerHandle_t xTimer );
* Defines the prototype to which functions used with the * Defines the prototype to which functions used with the
* xTimerPendFunctionCallFromISR() function must conform. * xTimerPendFunctionCallFromISR() function must conform.
*/ */
typedef void (* PendedFunction_t)( void *, typedef void (* PendedFunction_t)( void * arg1,
uint32_t ); uint32_t arg2 );
/** /**
* TimerHandle_t xTimerCreate( const char * const pcTimerName, * TimerHandle_t xTimerCreate( const char * const pcTimerName,
* TickType_t xTimerPeriodInTicks, * TickType_t xTimerPeriodInTicks,
* UBaseType_t uxAutoReload, * BaseType_t xAutoReload,
* void * pvTimerID, * void * pvTimerID,
* TimerCallbackFunction_t pxCallbackFunction ); * TimerCallbackFunction_t pxCallbackFunction );
* *
@@ -125,9 +125,9 @@ typedef void (* PendedFunction_t)( void *,
* to ( 500 / portTICK_PERIOD_MS ) provided configTICK_RATE_HZ is less than or * to ( 500 / portTICK_PERIOD_MS ) provided configTICK_RATE_HZ is less than or
* equal to 1000. Time timer period must be greater than 0. * equal to 1000. Time timer period must be greater than 0.
* *
* @param uxAutoReload If uxAutoReload is set to pdTRUE then the timer will * @param xAutoReload If xAutoReload is set to pdTRUE then the timer will
* expire repeatedly with a frequency set by the xTimerPeriodInTicks parameter. * expire repeatedly with a frequency set by the xTimerPeriodInTicks parameter.
* If uxAutoReload is set to pdFALSE then the timer will be a one-shot timer and * If xAutoReload is set to pdFALSE then the timer will be a one-shot timer and
* enter the dormant state after it expires. * enter the dormant state after it expires.
* *
* @param pvTimerID An identifier that is assigned to the timer being created. * @param pvTimerID An identifier that is assigned to the timer being created.
@@ -190,11 +190,11 @@ typedef void (* PendedFunction_t)( void *,
* // the scheduler starts. * // the scheduler starts.
* for( x = 0; x < NUM_TIMERS; x++ ) * for( x = 0; x < NUM_TIMERS; x++ )
* { * {
* xTimers[ x ] = xTimerCreate( "Timer", // Just a text name, not used by the kernel. * xTimers[ x ] = xTimerCreate( "Timer", // Just a text name, not used by the kernel.
* ( 100 * x ), // The timer period in ticks. * ( 100 * ( x + 1 ) ), // The timer period in ticks.
* pdTRUE, // The timers will auto-reload themselves when they expire. * pdTRUE, // The timers will auto-reload themselves when they expire.
* ( void * ) x, // Assign each timer a unique id equal to its array index. * ( void * ) x, // Assign each timer a unique id equal to its array index.
* vTimerCallback // Each timer calls the same callback when it expires. * vTimerCallback // Each timer calls the same callback when it expires.
* ); * );
* *
* if( xTimers[ x ] == NULL ) * if( xTimers[ x ] == NULL )
@@ -227,9 +227,9 @@ typedef void (* PendedFunction_t)( void *,
* @endverbatim * @endverbatim
*/ */
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
TimerHandle_t xTimerCreate( const char * const pcTimerName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ TimerHandle_t xTimerCreate( const char * const pcTimerName,
const TickType_t xTimerPeriodInTicks, const TickType_t xTimerPeriodInTicks,
const UBaseType_t uxAutoReload, const BaseType_t xAutoReload,
void * const pvTimerID, void * const pvTimerID,
TimerCallbackFunction_t pxCallbackFunction ) PRIVILEGED_FUNCTION; TimerCallbackFunction_t pxCallbackFunction ) PRIVILEGED_FUNCTION;
#endif #endif
@@ -237,7 +237,7 @@ typedef void (* PendedFunction_t)( void *,
/** /**
* TimerHandle_t xTimerCreateStatic(const char * const pcTimerName, * TimerHandle_t xTimerCreateStatic(const char * const pcTimerName,
* TickType_t xTimerPeriodInTicks, * TickType_t xTimerPeriodInTicks,
* UBaseType_t uxAutoReload, * BaseType_t xAutoReload,
* void * pvTimerID, * void * pvTimerID,
* TimerCallbackFunction_t pxCallbackFunction, * TimerCallbackFunction_t pxCallbackFunction,
* StaticTimer_t *pxTimerBuffer ); * StaticTimer_t *pxTimerBuffer );
@@ -271,9 +271,9 @@ typedef void (* PendedFunction_t)( void *,
* to ( 500 / portTICK_PERIOD_MS ) provided configTICK_RATE_HZ is less than or * to ( 500 / portTICK_PERIOD_MS ) provided configTICK_RATE_HZ is less than or
* equal to 1000. The timer period must be greater than 0. * equal to 1000. The timer period must be greater than 0.
* *
* @param uxAutoReload If uxAutoReload is set to pdTRUE then the timer will * @param xAutoReload If xAutoReload is set to pdTRUE then the timer will
* expire repeatedly with a frequency set by the xTimerPeriodInTicks parameter. * expire repeatedly with a frequency set by the xTimerPeriodInTicks parameter.
* If uxAutoReload is set to pdFALSE then the timer will be a one-shot timer and * If xAutoReload is set to pdFALSE then the timer will be a one-shot timer and
* enter the dormant state after it expires. * enter the dormant state after it expires.
* *
* @param pvTimerID An identifier that is assigned to the timer being created. * @param pvTimerID An identifier that is assigned to the timer being created.
@@ -357,9 +357,9 @@ typedef void (* PendedFunction_t)( void *,
* @endverbatim * @endverbatim
*/ */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 ) #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
TimerHandle_t xTimerCreateStatic( const char * const pcTimerName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ TimerHandle_t xTimerCreateStatic( const char * const pcTimerName,
const TickType_t xTimerPeriodInTicks, const TickType_t xTimerPeriodInTicks,
const UBaseType_t uxAutoReload, const BaseType_t xAutoReload,
void * const pvTimerID, void * const pvTimerID,
TimerCallbackFunction_t pxCallbackFunction, TimerCallbackFunction_t pxCallbackFunction,
StaticTimer_t * pxTimerBuffer ) PRIVILEGED_FUNCTION; StaticTimer_t * pxTimerBuffer ) PRIVILEGED_FUNCTION;
@@ -1196,10 +1196,12 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ) PRIVILEGED_FUNCTION;
* } * }
* @endverbatim * @endverbatim
*/ */
BaseType_t xTimerPendFunctionCallFromISR( PendedFunction_t xFunctionToPend, #if ( INCLUDE_xTimerPendFunctionCall == 1 )
void * pvParameter1, BaseType_t xTimerPendFunctionCallFromISR( PendedFunction_t xFunctionToPend,
uint32_t ulParameter2, void * pvParameter1,
BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION; uint32_t ulParameter2,
BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
#endif
/** /**
* BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend, * BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend,
@@ -1233,10 +1235,12 @@ BaseType_t xTimerPendFunctionCallFromISR( PendedFunction_t xFunctionToPend,
* timer daemon task, otherwise pdFALSE is returned. * timer daemon task, otherwise pdFALSE is returned.
* *
*/ */
BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend, #if ( INCLUDE_xTimerPendFunctionCall == 1 )
void * pvParameter1, BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend,
uint32_t ulParameter2, void * pvParameter1,
TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; uint32_t ulParameter2,
TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
#endif
/** /**
* const char * const pcTimerGetName( TimerHandle_t xTimer ); * const char * const pcTimerGetName( TimerHandle_t xTimer );
@@ -1247,10 +1251,10 @@ BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend,
* *
* @return The name assigned to the timer specified by the xTimer parameter. * @return The name assigned to the timer specified by the xTimer parameter.
*/ */
const char * pcTimerGetName( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ const char * pcTimerGetName( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
/** /**
* void vTimerSetReloadMode( TimerHandle_t xTimer, const UBaseType_t uxAutoReload ); * void vTimerSetReloadMode( TimerHandle_t xTimer, const BaseType_t xAutoReload );
* *
* Updates a timer to be either an auto-reload timer, in which case the timer * Updates a timer to be either an auto-reload timer, in which case the timer
* automatically resets itself each time it expires, or a one-shot timer, in * automatically resets itself each time it expires, or a one-shot timer, in
@@ -1258,14 +1262,28 @@ const char * pcTimerGetName( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; /*lint
* *
* @param xTimer The handle of the timer being updated. * @param xTimer The handle of the timer being updated.
* *
* @param uxAutoReload If uxAutoReload is set to pdTRUE then the timer will * @param xAutoReload If xAutoReload is set to pdTRUE then the timer will
* expire repeatedly with a frequency set by the timer's period (see the * expire repeatedly with a frequency set by the timer's period (see the
* xTimerPeriodInTicks parameter of the xTimerCreate() API function). If * xTimerPeriodInTicks parameter of the xTimerCreate() API function). If
* uxAutoReload is set to pdFALSE then the timer will be a one-shot timer and * xAutoReload is set to pdFALSE then the timer will be a one-shot timer and
* enter the dormant state after it expires. * enter the dormant state after it expires.
*/ */
void vTimerSetReloadMode( TimerHandle_t xTimer, void vTimerSetReloadMode( TimerHandle_t xTimer,
const UBaseType_t uxAutoReload ) PRIVILEGED_FUNCTION; const BaseType_t xAutoReload ) PRIVILEGED_FUNCTION;
/**
* BaseType_t xTimerGetReloadMode( TimerHandle_t xTimer );
*
* Queries a timer to determine if it is an auto-reload timer, in which case the timer
* automatically resets itself each time it expires, or a one-shot timer, in
* which case the timer will only expire once unless it is manually restarted.
*
* @param xTimer The handle of the timer being queried.
*
* @return If the timer is an auto-reload timer then pdTRUE is returned, otherwise
* pdFALSE is returned.
*/
BaseType_t xTimerGetReloadMode( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
/** /**
* UBaseType_t uxTimerGetReloadMode( TimerHandle_t xTimer ); * UBaseType_t uxTimerGetReloadMode( TimerHandle_t xTimer );
@@ -1307,17 +1325,54 @@ TickType_t xTimerGetPeriod( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
*/ */
TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
/**
* BaseType_t xTimerGetStaticBuffer( TimerHandle_t xTimer,
* StaticTimer_t ** ppxTimerBuffer );
*
* Retrieve pointer to a statically created timer's data structure
* buffer. This is the same buffer that is supplied at the time of
* creation.
*
* @param xTimer The timer for which to retrieve the buffer.
*
* @param ppxTaskBuffer Used to return a pointer to the timers's data
* structure buffer.
*
* @return pdTRUE if the buffer was retrieved, pdFALSE otherwise.
*/
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
BaseType_t xTimerGetStaticBuffer( TimerHandle_t xTimer,
StaticTimer_t ** ppxTimerBuffer ) PRIVILEGED_FUNCTION;
#endif /* configSUPPORT_STATIC_ALLOCATION */
/* /*
* Functions beyond this part are not part of the public API and are intended * Functions beyond this part are not part of the public API and are intended
* for use by the kernel only. * for use by the kernel only.
*/ */
BaseType_t xTimerCreateTimerTask( void ) PRIVILEGED_FUNCTION; BaseType_t xTimerCreateTimerTask( void ) PRIVILEGED_FUNCTION;
BaseType_t xTimerGenericCommand( TimerHandle_t xTimer,
const BaseType_t xCommandID,
const TickType_t xOptionalValue,
BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
/*
* Splitting the xTimerGenericCommand into two sub functions and making it a macro
* removes a recursion path when called from ISRs. This is primarily for the XCore
* XCC port which detects the recursion path and throws an error during compilation
* when this is not split.
*/
BaseType_t xTimerGenericCommandFromTask( TimerHandle_t xTimer,
const BaseType_t xCommandID,
const TickType_t xOptionalValue,
BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
BaseType_t xTimerGenericCommandFromISR( TimerHandle_t xTimer,
const BaseType_t xCommandID,
const TickType_t xOptionalValue,
BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
#define xTimerGenericCommand( xTimer, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait ) \
( ( xCommandID ) < tmrFIRST_FROM_ISR_COMMAND ? \
xTimerGenericCommandFromTask( xTimer, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait ) : \
xTimerGenericCommandFromISR( xTimer, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait ) )
#if ( configUSE_TRACE_FACILITY == 1 ) #if ( configUSE_TRACE_FACILITY == 1 )
void vTimerSetTimerNumber( TimerHandle_t xTimer, void vTimerSetTimerNumber( TimerHandle_t xTimer,
UBaseType_t uxTimerNumber ) PRIVILEGED_FUNCTION; UBaseType_t uxTimerNumber ) PRIVILEGED_FUNCTION;
@@ -1326,23 +1381,48 @@ BaseType_t xTimerGenericCommand( TimerHandle_t xTimer,
#if ( configSUPPORT_STATIC_ALLOCATION == 1 ) #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/** /**
* task.h * task.h
* <pre>void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, StackType_t ** ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) </pre> * @code{c}
* * void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, StackType_t ** ppxTimerTaskStackBuffer, configSTACK_DEPTH_TYPE * puxTimerTaskStackSize )
* This function is used to provide a statically allocated block of memory to FreeRTOS to hold the Timer Task TCB. This function is required when * @endcode
* configSUPPORT_STATIC_ALLOCATION is set. For more information see this URI: https://www.FreeRTOS.org/a00110.html#configSUPPORT_STATIC_ALLOCATION *
* * This function is used to provide a statically allocated block of memory to FreeRTOS to hold the Timer Task TCB. This function is required when
* @param ppxTimerTaskTCBBuffer A handle to a statically allocated TCB buffer * configSUPPORT_STATIC_ALLOCATION is set. For more information see this URI: https://www.FreeRTOS.org/a00110.html#configSUPPORT_STATIC_ALLOCATION
* @param ppxTimerTaskStackBuffer A handle to a statically allocated Stack buffer for thie idle task *
* @param pulTimerTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer * @param ppxTimerTaskTCBBuffer A handle to a statically allocated TCB buffer
*/ * @param ppxTimerTaskStackBuffer A handle to a statically allocated Stack buffer for the idle task
* @param puxTimerTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer
*/
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
StackType_t ** ppxTimerTaskStackBuffer, StackType_t ** ppxTimerTaskStackBuffer,
uint32_t * pulTimerTaskStackSize ); configSTACK_DEPTH_TYPE * puxTimerTaskStackSize );
#endif #endif
#if ( configUSE_DAEMON_TASK_STARTUP_HOOK != 0 )
/**
* timers.h
* @code{c}
* void vApplicationDaemonTaskStartupHook( void );
* @endcode
*
* This hook function is called form the timer task once when the task starts running.
*/
/* MISRA Ref 8.6.1 [External linkage] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-86 */
/* coverity[misra_c_2012_rule_8_6_violation] */
void vApplicationDaemonTaskStartupHook( void );
#endif
/*
* This function resets the internal state of the timer module. It must be called
* by the application before restarting the scheduler.
*/
void vTimerResetState( void ) PRIVILEGED_FUNCTION;
/* *INDENT-OFF* */ /* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -1,210 +1,246 @@
/* /*
* FreeRTOS Kernel V10.4.1 * FreeRTOS Kernel V11.1.0
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * SPDX-License-Identifier: MIT
* this software and associated documentation files (the "Software"), to deal in *
* the Software without restriction, including without limitation the rights to * Permission is hereby granted, free of charge, to any person obtaining a copy of
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * this software and associated documentation files (the "Software"), to deal in
* the Software, and to permit persons to whom the Software is furnished to do so, * the Software without restriction, including without limitation the rights to
* subject to the following conditions: * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* * the Software, and to permit persons to whom the Software is furnished to do so,
* The above copyright notice and this permission notice shall be included in all * subject to the following conditions:
* copies or substantial portions of the Software. *
* * The above copyright notice and this permission notice shall be included in all
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * copies or substantial portions of the Software.
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS *
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* https://www.FreeRTOS.org * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* https://github.com/FreeRTOS *
* * https://www.FreeRTOS.org
*/ * https://github.com/FreeRTOS
*
*/
#include <stdlib.h>
/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining #include <stdlib.h>
* all the API functions to use the MPU wrappers. That should only be done when
* task.h is included from an application file. */ /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE * all the API functions to use the MPU wrappers. That should only be done when
* task.h is included from an application file. */
#include "FreeRTOS.h" #define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#include "list.h"
#include "FreeRTOS.h"
/* Lint e9021, e961 and e750 are suppressed as a MISRA exception justified #include "list.h"
* because the MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be
* defined for the header files above, but not in this file, in order to /* The MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be
* generate the correct privileged Vs unprivileged linkage and placement. */ * defined for the header files above, but not in this file, in order to
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750 !e9021. */ * generate the correct privileged Vs unprivileged linkage and placement. */
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
/*-----------------------------------------------------------
* PUBLIC LIST API documented in list.h /*-----------------------------------------------------------
*----------------------------------------------------------*/ * PUBLIC LIST API documented in list.h
*----------------------------------------------------------*/
void vListInitialise( List_t * const pxList )
{ void vListInitialise( List_t * const pxList )
/* The list structure contains a list item which is used to mark the {
* end of the list. To initialise the list the list end is inserted traceENTER_vListInitialise( pxList );
* as the only list entry. */
pxList->pxIndex = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */ /* The list structure contains a list item which is used to mark the
* end of the list. To initialise the list the list end is inserted
/* The list end value is the highest possible value in the list to * as the only list entry. */
* ensure it remains at the end of the list. */ pxList->pxIndex = ( ListItem_t * ) &( pxList->xListEnd );
pxList->xListEnd.xItemValue = portMAX_DELAY;
listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( &( pxList->xListEnd ) );
/* The list end next and previous pointers point to itself so we know
* when the list is empty. */ /* The list end value is the highest possible value in the list to
pxList->xListEnd.pxNext = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */ * ensure it remains at the end of the list. */
pxList->xListEnd.pxPrevious = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */ pxList->xListEnd.xItemValue = portMAX_DELAY;
pxList->uxNumberOfItems = ( UBaseType_t ) 0U; /* The list end next and previous pointers point to itself so we know
* when the list is empty. */
/* Write known values into the list if pxList->xListEnd.pxNext = ( ListItem_t * ) &( pxList->xListEnd );
* configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */ pxList->xListEnd.pxPrevious = ( ListItem_t * ) &( pxList->xListEnd );
listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList );
listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList ); /* Initialize the remaining fields of xListEnd when it is a proper ListItem_t */
} #if ( configUSE_MINI_LIST_ITEM == 0 )
/*-----------------------------------------------------------*/ {
pxList->xListEnd.pvOwner = NULL;
void vListInitialiseItem( ListItem_t * const pxItem ) pxList->xListEnd.pxContainer = NULL;
{ listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( &( pxList->xListEnd ) );
/* Make sure the list item is not recorded as being on a list. */ }
pxItem->pxContainer = NULL; #endif
/* Write known values into the list item if pxList->uxNumberOfItems = ( UBaseType_t ) 0U;
* configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ); /* Write known values into the list if
listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ); * configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
} listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList );
/*-----------------------------------------------------------*/ listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList );
void vListInsertEnd( List_t * const pxList, traceRETURN_vListInitialise();
ListItem_t * const pxNewListItem ) }
{ /*-----------------------------------------------------------*/
ListItem_t * const pxIndex = pxList->pxIndex;
void vListInitialiseItem( ListItem_t * const pxItem )
/* Only effective when configASSERT() is also defined, these tests may catch {
* the list data structures being overwritten in memory. They will not catch traceENTER_vListInitialiseItem( pxItem );
* data errors caused by incorrect configuration or use of FreeRTOS. */
listTEST_LIST_INTEGRITY( pxList ); /* Make sure the list item is not recorded as being on a list. */
listTEST_LIST_ITEM_INTEGRITY( pxNewListItem ); pxItem->pxContainer = NULL;
/* Insert a new list item into pxList, but rather than sort the list, /* Write known values into the list item if
* makes the new list item the last item to be removed by a call to * configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
* listGET_OWNER_OF_NEXT_ENTRY(). */ listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem );
pxNewListItem->pxNext = pxIndex; listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem );
pxNewListItem->pxPrevious = pxIndex->pxPrevious;
traceRETURN_vListInitialiseItem();
/* Only used during decision coverage testing. */ }
mtCOVERAGE_TEST_DELAY(); /*-----------------------------------------------------------*/
pxIndex->pxPrevious->pxNext = pxNewListItem; void vListInsertEnd( List_t * const pxList,
pxIndex->pxPrevious = pxNewListItem; ListItem_t * const pxNewListItem )
{
/* Remember which list the item is in. */ ListItem_t * const pxIndex = pxList->pxIndex;
pxNewListItem->pxContainer = pxList;
traceENTER_vListInsertEnd( pxList, pxNewListItem );
( pxList->uxNumberOfItems )++;
} /* Only effective when configASSERT() is also defined, these tests may catch
/*-----------------------------------------------------------*/ * the list data structures being overwritten in memory. They will not catch
* data errors caused by incorrect configuration or use of FreeRTOS. */
void vListInsert( List_t * const pxList, listTEST_LIST_INTEGRITY( pxList );
ListItem_t * const pxNewListItem ) listTEST_LIST_ITEM_INTEGRITY( pxNewListItem );
{
ListItem_t * pxIterator; /* Insert a new list item into pxList, but rather than sort the list,
const TickType_t xValueOfInsertion = pxNewListItem->xItemValue; * makes the new list item the last item to be removed by a call to
* listGET_OWNER_OF_NEXT_ENTRY(). */
/* Only effective when configASSERT() is also defined, these tests may catch pxNewListItem->pxNext = pxIndex;
* the list data structures being overwritten in memory. They will not catch pxNewListItem->pxPrevious = pxIndex->pxPrevious;
* data errors caused by incorrect configuration or use of FreeRTOS. */
listTEST_LIST_INTEGRITY( pxList ); /* Only used during decision coverage testing. */
listTEST_LIST_ITEM_INTEGRITY( pxNewListItem ); mtCOVERAGE_TEST_DELAY();
/* Insert the new list item into the list, sorted in xItemValue order. pxIndex->pxPrevious->pxNext = pxNewListItem;
* pxIndex->pxPrevious = pxNewListItem;
* If the list already contains a list item with the same item value then the
* new list item should be placed after it. This ensures that TCBs which are /* Remember which list the item is in. */
* stored in ready lists (all of which have the same xItemValue value) get a pxNewListItem->pxContainer = pxList;
* share of the CPU. However, if the xItemValue is the same as the back marker
* the iteration loop below will not end. Therefore the value is checked ( pxList->uxNumberOfItems ) = ( UBaseType_t ) ( pxList->uxNumberOfItems + 1U );
* first, and the algorithm slightly modified if necessary. */
if( xValueOfInsertion == portMAX_DELAY ) traceRETURN_vListInsertEnd();
{ }
pxIterator = pxList->xListEnd.pxPrevious; /*-----------------------------------------------------------*/
}
else void vListInsert( List_t * const pxList,
{ ListItem_t * const pxNewListItem )
/* *** NOTE *********************************************************** {
* If you find your application is crashing here then likely causes are ListItem_t * pxIterator;
* listed below. In addition see https://www.FreeRTOS.org/FAQHelp.html for const TickType_t xValueOfInsertion = pxNewListItem->xItemValue;
* more tips, and ensure configASSERT() is defined!
* https://www.FreeRTOS.org/a00110.html#configASSERT traceENTER_vListInsert( pxList, pxNewListItem );
*
* 1) Stack overflow - /* Only effective when configASSERT() is also defined, these tests may catch
* see https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html * the list data structures being overwritten in memory. They will not catch
* 2) Incorrect interrupt priority assignment, especially on Cortex-M * data errors caused by incorrect configuration or use of FreeRTOS. */
* parts where numerically high priority values denote low actual listTEST_LIST_INTEGRITY( pxList );
* interrupt priorities, which can seem counter intuitive. See listTEST_LIST_ITEM_INTEGRITY( pxNewListItem );
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html and the definition
* of configMAX_SYSCALL_INTERRUPT_PRIORITY on /* Insert the new list item into the list, sorted in xItemValue order.
* https://www.FreeRTOS.org/a00110.html *
* 3) Calling an API function from within a critical section or when * If the list already contains a list item with the same item value then the
* the scheduler is suspended, or calling an API function that does * new list item should be placed after it. This ensures that TCBs which are
* not end in "FromISR" from an interrupt. * stored in ready lists (all of which have the same xItemValue value) get a
* 4) Using a queue or semaphore before it has been initialised or * share of the CPU. However, if the xItemValue is the same as the back marker
* before the scheduler has been started (are interrupts firing * the iteration loop below will not end. Therefore the value is checked
* before vTaskStartScheduler() has been called?). * first, and the algorithm slightly modified if necessary. */
**********************************************************************/ if( xValueOfInsertion == portMAX_DELAY )
{
for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. *//*lint !e440 The iterator moves to a different value, not xValueOfInsertion. */ pxIterator = pxList->xListEnd.pxPrevious;
{ }
/* There is nothing to do here, just iterating to the wanted else
* insertion position. */ {
} /* *** NOTE ***********************************************************
} * If you find your application is crashing here then likely causes are
* listed below. In addition see https://www.FreeRTOS.org/FAQHelp.html for
pxNewListItem->pxNext = pxIterator->pxNext; * more tips, and ensure configASSERT() is defined!
pxNewListItem->pxNext->pxPrevious = pxNewListItem; * https://www.FreeRTOS.org/a00110.html#configASSERT
pxNewListItem->pxPrevious = pxIterator; *
pxIterator->pxNext = pxNewListItem; * 1) Stack overflow -
* see https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html
/* Remember which list the item is in. This allows fast removal of the * 2) Incorrect interrupt priority assignment, especially on Cortex-M
* item later. */ * parts where numerically high priority values denote low actual
pxNewListItem->pxContainer = pxList; * interrupt priorities, which can seem counter intuitive. See
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html and the definition
( pxList->uxNumberOfItems )++; * of configMAX_SYSCALL_INTERRUPT_PRIORITY on
} * https://www.FreeRTOS.org/a00110.html
/*-----------------------------------------------------------*/ * 3) Calling an API function from within a critical section or when
* the scheduler is suspended, or calling an API function that does
UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove ) * not end in "FromISR" from an interrupt.
{ * 4) Using a queue or semaphore before it has been initialised or
/* The list item knows which list it is in. Obtain the list from the list * before the scheduler has been started (are interrupts firing
* item. */ * before vTaskStartScheduler() has been called?).
List_t * const pxList = pxItemToRemove->pxContainer; * 5) If the FreeRTOS port supports interrupt nesting then ensure that
* the priority of the tick interrupt is at or below
pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious; * configMAX_SYSCALL_INTERRUPT_PRIORITY.
pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext; **********************************************************************/
/* Only used during decision coverage testing. */ for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext )
mtCOVERAGE_TEST_DELAY(); {
/* There is nothing to do here, just iterating to the wanted
/* Make sure the index is left pointing to a valid item. */ * insertion position. */
if( pxList->pxIndex == pxItemToRemove ) }
{ }
pxList->pxIndex = pxItemToRemove->pxPrevious;
} pxNewListItem->pxNext = pxIterator->pxNext;
else pxNewListItem->pxNext->pxPrevious = pxNewListItem;
{ pxNewListItem->pxPrevious = pxIterator;
mtCOVERAGE_TEST_MARKER(); pxIterator->pxNext = pxNewListItem;
}
/* Remember which list the item is in. This allows fast removal of the
pxItemToRemove->pxContainer = NULL; * item later. */
( pxList->uxNumberOfItems )--; pxNewListItem->pxContainer = pxList;
return pxList->uxNumberOfItems; ( pxList->uxNumberOfItems ) = ( UBaseType_t ) ( pxList->uxNumberOfItems + 1U );
}
/*-----------------------------------------------------------*/ traceRETURN_vListInsert();
}
/*-----------------------------------------------------------*/
UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove )
{
/* The list item knows which list it is in. Obtain the list from the list
* item. */
List_t * const pxList = pxItemToRemove->pxContainer;
traceENTER_uxListRemove( pxItemToRemove );
pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious;
pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext;
/* Only used during decision coverage testing. */
mtCOVERAGE_TEST_DELAY();
/* Make sure the index is left pointing to a valid item. */
if( pxList->pxIndex == pxItemToRemove )
{
pxList->pxIndex = pxItemToRemove->pxPrevious;
}
else
{
mtCOVERAGE_TEST_MARKER();
}
pxItemToRemove->pxContainer = NULL;
( pxList->uxNumberOfItems ) = ( UBaseType_t ) ( pxList->uxNumberOfItems - 1U );
traceRETURN_uxListRemove( pxList->uxNumberOfItems );
return pxList->uxNumberOfItems;
}
/*-----------------------------------------------------------*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff