qdf_event.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. /**
  19. * DOC: qdf_event.h
  20. * This file provides OS abstraction for event APIs.
  21. */
  22. #if !defined(__QDF_EVENT_H)
  23. #define __QDF_EVENT_H
  24. /* Include Files */
  25. #include "qdf_status.h"
  26. #include <qdf_types.h>
  27. #include <i_qdf_event.h>
  28. #include <qdf_trace.h>
  29. #include <qdf_list.h>
  30. /* Preprocessor definitions and constants */
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif /* __cplusplus */
  34. typedef __qdf_event_t qdf_event_t;
  35. /* Function declarations and documenation */
  36. #ifdef CONFIG_MCL
  37. typedef void (*qdf_self_recovery_callback)(enum qdf_hang_reason);
  38. #endif
  39. QDF_STATUS qdf_event_create(qdf_event_t *event);
  40. QDF_STATUS qdf_event_set(qdf_event_t *event);
  41. QDF_STATUS qdf_event_reset(qdf_event_t *event);
  42. QDF_STATUS qdf_event_destroy(qdf_event_t *event);
  43. QDF_STATUS qdf_wait_single_event(qdf_event_t *event,
  44. uint32_t timeout);
  45. /**
  46. * qdf_complete_wait_events() - Sets all the events which are in the list.
  47. *
  48. * This function traverses the list of events and sets all of them. It
  49. * sets the flag force_set as TRUE to indicate that these events have
  50. * been forcefully set.
  51. *
  52. * Return: None
  53. */
  54. void qdf_complete_wait_events(void);
  55. /**
  56. * qdf_wait_for_event_completion() - Waits for an event to be set.
  57. * @event: Pointer to an event to wait on.
  58. * @timeout: Timeout value (in milliseconds).
  59. *
  60. * This function adds the event in a list and waits on it until it
  61. * is set or the timeout duration elapses. The purpose of waiting
  62. * is considered complete only if the event is set and the flag
  63. * force_set is FALSE, it returns success in this case. In other
  64. * cases it returns appropriate error status.
  65. *
  66. * Return: QDF status
  67. */
  68. QDF_STATUS qdf_wait_for_event_completion(qdf_event_t *event,
  69. uint32_t timeout);
  70. /**
  71. * qdf_event_list_init() - Creates a list and spinlock for events.
  72. *
  73. * This function creates a list for maintaining events on which threads
  74. * wait for completion. A spinlock is also created to protect related
  75. * operations.
  76. *
  77. * Return: None
  78. */
  79. void qdf_event_list_init(void);
  80. /**
  81. * qdf_event_list_destroy() - Destroys list and spinlock created for events.
  82. *
  83. * This function destroys the list and spinlock created for events on which
  84. * threads wait for completion.
  85. *
  86. * Return: None
  87. */
  88. void qdf_event_list_destroy(void);
  89. /**
  90. * qdf_exit_thread() - exit thread execution
  91. * @status: QDF status
  92. *
  93. * Return: QDF status
  94. */
  95. QDF_STATUS qdf_exit_thread(QDF_STATUS status);
  96. #ifdef CONFIG_MCL
  97. /**
  98. * qdf_register_self_recovery_callback () - register self recovery callback
  99. * @callback: self recovery callback
  100. *
  101. * Return: None
  102. */
  103. void qdf_register_self_recovery_callback(qdf_self_recovery_callback callback);
  104. /**
  105. * qdf_trigger_self_recovery () - tirgger self recovery
  106. *
  107. * Return: None
  108. */
  109. void qdf_trigger_self_recovery(void);
  110. #endif
  111. #ifdef __cplusplus
  112. }
  113. #endif /* __cplusplus */
  114. #endif /* __QDF_EVENT_H */