2021-09-29 22:53:26 -04:00
|
|
|
/*
|
2024-03-29 03:00:50 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Espressif Systems (Shanghai) CO LTD
|
2021-09-29 22:53:26 -04:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2016-11-15 05:36:18 -05:00
|
|
|
|
2018-02-01 04:45:41 -05:00
|
|
|
#ifndef PHY_INIT_DATA_H
|
|
|
|
#define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */
|
2016-11-15 05:36:18 -05:00
|
|
|
#include "esp_phy_init.h"
|
|
|
|
#include "sdkconfig.h"
|
|
|
|
|
2020-01-26 22:43:08 -05:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2016-11-15 05:36:18 -05:00
|
|
|
// 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"
|
2024-03-29 03:00:50 -04:00
|
|
|
#define PHY_INIT_MAGIC_LEN 8 // should be strlen(PHY_INIT_MAGIC) + 1
|
2016-11-15 05:36:18 -05:00
|
|
|
|
2018-07-25 05:28:56 -04:00
|
|
|
// define the lowest tx power as LOWEST_PHY_TX_POWER
|
2021-06-15 23:39:08 -04:00
|
|
|
#define PHY_TX_POWER_LOWEST LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 52)
|
2022-04-25 23:29:11 -04:00
|
|
|
#define PHY_TX_POWER_OFFSET 2
|
|
|
|
#define PHY_TX_POWER_NUM 14
|
2018-07-25 05:28:56 -04:00
|
|
|
|
2021-06-15 23:39:08 -04:00
|
|
|
#if CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN
|
2019-10-15 23:22:50 -04:00
|
|
|
#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
|
|
|
|
|
2024-03-29 03:00:50 -04:00
|
|
|
extern const char phy_init_magic_pre[];
|
|
|
|
extern const esp_phy_init_data_t phy_init_data;
|
|
|
|
extern const char phy_init_magic_post[];
|
2016-11-15 05:36:18 -05:00
|
|
|
|
2021-06-15 23:39:08 -04:00
|
|
|
#if CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN
|
2019-10-15 23:22:50 -04:00
|
|
|
/**
|
2024-03-29 03:00:50 -04:00
|
|
|
* @brief PHY init data control information structure
|
2019-10-15 23:22:50 -04:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2024-03-29 03:00:50 -04:00
|
|
|
uint8_t control_info_checksum[4]; /*!< 4-byte control information checksum */
|
2019-10-15 23:22:50 -04:00
|
|
|
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
|
|
|
|
|
2020-01-26 22:43:08 -05:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-02-01 04:45:41 -05:00
|
|
|
#endif /* PHY_INIT_DATA_H */
|