Skip to content

Commit 8c7b793

Browse files
committed
Export FreeRTOS task-related constants to header file. See cesanta/mongoose-os#554
1 parent bee6008 commit 8c7b793

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed

include/mgos_freertos.h

+27
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,35 @@
2323
#include "queue.h"
2424
#include "task.h"
2525

26+
#include "mongoose.h"
2627
#include "mgos_init.h"
2728

29+
#ifndef MGOS_TASK_STACK_SIZE_BYTES
30+
#define MGOS_TASK_STACK_SIZE_BYTES 8192
31+
#endif
32+
33+
#ifndef MGOS_TASK_PRIORITY
34+
#define MGOS_TASK_PRIORITY 5
35+
#endif
36+
37+
#ifndef MGOS_TASK_QUEUE_LENGTH
38+
#define MGOS_TASK_QUEUE_LENGTH 32
39+
#endif
40+
41+
#ifndef MGOS_MONGOOSE_MAX_POLL_SLEEP_MS
42+
#define MGOS_MONGOOSE_MAX_POLL_SLEEP_MS 1000
43+
#endif
44+
45+
#ifndef MGOS_EARLY_WDT_TIMEOUT
46+
#define MGOS_EARLY_WDT_TIMEOUT 30 /* seconds */
47+
#endif
48+
49+
#if CS_PLATFORM == CS_P_ESP32
50+
#define STACK_SIZE_UNIT 1
51+
#else
52+
#define STACK_SIZE_UNIT sizeof(portSTACK_TYPE)
53+
#endif
54+
2855
#ifdef __cplusplus
2956
extern "C" {
3057
#endif

src/mgos_freertos.c

-22
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,6 @@
3939
#include "mgos_uart_internal.h"
4040
#include "mgos_utils.h"
4141

42-
#ifndef MGOS_TASK_STACK_SIZE_BYTES
43-
#define MGOS_TASK_STACK_SIZE_BYTES 8192
44-
#endif
45-
46-
#ifndef MGOS_TASK_PRIORITY
47-
#define MGOS_TASK_PRIORITY 5
48-
#endif
49-
50-
#ifndef MGOS_TASK_QUEUE_LENGTH
51-
#define MGOS_TASK_QUEUE_LENGTH 32
52-
#endif
53-
54-
#ifndef MGOS_MONGOOSE_MAX_POLL_SLEEP_MS
55-
#define MGOS_MONGOOSE_MAX_POLL_SLEEP_MS 1000
56-
#endif
57-
58-
#ifndef MGOS_EARLY_WDT_TIMEOUT
59-
#define MGOS_EARLY_WDT_TIMEOUT 30 /* seconds */
60-
#endif
61-
6242
extern const char *build_version, *build_id;
6343
extern const char *mg_build_version, *mg_build_id;
6444

@@ -82,7 +62,6 @@ static portMUX_TYPE s_poll_spinlock = portMUX_INITIALIZER_UNLOCKED;
8262
{ \
8363
if (should_yield) portYIELD_FROM_ISR(); \
8464
}
85-
#define STACK_SIZE_UNIT 1
8665
#else
8766
#define ENTER_CRITICAL() portENTER_CRITICAL()
8867
#define EXIT_CRITICAL() portEXIT_CRITICAL()
@@ -92,7 +71,6 @@ static portMUX_TYPE s_poll_spinlock = portMUX_INITIALIZER_UNLOCKED;
9271
#define EXIT_CRITICAL_NO_ISR(from_isr) \
9372
if (!from_isr) portEXIT_CRITICAL()
9473
#define YIELD_FROM_ISR(should_yield) portYIELD_FROM_ISR(should_yield)
95-
#define STACK_SIZE_UNIT sizeof(portSTACK_TYPE)
9674
#endif
9775

9876
static IRAM void mgos_mg_poll_cb(void *arg) {

0 commit comments

Comments
 (0)