[errno code][-RT_ETIMEOUT] fix that use RT_ETIMEOUT without -

This commit is contained in:
Meco Man 2023-03-21 15:38:02 -04:00 committed by Man, Jianting (Meco)
parent 87c57f86f7
commit eb3cb250be
13 changed files with 44 additions and 44 deletions

View File

@ -341,7 +341,7 @@ static rt_err_t apm32_adc_get_value(struct rt_adc_device *device, rt_uint32_t ch
{
if (++counter > DRV_ADC_TIME_OUT)
{
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
}
@ -351,7 +351,7 @@ static rt_err_t apm32_adc_get_value(struct rt_adc_device *device, rt_uint32_t ch
{
if (++counter > DRV_ADC_TIME_OUT)
{
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
}
*value = ADC_ReadConversionValue(adc_cfg->adc);
@ -363,7 +363,7 @@ static rt_err_t apm32_adc_get_value(struct rt_adc_device *device, rt_uint32_t ch
{
if (++counter > DRV_ADC_TIME_OUT)
{
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
}
*value = ADC_ReadConversionValue(adc_cfg->adc);
@ -376,7 +376,7 @@ static rt_err_t apm32_adc_get_value(struct rt_adc_device *device, rt_uint32_t ch
{
if (++counter > DRV_ADC_TIME_OUT)
{
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
}
*value = ADC_ReadConversionValue();

View File

@ -57,7 +57,7 @@ static rt_err_t apm32_rtc_init(void)
{
if (++counter > DRV_RTC_TIME_OUT)
{
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
}
RCM_ConfigRTCCLK(RCM_RTCCLK_LSI);
@ -68,7 +68,7 @@ static rt_err_t apm32_rtc_init(void)
{
if (++counter > DRV_RTC_TIME_OUT)
{
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
}
RCM_ConfigRTCCLK(RCM_RTCCLK_LSE);
@ -83,7 +83,7 @@ static rt_err_t apm32_rtc_init(void)
{
if (++counter > DRV_RTC_TIME_OUT)
{
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
}
@ -140,7 +140,7 @@ static rt_err_t apm32_rtc_get_secs(void *args)
{
if (++counter > DRV_RTC_TIME_OUT)
{
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
}
@ -162,7 +162,7 @@ static rt_err_t apm32_rtc_set_secs(void *args)
{
if (++counter > DRV_RTC_TIME_OUT)
{
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
}

View File

@ -101,7 +101,7 @@ static rt_err_t cmd_data(U16 cmd, U32 arg, U16 mode, U16 blk_len, U16 num, U16 m
if (!to)
{
EOUT("%s TIMEOUT\n", __FUNCTION__);
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
#endif
}
@ -141,7 +141,7 @@ static rt_err_t cmd_response(U16 Cmd, U32 Arg, U16 TransMode, U16 BlkLen, U16 No
if (!to)
{
EOUT("%s Timeout\n", __FUNCTION__);
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
#endif
}
@ -179,7 +179,7 @@ static rt_err_t cmd_wait(U16 Cmd, U32 Arg, U16 IntMask)
if (!to)
{
EOUT("%s Timeout\n", __FUNCTION__);
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
#endif
@ -221,7 +221,7 @@ static rt_err_t sd_init(void)
if (err != RT_EOK)
{
EOUT("cmd_wait err in %s\n", __FUNCTION__);
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
#endif
@ -230,14 +230,14 @@ static rt_err_t sd_init(void)
if (err != RT_EOK)
{
EOUT("cmd_wait err in %s\n", __FUNCTION__);
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
#ifdef USE_TIMEOUT
to--;
if (!to)
{
EOUT("%s timeout\n", __FUNCTION__);
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
#endif
@ -325,7 +325,7 @@ static rt_err_t sd_readblock(rt_uint32_t address, rt_uint8_t *buf)
if (!to)
{
EOUT("%s TIMEOUT\n", __FUNCTION__);
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
#endif
}

View File

@ -259,7 +259,7 @@ static rt_ssize_t _spi_recv(SPI_Module *hspi,
{
if ((rt_tick_get() - tickstart) > timeout)
{
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
}
SPI_I2S_TransmitData(hspi, *tx_buff++);
@ -268,7 +268,7 @@ static rt_ssize_t _spi_recv(SPI_Module *hspi,
{
if ((rt_tick_get() - tickstart) > timeout)
{
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
}
dat = SPI_I2S_ReceiveData(hspi);

View File

@ -38,7 +38,7 @@ rt_err_t command_send(sdhi_instance_ctrl_t *p_ctrl, struct rt_mmcsd_cmd *cmd)
{
if (timeout == 0)
{
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
R_BSP_SoftwareDelay(1U, BSP_DELAY_UNITS_MICROSECONDS);
timeout--;

View File

@ -222,7 +222,7 @@ static rt_err_t _hash_update(struct hwcrypto_hash *ctx, const rt_uint8_t *in, rt
{
if (rt_tick_get() - tickstart > 0xFFFF)
{
result = RT_ETIMEOUT;
result = -RT_ETIMEOUT;
goto _exit;
}
}
@ -362,7 +362,7 @@ static rt_err_t _cryp_crypt(struct hwcrypto_symmetric *ctx,
{
if (rt_tick_get() - tickstart > 0xFFFF)
{
result = RT_ETIMEOUT;
result = -RT_ETIMEOUT;
goto _exit;
}
}

View File

@ -194,7 +194,7 @@ static rt_err_t rt_stm32_eth_init(rt_device_t dev)
}
else
{
status = RT_ETIMEOUT;
status = -RT_ETIMEOUT;
}
}
}

View File

@ -169,7 +169,7 @@ static rt_err_t phy_write_reg(uint8_t phy_addr, uint8_t reg_addr, uint16_t reg_v
return RT_EOK;
}
static uint16_t phy_read_reg(uint8_t phy_addr, uint8_t reg_addr)
static rt_ssize_t phy_read_reg(uint8_t phy_addr, uint8_t reg_addr)
{
uint16_t reg_value = 0;
uint32_t status = 0;
@ -194,7 +194,7 @@ static uint16_t phy_read_reg(uint8_t phy_addr, uint8_t reg_addr)
if((rt_tick_get() - tickstart) > ETH_TIME_OUT)
{
LOG_E("PHY read reg %02x timeout!", reg_addr);
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
}
@ -336,7 +336,7 @@ static rt_err_t rt_stm32_eth_init(rt_device_t dev)
{
RT_ASSERT(dev != RT_NULL);
rt_uint32_t status, i;
rt_ssize_t status, i;
volatile rt_uint32_t tickstart = 0;
rt_uint8_t *macAddr = &stm32_eth_device.dev_addr[0];
@ -478,7 +478,7 @@ static rt_err_t rt_stm32_eth_init(rt_device_t dev)
if((rt_tick_get() - tickstart) > ETH_TIME_OUT)
{
LOG_E("PHY software reset timeout!");
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
else
{
@ -711,7 +711,7 @@ void ETH1_IRQHandler(void)
static void phy_linkchange()
{
rt_uint32_t status = 0;
rt_ssize_t status = 0;
/* Read status register to acknowledge the interrupt */
status = phy_read_reg(RTL8211F_PHY_ADDR, RTL8211F_INSR);

View File

@ -115,7 +115,7 @@ static rt_err_t rt_hw_nand_wait_ready(void)
time++;
if (time >= 0X1FFFFFFF)
{
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
}
@ -303,7 +303,7 @@ static rt_err_t _read_page(struct rt_mtd_nand_device *device,
/* Check for the Timeout */
if ((rt_tick_get() - tickstart) > 10000)
{
result = RT_ETIMEOUT;
result = -RT_ETIMEOUT;
goto _exit;
}
}
@ -359,7 +359,7 @@ static rt_err_t _read_page(struct rt_mtd_nand_device *device,
if (rt_hw_nand_wait_ready() != RT_EOK)
{
result = RT_ETIMEOUT;
result = -RT_ETIMEOUT;
goto _exit;
}
@ -430,7 +430,7 @@ static rt_err_t _write_page(struct rt_mtd_nand_device *device,
/* Check for the Timeout */
if ((rt_tick_get() - tickstart) > 10000)
{
result = RT_ETIMEOUT;
result = -RT_ETIMEOUT;
goto _exit;
}
}

View File

@ -152,7 +152,7 @@ static rt_err_t phy_write_reg(uint8_t phy_addr, uint8_t reg_addr, uint16_t reg_v
if((rt_tick_get() - tickstart) > ETH_TIME_OUT)
{
LOG_E("PHY write reg %02x date %04x timeout!", reg_addr, reg_value);
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
}
@ -184,7 +184,7 @@ static uint16_t phy_read_reg(uint8_t phy_addr, uint8_t reg_addr)
if((rt_tick_get() - tickstart) > ETH_TIME_OUT)
{
LOG_E("PHY read reg %02x timeout!", reg_addr);
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
}
@ -468,7 +468,7 @@ static rt_err_t rt_stm32_eth_init(rt_device_t dev)
if((rt_tick_get() - tickstart) > ETH_TIME_OUT)
{
LOG_E("PHY software reset timeout!");
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
else
{

View File

@ -84,7 +84,7 @@ RTM_EXPORT(rt_data_queue_init);
* @param timeout is the waiting time.
*
* @return Return the operation status. When the return value is RT_EOK, the operation is successful.
* When the return value is RT_ETIMEOUT, it means the specified time out.
* When the return value is -RT_ETIMEOUT, it means the specified time out.
*/
rt_err_t rt_data_queue_push(struct rt_data_queue *queue,
const void *data_ptr,
@ -201,7 +201,7 @@ RTM_EXPORT(rt_data_queue_push);
* @param timeout is the waiting time.
*
* @return Return the operation status. When the return value is RT_EOK, the operation is successful.
* When the return value is RT_ETIMEOUT, it means the specified time out.
* When the return value is -RT_ETIMEOUT, it means the specified time out.
*/
rt_err_t rt_data_queue_pop(struct rt_data_queue *queue,
const void **data_ptr,

View File

@ -227,7 +227,7 @@ static rt_err_t _send_cmd(
if (rt_tick_timeout(tick_start, rt_tick_from_millisecond(2000)))
{
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
}
}
@ -296,7 +296,7 @@ static rt_err_t _wait_token(struct rt_spi_device *device, uint8_t token)
if (rt_tick_timeout(tick_start, rt_tick_from_millisecond(CARD_WAIT_TOKEN_TIMES)))
{
MSD_DEBUG("[err] wait data start token timeout!\r\n");
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
} /* wati token */
}
@ -329,7 +329,7 @@ static rt_err_t _wait_ready(struct rt_spi_device *device)
if (rt_tick_timeout(tick_start, rt_tick_from_millisecond(1000)))
{
MSD_DEBUG("[err] wait ready timeout!\r\n");
return RT_ETIMEOUT;
return -RT_ETIMEOUT;
}
}
}
@ -528,7 +528,7 @@ static rt_err_t rt_msd_init(rt_device_t dev)
if (rt_tick_timeout(tick_start, rt_tick_from_millisecond(CARD_TRY_TIMES)))
{
MSD_DEBUG("[err] SD card goto IDLE mode timeout!\r\n");
result = RT_ETIMEOUT;
result = -RT_ETIMEOUT;
goto _exit;
}
}
@ -579,7 +579,7 @@ static rt_err_t rt_msd_init(rt_device_t dev)
if (rt_tick_timeout(tick_start, rt_tick_from_millisecond(200)))
{
MSD_DEBUG("[err] CMD8 SEND_IF_COND timeout!\r\n");
result = RT_ETIMEOUT;
result = -RT_ETIMEOUT;
goto _exit;
}
}
@ -726,7 +726,7 @@ static rt_err_t rt_msd_init(rt_device_t dev)
if (rt_tick_timeout(tick_start, rt_tick_from_millisecond(CARD_TRY_TIMES)))
{
MSD_DEBUG("[err] SD card goto IDLE mode timeout!\r\n");
result = RT_ETIMEOUT;
result = -RT_ETIMEOUT;
goto _exit;
}
} /* send CMD0 goto IDLE stat */
@ -749,7 +749,7 @@ static rt_err_t rt_msd_init(rt_device_t dev)
if (rt_tick_timeout(tick_start, rt_tick_from_millisecond(CARD_TRY_TIMES)))
{
MSD_DEBUG("[err] SD card goto IDLE mode timeout!\r\n");
result = RT_ETIMEOUT;
result = -RT_ETIMEOUT;
goto _exit;
}
} /* send CMD1 */

View File

@ -20,7 +20,7 @@ The sending process of the non-blocking mode mails can be safely used in ISR. It
When a thread sends a message to a mailbox, if the mailbox is not full, the message will be copied to the mailbox. If the mailbox is full, the thread sending the message can set a timeout, and choose to wait and suspend or return directly - RT_EFULL. If the thread sending the message chooses to suspend and wait, then when the mails in the mailbox are received and space is left open again, the thread sending the message will be awaken and will continue to send.
When a thread receives a message from a mailbox, if the mailbox is empty, the thread receiving the message can choose whether to set a timeout or wait and suspend until a new message is received to be awaken. When the set timeout is up and the mailbox still hasn't received the message, the thread that chose to wait till timeout will be awaken and return - RT_ETIMEOUT. If there are messages in the mailbox, then the thread receiving the message will copy the 4-byte message in the mailbox to the receiving cache.
When a thread receives a message from a mailbox, if the mailbox is empty, the thread receiving the message can choose whether to set a timeout or wait and suspend until a new message is received to be awaken. When the set timeout is up and the mailbox still hasn't received the message, the thread that chose to wait till timeout will be awaken and return -RT_ETIMEOUT. If there are messages in the mailbox, then the thread receiving the message will copy the 4-byte message in the mailbox to the receiving cache.
### Mailbox Control Block