Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
schedule.h File Reference

Task Runner task scheduling. More...

#include <stdint.h>
#include <stdbool.h>
#include <zephyr/toolchain.h>
#include <zephyr/sys/atomic.h>
#include <infuse/task_runner/tasks/infuse_task_args.h>

Go to the source code of this file.

Data Structures

struct  task_schedule_tdf_logging
 Control TDF logging output of a task. More...
struct  task_schedule_state_conditions
 Schedule state conditions. More...
struct  task_schedule
 Schedule for a given task. More...
struct  task_schedule::battery_start_thresholds
 Battery charge thresholds to start the task. More...
struct  task_schedule::battery_terminate_thresholds
 Battery charge thresholds to terminate the task. More...
union  task_schedule::periodicity_args
 Periodicity parameters. More...
struct  task_schedule::periodicity_args::periodicity_periodic
 Start on global N second boundaries. More...
struct  task_schedule::periodicity_args::periodicity_lockout
 Start N seconds after task last started. More...
struct  task_schedule::periodicity_args::periodicity_after
 Start N seconds after another task finishes. More...
struct  task_schedule::periodicity_args::periodicity_lockout_dynamic_battery
 Lockout for a variable duration based on battery state. More...
union  task_schedule::task_args
 Task specific arguments. More...
struct  task_schedule_state
 State for a given task schedule. More...

Macros

#define TR_NOT   0x100
 Invert the state.
#define TR_OR   0x200
 OR the state with the previous result.
#define TR_AND   0x00
 AND the state with the previous result.
#define TASK_STATES_DEFINE(...)
 Helper for constructing a task_schedule_state_conditions struct.
#define TASK_STATES_START_TIMEOUT(seconds)
 Helper macro to initialise states_start_timeout_2x_s
#define TASK_RUNNER_LOCKOUT_IGNORE_FIRST   BIT(31)
 Normally the lockout period must elapse after boot before the periodicity check passes.
#define TASK_SCHEDULE_STATES_DEFINE(name, schedules)
 Instantiate schedule state array.

Typedefs

typedef void(* task_schedule_event_cb_t) (const struct task_schedule *schedule, enum task_schedule_event event)
 Callback notifying that an event has occurred on a schedule.

Enumerations

enum  task_runner_valid_type {
  TASK_LOCKED = 0x80 , TASK_VALID_ALWAYS = 1 , TASK_VALID_ACTIVE = 2 , TASK_VALID_INACTIVE = 3 ,
  TASK_VALID_PERMANENTLY_RUNS = 4
}
enum  task_runner_periodicity_type { TASK_PERIODICITY_FIXED = 1 , TASK_PERIODICITY_LOCKOUT = 2 , TASK_PERIODICITY_AFTER = 3 , TASK_PERIODICITY_LOCKOUT_DYNAMIC_BATTERY = 4 }
enum  task_schedule_event { TASK_SCHEDULE_STARTED = 0 , TASK_SCHEDULE_TERMINATE_REQUEST = 1 , TASK_SCHEDULE_STOPPED = 2 }
 Events that can trigger callbacks. More...

Functions

bool task_schedule_validate (const struct task_schedule *schedule)
 Basic validity checking on task schedules.
bool task_schedule_should_start (const struct task_schedule *schedule, struct task_schedule_state *state, atomic_t *app_states, uint32_t uptime, uint32_t epoch_time, uint8_t battery)
 Determine whether a task should start executing.
bool task_schedule_should_terminate (const struct task_schedule *schedule, struct task_schedule_state *state, atomic_t *app_states, uint32_t uptime, uint32_t epoch_time, uint8_t battery)
 Determine whether a task should be terminated.

Detailed Description

Task Runner task scheduling.

Author
Jordan Yates jorda.nosp@m.n@em.nosp@m.beint.nosp@m..com

SPDX-License-Identifier: FSL-1.1-ALv2