From 6a6160a99508770754d40621f606de610626bf29 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 4 Nov 2017 17:46:32 +0000 Subject: Fixed for time API changes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10943 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.c | 8 ++++---- os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.c | 8 ++++---- testhal/STM32/STM32F1xx/I2C/fake.c | 2 +- testhal/STM32/STM32F1xx/I2C/lis3.c | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.c b/os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.c index 20b8cf8b6..98046021a 100644 --- a/os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.c +++ b/os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.c @@ -737,7 +737,7 @@ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, /* Calculating the time window for the timeout on the busy bus condition.*/ start = osalOsGetSystemTimeX(); - end = start + OSAL_MS2ST(STM32_I2C_BUSY_TIMEOUT); + end = osalTimeAddX(start, OSAL_MS2I(STM32_I2C_BUSY_TIMEOUT)); /* Waits until BUSY flag is reset or, alternatively, for a timeout condition.*/ @@ -751,7 +751,7 @@ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, /* If the system time went outside the allowed window then a timeout condition is returned.*/ - if (!osalOsIsTimeWithinX(osalOsGetSystemTimeX(), start, end)) + if (!osalTimeIsInRangeX(osalOsGetSystemTimeX(), start, end)) return MSG_TIMEOUT; osalSysUnlock(); @@ -822,7 +822,7 @@ msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr, /* Calculating the time window for the timeout on the busy bus condition.*/ start = osalOsGetSystemTimeX(); - end = start + OSAL_MS2ST(STM32_I2C_BUSY_TIMEOUT); + end = osalTimeAddX(start, OSAL_MS2I(STM32_I2C_BUSY_TIMEOUT)); /* Waits until BUSY flag is reset or, alternatively, for a timeout condition.*/ @@ -836,7 +836,7 @@ msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr, /* If the system time went outside the allowed window then a timeout condition is returned.*/ - if (!osalOsIsTimeWithinX(osalOsGetSystemTimeX(), start, end)) + if (!osalTimeIsInRangeX(osalOsGetSystemTimeX(), start, end)) return MSG_TIMEOUT; osalSysUnlock(); diff --git a/os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.c b/os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.c index f2c9c95e9..724c5dbdb 100644 --- a/os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.c +++ b/os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.c @@ -984,7 +984,7 @@ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, /* Calculating the time window for the timeout on the busy bus condition.*/ start = osalOsGetSystemTimeX(); - end = start + OSAL_MS2ST(STM32_I2C_BUSY_TIMEOUT); + end = osalTimeAddX(start, OSAL_MS2I(STM32_I2C_BUSY_TIMEOUT)); /* Waits until BUSY flag is reset or, alternatively, for a timeout condition.*/ @@ -998,7 +998,7 @@ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, /* If the system time went outside the allowed window then a timeout condition is returned.*/ - if (!osalOsIsTimeWithinX(osalOsGetSystemTimeX(), start, end)) { + if (!osalTimeIsInRangeX(osalOsGetSystemTimeX(), start, end)) { return MSG_TIMEOUT; } @@ -1094,7 +1094,7 @@ msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr, /* Calculating the time window for the timeout on the busy bus condition.*/ start = osalOsGetSystemTimeX(); - end = start + OSAL_MS2ST(STM32_I2C_BUSY_TIMEOUT); + end = osalTimeAddX(start, OSAL_MS2I(STM32_I2C_BUSY_TIMEOUT)); /* Waits until BUSY flag is reset or, alternatively, for a timeout condition.*/ @@ -1108,7 +1108,7 @@ msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr, /* If the system time went outside the allowed window then a timeout condition is returned.*/ - if (!osalOsIsTimeWithinX(osalOsGetSystemTimeX(), start, end)) { + if (!osalTimeIsInRangeX(osalOsGetSystemTimeX(), start, end)) { return MSG_TIMEOUT; } diff --git a/testhal/STM32/STM32F1xx/I2C/fake.c b/testhal/STM32/STM32F1xx/I2C/fake.c index 4da6d25e7..f3cca595a 100644 --- a/testhal/STM32/STM32F1xx/I2C/fake.c +++ b/testhal/STM32/STM32F1xx/I2C/fake.c @@ -28,7 +28,7 @@ static i2cflags_t errors = 0; /* This is main function. */ void request_fake(void){ msg_t status = MSG_OK; - systime_t tmo = MS2ST(4); + sysinterval_t tmo = TIME_MS2I(4); i2cAcquireBus(&I2CD1); status = i2cMasterReceiveTimeout(&I2CD1, addr, rx_data, 2, tmo); diff --git a/testhal/STM32/STM32F1xx/I2C/lis3.c b/testhal/STM32/STM32F1xx/I2C/lis3.c index 8217798d6..ab1ae1b90 100644 --- a/testhal/STM32/STM32F1xx/I2C/lis3.c +++ b/testhal/STM32/STM32F1xx/I2C/lis3.c @@ -54,7 +54,7 @@ static uint8_t accel_tx_data[8]; */ void lis3Start(void){ msg_t status = MSG_OK; - systime_t tmo = MS2ST(4); + sysinterval_t tmo = TIME_MS2I(4); /* configure accelerometer */ accel_tx_data[0] = ACCEL_CTRL_REG1 | AUTO_INCREMENT_BIT; @@ -88,7 +88,7 @@ static void raw2g(uint8_t *raw, float *g) { */ void lis3GetAcc(float *result) { msg_t status = MSG_OK; - systime_t tmo = MS2ST(4); + sysinterval_t tmo = TIME_MS2I(4); /* read in burst mode */ memset(accel_rx_data, 0x55, sizeof(accel_rx_data)); -- cgit v1.2.3