Update ChibiOS[-Contrib], SIO driver, configs (#17915)

Co-authored-by: Nick Brassel <nick@tzarc.org>
This commit is contained in:
Stefan Kerkmann 2023-01-12 11:47:36 +01:00 committed by GitHub
parent 81513ab5f5
commit ec09087543
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 39 additions and 42 deletions

@ -1 +1 @@
Subproject commit 0e9d558b525a8f28285f3bb509fd48a897c43151 Subproject commit 0062927e3058a8b5ef587234bbd98d42fb4e595e

@ -1 +1 @@
Subproject commit 1130173eae6b7402443aff18ad68228acbe25cc4 Subproject commit a224be155ae18d38deccf33a6c1d259b9a5ad8d3

View file

@ -1,9 +1,12 @@
/* /*
ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

View file

@ -29,7 +29,7 @@
#define HALCONF_H #define HALCONF_H
#define _CHIBIOS_HAL_CONF_ #define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_8_0_ #define _CHIBIOS_HAL_CONF_VER_8_4_
#include <mcuconf.h> #include <mcuconf.h>
@ -335,15 +335,18 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Delays insertions. * @brief Timeout before assuming a failure while waiting for card idle.
* @details If enabled this options inserts delays into the MMC waiting * @note Time is in milliseconds.
* 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.
*/ */
#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) #if !defined(MMC_IDLE_TIMEOUT_MS) || defined(__DOXYGEN__)
#define MMC_NICE_WAITING TRUE #define MMC_IDLE_TIMEOUT_MS 1000
#endif
/**
* @brief Mutual exclusion on the SPI bus.
*/
#if !defined(MMC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define MMC_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/*===========================================================================*/ /*===========================================================================*/

View file

@ -29,7 +29,7 @@
#define HALCONF_H #define HALCONF_H
#define _CHIBIOS_HAL_CONF_ #define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_8_0_ #define _CHIBIOS_HAL_CONF_VER_8_4_
#include <mcuconf.h> #include <mcuconf.h>
@ -335,15 +335,18 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Delays insertions. * @brief Timeout before assuming a failure while waiting for card idle.
* @details If enabled this options inserts delays into the MMC waiting * @note Time is in milliseconds.
* 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.
*/ */
#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) #if !defined(MMC_IDLE_TIMEOUT_MS) || defined(__DOXYGEN__)
#define MMC_NICE_WAITING TRUE #define MMC_IDLE_TIMEOUT_MS 1000
#endif
/**
* @brief Mutual exclusion on the SPI bus.
*/
#if !defined(MMC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define MMC_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/*===========================================================================*/ /*===========================================================================*/

View file

@ -72,27 +72,17 @@ inline void serial_transport_driver_clear(void) {
#elif HAL_USE_SIO #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. * @brief SIO Driver startup routine.
*/ */
static inline void usart_driver_start(void) { static inline void usart_driver_start(void) {
sioStart(serial_driver, &serial_config); sioStart(serial_driver, &serial_config);
sioStartOperation(serial_driver, &serial_usart_operation);
} }
inline void serial_transport_driver_clear(void) { inline void serial_transport_driver_clear(void) {
if (sioHasRXErrorsX(serial_driver)) {
sioGetAndClearErrors(serial_driver);
}
osalSysLock(); osalSysLock();
while (!sioIsRXEmptyX(serial_driver)) { while (!sioIsRXEmptyX(serial_driver)) {
(void)sioGetX(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); return serial_transport_receive(dump, bytes_left);
# else # else
/* The SIO driver directly accesses the hardware FIFOs of the USART /* The SIO driver directly accesses the hardware FIFOs of the USART
* peripheral. As these are limited in depth, the RX FIFO might have been * peripheral. As these are limited in depth, the RX FIFO might have
* overflowed by a large that we just send. Therefore we attempt to read * been overflowed by a large transaction that we just send. Therefore
* back all the data we send or until the FIFO runs empty in case it * we attempt to read back all the data we send or until the FIFO runs
* overflowed and data was truncated. */ * empty in case it overflowed and data was truncated. */
if (unlikely(sioSynchronizeTXEnd(serial_driver, TIME_MS2I(SERIAL_USART_TIMEOUT)) < MSG_OK)) { if (unlikely(sioSynchronizeTXEnd(serial_driver, TIME_MS2I(SERIAL_USART_TIMEOUT)) < MSG_OK)) {
return false; return false;
} }

View file

@ -13,10 +13,8 @@ umask 022
# sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ # sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
# sudo apt-get update && sudo apt-get install adoptopenjdk-8-hotspot # sudo apt-get update && sudo apt-get install adoptopenjdk-8-hotspot
# #
# For Fedora 36-ish distros: # For Fedora 37-ish distros:
# # Prep yum repository from https://adoptium.net/installation/linux/ # sudo dnf install -y ant java-1.8.0-openjdk.x86_64
# sudo dnf install -y ant temurin-8-jdk
# export JAVA_HOME=/usr/lib/jvm/temurin-8-jdk
sinfo() { echo "$@" >&2 ; } sinfo() { echo "$@" >&2 ; }
shead() { sinfo "" ; sinfo "---------------------------------" ; sinfo "-- $@" ; sinfo "---------------------------------" ; } shead() { sinfo "" ; sinfo "---------------------------------" ; sinfo "-- $@" ; sinfo "---------------------------------" ; }