Skip to content

Commit

Permalink
Upload abstraction-rtos [2455]
Browse files Browse the repository at this point in the history
  • Loading branch information
gitlab-runner committed May 31, 2024
1 parent 345e1b1 commit 9941284
Show file tree
Hide file tree
Showing 9 changed files with 181 additions and 13 deletions.
4 changes: 4 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions include/COMPONENT_FREERTOS/cyabs_rtos_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
#include <event_groups.h>
#include <timers.h>
#include "stdbool.h"
#if !defined (COMPONENT_CAT5)
#include <cmsis_compiler.h>
#endif
#if defined(CY_USING_HAL)
#include "cyhal.h"
#endif
Expand Down
3 changes: 3 additions & 0 deletions include/COMPONENT_RTX/cyabs_rtos_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@

#include "cmsis_os2.h"
#include "rtx_os.h"
#if !defined (COMPONENT_CAT5)
#include <cmsis_compiler.h>
#endif

#ifdef __cplusplus
extern "C"
Expand Down
98 changes: 98 additions & 0 deletions include/COMPONENT_THREADX/COMPONENT_CAT5/cyabs_rtos_impl_cat5.h
Original file line number Diff line number Diff line change
@@ -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 <stdbool.h>
#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
34 changes: 23 additions & 11 deletions include/COMPONENT_THREADX/cyabs_rtos_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,20 @@

#include <stdint.h>
#include <stdbool.h>

#include "tx_api.h"


#ifdef __cplusplus
extern "C"
{
#endif

#if !defined (COMPONENT_CAT5)
#include <cmsis_compiler.h>
#else
#include "cyabs_rtos_impl_cat5.h"
#endif


/******************************************************
* Constants
******************************************************/
Expand All @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion props.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"core": {
"id": "83097955-1d6f-526e-97c4-75ce7920222f",
"name": "abstraction-rtos",
"version": "1.7.6.39828"
"version": "1.8.1.41337"
}
}
8 changes: 8 additions & 0 deletions source/COMPONENT_FREERTOS/cyabs_freertos_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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
31 changes: 31 additions & 0 deletions source/COMPONENT_FREERTOS/cyabs_rtos_freertos.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
//--------------------------------------------------------------------------------------------------
Expand All @@ -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
//--------------------------------------------------------------------------------------------------
Expand All @@ -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
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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
//--------------------------------------------------------------------------------------------------
Expand Down
11 changes: 10 additions & 1 deletion source/COMPONENT_THREADX/cyabs_rtos_threadx.c
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
#include <tx_api.h>
#include <stdlib.h>
#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)
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 9941284

Please sign in to comment.