summaryrefslogtreecommitdiff
path: root/tmk_core/common/arm_atsam
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/common/arm_atsam')
-rw-r--r--tmk_core/common/arm_atsam/_timer.h19
-rw-r--r--tmk_core/common/arm_atsam/_wait.h22
-rw-r--r--tmk_core/common/arm_atsam/atomic_util.h37
-rw-r--r--tmk_core/common/arm_atsam/bootloader.c57
-rw-r--r--tmk_core/common/arm_atsam/eeprom.c98
-rw-r--r--tmk_core/common/arm_atsam/gpio.h71
-rw-r--r--tmk_core/common/arm_atsam/pin_defs.h84
-rw-r--r--tmk_core/common/arm_atsam/platform.c21
-rw-r--r--tmk_core/common/arm_atsam/platform_deps.h18
-rw-r--r--tmk_core/common/arm_atsam/suspend.c77
-rw-r--r--tmk_core/common/arm_atsam/timer.c19
11 files changed, 0 insertions, 523 deletions
diff --git a/tmk_core/common/arm_atsam/_timer.h b/tmk_core/common/arm_atsam/_timer.h
deleted file mode 100644
index 77402b612a..0000000000
--- a/tmk_core/common/arm_atsam/_timer.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright 2021 Simon Arlott
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#pragma once
-
-// The platform is 32-bit, so prefer 32-bit timers to avoid overflow
-#define FAST_TIMER_T_SIZE 32
diff --git a/tmk_core/common/arm_atsam/_wait.h b/tmk_core/common/arm_atsam/_wait.h
deleted file mode 100644
index 41b686b56c..0000000000
--- a/tmk_core/common/arm_atsam/_wait.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright 2021 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#pragma once
-
-#include "clks.h"
-
-#define wait_ms(ms) CLK_delay_ms(ms)
-#define wait_us(us) CLK_delay_us(us)
-#define waitInputPinDelay()
diff --git a/tmk_core/common/arm_atsam/atomic_util.h b/tmk_core/common/arm_atsam/atomic_util.h
deleted file mode 100644
index 848542d23a..0000000000
--- a/tmk_core/common/arm_atsam/atomic_util.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright 2021 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#pragma once
-
-#include "samd51j18a.h"
-
-static __inline__ uint8_t __interrupt_disable__(void) {
- __disable_irq();
-
- return 1;
-}
-
-static __inline__ void __interrupt_enable__(const uint8_t *__s) {
- __enable_irq();
-
- __asm__ volatile("" ::: "memory");
- (void)__s;
-}
-
-#define ATOMIC_BLOCK(type) for (type, __ToDo = __interrupt_disable__(); __ToDo; __ToDo = 0)
-#define ATOMIC_FORCEON uint8_t sreg_save __attribute__((__cleanup__(__interrupt_enable__))) = 0
-
-#define ATOMIC_BLOCK_RESTORESTATE _Static_assert(0, "ATOMIC_BLOCK_RESTORESTATE not implemented")
-#define ATOMIC_BLOCK_FORCEON ATOMIC_BLOCK(ATOMIC_FORCEON)
diff --git a/tmk_core/common/arm_atsam/bootloader.c b/tmk_core/common/arm_atsam/bootloader.c
deleted file mode 100644
index 9015b00aab..0000000000
--- a/tmk_core/common/arm_atsam/bootloader.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Copyright 2017 Fred Sundvik
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "bootloader.h"
-#include "samd51j18a.h"
-#include "md_bootloader.h"
-
-// Set watchdog timer to reset. Directs the bootloader to stay in programming mode.
-void bootloader_jump(void) {
-#ifdef KEYBOARD_massdrop_ctrl
- // CTRL keyboards released with bootloader version below must use RAM method. Otherwise use WDT method.
- uint8_t ver_ram_method[] = "v2.18Jun 22 2018 17:28:08"; // The version to match (NULL terminated by compiler)
- uint8_t *ver_check = ver_ram_method; // Pointer to version match string for traversal
- uint8_t *ver_rom = (uint8_t *)0x21A0; // Pointer to address in ROM where this specific bootloader version would exist
-
- while (*ver_check && *ver_rom == *ver_check) { // While there are check version characters to match and bootloader's version matches check's version
- ver_check++; // Move check version pointer to next character
- ver_rom++; // Move ROM version pointer to next character
- }
-
- if (!*ver_check) { // If check version pointer is NULL, all characters have matched
- *MAGIC_ADDR = BOOTLOADER_MAGIC; // Set magic number into RAM
- NVIC_SystemReset(); // Perform system reset
- while (1) {
- } // Won't get here
- }
-#endif
-
- WDT->CTRLA.bit.ENABLE = 0;
- while (WDT->SYNCBUSY.bit.ENABLE) {
- }
- while (WDT->CTRLA.bit.ENABLE) {
- }
- WDT->CONFIG.bit.WINDOW = 0;
- WDT->CONFIG.bit.PER = 0;
- WDT->EWCTRL.bit.EWOFFSET = 0;
- WDT->CTRLA.bit.ENABLE = 1;
- while (WDT->SYNCBUSY.bit.ENABLE) {
- }
- while (!WDT->CTRLA.bit.ENABLE) {
- }
- while (1) {
- } // Wait on timeout
-}
diff --git a/tmk_core/common/arm_atsam/eeprom.c b/tmk_core/common/arm_atsam/eeprom.c
deleted file mode 100644
index ccd5d15a54..0000000000
--- a/tmk_core/common/arm_atsam/eeprom.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Copyright 2017 Fred Sundvik
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "eeprom.h"
-
-#ifndef EEPROM_SIZE
-# include "eeconfig.h"
-# define EEPROM_SIZE (((EECONFIG_SIZE + 3) / 4) * 4) // based off eeconfig's current usage, aligned to 4-byte sizes, to deal with LTO
-#endif
-
-__attribute__((aligned(4))) static uint8_t buffer[EEPROM_SIZE];
-
-uint8_t eeprom_read_byte(const uint8_t *addr) {
- uintptr_t offset = (uintptr_t)addr;
- return buffer[offset];
-}
-
-void eeprom_write_byte(uint8_t *addr, uint8_t value) {
- uintptr_t offset = (uintptr_t)addr;
- buffer[offset] = value;
-}
-
-uint16_t eeprom_read_word(const uint16_t *addr) {
- const uint8_t *p = (const uint8_t *)addr;
- return eeprom_read_byte(p) | (eeprom_read_byte(p + 1) << 8);
-}
-
-uint32_t eeprom_read_dword(const uint32_t *addr) {
- const uint8_t *p = (const uint8_t *)addr;
- return eeprom_read_byte(p) | (eeprom_read_byte(p + 1) << 8) | (eeprom_read_byte(p + 2) << 16) | (eeprom_read_byte(p + 3) << 24);
-}
-
-void eeprom_read_block(void *buf, const void *addr, size_t len) {
- const uint8_t *p = (const uint8_t *)addr;
- uint8_t * dest = (uint8_t *)buf;
- while (len--) {
- *dest++ = eeprom_read_byte(p++);
- }
-}
-
-void eeprom_write_word(uint16_t *addr, uint16_t value) {
- uint8_t *p = (uint8_t *)addr;
- eeprom_write_byte(p++, value);
- eeprom_write_byte(p, value >> 8);
-}
-
-void eeprom_write_dword(uint32_t *addr, uint32_t value) {
- uint8_t *p = (uint8_t *)addr;
- eeprom_write_byte(p++, value);
- eeprom_write_byte(p++, value >> 8);
- eeprom_write_byte(p++, value >> 16);
- eeprom_write_byte(p, value >> 24);
-}
-
-void eeprom_write_block(const void *buf, void *addr, size_t len) {
- uint8_t * p = (uint8_t *)addr;
- const uint8_t *src = (const uint8_t *)buf;
- while (len--) {
- eeprom_write_byte(p++, *src++);
- }
-}
-
-void eeprom_update_byte(uint8_t *addr, uint8_t value) { eeprom_write_byte(addr, value); }
-
-void eeprom_update_word(uint16_t *addr, uint16_t value) {
- uint8_t *p = (uint8_t *)addr;
- eeprom_write_byte(p++, value);
- eeprom_write_byte(p, value >> 8);
-}
-
-void eeprom_update_dword(uint32_t *addr, uint32_t value) {
- uint8_t *p = (uint8_t *)addr;
- eeprom_write_byte(p++, value);
- eeprom_write_byte(p++, value >> 8);
- eeprom_write_byte(p++, value >> 16);
- eeprom_write_byte(p, value >> 24);
-}
-
-void eeprom_update_block(const void *buf, void *addr, size_t len) {
- uint8_t * p = (uint8_t *)addr;
- const uint8_t *src = (const uint8_t *)buf;
- while (len--) {
- eeprom_write_byte(p++, *src++);
- }
-}
diff --git a/tmk_core/common/arm_atsam/gpio.h b/tmk_core/common/arm_atsam/gpio.h
deleted file mode 100644
index c2d5a30889..0000000000
--- a/tmk_core/common/arm_atsam/gpio.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Copyright 2021 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#pragma once
-
-#include "stdint.h"
-#include "samd51j18a.h"
-
-#include "pin_defs.h"
-
-typedef uint8_t pin_t;
-
-#define SAMD_PORT(pin) ((pin & 0x20) >> 5)
-#define SAMD_PIN(pin) (pin & 0x1f)
-#define SAMD_PIN_MASK(pin) (1 << (pin & 0x1f))
-
-#define setPinInput(pin) \
- do { \
- PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.INEN = 1; \
- PORT->Group[SAMD_PORT(pin)].DIRCLR.reg = SAMD_PIN_MASK(pin); \
- } while (0)
-
-#define setPinInputHigh(pin) \
- do { \
- PORT->Group[SAMD_PORT(pin)].DIRCLR.reg = SAMD_PIN_MASK(pin); \
- PORT->Group[SAMD_PORT(pin)].OUTSET.reg = SAMD_PIN_MASK(pin); \
- PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.INEN = 1; \
- PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.PULLEN = 1; \
- } while (0)
-
-#define setPinInputLow(pin) \
- do { \
- PORT->Group[SAMD_PORT(pin)].DIRCLR.reg = SAMD_PIN_MASK(pin); \
- PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \
- PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.INEN = 1; \
- PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.PULLEN = 1; \
- } while (0)
-
-#define setPinOutput(pin) \
- do { \
- PORT->Group[SAMD_PORT(pin)].DIRSET.reg = SAMD_PIN_MASK(pin); \
- PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \
- } while (0)
-
-#define writePinHigh(pin) \
- do { \
- PORT->Group[SAMD_PORT(pin)].OUTSET.reg = SAMD_PIN_MASK(pin); \
- } while (0)
-
-#define writePinLow(pin) \
- do { \
- PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \
- } while (0)
-
-#define writePin(pin, level) ((level) ? (writePinHigh(pin)) : (writePinLow(pin)))
-
-#define readPin(pin) ((PORT->Group[SAMD_PORT(pin)].IN.reg & SAMD_PIN_MASK(pin)) != 0)
-
-#define togglePin(pin) (PORT->Group[SAMD_PORT(pin)].OUTTGL.reg = SAMD_PIN_MASK(pin))
diff --git a/tmk_core/common/arm_atsam/pin_defs.h b/tmk_core/common/arm_atsam/pin_defs.h
deleted file mode 100644
index 5b50b23910..0000000000
--- a/tmk_core/common/arm_atsam/pin_defs.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Copyright 2021 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#pragma once
-
-#include "samd51j18a.h"
-
-#define A00 PIN_PA00
-#define A01 PIN_PA01
-#define A02 PIN_PA02
-#define A03 PIN_PA03
-#define A04 PIN_PA04
-#define A05 PIN_PA05
-#define A06 PIN_PA06
-#define A07 PIN_PA07
-#define A08 PIN_PA08
-#define A09 PIN_PA09
-#define A10 PIN_PA10
-#define A11 PIN_PA11
-#define A12 PIN_PA12
-#define A13 PIN_PA13
-#define A14 PIN_PA14
-#define A15 PIN_PA15
-#define A16 PIN_PA16
-#define A17 PIN_PA17
-#define A18 PIN_PA18
-#define A19 PIN_PA19
-#define A20 PIN_PA20
-#define A21 PIN_PA21
-#define A22 PIN_PA22
-#define A23 PIN_PA23
-#define A24 PIN_PA24
-#define A25 PIN_PA25
-#define A26 PIN_PA26
-#define A27 PIN_PA27
-#define A28 PIN_PA28
-#define A29 PIN_PA29
-#define A30 PIN_PA30
-#define A31 PIN_PA31
-
-#define B00 PIN_PB00
-#define B01 PIN_PB01
-#define B02 PIN_PB02
-#define B03 PIN_PB03
-#define B04 PIN_PB04
-#define B05 PIN_PB05
-#define B06 PIN_PB06
-#define B07 PIN_PB07
-#define B08 PIN_PB08
-#define B09 PIN_PB09
-#define B10 PIN_PB10
-#define B11 PIN_PB11
-#define B12 PIN_PB12
-#define B13 PIN_PB13
-#define B14 PIN_PB14
-#define B15 PIN_PB15
-#define B16 PIN_PB16
-#define B17 PIN_PB17
-#define B18 PIN_PB18
-#define B19 PIN_PB19
-#define B20 PIN_PB20
-#define B21 PIN_PB21
-#define B22 PIN_PB22
-#define B23 PIN_PB23
-#define B24 PIN_PB24
-#define B25 PIN_PB25
-#define B26 PIN_PB26
-#define B27 PIN_PB27
-#define B28 PIN_PB28
-#define B29 PIN_PB29
-#define B30 PIN_PB30
-#define B31 PIN_PB31
diff --git a/tmk_core/common/arm_atsam/platform.c b/tmk_core/common/arm_atsam/platform.c
deleted file mode 100644
index 3e35b4fe4c..0000000000
--- a/tmk_core/common/arm_atsam/platform.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright 2021 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "platform_deps.h"
-
-void platform_setup(void) {
- // do nothing
-}
diff --git a/tmk_core/common/arm_atsam/platform_deps.h b/tmk_core/common/arm_atsam/platform_deps.h
deleted file mode 100644
index f296d1d535..0000000000
--- a/tmk_core/common/arm_atsam/platform_deps.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Copyright 2021 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#pragma once
-
-// here just to please the build
diff --git a/tmk_core/common/arm_atsam/suspend.c b/tmk_core/common/arm_atsam/suspend.c
deleted file mode 100644
index e51426128d..0000000000
--- a/tmk_core/common/arm_atsam/suspend.c
+++ /dev/null
@@ -1,77 +0,0 @@
-#include "matrix.h"
-#include "i2c_master.h"
-#include "md_rgb_matrix.h"
-#include "suspend.h"
-
-/** \brief Suspend idle
- *
- * FIXME: needs doc
- */
-void suspend_idle(uint8_t time) { /* Note: Not used anywhere currently */
-}
-
-/** \brief Run user level Power down
- *
- * FIXME: needs doc
- */
-__attribute__((weak)) void suspend_power_down_user(void) {}
-
-/** \brief Run keyboard level Power down
- *
- * FIXME: needs doc
- */
-__attribute__((weak)) void suspend_power_down_kb(void) { suspend_power_down_user(); }
-
-/** \brief Suspend power down
- *
- * FIXME: needs doc
- */
-void suspend_power_down(void) {
-#ifdef RGB_MATRIX_ENABLE
- I2C3733_Control_Set(0); // Disable LED driver
-#endif
-
- suspend_power_down_kb();
-}
-
-__attribute__((weak)) void matrix_power_up(void) {}
-__attribute__((weak)) void matrix_power_down(void) {}
-bool suspend_wakeup_condition(void) {
- matrix_power_up();
- matrix_scan();
- matrix_power_down();
- for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
- if (matrix_get_row(r)) return true;
- }
- return false;
-}
-
-/** \brief run user level code immediately after wakeup
- *
- * FIXME: needs doc
- */
-__attribute__((weak)) void suspend_wakeup_init_user(void) {}
-
-/** \brief run keyboard level code immediately after wakeup
- *
- * FIXME: needs doc
- */
-__attribute__((weak)) void suspend_wakeup_init_kb(void) { suspend_wakeup_init_user(); }
-
-/** \brief run immediately after wakeup
- *
- * FIXME: needs doc
- */
-void suspend_wakeup_init(void) {
-#ifdef RGB_MATRIX_ENABLE
-# ifdef USE_MASSDROP_CONFIGURATOR
- if (led_enabled) {
- I2C3733_Control_Set(1);
- }
-# else
- I2C3733_Control_Set(1);
-# endif
-#endif
-
- suspend_wakeup_init_kb();
-}
diff --git a/tmk_core/common/arm_atsam/timer.c b/tmk_core/common/arm_atsam/timer.c
deleted file mode 100644
index b835dd5e75..0000000000
--- a/tmk_core/common/arm_atsam/timer.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include "samd51j18a.h"
-#include "timer.h"
-#include "tmk_core/protocol/arm_atsam/clks.h"
-
-void set_time(uint64_t tset) { ms_clk = tset; }
-
-void timer_init(void) { timer_clear(); }
-
-uint16_t timer_read(void) { return (uint16_t)ms_clk; }
-
-uint32_t timer_read32(void) { return (uint32_t)ms_clk; }
-
-uint64_t timer_read64(void) { return ms_clk; }
-
-uint16_t timer_elapsed(uint16_t tlast) { return TIMER_DIFF_16(timer_read(), tlast); }
-
-uint32_t timer_elapsed32(uint32_t tlast) { return TIMER_DIFF_32(timer_read32(), tlast); }
-
-void timer_clear(void) { set_time(0); }