| 
									
										
										
										
											2016-10-26 13:23:35 +08:00
										 |  |  | // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // Licensed under the Apache License, Version 2.0 (the "License");
 | 
					
						
							|  |  |  | // you may not use this file except in compliance with the License.
 | 
					
						
							|  |  |  | // You may obtain a copy of the License at
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //     http://www.apache.org/licenses/LICENSE-2.0
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // Unless required by applicable law or agreed to in writing, software
 | 
					
						
							|  |  |  | // distributed under the License is distributed on an "AS IS" BASIS,
 | 
					
						
							|  |  |  | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
					
						
							|  |  |  | // See the License for the specific language governing permissions and
 | 
					
						
							|  |  |  | // limitations under the License.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * All the APIs declared here are internal only APIs, it can only be used by  | 
					
						
							|  |  |  |  * espressif internal modules, such as SSC, LWIP, TCPIP adapter etc, espressif  | 
					
						
							|  |  |  |  * customers are not recommended to use them. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * If someone really want to use specified APIs declared in here, please contact | 
					
						
							|  |  |  |  * espressif AE/developer to make sure you know the limitations or risk of  | 
					
						
							|  |  |  |  * the API, otherwise you may get unexpected behavior!!! | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef __ESP_WIFI_INTERNAL_H__
 | 
					
						
							|  |  |  | #define __ESP_WIFI_INTERNAL_H__
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <stdint.h>
 | 
					
						
							|  |  |  | #include <stdbool.h>
 | 
					
						
							|  |  |  | #include "freertos/FreeRTOS.h"
 | 
					
						
							|  |  |  | #include "freertos/queue.h"
 | 
					
						
							|  |  |  | #include "rom/queue.h"
 | 
					
						
							|  |  |  | #include "esp_err.h"
 | 
					
						
							|  |  |  | #include "esp_wifi_types.h"
 | 
					
						
							|  |  |  | #include "esp_event.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-19 17:42:55 +08:00
										 |  |  | #include "esp_wifi.h"
 | 
					
						
							| 
									
										
										
										
											2016-10-26 13:23:35 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifdef __cplusplus
 | 
					
						
							|  |  |  | extern "C" { | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-30 11:39:42 +08:00
										 |  |  | typedef struct { | 
					
						
							|  |  |  |     QueueHandle_t handle; /**< FreeRTOS queue handler */ | 
					
						
							|  |  |  |     void *storage;        /**< storage for FreeRTOS queue */ | 
					
						
							|  |  |  | } wifi_static_queue_t; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-07 10:35:36 +05:30
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief Initialize Wi-Fi Driver | 
					
						
							|  |  |  |  *     Alloc resource for WiFi driver, such as WiFi control structure, RX/TX buffer, | 
					
						
							|  |  |  |  *     WiFi NVS structure among others. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-08-17 09:41:34 +05:30
										 |  |  |  * For the most part, you need not call this function directly. It gets called | 
					
						
							|  |  |  |  * from esp_wifi_init(). | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This function may be called, if you only need to initialize the Wi-Fi driver | 
					
						
							|  |  |  |  * without having to use the network stack on top. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-08-07 10:35:36 +05:30
										 |  |  |  * @param  config provide WiFi init configuration | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *    - ESP_OK: succeed | 
					
						
							| 
									
										
										
										
											2018-02-09 14:43:11 +01:00
										 |  |  |  *    - ESP_ERR_NO_MEM: out of memory | 
					
						
							| 
									
										
										
										
											2017-08-07 10:35:36 +05:30
										 |  |  |  *    - others: refer to error code esp_err.h | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-10-13 09:47:19 +08:00
										 |  |  | esp_err_t esp_wifi_init_internal(const wifi_init_config_t *config); | 
					
						
							| 
									
										
										
										
											2017-08-07 10:35:36 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-26 13:23:35 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |   * @brief  get whether the wifi driver is allowed to transmit data or not | 
					
						
							|  |  |  |   * | 
					
						
							| 
									
										
										
										
											2016-11-21 17:15:37 +08:00
										 |  |  |   * @return | 
					
						
							|  |  |  |   *     - true  : upper layer should stop to transmit data to wifi driver | 
					
						
							|  |  |  |   *     - false : upper layer can transmit data to wifi driver | 
					
						
							| 
									
										
										
										
											2016-10-26 13:23:35 +08:00
										 |  |  |   */ | 
					
						
							|  |  |  | bool esp_wifi_internal_tx_is_stop(void); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |   * @brief  free the rx buffer which allocated by wifi driver | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @param  void* buffer: rx buffer pointer | 
					
						
							|  |  |  |   */ | 
					
						
							|  |  |  | void esp_wifi_internal_free_rx_buffer(void* buffer); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2016-10-26 14:09:54 +08:00
										 |  |  |   * @brief  transmit the buffer via wifi driver | 
					
						
							| 
									
										
										
										
											2016-10-26 13:23:35 +08:00
										 |  |  |   * | 
					
						
							|  |  |  |   * @param  wifi_interface_t wifi_if : wifi interface id | 
					
						
							|  |  |  |   * @param  void *buffer : the buffer to be tansmit | 
					
						
							| 
									
										
										
										
											2018-04-05 11:46:42 +08:00
										 |  |  |   * @param  uint16_t len : the length of buffer | 
					
						
							| 
									
										
										
										
											2016-10-26 13:23:35 +08:00
										 |  |  |   * | 
					
						
							| 
									
										
										
										
											2016-11-08 19:19:28 +08:00
										 |  |  |   * @return | 
					
						
							|  |  |  |   *    - ERR_OK  : Successfully transmit the buffer to wifi driver | 
					
						
							|  |  |  |   *    - ERR_MEM : Out of memory | 
					
						
							|  |  |  |   *    - ERR_IF : WiFi driver error | 
					
						
							|  |  |  |   *    - ERR_ARG : Invalid argument | 
					
						
							| 
									
										
										
										
											2016-10-26 13:23:35 +08:00
										 |  |  |   */ | 
					
						
							| 
									
										
										
										
											2018-04-05 11:46:42 +08:00
										 |  |  | int esp_wifi_internal_tx(wifi_interface_t wifi_if, void *buffer, uint16_t len); | 
					
						
							| 
									
										
										
										
											2016-11-08 17:34:46 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |   * @brief     The WiFi RX callback function | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   *            Each time the WiFi need to forward the packets to high layer, the callback function will be called | 
					
						
							|  |  |  |   */ | 
					
						
							|  |  |  | typedef esp_err_t (*wifi_rxcb_t)(void *buffer, uint16_t len, void *eb); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |   * @brief     Set the WiFi RX callback | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @attention 1. Currently we support only one RX callback for each interface | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @param     wifi_interface_t ifx : interface | 
					
						
							|  |  |  |   * @param     wifi_rxcb_t fn : WiFi RX callback | 
					
						
							|  |  |  |   * | 
					
						
							| 
									
										
										
										
											2016-11-21 17:15:37 +08:00
										 |  |  |   * @return | 
					
						
							|  |  |  |   *     - ESP_OK : succeed | 
					
						
							|  |  |  |   *     - others : fail | 
					
						
							| 
									
										
										
										
											2016-11-08 17:34:46 +08:00
										 |  |  |   */ | 
					
						
							|  |  |  | esp_err_t esp_wifi_internal_reg_rxcb(wifi_interface_t ifx, wifi_rxcb_t fn); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |   * @brief     Notify WIFI driver that the station got ip successfully | 
					
						
							|  |  |  |   * | 
					
						
							| 
									
										
										
										
											2016-11-21 17:15:37 +08:00
										 |  |  |   * @return | 
					
						
							|  |  |  |   *     - ESP_OK : succeed | 
					
						
							|  |  |  |   *     - others : fail | 
					
						
							| 
									
										
										
										
											2016-11-08 17:34:46 +08:00
										 |  |  |   */ | 
					
						
							|  |  |  | esp_err_t esp_wifi_internal_set_sta_ip(void); | 
					
						
							| 
									
										
										
										
											2016-10-26 13:23:35 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-23 16:39:50 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |   * @brief  enable or disable transmitting WiFi MAC frame with fixed rate | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @attention 1. If fixed rate is enabled, both management and data frame are transmitted with fixed rate | 
					
						
							|  |  |  |   * @attention 2. Make sure that the receiver is able to receive the frame with the fixed rate if you want the frame to be received | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @param  ifx : wifi interface | 
					
						
							|  |  |  |   * @param  en : false - disable, true - enable | 
					
						
							|  |  |  |   * @param  rate : PHY rate | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @return | 
					
						
							|  |  |  |   *    - ERR_OK  : succeed | 
					
						
							|  |  |  |   *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init | 
					
						
							|  |  |  |   *    - ESP_ERR_WIFI_NOT_STARTED: WiFi was not started by esp_wifi_start | 
					
						
							|  |  |  |   *    - ESP_ERR_WIFI_IF : invalid WiFi interface | 
					
						
							|  |  |  |   *    - ESP_ERR_INVALID_ARG : invalid rate | 
					
						
							|  |  |  |   *    - ESP_ERR_NOT_SUPPORTED : do not support to set fixed rate if TX AMPDU is enabled | 
					
						
							|  |  |  |   */ | 
					
						
							|  |  |  | esp_err_t esp_wifi_internal_set_fix_rate(wifi_interface_t ifx, bool en, wifi_phy_rate_t rate); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-19 17:42:55 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |   * @brief     Check the MD5 values of the OS adapter header files in IDF and WiFi library | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @attention 1. It is used for internal CI version check | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @return | 
					
						
							|  |  |  |   *     - ESP_OK : succeed | 
					
						
							|  |  |  |   *     - ESP_WIFI_INVALID_ARG : MD5 check fail | 
					
						
							|  |  |  |   */ | 
					
						
							|  |  |  | esp_err_t esp_wifi_internal_osi_funcs_md5_check(const char *md5); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-29 20:25:20 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |   * @brief     Check the MD5 values of the crypto types header files in IDF and WiFi library | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @attention 1. It is used for internal CI version check | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @return | 
					
						
							|  |  |  |   *     - ESP_OK : succeed | 
					
						
							|  |  |  |   *     - ESP_WIFI_INVALID_ARG : MD5 check fail | 
					
						
							|  |  |  |   */ | 
					
						
							|  |  |  | esp_err_t esp_wifi_internal_crypto_funcs_md5_check(const char *md5); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-26 14:56:58 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |   * @brief     Check the git commit id of WiFi library | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @attention 1. It is used for internal CI WiFi library check | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @return | 
					
						
							|  |  |  |   *     - ESP_OK : succeed | 
					
						
							|  |  |  |   *     - ESP_FAIL : fail | 
					
						
							|  |  |  |   */ | 
					
						
							|  |  |  | esp_err_t esp_wifi_internal_git_commit_id_check(void); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-30 15:28:41 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |   * @brief     Allocate a chunk of memory for WiFi driver | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @attention This API is not used for DMA memory allocation. | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @param     size_t size : Size, in bytes, of the amount of memory to allocate | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @return    A pointer to the memory allocated on success, NULL on failure | 
					
						
							|  |  |  |   */ | 
					
						
							|  |  |  | void *wifi_malloc( size_t size ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |   * @brief     Reallocate a chunk of memory for WiFi driver | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @attention This API is not used for DMA memory allocation. | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @param     void * ptr  : Pointer to previously allocated memory, or NULL for a new allocation. | 
					
						
							|  |  |  |   * @param     size_t size : Size, in bytes, of the amount of memory to allocate | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @return    A pointer to the memory allocated on success, NULL on failure | 
					
						
							|  |  |  |   */ | 
					
						
							|  |  |  | void *wifi_realloc( void *ptr, size_t size ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |   * @brief     Callocate memory for WiFi driver | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @attention This API is not used for DMA memory allocation. | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @param     size_t n    : Number of continuing chunks of memory to allocate | 
					
						
							|  |  |  |   * @param     size_t size : Size, in bytes, of the amount of memory to allocate | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @return    A pointer to the memory allocated on success, NULL on failure | 
					
						
							|  |  |  |   */ | 
					
						
							|  |  |  | void *wifi_calloc( size_t n, size_t size ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-11 20:57:15 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |   * @brief     Update WiFi MAC time | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @param     uint32_t time_delta : time duration since the WiFi/BT common clock is disabled | 
					
						
							|  |  |  |   * | 
					
						
							|  |  |  |   * @return    Always returns ESP_OK | 
					
						
							|  |  |  |   */ | 
					
						
							|  |  |  | esp_err_t esp_wifi_internal_update_mac_time( uint32_t time_delta ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-26 13:23:35 +08:00
										 |  |  | #ifdef __cplusplus
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif /* __ESP_WIFI_H__ */
 |