Loading...
Searching...
No Matches
dpl_callout.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Inria
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
9#pragma once
10
24
25#include "os/os_callout.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
35 struct os_callout co;
36};
37
52static inline void dpl_callout_init(struct dpl_callout *c, struct dpl_eventq *q,
53 dpl_event_fn *e_cb, void *e_arg)
54{
55 os_callout_init(&c->co, &q->evq, (os_event_fn *) e_cb, e_arg);
56}
57
66static inline dpl_error_t dpl_callout_reset(struct dpl_callout *c, dpl_time_t ticks)
67{
68 return (dpl_error_t) os_callout_reset(&c->co, ticks);
69}
70
76static inline void dpl_callout_stop(struct dpl_callout *c)
77{
78 os_callout_stop(&c->co);
79}
80
81#ifdef __cplusplus
82}
83#endif
static void dpl_callout_stop(struct dpl_callout *c)
Stops the callout from firing.
Definition dpl_callout.h:76
static void dpl_callout_init(struct dpl_callout *c, struct dpl_eventq *q, dpl_event_fn *e_cb, void *e_arg)
Initialize a callout.
Definition dpl_callout.h:52
static dpl_error_t dpl_callout_reset(struct dpl_callout *c, dpl_time_t ticks)
Reset the callout to fire off in 'ticks' ticks.
Definition dpl_callout.h:66
os_error_t dpl_error_t
dpl error type
Definition dpl_error.h:50
void dpl_event_fn(struct dpl_event *ev)
dpl event callback function
Definition dpl_eventq.h:48
os_time_t dpl_time_t
dpl time type
Definition dpl_types.h:56
void os_event_fn(struct os_event *ev)
Event callback function.
Definition os_eventq.h:50
dpl callout wrapper
Definition dpl_callout.h:34
struct os_callout co
the callout
Definition dpl_callout.h:35
dpl event queue wrapper
Definition dpl_eventq.h:41
struct os_eventq evq
the event queue
Definition dpl_eventq.h:42