feat(FreeRTOS): Modify for ESP8266

This commit is contained in:
Dong Heng
2018-08-22 10:59:29 +08:00
parent 56e89a4372
commit 8633994744
4 changed files with 21 additions and 5 deletions

View File

@ -15,5 +15,12 @@ config FREERTOS_HZ
default 100
help
Select the tick rate at which FreeRTOS does pre-emptive context switching.
config FREERTOS_MAX_HOOK
int "FreeRTOS hook max number"
range 1 16
default 2
help
configurate the max number of FreeRTOS hook function.
endmenu

View File

@ -21,16 +21,22 @@
#include "esp_freertos_hooks.h"
#include "sdkconfig.h"
#include "esp_pm.h"
#include "pm_impl.h"
//We use just a static array here because it's not expected many components will need
//an idle or tick hook.
#define MAX_HOOKS 8
#define MAX_HOOKS CONFIG_FREERTOS_MAX_HOOK
#undef portENTER_CRITICAL
#undef portEXIT_CRITICAL
#define portENTER_CRITICAL(_s) vPortEnterCritical()
#define portEXIT_CRITICAL(_s) vPortExitCritical()
#if portNUM_PROCESSORS > 1
static portMUX_TYPE hooks_spinlock = portMUX_INITIALIZER_UNLOCKED;
static esp_freertos_idle_cb_t idle_cb[portNUM_PROCESSORS][MAX_HOOKS]={0};
static esp_freertos_tick_cb_t tick_cb[portNUM_PROCESSORS][MAX_HOOKS]={0};
#endif
static esp_freertos_idle_cb_t idle_cb[portNUM_PROCESSORS][MAX_HOOKS];
static esp_freertos_tick_cb_t tick_cb[portNUM_PROCESSORS][MAX_HOOKS];
void IRAM_ATTR esp_vApplicationTickHook()
{

View File

@ -83,6 +83,7 @@
* See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/
#define portNUM_PROCESSORS 1
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 1
#define configUSE_TICK_HOOK 0

View File

@ -167,6 +167,8 @@ void PortEnableInt_NoNest( void );
#define portENTER_CRITICAL() vPortEnterCritical()
#define portEXIT_CRITICAL() vPortExitCritical()
#define xPortGetCoreID() 0
// no need to disable/enable lvl1 isr again in ISR
//#define portSET_INTERRUPT_MASK_FROM_ISR() PortDisableInt_NoNest()
//#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) PortEnableInt_NoNest()