diff --git a/os/hal/osal/chibios/osal.h b/os/hal/osal/chibios/osal.h index b03681f09..7ae97f92b 100644 --- a/os/hal/osal/chibios/osal.h +++ b/os/hal/osal/chibios/osal.h @@ -397,11 +397,12 @@ static inline void osalSysUnlockFromISR(void) { } /** - * @brief Returns the execution context and enters the kernel lock mode. + * @brief Returns the execution status and enters a critical zone. * @details This functions enters into a critical zone and can be called * from any context. Because its flexibility it is less efficient * than @p chSysLock() which is preferable when the calling context * is known. + * @post The system is in a critical zone. * * @return The previous system status, the encoding of this * status word is architecture-dependent and opaque. @@ -414,15 +415,17 @@ static inline syssts_t osalSysGetStatusAndLockX(void) { } /** - * @brief Restores the specified execution status. + * @brief Restores the specified execution status and leaves a critical zone. + * @note A call to @p chSchRescheduleS() is automatically performed + * if exiting the critical zone and if not in ISR context. * * @param[in] sts the system status to be restored. * * @xclass */ -static inline void osalSysRestoreLockAndRescheduleX(syssts_t sts) { +static inline void osalSysRestoreStatusX(syssts_t sts) { - chSysRestoreLockAndRescheduleX(sts); + chSysRestoreStatusX(sts); } /** diff --git a/os/hal/platforms/STM32/USBv1/usb_lld.c b/os/hal/platforms/STM32/USBv1/usb_lld.c index b1e721556..1a44a678f 100644 --- a/os/hal/platforms/STM32/USBv1/usb_lld.c +++ b/os/hal/platforms/STM32/USBv1/usb_lld.c @@ -253,7 +253,7 @@ static void usb_packet_write_from_queue(stm32_usb_descriptor_t *udp, oqp->q_counter += n; osalQueueWakeupAllI(&oqp->q_waiting, Q_OK); - osalSysRestoreLockAndRescheduleX(sts); + osalSysRestoreStatusX(sts); } /*===========================================================================*/ diff --git a/os/rt/include/chsys.h b/os/rt/include/chsys.h index 270772323..eb1f859dd 100644 --- a/os/rt/include/chsys.h +++ b/os/rt/include/chsys.h @@ -219,7 +219,7 @@ extern "C" { void chSysHalt(const char *reason); void chSysTimerHandlerI(void); syssts_t chSysGetStatusAndLockX(void); - void chSysRestoreLockAndRescheduleX(syssts_t sts); + void chSysRestoreStatusX(syssts_t sts); #if CH_PORT_SUPPORTS_RT bool chSysIsCounterWithinX(rtcnt_t cnt, rtcnt_t start, rtcnt_t end); void chSysPolledDelayX(rtcnt_t cycles); diff --git a/os/rt/src/chsys.c b/os/rt/src/chsys.c index c4e31c76c..4ddbe41ce 100644 --- a/os/rt/src/chsys.c +++ b/os/rt/src/chsys.c @@ -216,7 +216,7 @@ void chSysTimerHandlerI(void) { } /** - * @brief Returns the execution context and enters the kernel lock mode. + * @brief Returns the execution status and enters a critical zone. * @details This functions enters into a critical zone and can be called * from any context. Because its flexibility it is less efficient * than @p chSysLock() which is preferable when the calling context @@ -241,15 +241,15 @@ syssts_t chSysGetStatusAndLockX(void) { } /** - * @brief Restores the specified execution status. + * @brief Restores the specified execution status and leaves a critical zone. * @note A call to @p chSchRescheduleS() is automatically performed - * is exiting the critical zone and if in proper context. + * if exiting the critical zone and if not in ISR context. * * @param[in] sts the system status to be restored. * * @xclass */ -void chSysRestoreLockAndRescheduleX(syssts_t sts) { +void chSysRestoreStatusX(syssts_t sts) { if (port_irq_enabled(sts)) { if (port_is_isr_context())