wlan_dsc_driver.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * Copyright (c) 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: Driver Synchronization Core (DSC) driver-level APIs
  20. */
  21. #ifndef __WLAN_DSC_DRIVER_H
  22. #define __WLAN_DSC_DRIVER_H
  23. #include "qdf_status.h"
  24. /**
  25. * struct dsc_driver - opaque dsc driver context
  26. */
  27. struct dsc_driver;
  28. /**
  29. * dsc_driver_create() - create a dsc driver context
  30. * @out_driver: opaque double pointer to assign the new context to
  31. *
  32. * Return: QDF_STATUS
  33. */
  34. QDF_STATUS dsc_driver_create(struct dsc_driver **out_driver);
  35. /**
  36. * dsc_driver_destroy() - destroy a dsc driver context
  37. * @out_driver: opaque double pointer to context to destroy and NULL
  38. *
  39. * Note, this:
  40. * - aborts all queued transitions on @driver
  41. * - asserts @driver has no attached psoc's
  42. * - asserts @driver has no operations in flight
  43. *
  44. * Return: None
  45. */
  46. void dsc_driver_destroy(struct dsc_driver **out_driver);
  47. /**
  48. * dsc_driver_trans_start() - start a transition on @driver
  49. * @driver: the driver to start a transition on
  50. * @desc: a unique description of the transition to start
  51. *
  52. * This API immediately aborts if a transition on @driver is already in flight
  53. *
  54. * Call dsc_driver_trans_stop() to complete the transition.
  55. *
  56. * Return:
  57. * QDF_STATUS_SUCCESS - transition started succcessfully
  58. * QDF_STATUS_E_INVAL - invalid request (causes debug panic)
  59. * QDF_STATUS_E_AGAIN - transition cannot currently be started
  60. * QDF_STATUS_E_ALREADY - transition with @desc already in flight
  61. */
  62. QDF_STATUS dsc_driver_trans_start(struct dsc_driver *driver, const char *desc);
  63. /**
  64. * dsc_driver_trans_start_wait() - start a transition on @driver, blocking if a
  65. * transition is already in flight
  66. * @driver: the driver to start a transition on
  67. * @desc: a unique description of the transition to start
  68. *
  69. * Call dsc_driver_trans_stop() to complete the transition.
  70. *
  71. * Return:
  72. * QDF_STATUS_SUCCESS - transition started succcessfully
  73. * QDF_STATUS_E_INVAL - invalid request (causes debug panic)
  74. * QDF_STATUS_E_AGAIN - transition cannot currently be started
  75. * QDF_STATUS_E_ALREADY - transition with @desc already queued or in flight
  76. */
  77. QDF_STATUS
  78. dsc_driver_trans_start_wait(struct dsc_driver *driver, const char *desc);
  79. /**
  80. * dsc_driver_trans_stop() - complete current transition in flight on @driver
  81. * @driver: the driver to complete the transition on
  82. *
  83. * Note: this asserts a transition is currently in flight on @driver
  84. *
  85. * Return: None
  86. */
  87. void dsc_driver_trans_stop(struct dsc_driver *driver);
  88. /**
  89. * dsc_driver_assert_trans_protected() - assert @driver is protected by a
  90. * transition
  91. * @driver: the driver to check
  92. *
  93. * Return: None
  94. */
  95. void dsc_driver_assert_trans_protected(struct dsc_driver *driver);
  96. /**
  97. * dsc_driver_op_start() - start an operation on @driver
  98. * @driver: the driver to start an operation on
  99. *
  100. * Return:
  101. * QDF_STATUS_SUCCESS - operation started succcessfully
  102. * QDF_STATUS_E_INVAL - invalid request (causes debug panic)
  103. * QDF_STATUS_E_AGAIN - operation cannot currently be started
  104. * QDF_STATUS_E_NOMEM - out of memory
  105. */
  106. #define dsc_driver_op_start(driver) _dsc_driver_op_start(driver, __func__)
  107. QDF_STATUS _dsc_driver_op_start(struct dsc_driver *driver, const char *func);
  108. /**
  109. * dsc_driver_op_stop() - complete operation with matching @func on @driver
  110. * @driver: the driver to stop an operation on
  111. *
  112. * Note: this asserts @func was previously started
  113. *
  114. * Return: None
  115. */
  116. #define dsc_driver_op_stop(driver) _dsc_driver_op_stop(driver, __func__)
  117. void _dsc_driver_op_stop(struct dsc_driver *driver, const char *func);
  118. /**
  119. * dsc_driver_wait_for_ops() - blocks until all operations on @driver have
  120. * stopped
  121. * @driver: the driver to wait for operations on
  122. *
  123. * Note: this asserts that @driver cannot currently transition
  124. *
  125. * Return: None
  126. */
  127. void dsc_driver_wait_for_ops(struct dsc_driver *driver);
  128. #endif /* __WLAN_DSC_DRIVER_H */