arch/i2c: Change xxx_i2c_tousecs to xxx_i2c_toticks

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-05-15 18:47:53 +08:00 committed by Petro Karashchenko
parent f311228f80
commit d3524d4f8b
14 changed files with 85 additions and 87 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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