mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-08-05 22:11:04 +08:00
feat(freertos): speed up CPU hardware interrupt active event
This commit is contained in:
@ -111,6 +111,7 @@ extern void vTaskSwitchContext( void ); \
|
||||
} \
|
||||
}
|
||||
|
||||
void portYIELD_FROM_ISR(void);
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
extern unsigned cpu_sr;
|
||||
|
@ -53,7 +53,6 @@
|
||||
#define PORT_ASSERT(x) do { if (!(x)) {ets_printf("%s %u\n", "rtos_port", __LINE__); while(1){}; }} while (0)
|
||||
|
||||
extern uint8_t NMIIrqIsOn;
|
||||
static int SWReq = 0;
|
||||
|
||||
uint32_t cpu_sr;
|
||||
|
||||
@ -68,9 +67,15 @@ uint64_t g_esp_os_ticks;
|
||||
uint64_t g_esp_os_us;
|
||||
uint64_t g_esp_os_cpu_clk;
|
||||
|
||||
static uint32_t s_switch_ctx_flag;
|
||||
|
||||
void vPortEnterCritical(void);
|
||||
void vPortExitCritical(void);
|
||||
|
||||
void IRAM_ATTR portYIELD_FROM_ISR(void)
|
||||
{
|
||||
s_switch_ctx_flag = 1;
|
||||
}
|
||||
|
||||
uint8_t *__cpu_init_stk(uint8_t *stack_top, void (*_entry)(void *), void *param, void (*_exit)(void))
|
||||
{
|
||||
@ -112,7 +117,7 @@ void IRAM_ATTR PendSV(int req)
|
||||
{
|
||||
if (req == 1) {
|
||||
vPortEnterCritical();
|
||||
SWReq = 1;
|
||||
s_switch_ctx_flag = 1;
|
||||
xthal_set_intset(1 << ETS_SOFT_INUM);
|
||||
vPortExitCritical();
|
||||
} else if (req == 2) {
|
||||
@ -120,13 +125,12 @@ void IRAM_ATTR PendSV(int req)
|
||||
}
|
||||
}
|
||||
|
||||
void TASK_SW_ATTR SoftIsrHdl(void* arg)
|
||||
void IRAM_ATTR SoftIsrHdl(void* arg)
|
||||
{
|
||||
extern int MacIsrSigPostDefHdl(void);
|
||||
|
||||
if (MacIsrSigPostDefHdl() || (SWReq == 1)) {
|
||||
vTaskSwitchContext();
|
||||
SWReq = 0;
|
||||
if (MacIsrSigPostDefHdl()) {
|
||||
portYIELD_FROM_ISR();
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,7 +169,7 @@ void IRAM_ATTR xPortSysTickHandle(void *p)
|
||||
g_esp_os_ticks++;
|
||||
|
||||
if (xTaskIncrementTick() != pdFALSE) {
|
||||
vTaskSwitchContext();
|
||||
portYIELD_FROM_ISR();
|
||||
}
|
||||
}
|
||||
|
||||
@ -259,7 +263,7 @@ void IRAM_ATTR vPortExitCritical(void)
|
||||
void show_critical_info(void)
|
||||
{
|
||||
ets_printf("ShowCritical:%u\n", uxCriticalNesting);
|
||||
ets_printf("SWReq:%u\n", SWReq);
|
||||
ets_printf("s_switch_ctx_flag:%u\n", s_switch_ctx_flag);
|
||||
}
|
||||
|
||||
#ifdef ESP_DPORT_CLOSE_NMI
|
||||
@ -345,6 +349,11 @@ void IRAM_ATTR _xt_isr_handler(void)
|
||||
mask &= ~bit;
|
||||
}
|
||||
} while (soc_get_int_mask());
|
||||
|
||||
if (s_switch_ctx_flag) {
|
||||
vTaskSwitchContext();
|
||||
s_switch_ctx_flag = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int xPortInIsrContext(void)
|
||||
|
Reference in New Issue
Block a user