This is an automated email from the ASF dual-hosted git repository.
pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new d3524d4f8b arch/i2c: Change xxx_i2c_tousecs to xxx_i2c_toticks
d3524d4f8b is described below
commit d3524d4f8b8ba53bd3a02f93d2c522c676f3c4ec
Author: Xiang Xiao <[email protected]>
AuthorDate: Sun May 15 18:47:53 2022 +0800
arch/i2c: Change xxx_i2c_tousecs to xxx_i2c_toticks
Signed-off-by: Xiang Xiao <[email protected]>
---
arch/arm/src/am335x/am335x_i2c.c | 13 ++++++-------
arch/arm/src/efm32/efm32_i2c.c | 12 ++++++------
arch/arm/src/imxrt/imxrt_lpi2c.c | 12 ++++++------
arch/arm/src/s32k1xx/s32k1xx_lpi2c.c | 14 +++++++-------
arch/arm/src/stm32/stm32_i2c.c | 12 ++++++------
arch/arm/src/stm32/stm32_i2c_alt.c | 12 ++++++------
arch/arm/src/stm32/stm32_i2c_v2.c | 12 ++++++------
arch/arm/src/stm32/stm32f40xxx_i2c.c | 12 ++++++------
arch/arm/src/stm32f0l0g0/stm32_i2c.c | 13 ++++++-------
arch/arm/src/stm32f7/stm32_i2c.c | 12 ++++++------
arch/arm/src/stm32h7/stm32_i2c.c | 12 ++++++------
arch/arm/src/stm32l4/stm32l4_i2c.c | 12 ++++++------
arch/arm/src/tiva/common/tiva_i2c.c | 12 ++++++------
arch/mips/src/pic32mz/pic32mz_i2c.c | 12 ++++++------
14 files changed, 85 insertions(+), 87 deletions(-)
diff --git a/arch/arm/src/am335x/am335x_i2c.c b/arch/arm/src/am335x/am335x_i2c.c
index b906629332..cf92262001 100644
--- a/arch/arm/src/am335x/am335x_i2c.c
+++ b/arch/arm/src/am335x/am335x_i2c.c
@@ -224,7 +224,7 @@ static int
am335x_i2c_sem_wait_noncancelable(struct am335x_i2c_priv_s *priv);
#ifdef CONFIG_AM335X_I2C_DYNTIMEO
-static useconds_t am335x_i2c_tousecs(int msgc, struct i2c_msg_s *msgs);
+static uint32_t am335x_i2c_toticks(int msgc, struct i2c_msg_s *msgs);
#endif /* CONFIG_AM335X_I2C_DYNTIMEO */
static inline int
@@ -468,7 +468,7 @@ am335x_i2c_sem_wait_noncancelable(struct am335x_i2c_priv_s
*priv)
}
/****************************************************************************
- * Name: am335x_i2c_tousecs
+ * Name: am335x_i2c_toticks
*
* Description:
* Return a micro-second delay based on the number of bytes left to be
@@ -477,7 +477,7 @@ am335x_i2c_sem_wait_noncancelable(struct am335x_i2c_priv_s
*priv)
****************************************************************************/
#ifdef CONFIG_AM335X_I2C_DYNTIMEO
-static useconds_t am335x_i2c_tousecs(int msgc, struct i2c_msg_s *msgs)
+static uint32_t am335x_i2c_toticks(int msgc, struct i2c_msg_s *msgs)
{
size_t bytecount = 0;
int i;
@@ -493,7 +493,7 @@ static useconds_t am335x_i2c_tousecs(int msgc, struct
i2c_msg_s *msgs)
* factor.
*/
- return (useconds_t)(CONFIG_AM335X_I2C_DYNTIMEO_USECPERBYTE * bytecount);
+ return USEC2TICK(CONFIG_AM335X_I2C_DYNTIMEO_USECPERBYTE * bytecount);
}
#endif
@@ -555,8 +555,7 @@ static inline int am335x_i2c_sem_waitdone(struct
am335x_i2c_priv_s *priv)
#ifdef CONFIG_AM335X_I2C_DYNTIMEO
ret = nxsem_tickwait(&priv->sem_isr,
- USEC2TICK(am335x_i2c_tousecs(priv->msgc,
- priv->msgv));
+ am335x_i2c_toticks(priv->msgc, priv->msgv));
#else
ret = nxsem_tickwait(&priv->sem_isr,
CONFIG_AM335X_I2CTIMEOTICKS);
@@ -598,7 +597,7 @@ static inline int am335x_i2c_sem_waitdone(struct
am335x_i2c_priv_s *priv)
/* Get the timeout value */
#ifdef CONFIG_AM335X_I2C_DYNTIMEO
- timeout = USEC2TICK(am335x_i2c_tousecs(priv->msgc, priv->msgv));
+ timeout = am335x_i2c_toticks(priv->msgc, priv->msgv);
#else
timeout = CONFIG_AM335X_I2CTIMEOTICKS;
#endif
diff --git a/arch/arm/src/efm32/efm32_i2c.c b/arch/arm/src/efm32/efm32_i2c.c
index 8f021d8733..2889495b08 100644
--- a/arch/arm/src/efm32/efm32_i2c.c
+++ b/arch/arm/src/efm32/efm32_i2c.c
@@ -265,7 +265,7 @@ static int
efm32_i2c_sem_wait_noncancelable(struct efm32_i2c_priv_s *priv);
#ifdef CONFIG_EFM32_I2C_DYNTIMEO
-static useconds_t efm32_i2c_tousecs(int msgc, struct i2c_msg_s *msgs);
+static uint32_t efm32_i2c_toticks(int msgc, struct i2c_msg_s *msgs);
#endif /* CONFIG_EFM32_I2C_DYNTIMEO */
static inline int efm32_i2c_sem_waitdone(struct efm32_i2c_priv_s *priv);
@@ -488,7 +488,7 @@ efm32_i2c_sem_wait_noncancelable(struct efm32_i2c_priv_s
*priv)
}
/****************************************************************************
- * Name: efm32_i2c_tousecs
+ * Name: efm32_i2c_toticks
*
* Description:
* Return a micro-second delay based on the number of bytes left to be
@@ -497,7 +497,7 @@ efm32_i2c_sem_wait_noncancelable(struct efm32_i2c_priv_s
*priv)
****************************************************************************/
#ifdef CONFIG_EFM32_I2C_DYNTIMEO
-static useconds_t efm32_i2c_tousecs(int msgc, struct i2c_msg_s *msgs)
+static uint32_t efm32_i2c_toticks(int msgc, struct i2c_msg_s *msgs)
{
size_t bytecount = 0;
int i;
@@ -513,7 +513,7 @@ static useconds_t efm32_i2c_tousecs(int msgc, struct
i2c_msg_s *msgs)
* factor.
*/
- return (useconds_t) (CONFIG_EFM32_I2C_DYNTIMEO_USECPERBYTE * bytecount);
+ return USEC2TICK(CONFIG_EFM32_I2C_DYNTIMEO_USECPERBYTE * bytecount);
}
#endif
@@ -541,7 +541,7 @@ static inline int efm32_i2c_sem_waitdone(struct
efm32_i2c_priv_s *priv)
#ifdef CONFIG_EFM32_I2C_DYNTIMEO
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
- USEC2TICK(efm32_i2c_tousecs(priv->msgc, priv->msgv)));
+ efm32_i2c_toticks(priv->msgc, priv->msgv));
#else
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
CONFIG_EFM32_I2CTIMEOTICKS);
@@ -584,7 +584,7 @@ static inline int efm32_i2c_sem_waitdone(struct
efm32_i2c_priv_s *priv)
/* Get the timeout value */
#ifdef CONFIG_EFM32_I2C_DYNTIMEO
- timeout = USEC2TICK(efm32_i2c_tousecs(priv->msgc, priv->msgv));
+ timeout = efm32_i2c_toticks(priv->msgc, priv->msgv);
#else
timeout = CONFIG_EFM32_I2CTIMEOTICKS;
#endif
diff --git a/arch/arm/src/imxrt/imxrt_lpi2c.c b/arch/arm/src/imxrt/imxrt_lpi2c.c
index ff031dfdbc..d5537a080f 100644
--- a/arch/arm/src/imxrt/imxrt_lpi2c.c
+++ b/arch/arm/src/imxrt/imxrt_lpi2c.c
@@ -231,7 +231,7 @@ imxrt_lpi2c_sem_wait_noncancelable(struct
imxrt_lpi2c_priv_s *priv);
#endif
#ifdef CONFIG_IMXRT_LPI2C_DYNTIMEO
-static useconds_t imxrt_lpi2c_tousecs(int msgc, struct i2c_msg_s *msgs);
+static uint32_t imxrt_lpi2c_toticks(int msgc, struct i2c_msg_s *msgs);
#endif /* CONFIG_IMXRT_LPI2C_DYNTIMEO */
static inline int
@@ -540,7 +540,7 @@ imxrt_lpi2c_sem_wait_noncancelable(struct
imxrt_lpi2c_priv_s *priv)
#endif
/****************************************************************************
- * Name: imxrt_lpi2c_tousecs
+ * Name: imxrt_lpi2c_toticks
*
* Description:
* Return a micro-second delay based on the number of bytes left to be
@@ -549,7 +549,7 @@ imxrt_lpi2c_sem_wait_noncancelable(struct
imxrt_lpi2c_priv_s *priv)
****************************************************************************/
#ifdef CONFIG_IMXRT_LPI2C_DYNTIMEO
-static useconds_t imxrt_lpi2c_tousecs(int msgc, struct i2c_msg_s *msgs)
+static uint32_t imxrt_lpi2c_toticks(int msgc, struct i2c_msg_s *msgs)
{
size_t bytecount = 0;
int i;
@@ -565,7 +565,7 @@ static useconds_t imxrt_lpi2c_tousecs(int msgc, struct
i2c_msg_s *msgs)
* factor.
*/
- return (useconds_t)(CONFIG_IMXRT_LPI2C_DYNTIMEO_USECPERBYTE * bytecount);
+ return USEC2TICK(CONFIG_IMXRT_LPI2C_DYNTIMEO_USECPERBYTE * bytecount);
}
#endif
@@ -624,7 +624,7 @@ imxrt_lpi2c_sem_waitdone(struct imxrt_lpi2c_priv_s *priv)
#ifdef CONFIG_IMXRT_LPI2C_DYNTIMEO
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
- USEC2TICK(imxrt_lpi2c_tousecs(priv->msgc, priv->msgv)));
+ imxrt_lpi2c_toticks(priv->msgc, priv->msgv));
#else
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
CONFIG_IMXRT_LPI2C_TIMEOTICKS);
@@ -679,7 +679,7 @@ imxrt_lpi2c_sem_waitdone(struct imxrt_lpi2c_priv_s *priv)
/* Get the timeout value */
#ifdef CONFIG_IMXRT_LPI2C_DYNTIMEO
- timeout = USEC2TICK(imxrt_lpi2c_tousecs(priv->msgc, priv->msgv));
+ timeout = imxrt_lpi2c_toticks(priv->msgc, priv->msgv);
#else
timeout = CONFIG_IMXRT_LPI2C_TIMEOTICKS;
#endif
diff --git a/arch/arm/src/s32k1xx/s32k1xx_lpi2c.c
b/arch/arm/src/s32k1xx/s32k1xx_lpi2c.c
index dc8d4851d2..517d35656c 100644
--- a/arch/arm/src/s32k1xx/s32k1xx_lpi2c.c
+++ b/arch/arm/src/s32k1xx/s32k1xx_lpi2c.c
@@ -222,8 +222,8 @@ static inline int
s32k1xx_lpi2c_sem_wait(struct s32k1xx_lpi2c_priv_s *priv);
#ifdef CONFIG_S32K1XX_I2C_DYNTIMEO
-static useconds_t
-s32k1xx_lpi2c_tousecs(int msgc, struct i2c_msg_s *msgs);
+static uint32_t
+s32k1xx_lpi2c_toticks(int msgc, struct i2c_msg_s *msgs);
#endif /* CONFIG_S32K1XX_I2C_DYNTIMEO */
static inline int
@@ -430,7 +430,7 @@ s32k1xx_lpi2c_sem_wait(struct s32k1xx_lpi2c_priv_s *priv)
}
/****************************************************************************
- * Name: s32k1xx_lpi2c_tousecs
+ * Name: s32k1xx_lpi2c_toticks
*
* Description:
* Return a micro-second delay based on the number of bytes left to be
@@ -439,7 +439,7 @@ s32k1xx_lpi2c_sem_wait(struct s32k1xx_lpi2c_priv_s *priv)
****************************************************************************/
#ifdef CONFIG_S32K1XX_I2C_DYNTIMEO
-static useconds_t s32k1xx_lpi2c_tousecs(int msgc, struct i2c_msg_s *msgs)
+static uint32_t s32k1xx_lpi2c_toticks(int msgc, struct i2c_msg_s *msgs)
{
size_t bytecount = 0;
int i;
@@ -455,7 +455,7 @@ static useconds_t s32k1xx_lpi2c_tousecs(int msgc, struct
i2c_msg_s *msgs)
* factor.
*/
- return (useconds_t)(CONFIG_S32K1XX_I2C_DYNTIMEO_USECPERBYTE * bytecount);
+ return USEC2TICK(CONFIG_S32K1XX_I2C_DYNTIMEO_USECPERBYTE * bytecount);
}
#endif
@@ -514,7 +514,7 @@ s32k1xx_lpi2c_sem_waitdone(struct s32k1xx_lpi2c_priv_s
*priv)
#ifdef CONFIG_S32K1XX_I2C_DYNTIMEO
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
- USEC2TICK(s32k1xx_lpi2c_tousecs(priv->msgc, priv->msgv)));
+ s32k1xx_lpi2c_toticks(priv->msgc, priv->msgv));
#else
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
CONFIG_S32K1XX_I2CTIMEOTICKS);
@@ -571,7 +571,7 @@ s32k1xx_lpi2c_sem_waitdone(struct s32k1xx_lpi2c_priv_s
*priv)
/* Get the timeout value */
#ifdef CONFIG_S32K1XX_I2C_DYNTIMEO
- timeout = USEC2TICK(s32k1xx_lpi2c_tousecs(priv->msgc, priv->msgv));
+ timeout = s32k1xx_lpi2c_toticks(priv->msgc, priv->msgv);
#else
timeout = CONFIG_S32K1XX_I2CTIMEOTICKS;
#endif
diff --git a/arch/arm/src/stm32/stm32_i2c.c b/arch/arm/src/stm32/stm32_i2c.c
index 877b6a91c3..78977f5df3 100644
--- a/arch/arm/src/stm32/stm32_i2c.c
+++ b/arch/arm/src/stm32/stm32_i2c.c
@@ -272,7 +272,7 @@ static inline void stm32_i2c_modifyreg(struct
stm32_i2c_priv_s *priv,
uint16_t setbits);
#ifdef CONFIG_STM32_I2C_DYNTIMEO
-static useconds_t stm32_i2c_tousecs(int msgc, struct i2c_msg_s *msgs);
+static uint32_t stm32_i2c_toticks(int msgc, struct i2c_msg_s *msgs);
#endif /* CONFIG_STM32_I2C_DYNTIMEO */
static inline int stm32_i2c_sem_waitdone(struct stm32_i2c_priv_s *priv);
@@ -488,7 +488,7 @@ static inline void stm32_i2c_modifyreg(struct
stm32_i2c_priv_s *priv,
}
/****************************************************************************
- * Name: stm32_i2c_tousecs
+ * Name: stm32_i2c_toticks
*
* Description:
* Return a micro-second delay based on the number of bytes left to be
@@ -497,7 +497,7 @@ static inline void stm32_i2c_modifyreg(struct
stm32_i2c_priv_s *priv,
****************************************************************************/
#ifdef CONFIG_STM32_I2C_DYNTIMEO
-static useconds_t stm32_i2c_tousecs(int msgc, struct i2c_msg_s *msgs)
+static uint32_t stm32_i2c_toticks(int msgc, struct i2c_msg_s *msgs)
{
size_t bytecount = 0;
int i;
@@ -513,7 +513,7 @@ static useconds_t stm32_i2c_tousecs(int msgc, struct
i2c_msg_s *msgs)
* factor.
*/
- return (useconds_t)(CONFIG_STM32_I2C_DYNTIMEO_USECPERBYTE * bytecount);
+ return USEC2TICK(CONFIG_STM32_I2C_DYNTIMEO_USECPERBYTE * bytecount);
}
#endif
@@ -552,7 +552,7 @@ static inline int stm32_i2c_sem_waitdone(struct
stm32_i2c_priv_s *priv)
#ifdef CONFIG_STM32_I2C_DYNTIMEO
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
- USEC2TICK(stm32_i2c_tousecs(priv->msgc, priv->msgv)));
+ stm32_i2c_toticks(priv->msgc, priv->msgv));
#else
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
CONFIG_STM32_I2CTIMEOTICKS);
@@ -596,7 +596,7 @@ static inline int stm32_i2c_sem_waitdone(struct
stm32_i2c_priv_s *priv)
/* Get the timeout value */
#ifdef CONFIG_STM32_I2C_DYNTIMEO
- timeout = USEC2TICK(stm32_i2c_tousecs(priv->msgc, priv->msgv));
+ timeout = stm32_i2c_toticks(priv->msgc, priv->msgv);
#else
timeout = CONFIG_STM32_I2CTIMEOTICKS;
#endif
diff --git a/arch/arm/src/stm32/stm32_i2c_alt.c
b/arch/arm/src/stm32/stm32_i2c_alt.c
index 4f1ac39161..16e4464a33 100644
--- a/arch/arm/src/stm32/stm32_i2c_alt.c
+++ b/arch/arm/src/stm32/stm32_i2c_alt.c
@@ -323,7 +323,7 @@ static inline void stm32_i2c_modifyreg(struct
stm32_i2c_priv_s *priv,
uint16_t setbits);
#ifdef CONFIG_STM32_I2C_DYNTIMEO
-static useconds_t stm32_i2c_tousecs(int msgc, struct i2c_msg_s *msgs);
+static uint32_t stm32_i2c_toticks(int msgc, struct i2c_msg_s *msgs);
#endif /* CONFIG_STM32_I2C_DYNTIMEO */
static inline int stm32_i2c_sem_waitdone(struct stm32_i2c_priv_s *priv);
@@ -518,7 +518,7 @@ static inline void stm32_i2c_modifyreg(struct
stm32_i2c_priv_s *priv,
}
/****************************************************************************
- * Name: stm32_i2c_tousecs
+ * Name: stm32_i2c_toticks
*
* Description:
* Return a micro-second delay based on the number of bytes left to be
@@ -527,7 +527,7 @@ static inline void stm32_i2c_modifyreg(struct
stm32_i2c_priv_s *priv,
****************************************************************************/
#ifdef CONFIG_STM32_I2C_DYNTIMEO
-static useconds_t stm32_i2c_tousecs(int msgc, struct i2c_msg_s *msgs)
+static uint32_t stm32_i2c_toticks(int msgc, struct i2c_msg_s *msgs)
{
size_t bytecount = 0;
int i;
@@ -543,7 +543,7 @@ static useconds_t stm32_i2c_tousecs(int msgc, struct
i2c_msg_s *msgs)
* factor.
*/
- return (useconds_t)(CONFIG_STM32_I2C_DYNTIMEO_USECPERBYTE * bytecount);
+ return USEC2TICK(CONFIG_STM32_I2C_DYNTIMEO_USECPERBYTE * bytecount);
}
#endif
@@ -582,7 +582,7 @@ static int stm32_i2c_sem_waitdone(struct stm32_i2c_priv_s
*priv)
#ifdef CONFIG_STM32_I2C_DYNTIMEO
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
- USEC2TICK(stm32_i2c_tousecs(priv->msgc, priv->msgv)));
+ stm32_i2c_toticks(priv->msgc, priv->msgv));
#else
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
CONFIG_STM32_I2CTIMEOTICKS);
@@ -626,7 +626,7 @@ static int stm32_i2c_sem_waitdone(struct stm32_i2c_priv_s
*priv)
/* Get the timeout value */
#ifdef CONFIG_STM32_I2C_DYNTIMEO
- timeout = USEC2TICK(stm32_i2c_tousecs(priv->msgc, priv->msgv));
+ timeout = stm32_i2c_toticks(priv->msgc, priv->msgv);
#else
timeout = CONFIG_STM32_I2CTIMEOTICKS;
#endif
diff --git a/arch/arm/src/stm32/stm32_i2c_v2.c
b/arch/arm/src/stm32/stm32_i2c_v2.c
index 2714cd16c5..2af25b64d0 100644
--- a/arch/arm/src/stm32/stm32_i2c_v2.c
+++ b/arch/arm/src/stm32/stm32_i2c_v2.c
@@ -454,7 +454,7 @@ static inline void stm32_i2c_modifyreg32(struct
stm32_i2c_priv_s *priv,
uint8_t offset, uint32_t clearbits,
uint32_t setbits);
#ifdef CONFIG_STM32_I2C_DYNTIMEO
-static useconds_t stm32_i2c_tousecs(int msgc, struct i2c_msg_s *msgs);
+static uint32_t stm32_i2c_toticks(int msgc, struct i2c_msg_s *msgs);
#endif /* CONFIG_STM32_I2C_DYNTIMEO */
static inline int stm32_i2c_sem_waitdone(struct stm32_i2c_priv_s *priv);
static inline void stm32_i2c_sem_waitstop(struct stm32_i2c_priv_s *priv);
@@ -712,7 +712,7 @@ static inline void stm32_i2c_modifyreg32(struct
stm32_i2c_priv_s *priv,
}
/****************************************************************************
- * Name: stm32_i2c_tousecs
+ * Name: stm32_i2c_toticks
*
* Description:
* Return a micro-second delay based on the number of bytes left to be
@@ -721,7 +721,7 @@ static inline void stm32_i2c_modifyreg32(struct
stm32_i2c_priv_s *priv,
****************************************************************************/
#ifdef CONFIG_STM32_I2C_DYNTIMEO
-static useconds_t stm32_i2c_tousecs(int msgc, struct i2c_msg_s *msgs)
+static uint32_t stm32_i2c_toticks(int msgc, struct i2c_msg_s *msgs)
{
size_t bytecount = 0;
int i;
@@ -737,7 +737,7 @@ static useconds_t stm32_i2c_tousecs(int msgc, struct
i2c_msg_s *msgs)
* factor.
*/
- return (useconds_t)(CONFIG_STM32_I2C_DYNTIMEO_USECPERBYTE * bytecount);
+ return USEC2TICK(CONFIG_STM32_I2C_DYNTIMEO_USECPERBYTE * bytecount);
}
#endif
@@ -795,7 +795,7 @@ static inline int stm32_i2c_sem_waitdone(struct
stm32_i2c_priv_s *priv)
#ifdef CONFIG_STM32_I2C_DYNTIMEO
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
- USEC2TICK(stm32_i2c_tousecs(priv->msgc, priv->msgv)));
+ stm32_i2c_toticks(priv->msgc, priv->msgv));
#else
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
CONFIG_STM32_I2CTIMEOTICKS);
@@ -837,7 +837,7 @@ static inline int stm32_i2c_sem_waitdone(struct
stm32_i2c_priv_s *priv)
/* Get the timeout value */
#ifdef CONFIG_STM32_I2C_DYNTIMEO
- timeout = USEC2TICK(stm32_i2c_tousecs(priv->msgc, priv->msgv));
+ timeout = stm32_i2c_toticks(priv->msgc, priv->msgv);
#else
timeout = CONFIG_STM32_I2CTIMEOTICKS;
#endif
diff --git a/arch/arm/src/stm32/stm32f40xxx_i2c.c
b/arch/arm/src/stm32/stm32f40xxx_i2c.c
index bd367ce3c6..b86ccbd362 100644
--- a/arch/arm/src/stm32/stm32f40xxx_i2c.c
+++ b/arch/arm/src/stm32/stm32f40xxx_i2c.c
@@ -312,7 +312,7 @@ static inline void stm32_i2c_modifyreg(struct
stm32_i2c_priv_s *priv,
uint16_t setbits);
#ifdef CONFIG_STM32_I2C_DYNTIMEO
-static useconds_t stm32_i2c_tousecs(int msgc, struct i2c_msg_s *msgs);
+static uint32_t stm32_i2c_toticks(int msgc, struct i2c_msg_s *msgs);
#endif /* CONFIG_STM32_I2C_DYNTIMEO */
static inline int stm32_i2c_sem_waitdone(struct stm32_i2c_priv_s *priv);
@@ -541,7 +541,7 @@ static inline void stm32_i2c_modifyreg(struct
stm32_i2c_priv_s *priv,
}
/****************************************************************************
- * Name: stm32_i2c_tousecs
+ * Name: stm32_i2c_toticks
*
* Description:
* Return a micro-second delay based on the number of bytes left to be
@@ -550,7 +550,7 @@ static inline void stm32_i2c_modifyreg(struct
stm32_i2c_priv_s *priv,
****************************************************************************/
#ifdef CONFIG_STM32_I2C_DYNTIMEO
-static useconds_t stm32_i2c_tousecs(int msgc, struct i2c_msg_s *msgs)
+static uint32_t stm32_i2c_toticks(int msgc, struct i2c_msg_s *msgs)
{
size_t bytecount = 0;
int i;
@@ -566,7 +566,7 @@ static useconds_t stm32_i2c_tousecs(int msgc, struct
i2c_msg_s *msgs)
* factor.
*/
- return (useconds_t)(CONFIG_STM32_I2C_DYNTIMEO_USECPERBYTE * bytecount);
+ return USEC2TICK(CONFIG_STM32_I2C_DYNTIMEO_USECPERBYTE * bytecount);
}
#endif
@@ -605,7 +605,7 @@ static inline int stm32_i2c_sem_waitdone(struct
stm32_i2c_priv_s *priv)
#ifdef CONFIG_STM32_I2C_DYNTIMEO
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
- USEC2TICK(stm32_i2c_tousecs(priv->msgc, priv->msgv)));
+ stm32_i2c_toticks(priv->msgc, priv->msgv));
#else
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
CONFIG_STM32_I2CTIMEOTICKS);
@@ -649,7 +649,7 @@ static inline int stm32_i2c_sem_waitdone(struct
stm32_i2c_priv_s *priv)
/* Get the timeout value */
#ifdef CONFIG_STM32_I2C_DYNTIMEO
- timeout = USEC2TICK(stm32_i2c_tousecs(priv->msgc, priv->msgv));
+ timeout = stm32_i2c_toticks(priv->msgc, priv->msgv);
#else
timeout = CONFIG_STM32_I2CTIMEOTICKS;
#endif
diff --git a/arch/arm/src/stm32f0l0g0/stm32_i2c.c
b/arch/arm/src/stm32f0l0g0/stm32_i2c.c
index 550dd10f07..95e8e7d3ec 100644
--- a/arch/arm/src/stm32f0l0g0/stm32_i2c.c
+++ b/arch/arm/src/stm32f0l0g0/stm32_i2c.c
@@ -456,7 +456,7 @@ static inline void stm32_i2c_modifyreg32(struct
stm32_i2c_priv_s *priv,
uint32_t setbits);
static inline int stm32_i2c_sem_wait(struct i2c_master_s *dev);
#ifdef CONFIG_STM32F0L0G0_I2C_DYNTIMEO
-static useconds_t stm32_i2c_tousecs(int msgc, struct i2c_msg_s *msgs);
+static uint32_t stm32_i2c_toticks(int msgc, struct i2c_msg_s *msgs);
#endif /* CONFIG_STM32F0L0G0_I2C_DYNTIMEO */
static inline int stm32_i2c_sem_waitdone(struct stm32_i2c_priv_s *priv);
static inline void stm32_i2c_sem_waitstop(struct stm32_i2c_priv_s *priv);
@@ -724,7 +724,7 @@ static inline int stm32_i2c_sem_wait(struct i2c_master_s
*dev)
}
/****************************************************************************
- * Name: stm32_i2c_tousecs
+ * Name: stm32_i2c_toticks
*
* Description:
* Return a micro-second delay based on the number of bytes left to be
@@ -733,7 +733,7 @@ static inline int stm32_i2c_sem_wait(struct i2c_master_s
*dev)
****************************************************************************/
#ifdef CONFIG_STM32F0L0G0_I2C_DYNTIMEO
-static useconds_t stm32_i2c_tousecs(int msgc, struct i2c_msg_s *msgs)
+static uint32_t stm32_i2c_toticks(int msgc, struct i2c_msg_s *msgs)
{
size_t bytecount = 0;
int i;
@@ -749,8 +749,7 @@ static useconds_t stm32_i2c_tousecs(int msgc, struct
i2c_msg_s *msgs)
* factor.
*/
- return (useconds_t)(CONFIG_STM32F0L0G0_I2C_DYNTIMEO_USECPERBYTE *
- bytecount);
+ return USEC2TICK(CONFIG_STM32F0L0G0_I2C_DYNTIMEO_USECPERBYTE * bytecount);
}
#endif
@@ -809,7 +808,7 @@ static inline int stm32_i2c_sem_waitdone(struct
stm32_i2c_priv_s *priv)
#ifdef CONFIG_STM32F0L0G0_I2C_DYNTIMEO
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
- USEC2TICK(stm32_i2c_tousecs(priv->msgc, priv->msgv)));
+ stm32_i2c_toticks(priv->msgc, priv->msgv));
#else
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
CONFIG_STM32F0L0G0_I2CTIMEOTICKS);
@@ -851,7 +850,7 @@ static inline int stm32_i2c_sem_waitdone(struct
stm32_i2c_priv_s *priv)
/* Get the timeout value */
#ifdef CONFIG_STM32F0L0G0_I2C_DYNTIMEO
- timeout = USEC2TICK(stm32_i2c_tousecs(priv->msgc, priv->msgv));
+ timeout = stm32_i2c_toticks(priv->msgc, priv->msgv);
#else
timeout = CONFIG_STM32F0L0G0_I2CTIMEOTICKS;
#endif
diff --git a/arch/arm/src/stm32f7/stm32_i2c.c b/arch/arm/src/stm32f7/stm32_i2c.c
index 35f7ecafcb..c7938d9349 100644
--- a/arch/arm/src/stm32f7/stm32_i2c.c
+++ b/arch/arm/src/stm32f7/stm32_i2c.c
@@ -491,7 +491,7 @@ static inline void stm32_i2c_modifyreg32(struct
stm32_i2c_priv_s *priv,
uint8_t offset, uint32_t clearbits,
uint32_t setbits);
#ifdef CONFIG_STM32F7_I2C_DYNTIMEO
-static useconds_t stm32_i2c_tousecs(int msgc, struct i2c_msg_s *msgs);
+static uint32_t stm32_i2c_toticks(int msgc, struct i2c_msg_s *msgs);
#endif /* CONFIG_STM32F7_I2C_DYNTIMEO */
static inline int stm32_i2c_sem_waitdone(struct stm32_i2c_priv_s *priv);
static inline void stm32_i2c_sem_waitstop(struct stm32_i2c_priv_s *priv);
@@ -749,7 +749,7 @@ static inline void stm32_i2c_modifyreg32(struct
stm32_i2c_priv_s *priv,
}
/****************************************************************************
- * Name: stm32_i2c_tousecs
+ * Name: stm32_i2c_toticks
*
* Description:
* Return a micro-second delay based on the number of bytes left to be
@@ -758,7 +758,7 @@ static inline void stm32_i2c_modifyreg32(struct
stm32_i2c_priv_s *priv,
****************************************************************************/
#ifdef CONFIG_STM32F7_I2C_DYNTIMEO
-static useconds_t stm32_i2c_tousecs(int msgc, struct i2c_msg_s *msgs)
+static uint32_t stm32_i2c_toticks(int msgc, struct i2c_msg_s *msgs)
{
size_t bytecount = 0;
int i;
@@ -774,7 +774,7 @@ static useconds_t stm32_i2c_tousecs(int msgc, struct
i2c_msg_s *msgs)
* factor.
*/
- return (useconds_t)(CONFIG_STM32F7_I2C_DYNTIMEO_USECPERBYTE * bytecount);
+ return USEC2TICK(CONFIG_STM32F7_I2C_DYNTIMEO_USECPERBYTE * bytecount);
}
#endif
@@ -832,7 +832,7 @@ static inline int stm32_i2c_sem_waitdone(struct
stm32_i2c_priv_s *priv)
#ifdef CONFIG_STM32F7_I2C_DYNTIMEO
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
- USEC2TICK(stm32_i2c_tousecs(priv->msgc, priv->msgv)));
+ stm32_i2c_toticks(priv->msgc, priv->msgv));
#else
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
CONFIG_STM32F7_I2CTIMEOTICKS);
@@ -874,7 +874,7 @@ static inline int stm32_i2c_sem_waitdone(struct
stm32_i2c_priv_s *priv)
/* Get the timeout value */
#ifdef CONFIG_STM32F7_I2C_DYNTIMEO
- timeout = USEC2TICK(stm32_i2c_tousecs(priv->msgc, priv->msgv));
+ timeout = stm32_i2c_toticks(priv->msgc, priv->msgv);
#else
timeout = CONFIG_STM32F7_I2CTIMEOTICKS;
#endif
diff --git a/arch/arm/src/stm32h7/stm32_i2c.c b/arch/arm/src/stm32h7/stm32_i2c.c
index b19d722aee..65bcbeb750 100644
--- a/arch/arm/src/stm32h7/stm32_i2c.c
+++ b/arch/arm/src/stm32h7/stm32_i2c.c
@@ -450,7 +450,7 @@ static inline void stm32_i2c_modifyreg32(struct
stm32_i2c_priv_s *priv,
uint8_t offset, uint32_t clearbits,
uint32_t setbits);
#ifdef CONFIG_STM32H7_I2C_DYNTIMEO
-static useconds_t stm32_i2c_tousecs(int msgc, struct i2c_msg_s *msgs);
+static uint32_t stm32_i2c_toticks(int msgc, struct i2c_msg_s *msgs);
#endif /* CONFIG_STM32H7_I2C_DYNTIMEO */
static inline int stm32_i2c_sem_waitdone(struct stm32_i2c_priv_s *priv);
static inline void stm32_i2c_sem_waitstop(struct stm32_i2c_priv_s *priv);
@@ -708,7 +708,7 @@ static inline void stm32_i2c_modifyreg32(struct
stm32_i2c_priv_s *priv,
}
/****************************************************************************
- * Name: stm32_i2c_tousecs
+ * Name: stm32_i2c_toticks
*
* Description:
* Return a micro-second delay based on the number of bytes left to be
@@ -717,7 +717,7 @@ static inline void stm32_i2c_modifyreg32(struct
stm32_i2c_priv_s *priv,
****************************************************************************/
#ifdef CONFIG_STM32H7_I2C_DYNTIMEO
-static useconds_t stm32_i2c_tousecs(int msgc, struct i2c_msg_s *msgs)
+static uint32_t stm32_i2c_toticks(int msgc, struct i2c_msg_s *msgs)
{
size_t bytecount = 0;
int i;
@@ -733,7 +733,7 @@ static useconds_t stm32_i2c_tousecs(int msgc, struct
i2c_msg_s *msgs)
* factor.
*/
- return (useconds_t)(CONFIG_STM32H7_I2C_DYNTIMEO_USECPERBYTE * bytecount);
+ return USEC2TICK(CONFIG_STM32H7_I2C_DYNTIMEO_USECPERBYTE * bytecount);
}
#endif
@@ -791,7 +791,7 @@ static inline int stm32_i2c_sem_waitdone(struct
stm32_i2c_priv_s *priv)
#ifdef CONFIG_STM32H7_I2C_DYNTIMEO
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
- USEC2TICK(stm32_i2c_tousecs(priv->msgc, priv->msgv)));
+ stm32_i2c_toticks(priv->msgc, priv->msgv));
#else
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
CONFIG_STM32H7_I2CTIMEOTICKS);
@@ -833,7 +833,7 @@ static inline int stm32_i2c_sem_waitdone(struct
stm32_i2c_priv_s *priv)
/* Get the timeout value */
#ifdef CONFIG_STM32H7_I2C_DYNTIMEO
- timeout = USEC2TICK(stm32_i2c_tousecs(priv->msgc, priv->msgv));
+ timeout = stm32_i2c_toticks(priv->msgc, priv->msgv);
#else
timeout = CONFIG_STM32H7_I2CTIMEOTICKS;
#endif
diff --git a/arch/arm/src/stm32l4/stm32l4_i2c.c
b/arch/arm/src/stm32l4/stm32l4_i2c.c
index ee939589cf..5aeab2790a 100644
--- a/arch/arm/src/stm32l4/stm32l4_i2c.c
+++ b/arch/arm/src/stm32l4/stm32l4_i2c.c
@@ -489,7 +489,7 @@ void stm32l4_i2c_modifyreg32(struct stm32l4_i2c_priv_s
*priv,
uint8_t offset, uint32_t clearbits,
uint32_t setbits);
#ifdef CONFIG_STM32L4_I2C_DYNTIMEO
-static useconds_t stm32l4_i2c_tousecs(int msgc, struct i2c_msg_s *msgs);
+static uint32_t stm32l4_i2c_toticks(int msgc, struct i2c_msg_s *msgs);
#endif /* CONFIG_STM32L4_I2C_DYNTIMEO */
static inline
int stm32l4_i2c_sem_waitdone(struct stm32l4_i2c_priv_s *priv);
@@ -754,7 +754,7 @@ void stm32l4_i2c_modifyreg32(struct stm32l4_i2c_priv_s
*priv,
}
/****************************************************************************
- * Name: stm32l4_i2c_tousecs
+ * Name: stm32l4_i2c_toticks
*
* Description:
* Return a micro-second delay based on the number of bytes left to be
@@ -763,7 +763,7 @@ void stm32l4_i2c_modifyreg32(struct stm32l4_i2c_priv_s
*priv,
****************************************************************************/
#ifdef CONFIG_STM32L4_I2C_DYNTIMEO
-static useconds_t stm32l4_i2c_tousecs(int msgc, struct i2c_msg_s *msgs)
+static uint32_t stm32l4_i2c_toticks(int msgc, struct i2c_msg_s *msgs)
{
size_t bytecount = 0;
int i;
@@ -779,7 +779,7 @@ static useconds_t stm32l4_i2c_tousecs(int msgc, struct
i2c_msg_s *msgs)
* factor.
*/
- return (useconds_t)(CONFIG_STM32L4_I2C_DYNTIMEO_USECPERBYTE * bytecount);
+ return USEC2TICK(CONFIG_STM32L4_I2C_DYNTIMEO_USECPERBYTE * bytecount);
}
#endif
@@ -839,7 +839,7 @@ int stm32l4_i2c_sem_waitdone(struct stm32l4_i2c_priv_s
*priv)
#ifdef CONFIG_STM32L4_I2C_DYNTIMEO
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
- USEC2TICK(stm32l4_i2c_tousecs(priv->msgc, priv->msgv)));
+ stm32l4_i2c_toticks(priv->msgc, priv->msgv));
#else
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
CONFIG_STM32L4_I2CTIMEOTICKS);
@@ -882,7 +882,7 @@ int stm32l4_i2c_sem_waitdone(struct stm32l4_i2c_priv_s
*priv)
/* Get the timeout value */
#ifdef CONFIG_STM32L4_I2C_DYNTIMEO
- timeout = USEC2TICK(stm32l4_i2c_tousecs(priv->msgc, priv->msgv));
+ timeout = stm32l4_i2c_toticks(priv->msgc, priv->msgv);
#else
timeout = CONFIG_STM32L4_I2CTIMEOTICKS;
#endif
diff --git a/arch/arm/src/tiva/common/tiva_i2c.c
b/arch/arm/src/tiva/common/tiva_i2c.c
index 95fceb1390..ddbb7a3e89 100644
--- a/arch/arm/src/tiva/common/tiva_i2c.c
+++ b/arch/arm/src/tiva/common/tiva_i2c.c
@@ -252,7 +252,7 @@ static inline void tiva_i2c_putreg(struct tiva_i2c_priv_s
*priv,
#endif
#ifdef CONFIG_TIVA_I2C_DYNTIMEO
-static useconds_t tiva_i2c_tousecs(int msgc, struct i2c_msg_s *msgv);
+static uint32_t tiva_i2c_toticks(int msgc, struct i2c_msg_s *msgv);
#endif /* CONFIG_TIVA_I2C_DYNTIMEO */
static inline int tiva_i2c_sem_waitdone(struct tiva_i2c_priv_s *priv);
@@ -631,7 +631,7 @@ static inline void tiva_i2c_putreg(struct tiva_i2c_priv_s
*priv,
#endif
/****************************************************************************
- * Name: tiva_i2c_tousecs
+ * Name: tiva_i2c_toticks
*
* Description:
* Return a micro-second delay based on the number of bytes left to be
@@ -640,7 +640,7 @@ static inline void tiva_i2c_putreg(struct tiva_i2c_priv_s
*priv,
****************************************************************************/
#ifdef CONFIG_TIVA_I2C_DYNTIMEO
-static useconds_t tiva_i2c_tousecs(int msgc, struct i2c_msg_s *msgv)
+static uint32_t tiva_i2c_toticks(int msgc, struct i2c_msg_s *msgv)
{
size_t bytecount = 0;
int i;
@@ -656,7 +656,7 @@ static useconds_t tiva_i2c_tousecs(int msgc, struct
i2c_msg_s *msgv)
* factor.
*/
- return (useconds_t)(CONFIG_TIVA_I2C_DYNTIMEO_USECPERBYTE * bytecount);
+ return USEC2TICK(CONFIG_TIVA_I2C_DYNTIMEO_USECPERBYTE * bytecount);
}
#endif
@@ -694,7 +694,7 @@ static inline int tiva_i2c_sem_waitdone(struct
tiva_i2c_priv_s *priv)
#ifdef CONFIG_TIVA_I2C_DYNTIMEO
ret = nxsem_tickwait_uninterruptible(&priv->waitsem,
- USEC2TICK(tiva_i2c_tousecs(priv->msgc, priv->msgv)));
+ tiva_i2c_toticks(priv->msgc, priv->msgv));
#else
ret = nxsem_tickwait_uninterruptible(&priv->waitsem,
CONFIG_TIVA_I2C_TIMEOTICKS);
@@ -739,7 +739,7 @@ static inline int tiva_i2c_sem_waitdone(struct
tiva_i2c_priv_s *priv)
/* Get the timeout value */
#ifdef CONFIG_TIVA_I2C_DYNTIMEO
- timeout = USEC2TICK(tiva_i2c_tousecs(priv->msgc, priv->msgv));
+ timeout = tiva_i2c_toticks(priv->msgc, priv->msgv);
#else
timeout = CONFIG_TIVA_I2C_TIMEOTICKS;
#endif
diff --git a/arch/mips/src/pic32mz/pic32mz_i2c.c
b/arch/mips/src/pic32mz/pic32mz_i2c.c
index 35af74ea1a..3307442a2a 100644
--- a/arch/mips/src/pic32mz/pic32mz_i2c.c
+++ b/arch/mips/src/pic32mz/pic32mz_i2c.c
@@ -228,7 +228,7 @@ static inline void pic32mz_i2c_modifyreg(struct
pic32mz_i2c_priv_s *priv,
uint32_t setbits);
#ifdef CONFIG_PICM32MZ_I2C_DYNTIMEO
-static useconds_t pic32mz_i2c_tousecs(int msgc, struct i2c_msg_s *msgs);
+static uint32_t pic32mz_i2c_toticks(int msgc, struct i2c_msg_s *msgs);
#endif /* CONFIG_PIC32MZ_I2C_DYNTIMEO */
static inline int
@@ -616,7 +616,7 @@ static inline void pic32mz_i2c_modifyreg(struct
pic32mz_i2c_priv_s *priv,
}
/****************************************************************************
- * Name: pic32mz_i2c_tousecs
+ * Name: pic32mz_i2c_toticks
*
* Description:
* Return a micro-second delay based on the number of bytes left to be
@@ -625,7 +625,7 @@ static inline void pic32mz_i2c_modifyreg(struct
pic32mz_i2c_priv_s *priv,
****************************************************************************/
#ifdef CONFIG_PIC32MZ_I2C_DYNTIMEO
-static useconds_t pic32mz_i2c_tousecs(int msgc, struct i2c_msg_s *msgs)
+static uint32_t pic32mz_i2c_toticks(int msgc, struct i2c_msg_s *msgs)
{
size_t bytecount = 0;
int i;
@@ -641,7 +641,7 @@ static useconds_t pic32mz_i2c_tousecs(int msgc, struct
i2c_msg_s *msgs)
* factor.
*/
- return (useconds_t)(CONFIG_PIC32MZ_I2C_DYNTIMEO_USECPERBYTE * bytecount);
+ return USEC2TICK(CONFIG_PIC32MZ_I2C_DYNTIMEO_USECPERBYTE * bytecount);
}
#endif
@@ -675,7 +675,7 @@ pic32mz_i2c_sem_waitdone(struct pic32mz_i2c_priv_s *priv)
#ifdef CONFIG_PIC32MZ_I2C_DYNTIMEO
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
- USEC2TICK(pic32mz_i2c_tousecs(priv->msgc, priv->msgv)));
+ pic32mz_i2c_toticks(priv->msgc, priv->msgv));
#else
ret = nxsem_tickwait_uninterruptible(&priv->sem_isr,
CONFIG_PIC32MZ_I2CTIMEOTICKS);
@@ -720,7 +720,7 @@ pic32mz_i2c_sem_waitdone(struct pic32mz_i2c_priv_s *priv)
/* Get the timeout value */
#ifdef CONFIG_PIC32MZ_I2C_DYNTIMEO
- timeout = USEC2TICK(pic32mz_i2c_tousecs(priv->msgc, priv->msgv));
+ timeout = pic32mz_i2c_toticks(priv->msgc, priv->msgv);
#else
timeout = CONFIG_PIC32MZ_I2CTIMEOTICKS;
#endif