/**************************************************************************
<MODULE NAME>
<FILENAME></FILENAME>
<HISTORY>
	<MODIFICATION>
		<DATE></DATE>
		<AUTHOR></AUTHOR>
		<DESCRIPTION>
		</DESCRIPTION>
	</MODIFICATION>
</HISTORY>
</MODULE NAME>
**************************************************************************/


/**************************************************************************
INCLUDE FILE
**************************************************************************/
#include <stdio.h>
#include "..\comp\eeprom\EepJItes.h"

/**************************************************************************
LOCAL VARIABLES
Always start with « static »-keyword
**************************************************************************/

/**************************************************************************
<METHOD>
	<CLASS>CEepromJites</CLASS>
	<NAME>CEepromJites</NAME>
	<TYPE> LOCAL  GLOBAL </TYPE>
	<DESCRIPTION></DESCRIPTION>
	<PARAMETERS>
		<PARAMETER>
			<NAME></NAME>
			<TYPE></TYPE>
			<IO> IN | OUT | INOUT</ IO >
			<DESCRIPTION>
			</DESCRIPTION>
		</PARAMETER>
	</PARAMETERS>
</METHOD>
**************************************************************************/
CEepromJites::CEepromJites()
{
	;
}


/**************************************************************************
<METHOD>
	<CLASS>CEepromJites</CLASS>
	<NAME>~CEepromJites</NAME>
	<TYPE> LOCAL | GLOBAL </TYPE>
	<DESCRIPTION></DESCRIPTION>
	<PARAMETERS>
		<PARAMETER>
			<NAME></NAME>
			<TYPE></TYPE>
			<IO>IN | OUT | INOUT</ IO >
			<DESCRIPTION>
			</DESCRIPTION>
		</PARAMETER>
	</PARAMETERS>
</METHOD>
**************************************************************************/
CEepromJites::~CEepromJites()
{
	;
}

/**************************************************************************
<METHOD>
	<CLASS>CEepromJites</CLASS>
	<NAME></NAME>
	<TYPE>LOCAL | GLOBAL</TYPE>
	<DESCRIPTION></DESCRIPTION>
	<PARAMETERS>
		<PARAMETER>
			<NAME></NAME>
			<TYPE></TYPE>
			<IO> IN | OUT | INOUT</ IO >
			<DESCRIPTION>
			</DESCRIPTION>
		</PARAMETER>
	</PARAMETERS>
	<RETURNS>
		<TYPE></TYPE>
		<DESCRIPTION>
		</DESCRIPTION>
	</RETURNS>
</METHOD>
**************************************************************************/
CEeprom* CEepromJites::Instance(void)
{
	if(m_pcInst == NULL)
	{
		m_pcInst = new CEepromJites();
	}	
	return m_pcInst;
}

boolean CEepromJites::EpromInit(ulong ulEpomSeg, ulong ulEpromSize)
{
	EPROM_TAILLE = (long)(1024L * (long)ulEpromSize);
	FP_SEG(m_ucEpromControl) =ulEpomSeg;
	FP_OFF(m_ucEpromControl) = 0x0;
	FP_SEG(m_ucEprom) = ulEpomSeg;
	FP_OFF(m_ucEprom) = 0x0;
	return(true);
} /* Eprom_Init */

/**************************************************************************
<METHOD>
	<CLASS>CEeprom</CLASS>
	<NAME></NAME>
	<TYPE>LOCAL | GLOBAL</TYPE>
	<DESCRIPTION>
		 Lit la valeur d'une adresse de l'EPROM
		 Parametres: adresse sur valeur a lire
			position de l'EPROM a lire
		 Rend le test sur la lecture.      
	</DESCRIPTION>
	<PARAMETERS>
		<PARAMETER>
			<NAME>Valeur</NAME>
			<TYPE>uchar*</TYPE>
			<IO> IN | OUT | INOUT</IO>
			<DESCRIPTION>
			</DESCRIPTION>
		</PARAMETER>
		<PARAMETER>
			<NAME>Emplacement</NAME>
			<TYPE>long</TYPE>
			<IO> IN | OUT | INOUT</IO>
			<DESCRIPTION>
			</DESCRIPTION>
		</PARAMETER>
	</PARAMETERS>
	<RETURNS>
		<TYPE>boolean</TYPE>
		<DESCRIPTION>
		</DESCRIPTION>
	</RETURNS>
</METHOD>
**************************************************************************/
boolean EpromRead(uchar *Valeur, long Emplacement)
/**/
{
  unsigned char _huge *p;
  unsigned char _huge *q;
  unsigned char val;

  if (Emplacement >= EPROM_TAILLE) return(false);
  p = EPROM_CONTROL;
  q = EPROM + (long)Emplacement;
  *p = 0x00;
  val = *q;
  if (val == 255) val = 0;
  *Valeur = val ;

  return(true);
} /* Eprom_Read */
