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

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,
1.1.1.4 ! root       65:    boolean_t basepri,
        !            66:    vm_offset_t pc);
1.1       root       67: 
                     68: extern void softclock (void);
                     69: 
                     70: /* For `private' timer elements.  */
                     71: extern void set_timeout(
                     72:    timer_elt_t telt,
                     73:    unsigned int interval);
                     74: extern boolean_t reset_timeout(timer_elt_t telt);
                     75: 
                     76: #define        set_timeout_setup(telt,fcn,param,interval)      \
                     77:        ((telt)->fcn = (fcn),                           \
                     78:         (telt)->param = (param),                       \
                     79:         (telt)->private = TRUE,                        \
                     80:        set_timeout((telt), (interval)))
                     81: 
                     82: #define        reset_timeout_check(t)                          \
                     83:        MACRO_BEGIN                                     \
                     84:        if ((t)->set)                                   \
                     85:            reset_timeout((t));                         \
                     86:        MACRO_END
                     87: 
                     88: extern void init_timeout (void);
                     89: 
1.1.1.3   root       90: /*
                     91:  * Record a timestamp in STAMP.  Records values in the boot-time clock
                     92:  * frame.
                     93:  */
1.1       root       94: extern void record_time_stamp (time_value_t *stamp);
                     95: 
1.1.1.3   root       96: /*
                     97:  * Read a timestamp in STAMP into RESULT.  Returns values in the
                     98:  * real-time clock frame.
                     99:  */
                    100: extern void read_time_stamp (time_value_t *stamp, time_value_t *result);
                    101: 
1.1       root      102: extern kern_return_t host_get_time(
                    103:    host_t host,
                    104:    time_value_t *current_time);
                    105: 
                    106: extern kern_return_t host_set_time(
                    107:    host_t host,
                    108:    time_value_t new_time);
                    109: 
                    110: extern kern_return_t host_adjust_time(
                    111:    host_t host,
                    112:    time_value_t new_adjustment,
                    113:    time_value_t *old_adjustment);
                    114: 
                    115: extern void mapable_time_init (void);
                    116: 
                    117: /* For public timer elements.  */
                    118: extern void timeout(timer_func_t *fcn, void *param, int interval);
1.1.1.2   root      119: extern boolean_t untimeout(timer_func_t *fcn, const void *param);
                    120: 
                    121: extern int timeopen(dev_t dev, int flag, io_req_t ior);
                    122: extern void timeclose(dev_t dev, int flag);
1.1       root      123: 
                    124: #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.