Skip to content

Commit

Permalink
Merge branch 'feature/external_coexist_improve_esp32s3_master_perform…
Browse files Browse the repository at this point in the history
…ance' into 'master'

Feature/external coexist improve esp32s3 master performance

Closes WIFI-5583, IDF-6640, IDF-6652, and FCC-52

See merge request espressif/esp-idf!23150
  • Loading branch information
jack0c committed Jul 12, 2023
2 parents dd08ec0 + 444760b commit d04928a
Show file tree
Hide file tree
Showing 18 changed files with 295 additions and 343 deletions.
72 changes: 39 additions & 33 deletions components/esp_coex/include/esp_coexist.h
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Loading

0 comments on commit d04928a

Please sign in to comment.