From 9941284ebeb55a3539014da590dabc8ca179113f Mon Sep 17 00:00:00 2001 From: gitlab-runner Date: Fri, 31 May 2024 11:06:50 -0500 Subject: [PATCH] Upload abstraction-rtos [2455] --- RELEASE.md | 4 + include/COMPONENT_FREERTOS/cyabs_rtos_impl.h | 3 + include/COMPONENT_RTX/cyabs_rtos_impl.h | 3 + .../COMPONENT_CAT5/cyabs_rtos_impl_cat5.h | 98 +++++++++++++++++++ include/COMPONENT_THREADX/cyabs_rtos_impl.h | 34 ++++--- props.json | 2 +- .../cyabs_freertos_common.c | 8 ++ .../COMPONENT_FREERTOS/cyabs_rtos_freertos.c | 31 ++++++ source/COMPONENT_THREADX/cyabs_rtos_threadx.c | 11 ++- 9 files changed, 181 insertions(+), 13 deletions(-) create mode 100644 include/COMPONENT_THREADX/COMPONENT_CAT5/cyabs_rtos_impl_cat5.h mode change 100755 => 100644 source/COMPONENT_THREADX/cyabs_rtos_threadx.c diff --git a/RELEASE.md b/RELEASE.md index 1304888..02bbe58 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -16,6 +16,10 @@ The this release of the RTOS Abstraction API includes support for the following: * ThreadX ### What Changed? +#### v1.8.1 +Extended full support on CAT5. +#### v1.8.0 +Pre-production release for CAT5 only. Only one application thread is supported. The Scheduler API functions are not supported. #### v1.7.6 * FreeRTOS: vApplicationSleep issue fixed where sleep could not be entered in non-deeplseep idle mode. #### v1.7.5 diff --git a/include/COMPONENT_FREERTOS/cyabs_rtos_impl.h b/include/COMPONENT_FREERTOS/cyabs_rtos_impl.h index e537506..b1f351f 100644 --- a/include/COMPONENT_FREERTOS/cyabs_rtos_impl.h +++ b/include/COMPONENT_FREERTOS/cyabs_rtos_impl.h @@ -32,6 +32,9 @@ #include #include #include "stdbool.h" +#if !defined (COMPONENT_CAT5) +#include +#endif #if defined(CY_USING_HAL) #include "cyhal.h" #endif diff --git a/include/COMPONENT_RTX/cyabs_rtos_impl.h b/include/COMPONENT_RTX/cyabs_rtos_impl.h index 4511eed..013aba4 100644 --- a/include/COMPONENT_RTX/cyabs_rtos_impl.h +++ b/include/COMPONENT_RTX/cyabs_rtos_impl.h @@ -28,6 +28,9 @@ #include "cmsis_os2.h" #include "rtx_os.h" +#if !defined (COMPONENT_CAT5) +#include +#endif #ifdef __cplusplus extern "C" diff --git a/include/COMPONENT_THREADX/COMPONENT_CAT5/cyabs_rtos_impl_cat5.h b/include/COMPONENT_THREADX/COMPONENT_CAT5/cyabs_rtos_impl_cat5.h new file mode 100644 index 0000000..8ecf840 --- /dev/null +++ b/include/COMPONENT_THREADX/COMPONENT_CAT5/cyabs_rtos_impl_cat5.h @@ -0,0 +1,98 @@ +/***********************************************************************************************//** + * \file cyabs_rtos_impl_cat5.h + * + * \brief + * Internal definitions for RTOS abstraction layer specific to CAT5. + *************************************************************************************************** + * \copyright + * Copyright 2018-2022 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **************************************************************************************************/ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include "tx_api.h" +#include "cyhal_system.h" + + +/****************************************************** +* Type Definitions +******************************************************/ +#if defined (CYW55500A0) +// RTOS thread priority. Main thread priority is 24. +typedef enum +{ + CY_RTOS_PRIORITY_MIN = 0, /**< Minimum allowable Thread priority */ + CY_RTOS_PRIORITY_LOW = 1, /**< A low priority Thread */ + CY_RTOS_PRIORITY_BELOWNORMAL = 2, /**< A slightly below normal Thread priority */ + CY_RTOS_PRIORITY_NORMAL = 3, /**< The normal Thread priority */ + CY_RTOS_PRIORITY_ABOVENORMAL = 4, /**< A slightly elevated Thread priority */ + CY_RTOS_PRIORITY_HIGH = 5, /**< A high priority Thread */ + CY_RTOS_PRIORITY_REALTIME = 6, /**< Realtime Thread priority */ + CY_RTOS_PRIORITY_MAX = 7 /**< Maximum allowable Thread priority */ +} cy_thread_priority_t; +#else // if defined (CYW55500A0) +#if defined (CYW55500A1) //Main thread priority is 24.Range from 24-31 +#define MULTIPLY_FACTOR (1U) +#else +#define MULTIPLY_FACTOR (3U) //Main thread priority is 10.Range from 10-31 +#endif +// RTOS thread priority. +typedef enum +{ + CY_RTOS_PRIORITY_MIN = (TX_MAX_PRIORITIES-1), /**< Minimum + allowable + Thread + priority */ + CY_RTOS_PRIORITY_LOW = ((TX_MAX_PRIORITIES-1) - (MULTIPLY_FACTOR*1)), /**< A low + priority + Thread */ + CY_RTOS_PRIORITY_BELOWNORMAL = ((TX_MAX_PRIORITIES-1) - (MULTIPLY_FACTOR*2)), /**< A slightly + below normal + Thread + priority + */ + CY_RTOS_PRIORITY_NORMAL = ((TX_MAX_PRIORITIES-1) - (MULTIPLY_FACTOR*3)), /**< The normal + Thread + priority */ + CY_RTOS_PRIORITY_ABOVENORMAL = ((TX_MAX_PRIORITIES-1) - (MULTIPLY_FACTOR*4)), /**< A slightly + elevated + Thread + priority + */ + CY_RTOS_PRIORITY_HIGH = ((TX_MAX_PRIORITIES-1) - (MULTIPLY_FACTOR*5)), /**< A high + priority + Thread */ + CY_RTOS_PRIORITY_REALTIME = ((TX_MAX_PRIORITIES-1) - (MULTIPLY_FACTOR*6)), /**< Realtime + Thread + priority + */ + CY_RTOS_PRIORITY_MAX = ((TX_MAX_PRIORITIES-1) - (MULTIPLY_FACTOR*7)) /**< Maximum + allowable + Thread + priority */ +} cy_thread_priority_t; +#endif // if defined (CYW55500) + +#if defined(__cplusplus) +} +#endif diff --git a/include/COMPONENT_THREADX/cyabs_rtos_impl.h b/include/COMPONENT_THREADX/cyabs_rtos_impl.h index 43a6d25..277bfeb 100644 --- a/include/COMPONENT_THREADX/cyabs_rtos_impl.h +++ b/include/COMPONENT_THREADX/cyabs_rtos_impl.h @@ -28,15 +28,20 @@ #include #include - #include "tx_api.h" - #ifdef __cplusplus extern "C" { #endif +#if !defined (COMPONENT_CAT5) +#include +#else +#include "cyabs_rtos_impl_cat5.h" +#endif + + /****************************************************** * Constants ******************************************************/ @@ -49,18 +54,25 @@ extern "C" * Type Definitions ******************************************************/ -// RTOS thread priority +#if !defined (COMPONENT_CAT5) +// RTOS thread priority. See /ref cy_thread_priority_t in the +// cyabs_rtos_impl_cat5.h for the CAT5 thread priority definitions typedef enum { - CY_RTOS_PRIORITY_MIN = TX_MAX_PRIORITIES - 1, - CY_RTOS_PRIORITY_LOW = (TX_MAX_PRIORITIES * 6 / 7), - CY_RTOS_PRIORITY_BELOWNORMAL = (TX_MAX_PRIORITIES * 5 / 7), - CY_RTOS_PRIORITY_NORMAL = (TX_MAX_PRIORITIES * 4 / 7), - CY_RTOS_PRIORITY_ABOVENORMAL = (TX_MAX_PRIORITIES * 3 / 7), - CY_RTOS_PRIORITY_HIGH = (TX_MAX_PRIORITIES * 2 / 7), - CY_RTOS_PRIORITY_REALTIME = (TX_MAX_PRIORITIES * 1 / 7), - CY_RTOS_PRIORITY_MAX = 0 + CY_RTOS_PRIORITY_MIN = TX_MAX_PRIORITIES - 1, /**< Minumum allowable Thread + priority */ + CY_RTOS_PRIORITY_LOW = (TX_MAX_PRIORITIES * 6 / 7), /**< A low priority Thread */ + CY_RTOS_PRIORITY_BELOWNORMAL = (TX_MAX_PRIORITIES * 5 / 7), /**< A slightly below normal + Thread priority */ + CY_RTOS_PRIORITY_NORMAL = (TX_MAX_PRIORITIES * 4 / 7), /**< The normal Thread priority */ + CY_RTOS_PRIORITY_ABOVENORMAL = (TX_MAX_PRIORITIES * 3 / 7), /**< A slightly elevated Thread + priority */ + CY_RTOS_PRIORITY_HIGH = (TX_MAX_PRIORITIES * 2 / 7), /**< A high priority Thread */ + CY_RTOS_PRIORITY_REALTIME = (TX_MAX_PRIORITIES * 1 / 7), /**< Realtime Thread priority */ + CY_RTOS_PRIORITY_MAX = 0 /**< Maximum allowable Thread + priority */ } cy_thread_priority_t; +#endif // if !defined (COMPONENT_CAT5) typedef struct { diff --git a/props.json b/props.json index 3d7120e..658f661 100644 --- a/props.json +++ b/props.json @@ -2,6 +2,6 @@ "core": { "id": "83097955-1d6f-526e-97c4-75ce7920222f", "name": "abstraction-rtos", - "version": "1.7.6.39828" + "version": "1.8.1.41337" } } \ No newline at end of file diff --git a/source/COMPONENT_FREERTOS/cyabs_freertos_common.c b/source/COMPONENT_FREERTOS/cyabs_freertos_common.c index 78fccda..acd21e7 100644 --- a/source/COMPONENT_FREERTOS/cyabs_freertos_common.c +++ b/source/COMPONENT_FREERTOS/cyabs_freertos_common.c @@ -45,6 +45,9 @@ __WEAK void _cyhal_system_irq_clear_disabled_in_pending(void) #endif /* defined(CY_USING_HAL) */ +#if defined(FREERTOS_COMMON_SECTION_BEGIN) +FREERTOS_COMMON_SECTION_BEGIN +#endif //-------------------------------------------------------------------------------------------------- // convert_ms_to_ticks //-------------------------------------------------------------------------------------------------- @@ -76,3 +79,8 @@ cy_time_t convert_ms_to_ticks(cy_time_t timeout_ms) return (cy_time_t)ticks; } } + + +#if defined(FREERTOS_COMMON_SECTION_END) +FREERTOS_COMMON_SECTION_END +#endif diff --git a/source/COMPONENT_FREERTOS/cyabs_rtos_freertos.c b/source/COMPONENT_FREERTOS/cyabs_rtos_freertos.c index f70731a..1ef6345 100644 --- a/source/COMPONENT_FREERTOS/cyabs_rtos_freertos.c +++ b/source/COMPONENT_FREERTOS/cyabs_rtos_freertos.c @@ -499,6 +499,9 @@ cy_rslt_t cy_rtos_mutex_init(cy_mutex_t* mutex, bool recursive) } +#if defined(FREERTOS_COMMON_SECTION_BEGIN) +FREERTOS_COMMON_SECTION_BEGIN +#endif //-------------------------------------------------------------------------------------------------- // cy_rtos_mutex_get //-------------------------------------------------------------------------------------------------- @@ -524,6 +527,14 @@ cy_rslt_t cy_rtos_mutex_get(cy_mutex_t* mutex, cy_time_t timeout_ms) } +#if defined(FREERTOS_COMMON_SECTION_END) +FREERTOS_COMMON_SECTION_END +#endif + + +#if defined(FREERTOS_COMMON_SECTION_BEGIN) +FREERTOS_COMMON_SECTION_BEGIN +#endif //-------------------------------------------------------------------------------------------------- // cy_rtos_mutex_set //-------------------------------------------------------------------------------------------------- @@ -548,6 +559,10 @@ cy_rslt_t cy_rtos_mutex_set(cy_mutex_t* mutex) } +#if defined(FREERTOS_COMMON_SECTION_END) +FREERTOS_COMMON_SECTION_END +#endif + //-------------------------------------------------------------------------------------------------- // cy_rtos_mutex_deinit //-------------------------------------------------------------------------------------------------- @@ -930,6 +945,9 @@ cy_rslt_t cy_rtos_queue_init(cy_queue_t* queue, size_t length, size_t itemsize) } +#if defined(FREERTOS_COMMON_SECTION_BEGIN) +FREERTOS_COMMON_SECTION_BEGIN +#endif //-------------------------------------------------------------------------------------------------- // cy_rtos_queue_put //-------------------------------------------------------------------------------------------------- @@ -971,6 +989,14 @@ cy_rslt_t cy_rtos_queue_put(cy_queue_t* queue, const void* item_ptr, cy_time_t t } +#if defined(FREERTOS_COMMON_SECTION_END) +FREERTOS_COMMON_SECTION_END +#endif + + +#if defined(FREERTOS_COMMON_SECTION_BEGIN) +FREERTOS_COMMON_SECTION_BEGIN +#endif //-------------------------------------------------------------------------------------------------- // cy_rtos_queue_get //-------------------------------------------------------------------------------------------------- @@ -1012,6 +1038,11 @@ cy_rslt_t cy_rtos_queue_get(cy_queue_t* queue, void* item_ptr, cy_time_t timeout } +#if defined(FREERTOS_COMMON_SECTION_END) +FREERTOS_COMMON_SECTION_END +#endif + + //-------------------------------------------------------------------------------------------------- // cy_rtos_queue_count //-------------------------------------------------------------------------------------------------- diff --git a/source/COMPONENT_THREADX/cyabs_rtos_threadx.c b/source/COMPONENT_THREADX/cyabs_rtos_threadx.c old mode 100755 new mode 100644 index 0918476..292f5d6 --- a/source/COMPONENT_THREADX/cyabs_rtos_threadx.c +++ b/source/COMPONENT_THREADX/cyabs_rtos_threadx.c @@ -30,6 +30,9 @@ #include #include #include "cyabs_rtos_internal.h" +#if defined (COMPONENT_CAT5) +#include "cyabs_rtos_impl_cat5.h" +#endif #define WRAPPER_IDENT (0xABCDEF01U) #define MAX_QUEUE_MESSAGE_SIZE (16) @@ -435,8 +438,14 @@ static uint16_t _cy_rtos_suspend_count = 0; cy_rslt_t cy_rtos_scheduler_suspend(void) { ++_cy_rtos_suspend_count; + #if defined (COMPONENT_CAT5) + if (_cy_rtos_suspend_count == 1) + { + tx_interrupt_control(TX_INT_DISABLE); + } + #else tx_interrupt_control(TX_INT_DISABLE); - + #endif return CY_RSLT_SUCCESS; }