Advertisement
Guest User

cyabs_rtos_impl.h

a guest
Aug 29th, 2023
87
0
117 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.37 KB | None | 0 0
  1. /***********************************************************************************************//**
  2. * \file cyabs_rtos_impl.h
  3. *
  4. * \brief
  5. * Template file for internal definitions for RTOS abstraction layer.
  6. * Replace all TODO items with the proper values for the RTOS that is
  7. * being wrapped.
  8. *
  9. ***************************************************************************************************
  10. * \copyright
  11. * Copyright 2019-2021 Cypress Semiconductor Corporation (an Infineon company) or
  12. * an affiliate of Cypress Semiconductor Corporation
  13. *
  14. * SPDX-License-Identifier: Apache-2.0
  15. *
  16. * Licensed under the Apache License, Version 2.0 (the "License");
  17. * you may not use this file except in compliance with the License.
  18. * You may obtain a copy of the License at
  19. *
  20. * http://www.apache.org/licenses/LICENSE-2.0
  21. *
  22. * Unless required by applicable law or agreed to in writing, software
  23. * distributed under the License is distributed on an "AS IS" BASIS,
  24. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  25. * See the License for the specific language governing permissions and
  26. * limitations under the License.
  27. **************************************************************************************************/
  28.  
  29. #pragma once
  30.  
  31. /*
  32. * Exclude template files except for documentation purposes.
  33. * This should be removed when using the template to support a new RTOS.
  34. */
  35. #if defined(DOXYGEN)
  36.  
  37. // #include "TODO: RTOS HEADER"
  38. #include "publisher_task.h"
  39. #include "mqtt_task.h"
  40. #include "subscriber_task.h"
  41.  
  42. #include "FreeRTOS.h"
  43. #include "stdbool.h"
  44. #include "cyhal.h"
  45.  
  46.  
  47. #ifdef __cplusplus
  48. extern "C"
  49. {
  50. #endif
  51.  
  52. /**
  53. * \addtogroup group_abstraction_rtos_port RTOS Specific Types and Defines
  54. * \ingroup group_abstraction_rtos_common
  55. * \{
  56. * The following defines and types have values that are specific to each RTOS port.
  57. * The define values are specific to each RTOS. The types are simple aliases that
  58. * wrap RTOS specifc types. Code cannot assume anything about the values or internals
  59. * of any types.
  60. */
  61.  
  62. /******************************************************
  63. * Constants
  64. ******************************************************/
  65. // TODO: Replace these with proper values for the target RTOS
  66. #define CY_RTOS_MIN_STACK_SIZE 300 /**< Minimum stack size */
  67. #define CY_RTOS_ALIGNMENT 0x00000008UL /**< Minimum alignment for RTOS objects */
  68. #define CY_RTOS_ALIGNMENT_MASK 0x00000007UL /**< Checks for 8-bit alignment */
  69.  
  70.  
  71. /******************************************************
  72. * Type Definitions
  73. ******************************************************/
  74.  
  75. // TODO: Replace all priority values with values specific to the RTOS
  76. /** RTOS thread priority.
  77. * Note: Depending on the RTOS and interrupt options for the device, some of these priorities may
  78. * end up being the same priority level in practice. Even if this happens, the relative ordering
  79. * of priorities is still maintained. eg:
  80. * MAX >= REALTIME >= HIGH >= ABOVENORMAL >= NORMAL >= BELOWNORMAL >= LOW >= MIN
  81. */
  82. typedef enum
  83. {
  84. CY_RTOS_PRIORITY_MIN = 0, /**< Minumum allowable Thread priority */
  85. CY_RTOS_PRIORITY_LOW = 1, /**< A low priority Thread */
  86. CY_RTOS_PRIORITY_BELOWNORMAL = 2, /**< A slightly below normal Thread priority */
  87. CY_RTOS_PRIORITY_NORMAL = 3, /**< The normal Thread priority */
  88. CY_RTOS_PRIORITY_ABOVENORMAL = 4, /**< A slightly elevated Thread priority */
  89. CY_RTOS_PRIORITY_HIGH = 5, /**< A high priority Thread */
  90. CY_RTOS_PRIORITY_REALTIME = 6, /**< Realtime Thread priority */
  91. CY_RTOS_PRIORITY_MAX = 7 /**< Maximum allowable Thread priority */
  92. } cy_thread_priority_t;
  93.  
  94.  
  95. typedef struct
  96. {
  97. SemaphoreHandle_t mutex_handle;
  98. bool is_recursive;
  99. } cy_mutex_t;
  100.  
  101. typedef QueueHandle_t cy_queue_t;
  102. typedef SemaphoreHandle_t cy_semaphore_t;
  103. typedef TaskHandle_t cy_thread_t;
  104. typedef EventGroupHandle_t cy_event_t;
  105. typedef TimerHandle_t cy_timer_t;
  106. typedef uint32_t cy_timer_callback_arg_t;
  107. typedef void* cy_thread_arg_t;
  108. typedef uint32_t cy_time_t;
  109. typedef BaseType_t cy_rtos_error_t;
  110.  
  111.  
  112. /** \} group_abstraction_rtos_port */
  113.  
  114. #ifdef __cplusplus
  115. } // extern "C"
  116. #endif
  117.  
  118. #endif // defined(DOXYGEN)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement