tx_event_flags.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /***************************************************************************
  2. * Copyright (c) 2024 Microsoft Corporation
  3. *
  4. * This program and the accompanying materials are made available under the
  5. * terms of the MIT License which is available at
  6. * https://opensource.org/licenses/MIT.
  7. *
  8. * SPDX-License-Identifier: MIT
  9. **************************************************************************/
  10. /**************************************************************************/
  11. /**************************************************************************/
  12. /** */
  13. /** ThreadX Component */
  14. /** */
  15. /** Event Flags */
  16. /** */
  17. /**************************************************************************/
  18. /**************************************************************************/
  19. /**************************************************************************/
  20. /* */
  21. /* COMPONENT DEFINITION RELEASE */
  22. /* */
  23. /* tx_event_flags.h PORTABLE C */
  24. /* 6.1 */
  25. /* AUTHOR */
  26. /* */
  27. /* William E. Lamie, Microsoft Corporation */
  28. /* */
  29. /* DESCRIPTION */
  30. /* */
  31. /* This file defines the ThreadX event flags management component, */
  32. /* including all data types and external references. It is assumed */
  33. /* that tx_api.h and tx_port.h have already been included. */
  34. /* */
  35. /* RELEASE HISTORY */
  36. /* */
  37. /* DATE NAME DESCRIPTION */
  38. /* */
  39. /* 05-19-2020 William E. Lamie Initial Version 6.0 */
  40. /* 09-30-2020 Yuxin Zhou Modified comment(s), */
  41. /* resulting in version 6.1 */
  42. /* */
  43. /**************************************************************************/
  44. #ifndef TX_EVENT_FLAGS_H
  45. #define TX_EVENT_FLAGS_H
  46. /* Define event flags control specific data definitions. */
  47. #define TX_EVENT_FLAGS_ID ((ULONG) 0x4456444E)
  48. #define TX_EVENT_FLAGS_AND_MASK ((UINT) 0x2)
  49. #define TX_EVENT_FLAGS_CLEAR_MASK ((UINT) 0x1)
  50. /* Determine if in-line component initialization is supported by the
  51. caller. */
  52. #ifdef TX_INVOKE_INLINE_INITIALIZATION
  53. /* Yes, in-line initialization is supported, remap the event flag initialization
  54. function. */
  55. #ifndef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
  56. #define _tx_event_flags_initialize() \
  57. _tx_event_flags_created_ptr = TX_NULL; \
  58. _tx_event_flags_created_count = TX_EMPTY
  59. #else
  60. #define _tx_event_flags_initialize() \
  61. _tx_event_flags_created_ptr = TX_NULL; \
  62. _tx_event_flags_created_count = TX_EMPTY; \
  63. _tx_event_flags_performance_set_count = ((ULONG) 0); \
  64. _tx_event_flags_performance_get_count = ((ULONG) 0); \
  65. _tx_event_flags_performance_suspension_count = ((ULONG) 0); \
  66. _tx_event_flags_performance_timeout_count = ((ULONG) 0)
  67. #endif
  68. #define TX_EVENT_FLAGS_INIT
  69. #else
  70. /* No in-line initialization is supported, use standard function call. */
  71. VOID _tx_event_flags_initialize(VOID);
  72. #endif
  73. /* Define internal event flags management function prototypes. */
  74. VOID _tx_event_flags_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequence);
  75. /* Event flags management component data declarations follow. */
  76. /* Determine if the initialization function of this component is including
  77. this file. If so, make the data definitions really happen. Otherwise,
  78. make them extern so other functions in the component can access them. */
  79. #ifdef TX_EVENT_FLAGS_INIT
  80. #define EVENT_FLAGS_DECLARE
  81. #else
  82. #define EVENT_FLAGS_DECLARE extern
  83. #endif
  84. /* Define the head pointer of the created event flags list. */
  85. EVENT_FLAGS_DECLARE TX_EVENT_FLAGS_GROUP * _tx_event_flags_created_ptr;
  86. /* Define the variable that holds the number of created event flag groups. */
  87. EVENT_FLAGS_DECLARE ULONG _tx_event_flags_created_count;
  88. #ifdef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
  89. /* Define the total number of event flag sets. */
  90. EVENT_FLAGS_DECLARE ULONG _tx_event_flags_performance_set_count;
  91. /* Define the total number of event flag gets. */
  92. EVENT_FLAGS_DECLARE ULONG _tx_event_flags_performance_get_count;
  93. /* Define the total number of event flag suspensions. */
  94. EVENT_FLAGS_DECLARE ULONG _tx_event_flags_performance_suspension_count;
  95. /* Define the total number of event flag timeouts. */
  96. EVENT_FLAGS_DECLARE ULONG _tx_event_flags_performance_timeout_count;
  97. #endif
  98. /* Define default post event flag group delete macro to whitespace, if it hasn't been defined previously (typically in tx_port.h). */
  99. #ifndef TX_EVENT_FLAGS_GROUP_DELETE_PORT_COMPLETION
  100. #define TX_EVENT_FLAGS_GROUP_DELETE_PORT_COMPLETION(g)
  101. #endif
  102. #endif