conteepprobe.c 1.56 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"

/*
 * 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;
	u16		type;
	OSContStatus	sdata;

	/* Block to get resource token */
	__osSiGetAccess();
	
	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;
	__osSiRelAccess();
	return(ret);
}