/***************************************************************************
*	NAME:  TIMER16.C
**	COPYRIGHT:
**	"Copyright (c) 1994, by FORTE
**
**       "This software is furnished under a license and may be used,
**       copied, or disclosed only in accordance with the terms of such
**       license and with the inclusion of the above copyright notice.
**       This software or any other copies thereof may not be provided or
**       otherwise made available to any other person. No title to and
**       ownership of the software is hereby transfered."
****************************************************************************
*  CREATION DATE: 01/01/94
*--------------------------------------------------------------------------*
*     VERSION	DATE	   NAME		DESCRIPTION
*>	1.0	01/01/94		Original
***************************************************************************/

#include <dos.h>
#include <conio.h>

#include "forte.h"
#include "ultraerr.h"

#include "gf1os.h"
#include "extern16.h"
#include "defs16.h"
#include "codecos.h"
#include "codec.h"
#include "proto16.h"

extern ULTRA16_DATA _codec_data;
extern IMAGE16 _image_codec;
extern ULTRA_DATA _gf1_data;

void
Ultra16StartTimer()
{
_image_codec.afei |= TIMER_ENABLE;

ENTER_CRITICAL;
outp(_codec_data.addr,ALT_FEATURE_1);
outp(_codec_data.data,_image_codec.afei);
LEAVE_CRITICAL;
}

void
Ultra16StopTimer()
{
_image_codec.afei &= ~TIMER_ENABLE;

ENTER_CRITICAL;
outp(_codec_data.addr,ALT_FEATURE_1);
outp(_codec_data.data,_image_codec.afei);
LEAVE_CRITICAL;
}

void
Ultra16SetTimer(count)
unsigned int count;
{
ENTER_CRITICAL;
outp(_codec_data.addr,TIMER_HIGH);
outp(_codec_data.data,(char)((count>>8)));
outp(_codec_data.addr,TIMER_LOW);
outp(_codec_data.data,(char)count);
LEAVE_CRITICAL;
}

