qdf_event.h 3.8 KB

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