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 
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #endif
36 
37 /******************************************************
38 *                 Constants
39 ******************************************************/
40 #define CY_RTOS_MIN_STACK_SIZE      300          /** Minimum stack size in bytes */
41 #define CY_RTOS_ALIGNMENT           0x00000008UL /** Minimum alignment for RTOS objects */
42 #define CY_RTOS_ALIGNMENT_MASK      0x00000007UL /** Mask for checking the alignment of
43                                                      created RTOS objects */
44 
45 
46 /******************************************************
47 *                 Type Definitions
48 ******************************************************/
49 
50 // RTOS thread priority
51 typedef enum
52 {
53     CY_RTOS_PRIORITY_MIN         = osPriorityNone,
54     CY_RTOS_PRIORITY_LOW         = osPriorityLow,
55     CY_RTOS_PRIORITY_BELOWNORMAL = osPriorityBelowNormal,
56     CY_RTOS_PRIORITY_NORMAL      = osPriorityNormal,
57     CY_RTOS_PRIORITY_ABOVENORMAL = osPriorityAboveNormal,
58     CY_RTOS_PRIORITY_HIGH        = osPriorityHigh,
59     CY_RTOS_PRIORITY_REALTIME    = osPriorityRealtime,
60     CY_RTOS_PRIORITY_MAX         = osPriorityRealtime7
61 } cy_thread_priority_t;
62 
63 typedef osThreadId_t       cy_thread_t;             /** CMSIS definition of a thread handle */
64 typedef void*              cy_thread_arg_t;         /** Argument passed to the entry function of
65                                                         a thread */
66 typedef osMutexId_t        cy_mutex_t;              /** CMSIS definition of a mutex */
67 typedef osSemaphoreId_t    cy_semaphore_t;          /** CMSIS definition of a semaphore */
68 typedef osEventFlagsId_t   cy_event_t;              /** CMSIS definition of an event */
69 typedef osMessageQueueId_t cy_queue_t;              /** CMSIS definition of a message queue */
70 typedef osTimerId_t        cy_timer_t;              /** CMSIS definition of a timer */
71 typedef void*              cy_timer_callback_arg_t; /** Argument passed to the timer callback
72                                                         function */
73 typedef uint32_t           cy_time_t;               /** Time in milliseconds */
74 typedef osStatus_t         cy_rtos_error_t;         /** CMSIS definition of a error status */
75 
76 #ifdef __cplusplus
77 } // extern "C"
78 #endif
79