diff options
Diffstat (limited to 'platforms')
-rw-r--r-- | platforms/common.mk | 2 | ||||
-rw-r--r-- | platforms/synchronization_util.c | 17 | ||||
-rw-r--r-- | platforms/synchronization_util.h | 6 | ||||
-rw-r--r-- | platforms/timer.c | 8 |
4 files changed, 33 insertions, 0 deletions
diff --git a/platforms/common.mk b/platforms/common.mk index 693bdc8cf0..da0697e3b0 100644 --- a/platforms/common.mk +++ b/platforms/common.mk @@ -2,6 +2,8 @@ PLATFORM_COMMON_DIR = $(PLATFORM_PATH)/$(PLATFORM_KEY) TMK_COMMON_SRC += \ $(PLATFORM_PATH)/suspend.c \ + $(PLATFORM_PATH)/synchronization_util.c \ + $(PLATFORM_PATH)/timer.c \ $(PLATFORM_COMMON_DIR)/hardware_id.c \ $(PLATFORM_COMMON_DIR)/platform.c \ $(PLATFORM_COMMON_DIR)/suspend.c \ diff --git a/platforms/synchronization_util.c b/platforms/synchronization_util.c new file mode 100644 index 0000000000..26cf7dccf1 --- /dev/null +++ b/platforms/synchronization_util.c @@ -0,0 +1,17 @@ +// Copyright 2023 Sergey Vlasov (@sigprof) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "synchronization_util.h" + +// Generate out-of-line copies for inline functions defined in synchronization_util.h. + +#if !defined(PLATFORM_SUPPORTS_SYNCHRONIZATION) +# if defined(SPLIT_KEYBOARD) +extern inline void split_shared_memory_lock(void); +extern inline void split_shared_memory_unlock(void); +# endif +#endif + +#if defined(SPLIT_KEYBOARD) +QMK_IMPLEMENT_AUTOUNLOCK_HELPERS(split_shared_memory) +#endif diff --git a/platforms/synchronization_util.h b/platforms/synchronization_util.h index 59933945c3..4969eff478 100644 --- a/platforms/synchronization_util.h +++ b/platforms/synchronization_util.h @@ -29,6 +29,12 @@ inline void split_shared_memory_unlock(void){}; prefix##_unlock(); \ } +/* Generate an out-of-line implementation in case the inline functions defined + * by the above macro don't actually get inlined. */ +#define QMK_IMPLEMENT_AUTOUNLOCK_HELPERS(prefix) \ + extern inline unsigned prefix##_autounlock_lock_helper(void); \ + extern inline void prefix##_autounlock_unlock_helper(unsigned* unused_guard); + /* Convinience macro the automatically generate the correct RAII-style * lock_autounlock function macro */ #define QMK_DECLARE_AUTOUNLOCK_CALL(prefix) unsigned prefix##_guard __attribute__((unused, cleanup(prefix##_autounlock_unlock_helper))) = prefix##_autounlock_lock_helper diff --git a/platforms/timer.c b/platforms/timer.c new file mode 100644 index 0000000000..26038dcda3 --- /dev/null +++ b/platforms/timer.c @@ -0,0 +1,8 @@ +// Copyright 2023 Sergey Vlasov (@sigprof) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "timer.h" + +// Generate out-of-line copies for inline functions defined in timer.h. +extern inline fast_timer_t timer_read_fast(void); +extern inline fast_timer_t timer_elapsed_fast(fast_timer_t last); |