diff --git a/include/reactor-uc/event.h b/include/reactor-uc/event.h index 6b98669b..b6993b0e 100644 --- a/include/reactor-uc/event.h +++ b/include/reactor-uc/event.h @@ -5,7 +5,8 @@ #include "reactor-uc/tag.h" #include -#define EVENT_INIT(Tag, Trigger, Payload) {.tag = Tag, .trigger = Trigger, .payload = Payload} +#define EVENT_INIT(Tag, Trigger, Payload) \ + { .tag = Tag, .trigger = Trigger, .payload = Payload } typedef struct Trigger Trigger; diff --git a/include/reactor-uc/tag.h b/include/reactor-uc/tag.h index 443ba5e1..c395e9d5 100644 --- a/include/reactor-uc/tag.h +++ b/include/reactor-uc/tag.h @@ -37,12 +37,15 @@ #define NEVER_TAG \ (tag_t) { .time = NEVER, .microstep = NEVER_MICROSTEP } // Need a separate initializer expression to comply with some C compilers -#define NEVER_TAG_INITIALIZER {NEVER, NEVER_MICROSTEP} +#define NEVER_TAG_INITIALIZER \ + { NEVER, NEVER_MICROSTEP } #define FOREVER_TAG \ (tag_t) { .time = FOREVER, .microstep = FOREVER_MICROSTEP } // Need a separate initializer expression to comply with some C compilers -#define FOREVER_TAG_INITIALIZER {FOREVER, FOREVER_MICROSTEP} -#define ZERO_TAG (tag_t){.time = 0LL, .microstep = 0u} +#define FOREVER_TAG_INITIALIZER \ + { FOREVER, FOREVER_MICROSTEP } +#define ZERO_TAG \ + (tag_t) { .time = 0LL, .microstep = 0u } // Returns true if timeout has elapsed. #define CHECK_TIMEOUT(start, duration) (lf_time_physical() > ((start) + (duration))) diff --git a/src/federated.c b/src/federated.c index 63505f2e..2f365b6d 100644 --- a/src/federated.c +++ b/src/federated.c @@ -3,7 +3,7 @@ #include "reactor-uc/logging.h" #include "reactor-uc/platform.h" -//#pragma GCC diagnostic ignored "-Wstack-usage=" THIS causes some problems with patmos-clang +// #pragma GCC diagnostic ignored "-Wstack-usage=" THIS causes some problems with patmos-clang // TODO: Refactor so this function is available void LogicalConnection_trigger_downstreams(Connection *self, const void *value, size_t value_size); diff --git a/src/platform/patmos/patmos.c b/src/platform/patmos/patmos.c index 79f002ec..036d99f4 100644 --- a/src/platform/patmos/patmos.c +++ b/src/platform/patmos/patmos.c @@ -11,24 +11,22 @@ static PlatformPatmos platform; #define USEC_TO_NSEC(usec) (usec * USEC(1)) #define NSEC_TO_USEC(nsec) (nsec / USEC(1)) -void Platform_vprintf(const char *fmt, va_list args) { - vprintf(fmt, args); -} +void Platform_vprintf(const char *fmt, va_list args) { vprintf(fmt, args); } lf_ret_t PlatformPatmos_initialize(Platform *self) { (void)self; - //TODO: + // TODO: return LF_OK; } instant_t PlatformPatmos_get_physical_time(Platform *self) { (void)self; - return USEC_TO_NSEC(get_cpu_usecs()); + return USEC_TO_NSEC(get_cpu_usecs()); } lf_ret_t PlatformPatmos_wait_until_interruptible(Platform *untyped_self, instant_t wakeup_time) { - PlatformPatmos* self = (PlatformPatmos*)untyped_self; + PlatformPatmos *self = (PlatformPatmos *)untyped_self; self->async_event = false; untyped_self->leave_critical_section(untyped_self); // turing on interrupts @@ -38,7 +36,7 @@ lf_ret_t PlatformPatmos_wait_until_interruptible(Platform *untyped_self, instant do { now = untyped_self->get_physical_time(untyped_self); } while ((now < wakeup_time) && !self->async_event); - + untyped_self->enter_critical_section(untyped_self); if (self->async_event) { @@ -48,7 +46,6 @@ lf_ret_t PlatformPatmos_wait_until_interruptible(Platform *untyped_self, instant return LF_OK; } - interval_t sleep_duration = wakeup_time - untyped_self->get_physical_time(untyped_self); if (sleep_duration < 0) { return LF_OK; @@ -64,7 +61,8 @@ lf_ret_t PlatformPatmos_wait_until(Platform *untyped_self, instant_t wakeup_time if (sleep_duration < 0) { return LF_OK; } -instant_t now = untyped_self->get_physical_time(untyped_self); + + instant_t now = untyped_self->get_physical_time(untyped_self); // Do busy sleep do { @@ -100,9 +98,7 @@ void PlatformPatmos_enter_critical_section(Platform *self) { intr_disable(); } -void PlatformPatmos_new_async_event(Platform *self) { - ((PlatformPatmos*)self)->async_event = true; -} +void PlatformPatmos_new_async_event(Platform *self) { ((PlatformPatmos *)self)->async_event = true; } void Platform_ctor(Platform *self) { self->initialize = PlatformPatmos_initialize; diff --git a/src/scheduler.c b/src/scheduler.c index 8cec05c3..96553c75 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -1,5 +1,4 @@ - #if defined(SCHEDULER_DYNAMIC) #include "./schedulers/dynamic/scheduler.c" #elif defined(SCHEDULER_STATIC)