forked from espressif/esp-idf
change(esp_hw_support): optimize periph ctrl memory (iram or flash) usage control by PERIPH_CTRL_FUNC_IN_IRAM
This commit is contained in:
@@ -41,7 +41,13 @@ entries:
|
||||
if IDF_TARGET_ESP32 = y || IDF_TARGET_ESP32S2 = y:
|
||||
rtc_wdt (noflash_text)
|
||||
if PERIPH_CTRL_FUNC_IN_IRAM = y:
|
||||
periph_ctrl: periph_module_reset (noflash)
|
||||
periph_ctrl:periph_module_reset (noflash)
|
||||
periph_ctrl:periph_rcc_enter (noflash)
|
||||
periph_ctrl:periph_rcc_exit (noflash)
|
||||
periph_ctrl:periph_rcc_acquire_enter (noflash)
|
||||
periph_ctrl:periph_rcc_acquire_exit (noflash)
|
||||
periph_ctrl:periph_rcc_release_enter (noflash)
|
||||
periph_ctrl:periph_rcc_release_exit (noflash)
|
||||
if PERIPH_CTRL_FUNC_IN_IRAM = y && ESP_WIFI_ENABLED = y:
|
||||
periph_ctrl: wifi_module_enable (noflash)
|
||||
periph_ctrl: wifi_module_disable (noflash)
|
||||
|
@@ -21,35 +21,35 @@ static portMUX_TYPE periph_spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
|
||||
static uint8_t ref_counts[PERIPH_MODULE_MAX] = {0};
|
||||
|
||||
IRAM_ATTR void periph_rcc_enter(void)
|
||||
void periph_rcc_enter(void)
|
||||
{
|
||||
portENTER_CRITICAL_SAFE(&periph_spinlock);
|
||||
}
|
||||
|
||||
IRAM_ATTR void periph_rcc_exit(void)
|
||||
void periph_rcc_exit(void)
|
||||
{
|
||||
portEXIT_CRITICAL_SAFE(&periph_spinlock);
|
||||
}
|
||||
|
||||
IRAM_ATTR uint8_t periph_rcc_acquire_enter(periph_module_t periph)
|
||||
uint8_t periph_rcc_acquire_enter(periph_module_t periph)
|
||||
{
|
||||
periph_rcc_enter();
|
||||
return ref_counts[periph];
|
||||
}
|
||||
|
||||
IRAM_ATTR void periph_rcc_acquire_exit(periph_module_t periph, uint8_t ref_count)
|
||||
void periph_rcc_acquire_exit(periph_module_t periph, uint8_t ref_count)
|
||||
{
|
||||
ref_counts[periph] = ++ref_count;
|
||||
periph_rcc_exit();
|
||||
}
|
||||
|
||||
IRAM_ATTR uint8_t periph_rcc_release_enter(periph_module_t periph)
|
||||
uint8_t periph_rcc_release_enter(periph_module_t periph)
|
||||
{
|
||||
periph_rcc_enter();
|
||||
return ref_counts[periph] - 1;
|
||||
}
|
||||
|
||||
IRAM_ATTR void periph_rcc_release_exit(periph_module_t periph, uint8_t ref_count)
|
||||
void periph_rcc_release_exit(periph_module_t periph, uint8_t ref_count)
|
||||
{
|
||||
ref_counts[periph] = ref_count;
|
||||
periph_rcc_exit();
|
||||
|
Reference in New Issue
Block a user