Skip to content

Commit

Permalink
Merge branch 'bugfix/fix_some_wifi_bugs_230713_v5.1' into 'release/v5.1'
Browse files Browse the repository at this point in the history
Wifi: Backport some wifi bugs 230713 to v5.1(Backport v5.1)

See merge request espressif/esp-idf!24753
  • Loading branch information
jack0c committed Jul 13, 2023
2 parents d0a2424 + 7c4cd75 commit d7604b5
Show file tree
Hide file tree
Showing 24 changed files with 405 additions and 385 deletions.
72 changes: 39 additions & 33 deletions components/esp_coex/include/esp_coexist.h
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand All @@ -9,6 +9,7 @@

#include <stdbool.h>
#include "esp_err.h"
#include "hal/gpio_types.h"

#ifdef __cplusplus
extern "C" {
Expand All @@ -28,6 +29,7 @@ typedef enum {
EXTERN_COEX_WIRE_1 = 0,
EXTERN_COEX_WIRE_2,
EXTERN_COEX_WIRE_3,
EXTERN_COEX_WIRE_4,
EXTERN_COEX_WIRE_NUM,
} external_coex_wire_t;

Expand All @@ -45,12 +47,25 @@ typedef enum {
* @brief external coex gpio pti
*/
typedef struct {
uint32_t in_pin0;
uint32_t in_pin1;
uint32_t out_pin0;
uint32_t out_pin1;
union {
uint32_t in_pin0 __attribute__((deprecated("Use 'request' instead")));
gpio_num_t request; /**< request gpio signal from slave to master */
};
union {
uint32_t in_pin1 __attribute__((deprecated("Use 'priority' instead")));
gpio_num_t priority; /**< request gpio signal priority from slave to master */
};
union {
uint32_t out_pin0 __attribute__((deprecated("Use 'grant' instead")));
gpio_num_t grant; /**< grant gpio signal from master to slave */
};
union {
uint32_t out_pin1 __attribute__((deprecated("Use 'tx_line' instead")));
gpio_num_t tx_line; /**< tx_line gpio signal from master to slave, indicates whether the master's WiFi is transmitting or not*/
};
} esp_external_coex_gpio_set_t;


/**
* @brief external coex pti level
*/
Expand All @@ -60,14 +75,6 @@ typedef enum {
EXTERN_COEX_PTI_NUM,
} esp_coex_pti_level_t;

/**
* @brief external coex follower pti
*/
typedef struct {
uint32_t pti_val1;
uint32_t pti_val2;
} esp_external_coex_follower_pti_t;

/**
* @brief external coex role
*/
Expand All @@ -77,18 +84,6 @@ typedef enum {
EXTERNAL_COEX_UNKNOWN_ROLE,
} esp_extern_coex_work_mode_t;

/**
* @brief external coex wiretype & role composition
*/
typedef enum {
wire_3_leader_mode = 0,
wire_2_leader_mode,
wire_1_leader_mode,
wire_3_follower_mode,
wire_2_follower_mode,
wire_1_follower_mode,
} external_coex_classification;

/**
* @brief external coex advance setup
*/
Expand Down Expand Up @@ -143,6 +138,13 @@ esp_err_t esp_coex_status_bit_set(esp_coex_status_type_t type, uint32_t status);
esp_err_t esp_coex_status_bit_clear(esp_coex_status_type_t type, uint32_t status);

#if CONFIG_EXTERNAL_COEX_ENABLE
/**
* @brief Configure work mode, the default work mode is leader role.
* @param work_mode : work mode.
* @return : ESP_OK - success, other - failed
*/
esp_err_t esp_external_coex_set_work_mode(esp_extern_coex_work_mode_t work_mode);

/**
* @brief Setup gpio pin and corresponding pti level, start external coex,
* the default work mode is leader role, the default output grant validate pin is high,
Expand All @@ -165,21 +167,25 @@ esp_err_t esp_disable_extern_coex_gpio_pin();
* @brief Configure leader work mode, gpio pin correspondly and finally enable external coex,
* demand not to call the legacy function of `esp_enable_extern_coex_gpio_pin` any more.
* @param wire_type : to select the whole external coex gpio number.
* @param gpio_pin : gpio pin number to select.
* @param request : request gpio pin number to select.
* @param priority : priority gpio pin number to select.
* @param grant : grant gpio pin number to select.
* @return : ESP_OK - success, other - failed
*/
esp_err_t esp_external_coex_leader_role_set_gpio_pin(external_coex_wire_t wire_type, uint32_t in_pin0,
uint32_t in_pin1, uint32_t out_pin0);
esp_err_t esp_external_coex_leader_role_set_gpio_pin(external_coex_wire_t wire_type, uint32_t request, uint32_t priority,
uint32_t grant) __attribute__((deprecated("Please use esp_external_coex_set_work_mode and esp_enable_extern_coex_gpio_pin instead")));

/**
* @brief Configure follower work mode, gpio pin correspondly and finally enable external coex,
* demand not to call the legacy function of `esp_enable_extern_coex_gpio_pin` any more.
* @param wire_type : to select the whole external coex gpio number.
* @param gpio_pin : gpio pin number to select.
* @param request : request gpio pin number to select.
* @param priority : priority gpio pin number to select.
* @param grant : grant gpio pin number to select.
* @return : ESP_OK - success, other - failed
*/
esp_err_t esp_external_coex_follower_role_set_gpio_pin(external_coex_wire_t wire_type, uint32_t in_pin0,
uint32_t out_pin0, uint32_t out_pin1);
esp_err_t esp_external_coex_follower_role_set_gpio_pin(external_coex_wire_t wire_type, uint32_t request, uint32_t priority,
uint32_t grant) __attribute__((deprecated("Please use esp_external_coex_set_work_mode and esp_enable_extern_coex_gpio_pin instead")));

/**
* @brief Configure output grant signal latency in delay microseconds only for leader role of external coex,
Expand All @@ -198,8 +204,8 @@ esp_err_t esp_external_coex_set_grant_delay(uint8_t delay_us);
* @return : ESP_OK - success, other - failed
*/
esp_err_t esp_external_coex_set_validate_high(bool is_high_valid);
#endif
#endif
#endif /* SOC_EXTERNAL_COEX_ADVANCE */
#endif /* CONFIG_EXTERNAL_COEX_ENABLE */

#if CONFIG_ESP_COEX_SW_COEXIST_ENABLE && CONFIG_SOC_IEEE802154_SUPPORTED
/**
Expand Down
31 changes: 16 additions & 15 deletions components/esp_coex/include/esp_coexist_internal.h
Expand Up @@ -306,26 +306,15 @@ esp_err_t esp_coex_adapter_register(coex_adapter_funcs_t *funcs);

#if CONFIG_EXTERNAL_COEX_ENABLE
/**
* @brief Force RX Anttena only in external coex situation.
*/
extern void phy_coex_force_rx_ant(void);

/**
* @brief Dismiss RX Anttena only in external coex situation.
*/
extern void phy_coex_dismiss_rx_ant(void);

/**
* @brief Set external coexistence advanced informations, like working mode and grant mode in which level.
* @brief Set external coexistence advanced informations, like working mode.
*
* @param outpti1 Only for slave mode, external coex output priority in level1.
* @param output2 Only for slave mode, external coex output priority in level2.
* @param out_pti1 This parameter no longer works, will be deprecated and later removed in future releases.
* @param out_pti2 This parameter no longer works, will be deprecated and later removed in future releases.
*
* @return
* - ESP_OK: succeed
*/
esp_err_t esp_coex_external_params(esp_external_coex_advance_t coex_info,
uint32_t out_pti1, uint32_t out_pti2);
esp_err_t esp_coex_external_params(esp_external_coex_advance_t coex_info, uint32_t out_pti1, uint32_t out_pti2);

/**
* @brief Set external coexistence pti level and enable it.
Expand All @@ -347,6 +336,18 @@ esp_err_t esp_coex_external_set(esp_coex_pti_level_t level1,
* - ESP_OK: succeed
*/
void esp_coex_external_stop(void);

#if SOC_EXTERNAL_COEX_LEADER_TX_LINE
/**
* @brief Enable external coexist tx line
*
* @param en Enable external coex tx line
*
* @return
* - ESP_OK: succeed
*/
void esp_coex_external_set_txline(bool en);
#endif /*SOC_EXTERNAL_COEX_LEADER_TX_LINE*/
#endif /*External Coex*/

/**
Expand Down

0 comments on commit d7604b5

Please sign in to comment.