mirror of
https://github.com/apache/nuttx.git
synced 2025-12-11 12:57:57 +08:00
timers/oneshot: Remove oneshot tick API.
This commit removed all oneshot tick API for new clkdev API. Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit is contained in:
committed by
Alin Jerpelea
parent
fc28b93224
commit
7e7828b3f6
@@ -95,10 +95,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#define ONESHOT_MAX_DELAY(l,t) \
|
||||
((l)->ops->max_delay ? (l)->ops->max_delay(l,t) : oneshot_max_delay(l,t))
|
||||
#define ONESHOT_TICK_MAX_DELAY(l,t) \
|
||||
((l)->ops->tick_max_delay ? (l)->ops->tick_max_delay(l,t) : oneshot_tick_max_delay(l,t))
|
||||
#define ONESHOT_MAX_DELAY(l,t) (l)->ops->max_delay(l,t)
|
||||
#define ONESHOT_TICK_MAX_DELAY(l,t) oneshot_tick_max_delay(l,t)
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ONESHOT_START
|
||||
@@ -120,10 +118,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#define ONESHOT_START(l,t) \
|
||||
((l)->ops->start ? (l)->ops->start(l,t) : oneshot_start(l,t))
|
||||
#define ONESHOT_TICK_START(l,t) \
|
||||
((l)->ops->tick_start ? (l)->ops->tick_start(l,t) : oneshot_tick_start(l,t))
|
||||
#define ONESHOT_START(l,t) (l)->ops->start(l,t)
|
||||
#define ONESHOT_TICK_START(l,t) oneshot_tick_start(l,t)
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ONESHOT_CANCEL
|
||||
@@ -149,10 +145,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#define ONESHOT_CANCEL(l,t) \
|
||||
((l)->ops->cancel ? (l)->ops->cancel(l,t) : oneshot_cancel(l,t))
|
||||
#define ONESHOT_TICK_CANCEL(l,t) \
|
||||
((l)->ops->tick_cancel ? (l)->ops->tick_cancel(l,t) : oneshot_tick_cancel(l,t))
|
||||
#define ONESHOT_CANCEL(l,t) (l)->ops->cancel(l,t)
|
||||
#define ONESHOT_TICK_CANCEL(l,t) oneshot_tick_cancel(l,t)
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ONESHOT_CURRENT
|
||||
@@ -173,10 +167,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#define ONESHOT_CURRENT(l,t) \
|
||||
((l)->ops->current ? (l)->ops->current(l,t) : oneshot_current(l,t))
|
||||
#define ONESHOT_TICK_CURRENT(l,t) \
|
||||
((l)->ops->tick_current ? (l)->ops->tick_current(l,t) : oneshot_tick_current(l,t))
|
||||
#define ONESHOT_CURRENT(l,t) (l)->ops->current(l,t)
|
||||
#define ONESHOT_TICK_CURRENT(l,t) oneshot_tick_current(l,t)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
@@ -207,14 +199,6 @@ struct oneshot_operations_s
|
||||
FAR struct timespec *ts);
|
||||
CODE int (*current)(FAR struct oneshot_lowerhalf_s *lower,
|
||||
FAR struct timespec *ts);
|
||||
CODE int (*tick_max_delay)(FAR struct oneshot_lowerhalf_s *lower,
|
||||
FAR clock_t *ticks);
|
||||
CODE int (*tick_start)(FAR struct oneshot_lowerhalf_s *lower,
|
||||
clock_t ticks);
|
||||
CODE int (*tick_cancel)(FAR struct oneshot_lowerhalf_s *lower,
|
||||
FAR clock_t *ticks);
|
||||
CODE int (*tick_current)(FAR struct oneshot_lowerhalf_s *lower,
|
||||
FAR clock_t *ticks);
|
||||
};
|
||||
|
||||
/* This structure describes the state of the oneshot timer lower-half
|
||||
@@ -260,77 +244,9 @@ extern "C"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
* Inline Functions
|
||||
****************************************************************************/
|
||||
|
||||
static inline
|
||||
int oneshot_max_delay(FAR struct oneshot_lowerhalf_s *lower,
|
||||
FAR struct timespec *ts)
|
||||
{
|
||||
clock_t tick;
|
||||
int ret;
|
||||
|
||||
if (lower->ops->tick_max_delay == NULL)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
ret = lower->ops->tick_max_delay(lower, &tick);
|
||||
clock_ticks2time(ts, tick);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline
|
||||
int oneshot_start(FAR struct oneshot_lowerhalf_s *lower,
|
||||
FAR const struct timespec *ts)
|
||||
{
|
||||
clock_t tick;
|
||||
|
||||
if (lower->ops->tick_start == NULL)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
tick = clock_time2ticks(ts);
|
||||
return lower->ops->tick_start(lower, tick);
|
||||
}
|
||||
|
||||
static inline
|
||||
int oneshot_cancel(FAR struct oneshot_lowerhalf_s *lower,
|
||||
FAR struct timespec *ts)
|
||||
{
|
||||
clock_t tick;
|
||||
int ret;
|
||||
|
||||
if (lower->ops->tick_cancel == NULL)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
ret = lower->ops->tick_cancel(lower, &tick);
|
||||
clock_ticks2time(ts, tick);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline
|
||||
int oneshot_current(FAR struct oneshot_lowerhalf_s *lower,
|
||||
FAR struct timespec *ts)
|
||||
{
|
||||
clock_t tick;
|
||||
int ret;
|
||||
|
||||
if (lower->ops->tick_current == NULL)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
ret = lower->ops->tick_current(lower, &tick);
|
||||
clock_ticks2time(ts, tick);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline
|
||||
int oneshot_tick_max_delay(FAR struct oneshot_lowerhalf_s *lower,
|
||||
FAR clock_t *ticks)
|
||||
@@ -408,6 +324,10 @@ void oneshot_process_callback(FAR struct oneshot_lowerhalf_s *lower)
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: oneshot_initialize
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user