summaryrefslogtreecommitdiffstats
path: root/tmk_core
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/arm_atsam.mk2
-rw-r--r--tmk_core/avr.mk2
-rw-r--r--tmk_core/chibios.mk322
-rw-r--r--tmk_core/common.mk121
-rw-r--r--tmk_core/common/arm_atsam/eeprom.c94
-rw-r--r--tmk_core/common/arm_atsam/gpio.h8
-rw-r--r--tmk_core/common/avr/suspend.c98
-rw-r--r--tmk_core/common/chibios/_wait.h2
-rw-r--r--tmk_core/common/chibios/bootloader.c22
-rw-r--r--tmk_core/common/chibios/chibios_config.h62
-rw-r--r--tmk_core/common/chibios/eeprom_stm32.c57
-rw-r--r--tmk_core/common/chibios/eeprom_stm32_defs.h25
-rw-r--r--tmk_core/common/chibios/eeprom_teensy.c213
-rw-r--r--tmk_core/common/chibios/flash_stm32.c48
-rw-r--r--tmk_core/common/chibios/gd32v_compatibility.h120
-rw-r--r--tmk_core/common/chibios/sleep_led.c4
-rw-r--r--tmk_core/common/chibios/suspend.c89
-rw-r--r--tmk_core/common/chibios/syscall-fallbacks.c6
-rw-r--r--tmk_core/common/raw_hid.h5
-rw-r--r--tmk_core/common/suspend.h2
-rw-r--r--tmk_core/common/sync_timer.c58
-rw-r--r--tmk_core/common/sync_timer.h54
-rw-r--r--tmk_core/common/test/rules.mk1
-rw-r--r--tmk_core/common/virtser.h7
-rw-r--r--tmk_core/native.mk2
-rw-r--r--tmk_core/protocol.mk92
-rw-r--r--tmk_core/protocol/adb.c535
-rw-r--r--tmk_core/protocol/adb.h106
-rw-r--r--tmk_core/protocol/arm_atsam.mk7
-rw-r--r--tmk_core/protocol/arm_atsam/arm_atsam_protocol.h4
-rw-r--r--tmk_core/protocol/arm_atsam/i2c_master.c19
-rw-r--r--tmk_core/protocol/arm_atsam/i2c_master.h9
-rw-r--r--tmk_core/protocol/arm_atsam/main_arm_atsam.c4
-rw-r--r--tmk_core/protocol/arm_atsam/md_rgb_matrix.c100
-rw-r--r--tmk_core/protocol/arm_atsam/md_rgb_matrix.h64
-rw-r--r--tmk_core/protocol/arm_atsam/shift_register.c118
-rw-r--r--tmk_core/protocol/arm_atsam/shift_register.h (renamed from tmk_core/protocol/arm_atsam/spi.h)25
-rw-r--r--tmk_core/protocol/arm_atsam/spi.c92
-rw-r--r--tmk_core/protocol/arm_atsam/spi_master.c109
-rw-r--r--tmk_core/protocol/arm_atsam/spi_master.h48
-rw-r--r--tmk_core/protocol/arm_atsam/usb/usb2422.h402
-rw-r--r--tmk_core/protocol/arm_atsam/usb/usb_hub.c (renamed from tmk_core/protocol/arm_atsam/usb/usb2422.c)98
-rw-r--r--tmk_core/protocol/arm_atsam/usb/usb_hub.h51
-rw-r--r--tmk_core/protocol/chibios/chibios.c63
-rw-r--r--tmk_core/protocol/chibios/usb_main.c27
-rw-r--r--tmk_core/protocol/host.c (renamed from tmk_core/common/host.c)15
-rw-r--r--tmk_core/protocol/host.h (renamed from tmk_core/common/host.h)2
-rw-r--r--tmk_core/protocol/host_driver.h (renamed from tmk_core/common/host_driver.h)1
-rw-r--r--tmk_core/protocol/ibm4704.c185
-rw-r--r--tmk_core/protocol/ibm4704.h103
-rw-r--r--tmk_core/protocol/lufa.mk27
-rw-r--r--tmk_core/protocol/lufa/adafruit_ble.cpp701
-rw-r--r--tmk_core/protocol/lufa/adafruit_ble.h59
-rw-r--r--tmk_core/protocol/lufa/lufa.c71
-rw-r--r--tmk_core/protocol/lufa/lufa.h11
-rw-r--r--tmk_core/protocol/lufa/outputselect.c79
-rw-r--r--tmk_core/protocol/lufa/outputselect.h34
-rw-r--r--tmk_core/protocol/lufa/ringbuffer.hpp66
-rw-r--r--tmk_core/protocol/m0110.c583
-rw-r--r--tmk_core/protocol/m0110.h81
-rw-r--r--tmk_core/protocol/midi/qmk_midi.c41
-rw-r--r--tmk_core/protocol/news.c161
-rw-r--r--tmk_core/protocol/news.h48
-rw-r--r--tmk_core/protocol/next_kbd.c219
-rw-r--r--tmk_core/protocol/next_kbd.h60
-rw-r--r--tmk_core/protocol/ps2.h139
-rw-r--r--tmk_core/protocol/ps2_busywait.c187
-rw-r--r--tmk_core/protocol/ps2_interrupt.c340
-rw-r--r--tmk_core/protocol/ps2_io.h11
-rw-r--r--tmk_core/protocol/ps2_io_avr.c58
-rw-r--r--tmk_core/protocol/ps2_io_chibios.c55
-rw-r--r--tmk_core/protocol/ps2_mouse.c274
-rw-r--r--tmk_core/protocol/ps2_mouse.h177
-rw-r--r--tmk_core/protocol/ps2_usart.c213
-rw-r--r--tmk_core/protocol/report.c (renamed from tmk_core/common/report.c)4
-rw-r--r--tmk_core/protocol/report.h (renamed from tmk_core/common/report.h)6
-rw-r--r--tmk_core/protocol/serial_mouse.h29
-rw-r--r--tmk_core/protocol/serial_mouse_microsoft.c113
-rw-r--r--tmk_core/protocol/serial_mouse_mousesystems.c119
-rw-r--r--tmk_core/protocol/usb_descriptor.c19
-rw-r--r--tmk_core/protocol/usb_device_state.c59
-rw-r--r--tmk_core/protocol/usb_device_state.h39
-rw-r--r--tmk_core/protocol/usb_hid/parser.h5
-rw-r--r--tmk_core/protocol/usb_hid/usb_hid.h6
-rw-r--r--tmk_core/protocol/usb_util.c (renamed from tmk_core/common/usb_util.c)0
-rw-r--r--tmk_core/protocol/usb_util.h (renamed from tmk_core/common/usb_util.h)0
-rw-r--r--tmk_core/protocol/vusb/protocol.c12
-rw-r--r--tmk_core/protocol/vusb/vusb.c39
-rw-r--r--tmk_core/protocol/xt.h73
-rw-r--r--tmk_core/protocol/xt_interrupt.c166
-rw-r--r--tmk_core/readme.md11
-rw-r--r--tmk_core/rules.mk18
92 files changed, 1649 insertions, 6467 deletions
diff --git a/tmk_core/arm_atsam.mk b/tmk_core/arm_atsam.mk
index b29de9132b..b49bf764d7 100644
--- a/tmk_core/arm_atsam.mk
+++ b/tmk_core/arm_atsam.mk
@@ -2,7 +2,7 @@
##############################################################################
# Compiler settings
#
-CC = arm-none-eabi-gcc
+CC = $(CC_PREFIX) arm-none-eabi-gcc
OBJCOPY = arm-none-eabi-objcopy
OBJDUMP = arm-none-eabi-objdump
SIZE = arm-none-eabi-size
diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk
index 940e95397b..c52262273e 100644
--- a/tmk_core/avr.mk
+++ b/tmk_core/avr.mk
@@ -2,7 +2,7 @@
##############################################################################
# Compiler settings
#
-CC = avr-gcc
+CC = $(CC_PREFIX) avr-gcc
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
SIZE = avr-size
diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk
index 18839710be..6b298732c2 100644
--- a/tmk_core/chibios.mk
+++ b/tmk_core/chibios.mk
@@ -27,29 +27,76 @@ endif
OPT_OS = chibios
CHIBIOS = $(TOP_DIR)/lib/chibios
CHIBIOS_CONTRIB = $(TOP_DIR)/lib/chibios-contrib
-# 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
-ifeq ("$(wildcard $(STARTUP_MK))","")
- STARTUP_MK = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk
- ifeq ("$(wildcard $(STARTUP_MK))","")
- STARTUP_MK = $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk
- endif
+
+#
+# Startup, Port and Platform support selection
+##############################################################################
+
+ifeq ($(strip $(MCU)), risc-v)
+ # RISC-V Support
+ # As of 7.4.2021 there is only one supported RISC-V platform in Chibios-Contrib,
+ # therefore all required settings are hard-coded
+ STARTUP_MK = $(CHIBIOS_CONTRIB)/os/common/startup/RISCV-ECLIC/compilers/GCC/mk/startup_$(MCU_STARTUP).mk
+ PORT_V = $(CHIBIOS_CONTRIB)/os/common/ports/RISCV-ECLIC/compilers/GCC/mk/port.mk
+ RULESPATH = $(CHIBIOS_CONTRIB)/os/common/startup/RISCV-ECLIC/compilers/GCC
+ 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
+ ifeq ("$(wildcard $(STARTUP_MK))","")
+ STARTUP_MK = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk
+ ifeq ("$(wildcard $(STARTUP_MK))","")
+ STARTUP_MK = $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk
+ endif
+ endif
+
+ # 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/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
+
+ # 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/ports/ARMCMx/compilers/GCC
+ ifeq ("$(wildcard $(RULESPATH)/rules.mk)","")
+ RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
+ endif
+ endif
endif
-include $(STARTUP_MK)
-# HAL-OSAL files (optional).
-include $(CHIBIOS)/os/hal/hal.mk
ifeq ("$(PLATFORM_NAME)","")
- PLATFORM_NAME = platform
+ PLATFORM_NAME = platform
endif
-PLATFORM_MK = $(CHIBIOS)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/$(PLATFORM_NAME).mk
ifeq ("$(wildcard $(PLATFORM_MK))","")
-PLATFORM_MK = $(CHIBIOS_CONTRIB)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/$(PLATFORM_NAME).mk
+ PLATFORM_MK = $(CHIBIOS)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/$(PLATFORM_NAME).mk
+ ifeq ("$(wildcard $(PLATFORM_MK))","")
+ PLATFORM_MK = $(CHIBIOS_CONTRIB)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/$(PLATFORM_NAME).mk
+ endif
endif
+
+include $(STARTUP_MK)
+include $(PORT_V)
include $(PLATFORM_MK)
+#
+# Board support selection.
+##############################################################################
+
BOARD_MK :=
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/boards/$(BOARD)/board.mk)","")
@@ -77,13 +124,19 @@ else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/boards/$(BOARD)/board/board
endif
ifeq ("$(wildcard $(BOARD_MK))","")
- BOARD_MK = $(CHIBIOS)/os/hal/boards/$(BOARD)/board.mk
- ifeq ("$(wildcard $(BOARD_MK))","")
- BOARD_MK = $(CHIBIOS_CONTRIB)/os/hal/boards/$(BOARD)/board.mk
- endif
+ BOARD_MK = $(CHIBIOS)/os/hal/boards/$(BOARD)/board.mk
+ ifeq ("$(wildcard $(BOARD_MK))","")
+ BOARD_MK = $(CHIBIOS_CONTRIB)/os/hal/boards/$(BOARD)/board.mk
+ endif
endif
-# Bootloader address
+include $(BOARD_MK)
+
+#
+# Bootloader selection.
+##############################################################################
+
+# Set bootloader address if supplied.
ifdef STM32_BOOTLOADER_ADDRESS
OPT_DEFS += -DSTM32_BOOTLOADER_ADDRESS=$(STM32_BOOTLOADER_ADDRESS)
endif
@@ -113,6 +166,10 @@ else ifneq ("$(wildcard $(BOARD_PATH)/configs/bootloader_defs.h)","")
OPT_DEFS += -include $(BOARD_PATH)/configs/bootloader_defs.h
endif
+#
+# ChibiOS config selection.
+##############################################################################
+
# Work out the config file directories
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/chconf.h)","")
CHCONFDIR = $(KEYBOARD_PATH_5)
@@ -130,6 +187,10 @@ else ifneq ("$(wildcard $(TOP_DIR)/platforms/boards/chibios/common/configs/chcon
CHCONFDIR = $(TOP_DIR)/platforms/chibios/boards/common/configs
endif
+#
+# HAL config selection.
+##############################################################################
+
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/halconf.h)","")
HALCONFDIR = $(KEYBOARD_PATH_5)
else ifneq ("$(wildcard $(KEYBOARD_PATH_4)/halconf.h)","")
@@ -146,40 +207,10 @@ else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/boards/common/configs/halco
HALCONFDIR = $(TOP_DIR)/platforms/chibios/boards/common/configs
endif
-# HAL-OSAL files (optional).
-include $(CHIBIOS)/os/hal/hal.mk
-
-ifeq ("$(PLATFORM_NAME)","")
- PLATFORM_NAME = platform
-endif
-
-PLATFORM_MK = $(CHIBIOS)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/$(PLATFORM_NAME).mk
-ifeq ("$(wildcard $(PLATFORM_MK))","")
-PLATFORM_MK = $(CHIBIOS_CONTRIB)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/$(PLATFORM_NAME).mk
-endif
-include $(PLATFORM_MK)
-
-
-include $(BOARD_MK)
--include $(CHIBIOS)/os/hal/osal/rt/osal.mk # ChibiOS <= 19.x
--include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk # ChibiOS >= 20.x
-# RTOS files (optional).
-include $(CHIBIOS)/os/rt/rt.mk
-# Compability with old version
-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
-include $(PORT_V)
-# Other files (optional).
-include $(CHIBIOS)/os/hal/lib/streams/streams.mk
-
-RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
-ifeq ("$(wildcard $(RULESPATH)/rules.mk)","")
-RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
-endif
+#
+# Linker script selection.
+##############################################################################
-# Define linker script file here
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/ld/$(MCU_LDSCRIPT).ld)","")
LDSCRIPT = $(KEYBOARD_PATH_5)/ld/$(MCU_LDSCRIPT).ld
else ifneq ("$(wildcard $(KEYBOARD_PATH_4)/ld/$(MCU_LDSCRIPT).ld)","")
@@ -202,22 +233,36 @@ else
LDSCRIPT = $(STARTUPLD)/$(MCU_LDSCRIPT).ld
endif
-CHIBISRC = $(STARTUPSRC) \
- $(KERNSRC) \
- $(PORTSRC) \
- $(OSALSRC) \
- $(HALSRC) \
- $(PLATFORMSRC) \
- $(BOARDSRC) \
- $(STREAMSSRC) \
- $(CHIBIOS)/os/various/syscalls.c \
- $(PLATFORM_COMMON_DIR)/syscall-fallbacks.c \
- $(PLATFORM_COMMON_DIR)/wait.c
+#
+# Include ChibiOS makefiles.
+##############################################################################
+
+# HAL-OSAL files (optional).
+include $(CHIBIOS)/os/hal/hal.mk
+-include $(CHIBIOS)/os/hal/osal/rt/osal.mk # ChibiOS <= 19.x
+-include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk # ChibiOS >= 20.x
+# RTOS files (optional).
+include $(CHIBIOS)/os/rt/rt.mk
+# Other files (optional).
+include $(CHIBIOS)/os/hal/lib/streams/streams.mk
+
+PLATFORM_SRC = \
+ $(STARTUPSRC) \
+ $(KERNSRC) \
+ $(PORTSRC) \
+ $(OSALSRC) \
+ $(HALSRC) \
+ $(PLATFORMSRC) \
+ $(BOARDSRC) \
+ $(STREAMSSRC) \
+ $(CHIBIOS)/os/various/syscalls.c \
+ $(PLATFORM_COMMON_DIR)/syscall-fallbacks.c \
+ $(PLATFORM_COMMON_DIR)/wait.c
# Ensure the ASM files are not subjected to LTO -- it'll strip out interrupt handlers otherwise.
QUANTUM_LIB_SRC += $(STARTUPASM) $(PORTASM) $(OSALASM) $(PLATFORMASM)
-CHIBISRC := $(patsubst $(TOP_DIR)/%,%,$(CHIBISRC))
+PLATFORM_SRC := $(patsubst $(TOP_DIR)/%,%,$(PLATFORM_SRC))
EXTRAINCDIRS += $(CHIBIOS)/os/license $(CHIBIOS)/os/oslib/include \
$(TOP_DIR)/platforms/chibios/boards/$(BOARD)/configs \
@@ -247,9 +292,9 @@ else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/boards/$(BOARD)/configs/hal
endif
ifeq ($(strip $(USE_CHIBIOS_CONTRIB)),yes)
- include $(CHIBIOS_CONTRIB)/os/hal/hal.mk
- CHIBISRC += $(PLATFORMSRC_CONTRIB) $(HALSRC_CONTRIB)
- EXTRAINCDIR