Select one of the symbols to view example projects that use it.
 
Outline
#include <stdbool.h>
#include "esp_attr.h"
#include "esp_private/regi2c_ctrl.h"
#include "esp_private/sar_periph_ctrl.h"
#include "esp_private/sar_periph_ctrl.h"
#include "freertos/FreeRTOS.h"
s_wifi_adc_xpd_flag
include_esp_phy_override()
set_xpd_sar(bool)
phy_i2c_enter_critical()
phy_i2c_exit_critical()
phy_set_pwdet_power(bool)
phy_set_tsens_power(bool)
phy_get_tsens_value()
Files
loading...
SourceVuESP-IDF Framework and ExamplesESP-IDFcomponents/esp_phy/src/phy_override.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */ #include <stdbool.h> #include "esp_attr.h" #include "esp_private/regi2c_ctrl.h" #include "esp_private/sar_periph_ctrl.h" #include "esp_private/sar_periph_ctrl.h" #include "freertos/FreeRTOS.h"6 includes /* * This file is used to override the hooks provided by the PHY lib for some system features. * Call phy_override() so that this file will be linked. *//* ... */ static bool s_wifi_adc_xpd_flag; #if CONFIG_SOC_TEMP_SENSOR_SUPPORTED // TODO: [ESP32C5] IDF-8727 remove me when fix IDF-8727 static bool s_wifi_pwdet_xpd_flag; static bool s_wifi_tsens_xpd_flag;/* ... */ #endif void include_esp_phy_override(void) { /* When this empty function is called, all functions below will be linked. */ }{ ... } /* Coordinate ADC power with other modules. */ // It seems that it is only required on ESP32, but we still compile it for all chips, in case it is // called by PHY unexpectedly. void set_xpd_sar(bool en) { if (s_wifi_adc_xpd_flag == en) { /* ignore repeated calls to set_xpd_sar when the state is already correct */ return; }{...} s_wifi_adc_xpd_flag = en; if (en) { sar_periph_ctrl_pwdet_power_acquire(); }{...} else { sar_periph_ctrl_pwdet_power_release(); }{...} }{ ... } //add spinlock protection IRAM_ATTR void phy_i2c_enter_critical(void) { regi2c_enter_critical(); }{ ... } IRAM_ATTR void phy_i2c_exit_critical(void) { regi2c_exit_critical(); }{ ... } void phy_set_pwdet_power(bool en) { #if CONFIG_SOC_TEMP_SENSOR_SUPPORTED // TODO: [ESP32C5] IDF-8727 remove me when fix IDF-8727 if (s_wifi_pwdet_xpd_flag == en) { /* ignore repeated calls to phy_set_pwdet_power when the state is already correct */ return; }{...} s_wifi_pwdet_xpd_flag = en; if (en) { sar_periph_ctrl_pwdet_power_acquire(); }{...} else { sar_periph_ctrl_pwdet_power_release(); }{...} #endif/* ... */ }{ ... } void IRAM_ATTR phy_set_tsens_power(bool en) { #if CONFIG_SOC_TEMP_SENSOR_SUPPORTED // TODO: [ESP32C5] IDF-8727 remove me when fix IDF-8727 if (s_wifi_tsens_xpd_flag == en) { /* ignore repeated calls to phy_set_tsens_power when the state is already correct */ return; }{...} s_wifi_tsens_xpd_flag = en; if (en) { temperature_sensor_power_acquire(); }{...} else { temperature_sensor_power_release(); }{...} #endif/* ... */ }{ ... } int16_t phy_get_tsens_value(void) { #if CONFIG_SOC_TEMP_SENSOR_SUPPORTED // TODO: [ESP32C5] IDF-8727 remove me when fix IDF-8727 return temp_sensor_get_raw_value(NULL); #else return 0; #endif }{ ... }
Details