conteepprobe.c 1.84 KB

/**************************************************************************
 *                                                                        *
 *               Copyright (C) 1995, Silicon Graphics, Inc.               *
 *                                                                        *
 *  These coded instructions, statements, and computer programs  contain  *
 *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
 *  are protected by Federal copyright law.  They  may  not be disclosed  *
 *  to  third  parties  or copied or duplicated in any form, in whole or  *
 *  in part, without the prior written consent of Silicon Graphics, Inc.  *
 *                                                                        *
 **************************************************************************/

#include "osint.h"
#include "controller.h"
#include "siint.h"
#ifdef BBPLAYER
#include "bbint.h"
#endif

/*
 * This call issues a request command to probe EEPROM.
 * A value of 0 is returned if EEPROM do not exist, otherwise
 * 1 is returned.
 */
s32
osEepromProbe(OSMesgQueue *mq)
{
	s32		ret = 0;
#ifndef BBPLAYER
	u16		type;
	OSContStatus	sdata;
#endif

	/* Block to get resource token */
	__osSiGetAccess();
	
#ifdef BBPLAYER
	/* continue to use SI as resource token */
	ret = 0;
	if (__osBbEepromSize == 512) {
	    ret = EEPROM_TYPE_4K;
	} else if (__osBbEepromSize == 2048) {
	    ret = EEPROM_TYPE_16K;
	}
#else
	ret = __osEepStatus(mq, &sdata);
	type = (u16)(sdata.type & (u16)(CONT_EEPROM | CONT_EEP16K));
	if (ret != 0) {
	  ret = 0;
	} else {
	  switch (type){
	  case (u16)CONT_EEPROM :
	    ret = EEPROM_TYPE_4K;
	    break;
	  case ((u16)CONT_EEPROM | (u16)CONT_EEP16K) :
	    ret = EEPROM_TYPE_16K;
	    break;
	  default :
	    ret = 0;
	    break;
	  }
	}
	__osEepromRead16K = 0;
#endif
	__osSiRelAccess();
	return(ret);
}