This is the interface of LoRaWAN system task manager.
Copyright (c) 2018 Microchip Technology Inc. and its subsidiaries.
#include <stdbool.h>
#include <stdint.h>
Typedefs | |
typedef enum _SYSTEM_Task_t | SYSTEM_Task_t |
typedef enum _SYSTEM_TaskStatus_t | SYSTEM_TaskStatus_t |
Possible results of task handler execution. More... | |
Enumerations | |
enum | _SYSTEM_Task_t { TIMER_TASK_ID = 1 << 0, RADIO_TASK_ID = 1 << 1, LORAWAN_TASK_ID = 1 << 2, PDS_TASK_ID = 1 << 3, APP_TASK_ID = 1 << 4 } |
enum | _SYSTEM_TaskStatus_t { SYSTEM_TASK_SUCCESS = 0x00, SYSTEM_TASK_FAILURE = 0x01 } |
Possible results of task handler execution. More... | |
Functions | |
void | SYSTEM_PostTask (SYSTEM_Task_t task) |
Posts a task to the task manager, which is later processed by the task handler of the corresponding stack layer. More... | |
bool | SYSTEM_ReadyToSleep (void) |
Returns the readiness of the system for sleep. More... | |
void | SYSTEM_RunTasks (void) |
This function is called by the stack or from the main() More... | |
typedef enum _SYSTEM_Task_t SYSTEM_Task_t |
The list of task IDs. The IDs are sorted according to descending
priority. For each task ID there is the corresponding task handler function.
typedef enum _SYSTEM_TaskStatus_t SYSTEM_TaskStatus_t |
Possible results of task handler execution.
enum _SYSTEM_Task_t |
enum _SYSTEM_TaskStatus_t |
void SYSTEM_PostTask | ( | SYSTEM_Task_t | task | ) |
Posts a task to the task manager, which is later processed by the task handler of the corresponding stack layer.
A task is processed when the SYSTEM_RunTasks() function.
[in] | task | - ID of the posted task. |
A task is processed when the SYSTEM_RunTasks() function.
IDs of the tasks are listed in the SYSTEM_Task_t enum. Each task has its own priority and is called only if there is no any task with higher priority.
A handler is called when respective task can be run. Each task has its own task handler.
Correspondence between tasks and handlers is listed below:
RADIO RADIO_TaskHandler()
HAL - HAL_TaskHandler()
LORAWAN - LORAWAN_TaskHandler()
APP - APP_TaskHandler()
[in] | task | - ID of the posted task. |
References ATOMIC_SECTION_ENTER, ATOMIC_SECTION_EXIT, and sysTaskFlag.
Referenced by APP_TaskHandler(), appPostTask(), messageTimerCb(), MSG_Send(), PDS_TaskHandler(), pdsPostTask(), processRunRestoreBand(), processRxDataAvailable(), and Stack_Init().
bool SYSTEM_ReadyToSleep | ( | void | ) |
Returns the readiness of the system for sleep.
References sysTaskFlag.
Referenced by PMM_Sleep().
void SYSTEM_RunTasks | ( | void | ) |
This function is called by the stack or from the main()
If several tasks have been posted by the moment of the function's call, they are executed in order of layers' priority: a task of the layer with the highest priority is executed first.
This function is called by the stack or from the main()
References ATOMIC_SECTION_ENTER, ATOMIC_SECTION_EXIT, sysTaskFlag, SYSTEM_TASK_ID_COUNT, and taskHandlers.
Referenced by main(), and pxp_monitor_start_scan().