1c0347b8b85de03691c7810f98f38bb245783985

Author
Joel Challis <git@zvecr.com>
Committer
GitHub <noreply@github.com>
Date

Message

Remove SERIAL_LINK feature (#14727)

* Remove SERIAL_LINK

* more stale paths in doxygen-todo

* Fix

* More refs

* Update testing docs

* Update doxygen-todo

Co-authored-by: Ryan <fauxpark@gmail.com>

Co-authored-by: Ryan <fauxpark@gmail.com>

Diff

This diff is truncated to protect this page.

   1diff --git a/build_test.mk b/build_test.mk
   2index 037577bf904144f8c88e71411c7c3d9a57f76952..96487c01faeab6ff6cd55dbf03ce718632297949 100644
   3--- a/build_test.mk
   4+++ b/build_test.mk
   5@@ -55,7 +55,6 @@ include common_features.mk
   6 include $(TMK_PATH)/common.mk
   7 include $(QUANTUM_PATH)/debounce/tests/rules.mk
   8 include $(QUANTUM_PATH)/sequencer/tests/rules.mk
   9-include $(QUANTUM_PATH)/serial_link/tests/rules.mk
  10 include $(TMK_PATH)/common/test/rules.mk
  11 ifneq ($(filter $(FULL_TESTS),$(TEST)),)
  12 include build_full_test.mk
  13diff --git a/common_features.mk b/common_features.mk
  14index fc9595ddd7f0d88bb88fc0ab0212345a76f654fe..3c956b7aaf66df401413c6d20b7ac9aff51facb4 100644
  15--- a/common_features.mk
  16+++ b/common_features.mk
  17@@ -13,8 +13,6 @@
  18 # You should have received a copy of the GNU General Public License
  19 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
  20 
  21-SERIAL_PATH := $(QUANTUM_PATH)/serial_link
  22-
  23 QUANTUM_SRC += \
  24     $(QUANTUM_DIR)/quantum.c \
  25     $(QUANTUM_DIR)/send_string.c \
  26@@ -363,17 +361,6 @@ ifeq ($(strip $(PRINTING_ENABLE)), yes)
  27     SRC += $(TMK_DIR)/protocol/serial_uart.c
  28 endif
  29 
  30-ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes)
  31-    SERIAL_SRC := $(wildcard $(SERIAL_PATH)/protocol/*.c)
  32-    SERIAL_SRC += $(wildcard $(SERIAL_PATH)/system/*.c)
  33-    SERIAL_DEFS += -DSERIAL_LINK_ENABLE
  34-    COMMON_VPATH += $(SERIAL_PATH)
  35-
  36-    SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC))
  37-    OPT_DEFS += $(SERIAL_DEFS)
  38-    VAPTH += $(SERIAL_PATH)
  39-endif
  40-
  41 VARIABLE_TRACE ?= no
  42 ifneq ($(strip $(VARIABLE_TRACE)),no)
  43     SRC += $(QUANTUM_DIR)/variable_trace.c
  44diff --git a/disable_features.mk b/disable_features.mk
  45index 6733e4e8081c780f2b534915c8fb915b2c05ef0b..090a9b5a11231689fb56fa8c9f8406d9a6683b1c 100644
  46--- a/disable_features.mk
  47+++ b/disable_features.mk
  48@@ -19,7 +19,6 @@ FEATURE_NAMES += PS2_MOUSE
  49 FEATURE_NAMES += RGBLIGHT
  50 FEATURE_NAMES += RGB_MATRIX
  51 FEATURE_NAMES += SLEEP_LED
  52-FEATURE_NAMES += SERIAL_LINK
  53 FEATURE_NAMES += STENO
  54 FEATURE_NAMES += SWAP_HANDS
  55 FEATURE_NAMES += WATCHDOG
  56diff --git a/docs/unit_testing.md b/docs/unit_testing.md
  57index 7310da8d0bc26889d416cfba5f482858618fdc4f..47a1055796435d1a4f70b7ab19a192d695171028 100644
  58--- a/docs/unit_testing.md
  59+++ b/docs/unit_testing.md
  60@@ -20,12 +20,12 @@ One thing to remember, is that you have to append `extern "C"` around all of you
  61 
  62 ## Adding Tests for New or Existing Features
  63 
  64-If you want to unit test some feature, then take a look at the existing serial_link tests, in the `quantum/serial_link/tests folder`, and follow the steps below to create a similar structure.
  65+If you want to unit test a feature, take a look at some of the existing tests, for example those in the `quantum/sequencer/tests` folder. Then follow the steps below to create a similar structure.
  66 
  67 1. If it doesn't already exist, add a test subfolder to the folder containing the feature.
  68 2. Create a `testlist.mk` and a `rules.mk` file in that folder.
  69 3. Include those files from the root folder `testlist.mk`and `build_test.mk` respectively.
  70diff --git a/doxygen-todo b/doxygen-todo
  71index 54d7e9ef7b129592103724fcf3d5dcc686eccf25..4151627e4a8f8116f06bc4a9faa7ba15f7e426bc 100644
  72--- a/doxygen-todo
  73+++ b/doxygen-todo
  74@@ -6,16 +6,8 @@ tmk_core/protocol/midi/bytequeue
  75 tmk_core/protocol/midi/Config
  76 tmk_core/protocol/usb_hid
  77 tmk_core/protocol/vusb
  78-tmk_core/tool
  79-tmk_core/tool/chibios
  80 quantum
  81-quantum/api
  82 quantum/audio
  83 quantum/keymap_extras
  84 quantum/process_keycode
  85-quantum/serial_link
  86-quantum/serial_link/protocol
  87-quantum/serial_link/system
  88-quantum/serial_link/tests
  89-quantum/tools
  90 drivers
  91diff --git a/keyboards/ergodox_infinity/ergodox_infinity.c b/keyboards/ergodox_infinity/ergodox_infinity.c
  92index d2a311ee8b6355665562dd79cd024c9d745cb8f7..88028d3638967728227a796dcadb32ba0f6f2695 100644
  93--- a/keyboards/ergodox_infinity/ergodox_infinity.c
  94+++ b/keyboards/ergodox_infinity/ergodox_infinity.c
  95@@ -3,7 +3,6 @@
  96 #include <hal.h>
  97 #include <string.h>
  98 #include "eeconfig.h"
  99-#include "serial_link/system/serial_link.h"
 100 
 101 #define RED_PIN 1
 102 #define GREEN_PIN 2
 103diff --git a/quantum/keyboard.c b/quantum/keyboard.c
 104index c2e2234f941acbe398074a2a7932c74471cc1bfb..ee7fa2bd4b18c9f7a60d9ba15718997ca89b02b0 100644
 105--- a/quantum/keyboard.c
 106+++ b/quantum/keyboard.c
 107@@ -61,9 +61,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 108 #ifdef STENO_ENABLE
 109 #    include "process_steno.h"
 110 #endif
 111-#ifdef SERIAL_LINK_ENABLE
 112-#    include "serial_link/system/serial_link.h"
 113-#endif
 114 #ifdef POINTING_DEVICE_ENABLE
 115 #    include "pointing_device.h"
 116 #endif
 117@@ -511,10 +508,6 @@ MATRIX_LOOP_END:
 118     adb_mouse_task();
 119 #endif
 120 
 121-#ifdef SERIAL_LINK_ENABLE
 122-    serial_link_update();
 123-#endif
 124-
 125 #ifdef POINTING_DEVICE_ENABLE
 126     pointing_device_task();
 127 #endif
 128diff --git a/quantum/sequencer/tests/rules.mk b/quantum/sequencer/tests/rules.mk
 129index 76c221cf92aac8d6ae98c5929b71e02e05ef4c08..87a204669c21aa3e13fb0ccb3bded7890fafcaf9 100644
 130--- a/quantum/sequencer/tests/rules.mk
 131+++ b/quantum/sequencer/tests/rules.mk
 132@@ -1,5 +1,5 @@
 133 # The letter case of these variables might seem odd. However:
 134-# - it is consistent with the serial_link example that is used as a reference in the Unit Testing article (https://docs.qmk.fm/#/unit_testing?id=adding-tests-for-new-or-existing-features)
 135+# - it is consistent with the example that is used as a reference in the Unit Testing article (https://docs.qmk.fm/#/unit_testing?id=adding-tests-for-new-or-existing-features)
 136 # - Neither `make test:sequencer` or `make test:SEQUENCER` work when using SCREAMING_SNAKE_CASE
 137 
 138 sequencer_DEFS := -DNO_DEBUG -DMIDI_MOCKED
 139diff --git a/quantum/serial_link/LICENSE b/quantum/serial_link/LICENSE
 140deleted file mode 100644
 141index d13cc4b26a53906de87bb29eb6c1ab82b1ef91fe..0000000000000000000000000000000000000000
 142--- a/quantum/serial_link/LICENSE
 143+++ /dev/null
 144@@ -1,19 +0,0 @@
 145-The MIT License (MIT)
 146-
 147-Permission is hereby granted, free of charge, to any person obtaining a copy
 148-of this software and associated documentation files (the "Software"), to deal
 149-in the Software without restriction, including without limitation the rights
 150-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 151-copies of the Software, and to permit persons to whom the Software is
 152-furnished to do so, subject to the following conditions:
 153-
 154-The above copyright notice and this permission notice shall be included in all
 155-copies or substantial portions of the Software.
 156-
 157-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 158-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 159-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 160-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 161-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 162-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 163-SOFTWARE.
 164diff --git a/quantum/serial_link/README.md b/quantum/serial_link/README.md
 165deleted file mode 100644
 166index 05871dbdf7ee621c8769092a7480a88d3459e230..0000000000000000000000000000000000000000
 167--- a/quantum/serial_link/README.md
 168+++ /dev/null
 169@@ -1 +0,0 @@
 170-# qmk_serial_link
 171diff --git a/quantum/serial_link/protocol/byte_stuffer.c b/quantum/serial_link/protocol/byte_stuffer.c
 172deleted file mode 100644
 173index d3a91d8286d9ec645163765aeac0e2c523faec55..0000000000000000000000000000000000000000
 174--- a/quantum/serial_link/protocol/byte_stuffer.c
 175+++ /dev/null
 176@@ -1,135 +0,0 @@
 177-/*
 178-The MIT License (MIT)
 179-
 180-Copyright (c) 2016 Fred Sundvik
 181-
 182-Permission is hereby granted, free of charge, to any person obtaining a copy
 183-of this software and associated documentation files (the "Software"), to deal
 184-in the Software without restriction, including without limitation the rights
 185-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 186-copies of the Software, and to permit persons to whom the Software is
 187-furnished to do so, subject to the following conditions:
 188-
 189-The above copyright notice and this permission notice shall be included in all
 190-copies or substantial portions of the Software.
 191-
 192-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 193-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 194-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 195-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 196-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 197-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 198-SOFTWARE.
 199-*/
 200-
 201-#include "serial_link/protocol/byte_stuffer.h"
 202-#include "serial_link/protocol/frame_validator.h"
 203-#include "serial_link/protocol/physical.h"
 204-#include <stdbool.h>
 205-
 206-// This implements the "Consistent overhead byte stuffing protocol"
 207-// https://en.wikipedia.org/wiki/Consistent_Overhead_Byte_Stuffing
 208-// http://www.stuartcheshire.org/papers/COBSforToN.pdf
 209-
 210-typedef struct byte_stuffer_state {
 211-    uint16_t next_zero;
 212-    uint16_t data_pos;
 213-    bool     long_frame;
 214-    uint8_t  data[MAX_FRAME_SIZE];
 215-} byte_stuffer_state_t;
 216-
 217-static byte_stuffer_state_t states[NUM_LINKS];
 218-
 219-void init_byte_stuffer_state(byte_stuffer_state_t* state) {
 220-    state->next_zero  = 0;
 221-    state->data_pos   = 0;
 222-    state->long_frame = false;
 223-}
 224-
 225-void init_byte_stuffer(void) {
 226-    int i;
 227-    for (i = 0; i < NUM_LINKS; i++) {
 228-        init_byte_stuffer_state(&states[i]);
 229-    }
 230-}
 231-
 232-void byte_stuffer_recv_byte(uint8_t link, uint8_t data) {
 233-    byte_stuffer_state_t* state = &states[link];
 234-    // Start of a new frame
 235-    if (state->next_zero == 0) {
 236-        state->next_zero  = data;
 237-        state->long_frame = data == 0xFF;
 238-        state->data_pos   = 0;
 239-        return;
 240-    }
 241-
 242-    state->next_zero--;
 243-    if (data == 0) {
 244-        if (state->next_zero == 0) {
 245-            // The frame is completed
 246-            if (state->data_pos > 0) {
 247-                validator_recv_frame(link, state->data, state->data_pos);
 248-            }
 249-        } else {
 250-            // The frame is invalid, so reset
 251-            init_byte_stuffer_state(state);
 252-        }
 253-    } else {
 254-        if (state->data_pos == MAX_FRAME_SIZE) {
 255-            // We exceeded our maximum frame size
 256-            // therefore there's nothing else to do than reset to a new frame
 257-            state->next_zero  = data;
 258-            state->long_frame = data == 0xFF;
 259-            state->data_pos   = 0;
 260-        } else if (state->next_zero == 0) {
 261-            if (state->long_frame) {
 262-                // This is part of a long frame, so continue
 263-                state->next_zero  = data;
 264-                state->long_frame = data == 0xFF;
 265-            } else {
 266-                // Special case for zeroes
 267-                state->next_zero               = data;
 268-                state->data[state->data_pos++] = 0;
 269-            }
 270-        } else {
 271-            state->data[state->data_pos++] = data;
 272-        }
 273-    }
 274-}
 275-
 276diff --git a/quantum/serial_link/protocol/byte_stuffer.h b/quantum/serial_link/protocol/byte_stuffer.h
 277deleted file mode 100644
 278index 397ed3baae19bda193197fbd4f142861cdd98650..0000000000000000000000000000000000000000
 279--- a/quantum/serial_link/protocol/byte_stuffer.h
 280+++ /dev/null
 281@@ -1,34 +0,0 @@
 282-/*
 283-The MIT License (MIT)
 284-
 285-Copyright (c) 2016 Fred Sundvik
 286-
 287-Permission is hereby granted, free of charge, to any person obtaining a copy
 288-of this software and associated documentation files (the "Software"), to deal
 289-in the Software without restriction, including without limitation the rights
 290-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 291-copies of the Software, and to permit persons to whom the Software is
 292-furnished to do so, subject to the following conditions:
 293-
 294-The above copyright notice and this permission notice shall be included in all
 295-copies or substantial portions of the Software.
 296-
 297-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 298-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 299-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 300-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 301-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 302-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 303-SOFTWARE.
 304-*/
 305-
 306-#pragma once
 307-
 308-#include <stdint.h>
 309-
 310-#define MAX_FRAME_SIZE 1024
 311-#define NUM_LINKS 2
 312-
 313-void init_byte_stuffer(void);
 314-void byte_stuffer_recv_byte(uint8_t link, uint8_t data);
 315-void byte_stuffer_send_frame(uint8_t link, uint8_t* data, uint16_t size);
 316diff --git a/quantum/serial_link/protocol/frame_router.c b/quantum/serial_link/protocol/frame_router.c
 317deleted file mode 100644
 318index 5292673700c61e80783c240f039f2c953cf8c89e..0000000000000000000000000000000000000000
 319--- a/quantum/serial_link/protocol/frame_router.c
 320+++ /dev/null
 321@@ -1,64 +0,0 @@
 322-/*
 323-The MIT License (MIT)
 324-
 325-Copyright (c) 2016 Fred Sundvik
 326-
 327-Permission is hereby granted, free of charge, to any person obtaining a copy
 328-of this software and associated documentation files (the "Software"), to deal
 329-in the Software without restriction, including without limitation the rights
 330-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 331-copies of the Software, and to permit persons to whom the Software is
 332-furnished to do so, subject to the following conditions:
 333-
 334-The above copyright notice and this permission notice shall be included in all
 335-copies or substantial portions of the Software.
 336-
 337-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 338-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 339-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 340-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 341-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 342-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 343-SOFTWARE.
 344-*/
 345-
 346-#include "serial_link/protocol/frame_router.h"
 347-#include "serial_link/protocol/transport.h"
 348-#include "serial_link/protocol/frame_validator.h"
 349-
 350-static bool is_master;
 351-
 352-void router_set_master(bool master) { is_master = master; }
 353-
 354-void route_incoming_frame(uint8_t link, uint8_t* data, uint16_t size) {
 355-    if (is_master) {
 356-        if (link == DOWN_LINK) {
 357-            transport_recv_frame(data[size - 1], data, size - 1);
 358-        }
 359-    } else {
 360-        if (link == UP_LINK) {
 361-            if (data[size - 1] & 1) {
 362-                transport_recv_frame(0, data, size - 1);
 363-            }
 364-            data[size - 1] >>= 1;
 365-            validator_send_frame(DOWN_LINK, data, size);
 366-        } else {
 367-            data[size - 1]++;
 368-            validator_send_frame(UP_LINK, data, size);
 369-        }
 370-    }
 371-}
 372-
 373-void router_send_frame(uint8_t destination, uint8_t* data, uint16_t size) {
 374-    if (destination == 0) {
 375-        if (!is_master) {
 376-            data[size] = 1;
 377-            validator_send_frame(UP_LINK, data, size + 1);
 378-        }
 379-    } else {
 380-        if (is_master) {
 381-            data[size] = destination;
 382-            validator_send_frame(DOWN_LINK, data, size + 1);
 383-        }
 384-    }
 385-}
 386diff --git a/quantum/serial_link/protocol/frame_router.h b/quantum/serial_link/protocol/frame_router.h
 387deleted file mode 100644
 388index 9325fe4eed96c6d2869df6632407c4813f949e1c..0000000000000000000000000000000000000000
 389--- a/quantum/serial_link/protocol/frame_router.h
 390+++ /dev/null
 391@@ -1,35 +0,0 @@
 392-/*
 393-The MIT License (MIT)
 394-
 395-Copyright (c) 2016 Fred Sundvik
 396-
 397-Permission is hereby granted, free of charge, to any person obtaining a copy
 398-of this software and associated documentation files (the "Software"), to deal
 399-in the Software without restriction, including without limitation the rights
 400-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 401-copies of the Software, and to permit persons to whom the Software is
 402-furnished to do so, subject to the following conditions:
 403-
 404-The above copyright notice and this permission notice shall be included in all
 405-copies or substantial portions of the Software.
 406-
 407-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 408-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 409-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 410-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 411-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 412-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 413-SOFTWARE.
 414-*/
 415-
 416-#pragma once
 417-
 418-#include <stdint.h>
 419-#include <stdbool.h>
 420-
 421-#define UP_LINK 0
 422-#define DOWN_LINK 1
 423-
 424-void router_set_master(bool master);
 425-void route_incoming_frame(uint8_t link, uint8_t* data, uint16_t size);
 426-void router_send_frame(uint8_t destination, uint8_t* data, uint16_t size);
 427diff --git a/quantum/serial_link/protocol/frame_validator.c b/quantum/serial_link/protocol/frame_validator.c
 428deleted file mode 100644
 429index bc9136f70befc2eb570536655ce65d0f4d7aafef..0000000000000000000000000000000000000000
 430--- a/quantum/serial_link/protocol/frame_validator.c
 431+++ /dev/null
 432@@ -1,57 +0,0 @@
 433-/*
 434-The MIT License (MIT)
 435-
 436-Copyright (c) 2016 Fred Sundvik
 437-
 438-Permission is hereby granted, free of charge, to any person obtaining a copy
 439-of this software and associated documentation files (the "Software"), to deal
 440-in the Software without restriction, including without limitation the rights
 441-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 442-copies of the Software, and to permit persons to whom the Software is
 443-furnished to do so, subject to the following conditions:
 444-
 445-The above copyright notice and this permission notice shall be included in all
 446-copies or substantial portions of the Software.
 447-
 448-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 449-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 450-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 451-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 452-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 453-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 454-SOFTWARE.
 455-*/
 456-
 457-#include "serial_link/protocol/frame_validator.h"
 458-#include "serial_link/protocol/frame_router.h"
 459-#include "serial_link/protocol/byte_stuffer.h"
 460-#include <string.h>
 461-
 462diff --git a/quantum/serial_link/protocol/frame_validator.h b/quantum/serial_link/protocol/frame_validator.h
 463deleted file mode 100644
 464index 0f78768a00fa3a6e45cc33bb0cd2d025b63c4860..0000000000000000000000000000000000000000
 465--- a/quantum/serial_link/protocol/frame_validator.h
 466+++ /dev/null
 467@@ -1,31 +0,0 @@
 468-/*
 469-The MIT License (MIT)
 470-
 471-Copyright (c) 2016 Fred Sundvik
 472-
 473-Permission is hereby granted, free of charge, to any person obtaining a copy
 474-of this software and associated documentation files (the "Software"), to deal
 475-in the Software without restriction, including without limitation the rights
 476-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 477-copies of the Software, and to permit persons to whom the Software is
 478-furnished to do so, subject to the following conditions:
 479-
 480-The above copyright notice and this permission notice shall be included in all
 481-copies or substantial portions of the Software.
 482-
 483-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 484-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 485-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 486-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 487-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 488-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 489-SOFTWARE.
 490-*/
 491-
 492-#pragma once
 493-
 494-#include <stdint.h>
 495-
 496-void validator_recv_frame(uint8_t link, uint8_t* data, uint16_t size);
 497-// The buffer pointed to by the data needs 4 additional bytes
 498-void validator_send_frame(uint8_t link, uint8_t* data, uint16_t size);
 499diff --git a/quantum/serial_link/protocol/physical.h b/quantum/serial_link/protocol/physical.h
 500deleted file mode 100644
 501index 399c9d1f7647379cfa1ea480e14b81bc4d82851d..0000000000000000000000000000000000000000
 502--- a/quantum/serial_link/protocol/physical.h
 503+++ /dev/null
 504@@ -1,27 +0,0 @@
 505-/*
 506-The MIT License (MIT)
 507-
 508-Copyright (c) 2016 Fred Sundvik
 509-
 510-Permission is hereby granted, free of charge, to any person obtaining a copy
 511-of this software and associated documentation files (the "Software"), to deal
 512-in the Software without restriction, including without limitation the rights
 513-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 514-copies of the Software, and to permit persons to whom the Software is
 515-furnished to do so, subject to the following conditions:
 516-
 517-The above copyright notice and this permission notice shall be included in all
 518-copies or substantial portions of the Software.
 519-
 520-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 521-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 522-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 523-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 524-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 525-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 526-SOFTWARE.
 527-*/
 528-
 529-#pragma once
 530-
 531-void send_data(uint8_t link, const uint8_t* data, uint16_t size);
 532diff --git a/quantum/serial_link/protocol/transport.c b/quantum/serial_link/protocol/transport.c
 533deleted file mode 100644
 534index 73b8dc62e9e60fb91c1515e0643ac171dafd8894..0000000000000000000000000000000000000000
 535--- a/quantum/serial_link/protocol/transport.c
 536+++ /dev/null
 537@@ -1,121 +0,0 @@
 538-/*
 539-The MIT License (MIT)
 540-
 541-Copyright (c) 2016 Fred Sundvik
 542-
 543-Permission is hereby granted, free of charge, to any person obtaining a copy
 544-of this software and associated documentation files (the "Software"), to deal
 545-in the Software without restriction, including without limitation the rights
 546-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 547-copies of the Software, and to permit persons to whom the Software is
 548-furnished to do so, subject to the following conditions:
 549-
 550-The above copyright notice and this permission notice shall be included in all
 551-copies or substantial portions of the Software.
 552-
 553-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 554-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 555-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 556-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 557-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 558-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 559-SOFTWARE.
 560-*/
 561-
 562-#include "serial_link/protocol/transport.h"
 563-#include "serial_link/protocol/frame_router.h"
 564-#include "serial_link/protocol/triple_buffered_object.h"
 565-#include <string.h>
 566-
 567-#define MAX_REMOTE_OBJECTS 16
 568-static remote_object_t* remote_objects[MAX_REMOTE_OBJECTS];
 569-static uint32_t         num_remote_objects = 0;
 570-
 571-void reinitialize_serial_link_transport(void) { num_remote_objects = 0; }
 572-
 573-void add_remote_objects(remote_object_t** _remote_objects, uint32_t _num_remote_objects) {
 574-    unsigned int i;
 575-    for (i = 0; i < _num_remote_objects; i++) {
 576-        remote_object_t* obj                 = _remote_objects[i];
 577-        remote_objects[num_remote_objects++] = obj;
 578-        if (obj->object_type == MASTER_TO_ALL_SLAVES) {
 579-            triple_buffer_object_t* tb = (triple_buffer_object_t*)obj->buffer;
 580-            triple_buffer_init(tb);
 581-            uint8_t* start = obj->buffer + LOCAL_OBJECT_SIZE(obj->object_size);
 582-            tb             = (triple_buffer_object_t*)start;
 583-            triple_buffer_init(tb);
 584-        } else if (obj->object_type == MASTER_TO_SINGLE_SLAVE) {
 585-            uint8_t*     start = obj->buffer;
 586-            unsigned int j;
 587-            for (j = 0; j < NUM_SLAVES; j++) {
 588-                triple_buffer_object_t* tb = (triple_buffer_object_t*)start;
 589-                triple_buffer_init(tb);
 590-                start += LOCAL_OBJECT_SIZE(obj->object_size);
 591-            }
 592-            triple_buffer_object_t* tb = (triple_buffer_object_t*)start;
 593-            triple_buffer_init(tb);
 594-        } else {
 595-            uint8_t*                start = obj->buffer;
 596-            triple_buffer_object_t* tb    = (triple_buffer_object_t*)start;
 597-            triple_buffer_init(tb);
 598-            start += LOCAL_OBJECT_SIZE(obj->object_size);
 599-            unsigned int j;
 600-            for (j = 0; j < NUM_SLAVES; j++) {
 601-                tb = (triple_buffer_object_t*)start;
 602-                triple_buffer_init(tb);
 603-                start += REMOTE_OBJECT_SIZE(obj->object_size);
 604-            }
 605-        }
 606-    }
 607-}
 608-
 609-void transport_recv_frame(uint8_t from, uint8_t* data, uint16_t size) {
 610-    uint8_t id = data[size - 1];
 611-    if (id < num_remote_objects) {
 612-        remote_object_t* obj = remote_objects[id];
 613-        if (obj->object_size == size - 1) {
 614-            uint8_t* start;
 615-            if (obj->object_type == MASTER_TO_ALL_SLAVES) {
 616-                start = obj->buffer + LOCAL_OBJECT_SIZE(obj->object_size);
 617-            } else if (obj->object_type == SLAVE_TO_MASTER) {
 618-                start = obj->buffer + LOCAL_OBJECT_SIZE(obj->object_size);
 619-                start += (from - 1) * REMOTE_OBJECT_SIZE(obj->object_size);
 620-            } else {
 621-                start = obj->buffer + NUM_SLAVES * LOCAL_OBJECT_SIZE(obj->object_size);
 622-            }
 623-            triple_buffer_object_t* tb  = (triple_buffer_object_t*)start;
 624-            void*                   ptr = triple_buffer_begin_write_internal(obj->object_size, tb);
 625-            memcpy(ptr, data, size - 1);
 626-            triple_buffer_end_write_internal(tb);
 627-        }
 628-    }
 629-}
 630-
 631-void update_transport(void) {
 632-    unsigned int i;
 633-    for (i = 0; i < num_remote_objects; i++) {
 634-        remote_object_t* obj = remote_objects[i];
 635-        if (obj->object_type == MASTER_TO_ALL_SLAVES || obj->object_type == SLAVE_TO_MASTER) {
 636-            triple_buffer_object_t* tb  = (triple_buffer_object_t*)obj->buffer;
 637diff --git a/quantum/serial_link/protocol/transport.h b/quantum/serial_link/protocol/transport.h
 638deleted file mode 100644
 639index 3ce0c9fe4e6f4fae8f71f2f8d69f82535ebd02aa..0000000000000000000000000000000000000000
 640--- a/quantum/serial_link/protocol/transport.h
 641+++ /dev/null
 642@@ -1,139 +0,0 @@
 643-/*
 644-The MIT License (MIT)
 645-
 646-Copyright (c) 2016 Fred Sundvik
 647-
 648-Permission is hereby granted, free of charge, to any person obtaining a copy
 649-of this software and associated documentation files (the "Software"), to deal
 650-in the Software without restriction, including without limitation the rights
 651-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 652-copies of the Software, and to permit persons to whom the Software is
 653-furnished to do so, subject to the following conditions:
 654-
 655-The above copyright notice and this permission notice shall be included in all
 656-copies or substantial portions of the Software.
 657-
 658-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 659-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 660-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 661-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 662-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 663-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 664-SOFTWARE.
 665-*/
 666-
 667-#pragma once
 668-
 669-#include "serial_link/protocol/triple_buffered_object.h"
 670-#include "serial_link/system/serial_link.h"
 671-
 672-#define NUM_SLAVES 8
 673-#define LOCAL_OBJECT_EXTRA 16
 674-
 675-// master -> slave = 1 local(target all), 1 remote object
 676-// slave -> master = 1 local(target 0), multiple remote objects
 677-// master -> single slave (multiple local, target id), 1 remote object
 678-typedef enum {
 679-    MASTER_TO_ALL_SLAVES,
 680-    MASTER_TO_SINGLE_SLAVE,
 681-    SLAVE_TO_MASTER,
 682-} remote_object_type;
 683-
 684-typedef struct {
 685-    remote_object_type object_type;
 686-    uint16_t           object_size;
 687-    uint8_t            buffer[] __attribute__((aligned(4)));
 688-} remote_object_t;
 689-
 690-#define REMOTE_OBJECT_SIZE(objectsize) (sizeof(triple_buffer_object_t) + objectsize * 3)
 691-#define LOCAL_OBJECT_SIZE(objectsize) (sizeof(triple_buffer_object_t) + (objectsize + LOCAL_OBJECT_EXTRA) * 3)
 692-
 693-#define REMOTE_OBJECT_HELPER(name, type, num_local, num_remote)                                                              \
 694-    typedef struct {                                                                                                         \
 695-        remote_object_t object;                                                                                              \
 696-        uint8_t         buffer[num_remote * REMOTE_OBJECT_SIZE(sizeof(type)) + num_local * LOCAL_OBJECT_SIZE(sizeof(type))]; \
 697-    } remote_object_##name##_t;
 698-
 699-#define MASTER_TO_ALL_SLAVES_OBJECT(name, type)                                                                     \
 700-    REMOTE_OBJECT_HELPER(name, type, 1, 1)                                                                          \
 701-    remote_object_##name##_t remote_object_##name = {.object = {                                                    \
 702-                                                         .object_type = MASTER_TO_ALL_SLAVES,                       \
 703-                                                         .object_size = sizeof(type),                               \
 704-                                                     }};                                                            \
 705-    type*                    begin_write_##name(void) {                                                             \
 706-        remote_object_t*        obj = (remote_object_t*)&remote_object_##name;                   \
 707-        triple_buffer_object_t* tb  = (triple_buffer_object_t*)obj->buffer;                      \
 708-        return (type*)triple_buffer_begin_write_internal(sizeof(type) + LOCAL_OBJECT_EXTRA, tb); \
 709-    }                                                                                                               \
 710-    void end_write_##name(void) {                                                                                   \
 711-        remote_object_t*        obj = (remote_object_t*)&remote_object_##name;                                      \
 712-        triple_buffer_object_t* tb  = (triple_buffer_object_t*)obj->buffer;                                         \
 713-        triple_buffer_end_write_internal(tb);                                                                       \
 714-        signal_data_written();                                                                                      \
 715-    }                                                                                                               \
 716-    type* read_##name(void) {                                                                                       \
 717-        remote_object_t*        obj   = (remote_object_t*)&remote_object_##name;                                    \
 718-        uint8_t*                start = obj->buffer + LOCAL_OBJECT_SIZE(obj->object_size);                          \
 719-        triple_buffer_object_t* tb    = (triple_buffer_object_t*)start;                                             \
 720-        return (type*)triple_buffer_read_internal(obj->object_size, tb);                                            \
 721-    }
 722-
 723-#define MASTER_TO_SINGLE_SLAVE_OBJECT(name, type)                                                                   \
 724-    REMOTE_OBJECT_HELPER(name, type, NUM_SLAVES, 1)                                                                 \
 725-    remote_object_##name##_t remote_object_##name = {.object = {                                                    \
 726-                                                         .object_type = MASTER_TO_SINGLE_SLAVE,                     \
 727-                                                         .object_size = sizeof(type),                               \
 728-                                                     }};                                                            \
 729-    type*                    begin_write_##name(uint8_t slave) {                                                    \
 730-        remote_object_t* obj   = (remote_object_t*)&remote_object_##name;                        \
 731-        uint8_t*         start = obj->buffer;                                                    \
 732-        start += slave * LOCAL_OBJECT_SIZE(obj->object_size);                                    \
 733-        triple_buffer_object_t* tb = (triple_buffer_object_t*)start;                             \
 734-        return (type*)triple_buffer_begin_write_internal(sizeof(type) + LOCAL_OBJECT_EXTRA, tb); \
 735-    }                                                                                                               \
 736-    void end_write_##name(uint8_t slave) {                                                                          \
 737-        remote_object_t* obj   = (remote_object_t*)&remote_object_##name;                                           \
 738-        uint8_t*         start = obj->buffer;                                                                       \
 739-        start += slave * LOCAL_OBJECT_SIZE(obj->object_size);                                                       \
 740-        triple_buffer_object_t* tb = (triple_buffer_object_t*)start;                                                \
 741-        triple_buffer_end_write_internal(tb);                                                                       \
 742diff --git a/quantum/serial_link/protocol/triple_buffered_object.c b/quantum/serial_link/protocol/triple_buffered_object.c
 743deleted file mode 100644
 744index e0c6d702a54c66125560adc608a0d447efd32378..0000000000000000000000000000000000000000
 745--- a/quantum/serial_link/protocol/triple_buffered_object.c
 746+++ /dev/null
 747@@ -1,77 +0,0 @@
 748-/*
 749-The MIT License (MIT)
 750-
 751-Copyright (c) 2016 Fred Sundvik
 752-
 753-Permission is hereby granted, free of charge, to any person obtaining a copy
 754-of this software and associated documentation files (the "Software"), to deal
 755-in the Software without restriction, including without limitation the rights
 756-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 757-copies of the Software, and to permit persons to whom the Software is
 758-furnished to do so, subject to the following conditions:
 759-
 760-The above copyright notice and this permission notice shall be included in all
 761-copies or substantial portions of the Software.
 762-
 763-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 764-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 765-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 766-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 767-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 768-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 769-SOFTWARE.
 770-*/
 771-
 772-#include "serial_link/protocol/triple_buffered_object.h"
 773-#include "serial_link/system/serial_link.h"
 774-#include <stdbool.h>
 775-#include <stddef.h>
 776-
 777-#define GET_READ_INDEX() object->state & 3
 778-#define GET_WRITE_INDEX() (object->state >> 2) & 3
 779-#define GET_SHARED_INDEX() (object->state >> 4) & 3
 780-#define GET_DATA_AVAILABLE() (object->state >> 6) & 1
 781-
 782-#define SET_READ_INDEX(i) object->state = ((object->state & ~3) | i)
 783-#define SET_WRITE_INDEX(i) object->state = ((object->state & ~(3 << 2)) | (i << 2))
 784-#define SET_SHARED_INDEX(i) object->state = ((object->state & ~(3 << 4)) | (i << 4))
 785-#define SET_DATA_AVAILABLE(i) object->state = ((object->state & ~(1 << 6)) | (i << 6))
 786-
 787-void triple_buffer_init(triple_buffer_object_t* object) {
 788-    object->state = 0;
 789-    SET_WRITE_INDEX(0);
 790-    SET_READ_INDEX(1);
 791-    SET_SHARED_INDEX(2);
 792-    SET_DATA_AVAILABLE(0);
 793-}
 794-
 795-void* triple_buffer_read_internal(uint16_t object_size, triple_buffer_object_t* object) {
 796-    serial_link_lock();
 797-    if (GET_DATA_AVAILABLE()) {
 798-        uint8_t shared_index = GET_SHARED_INDEX();
 799-        uint8_t read_index   = GET_READ_INDEX();
 800-        SET_READ_INDEX(shared_index);
 801-        SET_SHARED_INDEX(read_index);
 802-        SET_DATA_AVAILABLE(false);
 803-        serial_link_unlock();
 804-        return object->buffer + object_size * shared_index;
 805-    } else {
 806-        serial_link_unlock();
 807-        return NULL;
 808-    }
 809-}
 810-
 811-void* triple_buffer_begin_write_internal(uint16_t object_size, triple_buffer_object_t* object) {
 812-    uint8_t write_index = GET_WRITE_INDEX();
 813-    return object->buffer + object_size * write_index;
 814-}
 815-
 816-void triple_buffer_end_write_internal(triple_buffer_object_t* object) {
 817-    serial_link_lock();
 818-    uint8_t shared_index = GET_SHARED_INDEX();
 819-    uint8_t write_index  = GET_WRITE_INDEX();
 820-    SET_SHARED_INDEX(write_index);
 821-    SET_WRITE_INDEX(shared_index);
 822-    SET_DATA_AVAILABLE(true);
 823-    serial_link_unlock();
 824-}
 825diff --git a/quantum/serial_link/protocol/triple_buffered_object.h b/quantum/serial_link/protocol/triple_buffered_object.h
 826deleted file mode 100644
 827index 717d6d7b8be3e23f78560d5eb25531cdc314fd0f..0000000000000000000000000000000000000000
 828--- a/quantum/serial_link/protocol/triple_buffered_object.h
 829+++ /dev/null
 830@@ -1,44 +0,0 @@
 831-/*
 832-The MIT License (MIT)
 833-
 834-Copyright (c) 2016 Fred Sundvik
 835-
 836-Permission is hereby granted, free of charge, to any person obtaining a copy
 837-of this software and associated documentation files (the "Software"), to deal
 838-in the Software without restriction, including without limitation the rights
 839-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 840-copies of the Software, and to permit persons to whom the Software is
 841-furnished to do so, subject to the following conditions:
 842-
 843-The above copyright notice and this permission notice shall be included in all
 844-copies or substantial portions of the Software.
 845-
 846-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 847-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 848-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 849-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 850-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 851-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 852-SOFTWARE.
 853-*/
 854-
 855-#pragma once
 856-
 857-#include <stdint.h>
 858-
 859-typedef struct {
 860-    uint8_t state;
 861-    uint8_t buffer[] __attribute__((aligned(4)));
 862-} triple_buffer_object_t;
 863-
 864-void triple_buffer_init(triple_buffer_object_t* object);
 865-
 866-#define triple_buffer_begin_write(object) (typeof(*object.buffer[0])*)triple_buffer_begin_write_internal(sizeof(*object.buffer[0]), (triple_buffer_object_t*)object)
 867-
 868-#define triple_buffer_end_write(object) triple_buffer_end_write_internal((triple_buffer_object_t*)object)
 869-
 870-#define triple_buffer_read(object) (typeof(*object.buffer[0])*)triple_buffer_read_internal(sizeof(*object.buffer[0]), (triple_buffer_object_t*)object)
 871-
 872-void* triple_buffer_begin_write_internal(uint16_t object_size, triple_buffer_object_t* object);
 873-void  triple_buffer_end_write_internal(triple_buffer_object_t* object);
 874-void* triple_buffer_read_internal(uint16_t object_size, triple_buffer_object_t* object);
 875diff --git a/quantum/serial_link/system/serial_link.c b/quantum/serial_link/system/serial_link.c
 876deleted file mode 100644
 877index 6363f8ff3ba7e0a1b35bd5fb1ee20624cd411280..0000000000000000000000000000000000000000
 878--- a/quantum/serial_link/system/serial_link.c
 879+++ /dev/null
 880@@ -1,250 +0,0 @@
 881-/*
 882-The MIT License (MIT)
 883-
 884-Copyright (c) 2016 Fred Sundvik
 885-
 886-Permission is hereby granted, free of charge, to any person obtaining a copy
 887-of this software and associated documentation files (the "Software"), to deal
 888-in the Software without restriction, including without limitation the rights
 889-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 890-copies of the Software, and to permit persons to whom the Software is
 891-furnished to do so, subject to the following conditions:
 892-
 893-The above copyright notice and this permission notice shall be included in all
 894-copies or substantial portions of the Software.
 895-
 896-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 897-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 898-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 899-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 900-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 901-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 902-SOFTWARE.
 903-*/
 904-#include "report.h"
 905-#include "host_driver.h"
 906-#include "serial_link/system/serial_link.h"
 907-#include <hal.h>
 908-#include "serial_link/protocol/byte_stuffer.h"
 909-#include "serial_link/protocol/transport.h"
 910-#include "serial_link/protocol/frame_router.h"
 911-#include "matrix.h"
 912-#include "sync_timer.h"
 913-#include <stdbool.h>
 914-#include "print.h"
 915-#include "config.h"
 916-
 917-#define SYNC_TIMER_OFFSET 2
 918-
 919-static event_source_t new_data_event;
 920-static bool           serial_link_connected;
 921-static bool           is_master = false;
 922-
 923-static uint8_t keyboard_leds(void);
 924-static void    send_keyboard(report_keyboard_t* report);
 925-static void    send_mouse(report_mouse_t* report);
 926-static void    send_system(uint16_t data);
 927-static void    send_consumer(uint16_t data);
 928-
 929-host_driver_t serial_driver = {keyboard_leds, send_keyboard, send_mouse, send_system, send_consumer};
 930-
 931-// Define these in your Config.h file
 932-#ifndef SERIAL_LINK_BAUD
 933-#    error "Serial link baud is not set"
 934-#endif
 935-
 936-#ifndef SERIAL_LINK_THREAD_PRIORITY
 937-#    error "Serial link thread priority not set"
 938-#endif
 939-
 940-static SerialConfig config = {.sc_speed = SERIAL_LINK_BAUD};
 941-
 942-//#define DEBUG_LINK_ERRORS
 943-
 944-static uint32_t read_from_serial(SerialDriver* driver, uint8_t link) {
 945-    const uint32_t buffer_size = 16;
 946-    uint8_t        buffer[buffer_size];
 947-    uint32_t       bytes_read = sdAsynchronousRead(driver, buffer, buffer_size);
 948-    uint8_t*       current    = buffer;
 949-    uint8_t*       end        = current + bytes_read;
 950-    while (current < end) {
 951-        byte_stuffer_recv_byte(link, *current);
 952-        current++;
 953-    }
 954-    return bytes_read;
 955-}
 956-
 957-static void print_error(char* str, eventflags_t flags, SerialDriver* driver) {
 958-#ifdef DEBUG_LINK_ERRORS
 959-    if (flags & SD_PARITY_ERROR) {
 960-        print(str);
 961-        print(" Parity error\n");
 962-    }
 963-    if (flags & SD_FRAMING_ERROR) {
 964-        print(str);
 965-        print(" Framing error\n");
 966-    }
 967-    if (flags & SD_OVERRUN_ERROR) {
 968-        print(str);
 969-        uint32_t size = qSpaceI(&(driver->iqueue));
 970-        xprintf(" Overrun error, queue size %d\n", size);
 971-    }
 972-    if (flags & SD_NOISE_ERROR) {
 973-        print(str);
 974-        print(" Noise error\n");
 975-    }
 976-    if (flags & SD_BREAK_DETECTED) {
 977-        print(str);
 978-        print(" Break detected\n");
 979-    }
 980diff --git a/quantum/serial_link/system/serial_link.h b/quantum/serial_link/system/serial_link.h
 981deleted file mode 100644
 982index adc1f6e93d00a013ad70857412640d816ce80f8a..0000000000000000000000000000000000000000
 983--- a/quantum/serial_link/system/serial_link.h
 984+++ /dev/null
 985@@ -1,54 +0,0 @@
 986-/*
 987-The MIT License (MIT)
 988-
 989-Copyright (c) 2016 Fred Sundvik
 990-
 991-Permission is hereby granted, free of charge, to any person obtaining a copy
 992-of this software and associated documentation files (the "Software"), to deal
 993-in the Software without restriction, including without limitation the rights
 994-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 995-copies of the Software, and to permit persons to whom the Software is
 996-furnished to do so, subject to the following conditions:
 997-
 998-The above copyright notice and this permission notice shall be included in all
 999-copies or substantial portions of the Software.
1000-
1001-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1002-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1003-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1004-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1005-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1006-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1007-SOFTWARE.
1008-*/
1009-
1010-#pragma once
1011-
1012-#include "host_driver.h"
1013-#include <stdbool.h>
1014-
1015-void           init_serial_link(void);
1016-void           init_serial_link_hal(void);
1017-bool           is_serial_link_connected(void);
1018-bool           is_serial_link_master(void);
1019-host_driver_t* get_serial_link_driver(void);
1020-void           serial_link_update(void);
1021-
1022-#if defined(PROTOCOL_CHIBIOS)
1023-#    include <ch.h>
1024-
1025-static inline void serial_link_lock(void) { chSysLock(); }
1026-
1027-static inline void serial_link_unlock(void) { chSysUnlock(); }
1028-
1029-void signal_data_written(void);
1030-
1031-#else
1032-
1033-inline void serial_link_lock(void) {}
1034-
1035-inline void serial_link_unlock(void) {}
1036-
1037-void signal_data_written(void);
1038-
1039-#endif
1040diff --git a/quantum/serial_link/tests/Makefile b/quantum/serial_link/tests/Makefile
1041deleted file mode 100644
1042index 11dd355b227ce468e3b95fd47239e1b2bc36aec5..0000000000000000000000000000000000000000
1043--- a/quantum/serial_link/tests/Makefile
1044+++ /dev/null
1045@@ -1,61 +0,0 @@
1046-# The MIT License (MIT)
1047-#
1048-# Copyright (c) 2016 Fred Sundvik
1049-#
1050-# Permission is hereby granted, free of charge, to any person obtaining a copy
1051-# of this software and associated documentation files (the "Software"), to deal
1052-# in the Software without restriction, including without limitation the rights
1053-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1054-# copies of the Software, and to permit persons to whom the Software is
1055-# furnished to do so, subject to the following conditions:
1056-#
1057-# The above copyright notice and this permission notice shall be included in all
1058-# copies or substantial portions of the Software.
1059-#
1060-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1061-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1062-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1063-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1064-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1065-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1066-# SOFTWARE.
1067-
1068-CC = gcc
1069-CFLAGS	=
1070-INCLUDES = -I. -I../../
1071-LDFLAGS = -L$(BUILDDIR)/cgreen/build-c/src -shared
1072-LDLIBS = -lcgreen
1073-UNITOBJ = $(BUILDDIR)/serialtest/unitobj
1074-DEPDIR = $(BUILDDIR)/serialtest/unit.d
1075-UNITTESTS = $(BUILDDIR)/serialtest/unittests
1076-DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td
1077-EXT = .so
1078-UNAME := $(shell uname)
1079-ifneq (, $(findstring MINGW, $(UNAME)))
1080-	EXT = .dll
1081-endif
1082-ifneq (, $(findstring CYGWIN, $(UNAME)))
1083-	EXT = .dll
1084-endif
1085-
1086-SRC = $(wildcard *.c)
1087-TESTFILES = $(patsubst %.c, $(UNITTESTS)/%$(EXT), $(SRC))
1088-$(shell mkdir -p $(DEPDIR) >/dev/null)
1089-
1090-test: $(TESTFILES)
1091-	@$(BUILDDIR)/cgreen/build-c/tools/cgreen-runner --color $(TESTFILES)
1092-
1093-$(UNITTESTS)/%$(EXT): $(UNITOBJ)/%.o
1094-	@mkdir -p $(UNITTESTS)
1095-	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
1096-
1097-$(UNITOBJ)/%.o : %.c
1098-$(UNITOBJ)/%.o: %.c $(DEPDIR)/%.d
1099-	@mkdir -p $(UNITOBJ)
1100-	$(CC) $(CFLAGS) $(DEPFLAGS) $(INCLUDES) -c $< -o $@
1101-	@mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d
1102-
1103-$(DEPDIR)/%.d: ;
1104-.PRECIOUS: $(DEPDIR)/%.d
1105-
1106--include $(patsubst %,$(DEPDIR)/%.d,$(basename $(SRC)))
1107diff --git a/quantum/serial_link/tests/byte_stuffer_tests.cpp b/quantum/serial_link/tests/byte_stuffer_tests.cpp
1108deleted file mode 100644
1109index 9e4e1768f4f264714e1f5bb46b78137c04f1f764..0000000000000000000000000000000000000000
1110--- a/quantum/serial_link/tests/byte_stuffer_tests.cpp
1111+++ /dev/null
1112@@ -1,450 +0,0 @@
1113-/*
1114-The MIT License (MIT)
1115-
1116-Copyright (c) 2016 Fred Sundvik
1117-
1118-Permission is hereby granted, free of charge, to any person obtaining a copy
1119-of this software and associated documentation files (the "Software"), to deal
1120-in the Software without restriction, including without limitation the rights
1121-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1122-copies of the Software, and to permit persons to whom the Software is
1123-furnished to do so, subject to the following conditions:
1124-
1125-The above copyright notice and this permission notice shall be included in all
1126-copies or substantial portions of the Software.
1127-
1128-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1129-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1130-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1131-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1132-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1133-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1134-SOFTWARE.
1135-*/
1136-
1137-#include "gtest/gtest.h"
1138-#include "gmock/gmock.h"
1139-#include <vector>
1140-#include <algorithm>
1141-extern "C" {
1142-#include "serial_link/protocol/byte_stuffer.h"
1143-#include "serial_link/protocol/frame_validator.h"
1144-#include "serial_link/protocol/physical.h"
1145-}
1146-
1147-using testing::_;
1148-using testing::Args;
1149-using testing::ElementsAreArray;
1150-
1151-class ByteStuffer : public ::testing::Test {
1152-   public:
1153-    ByteStuffer() {
1154-        Instance = this;
1155-        init_byte_stuffer();
1156-    }
1157-
1158-    ~ByteStuffer() { Instance = nullptr; }
1159-
1160-    MOCK_METHOD3(validator_recv_frame, void(uint8_t link, uint8_t* data, uint16_t size));
1161-
1162-    void                 send_data(uint8_t link, const uint8_t* data, uint16_t size) { std::copy(data, data + size, std::back_inserter(sent_data)); }
1163-    std::vector<uint8_t> sent_data;
1164-
1165-    static ByteStuffer* Instance;
1166-};
1167-
1168-ByteStuffer* ByteStuffer::Instance = nullptr;
1169-
1170-extern "C" {
1171-void validator_recv_frame(uint8_t link, uint8_t* data, uint16_t size) { ByteStuffer::Instance->validator_recv_frame(link, data, size); }
1172-
1173-void send_data(uint8_t link, const uint8_t* data, uint16_t size) { ByteStuffer::Instance->send_data(link, data, size); }
1174-}
1175-
1176-TEST_F(ByteStuffer, receives_no_frame_for_a_single_zero_byte) {
1177-    EXPECT_CALL(*this, validator_recv_frame(_, _, _)).Times(0);
1178-    byte_stuffer_recv_byte(0, 0);
1179-}
1180-
1181-TEST_F(ByteStuffer, receives_no_frame_for_a_single_FF_byte) {
1182-    EXPECT_CALL(*this, validator_recv_frame(_, _, _)).Times(0);
1183-    byte_stuffer_recv_byte(0, 0xFF);
1184-}
1185-
1186-TEST_F(ByteStuffer, receives_no_frame_for_a_single_random_byte) {
1187-    EXPECT_CALL(*this, validator_recv_frame(_, _, _)).Times(0);
1188-    byte_stuffer_recv_byte(0, 0x4A);
1189-}
1190-
1191-TEST_F(ByteStuffer, receives_no_frame_for_a_zero_length_frame) {
1192-    EXPECT_CALL(*this, validator_recv_frame(_, _, _)).Times(0);
1193-    byte_stuffer_recv_byte(0, 1);
1194-    byte_stuffer_recv_byte(0, 0);
1195-}
1196-
1197-TEST_F(ByteStuffer, receives_single_byte_valid_frame) {
1198-    uint8_t expected[] = {0x37};
1199-    EXPECT_CALL(*this, validator_recv_frame(_, _, _)).With(Args<1, 2>(ElementsAreArray(expected)));
1200-    byte_stuffer_recv_byte(0, 2);
1201-    byte_stuffer_recv_byte(0, 0x37);
1202-    byte_stuffer_recv_byte(0, 0);
1203-}
1204-TEST_F(ByteStuffer, receives_three_bytes_valid_frame) {
1205-    uint8_t expected[] = {0x37, 0x99, 0xFF};
1206-    EXPECT_CALL(*this, validator_recv_frame(_, _, _)).With(Args<1, 2>(ElementsAreArray(expected)));
1207-    byte_stuffer_recv_byte(0, 4);
1208-    byte_stuffer_recv_byte(0, 0x37);
1209-    byte_stuffer_recv_byte(0, 0x99);
1210-    byte_stuffer_recv_byte(0, 0xFF);
1211-    byte_stuffer_recv_byte(0, 0);
1212diff --git a/quantum/serial_link/tests/frame_router_tests.cpp b/quantum/serial_link/tests/frame_router_tests.cpp
1213deleted file mode 100644
1214index f76dfb33d6e9992c64697bf16eb1db9e1197e870..0000000000000000000000000000000000000000
1215--- a/quantum/serial_link/tests/frame_router_tests.cpp
1216+++ /dev/null
1217@@ -1,204 +0,0 @@
1218-/*
1219-The MIT License (MIT)
1220-
1221-Copyright (c) 2016 Fred Sundvik
1222-
1223-Permission is hereby granted, free of charge, to any person obtaining a copy
1224-of this software and associated documentation files (the "Software"), to deal
1225-in the Software without restriction, including without limitation the rights
1226-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1227-copies of the Software, and to permit persons to whom the Software is
1228-furnished to do so, subject to the following conditions:
1229-
1230-The above copyright notice and this permission notice shall be included in all
1231-copies or substantial portions of the Software.
1232-
1233-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1234-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1235-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1236-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1237-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1238-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1239-SOFTWARE.
1240-*/
1241-
1242-#include "gtest/gtest.h"
1243-#include "gmock/gmock.h"
1244-#include <array>
1245-extern "C" {
1246-#include "serial_link/protocol/transport.h"
1247-#include "serial_link/protocol/byte_stuffer.h"
1248-#include "serial_link/protocol/frame_router.h"
1249-}
1250-
1251-using testing::_;
1252-using testing::Args;
1253-using testing::ElementsAreArray;
1254-
1255-class FrameRouter : public testing::Test {
1256-   public:
1257-    FrameRouter() : current_router_buffer(nullptr) {
1258-        Instance = this;
1259-        init_byte_stuffer();
1260-    }
1261-
1262-    ~FrameRouter() { Instance = nullptr; }
1263-
1264-    void send_data(uint8_t link, const uint8_t* data, uint16_t size) {
1265-        auto& buffer = current_router_buffer->send_buffers[link];
1266-        std::copy(data, data + size, std::back_inserter(buffer));
1267-    }
1268-
1269-    void receive_data(uint8_t link, uint8_t* data, uint16_t size) {
1270-        int i;
1271-        for (i = 0; i < size; i++) {
1272-            byte_stuffer_recv_byte(link, data[i]);
1273-        }
1274-    }
1275-
1276-    void activate_router(uint8_t num) {
1277-        current_router_buffer = router_buffers + num;
1278-        router_set_master(num == 0);
1279-    }
1280-
1281-    void simulate_transport(uint8_t from, uint8_t to) {
1282-        activate_router(to);
1283-        if (from > to) {
1284-            receive_data(DOWN_LINK, router_buffers[from].send_buffers[UP_LINK].data(), router_buffers[from].send_buffers[UP_LINK].size());
1285-        } else if (to > from) {
1286-            receive_data(UP_LINK, router_buffers[from].send_buffers[DOWN_LINK].data(), router_buffers[from].send_buffers[DOWN_LINK].size());
1287-        }
1288-    }
1289-
1290-    MOCK_METHOD3(transport_recv_frame, void(uint8_t from, uint8_t* data, uint16_t size));
1291-
1292-    std::vector<uint8_t> received_data;
1293-
1294-    struct router_buffer {
1295-        std::vector<uint8_t> send_buffers[2];
1296-    };
1297-
1298-    router_buffer  router_buffers[8];
1299-    router_buffer* current_router_buffer;
1300-
1301-    static FrameRouter* Instance;
1302-};
1303-
1304-FrameRouter* FrameRouter::Instance = nullptr;
1305-
1306-typedef struct {
1307-    std::array<uint8_t, 4> data;
1308-    uint8_t                extra[16];
1309-} frame_buffer_t;
1310-
1311-extern "C" {
1312-void send_data(uint8_t link, const uint8_t* data, uint16_t size) { FrameRouter::Instance->send_data(link, data, size); }
1313-
1314-void transport_recv_frame(uint8_t from, uint8_t* data, uint16_t size) { FrameRouter::Instance->transport_recv_frame(from, data, size); }
1315-}
1316-
1317diff --git a/quantum/serial_link/tests/frame_validator_tests.cpp b/quantum/serial_link/tests/frame_validator_tests.cpp
1318deleted file mode 100644
1319index 43dc57b6330e4afd4319811d48cc801eac003c3f..0000000000000000000000000000000000000000
1320--- a/quantum/serial_link/tests/frame_validator_tests.cpp
1321+++ /dev/null
1322@@ -1,100 +0,0 @@
1323-/*
1324-The MIT License (MIT)
1325-
1326-Copyright (c) 2016 Fred Sundvik
1327-
1328-Permission is hereby granted, free of charge, to any person obtaining a copy
1329-of this software and associated documentation files (the "Software"), to deal
1330-in the Software without restriction, including without limitation the rights
1331-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1332-copies of the Software, and to permit persons to whom the Software is
1333-furnished to do so, subject to the following conditions:
1334-
1335-The above copyright notice and this permission notice shall be included in all
1336-copies or substantial portions of the Software.
1337-
1338-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1339-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1340-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1341-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1342-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1343-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1344-SOFTWARE.
1345-*/
1346-
1347-#include "gtest/gtest.h"
1348-#include "gmock/gmock.h"
1349-extern "C" {
1350-#include "serial_link/protocol/frame_validator.h"
1351-}
1352-
1353-using testing::_;
1354-using testing::Args;
1355-using testing::ElementsAreArray;
1356-
1357-class FrameValidator : public testing::Test {
1358-   public:
1359-    FrameValidator() { Instance = this; }
1360-
1361-    ~FrameValidator() { Instance = nullptr; }
1362-
1363-    MOCK_METHOD3(route_incoming_frame, void(uint8_t link, uint8_t* data, uint16_t size));
1364-    MOCK_METHOD3(byte_stuffer_send_frame, void(uint8_t link, uint8_t* data, uint16_t size));
1365-
1366-    static FrameValidator* Instance;
1367-};
1368-
1369-FrameValidator* FrameValidator::Instance = nullptr;
1370-
1371-extern "C" {
1372-void route_incoming_frame(uint8_t link, uint8_t* data, uint16_t size) { FrameValidator::Instance->route_incoming_frame(link, data, size); }
1373-
1374-void byte_stuffer_send_frame(uint8_t link, uint8_t* data, uint16_t size) { FrameValidator::Instance->byte_stuffer_send_frame(link, data, size); }
1375-}
1376-
1377-TEST_F(FrameValidator, doesnt_validate_frames_under_5_bytes) {
1378-    EXPECT_CALL(*this, route_incoming_frame(_, _, _)).Times(0);
1379-    uint8_t data[] = {1, 2};
1380-    validator_recv_frame(0, 0, 1);
1381-    validator_recv_frame(0, data, 2);
1382-    validator_recv_frame(0, data, 3);
1383-    validator_recv_frame(0, data, 4);
1384-}
1385-
1386-TEST_F(FrameValidator, validates_one_byte_frame_with_correct_crc) {
1387-    uint8_t data[] = {0x44, 0x04, 0x6A, 0xB3, 0xA3};
1388-    EXPECT_CALL(*this, route_incoming_frame(_, _, _)).With(Args<1, 2>(ElementsAreArray(data, 1)));
1389-    validator_recv_frame(0, data, 5);
1390-}
1391-
1392-TEST_F(FrameValidator, does_not_validate_one_byte_frame_with_incorrect_crc) {
1393-    uint8_t data[] = {0x44, 0, 0, 0, 0};
1394-    EXPECT_CALL(*this, route_incoming_frame(_, _, _)).Times(0);
1395-    validator_recv_frame(1, data, 5);
1396-}
1397-
1398-TEST_F(FrameValidator, validates_four_byte_frame_with_correct_crc) {
1399-    uint8_t data[] = {0x44, 0x10, 0xFF, 0x00, 0x74, 0x4E, 0x30, 0xBA};
1400-    EXPECT_CALL(*this, route_incoming_frame(_, _, _)).With(Args<1, 2>(ElementsAreArray(data, 4)));
1401-    validator_recv_frame(1, data, 8);
1402-}
1403-
1404-TEST_F(FrameValidator, validates_five_byte_frame_with_correct_crc) {
1405-    uint8_t data[] = {1, 2, 3, 4, 5, 0xF4, 0x99, 0x0B, 0x47};
1406-    EXPECT_CALL(*this, route_incoming_frame(_, _, _)).With(Args<1, 2>(ElementsAreArray(data, 5)));
1407-    validator_recv_frame(0, data, 9);
1408-}
1409-
1410-TEST_F(FrameValidator, sends_one_byte_with_correct_crc) {
1411-    uint8_t original[] = {0x44, 0, 0, 0, 0};
1412-    uint8_t expected[] = {0x44, 0x04, 0x6A, 0xB3, 0xA3};
1413-    EXPECT_CALL(*this, byte_stuffer_send_frame(_, _, _)).With(Args<1, 2>(ElementsAreArray(expected)));
1414-    validator_send_frame(0, original, 1);
1415-}
1416-
1417-TEST_F(FrameValidator, sends_five_bytes_with_correct_crc) {
1418-    uint8_t original[] = {1, 2, 3, 4, 5, 0, 0, 0, 0};
1419-    uint8_t expected[] = {1, 2, 3, 4, 5, 0xF4, 0x99, 0x0B, 0x47};
1420-    EXPECT_CALL(*this, byte_stuffer_send_frame(_, _, _)).With(Args<1, 2>(ElementsAreArray(expected)));
1421-    validator_send_frame(0, original, 5);
1422diff --git a/quantum/serial_link/tests/rules.mk b/quantum/serial_link/tests/rules.mk
1423deleted file mode 100644
1424index b81515bc55eab88ddb27c3adbd42bd91c4ed14d1..0000000000000000000000000000000000000000
1425--- a/quantum/serial_link/tests/rules.mk
1426+++ /dev/null
1427@@ -1,22 +0,0 @@
1428-serial_link_byte_stuffer_SRC :=\
1429-	$(SERIAL_PATH)/tests/byte_stuffer_tests.cpp \
1430-	$(SERIAL_PATH)/protocol/byte_stuffer.c
1431-
1432-serial_link_frame_validator_SRC := \
1433-	$(SERIAL_PATH)/tests/frame_validator_tests.cpp \
1434-	$(SERIAL_PATH)/protocol/frame_validator.c 
1435-
1436-serial_link_frame_router_SRC := \
1437-	$(SERIAL_PATH)/tests/frame_router_tests.cpp \
1438-	$(SERIAL_PATH)/protocol/byte_stuffer.c \
1439-	$(SERIAL_PATH)/protocol/frame_validator.c \
1440-	$(SERIAL_PATH)/protocol/frame_router.c
1441-
1442-serial_link_triple_buffered_object_SRC := \
1443-	$(SERIAL_PATH)/tests/triple_buffered_object_tests.cpp \
1444-	$(SERIAL_PATH)/protocol/triple_buffered_object.c 
1445-
1446-serial_link_transport_SRC := \
1447-	$(SERIAL_PATH)/tests/transport_tests.cpp \
1448-	$(SERIAL_PATH)/protocol/transport.c \
1449-	$(SERIAL_PATH)/protocol/triple_buffered_object.c 
1450diff --git a/quantum/serial_link/tests/testlist.mk b/quantum/serial_link/tests/testlist.mk
1451deleted file mode 100644
1452index c5edaf478f53da62c05c84d733d90b0d7320c61c..0000000000000000000000000000000000000000
1453--- a/quantum/serial_link/tests/testlist.mk
1454+++ /dev/null
1455@@ -1,6 +0,0 @@
1456-TEST_LIST +=\
1457-	serial_link_byte_stuffer\
1458-	serial_link_frame_validator\
1459-	serial_link_frame_router\
1460-	serial_link_triple_buffered_object\
1461-	serial_link_transport
1462diff --git a/quantum/serial_link/tests/transport_tests.cpp b/quantum/serial_link/tests/transport_tests.cpp
1463deleted file mode 100644
1464index cfd11104609bb97661a0120792c5bcf554ec3978..0000000000000000000000000000000000000000
1465--- a/quantum/serial_link/tests/transport_tests.cpp
1466+++ /dev/null
1467@@ -1,184 +0,0 @@
1468-/*
1469-The MIT License (MIT)
1470-
1471-Copyright (c) 2016 Fred Sundvik
1472-
1473-Permission is hereby granted, free of charge, to any person obtaining a copy
1474-of this software and associated documentation files (the "Software"), to deal
1475-in the Software without restriction, including without limitation the rights
1476-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1477-copies of the Software, and to permit persons to whom the Software is
1478-furnished to do so, subject to the following conditions:
1479-
1480-The above copyright notice and this permission notice shall be included in all
1481-copies or substantial portions of the Software.
1482-
1483-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1484-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1485-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1486-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1487-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1488-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1489-SOFTWARE.
1490-*/
1491-
1492-#include "gtest/gtest.h"
1493-#include "gmock/gmock.h"
1494-
1495-using testing::_;
1496-using testing::Args;
1497-using testing::ElementsAreArray;
1498-
1499-extern "C" {
1500-#include "serial_link/protocol/transport.h"
1501-}
1502-
1503-struct test_object1 {
1504-    uint32_t test;
1505-};
1506-
1507-struct test_object2 {
1508-    uint32_t test1;
1509-    uint32_t test2;
1510-};
1511-
1512-MASTER_TO_ALL_SLAVES_OBJECT(master_to_slave, test_object1);
1513-MASTER_TO_SINGLE_SLAVE_OBJECT(master_to_single_slave, test_object1);
1514-SLAVE_TO_MASTER_OBJECT(slave_to_master, test_object1);
1515-
1516-static remote_object_t* test_remote_objects[] = {
1517-    REMOTE_OBJECT(master_to_slave),
1518-    REMOTE_OBJECT(master_to_single_slave),
1519-    REMOTE_OBJECT(slave_to_master),
1520-};
1521-
1522-class Transport : public testing::Test {
1523-   public:
1524-    Transport() {
1525-        Instance = this;
1526-        add_remote_objects(test_remote_objects, sizeof(test_remote_objects) / sizeof(remote_object_t*));
1527-    }
1528-
1529-    ~Transport() {
1530-        Instance = nullptr;
1531-        reinitialize_serial_link_transport();
1532-    }
1533-
1534-    MOCK_METHOD0(signal_data_written, void());
1535-    MOCK_METHOD1(router_send_frame, void(uint8_t destination));
1536-
1537-    void router_send_frame(uint8_t destination, uint8_t* data, uint16_t size) {
1538-        router_send_frame(destination);
1539-        std::copy(data, data + size, std::back_inserter(sent_data));
1540-    }
1541-
1542-    static Transport* Instance;
1543-
1544-    std::vector<uint8_t> sent_data;
1545-};
1546-
1547-Transport* Transport::Instance = nullptr;
1548-
1549-extern "C" {
1550-void signal_data_written(void) { Transport::Instance->signal_data_written(); }
1551-
1552-void router_send_frame(uint8_t destination, uint8_t* data, uint16_t size) { Transport::Instance->router_send_frame(destination, data, size); }
1553-}
1554-
1555-TEST_F(Transport, write_to_local_signals_an_event) {
1556-    begin_write_master_to_slave();
1557-    EXPECT_CALL(*this, signal_data_written());
1558-    end_write_master_to_slave();
1559-    begin_write_slave_to_master();
1560-    EXPECT_CALL(*this, signal_data_written());
1561-    end_write_slave_to_master();
1562-    begin_write_master_to_single_slave(1);
1563-    EXPECT_CALL(*this, signal_data_written());
1564-    end_write_master_to_single_slave(1);
1565-}
1566-
1567diff --git a/quantum/serial_link/tests/triple_buffered_object_tests.cpp b/quantum/serial_link/tests/triple_buffered_object_tests.cpp
1568deleted file mode 100644
1569index 8de9bfdebf3c2ff32e9dbfb2e59fdadc61e41aed..0000000000000000000000000000000000000000
1570--- a/quantum/serial_link/tests/triple_buffered_object_tests.cpp
1571+++ /dev/null
1572@@ -1,80 +0,0 @@
1573-/*
1574-The MIT License (MIT)
1575-
1576-Copyright (c) 2016 Fred Sundvik
1577-
1578-Permission is hereby granted, free of charge, to any person obtaining a copy
1579-of this software and associated documentation files (the "Software"), to deal
1580-in the Software without restriction, including without limitation the rights
1581-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1582-copies of the Software, and to permit persons to whom the Software is
1583-furnished to do so, subject to the following conditions:
1584-
1585-The above copyright notice and this permission notice shall be included in all
1586-copies or substantial portions of the Software.
1587-
1588-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1589-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1590-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1591-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1592-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1593-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1594-SOFTWARE.
1595-*/
1596-
1597-#include "gtest/gtest.h"
1598-extern "C" {
1599-#include "serial_link/protocol/triple_buffered_object.h"
1600-}
1601-
1602-struct test_object {
1603-    uint8_t  state;
1604-    uint32_t buffer[3];
1605-};
1606-
1607-test_object test_object;
1608-
1609-class TripleBufferedObject : public testing::Test {
1610-   public:
1611-    TripleBufferedObject() { triple_buffer_init((triple_buffer_object_t*)&test_object); }
1612-};
1613-
1614-TEST_F(TripleBufferedObject, writes_and_reads_object) {
1615-    *triple_buffer_begin_write(&test_object) = 0x3456ABCC;
1616-    triple_buffer_end_write(&test_object);
1617-    EXPECT_EQ(*triple_buffer_read(&test_object), 0x3456ABCC);
1618-}
1619-
1620-TEST_F(TripleBufferedObject, does_not_read_empty) { EXPECT_EQ(triple_buffer_read(&test_object), nullptr); }
1621-
1622-TEST_F(TripleBufferedObject, writes_twice_and_reads_object) {
1623-    *triple_buffer_begin_write(&test_object) = 0x3456ABCC;
1624-    triple_buffer_end_write(&test_object);
1625-    *triple_buffer_begin_write(&test_object) = 0x44778899;
1626-    triple_buffer_end_write(&test_object);
1627-    EXPECT_EQ(*triple_buffer_read(&test_object), 0x44778899);
1628-}
1629-
1630-TEST_F(TripleBufferedObject, performs_another_write_in_the_middle_of_read) {
1631-    *triple_buffer_begin_write(&test_object) = 1;
1632-    triple_buffer_end_write(&test_object);
1633-    uint32_t* read                           = triple_buffer_read(&test_object);
1634-    *triple_buffer_begin_write(&test_object) = 2;
1635-    triple_buffer_end_write(&test_object);
1636-    EXPECT_EQ(*read, 1);
1637-    EXPECT_EQ(*triple_buffer_read(&test_object), 2);
1638-    EXPECT_EQ(triple_buffer_read(&test_object), nullptr);
1639-}
1640-
1641-TEST_F(TripleBufferedObject, performs_two_writes_in_the_middle_of_read) {
1642-    *triple_buffer_begin_write(&test_object) = 1;
1643-    triple_buffer_end_write(&test_object);
1644-    uint32_t* read                           = triple_buffer_read(&test_object);
1645-    *triple_buffer_begin_write(&test_object) = 2;
1646-    triple_buffer_end_write(&test_object);
1647-    *triple_buffer_begin_write(&test_object) = 3;
1648-    triple_buffer_end_write(&test_object);
1649-    EXPECT_EQ(*read, 1);
1650-    EXPECT_EQ(*triple_buffer_read(&test_object), 3);
1651-    EXPECT_EQ(triple_buffer_read(&test_object), nullptr);
1652-}
1653diff --git a/show_options.mk b/show_options.mk
1654index 03008ccabf1f2a11b546cdf0256b09b7773edf76..0831069635fa2f6f8286149460f3aad10d4d89e1 100644
1655--- a/show_options.mk
1656+++ b/show_options.mk
1657@@ -21,7 +21,6 @@ HARDWARE_OPTION_NAMES = \
1658   RGBLIGHT_CUSTOM_DRIVER \
1659   RGB_MATRIX_ENABLE \
1660   RGB_MATRIX_DRIVER \
1661-  SERIAL_LINK_ENABLE \
1662   CIE1931_CURVE \
1663   MIDI_ENABLE \
1664   BLUETOOTH_ENABLE \
1665diff --git a/testlist.mk b/testlist.mk
1666index b66b93d29567c67d0c1ab8e9cbb1543635007939..364fb339c60ceb7c4f9769765f274d9adb21bc20 100644
1667--- a/testlist.mk
1668+++ b/testlist.mk
1669@@ -3,7 +3,6 @@ FULL_TESTS := $(TEST_LIST)
1670 
1671 include $(ROOT_DIR)/quantum/debounce/tests/testlist.mk
1672 include $(ROOT_DIR)/quantum/sequencer/tests/testlist.mk
1673-include $(ROOT_DIR)/quantum/serial_link/tests/testlist.mk
1674 include $(ROOT_DIR)/tmk_core/common/test/testlist.mk
1675 
1676 define VALIDATE_TEST_LIST
1677diff --git a/tmk_core/common/sync_timer.c b/tmk_core/common/sync_timer.c
1678index 68b92d8b439c175be96660cdd801bfb0d3e487d6..de24b463b6b74cf6ba9e8e04e8702444d32110d0 100644
1679--- a/tmk_core/common/sync_timer.c
1680+++ b/tmk_core/common/sync_timer.c
1681@@ -26,7 +26,7 @@ SOFTWARE.
1682 #include "sync_timer.h"
1683 #include "keyboard.h"
1684 
1685-#if (defined(SPLIT_KEYBOARD) || defined(SERIAL_LINK_ENABLE)) && !defined(DISABLE_SYNC_TIMER)
1686+#if defined(SPLIT_KEYBOARD) && !defined(DISABLE_SYNC_TIMER)
1687 volatile int32_t sync_timer_ms;
1688 
1689 void sync_timer_init(void) { sync_timer_ms = 0; }
1690diff --git a/tmk_core/common/sync_timer.h b/tmk_core/common/sync_timer.h
1691index 744e2b50d5452609554ee09694b07b7f8c826db7..9ddef45bb263e39b1bf322c436359206b3f2a723 100644
1692--- a/tmk_core/common/sync_timer.h
1693+++ b/tmk_core/common/sync_timer.h
1694@@ -32,7 +32,7 @@ SOFTWARE.
1695 extern "C" {
1696 #endif
1697 
1698-#if (defined(SPLIT_KEYBOARD) || defined(SERIAL_LINK_ENABLE)) && !defined(DISABLE_SYNC_TIMER)
1699+#if defined(SPLIT_KEYBOARD) && !defined(DISABLE_SYNC_TIMER)
1700 void     sync_timer_init(void);
1701 void     sync_timer_update(uint32_t time);
1702 uint16_t sync_timer_read(void);
1703diff --git a/tmk_core/protocol/chibios/chibios.c b/tmk_core/protocol/chibios/chibios.c
1704index 26181d8c76aecb43901d4f5af33330eb00a4d0aa..c860328c807eba0d45e316d5c7a86dc734c61775 100644
1705--- a/tmk_core/protocol/chibios/chibios.c
1706+++ b/tmk_core/protocol/chibios/chibios.c
1707@@ -43,9 +43,6 @@
1708 #ifdef SLEEP_LED_ENABLE
1709 #    include "sleep_led.h"
1710 #endif
1711-#ifdef SERIAL_LINK_ENABLE
1712-#    include "serial_link/system/serial_link.h"
1713-#endif
1714 #ifdef MIDI_ENABLE
1715 #    include "qmk_midi.h"
1716 #endif
1717@@ -154,15 +151,11 @@ void protocol_init(void) {
1718     setup_midi();
1719 #endif
1720 
1721-#ifdef SERIAL_LINK_ENABLE
1722-    init_serial_link();
1723-#endif
1724-
1725     host_driver_t *driver = NULL;
1726 
1727-    /* Wait until the USB or serial link is active */
1728+    /* Wait until USB is active */
1729     while (true) {
1730-#if defined(WAIT_FOR_USB) || defined(SERIAL_LINK_ENABLE)
1731+#if defined(WAIT_FOR_USB)
1732         if (USB_DRIVER.state == USB_ACTIVE) {
1733             driver = &chibios_driver;
1734             break;
1735@@ -170,13 +163,6 @@ void protocol_init(void) {
1736 #else
1737         driver = &chibios_driver;
1738         break;
1739-#endif
1740-#ifdef SERIAL_LINK_ENABLE
1741-        if (is_serial_link_connected()) {
1742-            driver = get_serial_link_driver();
1743-            break;
1744-        }
1745-        serial_link_update();
1746 #endif
1747         wait_ms(50);
1748     }
1749@@ -209,9 +195,6 @@ void protocol_task(void) {
1750         print("[s]");
1751         while (USB_DRIVER.state == USB_SUSPENDED) {
1752             /* Do this in the suspended state */
1753-#    ifdef SERIAL_LINK_ENABLE
1754-            serial_link_update();
1755-#    endif
1756             suspend_power_down();  // on AVR this deep sleeps for 15ms
1757             /* Remote wakeup */
1758             if (suspend_wakeup_condition()) {