mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-09-22 06:32:10 +08:00
feat(esp8266): rename some wifi private file
This commit is contained in:
108
components/esp8266/include/esp_private/esp_system_internal.h
Normal file
108
components/esp8266/include/esp_private/esp_system_internal.h
Normal file
@ -0,0 +1,108 @@
|
||||
// Copyright 2018-2019 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <esp_system.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define RTC_SYS_RAM_SIZE 256
|
||||
#define ESP_SYSTEM_FAST_BOOT_IMAGE 0x5aa5a55a
|
||||
|
||||
/**
|
||||
* @brief Station's AP base information of old SDK
|
||||
*/
|
||||
struct old_ap_ssid {
|
||||
uint32_t len; //!< SSID length
|
||||
uint8_t ssid[32]; //!< SSID data
|
||||
uint8_t passwd[64]; //!< password data
|
||||
} __attribute__((packed));
|
||||
|
||||
/**
|
||||
* @brief System information of old SDK
|
||||
*/
|
||||
struct old_sysconf {
|
||||
uint8_t reserved_1[0x13C]; //!< reserved data
|
||||
uint8_t ap_number; //!< number of stored AP
|
||||
uint8_t ap_index; //!< index of current used AP
|
||||
uint8_t reserved_2[0x2]; //!< reserved data
|
||||
struct old_ap_ssid ap_ssid[5]; //!< station's AP base information
|
||||
} __attribute__((packed));
|
||||
|
||||
/**
|
||||
* The size of structure must not be larger than 256 bytes and all member varible must be uint32_t type
|
||||
*/
|
||||
struct _rtc_sys_info {
|
||||
uint32_t hint; // software reset reason
|
||||
uint32_t old_sysconf_addr; /*<! old SDK system configuration parameters base address,
|
||||
if your bootloader is older than v3.2, please don't use this */
|
||||
struct {
|
||||
uint32_t magic;
|
||||
uint32_t image_start;
|
||||
uint32_t image_size;
|
||||
uint32_t image_entry;
|
||||
uint32_t crc32;
|
||||
} fast_boot;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief System information
|
||||
*/
|
||||
typedef struct esp_sys_info {
|
||||
uint32_t version; //!< system version
|
||||
uint32_t reserved[3]; //!< reserved data
|
||||
} esp_sys_info_t;
|
||||
|
||||
_Static_assert(sizeof(esp_sys_info_t) == 16, "esp_sys_info_t should be 16 bytes");
|
||||
|
||||
extern struct _rtc_sys_info rtc_sys_info;
|
||||
|
||||
/**
|
||||
* @brief Internal function to get SoC reset reason at system initialization
|
||||
*/
|
||||
void esp_reset_reason_init(void);
|
||||
|
||||
/**
|
||||
* @brief Internal function to set reset reason hint
|
||||
*
|
||||
* The hint is used do distinguish different reset reasons when software reset
|
||||
* is performed.
|
||||
*
|
||||
* The hint is stored in RTC store register, RTC_RESET_CAUSE_REG.
|
||||
*
|
||||
* @param hint Desired esp_reset_reason_t value for the real reset reason
|
||||
*/
|
||||
void esp_reset_reason_set_hint(esp_reset_reason_t hint);
|
||||
|
||||
/**
|
||||
* @brief Get reason of last reset but not clear it for next reset
|
||||
*
|
||||
* @return See description of esp_reset_reason_t for explanation of each value.
|
||||
*/
|
||||
esp_reset_reason_t esp_reset_reason_early(void);
|
||||
|
||||
/**
|
||||
* @brief Get old SDK configuration parameters base address
|
||||
*
|
||||
* @return 0 if it is not upgraded from old SDK or the absolute address of the flash
|
||||
*/
|
||||
uint32_t esp_get_old_sysconf_addr(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
165
components/esp8266/include/esp_private/phy_init_data.h
Normal file
165
components/esp8266/include/esp_private/phy_init_data.h
Normal file
@ -0,0 +1,165 @@
|
||||
// Copyright 2018 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "esp_phy_init.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
// constrain a value between 'low' and 'high', inclusive
|
||||
#define LIMIT(val, low, high) ((val < low) ? low : (val > high) ? high : val)
|
||||
#define PHY_INIT_MAGIC "PHYINIT"
|
||||
|
||||
static const char phy_init_magic_pre[] = PHY_INIT_MAGIC;
|
||||
|
||||
/**
|
||||
* @brief Structure containing default recommended PHY initialization parameters.
|
||||
*/
|
||||
static const esp_phy_init_data_t phy_init_data= { {
|
||||
0x05,
|
||||
0x00,
|
||||
0x04,
|
||||
0x02,
|
||||
0x05,
|
||||
0x05,
|
||||
0x05,
|
||||
0x02,
|
||||
0x05,
|
||||
0x00,
|
||||
0x04,
|
||||
0x05,
|
||||
0x05,
|
||||
0x04,
|
||||
0x05,
|
||||
0x05,
|
||||
0x04,
|
||||
0xfe,
|
||||
0xfd,
|
||||
0xff,
|
||||
0xf0,
|
||||
0xf0,
|
||||
0xf0,
|
||||
0xe0,
|
||||
0xe0,
|
||||
0xe0,
|
||||
0xe1,
|
||||
0x0a,
|
||||
0xff,
|
||||
0xff,
|
||||
0xf8,
|
||||
0x00,
|
||||
0xf8,
|
||||
0xf8,
|
||||
LIMIT(CONFIG_ESP8266_PHY_MAX_WIFI_TX_POWER * 4, 0, 0x52),
|
||||
LIMIT(CONFIG_ESP8266_PHY_MAX_WIFI_TX_POWER * 4, 0, 0x4e),
|
||||
LIMIT(CONFIG_ESP8266_PHY_MAX_WIFI_TX_POWER * 4, 0, 0x4a),
|
||||
LIMIT(CONFIG_ESP8266_PHY_MAX_WIFI_TX_POWER * 4, 0, 0x44),
|
||||
LIMIT(CONFIG_ESP8266_PHY_MAX_WIFI_TX_POWER * 4, 0, 0x40),
|
||||
LIMIT(CONFIG_ESP8266_PHY_MAX_WIFI_TX_POWER * 4, 0, 0x38),
|
||||
0x00,
|
||||
0x00,
|
||||
0x01,
|
||||
0x01,
|
||||
0x02,
|
||||
0x03,
|
||||
0x04,
|
||||
0x05,
|
||||
0x01,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x02,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0xe1,
|
||||
0x0a,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x01,
|
||||
0x93,
|
||||
0x43,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
#ifdef CONFIG_ESP_PHY_INIT_DATA_VDD33_CONST
|
||||
CONFIG_ESP_PHY_INIT_DATA_VDD33_CONST,
|
||||
#else
|
||||
0x00,
|
||||
#endif
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x01,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
} };
|
||||
|
||||
static const char phy_init_magic_post[] = PHY_INIT_MAGIC;
|
||||
|
196
components/esp8266/include/esp_private/wifi.h
Normal file
196
components/esp8266/include/esp_private/wifi.h
Normal file
@ -0,0 +1,196 @@
|
||||
// Copyright 2018-2019 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.
|
||||
|
||||
#ifndef _ESP_WIFI_INTERNAL_H
|
||||
#define _ESP_WIFI_INTERNAL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
WIFI_RX_PBUF_IRAM, /** save rx buffer to iram and upload to tcpip*/
|
||||
WIFI_RX_PBUF_DRAM, /** save rx buffer to dram and upload to tcpip */
|
||||
} wifi_rx_pbuf_mem_type_t;
|
||||
|
||||
/**
|
||||
* @brief WiFi log level
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
WIFI_LOG_ERROR = 0, /*enabled by default*/
|
||||
WIFI_LOG_WARNING, /*can be set in menuconfig*/
|
||||
WIFI_LOG_INFO, /*can be set in menuconfig*/
|
||||
WIFI_LOG_DEBUG, /*can be set in menuconfig*/
|
||||
WIFI_LOG_VERBOSE, /*can be set in menuconfig*/
|
||||
} wifi_log_level_t;
|
||||
|
||||
/**
|
||||
* @brief WiFi log submodule definition
|
||||
*
|
||||
*/
|
||||
#define WIFI_LOG_SUBMODULE_NULL (0)
|
||||
#define WIFI_LOG_SUBMODULE_CORE (1<<0)
|
||||
#define WIFI_LOG_SUBMODULE_SCAN (1<<1)
|
||||
#define WIFI_LOG_SUBMODULE_PM (1<<2)
|
||||
#define WIFI_LOG_SUBMODULE_NVS (1<<3)
|
||||
#define WIFI_LOG_SUBMODULE_TRC (1<<4)
|
||||
#define WIFI_LOG_SUBMODULE_EBUF (1<<5)
|
||||
#define WIFI_LOG_SUBMODULE_NET80211 (1<<6)
|
||||
#define WIFI_LOG_SUBMODULE_TIMER (1<<7)
|
||||
#define WIFI_LOG_SUBMODULE_ESPNOW (1<<8)
|
||||
#define WIFI_LOG_SUBMODULE_MAC (1<<9)
|
||||
#define WIFI_LOG_SUBMODULE_WPA (1<<10)
|
||||
#define WIFI_LOG_SUBMODULE_WPS (1<<11)
|
||||
#define WIFI_LOG_SUBMODULE_AMPDU (1<<12)
|
||||
#define WIFI_LOG_SUBMODULE_AMSDU (1<<13)
|
||||
#define WIFI_LOG_SUBMODULE_FRAG (1<<14)
|
||||
#define WIFI_LOG_SUBMODULE_WPA2 (1<<15)
|
||||
|
||||
/**
|
||||
* @brief Set WIFI received TCP/IP data cache ram type
|
||||
*
|
||||
* @param type if use dram
|
||||
*/
|
||||
void esp_wifi_set_rx_pbuf_mem_type(wifi_rx_pbuf_mem_type_t type);
|
||||
|
||||
/**
|
||||
* @brief get WIFI received TCP/IP data cache ram type
|
||||
*
|
||||
* @return true if use dram or false
|
||||
*/
|
||||
wifi_rx_pbuf_mem_type_t esp_wifi_get_rx_pbuf_mem_type(void);
|
||||
|
||||
int8_t esp_wifi_get_ap_rssi(void);
|
||||
|
||||
/**
|
||||
* @brief The RX callback function when receive probe request packet.
|
||||
* When probe request packet is received, the callback function will be called.
|
||||
*
|
||||
* @param frame Data of received probe request.
|
||||
* @param len length of received probe request.
|
||||
* @param rssi rssi of received probe request.
|
||||
*/
|
||||
typedef void (*wifi_sta_rx_probe_req_t)(const uint8_t *frame, int len, int rssi);
|
||||
|
||||
/**
|
||||
* @brief Register the RX callback function when receive probe request.
|
||||
*
|
||||
* When probe request packet is received, the registered callback function will be called.
|
||||
*
|
||||
* @param cb callback
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
|
||||
*/
|
||||
esp_err_t esp_wifi_set_sta_rx_probe_req(wifi_sta_rx_probe_req_t cb);
|
||||
|
||||
/**
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* @brief transmit the buffer via wifi driver
|
||||
*
|
||||
* @param wifi_interface_t wifi_if : wifi interface id
|
||||
* @param void *buffer : the buffer to be tansmit
|
||||
* @param uint16_t len : the length of buffer
|
||||
*
|
||||
* @return
|
||||
* - ERR_OK : Successfully transmit the buffer to wifi driver
|
||||
* - ERR_MEM : Out of memory
|
||||
* - ERR_IF : WiFi driver error
|
||||
* - ERR_ARG : Invalid argument
|
||||
*/
|
||||
int esp_wifi_internal_tx(wifi_interface_t wifi_if, void *buffer, uint16_t len);
|
||||
|
||||
/**
|
||||
* @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
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : succeed
|
||||
* - others : fail
|
||||
*/
|
||||
esp_err_t esp_wifi_internal_reg_rxcb(wifi_interface_t ifx, wifi_rxcb_t fn);
|
||||
|
||||
/**
|
||||
* @brief Set current WiFi log level
|
||||
*
|
||||
* @param level Log level.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - ESP_FAIL: level is invalid
|
||||
*/
|
||||
esp_err_t esp_wifi_internal_set_log_level(wifi_log_level_t level);
|
||||
|
||||
/**
|
||||
* @brief Set current log module and submodule
|
||||
*
|
||||
* @param module Log module
|
||||
* @param submodule Log submodule
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
|
||||
* - ESP_ERR_WIFI_ARG: invalid argument
|
||||
*/
|
||||
esp_err_t esp_wifi_internal_set_log_mod(uint32_t submodule);
|
||||
|
||||
/**
|
||||
* @brief Get current WiFi log info
|
||||
*
|
||||
* @param log_level the return log level.
|
||||
* @param log_mod the return log module and submodule
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
*/
|
||||
esp_err_t esp_wifi_internal_get_log(wifi_log_level_t *log_level, uint32_t *log_mod);
|
||||
|
||||
/**
|
||||
* @brief get wifi power management config.
|
||||
*
|
||||
* @param ps_config power management config
|
||||
*/
|
||||
void esp_wifi_set_pm_config(esp_pm_config_t *pm_config);
|
||||
|
||||
/**
|
||||
* @brief set wifi power management config.
|
||||
*
|
||||
* @param ps_config power management config
|
||||
*/
|
||||
void esp_wifi_get_pm_config(esp_pm_config_t *pm_config);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ESP_WIFI_INTERNAL_H */
|
Reference in New Issue
Block a user