Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions drivers/serial/uart_sam0.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ static void uart_sam0_rx_timeout(struct k_work *work)
return;
}

u32_t now = k_uptime_get_32();
u32_t now = (u32_t)k_uptime_get();
u32_t elapsed = now - dev_data->rx_timeout_start;

if (elapsed >= dev_data->rx_timeout_time) {
Expand Down Expand Up @@ -546,7 +546,7 @@ static void uart_sam0_isr(void *arg)
*/
if (dev_data->rx_timeout_time != K_FOREVER) {
dev_data->rx_timeout_from_isr = true;
dev_data->rx_timeout_start = k_uptime_get_32();
dev_data->rx_timeout_start = (u32_t)k_uptime_get();
k_delayed_work_submit(&dev_data->rx_timeout_work,
dev_data->rx_timeout_chunk);
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/watchdog/wdt_iwdg_stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ static int iwdg_stm32_install_timeout(struct device *dev,
return -EINVAL;
}

tickstart = k_uptime_get_32();
tickstart = (u32_t)k_uptime_get();

while (LL_IWDG_IsReady(iwdg) == 0) {
/* Wait until WVU, RVU, PVU are reset before updating */
if ((k_uptime_get_32() - tickstart) > IWDG_DEFAULT_TIMEOUT) {
if (((u32_t)k_uptime_get() - tickstart) > IWDG_DEFAULT_TIMEOUT) {
return -ENODEV;
}
}
Expand Down
19 changes: 11 additions & 8 deletions include/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -1729,13 +1729,16 @@ __deprecated static inline void k_disable_sys_clock_always_on(void)
/**
* @brief Get system uptime (32-bit version).
*
* This routine returns the lower 32-bits of the elapsed time since the system
* booted, in milliseconds.
* This routine returns a value obtained by converting the lower
* 32-bits of the system clock into milliseconds.
*
* This routine can be more efficient than k_uptime_get(), as it reduces the
* need for interrupt locking and 64-bit math. However, the 32-bit result
* cannot hold a system uptime time larger than approximately 50 days, so the
* caller must handle possible rollovers.
* This value is computed more efficiently than k_uptime_get(), as it
* reduces the need for interrupt locking and 64-bit math. However as
* the system clock counter approaches 2^32 the value is no longer
* equal to the low 32-bits of the elapsed time in milliseconds since
* the system booted. Rollover calculation at the discontinuity is complex.
*
* @note Replace this with k_uptime_get().
*
* @note
* @rst
Expand All @@ -1744,9 +1747,9 @@ __deprecated static inline void k_disable_sys_clock_always_on(void)
* :option:`CONFIG_SYS_CLOCK_TICKS_PER_SEC` config option
* @endrst
*
* @return Current uptime in milliseconds.
* @return Current uptime in milliseconds, sorta.
*/
__syscall u32_t k_uptime_get_32(void);
__deprecated __syscall u32_t k_uptime_get_32(void);

/**
* @brief Get elapsed time.
Expand Down
4 changes: 2 additions & 2 deletions kernel/queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ static void *k_queue_poll(struct k_queue *queue, s32_t timeout)
K_POLL_MODE_NOTIFY_ONLY, queue);

if (timeout != K_FOREVER) {
start = k_uptime_get_32();
start = (u32_t)k_uptime_get();
}

do {
Expand All @@ -304,7 +304,7 @@ static void *k_queue_poll(struct k_queue *queue, s32_t timeout)
k_spin_unlock(&queue->lock, key);

if ((val == NULL) && (timeout != K_FOREVER)) {
elapsed = k_uptime_get_32() - start;
elapsed = (u32_t)k_uptime_get() - start;
done = elapsed > timeout;
}
} while (!val && !done);
Expand Down
2 changes: 1 addition & 1 deletion lib/gui/lvgl/lv_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ typedef void *lv_img_decoder_user_data_t;

#define LV_TICK_CUSTOM 1
#define LV_TICK_CUSTOM_INCLUDE "kernel.h"
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (k_uptime_get_32())
#define LV_TICK_CUSTOM_SYS_TIME_EXPR ((u32_t)k_uptime_get())

typedef void *lv_disp_drv_user_data_t;
typedef void *lv_indev_drv_user_data_t;
Expand Down
4 changes: 2 additions & 2 deletions samples/boards/nrf52/mesh/onoff-app/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ static void button_pressed(struct device *dev, struct gpio_callback *cb,
* More than one button press sends an off message
*/

time = k_uptime_get_32();
time = (u32_t)k_uptime_get();

/* debounce the switch */
if (time < last_time + BUTTON_DEBOUNCE_DELAY_MS) {
Expand Down Expand Up @@ -604,7 +604,7 @@ void main(void)
printk("Initializing...\n");

/* Initialize the button debouncer */
last_time = k_uptime_get_32();
last_time = (u32_t)k_uptime_get();

/* Initialize button worker task*/
k_work_init(&sw.button_work, button_pressed_worker);
Expand Down
2 changes: 1 addition & 1 deletion samples/boards/reel_board/mesh_badge/src/reel_board.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ static void button_interrupt(struct device *dev, struct gpio_callback *cb,
return;
case SCREEN_MAIN:
if (pins & BIT(DT_ALIAS_SW0_GPIOS_PIN)) {
u32_t uptime = k_uptime_get_32();
u32_t uptime = (u32_t)k_uptime_get();
static u32_t bad_count, press_ts;

if (uptime - press_ts < 500) {
Expand Down
2 changes: 1 addition & 1 deletion samples/philosophers/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static s32_t get_random_delay(int id, int period_in_ms)
* and the current uptime to create some pseudo-randomness. It produces
* a value between 0 and 31.
*/
s32_t delay = (k_uptime_get_32()/100 * (id + 1)) & 0x1f;
s32_t delay = ((u32_t)k_uptime_get()/100 * (id + 1)) & 0x1f;

/* add 1 to not generate a delay of 0 */
s32_t ms = (delay + 1) * period_in_ms;
Expand Down
2 changes: 1 addition & 1 deletion samples/portability/cmsis_rtos_v1/philosophers/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static s32_t get_random_delay(int id, int period_in_ms)
* and the current uptime to create some pseudo-randomness. It produces
* a value between 0 and 31.
*/
s32_t delay = (k_uptime_get_32() / 100 * (id + 1)) & 0x1f;
s32_t delay = ((u32_t)k_uptime_get() / 100 * (id + 1)) & 0x1f;

/* add 1 to not generate a delay of 0 */
s32_t ms = (delay + 1) * period_in_ms;
Expand Down
2 changes: 1 addition & 1 deletion samples/portability/cmsis_rtos_v2/philosophers/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ static s32_t get_random_delay(int id, int period_in_ms)
* and the current uptime to create some pseudo-randomness. It produces
* a value between 0 and 31.
*/
s32_t delay = (k_uptime_get_32()/100 * (id + 1)) & 0x1f;
s32_t delay = ((u32_t)k_uptime_get()/100 * (id + 1)) & 0x1f;

/* add 1 to not generate a delay of 0 */
s32_t ms = (delay + 1) * period_in_ms;
Expand Down
2 changes: 1 addition & 1 deletion soc/arm/st_stm32/common/stm32cube_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
uint32_t HAL_GetTick(void)
{
return k_uptime_get_32();
return (u32_t)k_uptime_get();
}

/**
Expand Down
8 changes: 4 additions & 4 deletions subsys/bluetooth/controller/hci/hci_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ static void prio_recv_thread(void *p1, void *p2, void *p3)
BT_DBG("sem taken");

#if defined(CONFIG_INIT_STACKS)
if (k_uptime_get_32() - prio_ts > K_SECONDS(5)) {
if ((u32_t)k_uptime_get() - prio_ts > K_SECONDS(5)) {
STACK_ANALYZE("prio recv thread stack",
prio_recv_thread_stack);
prio_ts = k_uptime_get_32();
prio_ts = (u32_t)k_uptime_get();
}
#endif
}
Expand Down Expand Up @@ -370,9 +370,9 @@ static void recv_thread(void *p1, void *p2, void *p3)
k_yield();

#if defined(CONFIG_INIT_STACKS)
if (k_uptime_get_32() - rx_ts > K_SECONDS(5)) {
if ((u32_t)k_uptime_get() - rx_ts > K_SECONDS(5)) {
STACK_ANALYZE("recv thread stack", recv_thread_stack);
rx_ts = k_uptime_get_32();
rx_ts = (u32_t)k_uptime_get();
}
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions subsys/bluetooth/mesh/access.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static s32_t next_period(struct bt_mesh_model *mod)
return 0;
}

elapsed = k_uptime_get_32() - pub->period_start;
elapsed = (u32_t)k_uptime_get() - pub->period_start;

BT_DBG("Publishing took %ums", elapsed);

Expand Down Expand Up @@ -159,7 +159,7 @@ static void publish_start(u16_t duration, int err, void *user_data)

/* Initialize the timestamp for the beginning of a new period */
if (pub->count == BT_MESH_PUB_TRANSMIT_COUNT(pub->retransmit)) {
pub->period_start = k_uptime_get_32();
pub->period_start = (u32_t)k_uptime_get();
}
}

Expand Down
4 changes: 2 additions & 2 deletions subsys/bluetooth/mesh/beacon.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static void beacon_complete(int err, void *user_data)

BT_DBG("err %d", err);

sub->beacon_sent = k_uptime_get_32();
sub->beacon_sent = (u32_t)k_uptime_get();
}

void bt_mesh_beacon_create(struct bt_mesh_subnet *sub,
Expand Down Expand Up @@ -113,7 +113,7 @@ static int secure_beacon_send(void)
static const struct bt_mesh_send_cb send_cb = {
.end = beacon_complete,
};
u32_t now = k_uptime_get_32();
u32_t now = (u32_t)k_uptime_get();
int i;

BT_DBG("");
Expand Down
4 changes: 2 additions & 2 deletions subsys/bluetooth/mesh/friend.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ static void clear_timeout(struct k_work *work)

BT_DBG("LPN 0x%04x (old) Friend 0x%04x", frnd->lpn, frnd->clear.frnd);

duration = k_uptime_get_32() - frnd->clear.start;
duration = (u32_t)k_uptime_get() - frnd->clear.start;
if (duration > 2 * frnd->poll_to) {
BT_DBG("Clear Procedure timer expired");
frnd->clear.frnd = BT_MESH_ADDR_UNASSIGNED;
Expand All @@ -663,7 +663,7 @@ static void clear_procedure_start(struct bt_mesh_friend *frnd)
{
BT_DBG("LPN 0x%04x (old) Friend 0x%04x", frnd->lpn, frnd->clear.frnd);

frnd->clear.start = k_uptime_get_32() + (2 * frnd->poll_to);
frnd->clear.start = (u32_t)k_uptime_get() + (2 * frnd->poll_to);
frnd->clear.repeat_sec = 1U;

send_friend_clear(frnd);
Expand Down
4 changes: 2 additions & 2 deletions subsys/bluetooth/mesh/proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ void bt_mesh_proxy_beacon_send(struct bt_mesh_subnet *sub)
void bt_mesh_proxy_identity_start(struct bt_mesh_subnet *sub)
{
sub->node_id = BT_MESH_NODE_IDENTITY_RUNNING;
sub->node_id_start = k_uptime_get_32();
sub->node_id_start = (u32_t)k_uptime_get();

/* Prioritize the recently enabled subnet */
next_idx = sub - bt_mesh.sub;
Expand Down Expand Up @@ -1138,7 +1138,7 @@ static s32_t gatt_proxy_advertise(struct bt_mesh_subnet *sub)
}

if (sub->node_id == BT_MESH_NODE_IDENTITY_RUNNING) {
u32_t active = k_uptime_get_32() - sub->node_id_start;
u32_t active = (u32_t)k_uptime_get() - sub->node_id_start;

if (active < NODE_ID_TIMEOUT) {
remaining = NODE_ID_TIMEOUT - active;
Expand Down
4 changes: 2 additions & 2 deletions subsys/bluetooth/mesh/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ static void seg_ack(struct k_work *work)

BT_DBG("rx %p", rx);

if (k_uptime_get_32() - rx->last > K_SECONDS(60)) {
if ((u32_t)k_uptime_get() - rx->last > K_SECONDS(60)) {
BT_WARN("Incomplete timer expired");
seg_rx_reset(rx, false);

Expand Down Expand Up @@ -1365,7 +1365,7 @@ static int trans_seg(struct net_buf_simple *buf, struct bt_mesh_net_rx *net_rx,
}

/* Reset the Incomplete Timer */
rx->last = k_uptime_get_32();
rx->last = (u32_t)k_uptime_get();

if (!k_delayed_work_remaining_get(&rx->ack) &&
!bt_mesh_lpn_established()) {
Expand Down
4 changes: 2 additions & 2 deletions subsys/disk/disk_access_sdhc.h
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ static inline int sdhc_map_data_status(int status)
static inline void sdhc_retry_init(struct sdhc_retry *retry, u32_t timeout,
u16_t sleep)
{
retry->end = k_uptime_get_32() + timeout;
retry->end = (u32_t)k_uptime_get() + timeout;
retry->tries = 0;
retry->sleep = sleep;
}
Expand All @@ -561,7 +561,7 @@ static inline void sdhc_retry_init(struct sdhc_retry *retry, u32_t timeout,
*/
static inline bool sdhc_retry_ok(struct sdhc_retry *retry)
{
s32_t remain = retry->end - k_uptime_get_32();
s32_t remain = retry->end - (u32_t)k_uptime_get();

if (retry->tries < SDHC_MIN_TRIES) {
retry->tries++;
Expand Down
14 changes: 7 additions & 7 deletions subsys/net/buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ struct net_buf *net_buf_alloc_len(struct net_buf_pool *pool, size_t size,
s32_t timeout)
#endif
{
u32_t alloc_start = k_uptime_get_32();
u32_t alloc_start = (u32_t)k_uptime_get();
struct net_buf *buf;
unsigned int key;

Expand Down Expand Up @@ -277,7 +277,7 @@ struct net_buf *net_buf_alloc_len(struct net_buf_pool *pool, size_t size,

#if defined(CONFIG_NET_BUF_LOG) && (CONFIG_NET_BUF_LOG_LEVEL >= LOG_LEVEL_WRN)
if (timeout == K_FOREVER) {
u32_t ref = k_uptime_get_32();
u32_t ref = (u32_t)k_uptime_get();
buf = k_lifo_get(&pool->free, K_NO_WAIT);
while (!buf) {
#if defined(CONFIG_NET_BUF_POOL_USAGE)
Expand All @@ -291,11 +291,11 @@ struct net_buf *net_buf_alloc_len(struct net_buf_pool *pool, size_t size,
#if defined(CONFIG_NET_BUF_POOL_USAGE)
NET_BUF_WARN("%s():%d: Pool %s blocked for %u secs",
func, line, pool->name,
(k_uptime_get_32() - ref) / MSEC_PER_SEC);
((u32_t)k_uptime_get() - ref) / MSEC_PER_SEC);
#else
NET_BUF_WARN("%s():%d: Pool %p blocked for %u secs",
func, line, pool,
(k_uptime_get_32() - ref) / MSEC_PER_SEC);
((u32_t)k_uptime_get() - ref) / MSEC_PER_SEC);
#endif
}
} else {
Expand All @@ -314,7 +314,7 @@ struct net_buf *net_buf_alloc_len(struct net_buf_pool *pool, size_t size,

if (size) {
if (timeout != K_NO_WAIT && timeout != K_FOREVER) {
u32_t diff = k_uptime_get_32() - alloc_start;
u32_t diff = (u32_t)k_uptime_get() - alloc_start;

timeout -= MIN(timeout, diff);
}
Expand Down Expand Up @@ -563,7 +563,7 @@ struct net_buf *net_buf_ref(struct net_buf *buf)

struct net_buf *net_buf_clone(struct net_buf *buf, s32_t timeout)
{
u32_t alloc_start = k_uptime_get_32();
u32_t alloc_start = (u32_t)k_uptime_get();
struct net_buf_pool *pool;
struct net_buf *clone;

Expand All @@ -588,7 +588,7 @@ struct net_buf *net_buf_clone(struct net_buf *buf, s32_t timeout)
size_t size = buf->size;

if (timeout != K_NO_WAIT && timeout != K_FOREVER) {
u32_t diff = k_uptime_get_32() - alloc_start;
u32_t diff = (u32_t)k_uptime_get() - alloc_start;

timeout -= MIN(timeout, diff);
}
Expand Down
2 changes: 1 addition & 1 deletion subsys/net/ip/ipv6_nbr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2108,7 +2108,7 @@ static inline u32_t remaining_lifetime(struct net_if_addr *ifaddr)
remaining = (u64_t)ifaddr->lifetime.timer_timeout +
(u64_t)ifaddr->lifetime.wrap_counter *
(u64_t)NET_TIMEOUT_MAX_VALUE -
(u64_t)time_diff(k_uptime_get_32(),
(u64_t)time_diff((u32_t)k_uptime_get(),
ifaddr->lifetime.timer_start);

return (u32_t)(remaining / K_MSEC(1000));
Expand Down
Loading