Annotation of Gnu-Mach/kern/mach_clock.h, revision 1.1.1.3

1.1       root        1: /*
                      2:  * Copyright (C) 2006, 2007 Free Software Foundation, Inc.
                      3:  *
                      4:  * This program is free software; you can redistribute it and/or modify
                      5:  * it under the terms of the GNU General Public License as published by
                      6:  * the Free Software Foundation; either version 2, or (at your option)
                      7:  * any later version.
                      8:  *
                      9:  * This program is distributed in the hope that it will be useful,
                     10:  * but WITHOUT ANY WARRANTY; without even the implied warranty of
                     11:  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     12:  * GNU General Public License for more details.
                     13:  *
                     14:  * You should have received a copy of the GNU General Public License
                     15:  * along with this program; if not, write to the Free Software
                     16:  * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
                     17:  *
                     18:  * Author: Barry deFreese and others.
                     19:  */
                     20: 
                     21: #ifndef _KERN_MACH_CLOCK_H_
                     22: #define _KERN_MACH_CLOCK_H_
                     23: 
                     24: /*
                     25:  * Mach time-out and time-of-day facility.
                     26:  */
                     27: 
                     28: #include <mach/machine/kern_return.h>
                     29: #include <mach/time_value.h>
                     30: #include <kern/host.h>
                     31: #include <kern/queue.h>
1.1.1.2   root       32: #include <sys/types.h>
                     33: 
                     34: struct io_req;
                     35: typedef struct io_req *io_req_t;
1.1       root       36: 
                     37: 
                     38: /* Timers in kernel.  */
                     39: extern unsigned long   elapsed_ticks;  /* number of ticks elapsed since bootup */
                     40: extern int             hz;             /* number of ticks per second */
                     41: extern int             tick;           /* number of usec per tick */
                     42: 
                     43: 
                     44: typedef void timer_func_t(void *);
                     45: 
                     46: /* Time-out element.  */
                     47: struct timer_elt {
                     48:        queue_chain_t   chain;          /* chain in order of expiration */
                     49:        timer_func_t    *fcn;           /* function to call */
                     50:        void *          param;          /* with this parameter */
                     51:        unsigned long   ticks;          /* expiration time, in ticks */
                     52:        int             set;            /* unset | set | allocated */
                     53: };
                     54: #define        TELT_UNSET      0               /* timer not set */
                     55: #define        TELT_SET        1               /* timer set */
                     56: #define        TELT_ALLOC      2               /* timer allocated from pool */
                     57: 
                     58: typedef        struct timer_elt        timer_elt_data_t;
                     59: typedef        struct timer_elt        *timer_elt_t;
                     60: 
                     61: 
                     62: extern void clock_interrupt(
                     63:    int usec,
                     64:    boolean_t usermode,
                     65:    boolean_t basepri);
                     66: 
                     67: extern void softclock (void);
                     68: 
                     69: /* For `private' timer elements.  */
                     70: extern void set_timeout(
                     71:    timer_elt_t telt,
                     72:    unsigned int interval);
                     73: extern boolean_t reset_timeout(timer_elt_t telt);
                     74: 
                     75: #define        set_timeout_setup(telt,fcn,param,interval)      \
                     76:        ((telt)->fcn = (fcn),                           \
                     77:         (telt)->param = (param),                       \
                     78:         (telt)->private = TRUE,                        \
                     79:        set_timeout((telt), (interval)))
                     80: 
                     81: #define        reset_timeout_check(t)                          \
                     82:        MACRO_BEGIN                                     \
                     83:        if ((t)->set)                                   \
                     84:            reset_timeout((t));                         \
                     85:        MACRO_END
                     86: 
                     87: extern void init_timeout (void);
                     88: 
1.1.1.3 ! root       89: /*
        !            90:  * Record a timestamp in STAMP.  Records values in the boot-time clock
        !            91:  * frame.
        !            92:  */
1.1       root       93: extern void record_time_stamp (time_value_t *stamp);
                     94: 
1.1.1.3 ! root       95: /*
        !            96:  * Read a timestamp in STAMP into RESULT.  Returns values in the
        !            97:  * real-time clock frame.
        !            98:  */
        !            99: extern void read_time_stamp (time_value_t *stamp, time_value_t *result);
        !           100: 
1.1       root      101: extern kern_return_t host_get_time(
                    102:    host_t host,
                    103:    time_value_t *current_time);
                    104: 
                    105: extern kern_return_t host_set_time(
                    106:    host_t host,
                    107:    time_value_t new_time);
                    108: 
                    109: extern kern_return_t host_adjust_time(
                    110:    host_t host,
                    111:    time_value_t new_adjustment,
                    112:    time_value_t *old_adjustment);
                    113: 
                    114: extern void mapable_time_init (void);
                    115: 
                    116: /* For public timer elements.  */
                    117: extern void timeout(timer_func_t *fcn, void *param, int interval);
1.1.1.2   root      118: extern boolean_t untimeout(timer_func_t *fcn, const void *param);
                    119: 
                    120: extern int timeopen(dev_t dev, int flag, io_req_t ior);
                    121: extern void timeclose(dev_t dev, int flag);
1.1       root      122: 
                    123: #endif /* _KERN_MACH_CLOCK_H_ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.