2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
12 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
15 #ifndef _SYS_DDI_PERIODIC_H
16 #define _SYS_DDI_PERIODIC_H
19 #include <sys/taskq_impl.h>
20 #include <sys/cyclic.h>
29 * Opaque handle type for i_timeout() and i_untimeout().
31 typedef struct __timeout
*timeout_t
;
33 typedef enum ddi_periodic_flags
{
34 DPF_DISPATCHED
= 0x01,
37 } ddi_periodic_flags_t
;
40 * Each instance of this structure represents a single periodic handler
41 * registered through ddi_periodic_add(9F).
43 typedef struct ddi_periodic_impl
{
44 struct list_node dpr_link
; /* protected by periodics_lock */
45 struct list_node dpr_softint_link
; /* only used when DPF_DISPATCHED */
47 hrtime_t dpr_interval
;
51 ddi_periodic_flags_t dpr_flags
;
52 uint_t dpr_level
; /* 0 <= dpr_level <= 10 */
53 taskq_ent_t dpr_taskq_ent
; /* only used for level of 0 */
54 uint64_t dpr_fire_count
;
55 kthread_t
*dpr_thread
;
57 cyclic_id_t dpr_cyclic_id
;
59 void (*dpr_handler
)(void *);
61 } ddi_periodic_impl_t
;
64 * Internal implementation functions for the DDI periodic interface.
66 void ddi_periodic_init(void);
67 void ddi_periodic_fini(void);
68 void ddi_periodic_softintr(int level
);
69 timeout_t
i_timeout(void (*)(void *), void *, hrtime_t
, int);
70 void i_untimeout(timeout_t
);
78 #endif /* _SYS_DDI_PERIODIC_H */