From ae70b0edcea8b466894e140839371fb122a4aa92 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 26 Dec 2015 13:16:24 +0000 Subject: Fixed bug #686. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8647 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/pal.h | 28 ++++++++++++++-------------- os/hal/ports/LPC/LPC214x/serial_lld.c | 20 ++++++++++---------- os/hal/ports/LPC/LPC214x/spi_lld.h | 2 +- os/hal/ports/STM32/LLD/I2Cv1/i2c_lld.h | 2 +- os/hal/ports/STM32/LLD/MACv1/mac_lld.c | 2 +- os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c | 24 ++++++++++++------------ os/hal/ports/STM32/LLD/RTCv2/rtc_lld.c | 20 ++++++++++---------- os/hal/src/hal_buffers.c | 12 ++++++------ os/hal/src/pal.c | 12 ++++++------ 9 files changed, 61 insertions(+), 61 deletions(-) (limited to 'os/hal') diff --git a/os/hal/include/pal.h b/os/hal/include/pal.h index ca4681287..c937e3201 100644 --- a/os/hal/include/pal.h +++ b/os/hal/include/pal.h @@ -260,8 +260,8 @@ typedef struct { * @brief Sets a bits mask on a I/O port. * @note The operation is not guaranteed to be atomic on all the * architectures, for atomicity and/or portability reasons you may - * need to enclose port I/O operations between @p chSysLock() and - * @p chSysUnlock(). + * need to enclose port I/O operations between @p osalSysLock() and + * @p osalSysUnlock(). * @note The default implementation is non atomic and not necessarily * optimal. Low level drivers may optimize the function by using * specific hardware or coding. @@ -283,8 +283,8 @@ typedef struct { * @brief Clears a bits mask on a I/O port. * @note The operation is not guaranteed to be atomic on all the * architectures, for atomicity and/or portability reasons you may - * need to enclose port I/O operations between @p chSysLock() and - * @p chSysUnlock(). + * need to enclose port I/O operations between @p osalSysLock() and + * @p osalSysUnlock(). * @note The default implementation is non atomic and not necessarily * optimal. Low level drivers may optimize the function by using * specific hardware or coding. @@ -306,8 +306,8 @@ typedef struct { * @brief Toggles a bits mask on a I/O port. * @note The operation is not guaranteed to be atomic on all the * architectures, for atomicity and/or portability reasons you may - * need to enclose port I/O operations between @p chSysLock() and - * @p chSysUnlock(). + * need to enclose port I/O operations between @p osalSysLock() and + * @p osalSysUnlock(). * @note The default implementation is non atomic and not necessarily * optimal. Low level drivers may optimize the function by using * specific hardware or coding. @@ -414,8 +414,8 @@ typedef struct { * @brief Writes a logic state on an output pad. * @note The operation is not guaranteed to be atomic on all the * architectures, for atomicity and/or portability reasons you may - * need to enclose port I/O operations between @p chSysLock() and - * @p chSysUnlock(). + * need to enclose port I/O operations between @p osalSysLock() and + * @p osalSysUnlock(). * @note The default implementation is non atomic and not necessarily * optimal. Low level drivers may optimize the function by using * specific hardware or coding. @@ -442,8 +442,8 @@ typedef struct { * @brief Sets a pad logic state to @p PAL_HIGH. * @note The operation is not guaranteed to be atomic on all the * architectures, for atomicity and/or portability reasons you may - * need to enclose port I/O operations between @p chSysLock() and - * @p chSysUnlock(). + * need to enclose port I/O operations between @p osalSysLock() and + * @p osalSysUnlock(). * @note The default implementation is non atomic and not necessarily * optimal. Low level drivers may optimize the function by using * specific hardware or coding. @@ -465,8 +465,8 @@ typedef struct { * @brief Clears a pad logic state to @p PAL_LOW. * @note The operation is not guaranteed to be atomic on all the * architectures, for atomicity and/or portability reasons you may - * need to enclose port I/O operations between @p chSysLock() and - * @p chSysUnlock(). + * need to enclose port I/O operations between @p osalSysLock() and + * @p osalSysUnlock(). * @note The default implementation is non atomic and not necessarily * optimal. Low level drivers may optimize the function by using * specific hardware or coding. @@ -488,8 +488,8 @@ typedef struct { * @brief Toggles a pad logic state. * @note The operation is not guaranteed to be atomic on all the * architectures, for atomicity and/or portability reasons you may - * need to enclose port I/O operations between @p chSysLock() and - * @p chSysUnlock(). + * need to enclose port I/O operations between @p osalSysLock() and + * @p osalSysUnlock(). * @note The default implementation is non atomic and not necessarily * optimal. Low level drivers may optimize the function by using * specific hardware or coding. diff --git a/os/hal/ports/LPC/LPC214x/serial_lld.c b/os/hal/ports/LPC/LPC214x/serial_lld.c index d1bb58cb1..d8154396e 100644 --- a/os/hal/ports/LPC/LPC214x/serial_lld.c +++ b/os/hal/ports/LPC/LPC214x/serial_lld.c @@ -111,9 +111,9 @@ static void set_error(SerialDriver *sdp, IOREG32 err) { sts |= SD_FRAMING_ERROR; if (err & LSR_BREAK) sts |= SD_BREAK_DETECTED; - chSysLockFromISR(); + osalSysLockFromISR(); chnAddFlagsI(sdp, sts); - chSysUnlockFromISR(); + osalSysUnlockFromISR(); } /** @@ -135,15 +135,15 @@ static void serve_interrupt(SerialDriver *sdp) { break; case IIR_SRC_TIMEOUT: case IIR_SRC_RX: - chSysLockFromISR(); + osalSysLockFromISR(); if (chIQIsEmptyI(&sdp->iqueue)) chnAddFlagsI(sdp, CHN_INPUT_AVAILABLE); - chSysUnlockFromISR(); + osalSysUnlockFromISR(); while (u->UART_LSR & LSR_RBR_FULL) { - chSysLockFromISR(); + osalSysLockFromISR(); if (chIQPutI(&sdp->iqueue, u->UART_RBR) < Q_OK) chnAddFlagsI(sdp, SD_OVERRUN_ERROR); - chSysUnlockFromISR(); + osalSysUnlockFromISR(); } break; case IIR_SRC_TX: @@ -152,14 +152,14 @@ static void serve_interrupt(SerialDriver *sdp) { do { msg_t b; - chSysLockFromISR(); + osalSysLockFromISR(); b = chOQGetI(&sdp->oqueue); - chSysUnlockFromISR(); + osalSysUnlockFromISR(); if (b < Q_OK) { u->UART_IER &= ~IER_THRE; - chSysLockFromISR(); + osalSysLockFromISR(); chnAddFlagsI(sdp, CHN_OUTPUT_EMPTY); - chSysUnlockFromISR(); + osalSysUnlockFromISR(); break; } u->UART_THR = b; diff --git a/os/hal/ports/LPC/LPC214x/spi_lld.h b/os/hal/ports/LPC/LPC214x/spi_lld.h index d0455f359..6f95cddfa 100644 --- a/os/hal/ports/LPC/LPC214x/spi_lld.h +++ b/os/hal/ports/LPC/LPC214x/spi_lld.h @@ -61,7 +61,7 @@ * @details The default action is to stop the system. */ #if !defined(LPC214x_SPI_SSP_ERROR_HOOK) || defined(__DOXYGEN__) -#define LPC214x_SPI_SSP_ERROR_HOOK() chSysHalt() +#define LPC214x_SPI_SSP_ERROR_HOOK() osalSysHalt() #endif /*===========================================================================*/ diff --git a/os/hal/ports/STM32/LLD/I2Cv1/i2c_lld.h b/os/hal/ports/STM32/LLD/I2Cv1/i2c_lld.h index 0c027b50c..77a039ca3 100644 --- a/os/hal/ports/STM32/LLD/I2Cv1/i2c_lld.h +++ b/os/hal/ports/STM32/LLD/I2Cv1/i2c_lld.h @@ -139,7 +139,7 @@ * error can only happen because programming errors. */ #if !defined(STM32_I2C_DMA_ERROR_HOOK) || defined(__DOXYGEN__) -#define STM32_I2C_DMA_ERROR_HOOK(i2cp) chSysHalt("DMA failure") +#define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure") #endif #if STM32_ADVANCED_DMA || defined(__DOXYGEN__) diff --git a/os/hal/ports/STM32/LLD/MACv1/mac_lld.c b/os/hal/ports/STM32/LLD/MACv1/mac_lld.c index de3fdba54..7863210bc 100644 --- a/os/hal/ports/STM32/LLD/MACv1/mac_lld.c +++ b/os/hal/ports/STM32/LLD/MACv1/mac_lld.c @@ -266,7 +266,7 @@ void mac_lld_init(void) { /* PHY soft reset procedure.*/ mii_write(ÐD1, MII_BMCR, BMCR_RESET); #if defined(BOARD_PHY_RESET_DELAY) - chSysPolledDelayX(BOARD_PHY_RESET_DELAY); + osalSysPolledDelayX(BOARD_PHY_RESET_DELAY); #endif while (mii_read(ÐD1, MII_BMCR) & BMCR_RESET) ; diff --git a/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c b/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c index 16cb9b500..8f5193222 100644 --- a/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c +++ b/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c @@ -196,7 +196,7 @@ void rtc_lld_set_prescaler(void) { syssts_t sts; /* Entering a reentrant critical zone.*/ - sts = chSysGetStatusAndLockX(); + sts = osalSysGetStatusAndLockX(); rtc_acquire_access(); RTC->PRLH = (uint16_t)((STM32_RTCCLK - 1) >> 16) & 0x000F; @@ -204,7 +204,7 @@ void rtc_lld_set_prescaler(void) { rtc_release_access(); /* Leaving a reentrant critical zone.*/ - chSysRestoreStatusX(sts); + osalSysRestoreStatusX(sts); } /** @@ -290,7 +290,7 @@ void rtc_lld_set_alarm(RTCDriver *rtcp, (void)alarm_number; /* Entering a reentrant critical zone.*/ - sts = chSysGetStatusAndLockX(); + sts = osalSysGetStatusAndLockX(); rtc_acquire_access(); if (alarmspec != NULL) { @@ -304,7 +304,7 @@ void rtc_lld_set_alarm(RTCDriver *rtcp, rtc_release_access(); /* Leaving a reentrant critical zone.*/ - chSysRestoreStatusX(sts); + osalSysRestoreStatusX(sts); } /** @@ -327,7 +327,7 @@ void rtc_lld_get_alarm(RTCDriver *rtcp, (void)alarm_number; /* Entering a reentrant critical zone.*/ - sts = chSysGetStatusAndLockX(); + sts = osalSysGetStatusAndLockX(); /* Required because access to ALR.*/ rtc_apb1_sync(); @@ -335,7 +335,7 @@ void rtc_lld_get_alarm(RTCDriver *rtcp, alarmspec->tv_sec = ((rtcp->rtc->ALRH << 16) + rtcp->rtc->ALRL); /* Leaving a reentrant critical zone.*/ - chSysRestoreStatusX(sts); + osalSysRestoreStatusX(sts); } /** @@ -353,7 +353,7 @@ void rtc_lld_set_callback(RTCDriver *rtcp, rtccb_t callback) { syssts_t sts; /* Entering a reentrant critical zone.*/ - sts = chSysGetStatusAndLockX(); + sts = osalSysGetStatusAndLockX(); if (callback != NULL) { @@ -373,7 +373,7 @@ void rtc_lld_set_callback(RTCDriver *rtcp, rtccb_t callback) { } /* Leaving a reentrant critical zone.*/ - chSysRestoreStatusX(sts); + osalSysRestoreStatusX(sts); } /** @@ -394,7 +394,7 @@ void rtcSTM32GetSecMsec(RTCDriver *rtcp, uint32_t *tv_sec, uint32_t *tv_msec) { osalDbgCheck((NULL != tv_sec) && (NULL != rtcp)); /* Entering a reentrant critical zone.*/ - sts = chSysGetStatusAndLockX(); + sts = osalSysGetStatusAndLockX(); /* Required because access to CNT and DIV.*/ rtc_apb1_sync(); @@ -406,7 +406,7 @@ void rtcSTM32GetSecMsec(RTCDriver *rtcp, uint32_t *tv_sec, uint32_t *tv_msec) { } while ((*tv_sec) != (((uint32_t)(rtcp->rtc->CNTH) << 16) + rtcp->rtc->CNTL)); /* Leaving a reentrant critical zone.*/ - chSysRestoreStatusX(sts); + osalSysRestoreStatusX(sts); if (NULL != tv_msec) *tv_msec = (((uint32_t)STM32_RTCCLK - 1 - time_frac) * 1000) / STM32_RTCCLK; @@ -427,7 +427,7 @@ void rtcSTM32SetSec(RTCDriver *rtcp, uint32_t tv_sec) { osalDbgCheck(NULL != rtcp); /* Entering a reentrant critical zone.*/ - sts = chSysGetStatusAndLockX(); + sts = osalSysGetStatusAndLockX(); rtc_acquire_access(); rtcp->rtc->CNTH = (uint16_t)(tv_sec >> 16); @@ -435,7 +435,7 @@ void rtcSTM32SetSec(RTCDriver *rtcp, uint32_t tv_sec) { rtc_release_access(); /* Leaving a reentrant critical zone.*/ - chSysRestoreStatusX(sts); + osalSysRestoreStatusX(sts); } #endif /* HAL_USE_RTC */ diff --git a/os/hal/ports/STM32/LLD/RTCv2/rtc_lld.c b/os/hal/ports/STM32/LLD/RTCv2/rtc_lld.c index 51ee7c41c..a362d2379 100644 --- a/os/hal/ports/STM32/LLD/RTCv2/rtc_lld.c +++ b/os/hal/ports/STM32/LLD/RTCv2/rtc_lld.c @@ -339,7 +339,7 @@ void rtc_lld_set_time(RTCDriver *rtcp, const RTCDateTime *timespec) { dr = rtc_encode_date(timespec); /* Entering a reentrant critical zone.*/ - sts = chSysGetStatusAndLockX(); + sts = osalSysGetStatusAndLockX(); /* Writing the registers.*/ rtc_enter_init(); @@ -348,7 +348,7 @@ void rtc_lld_set_time(RTCDriver *rtcp, const RTCDateTime *timespec) { rtc_exit_init(); /* Leaving a reentrant critical zone.*/ - chSysRestoreStatusX(sts); + osalSysRestoreStatusX(sts); } /** @@ -369,7 +369,7 @@ void rtc_lld_get_time(RTCDriver *rtcp, RTCDateTime *timespec) { syssts_t sts; /* Entering a reentrant critical zone.*/ - sts = chSysGetStatusAndLockX(); + sts = osalSysGetStatusAndLockX(); /* Synchronization with the RTC and reading the registers, note DR must be read last.*/ @@ -383,7 +383,7 @@ void rtc_lld_get_time(RTCDriver *rtcp, RTCDateTime *timespec) { rtcp->rtc->ISR &= ~RTC_ISR_RSF; /* Leaving a reentrant critical zone.*/ - chSysRestoreStatusX(sts); + osalSysRestoreStatusX(sts); /* Decoding day time, this starts the atomic read sequence, see "Reading the calendar" in the RTC documentation.*/ @@ -421,7 +421,7 @@ void rtc_lld_set_alarm(RTCDriver *rtcp, syssts_t sts; /* Entering a reentrant critical zone.*/ - sts = chSysGetStatusAndLockX(); + sts = osalSysGetStatusAndLockX(); if (alarm == 0) { if (alarmspec != NULL) { @@ -455,7 +455,7 @@ void rtc_lld_set_alarm(RTCDriver *rtcp, #endif /* RTC_ALARMS > 1 */ /* Leaving a reentrant critical zone.*/ - chSysRestoreStatusX(sts); + osalSysRestoreStatusX(sts); } /** @@ -496,7 +496,7 @@ void rtcSTM32SetPeriodicWakeup(RTCDriver *rtcp, const RTCWakeup *wakeupspec) { syssts_t sts; /* Entering a reentrant critical zone.*/ - sts = chSysGetStatusAndLockX(); + sts = osalSysGetStatusAndLockX(); if (wakeupspec != NULL) { osalDbgCheck(wakeupspec->wutr != 0x30000); @@ -515,7 +515,7 @@ void rtcSTM32SetPeriodicWakeup(RTCDriver *rtcp, const RTCWakeup *wakeupspec) { } /* Leaving a reentrant critical zone.*/ - chSysRestoreStatusX(sts); + osalSysRestoreStatusX(sts); } /** @@ -532,14 +532,14 @@ void rtcSTM32GetPeriodicWakeup(RTCDriver *rtcp, RTCWakeup *wakeupspec) { syssts_t sts; /* Entering a reentrant critical zone.*/ - sts = chSysGetStatusAndLockX(); + sts = osalSysGetStatusAndLockX(); wakeupspec->wutr = 0; wakeupspec->wutr |= rtcp->rtc->WUTR; wakeupspec->wutr |= (((uint32_t)rtcp->rtc->CR) & 0x7) << 16; /* Leaving a reentrant critical zone.*/ - chSysRestoreStatusX(sts); + osalSysRestoreStatusX(sts); } #endif /* STM32_RTC_HAS_PERIODIC_WAKEUPS */ diff --git a/os/hal/src/hal_buffers.c b/os/hal/src/hal_buffers.c index 69f303013..2dae9771e 100644 --- a/os/hal/src/hal_buffers.c +++ b/os/hal/src/hal_buffers.c @@ -175,9 +175,9 @@ msg_t ibqGetFullBufferTimeout(input_buffers_queue_t *ibqp, systime_t timeout) { msg_t msg; - chSysLock(); + osalSysLock(); msg = ibqGetFullBufferTimeoutS(ibqp, timeout); - chSysUnlock(); + osalSysUnlock(); return msg; } @@ -233,9 +233,9 @@ msg_t ibqGetFullBufferTimeout(input_buffers_queue_t *ibqp, */ void ibqReleaseEmptyBuffer(input_buffers_queue_t *ibqp) { - chSysLock(); + osalSysLock(); ibqReleaseEmptyBufferS(ibqp); - chSysUnlock(); + osalSysUnlock(); } /** @@ -545,9 +545,9 @@ msg_t obqGetEmptyBufferTimeout(output_buffers_queue_t *obqp, systime_t timeout) { msg_t msg; - chSysLock(); + osalSysLock(); msg = obqGetEmptyBufferTimeoutS(obqp, timeout); - chSysUnlock(); + osalSysUnlock(); return msg; } diff --git a/os/hal/src/pal.c b/os/hal/src/pal.c index 820ee1979..ec86996a2 100644 --- a/os/hal/src/pal.c +++ b/os/hal/src/pal.c @@ -50,8 +50,8 @@ * @brief Read from an I/O bus. * @note The operation is not guaranteed to be atomic on all the * architectures, for atomicity and/or portability reasons you may - * need to enclose port I/O operations between @p chSysLock() and - * @p chSysUnlock(). + * need to enclose port I/O operations between @p osalSysLock() and + * @p osalSysUnlock(). * @note The function internally uses the @p palReadGroup() macro. The use * of this function is preferred when you value code size, readability * and error checking over speed. @@ -73,8 +73,8 @@ ioportmask_t palReadBus(IOBus *bus) { * @brief Write to an I/O bus. * @note The operation is not guaranteed to be atomic on all the * architectures, for atomicity and/or portability reasons you may - * need to enclose port I/O operations between @p chSysLock() and - * @p chSysUnlock(). + * need to enclose port I/O operations between @p osalSysLock() and + * @p osalSysUnlock(). * @note The default implementation is non atomic and not necessarily * optimal. Low level drivers may optimize the function by using * specific hardware or coding. @@ -98,8 +98,8 @@ void palWriteBus(IOBus *bus, ioportmask_t bits) { * @brief Programs a bus with the specified mode. * @note The operation is not guaranteed to be atomic on all the * architectures, for atomicity and/or portability reasons you may - * need to enclose port I/O operations between @p chSysLock() and - * @p chSysUnlock(). + * need to enclose port I/O operations between @p osalSysLock() and + * @p osalSysUnlock(). * @note The default implementation is non atomic and not necessarily * optimal. Low level drivers may optimize the function by using * specific hardware or coding. -- cgit v1.2.3