summaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/chibios.mk24
-rw-r--r--tmk_core/protocol/chibios/usb_main.c12
2 files changed, 30 insertions, 6 deletions
diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk
index 957a259229..6b298732c2 100644
--- a/tmk_core/chibios.mk
+++ b/tmk_core/chibios.mk
@@ -42,6 +42,11 @@ ifeq ($(strip $(MCU)), risc-v)
PLATFORM_MK = $(CHIBIOS_CONTRIB)/os/hal/ports/GD/GD32VF103/platform.mk
else
# ARM Support
+ CHIBIOS_PORT ?=
+ ifeq ("$(CHIBIOS_PORT)","")
+ CHIBIOS_PORT = ARMv$(ARMV)-M
+ endif
+
# Startup files. Try a few different locations, for compability with old versions and
# for things hardware in the contrib repository
STARTUP_MK = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk
@@ -52,15 +57,24 @@ else
endif
endif
- # Compability with old version
- PORT_V = $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk
+ # Port files. Try a few different locations, for compability with old versions and
+ # for things hardware in the contrib repository
+ PORT_V = $(CHIBIOS)/os/common/ports/$(CHIBIOS_PORT)/compilers/GCC/mk/port.mk
ifeq ("$(wildcard $(PORT_V))","")
- PORT_V = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk
+ PORT_V = $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk
+ ifeq ("$(wildcard $(PORT_V))","")
+ PORT_V = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk
+ endif
endif
- RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
+ # Rules location. Try a few different locations, for compability with old versions and
+ # for things hardware in the contrib repository
+ RULESPATH = $(CHIBIOS)/os/common/ports/$(CHIBIOS_PORT)/compilers/GCC
ifeq ("$(wildcard $(RULESPATH)/rules.mk)","")
- RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
+ RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
+ ifeq ("$(wildcard $(RULESPATH)/rules.mk)","")
+ RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
+ endif
endif
endif
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c
index 3b16a0ff7b..a7db3e3ab1 100644
--- a/tmk_core/protocol/chibios/usb_main.c
+++ b/tmk_core/protocol/chibios/usb_main.c
@@ -71,7 +71,12 @@ uint8_t keyboard_protocol __attribute__((aligned(2))) = 1;
uint8_t keyboard_led_state = 0;
volatile uint16_t keyboard_idle_count = 0;
static virtual_timer_t keyboard_idle_timer;
-static void keyboard_idle_timer_cb(void *arg);
+
+#if CH_KERNEL_MAJOR >= 7
+static void keyboard_idle_timer_cb(struct ch_virtual_timer *, void *arg);
+#elif CH_KERNEL_MAJOR <= 6
+static void keyboard_idle_timer_cb(void *arg);
+#endif
report_keyboard_t keyboard_report_sent = {{0}};
#ifdef MOUSE_ENABLE
@@ -774,7 +779,12 @@ void kbd_sof_cb(USBDriver *usbp) { (void)usbp; }
/* Idle requests timer code
* callback (called from ISR, unlocked state) */
+#if CH_KERNEL_MAJOR >= 7
+static void keyboard_idle_timer_cb(struct ch_virtual_timer *timer, void *arg) {
+ (void)timer;
+#elif CH_KERNEL_MAJOR <= 6
static void keyboard_idle_timer_cb(void *arg) {
+#endif
USBDriver *usbp = (USBDriver *)arg;
osalSysLockFromISR();