Skip to content

Commit

Permalink
timer/alarm: move g_current_tick to oneshot_lowerhalf_s
Browse files Browse the repository at this point in the history
move g_current_tick to oneshot_lowerhalf_s

Signed-off-by: chao an <[email protected]>
  • Loading branch information
anchao committed Aug 23, 2024
1 parent cfdbc85 commit 32dd112
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/timers/arch_alarm.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@

static FAR struct oneshot_lowerhalf_s *g_oneshot_lower;

#ifndef CONFIG_SCHED_TICKLESS
static clock_t g_current_tick;
#endif

/****************************************************************************
* Private Functions
****************************************************************************/
Expand Down Expand Up @@ -140,7 +136,7 @@ static void oneshot_callback(FAR struct oneshot_lowerhalf_s *lower,
clock_t next;

nxsched_process_timer();
next = ++g_current_tick;
next = ++lower->current_tick;
ONESHOT_TICK_CURRENT(g_oneshot_lower, &now);
delta = next - now;
}
Expand All @@ -166,7 +162,7 @@ void up_alarm_set_lowerhalf(FAR struct oneshot_lowerhalf_s *lower)
ONESHOT_TICK_MAX_DELAY(g_oneshot_lower, &ticks);
g_oneshot_maxticks = ticks < UINT32_MAX ? ticks : UINT32_MAX;
#else
ONESHOT_TICK_CURRENT(g_oneshot_lower, &g_current_tick);
ONESHOT_TICK_CURRENT(g_oneshot_lower, &lower->current_tick);
ONESHOT_TICK_START(g_oneshot_lower, oneshot_callback, NULL, 1);
#endif
}
Expand Down
4 changes: 4 additions & 0 deletions include/nuttx/timers/oneshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ struct oneshot_lowerhalf_s

FAR const struct oneshot_operations_s *ops;

#ifndef CONFIG_SCHED_TICKLESS
clock_t current_tick;
#endif

/* Private lower half data may follow */
};

Expand Down

0 comments on commit 32dd112

Please sign in to comment.