qdf_event.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * Copyright (c) 2014-2018 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. QDF_STATUS qdf_event_create(qdf_event_t *event);
  37. QDF_STATUS qdf_event_set(qdf_event_t *event);
  38. QDF_STATUS qdf_event_reset(qdf_event_t *event);
  39. QDF_STATUS qdf_event_destroy(qdf_event_t *event);
  40. QDF_STATUS qdf_wait_single_event(qdf_event_t *event,
  41. uint32_t timeout);
  42. /**
  43. * qdf_complete_wait_events() - Sets all the events which are in the list.
  44. *
  45. * This function traverses the list of events and sets all of them. It
  46. * sets the flag force_set as TRUE to indicate that these events have
  47. * been forcefully set.
  48. *
  49. * Return: None
  50. */
  51. void qdf_complete_wait_events(void);
  52. /**
  53. * qdf_wait_for_event_completion() - Waits for an event to be set.
  54. * @event: Pointer to an event to wait on.
  55. * @timeout: Timeout value (in milliseconds).
  56. *
  57. * This function adds the event in a list and waits on it until it
  58. * is set or the timeout duration elapses. The purpose of waiting
  59. * is considered complete only if the event is set and the flag
  60. * force_set is FALSE, it returns success in this case. In other
  61. * cases it returns appropriate error status.
  62. *
  63. * Return: QDF status
  64. */
  65. QDF_STATUS qdf_wait_for_event_completion(qdf_event_t *event,
  66. uint32_t timeout);
  67. /**
  68. * qdf_event_list_init() - Creates a list and spinlock for events.
  69. *
  70. * This function creates a list for maintaining events on which threads
  71. * wait for completion. A spinlock is also created to protect related
  72. * operations.
  73. *
  74. * Return: None
  75. */
  76. void qdf_event_list_init(void);
  77. /**
  78. * qdf_event_list_destroy() - Destroys list and spinlock created for events.
  79. *
  80. * This function destroys the list and spinlock created for events on which
  81. * threads wait for completion.
  82. *
  83. * Return: None
  84. */
  85. void qdf_event_list_destroy(void);
  86. /**
  87. * qdf_exit_thread() - exit thread execution
  88. * @status: QDF status
  89. *
  90. * Return: QDF status
  91. */
  92. QDF_STATUS qdf_exit_thread(QDF_STATUS status);
  93. #ifdef __cplusplus
  94. }
  95. #endif /* __cplusplus */
  96. #endif /* __QDF_EVENT_H */