Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New timeout API #17155

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,10 @@ add_custom_command(
DEPENDS ${syscalls_subdirs_trigger} ${PARSE_SYSCALLS_HEADER_DEPENDS}
)

if(CONFIG_SYS_TIMEOUT_64BIT)
set(GEN_SYSCALLS_EXTRA_ARGS --split-type k_timeout_t)
endif()

add_custom_target(${SYSCALL_LIST_H_TARGET} DEPENDS ${syscall_list_h})
add_custom_command(OUTPUT include/generated/syscall_dispatch.c ${syscall_list_h}
# Also, some files are written to include/generated/syscalls/
Expand All @@ -589,6 +593,7 @@ add_custom_command(OUTPUT include/generated/syscall_dispatch.c ${syscall_list_h}
--base-output include/generated/syscalls # Write to this dir
--syscall-dispatch include/generated/syscall_dispatch.c # Write this file
--syscall-list ${syscall_list_h}
${GEN_SYSCALLS_EXTRA_ARGS}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${syscalls_json}
)
Expand Down
2 changes: 1 addition & 1 deletion boards/arm/nrf52_pca20020/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static int pwr_ctrl_init(struct device *dev)
gpio_pin_configure(gpio, cfg->pin, GPIO_DIR_OUT);
gpio_pin_write(gpio, cfg->pin, 1);

k_sleep(1); /* Wait for the rail to come up and stabilize */
k_msleep(1); /* Wait for the rail to come up and stabilize */

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion boards/arm/nrf9160_pca10090/nrf52840_reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int bt_hci_transport_setup(struct device *h4)
* It is critical (!) to wait here, so that all bytes
* on the lines are received and drained correctly.
*/
k_sleep(1);
k_msleep(1);

/* Drain bytes */
while (uart_fifo_read(h4, &c, 1)) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/adc/adc_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static inline void adc_context_enable_timer(struct adc_context *ctx)
u32_t interval_us = ctx->options.interval_us;
u32_t interval_ms = ceiling_fraction(interval_us, 1000UL);

k_timer_start(&ctx->timer, 0, interval_ms);
k_timer_start(&ctx->timer, K_NO_WAIT, K_TIMEOUT_MS(interval_ms));
}

static inline void adc_context_disable_timer(struct adc_context *ctx)
Expand Down
4 changes: 2 additions & 2 deletions drivers/bluetooth/hci/h5.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,11 +608,11 @@ static void tx_thread(void)
switch (h5.link_state) {
case UNINIT:
/* FIXME: send sync */
k_sleep(100);
k_msleep(100);
break;
case INIT:
/* FIXME: send conf */
k_sleep(100);
k_msleep(100);
break;
case ACTIVE:
buf = net_buf_get(&h5.tx_queue, K_FOREVER);
Expand Down
2 changes: 1 addition & 1 deletion drivers/bluetooth/hci/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ static int bt_spi_send(struct net_buf *buf)
if (!pending) {
break;
}
k_sleep(1);
k_msleep(1);
}

k_sem_take(&sem_busy, K_FOREVER);
Expand Down
2 changes: 1 addition & 1 deletion drivers/console/native_posix_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ static void native_stdio_runner(void *p1, void *p2, void *p3)
while (1) {
s32_t wait_time = attempt_read_from_stdin();

k_sleep(wait_time);
k_msleep(wait_time);
}
}
#endif /* CONFIG_NATIVE_POSIX_STDIN_CONSOLE */
Expand Down
2 changes: 1 addition & 1 deletion drivers/console/rtt_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static void wait(void)
k_busy_wait(1000*CONFIG_RTT_TX_RETRY_DELAY_MS);
}
} else {
k_sleep(CONFIG_RTT_TX_RETRY_DELAY_MS);
k_msleep(CONFIG_RTT_TX_RETRY_DELAY_MS);
}
}

Expand Down
8 changes: 4 additions & 4 deletions drivers/display/display_ili9340.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct ili9340_data {
static void ili9340_exit_sleep(struct ili9340_data *data)
{
ili9340_transmit(data, ILI9340_CMD_EXIT_SLEEP, NULL, 0);
k_sleep(120);
k_msleep(120);
}

static int ili9340_init(struct device *dev)
Expand Down Expand Up @@ -96,11 +96,11 @@ static int ili9340_init(struct device *dev)
#ifdef DT_INST_0_ILITEK_ILI9340_RESET_GPIOS_CONTROLLER
LOG_DBG("Resetting display driver");
gpio_pin_write(data->reset_gpio, DT_INST_0_ILITEK_ILI9340_RESET_GPIOS_PIN, 1);
k_sleep(1);
k_msleep(1);
gpio_pin_write(data->reset_gpio, DT_INST_0_ILITEK_ILI9340_RESET_GPIOS_PIN, 0);
k_sleep(1);
k_msleep(1);
gpio_pin_write(data->reset_gpio, DT_INST_0_ILITEK_ILI9340_RESET_GPIOS_PIN, 1);
k_sleep(5);
k_msleep(5);
#endif

LOG_DBG("Initializing LCD");
Expand Down
4 changes: 2 additions & 2 deletions drivers/display/display_ili9340_seeed_tftv2.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void ili9340_lcd_init(struct ili9340_data *p_ili9340)
cmd = ILI9340_CMD_SOFTWARE_RESET;
ili9340_transmit(p_ili9340, cmd, NULL, 0);

k_sleep(5);
k_msleep(5);

cmd = ILI9341_CMD_POWER_CTRL_B;
data[0] = 0x00U;
Expand Down Expand Up @@ -166,7 +166,7 @@ void ili9340_lcd_init(struct ili9340_data *p_ili9340)
cmd = ILI9340_CMD_EXIT_SLEEP;
ili9340_transmit(p_ili9340, cmd, NULL, 0);

k_sleep(120);
k_msleep(120);

/* Display Off */
cmd = ILI9340_CMD_DISPLAY_OFF;
Expand Down
10 changes: 5 additions & 5 deletions drivers/display/display_st7789v.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,22 @@ void st7789v_transmit(struct st7789v_data *data, u8_t cmd,
static void st7789v_exit_sleep(struct st7789v_data *data)
{
st7789v_transmit(data, ST7789V_CMD_SLEEP_OUT, NULL, 0);
k_sleep(120);
k_msleep(120);
}

static void st7789v_reset_display(struct st7789v_data *data)
{
LOG_DBG("Resetting display");
#ifdef DT_INST_0_SITRONIX_ST7789V_RESET_GPIOS_CONTROLLER
gpio_pin_write(data->reset_gpio, ST7789V_RESET_PIN, 1);
k_sleep(1);
k_msleep(1);
gpio_pin_write(data->reset_gpio, ST7789V_RESET_PIN, 0);
k_sleep(6);
k_msleep(6);
gpio_pin_write(data->reset_gpio, ST7789V_RESET_PIN, 1);
k_sleep(20);
k_msleep(20);
#else
st7789v_transmit(p_st7789v, ST7789V_CMD_SW_RESET, NULL, 0);
k_sleep(5);
k_msleep(5);
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/display/ssd1306.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,10 @@ static int ssd1306_init_device(struct device *dev)
#ifdef DT_INST_0_SOLOMON_SSD1306FB_RESET_GPIOS_CONTROLLER
gpio_pin_write(driver->reset,
DT_INST_0_SOLOMON_SSD1306FB_RESET_GPIOS_PIN, 1);
k_sleep(SSD1306_RESET_DELAY);
k_msleep(SSD1306_RESET_DELAY);
gpio_pin_write(driver->reset,
DT_INST_0_SOLOMON_SSD1306FB_RESET_GPIOS_PIN, 0);
k_sleep(SSD1306_RESET_DELAY);
k_msleep(SSD1306_RESET_DELAY);
gpio_pin_write(driver->reset,
DT_INST_0_SOLOMON_SSD1306FB_RESET_GPIOS_PIN, 1);
#endif
Expand Down
6 changes: 3 additions & 3 deletions drivers/display/ssd16xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static inline void ssd16xx_busy_wait(struct ssd16xx_data *driver)

gpio_pin_read(driver->busy, SSD16XX_BUSY_PIN, &val);
while (val) {
k_sleep(SSD16XX_BUSY_DELAY);
k_msleep(SSD16XX_BUSY_DELAY);
gpio_pin_read(driver->busy, SSD16XX_BUSY_PIN, &val);
}
}
Expand Down Expand Up @@ -449,9 +449,9 @@ static int ssd16xx_controller_init(struct device *dev)
LOG_DBG("");

gpio_pin_write(driver->reset, SSD16XX_RESET_PIN, 0);
k_sleep(SSD16XX_RESET_DELAY);
k_msleep(SSD16XX_RESET_DELAY);
gpio_pin_write(driver->reset, SSD16XX_RESET_PIN, 1);
k_sleep(SSD16XX_RESET_DELAY);
k_msleep(SSD16XX_RESET_DELAY);
ssd16xx_busy_wait(driver);

err = ssd16xx_write_cmd(driver, SSD16XX_CMD_SW_RESET, NULL, 0);
Expand Down
6 changes: 3 additions & 3 deletions drivers/ethernet/eth_enc424j600.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ static int enc424j600_tx(struct device *dev, struct net_pkt *pkt)
enc424j600_write_sbc(dev, ENC424J600_1BC_SETTXRTS);

do {
k_sleep(1);
k_msleep(1);
enc424j600_read_sfru(dev, ENC424J600_SFRX_ECON1L, &tmp);
} while (tmp & ENC424J600_ECON1_TXRTS);

Expand Down Expand Up @@ -545,12 +545,12 @@ static int enc424j600_stop_device(struct device *dev)
ENC424J600_ECON1_RXEN);

do {
k_sleep(10U);
k_msleep(10U);
enc424j600_read_sfru(dev, ENC424J600_SFRX_ESTATL, &tmp);
} while (tmp & ENC424J600_ESTAT_RXBUSY);

do {
k_sleep(10U);
k_msleep(10U);
enc424j600_read_sfru(dev, ENC424J600_SFRX_ECON1L, &tmp);
} while (tmp & ENC424J600_ECON1_TXRTS);

Expand Down
2 changes: 1 addition & 1 deletion drivers/ethernet/eth_mcux.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ static void eth_mcux_phy_event(struct eth_context *context)
context->link_up = link_up;
context->phy_state = eth_mcux_phy_state_read_duplex;
net_eth_carrier_on(context->iface);
k_sleep(USEC_PER_MSEC);
k_msleep(USEC_PER_MSEC);
} else if (!link_up && context->link_up) {
LOG_INF("Link down");
context->link_up = link_up;
Expand Down
10 changes: 5 additions & 5 deletions drivers/ethernet/eth_smsc911x.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ int smsc_phy_regread(u8_t regoffset, u32_t *data)

val = 0U;
do {
k_sleep(1);
k_msleep(1);
time_out--;
if (smsc_mac_regread(SMSC9220_MAC_MII_ACC, &val)) {
return -1;
Expand Down Expand Up @@ -152,7 +152,7 @@ int smsc_phy_regwrite(u8_t regoffset, u32_t data)
}

do {
k_sleep(1);
k_msleep(1);
time_out--;
if (smsc_mac_regread(SMSC9220_MAC_MII_ACC, &phycmd)) {
return -1;
Expand Down Expand Up @@ -222,7 +222,7 @@ static int smsc_soft_reset(void)
SMSC9220->HW_CFG |= HW_CFG_SRST;

do {
k_sleep(1);
k_msleep(1);
time_out--;
} while (time_out != 0U && (SMSC9220->HW_CFG & HW_CFG_SRST));

Expand Down Expand Up @@ -375,7 +375,7 @@ int smsc_init(void)
return -1;
}

k_sleep(PHY_RESET_TIMEOUT);
k_msleep(PHY_RESET_TIMEOUT);
/* Checking whether phy reset completed successfully.*/
if (smsc_phy_regread(SMSC9220_PHY_BCONTROL, &phyreset)) {
return 1;
Expand All @@ -402,7 +402,7 @@ int smsc_init(void)
SMSC9220->FIFO_INT &= ~(0xFF); /* Clear 2 bottom nibbles */

/* This sleep is compulsory otherwise txmit/receive will fail. */
k_sleep(2000);
k_msleep(2000);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/ethernet/eth_stm32_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static inline void disable_mcast_filter(ETH_HandleTypeDef *heth)
* at least four TX_CLK/RX_CLK clock cycles
*/
tmp = heth->Instance->MACFFR;
k_sleep(1);
k_msleep(1);
heth->Instance->MACFFR = tmp;
}

Expand Down
6 changes: 3 additions & 3 deletions drivers/ethernet/phy_sam_gmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static int mdio_bus_wait(Gmac *gmac)
return -ETIMEDOUT;
}

k_sleep(10);
k_msleep(10);
}

return 0;
Expand Down Expand Up @@ -127,7 +127,7 @@ static int phy_soft_reset(const struct phy_sam_gmac_dev *phy)
return -ETIMEDOUT;
}

k_sleep(50);
k_msleep(50);

retval = phy_read(phy, MII_BMCR, &phy_reg);
if (retval < 0) {
Expand Down Expand Up @@ -228,7 +228,7 @@ int phy_sam_gmac_auto_negotiate(const struct phy_sam_gmac_dev *phy,
goto auto_negotiate_exit;
}

k_sleep(100);
k_msleep(100);

retval = phy_read(phy, MII_BMSR, &val);
if (retval < 0) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/i2s/i2s_ll_stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ static int i2s_stm32_set_clock(struct device *dev, u32_t bit_clk_freq)
}

/* wait 1 ms */
k_sleep(1);
k_msleep(1);
}
LOG_DBG("PLLI2S is locked");

Expand Down
2 changes: 1 addition & 1 deletion drivers/led/ht16k33.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ static void ht16k33_irq_thread(struct device *dev)
do {
k_sem_reset(&data->irq_sem);
pressed = ht16k33_process_keyscan_data(dev);
k_sleep(CONFIG_HT16K33_KEYSCAN_DEBOUNCE_MSEC);
k_msleep(CONFIG_HT16K33_KEYSCAN_DEBOUNCE_MSEC);
} while (pressed);
}
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/led/lp5562.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ static inline int lp5562_set_engine_exec_state(struct device *dev,
* Delay between consecutive I2C writes to
* ENABLE register (00h) need to be longer than 488μs (typ.).
*/
k_sleep(1);
k_msleep(1);

return ret;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/modem/ublox-sara-r4.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ static int send_socket_data(struct modem_socket *sock,
}

/* slight pause per spec so that @ prompt is received */
k_sleep(MDM_PROMPT_CMD_DELAY);
k_msleep(MDM_PROMPT_CMD_DELAY);
#if defined(CONFIG_MODEM_UBLOX_SARA_R4)
/*
* HACK: Apparently, enabling HEX transmit mode also
Expand Down Expand Up @@ -830,15 +830,15 @@ static void modem_reset(void)

/* query modem RSSI */
modem_rssi_query_work(NULL);
k_sleep(MDM_WAIT_FOR_RSSI_DELAY);
k_msleep(MDM_WAIT_FOR_RSSI_DELAY);

counter = 0;
/* wait for RSSI < 0 and > -1000 */
while (counter++ < MDM_WAIT_FOR_RSSI_COUNT &&
(mctx.data_rssi >= 0 ||
mctx.data_rssi <= -1000)) {
modem_rssi_query_work(NULL);
k_sleep(MDM_WAIT_FOR_RSSI_DELAY);
k_msleep(MDM_WAIT_FOR_RSSI_DELAY);
}

if (mctx.data_rssi >= 0 || mctx.data_rssi <= -1000) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/pwm/pwm_imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static int imx_pwm_pin_set(struct device *dev, u32_t pwm,
} else {
PWM_PWMCR_REG(base) = PWM_PWMCR_SWR(1);
do {
k_sleep(1);
k_msleep(1);
cr = PWM_PWMCR_REG(base);
} while ((PWM_PWMCR_SWR(cr)) &&
(++wait_count < CONFIG_PWM_PWMSWR_LOOP));
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensor/adxl362/adxl362.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ static int adxl362_init(struct device *dev)
return -ENODEV;
}

k_sleep(5);
k_msleep(5);

adxl362_get_reg(dev, &value, ADXL362_REG_PARTID, 1);
if (value != ADXL362_PART_ID) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensor/adxl372/adxl372.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ static int adxl372_reset(struct device *dev)
}
/* Writing code 0x52 resets the device */
ret = adxl372_reg_write(dev, ADXL372_RESET, ADXL372_RESET_CODE);
k_sleep(1000);
k_msleep(1000);

return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensor/ams_iAQcore/iAQcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static int iaqcore_sample_fetch(struct device *dev, enum sensor_channel chan)
return 0;
}

k_sleep(100);
k_msleep(100);
}

if (drv_data->status == 0x01) {
Expand Down
Loading