|
|
coherent
aallttccllkk_iinn() -- Accessible Kernel Routine
iinntt
aallttccllkk_iinn(_h_z, _f_n)
iinntt _h_z, (*_f_n)();
aallttccllkk_iinn() increases the system clock rate from the value set by manifest
constant HHZZ (at present, 100 Hertz) to _h_z. Function _f_n will be called every
time the clock interrupt occurs. _h_z must be an integral multiple of HHZZ;
therefore, the rate of clock interrupts will be increased by a factor of
_h_z/HHZZ. _f_n is an iinntt-valued function that must return 0 every _h_z/HHZZ'th time
it is called, nonzero the rest of the time. The zero value returned from
_f_n tells the COHERENT system's clock routine to do its usual processing.
aallttccllkk_iinn() returns 0 if it completes normally; if argument _h_z is less than
HHZZ or not an integral multiple of HHZZ, this function does nothing and
returns -1.
_E_x_a_m_p_l_e
The following gives a partial example of how to use aallttccllkk_iinn() in a device
driver.
#include <sys/const.h> /* #define's HZ */
...
static int scale_factor;
static int poll_fn();
...
/* install high-speed polling of I/O device */
poll_rate = ...;
scale_factor = poll_rate/HZ;
altclk_out();
altclk_in(poll_rate, poll_fn);
...
/* polling function */
int poll_fn()
{
static int count;
...do device polling...
count++;
if (count >= scale_factor)
count = 0;
return count;
}
_S_e_e _A_l_s_o
aacccceessssiibbllee kkeerrnneell rroouuttiinneess, aallttccllkk_oouutt()
_N_o_t_e_s
Avoid naming the polling function aallttccllkk(): there is already a kernel
symbol with this name.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.