/* --- SCHED.C
   --- This file contains the scheduler routines for running the PUMA
   --- robot with the Trident Robotics and Research, Inc. interface
   --- boards.
   ---
   --- These are only demo routines and are not complete.
   --- You are free to use these routines, or any
   --- part thereof, AT YOUR OWN RISK, provided this entire comment
   --- block and the included copyright notice remain intact.
   ---
   --- Initial coding by Richard Voyles, Trident Robotics.
   ---
   --- Copyright 1996 Trident Robotics and Research, Inc.
   ---
   --- */

#define SCHED_SRC
/* #define DEBUG */

#include <stdio.h>
#include <stdlib.h>
#include "vtypes.h"
#include "robot.h"
#include "sched.h"

#define MAX_READY	16


/* --- Input frequency to the Programmable Interval Timer (8253 or
   --- equivalent) on IBM compatible machines. */
#define TIMER_INPUT_FREQ        1192500.0


/* --- Global variables (all globals end in "G") */
long    clockTicksG;            /* number of timer interrupts since init */
float   clockPeriodG;           /* period, in seconds, of interrupts */
float   clockFreqG;             /* actual frequency, in hertz */
short   DOStimerCntG;		/* number of new timer ticks per DOS tick */
short   installFlagG = 0;       /* flag indicating handler installed */
hndlr_ptr       oldHandlerG;    /* function pointer to old timer handler */
processT   *readyQueueG[MAX_READY]; /* list of functions ready to execute */
procListT	*spawnQueueG; 	/* list of functions spawned */
procListT	*onQueueG; 	/* list of functions running */
short	readyHeadG, readyTailG;
unsigned long	pidG;		/* counting process ID */

/* ************ Function Prototypes ************** */

/* ************ Interrupt Code ******************* */


