forked from espressif/esp-idf
change(esp_hw_support): optimize regi2c ctrl memory (iram or flash) usage control by REGI2C_CTRL_FUNC_IN_IRAM
This commit is contained in:
@@ -225,6 +225,13 @@ menu "Hardware Settings"
|
||||
help
|
||||
Place peripheral control functions (e.g. periph_module_reset) into IRAM,
|
||||
so that these functions can be IRAM-safe and able to be called in the other IRAM interrupt context.
|
||||
|
||||
config REGI2C_CTRL_FUNC_IN_IRAM
|
||||
bool "Place regi2c control functions into IRAM"
|
||||
default y
|
||||
help
|
||||
Place analog i2c master control functions (e.g. regi2c_ctrl_read_reg, regi2c_ctrl_write_reg) into IRAM,
|
||||
so that these functions can be IRAM-safe and able to be called in the other IRAM interrupt context.
|
||||
endmenu
|
||||
|
||||
menu "ETM Configuration"
|
||||
|
@@ -51,6 +51,13 @@ entries:
|
||||
if PERIPH_CTRL_FUNC_IN_IRAM = y && ESP_WIFI_ENABLED = y:
|
||||
periph_ctrl: wifi_module_enable (noflash)
|
||||
periph_ctrl: wifi_module_disable (noflash)
|
||||
if REGI2C_CTRL_FUNC_IN_IRAM = y:
|
||||
regi2c_ctrl:regi2c_ctrl_read_reg (noflash)
|
||||
regi2c_ctrl:regi2c_ctrl_read_reg_mask (noflash)
|
||||
regi2c_ctrl:regi2c_ctrl_write_reg (noflash)
|
||||
regi2c_ctrl:regi2c_ctrl_write_reg_mask (noflash)
|
||||
regi2c_ctrl:regi2c_enter_critical (noflash)
|
||||
regi2c_ctrl:regi2c_exit_critical (noflash)
|
||||
if SOC_SYSTIMER_SUPPORTED = y:
|
||||
systimer (noflash)
|
||||
if SOC_ADC_SHARED_POWER = y:
|
||||
|
@@ -18,7 +18,7 @@ static portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;
|
||||
|
||||
static DRAM_ATTR __attribute__((unused)) const char *TAG = "REGI2C";
|
||||
|
||||
uint8_t IRAM_ATTR regi2c_ctrl_read_reg(uint8_t block, uint8_t host_id, uint8_t reg_add)
|
||||
uint8_t regi2c_ctrl_read_reg(uint8_t block, uint8_t host_id, uint8_t reg_add)
|
||||
{
|
||||
REGI2C_CLOCK_ENABLE();
|
||||
portENTER_CRITICAL_SAFE(&mux);
|
||||
@@ -28,7 +28,7 @@ uint8_t IRAM_ATTR regi2c_ctrl_read_reg(uint8_t block, uint8_t host_id, uint8_t r
|
||||
return value;
|
||||
}
|
||||
|
||||
uint8_t IRAM_ATTR regi2c_ctrl_read_reg_mask(uint8_t block, uint8_t host_id, uint8_t reg_add, uint8_t msb, uint8_t lsb)
|
||||
uint8_t regi2c_ctrl_read_reg_mask(uint8_t block, uint8_t host_id, uint8_t reg_add, uint8_t msb, uint8_t lsb)
|
||||
{
|
||||
REGI2C_CLOCK_ENABLE();
|
||||
portENTER_CRITICAL_SAFE(&mux);
|
||||
@@ -38,7 +38,7 @@ uint8_t IRAM_ATTR regi2c_ctrl_read_reg_mask(uint8_t block, uint8_t host_id, uint
|
||||
return value;
|
||||
}
|
||||
|
||||
void IRAM_ATTR regi2c_ctrl_write_reg(uint8_t block, uint8_t host_id, uint8_t reg_add, uint8_t data)
|
||||
void regi2c_ctrl_write_reg(uint8_t block, uint8_t host_id, uint8_t reg_add, uint8_t data)
|
||||
{
|
||||
REGI2C_CLOCK_ENABLE();
|
||||
portENTER_CRITICAL_SAFE(&mux);
|
||||
@@ -47,7 +47,7 @@ void IRAM_ATTR regi2c_ctrl_write_reg(uint8_t block, uint8_t host_id, uint8_t reg
|
||||
REGI2C_CLOCK_DISABLE();
|
||||
}
|
||||
|
||||
void IRAM_ATTR regi2c_ctrl_write_reg_mask(uint8_t block, uint8_t host_id, uint8_t reg_add, uint8_t msb, uint8_t lsb, uint8_t data)
|
||||
void regi2c_ctrl_write_reg_mask(uint8_t block, uint8_t host_id, uint8_t reg_add, uint8_t msb, uint8_t lsb, uint8_t data)
|
||||
{
|
||||
REGI2C_CLOCK_ENABLE();
|
||||
portENTER_CRITICAL_SAFE(&mux);
|
||||
@@ -56,12 +56,12 @@ void IRAM_ATTR regi2c_ctrl_write_reg_mask(uint8_t block, uint8_t host_id, uint8_
|
||||
REGI2C_CLOCK_DISABLE();
|
||||
}
|
||||
|
||||
void IRAM_ATTR regi2c_enter_critical(void)
|
||||
void regi2c_enter_critical(void)
|
||||
{
|
||||
portENTER_CRITICAL_SAFE(&mux);
|
||||
}
|
||||
|
||||
void IRAM_ATTR regi2c_exit_critical(void)
|
||||
void regi2c_exit_critical(void)
|
||||
{
|
||||
portEXIT_CRITICAL_SAFE(&mux);
|
||||
}
|
||||
|
Reference in New Issue
Block a user