Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Toggle main menu visibility
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
21
#include "
safeapi/utils/status/sapi_status.h
"
22
#include "
safeapi/utils/types/sapi_types.h
"
23
24
#ifdef __cplusplus
25
extern
"C"
{
26
#endif
27
29
SAFEAPI_DECLARE_STORAGE
(sapi_task_storage_t, 128U);
30
32
typedef
struct
sapi_task_impl_s *
sapi_task_handle_t
;
33
35
typedef
void (*
sapi_task_entry_t
)(
void
*user_ctx);
36
38
typedef
struct
sapi_task_config_s
39
{
40
const
char
*
name
;
41
sapi_task_entry_t
entry
;
42
void
*
user_ctx
;
43
sapi_duration_ms_t
period_ms
;
44
uint32_t
priority
;
45
size_t
stack_size
;
46
}
sapi_task_config_t
;
47
59
sapi_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
70
sapi_status_t
sapi_task_start
(
sapi_task_handle_t
handle);
71
78
sapi_status_t
sapi_task_suspend
(
sapi_task_handle_t
handle);
79
86
sapi_status_t
sapi_task_destroy
(
sapi_task_handle_t
handle);
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
sapi_status_t
Common result/status codes.
Definition
sapi_status.h:27
sapi_task_create
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_task_start
sapi_status_t sapi_task_start(sapi_task_handle_t handle)
Starts a created task.
Definition
sapi_task.c:68
sapi_task_handle_t
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
sapi_task_entry_t
void(*) sapi_task_entry_t(void *user_ctx)
Task entry point, invoked cyclically at the configured period.
Definition
sapi_task.h:35
sapi_task_suspend
sapi_status_t sapi_task_suspend(sapi_task_handle_t handle)
Suspends a running task.
Definition
sapi_task.c:85
sapi_task_destroy
sapi_status_t sapi_task_destroy(sapi_task_handle_t handle)
Terminates and destroys a task.
Definition
sapi_task.c:102
sapi_duration_ms_t
uint32_t sapi_duration_ms_t
Definition
sapi_types.h:27
SAFEAPI_DECLARE_STORAGE
#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
sapi_status.h
Common status/error codes returned by every Safe API Framework function. Shared across all OS Abstrac...
sapi_types.h
Common fixed-width types and the caller-owned-storage handle pattern used by every OAL service (see A...
sapi_task_config_t
Configuration for sapi_task_create().
Definition
sapi_task.h:39
sapi_task_config_t::entry
sapi_task_entry_t entry
Definition
sapi_task.h:41
sapi_task_config_t::stack_size
size_t stack_size
Definition
sapi_task.h:45
sapi_task_config_t::user_ctx
void * user_ctx
Definition
sapi_task.h:42
sapi_task_config_t::period_ms
sapi_duration_ms_t period_ms
Definition
sapi_task.h:43
sapi_task_config_t::name
const char * name
Definition
sapi_task.h:40
sapi_task_config_t::priority
uint32_t priority
Definition
sapi_task.h:44
include
safeapi
oal
task
sapi_task.h
Generated by
1.18.0