Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
sapi_task.h
Go to the documentation of this file.
1
18#ifndef SAFEAPI_OS_TASK_H
19#define SAFEAPI_OS_TASK_H
20
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
29SAFEAPI_DECLARE_STORAGE(sapi_task_storage_t, 128U);
30
32typedef struct sapi_task_impl_s *sapi_task_handle_t;
33
35typedef void (*sapi_task_entry_t)(void *user_ctx);
36
38typedef struct sapi_task_config_s
39{
40 const char *name;
42 void *user_ctx;
44 uint32_t priority;
45 size_t stack_size;
47
59sapi_status_t sapi_task_create(sapi_task_storage_t *storage,
60 const sapi_task_config_t *config,
61 sapi_task_handle_t *out_handle);
62
71
79
87
88/*
89 * The backend vtable (sapi_task_backend_t) and sapi_task_register_backend()
90 * live in safeapi_backend/task/sapi_task_backend.h, not here (ADR-021).
91 * This header is the consumer-facing surface only.
92 */
93
94#ifdef __cplusplus
95}
96#endif
97
98#endif /* SAFEAPI_OS_TASK_H */
99 /* TASK */
sapi_status_t
Common result/status codes.
Definition sapi_status.h:27
sapi_status_t sapi_task_create(sapi_task_storage_t *storage, const sapi_task_config_t *config, sapi_task_handle_t *out_handle)
Creates a task in the suspended state.
Definition sapi_task.c:44
sapi_status_t sapi_task_start(sapi_task_handle_t handle)
Starts a created task.
Definition sapi_task.c:68
struct sapi_task_impl_s * sapi_task_handle_t
Opaque handle to a created task, returned by sapi_task_create().
Definition sapi_task.h:32
void(*) sapi_task_entry_t(void *user_ctx)
Task entry point, invoked cyclically at the configured period.
Definition sapi_task.h:35
sapi_status_t sapi_task_suspend(sapi_task_handle_t handle)
Suspends a running task.
Definition sapi_task.c:85
sapi_status_t sapi_task_destroy(sapi_task_handle_t handle)
Terminates and destroys a task.
Definition sapi_task.c:102
uint32_t sapi_duration_ms_t
Definition sapi_types.h:27
#define SAFEAPI_DECLARE_STORAGE(type_name, byte_size)
Declares an opaque, fixed-size, aligned storage type for a service's handle. The real internal layout...
Definition sapi_types.h:69
Common status/error codes returned by every Safe API Framework function. Shared across all OS Abstrac...
Common fixed-width types and the caller-owned-storage handle pattern used by every OAL service (see A...
Configuration for sapi_task_create().
Definition sapi_task.h:39
sapi_task_entry_t entry
Definition sapi_task.h:41
sapi_duration_ms_t period_ms
Definition sapi_task.h:43
const char * name
Definition sapi_task.h:40
uint32_t priority
Definition sapi_task.h:44