qdf_event.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. * Copyright (c) 2014-2015 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. #if !defined(__CDF_EVENT_H)
  27. #define __CDF_EVENT_H
  28. /**
  29. * DOC: cdf_event.h
  30. *
  31. * Connectivity driver framework (CDF) events API
  32. *
  33. **/
  34. /* Include Files */
  35. #include "cdf_status.h"
  36. #include "cdf_types.h"
  37. #include "i_cdf_event.h"
  38. /* Preprocessor definitions and constants */
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif /* __cplusplus */
  42. /* Type declarations */
  43. /* Function declarations and documenation */
  44. /**
  45. * cdf_event_init() - initializes the specified event
  46. *
  47. * @event: Pointer to CDF event object to initialize
  48. *
  49. * Initializes the specified event. Upon successful initialization the state
  50. * of the event becomes initialized and not signaled.
  51. *
  52. * Return:
  53. * CDF_STATUS_SUCCESS - Event was successfully initialized and is ready to
  54. * be used
  55. * Otherwise failure CDF reason code
  56. */
  57. CDF_STATUS cdf_event_init(cdf_event_t *event);
  58. /**
  59. * cdf_event_set() - set a CDF event
  60. *
  61. * @event: Pointer of CDF event to set to the signalled state
  62. *
  63. * The state of the specified event is set to 'signalled by calling
  64. * cdf_event_set(). The state of the event remains signalled until an
  65. * explicit call to cdf_event_reset().
  66. *
  67. * Any threads waiting on the event as a result of a cdf_event_wait() will
  68. * be unblocked and available to be scheduled for execution when the event
  69. * is signaled by a call to cdf_event_set().
  70. *
  71. * Return:
  72. * CDF_STATUS_SUCCESS - Event was successfully set
  73. * Otherwise failure CDF reason code
  74. */
  75. CDF_STATUS cdf_event_set(cdf_event_t *event);
  76. /**
  77. * cdf_event_reset() - reset a CDF event
  78. *
  79. * @event: Pointer of CDF event to reset
  80. *
  81. * The state of the specified event is set to 'NOT signalled' by calling
  82. * cdf_event_reset(). The state of the event remains NOT signalled until an
  83. * explicit call to cdf_event_set().
  84. *
  85. * This function sets the event to a NOT signalled state even if the event was
  86. * signalled multiple times before being signaled.
  87. *
  88. * Return:
  89. * CDF_STATUS_SUCCESS - Event was successfully reset
  90. * Otherwise failure CDF reason code
  91. */
  92. CDF_STATUS cdf_event_reset(cdf_event_t *event);
  93. /**
  94. * cdf_event_destroy() - destroy a CDF event
  95. *
  96. * @event: Pointer of CDF event to destroy
  97. *
  98. * The function destroys the event object referenced by event.
  99. * After a successful return from cdf_event_destroy() the event object becomes,
  100. * in effect, uninitialized.
  101. *
  102. * A destroyed event object can be reinitialized using cdf_event_init();
  103. * the results of otherwise referencing the object after it has been destroyed
  104. * are undefined. Calls to CDF event functions to manipulate the lock such
  105. * as cdf_event_set() will fail if the event is destroyed. Therefore,
  106. * don't use the event after it has been destroyed until it has
  107. * been re-initialized.
  108. *
  109. * Return:
  110. * CDF_STATUS_SUCCESS - Event was successfully destroyed
  111. * Otherwise failure CDF reason code
  112. */
  113. CDF_STATUS cdf_event_destroy(cdf_event_t *event);
  114. /**
  115. * cdf_wait_single_event() - wait for a single input CDF event to be set
  116. *
  117. * @event: Pointer of CDF event to wait on
  118. * @timeout: Timeout value in milli seconds
  119. *
  120. * This API waits for the event to be set. This function returns
  121. * if this interval elapses, regardless if any of the events have
  122. * been set. An input value of 0 for this timeout parameter means
  123. * to wait infinitely, meaning a timeout will never occur.
  124. *
  125. *
  126. * Return:
  127. * CDF_STATUS_SUCCESS - the wait was satisifed by the event being
  128. * set.
  129. *
  130. * CDF_STATUS_E_TIMEOUT - the timeout interval elapsed before the
  131. * event was set.
  132. *
  133. * CDF_STATUS_E_INVAL - The value specified by event is invalid.
  134. */
  135. CDF_STATUS cdf_wait_single_event(cdf_event_t *pEvent,
  136. uint32_t timeout);
  137. #ifdef __cplusplus
  138. }
  139. #endif /* __cplusplus */
  140. #endif /* __CDF_EVENT_H */