home *** CD-ROM | disk | FTP | other *** search
- /***********************************************************************
-
- FILE
- time.c - timing routines
-
- ENTRY ROUTINES
- chronos - timer interrupt service routine
-
- NewDTimer - allocate new countdown timer
- FreeDTimer - deallocate countdown timer
- SetDTimer - set countdown timer
- ReadDTimer - read countdown timer
- StopDTimer - freeze timer
- StartDTimer - unfreeze timer
-
- CisDTimer - set tm_isf field to 0
-
- NewITimer - allocate new interval timer
- FreeITimer - deallocate interval timer
- SetITimer - set interval timer
- ReadITimer - read interval timer
-
- ReadClock - time telling
-
- PRIVATE ROUTINES
- reset_dtimer - reset countdown timer
- reset_itimer - reset interval timer
-
- INITIALIZATION ROUTINES
- InitTime - initialize timer module
- InitSysTime - system initialization for task scheduling
-
- DESCRIPTION
- These routines implement multiple timers in software, using a
- single hardware clock as the real-time base. Actual and
- simulation routines are included.
-
- Note the implementation of multiple prioritized timer interrupts
- in chronos(). Only countdown timers are associated with interrupt
- service routines.
-
- The first two timers are reserved by the kernel for time telling
- and task scheduling.
-
- LAST UPDATE
- 03 May 1985
- restructure allocation routines
- 04 February 1986
- put enable() & disable() in #if BACKGROUND
- 1 December 1987
- implement tm_flag[]
- 26 January 1988
- use the new void types and add ANSI features
-
- Copyright (c) 1985-1988 D.M. Auslander and C.H. Tham
-
- ***********************************************************************/
-
- /***********************************************************************
- I M P O R T S
- ***********************************************************************/
-
- #include <stdio.h>
-
- #include "envir.h" /* environment definitions */
-
- #include "config.h" /* system configuration header */
- #include "8259.h" /* hardware dependent declarations */
- #include "time.h" /* time module declarations */
-
- #ifdef ANSI
- extern int enable(void); /* enable CPU interrupt response */
- extern int disable(void); /* disable CPU interrupt response */
- extern void seoi(int); /* send specific EOI to 8259 */
- extern void panic(char *); /* abort execution */
- #else
- extern int enable(); /* enable CPU interrupt response */
- extern int disable(); /* disable CPU interrupt response */
- extern void seoi(); /* send specific EOI to 8259 */
- extern void panic(); /* abort execution */
- #endif
-
- /***********************************************************************
- F O R W A R D D E C L A R A T I O N S
- ***********************************************************************/
-
- #ifdef ANSI
-
- void reset_dtimer(int);
- void reset_itimer(int);
-
- #else
-
- void reset_dtimer();
- void reset_itimer();
-
- #endif
-
- /***********************************************************************
- P R I V A T E D A T A
- ***********************************************************************/
-
- #define MAXINT 0x7FFF /* max. integer value */
- #define MAXLONG 0x7FFFFFFL /* max. long integer value */
-
- static long tm_dtime[MAXDTIMERS]; /* count down timers */
-
- static int tm_used[MAXDTIMERS]; /* timer in use flag */
- static int tm_lock[MAXDTIMERS]; /* used for virtual time */
- static int tm_flag[MAXDTIMERS]; /* timeout flags */
- static int tm_pri[MAXDTIMERS]; /* priority (countdown only) */
-
- static int tm_isf[MAXDTIMERS]; /* interrupt in service flag */
- static void (*tm_tsr[MAXDTIMERS])(); /* timeout service routines */
- static void *tm_argp[MAXDTIMERS]; /* ptr to arguments */
-
- static long tm_itime[MAXITIMERS]; /* interval timers */
- static int tm_iused[MAXITIMERS]; /* interval timer in use flag */
-
- static long clock; /* countdown since system started */
- static long mstick; /* milliseconds per tick */
-
-
- #define ISF 1 /* whether to use tm_isf field */
- #define AUTO_EOI 0 /* enable and send EOI to 8259 */
-
- #define UNUSED 0 /* timer unused */
- #define USED 1 /* timer in use */
- #define UNLOCK 0 /* timer unlocked */
- #define LOCK 1 /* timer locked */
-
-
- /***********************************************************************
- E N T R Y R O U T I N E S
- ***********************************************************************/
-
- /*---------------------------------------------------------------------
- PROCEDURE
- CHRONOS - Timer Interrupt Service Routine
-
- DESCRIPTION
- First decrements count down timers. Count down timers are only
- decremented if they are in used (ie. allocated to a task) and
- if the timer is not locked. Interval timers are the exception
- and are all incremented irregardless since its probably faster to
- do so than check if they are in use.
-
- Next, the countdown timer array, tm_dtime[], is scanned for zero
- or negative times. If time is zero or negative, see if user has
- specified an interrupt service routine (tm_tsr not NULL). If so,
- set the In Service Flag (tm_isf) and execute the routine, clearing
- tm_isf on completion.
-
- If two or more service routines are due for service, the one with
- the highest priority will be executed first. Only service routines
- with equal or higher priority can interrupt a currently in service
- routine. Priority is set by the user when the timer is allocated.
- The larger the number, the higher the priority.
-
- Service routines are passed a pointer which may point to a scalar
- argument or an aggregate argument block (eg. structures). This
- pointer is cast to a char type pointer.
-
- If this routine is run in a simulation environment, there may be
- simulation routines that have to be executed at every time step,
- regardless of whether a service routine is executed or not. This
- is provided for by the external routine simintr() which is executed
- at every "tick".
-
- Chronos() may be used in programs where the "interrupt" routine
- never returns; the "interrupt" service routine may be a task
- dispatcher or scheduler. In such cases, two course of action are
- possible depending on whether the dispatcher/scheduler. In the
- case of a background scheduler, we normally want to disable the
- in service flag and also reset the hardware interrupt controller.
- This is to allow another timer interrupt to be generated and passed
- to chronos() without the intervention of the dispatcher/scheduler.
- For a foreground dispatcher/scheduler that uses the timer, it will
- want to control exactly when it gives up control, so we do not want
- to send EOI's or enable interrupts here, but allow the foreground
- dispatcher/scheduler to do so with CisDTimer().
-
- The in-service-flag may be ignored by means of the ISF conditional
- compilation switch. The service routine has the task of reseting
- the hardware interrupt controller. CisDTimer() performs both actions.
-
- Chronos() functions like a level triggered interrupt controller.
- As long as other conditions are satisfied, a zero or negative
- count will result in execution of the associated service routine.
-
- Note the use of register pointers for speed.
-
- New: A timeout service routine is only invoked once when the
- count-down timer times out. The timer must be reset by
- SetDTimer() before the timeout handler can be invoked again.
-
- LAST UPDATE
- 28 February 1985
- add ISF test
- 04 February 1986
- use enable() and disable() only if BACKGROUND
- 1 December 1987
- lock timer when isr active, release on reset
- 26 January 1988
- use the new void pointer types
- ----------------------------------------------------------------------*/
-
- void chronos()
- {
- int maxpri; /* max. pri. of in-service routine */
- int index; /* index into timer array */
- int istat; /* interrupt status on entry */
- int i; /* iteration counter */
- register long *p; /* fast pointer to timer times */
-
-
- istat = disable(); /* critical section, disable interrupts */
-
-
- ++clock; /* update clock */
-
- /*---------------------------------------------------------------
- Upon system clock interrupt, increment all interval timers.
- May be faster than checking if they are used b4 incrementing.
- ----------------------------------------------------------------*/
-
- for (p = tm_itime, i = 0; i < MAXITIMERS; i++, p++)
- ++(*p);
-
- /*---------------------------------------------------------------
- If a countdown timer is active and it is not locked, its
- time value is decremented. Does not check if timer has
- timed out since this is taken care of by tm_flag[] and to
- do so here will increase the overheads. The tm_lock[]
- check is needed because we may need to stop certain timers.
- Have to check if timer is in use because a timeout service
- routine may be attached to a timer.
- ----------------------------------------------------------------*/
-
- for (p = tm_dtime, i = 0; i < MAXDTIMERS; i++, p++)
- if ((tm_used[i] == USED) && (tm_lock[i] == UNLOCK))
- --(*p);
-
- #if FOREGROUND /* use timeout service routines */
-
- /*--------------------------------------------------------------
- Find the highest priority of all timer interrupt routines
- currently in service and set maxpri to that priority.
- --------------------------------------------------------------*/
-
- maxpri = -MAXINT;
-
- for (i = 0; i < MAXDTIMERS; i++)
- if ((tm_isf[i] > 0) && (tm_pri[i] > maxpri))
- maxpri = tm_pri[i];
-
- /*--------------------------------------------------------------
- Find any pending service routine with greater or equal
- priority. If index >= 0, such a routine exists and index
- is its offset in tm_tsr[].
- --------------------------------------------------------------*/
-
- index = -1;
-
- for (i = 0; i < MAXDTIMERS; i++)
- {
- if ((tm_dtime[i] <= 0L) && (tm_pri[i] >= maxpri)
- && (tm_isf[i] == 0) && (tm_tsr[i] != (void(*)())NULL)
- && (tm_lock[i] == UNLOCK) && (tm_flag[i] == 0))
- {
- index = i;
- maxpri = tm_pri[i];
- }
- }
-
- if (index >= 0)
- {
- #if ISF
- tm_isf[index] += 1; /* indicate routine in service */
- #endif
- #if AUTO_EOI
- enable();
-
- seoi(TMRVEC); /* specific EOI to intrp. controller */
- #endif
- tm_flag[index] = 1; /* prevent further use until reset */
-
- (*(tm_tsr[index]))(tm_argp[index]);
-
- #if AUTO_EOI
- disable();
- #endif
- #if ISF
- tm_isf[index] -= 1; /* indicate routine done */
- #endif
- }
-
- #endif /* if FOREGROUND */
-
- if (istat)
- enable(); /* release mutual exclusion */
-
- }
-
-
-
- /*----------------------------------------------------------------------
- FUNCTION
- NewDTimer - allocate countdown timer
-
- SYNOPSIS
- int NewDTimer(func, argp, pri)
- void (*func)(), *argp;
- int pri;
-
- PARAMETERS
- func - pointer to service routine
- argp - pointer to argument(s)
- pri - priority
-
- RETURNS
- timer index if successful, -1 if not.
-
- LAST UPDATE
- 26 January 1988
- change func type to void
- ----------------------------------------------------------------------*/
-
- int NewDTimer(func, argp, pri)
- void (*func)(), *argp;
- int pri;
- {
- int i; /* iteration variable */
- int istat; /* interrupt status */
-
-
- istat = disable(); /* disable interrupts, critical section */
-
- for (i = 0; i < MAXDTIMERS; i++)
- if (tm_used[i] != USED)
- break;
-
- if (i < MAXDTIMERS)
- {
- tm_pri[i] = pri;
- tm_tsr[i] = func;
- tm_argp[i] = argp;
- tm_lock[i] = UNLOCK;
- tm_flag[i] = 0;
- tm_used[i] = USED;
- }
- else
- i = -1;
-
- if (istat) /* exit critical section, re-enable intrp */
- enable();
-
- return(i);
- }
-
-
-
- /*----------------------------------------------------------------------
- PROCEDURE
- FreeDTimer - free allocated timer
-
- SYNOPSIS
- void FreeITimer(timer)
- int timer;
-
- PARAMTERS
- timer - timer index number
-
- DESCRIPTION
- Set associated used field to 0, indicating timer is free. Note that
- you MUST ensure that the timer you are returning is obtained with
- NewDTimer. Otherwise, you will screw-up the system for sure.
-
- LAST UPDATE
- 3 May 1985
- ----------------------------------------------------------------------*/
-
- void FreeDTimer(timer)
- int timer;
- {
-
- if ((timer < 0) || (timer >= MAXDTIMERS))
- {
- panic("FreeDTimer: nonexistant countdown timer");
- }
- else if (tm_used[timer] == USED)
- {
- reset_dtimer(timer);
- }
- else
- panic("FreeDTimer: countdown timer not allocated");
-
- }
-
-
-
- /*----------------------------------------------------------------------
- PROCEDURE
- SETDTIMER - set countdown timer
-
- SYNOPSIS
- void SetDTimer(n, ms)
- int n;
- long ms;
-
- PARAMETERS
- n - timer id
- ms - time in milliseconds
-
- DESCRIPTION
- Set countdown timer 'n' for ms milliseconds. If ms is less than
- the resolution of the time-base, tm_dtime is set to zero.
- A negative value of ms deallocates the timer.
-
- LAST UPDATE
- 1 December 1987
- reset tm_flag
- ----------------------------------------------------------------------*/
-
- void SetDTimer(n, ms)
- int n;
- long ms;
- {
- int istat; /* interrupt status */
- long tmp; /* temporary to hold tick calculations */
- int flag; /* temporary to hold flag state */
-
-
- if ((n < 0) || (n >= MAXDTIMERS))
- panic("SetDTimer: nonexistent timer");
- else if (tm_used[n] == UNUSED)
- panic("SetDTimer: timer not allocated");
-
- tmp = ms / mstick;
- flag = (ms > 0L) ? 0 : 1;
-
- istat = disable(); /* guarantee mutual exclusion */
-
- if (ms >= 0L)
- {
- tm_dtime[n] = tmp;
- tm_flag[n] = flag;
- }
- else /* release timer */
- {
- tm_used[n] = UNUSED;
- tm_tsr[n] = (void(*)())NULL;
- }
-
- if (istat)
- enable(); /* release mutual exclusion */
-
- }
-
-
-
- /*----------------------------------------------------------------------
- FUNCTION
- ReadDTimer - read countdown timer
-
- SYNOPSIS
- long ReadDTimer(n)
- int n;
-
- PARAMETER
- n - timer number
-
- RETURNS
- time in milliseconds
-
- REMARKS
- The time left is only accurate to the precision allowed by the
- system clock rate. If quantization is 10 ms, then ReadDTimer()
- will report 10 ms even if actual time left is 1 ms.
-
- LAST UPDATE
- 12 February 1985 by author
- ----------------------------------------------------------------------*/
-
- long ReadDTimer(n)
- int n;
- {
-
- if ((n < 0) || (n >= MAXDTIMERS))
- panic("ReadDTimer: nonexistant timer");
-
- return(tm_dtime[n] * mstick);
- }
-
-
-
- /*----------------------------------------------------------------------
- PROCEDURE
- STOPDTIMER - stop timer from counting down
-
- SYNOPSIS
- void StopDTimer(n)
- int n;
-
- PARAMETER
- n - timer number
-
- DESCRIPTION
- This routine should only be used by the system to freeze timers
- used by background process for virtual timing, ie. time proceeds
- only when that process is running. An important use is for
- background scheduling.
-
- As this is an internal system routine, error checking is lax.
-
- SEE ALSO
- StartDTimer() to restart stopped timers
-
- LAST UPDATE
- 12 February 1985
- ----------------------------------------------------------------------*/
-
- void StopDTimer(n)
- int n;
- {
- int istat; /* interrupt status */
-
-
- if ((n < 0) || (n >= MAXDTIMERS))
- panic("StopDTimer: nonexistent timer");
-
- istat = disable();
-
- tm_lock[n] = LOCK;
-
- if (istat)
- enable();
- }
-
-
-
- /*----------------------------------------------------------------------
- PROCEDURE
- STARTDTIMER - stop timer from counting down
-
- SYNOPSIS
- void StartDTimer(n)
- int n;
-
- PARAMETER
- n - timer number
-
- REMARKS
- This routine should only be used by the system to restart timers
- frozen by a StopDTimer call.
-
- SEE ALSO
- StopDTimer() to stop timers
-
- LAST UPDATE
- 12 February 1985 by author
- ----------------------------------------------------------------------*/
-
- void StartDTimer(n)
- int n;
- {
- int istat; /* interrupt status */
-
-
- if ((n < 0) || (n >= MAXDTIMERS))
- panic("StartDTimer: nonexistent timer");
-
- istat = disable();
-
- tm_lock[n] = UNLOCK;
-
- if (istat)
- enable();
-
- }
-
-
-
- /*----------------------------------------------------------------------
- PROCEDURE
- CISDTIMER - clear in service flags (software and hardware)
-
- SYNOPSIS
- void CisDTimer(n)
- int n;
-
- PARAMTER
- n - countdown timer number
-
- REMARKS
- The purpose is to allow another invokation of the timeout service
- routine at the next timer interrupt.
-
- LAST UPDATE
- 1 December 1987
- clear tm_flag
- ----------------------------------------------------------------------*/
-
- void CisDTimer(n)
- int n;
- {
- int istat; /* interrupt status */
-
-
- if ((n < 0) || (n >= MAXDTIMERS))
- panic("CisDTimer: nonexistant timer");
-
- istat = disable();
-
- tm_isf[n] = 0;
- tm_flag[n] = 0;
-
- seoi(TMRVEC); /* send specific EOI to interrupt controller */
-
- if (istat)
- enable();
-
- }
-
-
-
- /*---------------------------------------------------------------------
- PROCEDURE
- SETTSR - install timeout service routine
-
- SYNOPSIS
- void SetTsr(n, func, argp, pri)
- void (*func)(), *argp;
- int n, pri;
-
- PARAMETERS
- n - timer id
- func - pointer to service routine
- argp - pointer to argument structure
- pri - priority
-
- REMARKS
- There had better be no mistakes when specifying timer.
-
- LAST UPDATE
- 26 January 1988
- use the new void types
- ----------------------------------------------------------------------*/
-
- void SetTsr(n, func, argp, pri)
- void (*func)(), *argp;
- int n, pri;
- {
- int istat; /* interrupt status */
-
-
- if ((n < 0) || (n >= MAXDTIMERS))
- panic("SetTsr: nonexistant timer");
-
- istat = disable();
-
- tm_pri[n] = pri;
- tm_tsr[n] = func;
- tm_argp[n] = argp;
- tm_lock[n] = UNLOCK;
- tm_flag[n] = 0;
- tm_used[n] = USED;
-
- if (istat)
- enable();
-
- }
-
-
-
- /*----------------------------------------------------------------------
- FUNCTION
- TIMEUP - has timer run out?
-
- SYNOPSIS
- int TimeUp(n)
- int n;
-
- PARAMETER
- n - timer number
-
- RETURNS
- 0 if timer has not timed out
- 1 if it has timed out
-
- LAST UPDATE
- 29 January 1988
- created as this makes more sense than reading the timer
- ----------------------------------------------------------------------*/
-
- int TimeUp(n)
- int n;
- {
-
- if ((n < 0) || (n >= MAXDTIMERS))
- panic("TimeUp: nonexistant timer");
-
- return(tm_dtime[n] <= 0L ? 1 : 0);
- }
-
-
-
- /*----------------------------------------------------------------------
- FUNCTION
- NewITimer - allocate interval timer
-
- SYNOPSIS
- int NewITimer()
-
- RETURNS
- timer index if successful, -1 if not.
-
- LAST UPDATE
- 3 May 1985
- ----------------------------------------------------------------------*/
-
- int NewITimer()
- {
- int istat; /* interrupt status */
- int i; /* iteration variable */
-
-
- istat = disable(); /* disable interrupts, critical section */
-
- for (i = 0; i < MAXITIMERS; i++)
- if (tm_iused[i] != USED)
- break;
-
- if (i < MAXITIMERS)
- {
- reset_itimer(i);
-
- tm_iused[i] = USED;
- }
- else
- i = -1;
-
- if (istat) /* exit critical section, re-enable intrp */
- enable();
-
- return(i);
- }
-
-
-
- /*----------------------------------------------------------------------
- PROCEDURE
- FreeITimer - free allocated interval timer
-
- SYNOPSIS
- void FreeITimer(timer)
- int timer;
-
- PARAMTERS
- timer - timer index number
-
- DESCRIPTION
- Set associated used field to 0, indicating timer is free. Note that
- you MUST ensure that the timer you are returning is obtained with
- NewITimer. Otherwise, you will screw-up the system for sure.
-
- LAST UPDATE
- 3 May 1985 by author
- ----------------------------------------------------------------------*/
-
- void FreeITimer(timer)
- int timer;
- {
-
- if ((timer < 0) || (timer >= MAXITIMERS))
- {
- panic("FreeITimer: nonexistant interval timer");
- }
- else if (tm_iused[timer] == USED)
- {
- reset_itimer(timer);
- }
- else
- panic("FreeITimer: interval timer not allocated");
-
- }
-
-
-
- /*----------------------------------------------------------------------
- PROCEDURE
- SetITimer - set interval timer
-
- SYNOPSIS
- void SetITimer(n);
- int n;
-
- PARAMETERS
- n - timer id
-
- REMARKS
- Set interval time value to 0.
-
- LAST UPDATE
- 13 October 1984
- ----------------------------------------------------------------------*/
-
- void SetITimer(n)
- int n;
- {
-
- if ((n < 0) || (n >= MAXITIMERS))
- panic("SetITimer: nonexistant timer");
-
- tm_itime[n] = 0;
-
- }
-
-
-
- /*----------------------------------------------------------------------
- FUNCTION
- ReadITimer - read interval timer
-
- SYNOPSIS
- long ReadITimer(n);
- int n;
-
- PARAMETERS
- n - timer id
-
- RETURNS
- interval value in milliseconds
-
- LAST UPDATE
- 13 October 1984
- ----------------------------------------------------------------------*/
-
- long ReadITimer(n)
- int n;
- {
-
- if ((n < 0) || (n >= MAXITIMERS))
- panic("ReadITimer: nonexistant timer");
-
- return(tm_itime[n] * mstick);
- }
-
-
-
- /*----------------------------------------------------------------------
- FUNCTION
- ReadClock - read system time
-
- SYNOPSIS
- long ReadClock()
-
- RETURNS
- time elasped in milliseconds since system is born
-
- LAST UPDATE
- 12 February 1985
- ----------------------------------------------------------------------*/
-
- long ReadClock()
- {
-
- return(clock * mstick);
- }
-
-
-
- /***********************************************************************
- P R I V A T E R O U T I N E S
- ***********************************************************************/
-
- /*----------------------------------------------------------------------
- PROCEDURE
- reset_dtimer - reset countdown timer
-
- SYNOPSIS
- static reset_dtimer(n)
- int n;
-
- PARAMETER
- n - timer id
-
- LAST UPDATE
- 1 December 1987
- clear tm_flag
- ----------------------------------------------------------------------*/
-
- static void reset_dtimer(n)
- int n;
- {
-
- tm_dtime[n] = MAXLONG;
- tm_used[n] = UNUSED;
- tm_lock[n] = UNLOCK;
- tm_flag[n] = 0;
- tm_pri[n] = PZERO - 1;
- tm_isf[n] = 0;
- tm_tsr[n] = (void(*)())NULL;
- tm_argp[n] = (void *)NULL;
-
- }
-
-
-
- /*----------------------------------------------------------------------
- PROCEDURE
- reset_itimer - reset interval timer
-
- SYNOPSIS
- static void reset_itimer(n)
- int n;
-
- PARAMETER
- n - timer id
-
- LAST UPDATE
- 12 February 1985
- ----------------------------------------------------------------------*/
-
- static void reset_itimer(n)
- int n;
- {
-
- tm_itime[n] = 0L;
- tm_iused[n] = UNUSED;
-
- }
-
-
- /***********************************************************************
- I N I T I A L I Z A T I O N R O U T I N E S
- ***********************************************************************/
-
- /*----------------------------------------------------------------------
- PROCEDURE
- INITTIME - initialize this module
-
- SYNOPSIS
- void InitTime(ms)
- long ms;
-
- PARAMETER
- ms - milliseconds per tick
-
- LAST UPDATE
- 12 February 1985
- separate countdown and interval timers.
- ----------------------------------------------------------------------*/
-
- void InitTime(ms)
- long ms;
- {
- int i; /* iteration variable */
-
-
- mstick = ms;
- clock = 0L;
-
-
- for (i = 0; i < MAXDTIMERS; i++)
- {
- reset_dtimer(i);
- }
-
- for (i = 0; i < MAXITIMERS; i++)
- {
- reset_itimer(i);
- }
-
- }
-
-
- #ifdef CLOTHO /* used by clotho kernel only */
-
- /*----------------------------------------------------------------------
- PROCEDURE
- INITSYSTIME - allocate and initialize timers for system
-
- SYNOPSIS
- void InitSysTime(dispatcher)
- void (*dispatcher)();
-
- PARAMETER
- dispatcher - pointer to clotho's scheduler/dispatcher
-
- REMARKS
- timer 0 - reserved for normal dispatcher
- timer 1 - reserved for control-task dispatcher/scheduler
-
- LAST UPDATE
- 12 February 1985
- ----------------------------------------------------------------------*/
-
- void InitSysTime(dispatcher)
- void (*dispatcher)();
- {
-
- if ((SLC_TIMER >= MAXDTIMERS) || (STL_TIMER >= MAXDTIMERS))
- panic("InitSysTime: check SLC_TIMER & STL_TIMER < MAXDTIMERS");
-
- tm_used[SLC_TIMER] = USED;
- tm_lock[SLC_TIMER] = UNLOCK;
- tm_flag[SLC_TIMER] = 0;
-
- tm_used[STL_TIMER] = USED;
- tm_lock[STL_TIMER] = UNLOCK;
- tm_flag[STL_TIMER] = 0;
-
- #if FOREGROUND
-
- /***** set up timer for time-slice priority dispatcher *****/
-
- tm_tsr[SLC_TIMER] = dispatcher;
- tm_argp[SLC_TIMER] = (void *)SLC_TIMER;
- tm_pri[SLC_TIMER] = PZERO + 1; /* has low priority */
- tm_dtime[SLC_TIMER] = 0; /* start background next */
-
-
- /***** set up timer for control-task STL dispatcher *****/
-
- tm_tsr[STL_TIMER] = dispatcher;
- tm_argp[STL_TIMER] = (void *)STL_TIMER;
- tm_pri[STL_TIMER] = MAXINT; /* has very high priority */
- tm_dtime[STL_TIMER] = MAXLONG;
-
- #endif
-
- }
-
- #endif /* ifdef CLOTHO */
-