1 /* $NetBSD: cyclic.h,v 1.6 2019/07/23 07:46:22 hannken Exp $ */ 2 3 /* 4 * CDDL HEADER START 5 * 6 * The contents of this file are subject to the terms of the 7 * Common Development and Distribution License, Version 1.0 only 8 * (the "License"). You may not use this file except in compliance 9 * with the License. 10 * 11 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 12 * or http://www.opensolaris.org/os/licensing. 13 * See the License for the specific language governing permissions 14 * and limitations under the License. 15 * 16 * When distributing Covered Code, include this CDDL HEADER in each 17 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 18 * If applicable, add the following below this CDDL HEADER, with the 19 * fields enclosed by brackets "[]" replaced with your own identifying 20 * information: Portions Copyright [yyyy] [name of copyright owner] 21 * 22 * CDDL HEADER END 23 * 24 * $FreeBSD: head/sys/cddl/compat/opensolaris/sys/cyclic.h 179202 2008-05-22 08:33:24Z jb $ 25 * 26 */ 27 /* 28 * Copyright (c) 1999-2001 by Sun Microsystems, Inc. 29 * All rights reserved. 30 */ 31 32 #ifndef _COMPAT_OPENSOLARIS_SYS_CYCLIC_H_ 33 #define _COMPAT_OPENSOLARIS_SYS_CYCLIC_H_ 34 35 #ifndef _KERNEL 36 typedef void cpu_t; 37 #endif 38 39 40 #ifndef _ASM 41 #include <sys/time.h> 42 #include <sys/cpuvar.h> 43 #ifndef __NetBSD__ 44 #include <sys/cpupart.h> 45 #endif 46 #endif /* !_ASM */ 47 48 #define CY_LOW_LEVEL 0 49 #define CY_LOCK_LEVEL 1 50 #define CY_HIGH_LEVEL 2 51 #define CY_SOFT_LEVELS 2 52 #define CY_LEVELS 3 53 54 #ifndef _ASM 55 56 typedef uintptr_t cyclic_id_t; 57 typedef int cyc_index_t; 58 typedef uint16_t cyc_level_t; 59 typedef void (*cyc_func_t)(void *); 60 typedef void *cyb_arg_t; 61 62 #define CYCLIC_NONE ((cyclic_id_t)0) 63 64 typedef struct cyc_handler { 65 cyc_func_t cyh_func; 66 void *cyh_arg; 67 cyc_level_t cyh_level; 68 } cyc_handler_t; 69 70 typedef struct cyc_time { 71 hrtime_t cyt_when; 72 hrtime_t cyt_interval; 73 } cyc_time_t; 74 75 typedef struct cyc_omni_handler { 76 void (*cyo_online)(void *, cpu_t *, cyc_handler_t *, cyc_time_t *); 77 void (*cyo_offline)(void *, cpu_t *, void *); 78 void *cyo_arg; 79 } cyc_omni_handler_t; 80 81 #define CY_INFINITY INT64_MAX 82 83 #ifdef _KERNEL 84 85 cyclic_id_t cyclic_add(cyc_handler_t *, cyc_time_t *); 86 cyclic_id_t cyclic_add_omni(cyc_omni_handler_t *); 87 void cyclic_remove(cyclic_id_t); 88 int cyclic_reprogram(cyclic_id_t, hrtime_t); 89 90 #endif /* _KERNEL */ 91 92 #endif /* !_ASM */ 93 94 #endif 95