mirror of
				https://github.com/0xFEEDC0DE64/arduino-esp32.git
				synced 2025-11-03 15:41:47 +01:00 
			
		
		
		
	IDF master 1d7068e4b (#5257)
esp-dsp: master 7cc5073 esp-face: master 420fc7e esp-rainmaker: f1b82c7 esp32-camera: master 7a06a7e esp_littlefs: master b58f00c
This commit is contained in:
		@@ -1,175 +0,0 @@
 | 
			
		||||
// Copyright 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.
 | 
			
		||||
 | 
			
		||||
#ifndef PHY_INIT_DATA_H
 | 
			
		||||
#define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */
 | 
			
		||||
#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"
 | 
			
		||||
 | 
			
		||||
// define the lowest tx power as LOWEST_PHY_TX_POWER
 | 
			
		||||
#define PHY_TX_POWER_LOWEST LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 0, 52)
 | 
			
		||||
#define PHY_TX_POWER_OFFSET 44
 | 
			
		||||
#define PHY_TX_POWER_NUM    5
 | 
			
		||||
 | 
			
		||||
#if CONFIG_ESP32_SUPPORT_MULTIPLE_PHY_INIT_DATA_BIN
 | 
			
		||||
#define PHY_CRC_ALGORITHM 1
 | 
			
		||||
#define PHY_COUNTRY_CODE_LEN 2
 | 
			
		||||
#define PHY_INIT_DATA_TYPE_OFFSET 126
 | 
			
		||||
#define PHY_SUPPORT_MULTIPLE_BIN_OFFSET 125
 | 
			
		||||
#endif
 | 
			
		||||
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= { {
 | 
			
		||||
        3,
 | 
			
		||||
        3,
 | 
			
		||||
        0x05,
 | 
			
		||||
        0x09,
 | 
			
		||||
        0x06,
 | 
			
		||||
        0x05,
 | 
			
		||||
        0x03,
 | 
			
		||||
        0x06,
 | 
			
		||||
        0x05,
 | 
			
		||||
        0x04,
 | 
			
		||||
        0x06,
 | 
			
		||||
        0x04,
 | 
			
		||||
        0x05,
 | 
			
		||||
        0x00,
 | 
			
		||||
        0x00,
 | 
			
		||||
        0x00,
 | 
			
		||||
        0x00,
 | 
			
		||||
        0x05,
 | 
			
		||||
        0x09,
 | 
			
		||||
        0x06,
 | 
			
		||||
        0x05,
 | 
			
		||||
        0x03,
 | 
			
		||||
        0x06,
 | 
			
		||||
        0x05,
 | 
			
		||||
        0x00,
 | 
			
		||||
        0x00,
 | 
			
		||||
        0x00,
 | 
			
		||||
        0x00,
 | 
			
		||||
        0x00,
 | 
			
		||||
        0x00,
 | 
			
		||||
        0x00,
 | 
			
		||||
        0x00,
 | 
			
		||||
        0xfc,
 | 
			
		||||
        0xfc,
 | 
			
		||||
        0xfe,
 | 
			
		||||
        0xf0,
 | 
			
		||||
        0xf0,
 | 
			
		||||
        0xf0,
 | 
			
		||||
        0xe0,
 | 
			
		||||
        0xe0,
 | 
			
		||||
        0xe0,
 | 
			
		||||
        0x18,
 | 
			
		||||
        0x18,
 | 
			
		||||
        0x18,
 | 
			
		||||
        LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 40, 84),
 | 
			
		||||
        LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 40, 72),
 | 
			
		||||
        LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 40, 66),
 | 
			
		||||
        LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 40, 60),
 | 
			
		||||
        LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 40, 56),
 | 
			
		||||
        LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 40, 52),
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        2,
 | 
			
		||||
        2,
 | 
			
		||||
        3,
 | 
			
		||||
        4,
 | 
			
		||||
        5,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
} };
 | 
			
		||||
 | 
			
		||||
static const char phy_init_magic_post[] = PHY_INIT_MAGIC;
 | 
			
		||||
 | 
			
		||||
#if CONFIG_ESP32_SUPPORT_MULTIPLE_PHY_INIT_DATA_BIN
 | 
			
		||||
/**
 | 
			
		||||
 * @brief PHY init data control infomation structure
 | 
			
		||||
 */
 | 
			
		||||
typedef struct {
 | 
			
		||||
    uint8_t control_info_checksum[4];     /*!< 4-byte control infomation checksum */
 | 
			
		||||
    uint8_t multiple_bin_checksum[4];     /*!< 4-byte multiple bin checksum */
 | 
			
		||||
    uint8_t check_algorithm;              /*!< check algorithm */
 | 
			
		||||
    uint8_t version;                      /*!< PHY init data bin version */
 | 
			
		||||
    uint8_t number;                       /*!< PHY init data bin number */
 | 
			
		||||
    uint8_t length[2];                    /*!< Length of each PHY init data bin */
 | 
			
		||||
    uint8_t reserved[19];                 /*!< 19-byte reserved  */
 | 
			
		||||
} __attribute__ ((packed)) phy_control_info_data_t;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Country corresponds to PHY init data type structure
 | 
			
		||||
 */
 | 
			
		||||
typedef struct {
 | 
			
		||||
    char cc[PHY_COUNTRY_CODE_LEN];
 | 
			
		||||
    uint8_t type;
 | 
			
		||||
} phy_country_to_bin_type_t;
 | 
			
		||||
#endif
 | 
			
		||||
#endif /* PHY_INIT_DATA_H */
 | 
			
		||||
@@ -1,240 +0,0 @@
 | 
			
		||||
// 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.
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <stdbool.h>
 | 
			
		||||
#include "esp_err.h"
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file PHY init parameters and API
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Structure holding PHY init parameters
 | 
			
		||||
 */
 | 
			
		||||
typedef struct {
 | 
			
		||||
	uint8_t params[128];                    /*!< opaque PHY initialization parameters */
 | 
			
		||||
} esp_phy_init_data_t;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Opaque PHY calibration data
 | 
			
		||||
 */
 | 
			
		||||
typedef struct {
 | 
			
		||||
    uint8_t version[4];                     /*!< PHY version */
 | 
			
		||||
    uint8_t mac[6];                         /*!< The MAC address of the station */
 | 
			
		||||
    uint8_t opaque[1894];                   /*!< calibration data */
 | 
			
		||||
} esp_phy_calibration_data_t;
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
    PHY_RF_CAL_PARTIAL = 0x00000000,        /*!< Do part of RF calibration. This should be used after power-on reset. */
 | 
			
		||||
    PHY_RF_CAL_NONE    = 0x00000001,        /*!< Don't do any RF calibration. This mode is only suggested to be used after deep sleep reset. */
 | 
			
		||||
    PHY_RF_CAL_FULL    = 0x00000002         /*!< Do full RF calibration. Produces best results, but also consumes a lot of time and current. Suggested to be used once. */
 | 
			
		||||
} esp_phy_calibration_mode_t;
 | 
			
		||||
 | 
			
		||||
#if CONFIG_ESP32_SUPPORT_MULTIPLE_PHY_INIT_DATA_BIN
 | 
			
		||||
/**
 | 
			
		||||
 * @brief PHY init data type
 | 
			
		||||
 */
 | 
			
		||||
typedef enum {
 | 
			
		||||
    ESP_PHY_INIT_DATA_TYPE_DEFAULT = 0,
 | 
			
		||||
    ESP_PHY_INIT_DATA_TYPE_SRRC,
 | 
			
		||||
    ESP_PHY_INIT_DATA_TYPE_FCC,
 | 
			
		||||
    ESP_PHY_INIT_DATA_TYPE_CE,
 | 
			
		||||
    ESP_PHY_INIT_DATA_TYPE_NCC,
 | 
			
		||||
    ESP_PHY_INIT_DATA_TYPE_KCC,
 | 
			
		||||
    ESP_PHY_INIT_DATA_TYPE_MIC,
 | 
			
		||||
    ESP_PHY_INIT_DATA_TYPE_IC,
 | 
			
		||||
    ESP_PHY_INIT_DATA_TYPE_ACMA,
 | 
			
		||||
    ESP_PHY_INIT_DATA_TYPE_ANATEL,
 | 
			
		||||
    ESP_PHY_INIT_DATA_TYPE_ISED,
 | 
			
		||||
    ESP_PHY_INIT_DATA_TYPE_WPC,
 | 
			
		||||
    ESP_PHY_INIT_DATA_TYPE_OFCA,
 | 
			
		||||
    ESP_PHY_INIT_DATA_TYPE_IFETEL,
 | 
			
		||||
    ESP_PHY_INIT_DATA_TYPE_RCM,
 | 
			
		||||
    ESP_PHY_INIT_DATA_TYPE_NUMBER,
 | 
			
		||||
} phy_init_data_type_t;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Get PHY init data
 | 
			
		||||
 *
 | 
			
		||||
 * If "Use a partition to store PHY init data" option is set in menuconfig,
 | 
			
		||||
 * This function will load PHY init data from a partition. Otherwise,
 | 
			
		||||
 * PHY init data will be compiled into the application itself, and this function
 | 
			
		||||
 * will return a pointer to PHY init data located in read-only memory (DROM).
 | 
			
		||||
 *
 | 
			
		||||
 * If "Use a partition to store PHY init data" option is enabled, this function
 | 
			
		||||
 * may return NULL if the data loaded from flash is not valid.
 | 
			
		||||
 *
 | 
			
		||||
 * @note Call esp_phy_release_init_data to release the pointer obtained using
 | 
			
		||||
 * this function after the call to esp_wifi_init.
 | 
			
		||||
 *
 | 
			
		||||
 * @return pointer to PHY init data structure
 | 
			
		||||
 */
 | 
			
		||||
const esp_phy_init_data_t* esp_phy_get_init_data(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Release PHY init data
 | 
			
		||||
 * @param data  pointer to PHY init data structure obtained from
 | 
			
		||||
 *              esp_phy_get_init_data function
 | 
			
		||||
 */
 | 
			
		||||
void esp_phy_release_init_data(const esp_phy_init_data_t* data);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Function called by esp_phy_init to load PHY calibration data
 | 
			
		||||
 *
 | 
			
		||||
 * This is a convenience function which can be used to load PHY calibration
 | 
			
		||||
 * data from NVS. Data can be stored to NVS using esp_phy_store_cal_data_to_nvs
 | 
			
		||||
 * function.
 | 
			
		||||
 *
 | 
			
		||||
 * If calibration data is not present in the NVS, or
 | 
			
		||||
 * data is not valid (was obtained for a chip with a different MAC address,
 | 
			
		||||
 * or obtained for a different version of software), this function will
 | 
			
		||||
 * return an error.
 | 
			
		||||
 *
 | 
			
		||||
 * If "Initialize PHY in startup code" option is set in menuconfig, this
 | 
			
		||||
 * function will be used to load calibration data. To provide a different
 | 
			
		||||
 * mechanism for loading calibration data, disable
 | 
			
		||||
 * "Initialize PHY in startup code" option in menuconfig and call esp_phy_init
 | 
			
		||||
 * function from the application. For an example usage of esp_phy_init and
 | 
			
		||||
 * this function, see esp_phy_store_cal_data_to_nvs function in cpu_start.c
 | 
			
		||||
 *
 | 
			
		||||
 * @param out_cal_data pointer to calibration data structure to be filled with
 | 
			
		||||
 *                     loaded data.
 | 
			
		||||
 * @return ESP_OK on success
 | 
			
		||||
 */
 | 
			
		||||
esp_err_t esp_phy_load_cal_data_from_nvs(esp_phy_calibration_data_t* out_cal_data);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Function called by esp_phy_init to store PHY calibration data
 | 
			
		||||
 *
 | 
			
		||||
 * This is a convenience function which can be used to store PHY calibration
 | 
			
		||||
 * data to the NVS. Calibration data is returned by esp_phy_init function.
 | 
			
		||||
 * Data saved using this function to the NVS can later be loaded using
 | 
			
		||||
 * esp_phy_store_cal_data_to_nvs function.
 | 
			
		||||
 *
 | 
			
		||||
 * If "Initialize PHY in startup code" option is set in menuconfig, this
 | 
			
		||||
 * function will be used to store calibration data. To provide a different
 | 
			
		||||
 * mechanism for storing calibration data, disable
 | 
			
		||||
 * "Initialize PHY in startup code" option in menuconfig and call esp_phy_init
 | 
			
		||||
 * function from the application.
 | 
			
		||||
 *
 | 
			
		||||
 * @param cal_data pointer to calibration data which has to be saved.
 | 
			
		||||
 * @return ESP_OK on success
 | 
			
		||||
 */
 | 
			
		||||
esp_err_t esp_phy_store_cal_data_to_nvs(const esp_phy_calibration_data_t* cal_data);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Erase PHY calibration data which is stored in the NVS
 | 
			
		||||
 *
 | 
			
		||||
 * This is a function which can be used to trigger full calibration as a last-resort remedy
 | 
			
		||||
 * if partial calibration is used. It can be called in the application based on some conditions
 | 
			
		||||
 * (e.g. an option provided in some diagnostic mode).
 | 
			
		||||
 *
 | 
			
		||||
 * @return ESP_OK on success
 | 
			
		||||
 * @return others on fail. Please refer to NVS API return value error number.
 | 
			
		||||
 */
 | 
			
		||||
esp_err_t esp_phy_erase_cal_data_in_nvs(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Enable PHY and RF module
 | 
			
		||||
 *
 | 
			
		||||
 * PHY and RF module should be enabled in order to use WiFi or BT.
 | 
			
		||||
 * Now PHY and RF enabling job is done automatically when start WiFi or BT. Users should not
 | 
			
		||||
 * call this API in their application.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
void esp_phy_enable(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Disable PHY and RF module
 | 
			
		||||
 *
 | 
			
		||||
 * PHY module should be disabled in order to shutdown WiFi or BT.
 | 
			
		||||
 * Now PHY and RF disabling job is done automatically when stop WiFi or BT. Users should not
 | 
			
		||||
 * call this API in their application.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
void esp_phy_disable(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Load calibration data from NVS and initialize PHY and RF module
 | 
			
		||||
 */
 | 
			
		||||
void esp_phy_load_cal_and_init(void);
 | 
			
		||||
 | 
			
		||||
#if CONFIG_MAC_BB_PD
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Initialize backup memory for MAC and Baseband power up/down
 | 
			
		||||
 */
 | 
			
		||||
void esp_mac_bb_pd_mem_init(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Power up MAC and Baseband
 | 
			
		||||
 */
 | 
			
		||||
void esp_mac_bb_power_up(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Power down MAC and Baseband
 | 
			
		||||
 */
 | 
			
		||||
void esp_mac_bb_power_down(void);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Enable WiFi/BT common clock
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
void esp_phy_common_clock_enable(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Disable WiFi/BT common clock
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
void esp_phy_common_clock_disable(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief            Get the time stamp when PHY/RF was switched on
 | 
			
		||||
 * @return           return 0 if PHY/RF is never switched on. Otherwise return time in
 | 
			
		||||
 *                   microsecond since boot when phy/rf was last switched on
 | 
			
		||||
*/
 | 
			
		||||
int64_t esp_phy_rf_get_on_ts(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Update the corresponding PHY init type according to the country code of Wi-Fi.
 | 
			
		||||
 */
 | 
			
		||||
esp_err_t esp_phy_update_country_info(const char *country);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#if CONFIG_ESP32_SUPPORT_MULTIPLE_PHY_INIT_DATA_BIN
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Apply PHY init bin to PHY
 | 
			
		||||
 * @return ESP_OK on success.
 | 
			
		||||
 * @return ESP_FAIL on fail.
 | 
			
		||||
 */
 | 
			
		||||
esp_err_t esp_phy_apply_phy_init_data(uint8_t *init_data);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Get PHY lib version
 | 
			
		||||
 * @return PHY lib version.
 | 
			
		||||
 */
 | 
			
		||||
char * get_phy_version_str(void);
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,98 +0,0 @@
 | 
			
		||||
// 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.
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
#include "esp_phy_init.h"
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define ESP_CAL_DATA_CHECK_FAIL 1
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file phy.h
 | 
			
		||||
 * @brief Declarations for functions provided by libphy.a
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Return ROM function pointer table from PHY library.
 | 
			
		||||
 */
 | 
			
		||||
void phy_get_romfunc_addr(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Initialize PHY module and do RF calibration
 | 
			
		||||
 * @param[in] init_data Initialization parameters to be used by the PHY
 | 
			
		||||
 * @param[inout] cal_data As input, calibration data previously obtained. As output, will contain new calibration data.
 | 
			
		||||
 * @param[in] cal_mode  RF calibration mode
 | 
			
		||||
 * @return ESP_CAL_DATA_CHECK_FAIL if calibration data checksum fails, other values are reserved for future use
 | 
			
		||||
 */
 | 
			
		||||
int register_chipv7_phy(const esp_phy_init_data_t* init_data, esp_phy_calibration_data_t *cal_data, esp_phy_calibration_mode_t cal_mode);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Get the format version of calibration data used by PHY library.
 | 
			
		||||
 * @return Format version number, OR'ed with BIT(16) if PHY is in WIFI only mode.
 | 
			
		||||
 */
 | 
			
		||||
uint32_t phy_get_rf_cal_version(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Set RF/BB for only WIFI mode or coexist(WIFI & BT) mode
 | 
			
		||||
 * @param[in] true is for only WIFI mode, false is for coexist mode. default is 0.
 | 
			
		||||
 * @return NULL
 | 
			
		||||
 */
 | 
			
		||||
void phy_set_wifi_mode_only(bool wifi_only);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Set BT the highest priority in coexist mode.
 | 
			
		||||
 * @return NULL
 | 
			
		||||
 */
 | 
			
		||||
void coex_bt_high_prio(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Open PHY and RF.
 | 
			
		||||
 */
 | 
			
		||||
void phy_wakeup_init(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Shutdown PHY and RF.
 | 
			
		||||
 */
 | 
			
		||||
void phy_close_rf(void);
 | 
			
		||||
 | 
			
		||||
#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Disable PHY temperature sensor.
 | 
			
		||||
 */
 | 
			
		||||
void phy_xpd_tsens(void);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Store and load PHY digital registers.
 | 
			
		||||
 *
 | 
			
		||||
 * @param     backup_en  if backup_en is true, store PHY digital registers to memory. Otherwise load PHY digital registers from memory
 | 
			
		||||
 * @param     mem_addr   Memory address to store and load PHY digital registers
 | 
			
		||||
 *
 | 
			
		||||
 * @return    memory size
 | 
			
		||||
 */
 | 
			
		||||
uint8_t phy_dig_reg_backup(bool backup_en, uint32_t *mem_addr);
 | 
			
		||||
 | 
			
		||||
#if CONFIG_MAC_BB_PD
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Store and load baseband registers.
 | 
			
		||||
 */
 | 
			
		||||
void phy_freq_mem_backup(bool backup_en, uint32_t *mem);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
		Reference in New Issue
	
	Block a user