1 /***********************************************************************************************//**
2  * \file cyabs_rtos_impl.h
3  *
4  * \brief
5  * Internal definitions for RTOS abstraction layer
6  *
7  ***************************************************************************************************
8  * \copyright
9  * Copyright 2019-2021 Cypress Semiconductor Corporation (an Infineon company) or
10  * an affiliate of Cypress Semiconductor Corporation
11  *
12  * SPDX-License-Identifier: Apache-2.0
13  *
14  * Licensed under the Apache License, Version 2.0 (the "License");
15  * you may not use this file except in compliance with the License.
16  * You may obtain a copy of the License at
17  *
18  *     http://www.apache.org/licenses/LICENSE-2.0
19  *
20  * Unless required by applicable law or agreed to in writing, software
21  * distributed under the License is distributed on an "AS IS" BASIS,
22  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23  * See the License for the specific language governing permissions and
24  * limitations under the License.
25  **************************************************************************************************/
26 
27 #pragma once
28 
29 #include "cmsis_os2.h"
30 #include "rtx_os.h"
31 #if !defined (COMPONENT_CAT5)
32 #include <cmsis_compiler.h>
33 #endif
34 
35 #ifdef __cplusplus
36 extern "C"
37 {
38 #endif
39 
40 /******************************************************
41 *                 Constants
42 ******************************************************/
43 #define CY_RTOS_MIN_STACK_SIZE      300          /** Minimum stack size in bytes */
44 #define CY_RTOS_ALIGNMENT           0x00000008UL /** Minimum alignment for RTOS objects */
45 #define CY_RTOS_ALIGNMENT_MASK      0x00000007UL /** Mask for checking the alignment of
46                                                      created RTOS objects */
47 
48 
49 /******************************************************
50 *                 Type Definitions
51 ******************************************************/
52 
53 // RTOS thread priority
54 typedef enum
55 {
56     CY_RTOS_PRIORITY_MIN         = osPriorityNone,
57     CY_RTOS_PRIORITY_LOW         = osPriorityLow,
58     CY_RTOS_PRIORITY_BELOWNORMAL = osPriorityBelowNormal,
59     CY_RTOS_PRIORITY_NORMAL      = osPriorityNormal,
60     CY_RTOS_PRIORITY_ABOVENORMAL = osPriorityAboveNormal,
61     CY_RTOS_PRIORITY_HIGH        = osPriorityHigh,
62     CY_RTOS_PRIORITY_REALTIME    = osPriorityRealtime,
63     CY_RTOS_PRIORITY_MAX         = osPriorityRealtime7
64 } cy_thread_priority_t;
65 
66 typedef osThreadId_t       cy_thread_t;             /** CMSIS definition of a thread handle */
67 typedef void*              cy_thread_arg_t;         /** Argument passed to the entry function of
68                                                         a thread */
69 typedef osMutexId_t        cy_mutex_t;              /** CMSIS definition of a mutex */
70 typedef osSemaphoreId_t    cy_semaphore_t;          /** CMSIS definition of a semaphore */
71 typedef osEventFlagsId_t   cy_event_t;              /** CMSIS definition of an event */
72 typedef osMessageQueueId_t cy_queue_t;              /** CMSIS definition of a message queue */
73 typedef osTimerId_t        cy_timer_t;              /** CMSIS definition of a timer */
74 typedef void*              cy_timer_callback_arg_t; /** Argument passed to the timer callback
75                                                         function */
76 typedef uint32_t           cy_time_t;               /** Time in milliseconds */
77 typedef osStatus_t         cy_rtos_error_t;         /** CMSIS definition of a error status */
78 
79 #ifdef __cplusplus
80 } // extern "C"
81 #endif
82