diff --git a/components/ethernet/eth_phy/phy_common.c b/components/ethernet/eth_phy/phy_common.c index a72a6daf8..88e5d0c73 100644 --- a/components/ethernet/eth_phy/phy_common.c +++ b/components/ethernet/eth_phy/phy_common.c @@ -41,8 +41,10 @@ void phy_rmii_configure_data_interface_pins(void) void phy_rmii_smi_configure_pins(uint8_t mdc_gpio, uint8_t mdio_gpio) { gpio_matrix_out(mdc_gpio, EMAC_MDC_O_IDX, 0, 0); + PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[mdc_gpio], PIN_FUNC_GPIO); gpio_matrix_out(mdio_gpio, EMAC_MDO_O_IDX, 0, 0); gpio_matrix_in(mdio_gpio, EMAC_MDI_I_IDX, 0); + PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[mdio_gpio], PIN_FUNC_GPIO); } void phy_mii_enable_flow_ctrl(void) diff --git a/components/freertos/include/freertos/FreeRTOSConfig.h b/components/freertos/include/freertos/FreeRTOSConfig.h index 5f5cebc6b..37912a66c 100644 --- a/components/freertos/include/freertos/FreeRTOSConfig.h +++ b/components/freertos/include/freertos/FreeRTOSConfig.h @@ -253,6 +253,7 @@ int xt_clock_freq(void) __attribute__((deprecated)); #define INCLUDE_uxTaskGetStackHighWaterMark 1 #define INCLUDE_pcTaskGetTaskName 1 #define INCLUDE_xTaskGetIdleTaskHandle 1 +#define INCLUDE_pxTaskGetStackStart 1 #define INCLUDE_xSemaphoreGetMutexHolder 1 diff --git a/components/freertos/tasks.c b/components/freertos/tasks.c index bdfe1086c..ff549183a 100644 --- a/components/freertos/tasks.c +++ b/components/freertos/tasks.c @@ -3814,14 +3814,17 @@ BaseType_t xTaskGetAffinity( TaskHandle_t xTask ) /*-----------------------------------------------------------*/ #if (INCLUDE_pxTaskGetStackStart == 1) - uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) - { - TCB_t *pxTCB; - UBaseType_t uxReturn; - pxTCB = prvGetTCBFromHandle( xTask ); - return ( uint8_t * ) pxTCB->pxStack; - } + uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) + { + TCB_t *pxTCB; + uint8_t* uxReturn; + + pxTCB = prvGetTCBFromHandle( xTask ); + uxReturn = (uint8_t*)pxTCB->pxStack; + + return uxReturn; + } #endif /* INCLUDE_pxTaskGetStackStart */ /*-----------------------------------------------------------*/ diff --git a/components/log/include/esp_log.h b/components/log/include/esp_log.h index 085970c51..e525bca3c 100644 --- a/components/log/include/esp_log.h +++ b/components/log/include/esp_log.h @@ -55,11 +55,14 @@ void esp_log_level_set(const char* tag, esp_log_level_t level); * @brief Set function used to output log entries * * By default, log output goes to UART0. This function can be used to redirect log - * output to some other destination, such as file or network. + * output to some other destination, such as file or network. Returns the original + * log handler, which may be necessary to return output to the previous destination. * - * @param func Function used for output. Must have same signature as vprintf. + * @param func new Function used for output. Must have same signature as vprintf. + * + * @return func old Function used for output. */ -void esp_log_set_vprintf(vprintf_like_t func); +vprintf_like_t esp_log_set_vprintf(vprintf_like_t func); /** * @brief Function which returns timestamp to be used in log output diff --git a/components/log/log.c b/components/log/log.c index 038e8e163..370c8b01c 100644 --- a/components/log/log.c +++ b/components/log/log.c @@ -106,9 +106,18 @@ static inline void heap_swap(int i, int j); static inline bool should_output(esp_log_level_t level_for_message, esp_log_level_t level_for_tag); static inline void clear_log_level_list(); -void esp_log_set_vprintf(vprintf_like_t func) +vprintf_like_t esp_log_set_vprintf(vprintf_like_t func) { + if (!s_log_mutex) { + s_log_mutex = xSemaphoreCreateMutex(); + } + xSemaphoreTake(s_log_mutex, portMAX_DELAY); + + vprintf_like_t orig_func = s_log_print_func; s_log_print_func = func; + + xSemaphoreGive(s_log_mutex); + return orig_func; } void esp_log_level_set(const char* tag, esp_log_level_t level) diff --git a/components/soc/esp32/include/soc/io_mux_reg.h b/components/soc/esp32/include/soc/io_mux_reg.h index be07c6bcd..2598989d0 100644 --- a/components/soc/esp32/include/soc/io_mux_reg.h +++ b/components/soc/esp32/include/soc/io_mux_reg.h @@ -72,7 +72,6 @@ #define MCU_SEL_M (MCU_SEL_V << MCU_SEL_S) #define MCU_SEL_V 0x7 #define MCU_SEL_S 12 -#define MCU_SEL_V 0x7 #define PIN_INPUT_ENABLE(PIN_NAME) SET_PERI_REG_MASK(PIN_NAME,FUN_IE) #define PIN_INPUT_DISABLE(PIN_NAME) CLEAR_PERI_REG_MASK(PIN_NAME,FUN_IE)