conteepprobe.c
1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**************************************************************************
* *
* 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);
}