esp_wifi_internal.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. /*
  14. * All the APIs declared here are internal only APIs, it can only be used by
  15. * espressif internal modules, such as SSC, LWIP, TCPIP adapter etc, espressif
  16. * customers are not recommended to use them.
  17. *
  18. * If someone really want to use specified APIs declared in here, please contact
  19. * espressif AE/developer to make sure you know the limitations or risk of
  20. * the API, otherwise you may get unexpected behavior!!!
  21. *
  22. */
  23. #ifndef __ESP_WIFI_INTERNAL_H__
  24. #define __ESP_WIFI_INTERNAL_H__
  25. #include <stdint.h>
  26. #include <stdbool.h>
  27. #include "freertos/FreeRTOS.h"
  28. #include "freertos/queue.h"
  29. #include "rom/queue.h"
  30. #include "esp_err.h"
  31. #include "esp_wifi_types.h"
  32. #include "esp_event.h"
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36. /**
  37. * @brief get whether the wifi driver is allowed to transmit data or not
  38. *
  39. * @return
  40. * - true : upper layer should stop to transmit data to wifi driver
  41. * - false : upper layer can transmit data to wifi driver
  42. */
  43. bool esp_wifi_internal_tx_is_stop(void);
  44. /**
  45. * @brief free the rx buffer which allocated by wifi driver
  46. *
  47. * @param void* buffer: rx buffer pointer
  48. */
  49. void esp_wifi_internal_free_rx_buffer(void* buffer);
  50. /**
  51. * @brief transmit the buffer via wifi driver
  52. *
  53. * @param wifi_interface_t wifi_if : wifi interface id
  54. * @param void *buffer : the buffer to be tansmit
  55. * @param u16_t len : the length of buffer
  56. *
  57. * @return
  58. * - ERR_OK : Successfully transmit the buffer to wifi driver
  59. * - ERR_MEM : Out of memory
  60. * - ERR_IF : WiFi driver error
  61. * - ERR_ARG : Invalid argument
  62. */
  63. int esp_wifi_internal_tx(wifi_interface_t wifi_if, void *buffer, u16_t len);
  64. /**
  65. * @brief The WiFi RX callback function
  66. *
  67. * Each time the WiFi need to forward the packets to high layer, the callback function will be called
  68. */
  69. typedef esp_err_t (*wifi_rxcb_t)(void *buffer, uint16_t len, void *eb);
  70. /**
  71. * @brief Set the WiFi RX callback
  72. *
  73. * @attention 1. Currently we support only one RX callback for each interface
  74. *
  75. * @param wifi_interface_t ifx : interface
  76. * @param wifi_rxcb_t fn : WiFi RX callback
  77. *
  78. * @return
  79. * - ESP_OK : succeed
  80. * - others : fail
  81. */
  82. esp_err_t esp_wifi_internal_reg_rxcb(wifi_interface_t ifx, wifi_rxcb_t fn);
  83. /**
  84. * @brief Notify WIFI driver that the station got ip successfully
  85. *
  86. * @return
  87. * - ESP_OK : succeed
  88. * - others : fail
  89. */
  90. esp_err_t esp_wifi_internal_set_sta_ip(void);
  91. #ifdef __cplusplus
  92. }
  93. #endif
  94. #endif /* __ESP_WIFI_H__ */