Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
sapi_platform.c
Go to the documentation of this file.
1
11
14#define SAPI_PLATFORM_RT_PRIORITY_MAX 99U
15
17
21
23
25
26
29{
30 sapi_status_t lifecycle_status;
31
32 if (backend == NULL)
33 {
35 }
36 /* REQ-LIFECYCLE-001 (ADR-026): registering a backend is a setup-only
37 * action - refuse once the application's setup phase has been locked. */
38 lifecycle_status = sapi_lifecycle_check_setup_allowed();
39 if (lifecycle_status != SAPI_STATUS_OK)
40 {
41 return lifecycle_status;
42 }
43 s_backend = backend;
44 return SAPI_STATUS_OK;
45}
46
48{
49 if (rt_priority > SAPI_PLATFORM_RT_PRIORITY_MAX)
50 {
52 }
53 if (s_backend == NULL)
54 {
56 }
57 if (s_backend->realtime_init == NULL)
58 {
60 }
61 return s_backend->realtime_init(rt_priority);
62}
sapi_status_t sapi_lifecycle_check_setup_allowed(void)
Convenience check for a setup-only constructor: call this as one of the first checks in any function ...
sapi_status_t sapi_platform_register_backend(const sapi_platform_backend_t *backend)
Registers the backend implementation used by sapi_platform_realtime_init() (ADR-005 section 2....
sapi_status_t sapi_platform_realtime_init(uint32_t rt_priority)
Applies the registered backend's real-time platform configuration for the calling process/thread....
sapi_status_t
Common result/status codes.
Definition sapi_status.h:27
@ SAPI_STATUS_NOT_SUPPORTED
Definition sapi_status.h:34
@ SAPI_STATUS_INVALID_PARAM
Definition sapi_status.h:29
@ SAPI_STATUS_NOT_INITIALIZED
Definition sapi_status.h:30
@ SAPI_STATUS_OK
Definition sapi_status.h:28
static const sapi_clocksync_backend_t * s_backend
Process-wide application setup-phase lock (ADR-026).
#define SAPI_PLATFORM_RT_PRIORITY_MAX
Highest real-time priority sapi_platform_realtime_init() accepts.
OS Abstraction Layer - Real-time platform configuration service (ADR-035).
OS-backend adaptation surface for the Real-Time Platform Configuration service (ADR-035,...
Backend vtable: an integrator's implementation of the real-time platform bring-up for a specific targ...
sapi_status_t(*) realtime_init(uint32_t rt_priority)
Backend implementation of sapi_platform_realtime_init(). May be NULL (the service then returns SAPI_S...