Skip to content

Commit

Permalink
Export FreeRTOS task-related constants to header file. See cesanta/mo…
Browse files Browse the repository at this point in the history
  • Loading branch information
Harvie committed Nov 4, 2020
1 parent bee6008 commit 8c7b793
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
27 changes: 27 additions & 0 deletions include/mgos_freertos.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,35 @@
#include "queue.h"
#include "task.h"

#include "mongoose.h"
#include "mgos_init.h"

#ifndef MGOS_TASK_STACK_SIZE_BYTES
#define MGOS_TASK_STACK_SIZE_BYTES 8192
#endif

#ifndef MGOS_TASK_PRIORITY
#define MGOS_TASK_PRIORITY 5
#endif

#ifndef MGOS_TASK_QUEUE_LENGTH
#define MGOS_TASK_QUEUE_LENGTH 32
#endif

#ifndef MGOS_MONGOOSE_MAX_POLL_SLEEP_MS
#define MGOS_MONGOOSE_MAX_POLL_SLEEP_MS 1000
#endif

#ifndef MGOS_EARLY_WDT_TIMEOUT
#define MGOS_EARLY_WDT_TIMEOUT 30 /* seconds */
#endif

#if CS_PLATFORM == CS_P_ESP32
#define STACK_SIZE_UNIT 1
#else
#define STACK_SIZE_UNIT sizeof(portSTACK_TYPE)
#endif

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
22 changes: 0 additions & 22 deletions src/mgos_freertos.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,6 @@
#include "mgos_uart_internal.h"
#include "mgos_utils.h"

#ifndef MGOS_TASK_STACK_SIZE_BYTES
#define MGOS_TASK_STACK_SIZE_BYTES 8192
#endif

#ifndef MGOS_TASK_PRIORITY
#define MGOS_TASK_PRIORITY 5
#endif

#ifndef MGOS_TASK_QUEUE_LENGTH
#define MGOS_TASK_QUEUE_LENGTH 32
#endif

#ifndef MGOS_MONGOOSE_MAX_POLL_SLEEP_MS
#define MGOS_MONGOOSE_MAX_POLL_SLEEP_MS 1000
#endif

#ifndef MGOS_EARLY_WDT_TIMEOUT
#define MGOS_EARLY_WDT_TIMEOUT 30 /* seconds */
#endif

extern const char *build_version, *build_id;
extern const char *mg_build_version, *mg_build_id;

Expand All @@ -82,7 +62,6 @@ static portMUX_TYPE s_poll_spinlock = portMUX_INITIALIZER_UNLOCKED;
{ \
if (should_yield) portYIELD_FROM_ISR(); \
}
#define STACK_SIZE_UNIT 1
#else
#define ENTER_CRITICAL() portENTER_CRITICAL()
#define EXIT_CRITICAL() portEXIT_CRITICAL()
Expand All @@ -92,7 +71,6 @@ static portMUX_TYPE s_poll_spinlock = portMUX_INITIALIZER_UNLOCKED;
#define EXIT_CRITICAL_NO_ISR(from_isr) \
if (!from_isr) portEXIT_CRITICAL()
#define YIELD_FROM_ISR(should_yield) portYIELD_FROM_ISR(should_yield)
#define STACK_SIZE_UNIT sizeof(portSTACK_TYPE)
#endif

static IRAM void mgos_mg_poll_cb(void *arg) {
Expand Down

0 comments on commit 8c7b793

Please sign in to comment.