reactor-uc 0.1
Loading...
Searching...
No Matches
platform.h
Go to the documentation of this file.
1#ifndef REACTOR_UC_PLATFORM_H
2#define REACTOR_UC_PLATFORM_H
3
4#include "reactor-uc/error.h"
5#include "reactor-uc/tag.h"
6#include <stdarg.h>
7
8typedef struct Platform Platform;
9
10struct Platform {
15 lf_ret_t (*initialize)(Platform *self);
19 instant_t (*get_physical_time)(Platform *self);
24 lf_ret_t (*wait_until)(Platform *self, instant_t wakeup_time);
29 lf_ret_t (*wait_for)(Platform *self, interval_t duration);
34 lf_ret_t (*wait_until_interruptible)(Platform *self, instant_t wakeup_time);
35
40 void (*new_async_event)(Platform *self);
41
49};
50
51// Return a pointer to a Platform object. Must be implemented for each
52// target platform.
54
55// Construct a Platform object. Must be implemented for each target platform.
57
58// Allow each platform to provide its own implemntation for printing.
59void Platform_vprintf(const char *fmt, va_list args);
60
61#endif
Platform * Platform_new(void)
void Platform_vprintf(const char *fmt, va_list args)
void Platform_ctor(Platform *self)
Definition platform.h:10
lf_ret_t(* initialize)(Platform *self)
Perform any platform initialization such as initializing semaphores, configuring clocks,...
Definition platform.h:15
void(* leave_critical_section)(Platform *self)
Definition platform.h:48
lf_ret_t(* wait_until)(Platform *self, instant_t wakeup_time)
Put system to sleep until the wakeup time.
Definition platform.h:24
lf_ret_t(* wait_for)(Platform *self, interval_t duration)
Put system to sleep until the wakeup time.
Definition platform.h:29
void(* enter_critical_section)(Platform *self)
Enter and leave a critical section.
Definition platform.h:47
lf_ret_t(* wait_until_interruptible)(Platform *self, instant_t wakeup_time)
Put the system to sleep until the wakeup time or until an asynchronous event occurs.
Definition platform.h:34
void(* new_async_event)(Platform *self)
Signal the occurrence of an asynchronous event.
Definition platform.h:40
instant_t(* get_physical_time)(Platform *self)
Return the current physical time in nanoseconds.
Definition platform.h:19