Annotation of coherent/f/usr/man/KERNEL/altclk_in, revision 1.1.1.1

1.1       root        1: aallttccllkk_iinn() -- Accessible Kernel Routine
                      2: 
                      3: iinntt
                      4: aallttccllkk_iinn(_h_z, _f_n)
                      5: iinntt _h_z, (*_f_n)();
                      6: 
                      7: aallttccllkk_iinn() increases the system clock  rate from the value set by manifest
                      8: constant HHZZ (at present, 100 Hertz) to _h_z. Function _f_n will be called every
                      9: time the  clock interrupt occurs.  _h_z  must be an integral  multiple of HHZZ;
                     10: therefore, the  rate of clock interrupts  will be increased by  a factor of
                     11: _h_z/HHZZ.  _f_n is an iinntt-valued function that must return 0 every _h_z/HHZZ'th time
                     12: it is called,  nonzero the rest of the time.   The zero value returned from
                     13: _f_n tells the COHERENT system's clock routine to do its usual processing.
                     14: 
                     15: aallttccllkk_iinn() returns 0 if it completes normally; if argument _h_z is less than
                     16: HHZZ  or not  an integral  multiple  of HHZZ,  this function  does nothing  and
                     17: returns -1.
                     18: 
                     19: _E_x_a_m_p_l_e
                     20: The following gives a partial example of how to use aallttccllkk_iinn() in a device
                     21: driver.
                     22: 
                     23: #include <sys/const.h>  /* #define's HZ */
                     24: ...
                     25: 
                     26: static int scale_factor;
                     27: static int poll_fn();
                     28: ...
                     29: 
                     30:     /* install high-speed polling of I/O device */
                     31:     poll_rate = ...;
                     32:     scale_factor = poll_rate/HZ;
                     33:     altclk_out();
                     34:     altclk_in(poll_rate, poll_fn);
                     35: ...
                     36: 
                     37: /* polling function */
                     38: int poll_fn()
                     39: {
                     40:     static int count;
                     41: 
                     42:     ...do device polling...
                     43: 
                     44:     count++;
                     45:     if (count >= scale_factor)
                     46:         count = 0;
                     47:     return count;
                     48: }
                     49: 
                     50: _S_e_e _A_l_s_o
                     51: aacccceessssiibbllee kkeerrnneell rroouuttiinneess, aallttccllkk_oouutt()
                     52: 
                     53: _N_o_t_e_s
                     54: Avoid  naming the  polling  function aallttccllkk():  there is  already a  kernel
                     55: symbol with this name.

unix.superglobalmegacorp.com

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