wlan_dsc_driver.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. * Copyright (c) 2018 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. /**
  20. * DOC: Driver Synchronization Core (DSC) driver-level APIs
  21. */
  22. #ifndef __WLAN_DSC_DRIVER_H
  23. #define __WLAN_DSC_DRIVER_H
  24. #include "qdf_status.h"
  25. /*
  26. * struct dsc_driver - opaque dsc driver context
  27. */
  28. struct dsc_driver;
  29. /**
  30. * dsc_driver_create() - create a dsc driver context
  31. * @out_driver: opaque double pointer to assign the new context to
  32. *
  33. * Return: QDF_STATUS
  34. */
  35. QDF_STATUS dsc_driver_create(struct dsc_driver **out_driver);
  36. /**
  37. * dsc_driver_destroy() - destroy a dsc driver context
  38. * @out_driver: opaque double pointer to context to destroy and NULL
  39. *
  40. * Note, this:
  41. * - aborts all queued transitions on @driver
  42. * - asserts @driver has no attached psoc's
  43. * - asserts @driver has no operations in flight
  44. *
  45. * Return: None
  46. */
  47. void dsc_driver_destroy(struct dsc_driver **out_driver);
  48. /**
  49. * dsc_driver_trans_start() - start a transition on @driver
  50. * @driver: the driver to start a transition on
  51. * @desc: a unique description of the transition to start
  52. *
  53. * This API immediately aborts if a transition on @driver is already in flight
  54. *
  55. * Call dsc_driver_trans_stop() to complete the transition.
  56. *
  57. * Return:
  58. * QDF_STATUS_SUCCESS - transition started successfully
  59. * QDF_STATUS_E_INVAL - invalid request (causes debug panic)
  60. * QDF_STATUS_E_AGAIN - transition cannot currently be started
  61. * QDF_STATUS_E_ALREADY - transition with @desc already in flight
  62. */
  63. QDF_STATUS dsc_driver_trans_start(struct dsc_driver *driver, const char *desc);
  64. /**
  65. * dsc_driver_trans_start_wait() - start a transition on @driver, blocking if a
  66. * transition is already in flight
  67. * @driver: the driver to start a transition on
  68. * @desc: a unique description of the transition to start
  69. *
  70. * Call dsc_driver_trans_stop() to complete the transition.
  71. *
  72. * Return:
  73. * QDF_STATUS_SUCCESS - transition started successfully
  74. * QDF_STATUS_E_INVAL - invalid request (causes debug panic)
  75. * QDF_STATUS_E_AGAIN - transition cannot currently be started
  76. * QDF_STATUS_E_ALREADY - transition with @desc already queued or in flight
  77. */
  78. QDF_STATUS
  79. dsc_driver_trans_start_wait(struct dsc_driver *driver, const char *desc);
  80. /**
  81. * dsc_driver_trans_stop() - complete current transition in flight on @driver
  82. * @driver: the driver to complete the transition on
  83. *
  84. * Note: this asserts a transition is currently in flight on @driver
  85. *
  86. * Return: None
  87. */
  88. void dsc_driver_trans_stop(struct dsc_driver *driver);
  89. /**
  90. * dsc_driver_assert_trans_protected() - assert @driver is protected by a
  91. * transition
  92. * @driver: the driver to check
  93. *
  94. * Return: None
  95. */
  96. void dsc_driver_assert_trans_protected(struct dsc_driver *driver);
  97. /**
  98. * dsc_driver_op_start() - start an operation on @driver
  99. * @driver: the driver to start an operation on
  100. *
  101. * Return:
  102. * QDF_STATUS_SUCCESS - operation started successfully
  103. * QDF_STATUS_E_INVAL - invalid request (causes debug panic)
  104. * QDF_STATUS_E_AGAIN - operation cannot currently be started
  105. * QDF_STATUS_E_NOMEM - out of memory
  106. */
  107. #define dsc_driver_op_start(driver) _dsc_driver_op_start(driver, __func__)
  108. QDF_STATUS _dsc_driver_op_start(struct dsc_driver *driver, const char *func);
  109. /**
  110. * dsc_driver_op_stop() - complete operation with matching @func on @driver
  111. * @driver: the driver to stop an operation on
  112. *
  113. * Note: this asserts @func was previously started
  114. *
  115. * Return: None
  116. */
  117. #define dsc_driver_op_stop(driver) _dsc_driver_op_stop(driver, __func__)
  118. void _dsc_driver_op_stop(struct dsc_driver *driver, const char *func);
  119. /**
  120. * dsc_driver_wait_for_ops() - blocks until all operations on @driver have
  121. * stopped
  122. * @driver: the driver to wait for operations on
  123. *
  124. * Note: this asserts that @driver cannot currently transition
  125. *
  126. * Return: None
  127. */
  128. void dsc_driver_wait_for_ops(struct dsc_driver *driver);
  129. #endif /* __WLAN_DSC_DRIVER_H */