/***************************************************************************
*	NAME:  UTIL16.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
AutoCalibrate()
{
ENTER_CRITICAL;
	/* Now, if in auto calibrate, wait for it to finish */
	if (_image_codec.ic & AUTOCALIB)
		{
		outp(_codec_data.addr,TEST_INIT);
		while(inp(_codec_data.addr) != TEST_INIT)
			outp(_codec_data.addr,TEST_INIT);

		while(inp(_codec_data.data) & CALIB_IN_PROGRESS)
			outp(_codec_data.addr,TEST_INIT);
		}
	else
		{
		/* Need to delay here a while if NOT in ACAL... */
		}
LEAVE_CRITICAL;

}

unsigned char
Ultra16Revision()
{
unsigned char version;

ENTER_CRITICAL;
outp(_codec_data.addr,MISC_INFO);
outp(_codec_data.data,_image_codec.mi);
version = inp(_codec_data.data) & 0x0f;
LEAVE_CRITICAL;

return(version);

}

void
Ultra16Version(major,minor)
unsigned int *major;
unsigned int *minor;
{
*major = 1;
*minor = 1;
}

