Skip to content
Merged
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
6 changes: 3 additions & 3 deletions include/nuttx/hrtimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ typedef struct hrtimer_node_s hrtimer_node_t;
* timer context and must not block.
*/

typedef CODE uint64_t
(*hrtimer_cb)(FAR hrtimer_t *hrtimer, uint64_t expired);
typedef CODE uint64_t (*hrtimer_entry_t)(FAR const hrtimer_t *hrtimer,
Comment thread
xiaoxiang781216 marked this conversation as resolved.
Comment thread
xiaoxiang781216 marked this conversation as resolved.
uint64_t expired);

/* Red-black tree node used to order hrtimers by expiration time */

Expand All @@ -85,7 +85,7 @@ struct hrtimer_node_s
struct hrtimer_s
{
hrtimer_node_t node; /* RB-tree node for sorted insertion */
hrtimer_cb func; /* Expiration callback function */
hrtimer_entry_t func; /* Expiration callback function */
uint64_t expired; /* Absolute expiration time (ns) */
};

Expand Down
1 change: 1 addition & 0 deletions sched/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2007,5 +2007,6 @@ config CUSTOM_SEMAPHORE_MAXVALUE
config HRTIMER
bool "High resolution timer support"
default n
depends on SYSTEM_TIME64
---help---
Enable to support high resolution timer
1 change: 1 addition & 0 deletions sched/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ include timer/Make.defs
include tls/Make.defs
include wdog/Make.defs
include wqueue/Make.defs
include hrtimer/Make.defs

CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)sched

Expand Down
6 changes: 4 additions & 2 deletions sched/hrtimer/hrtimer_cancel.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,11 @@ int hrtimer_cancel(FAR hrtimer_t *hrtimer)
hrtimer_remove(hrtimer);
}

/* Mark timer as cancelled */
/* If the timer was running, increment its expiration count to prevent
* it from being re-armed by the callback.
*/

hrtimer->expired = UINT64_MAX;
hrtimer->expired++;
Comment thread
xiaoxiang781216 marked this conversation as resolved.

/* If the canceled timer was the earliest one, update the hardware timer */

Expand Down
2 changes: 1 addition & 1 deletion sched/hrtimer/hrtimer_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void hrtimer_process(uint64_t now)
{
FAR hrtimer_t *hrtimer;
irqstate_t flags;
hrtimer_cb func;
hrtimer_entry_t func;
uint64_t expired;
uint64_t period;
int cpu = this_cpu();
Expand Down
Loading