qdf_qmi.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /*
  2. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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_qmi.h
  20. * This file defines the QMI abstraction.
  21. */
  22. #ifndef _QDF_QMI_H
  23. #define _QDF_QMI_H
  24. #ifdef WLAN_QMI
  25. #include <i_qdf_qmi.h>
  26. typedef __qdf_qmi_handle qdf_qmi_handle;
  27. typedef __qdf_qmi_ops qdf_qmi_ops;
  28. typedef __qdf_qmi_msg_handler qdf_qmi_msg_handler;
  29. typedef __qdf_qmi_service qdf_qmi_service;
  30. typedef __qdf_qmi_txn qdf_qmi_txn;
  31. typedef __qdf_qmi_elem_info qdf_qmi_elem_info;
  32. typedef __qdf_sockaddr_qrtr qdf_sockaddr_qrtr;
  33. /**
  34. * qdf_qmi_handle_init() - Initialize QMI handle
  35. * @qmi_hdl: QMI handle to initialize
  36. * @recv_buf_size: maximum size of incoming message
  37. * @ops: reference to callbacks for QRTR notifications
  38. * @qmi_msg_handlers: NULL-terminated list of QMI message handlers
  39. *
  40. * Returns: QDF status
  41. */
  42. static inline
  43. QDF_STATUS qdf_qmi_handle_init(qdf_qmi_handle *qmi_hdl, uint32_t recv_buf_size,
  44. qdf_qmi_ops *ops,
  45. qdf_qmi_msg_handler *qmi_msg_handlers)
  46. {
  47. return __qdf_qmi_handle_init(qmi_hdl, recv_buf_size, ops,
  48. qmi_msg_handlers);
  49. }
  50. /**
  51. * qdf_qmi_handle_release() - Release QMI handle
  52. * @qm_hdl: QMI handle to release
  53. *
  54. * Returns: None
  55. */
  56. static inline
  57. void qdf_qmi_handle_release(qdf_qmi_handle *qmi_hdl)
  58. {
  59. return __qdf_qmi_handle_release(qmi_hdl);
  60. }
  61. /**
  62. * qdf_qmi_add_lookup() - Register a new lookup with the name service
  63. * @qmi_hdl: QMI handle
  64. * @service: service id of the request
  65. * @version: version number of the request
  66. * @instance: instance id of the request
  67. *
  68. * Return: QDF status
  69. */
  70. static inline
  71. QDF_STATUS qdf_qmi_add_lookup(qdf_qmi_handle *qmi_hdl, unsigned int service,
  72. unsigned int version, unsigned int instance)
  73. {
  74. return __qdf_qmi_add_lookup(qmi_hdl, service, version, instance);
  75. }
  76. /**
  77. * qdf_qmi_connect_to_svc() - Connect to QMI service
  78. * @qmi_hdl: QMI handle
  79. * @qmi_svc: QMI service handle
  80. *
  81. * Return: QDF status
  82. */
  83. static inline
  84. QDF_STATUS qdf_qmi_connect_to_svc(qdf_qmi_handle *qmi_hdl,
  85. qdf_qmi_service *qmi_svc)
  86. {
  87. return __qdf_qmi_connect_to_svc(qmi_hdl, qmi_svc);
  88. }
  89. /**
  90. * qdf_qmi_txn_init() - Initialize QMI transaction handle
  91. * @qmi_hdl: QMI handle
  92. * @qmi_txn: QMI transaction handle
  93. * @qmi_ei: description of how to decode a matching response (optional)
  94. * @qmi_resp: pointer to the object to decode the response into (optional)
  95. *
  96. * Return: QDF status
  97. */
  98. static inline
  99. QDF_STATUS qdf_qmi_txn_init(qdf_qmi_handle *qmi_hdl, qdf_qmi_txn *qmi_txn,
  100. qdf_qmi_elem_info *qmi_ei, void *qmi_resp)
  101. {
  102. return __qdf_qmi_txn_init(qmi_hdl, qmi_txn, qmi_ei, qmi_resp);
  103. }
  104. /**
  105. * qdf_qmi_send_request() - Send QMI request
  106. * @qmi_hdl: QMI handle
  107. * @sq: destination sockaddr
  108. * @qmi_txn: QMI transaction handle
  109. * @msg_id: message id
  110. * @len: max length of the QMI message
  111. * @ei: QMI message description
  112. * @req: message to be encoded
  113. *
  114. * Return: QDF status
  115. */
  116. static inline
  117. QDF_STATUS qdf_qmi_send_request(qdf_qmi_handle *qmi_hdl, qdf_sockaddr_qrtr *sq,
  118. qdf_qmi_txn *qmi_txn, int msg_id, uint32_t len,
  119. qdf_qmi_elem_info *ei, const void *req)
  120. {
  121. return __qdf_qmi_send_request(qmi_hdl, sq, qmi_txn, msg_id, len, ei,
  122. req);
  123. }
  124. /**
  125. * qdf_qmi_txn_wait() - Wait for transaction response
  126. * @qmi_txn: QMI transaction handle
  127. * @timeout: Timeout value in jiffies
  128. *
  129. * Return: QDF status
  130. */
  131. static inline
  132. QDF_STATUS qdf_qmi_txn_wait(qdf_qmi_txn *qmi_txn, unsigned long timeout)
  133. {
  134. return __qdf_qmi_txn_wait(qmi_txn, timeout);
  135. }
  136. /**
  137. * qdf_qmi_txn_cancel() - Cancel the QMI transaction
  138. * @qmi_txn: QMI transaction handle
  139. *
  140. * Return: None
  141. */
  142. static inline
  143. void qdf_qmi_txn_cancel(qdf_qmi_txn *qmi_txn)
  144. {
  145. __qdf_qmi_txn_cancel(qmi_txn);
  146. }
  147. #endif
  148. #endif