114e3d835SApple OSS Distributions /* 214e3d835SApple OSS Distributions * Copyright (c) 2004 Apple Computer, Inc. All rights reserved. 314e3d835SApple OSS Distributions * 4*e13b1fa5SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 514e3d835SApple OSS Distributions * 6*e13b1fa5SApple OSS Distributions * This file contains Original Code and/or Modifications of Original Code 7*e13b1fa5SApple OSS Distributions * as defined in and that are subject to the Apple Public Source License 8*e13b1fa5SApple OSS Distributions * Version 2.0 (the 'License'). You may not use this file except in 9*e13b1fa5SApple OSS Distributions * compliance with the License. The rights granted to you under the License 10*e13b1fa5SApple OSS Distributions * may not be used to create, or enable the creation or redistribution of, 11*e13b1fa5SApple OSS Distributions * unlawful or unlicensed copies of an Apple operating system, or to 12*e13b1fa5SApple OSS Distributions * circumvent, violate, or enable the circumvention or violation of, any 13*e13b1fa5SApple OSS Distributions * terms of an Apple operating system software license agreement. 1414e3d835SApple OSS Distributions * 15*e13b1fa5SApple OSS Distributions * Please obtain a copy of the License at 16*e13b1fa5SApple OSS Distributions * http://www.opensource.apple.com/apsl/ and read it before using this file. 17*e13b1fa5SApple OSS Distributions * 18*e13b1fa5SApple OSS Distributions * The Original Code and all software distributed under the License are 19*e13b1fa5SApple OSS Distributions * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 2014e3d835SApple OSS Distributions * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 2114e3d835SApple OSS Distributions * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22*e13b1fa5SApple OSS Distributions * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23*e13b1fa5SApple OSS Distributions * Please see the License for the specific language governing rights and 24*e13b1fa5SApple OSS Distributions * limitations under the License. 2514e3d835SApple OSS Distributions * 26*e13b1fa5SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 2714e3d835SApple OSS Distributions */ 2814e3d835SApple OSS Distributions 2914e3d835SApple OSS Distributions /* 3014e3d835SApple OSS Distributions * devtimer.h 3114e3d835SApple OSS Distributions * - timer source based on <kern/thread_call.h> 3214e3d835SApple OSS Distributions */ 3314e3d835SApple OSS Distributions 3414e3d835SApple OSS Distributions 3514e3d835SApple OSS Distributions #ifndef _NET_DEVTIMER_H 3614e3d835SApple OSS Distributions #define _NET_DEVTIMER_H 3714e3d835SApple OSS Distributions 3814e3d835SApple OSS Distributions #include <sys/types.h> 3914e3d835SApple OSS Distributions #include <sys/systm.h> 4014e3d835SApple OSS Distributions 4114e3d835SApple OSS Distributions #define DEVTIMER_USECS_PER_SEC (1000 * 1000) 4214e3d835SApple OSS Distributions 4314e3d835SApple OSS Distributions enum { 4414e3d835SApple OSS Distributions devtimer_process_func_event_lock, 4514e3d835SApple OSS Distributions devtimer_process_func_event_unlock, 4614e3d835SApple OSS Distributions }; 4714e3d835SApple OSS Distributions typedef int devtimer_process_func_event; 4814e3d835SApple OSS Distributions 4914e3d835SApple OSS Distributions typedef struct devtimer_s * devtimer_ref; 5014e3d835SApple OSS Distributions typedef void (*devtimer_process_func)(devtimer_ref timer, 5114e3d835SApple OSS Distributions devtimer_process_func_event event); 5214e3d835SApple OSS Distributions typedef void (*devtimer_timeout_func)(void * arg0, void * arg1, void * arg2); 5314e3d835SApple OSS Distributions 5414e3d835SApple OSS Distributions int 5514e3d835SApple OSS Distributions devtimer_valid(devtimer_ref timer); 5614e3d835SApple OSS Distributions 5714e3d835SApple OSS Distributions void 5814e3d835SApple OSS Distributions devtimer_retain(devtimer_ref timer); 5914e3d835SApple OSS Distributions 6014e3d835SApple OSS Distributions void * 6114e3d835SApple OSS Distributions devtimer_arg0(devtimer_ref timer); 6214e3d835SApple OSS Distributions 6314e3d835SApple OSS Distributions devtimer_ref 6414e3d835SApple OSS Distributions devtimer_create(devtimer_process_func process_func, void * arg0); 6514e3d835SApple OSS Distributions 6614e3d835SApple OSS Distributions void 6714e3d835SApple OSS Distributions devtimer_invalidate(devtimer_ref timer); 6814e3d835SApple OSS Distributions 6914e3d835SApple OSS Distributions void 7014e3d835SApple OSS Distributions devtimer_release(devtimer_ref timer); 7114e3d835SApple OSS Distributions 7214e3d835SApple OSS Distributions void 7314e3d835SApple OSS Distributions devtimer_set_absolute(devtimer_ref t, 7414e3d835SApple OSS Distributions struct timeval abs_time, 7514e3d835SApple OSS Distributions devtimer_timeout_func func, 7614e3d835SApple OSS Distributions void * arg1, void * arg2); 7714e3d835SApple OSS Distributions 7814e3d835SApple OSS Distributions void 7914e3d835SApple OSS Distributions devtimer_set_relative(devtimer_ref t, 8014e3d835SApple OSS Distributions struct timeval rel_time, 8114e3d835SApple OSS Distributions devtimer_timeout_func func, 8214e3d835SApple OSS Distributions void * arg1, void * arg2); 8314e3d835SApple OSS Distributions void 8414e3d835SApple OSS Distributions devtimer_cancel(devtimer_ref t); 8514e3d835SApple OSS Distributions 8614e3d835SApple OSS Distributions int 8714e3d835SApple OSS Distributions devtimer_enabled(devtimer_ref t); 8814e3d835SApple OSS Distributions 8914e3d835SApple OSS Distributions struct timeval 9014e3d835SApple OSS Distributions devtimer_current_time(void); 9114e3d835SApple OSS Distributions 9214e3d835SApple OSS Distributions int32_t 9314e3d835SApple OSS Distributions devtimer_current_secs(void); 9414e3d835SApple OSS Distributions 9514e3d835SApple OSS Distributions #endif _NET_DEVTIMER_H 96