summaryrefslogtreecommitdiff
path: root/platforms
diff options
context:
space:
mode:
authorStefan Kerkmann <karlk90@pm.me>2023-01-12 11:47:36 +0100
committerGitHub <noreply@github.com>2023-01-12 21:47:36 +1100
commitec0908754389017d723e2f656827381e93d8bd8a (patch)
tree94b93b209568d70903207b6f5d71136a3054c656 /platforms
parent81513ab5f59cfc00233972162b86b40096f0e481 (diff)
Update ChibiOS[-Contrib], SIO driver, configs (#17915)
Co-authored-by: Nick Brassel <nick@tzarc.org>
Diffstat (limited to 'platforms')
-rw-r--r--platforms/chibios/boards/BONSAI_C4/configs/mcuconf.h5
-rw-r--r--platforms/chibios/boards/QMK_PROTON_C/configs/halconf.h21
-rw-r--r--platforms/chibios/boards/common/configs/halconf.h21
-rw-r--r--platforms/chibios/drivers/serial_usart.c24
4 files changed, 35 insertions, 36 deletions
diff --git a/platforms/chibios/boards/BONSAI_C4/configs/mcuconf.h b/platforms/chibios/boards/BONSAI_C4/configs/mcuconf.h
index 2f9e627c7e..b381aed4fd 100644
--- a/platforms/chibios/boards/BONSAI_C4/configs/mcuconf.h
+++ b/platforms/chibios/boards/BONSAI_C4/configs/mcuconf.h
@@ -1,9 +1,12 @@
/*
ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
+
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
+
http://www.apache.org/licenses/LICENSE-2.0
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -246,4 +249,4 @@
*/
#define STM32_WDG_USE_IWDG FALSE
-#endif /* MCUCONF_H */ \ No newline at end of file
+#endif /* MCUCONF_H */
diff --git a/platforms/chibios/boards/QMK_PROTON_C/configs/halconf.h b/platforms/chibios/boards/QMK_PROTON_C/configs/halconf.h
index 8367328a04..4a22e818e2 100644
--- a/platforms/chibios/boards/QMK_PROTON_C/configs/halconf.h
+++ b/platforms/chibios/boards/QMK_PROTON_C/configs/halconf.h
@@ -29,7 +29,7 @@
#define HALCONF_H
#define _CHIBIOS_HAL_CONF_
-#define _CHIBIOS_HAL_CONF_VER_8_0_
+#define _CHIBIOS_HAL_CONF_VER_8_4_
#include <mcuconf.h>
@@ -335,15 +335,18 @@
/*===========================================================================*/
/**
- * @brief Delays insertions.
- * @details If enabled this options inserts delays into the MMC waiting
- * routines releasing some extra CPU time for the threads with
- * lower priority, this may slow down the driver a bit however.
- * This option is recommended also if the SPI driver does not
- * use a DMA channel and heavily loads the CPU.
+ * @brief Timeout before assuming a failure while waiting for card idle.
+ * @note Time is in milliseconds.
+ */
+#if !defined(MMC_IDLE_TIMEOUT_MS) || defined(__DOXYGEN__)
+#define MMC_IDLE_TIMEOUT_MS 1000
+#endif
+
+/**
+ * @brief Mutual exclusion on the SPI bus.
*/
-#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
-#define MMC_NICE_WAITING TRUE
+#if !defined(MMC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define MMC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/
diff --git a/platforms/chibios/boards/common/configs/halconf.h b/platforms/chibios/boards/common/configs/halconf.h
index 1805a77438..b0ccbc1f2f 100644
--- a/platforms/chibios/boards/common/configs/halconf.h
+++ b/platforms/chibios/boards/common/configs/halconf.h
@@ -29,7 +29,7 @@
#define HALCONF_H
#define _CHIBIOS_HAL_CONF_
-#define _CHIBIOS_HAL_CONF_VER_8_0_
+#define _CHIBIOS_HAL_CONF_VER_8_4_
#include <mcuconf.h>
@@ -335,15 +335,18 @@
/*===========================================================================*/
/**
- * @brief Delays insertions.
- * @details If enabled this options inserts delays into the MMC waiting
- * routines releasing some extra CPU time for the threads with
- * lower priority, this may slow down the driver a bit however.
- * This option is recommended also if the SPI driver does not
- * use a DMA channel and heavily loads the CPU.
+ * @brief Timeout before assuming a failure while waiting for card idle.
+ * @note Time is in milliseconds.
+ */
+#if !defined(MMC_IDLE_TIMEOUT_MS) || defined(__DOXYGEN__)
+#define MMC_IDLE_TIMEOUT_MS 1000
+#endif
+
+/**
+ * @brief Mutual exclusion on the SPI bus.
*/
-#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
-#define MMC_NICE_WAITING TRUE
+#if !defined(MMC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define MMC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/
diff --git a/platforms/chibios/drivers/serial_usart.c b/platforms/chibios/drivers/serial_usart.c
index 6581a5b6e9..6ebbf7c8ca 100644
--- a/platforms/chibios/drivers/serial_usart.c
+++ b/platforms/chibios/drivers/serial_usart.c
@@ -72,27 +72,17 @@ inline void serial_transport_driver_clear(void) {
#elif HAL_USE_SIO
-void clear_rx_evt_cb(SIODriver* siop) {
- osalSysLockFromISR();
- /* If errors occured during transactions this callback is invoked. We just
- * clear the error sources and move on. We rely on the fact that we check
- * for the success of the transaction by comparing the received/send bytes
- * with the actual received/send bytes in the send/receive functions. */
- sioGetAndClearEventsI(serial_driver);
- osalSysUnlockFromISR();
-}
-
-static const SIOOperation serial_usart_operation = {.rx_cb = NULL, .rx_idle_cb = NULL, .tx_cb = NULL, .tx_end_cb = NULL, .rx_evt_cb = &clear_rx_evt_cb};
-
/**
* @brief SIO Driver startup routine.
*/
static inline void usart_driver_start(void) {
sioStart(serial_driver, &serial_config);
- sioStartOperation(serial_driver, &serial_usart_operation);
}
inline void serial_transport_driver_clear(void) {
+ if (sioHasRXErrorsX(serial_driver)) {
+ sioGetAndClearErrors(serial_driver);
+ }
osalSysLock();
while (!sioIsRXEmptyX(serial_driver)) {
(void)sioGetX(serial_driver);
@@ -132,10 +122,10 @@ inline bool serial_transport_send(const uint8_t* source, const size_t size) {
return serial_transport_receive(dump, bytes_left);
# else
/* The SIO driver directly accesses the hardware FIFOs of the USART
- * peripheral. As these are limited in depth, the RX FIFO might have been
- * overflowed by a large that we just send. Therefore we attempt to read
- * back all the data we send or until the FIFO runs empty in case it
- * overflowed and data was truncated. */
+ * peripheral. As these are limited in depth, the RX FIFO might have
+ * been overflowed by a large transaction that we just send. Therefore
+ * we attempt to read back all the data we send or until the FIFO runs
+ * empty in case it overflowed and data was truncated. */
if (unlikely(sioSynchronizeTXEnd(serial_driver, TIME_MS2I(SERIAL_USART_TIMEOUT)) < MSG_OK)) {
return false;
}