123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592 |
- /*
- * config sensor sdr in here.
- * Author:Jimbo
- */
- #include "sensor_sdr.h"
- #include "sensor_thread.h"
- #include <stdio.h>
- #include <stdint.h>
- #include "bmc_main.h"
- #include "bmc_type.h"
- /*
- * sensor sdr table, use sensor number as index.
- */
- static INT16U SDR_ReserveSDRRepository (void);
- static MgmtCtrlrDevLocator_T MgmtCtrlrDevLocator =
- {
- /* SDR Record Header */
- 0x01, /* Record ID */
- 0x51, /* SDR Version */
- 0x12, /* Record Type */
- 11 + MAX_ID_STR_LEN,//sizeof "AST2300",/* Record Length = 11+ string length*/
- /* Record Key Bytes*/
- 0x2a, /* Slave address - 0x20 Primary BMC */
- 0x00, /* ChannelNumber - 0x00 Primary BMC */
- /* Record Body Bytes */
- 0x0, /* power state notification */
- 0xff, /* Device Capablities */
- {0x00,0x00,0x00}, /* RESERVED */
- 0x0, /* Entity ID */
- 0x1, /* Entity Instance */
- 0x0, /* OEM */
- 0xc0 + MAX_ID_STR_LEN, /* ID String Type / Length Code */
- "AST2300"
- };
- static SDRRec_T sdr_tbl[]=
- {
- /*
- * sensor number: 0
- * sensor name: LM73
- * brief: temporary
- */
- (FullSensorRec_T){
- /* SDR Record Header */
- 0x02, //Record ID
- 0x51, //SDR Version
- 0x01, //Record Type
- 43+MAX_ID_STR_LEN,//MAX_ID_STR_LEN,//0x43+MAX_ID_STR_LEN, //Record Length = 43+string length
- /* Record Key Bytes */
- 0x20, //Sensor Owner ID
- 0x0, //Sensor Owner LUN
- 0x0,//0x1//sensor_tbl[0].sensor_number, //Sensor Number
- /* Record Body Bytes */
- 0x7, //Entity ID
- 0x1, //Entity Instance
- 0x7f, //Entity Initialization
- 0x68, //Sensor Capabilities
- 0x01, //Sensor Type
- 0x01, //Event / Reading Type
- 0x7a95, //Lower Threshold Reading Mask
- 0x7a95, //Upper Threshold Reading Mask
- 0x3f3f, //Settable / Readable Threshold Mask
- (0x2<<6)+(0x0<<3)+(0x0<<1)+0x0, //Sensor Units 1
- 0x1, //Sensor Units 2 - Base Unit
- 0x0, //Sensor Units 3 - Modifier Unit
- 0x0, //Linerization
- 0x2, //M
- ((0x2>>2)&0xC0)+(0x0&0x3F), //M,Tolerance
- 0x0, //B
- ((0x0>>2)&0xC0)+(0x0&0x3F), //B,Accuracy
- ((0x0>>2)&0xF0)+(0x0&0x0C)+0x0, //Accuracy,Accuracy exponent
- (0x0<<4)+(0x0&0x0F), //R exponent,B exponent
- 0x0, //Analog Characteristics Flags
- 0x7f, //Nominal Reading
- 0x7f, //Normal Maximum
- 0x80, //Normal Minimum
- 0x7f, //Sensor Maximum Reading
- 0x80, //Sensor Minimum Reading
- 0x7f, //Upper Non-Recoverable Threshold
- 0x7f, //Upper Critical Threshold
- 0x7f, //Upper Non-Critical Threshold
- 0x80, //Lower Non-Recoverable Threshold
- 0x80, //Lower Critical Threshold
- 0x80, //Lower Non-Critical threshold
- 0x0, //Positive - threshold Hysteresis value
- 0x0, //Negative - threshold Hysteresis value
- 0x0, //Reserved
- 0x0, //Reserved
- 0x0, //OEM
- 0xC0+MAX_ID_STR_LEN,//MAX_ID_STR_LEN, //ID String Type / Length Code
- "lm73_1"
- },
- /*
- * sensor number: 1
- * sensor name: LM73
- * brief: temporary
- */
- (FullSensorRec_T){
- /* SDR Record Header */
- 0x03, //Record ID
- 0x51, //SDR Version
- 0x01, //Record Type
- 43+MAX_ID_STR_LEN,//0x43+MAX_ID_STR_LEN, //Record Length = 43+string length
- /* Record Key Bytes */
- 0x20, //Sensor Owner ID
- 0x0, //Sensor Owner LUN
- 0x1,//sensor_tbl[1].sensor_number, //Sensor Number
- /* Record Body Bytes */
- 0x8, //Entity ID
- 0x1, //Entity Instance
- 0x7f, //Entity Initialization
- 0x68, //Sensor Capabilities
- 0x02, //Sensor Type
- 0x01, //Event / Reading Type
- 0x7a95, //Lower Threshold Reading Mask
- 0x7a95, //Upper Threshold Reading Mask
- 0x3f3f, //Settable / Readable Threshold Mask
- (0x2<<6)+(0x0<<3)+(0x0<<1)+0x0, //Sensor Units 1
- 0x4, //Sensor Units 2 - Base Unit
- 0x0, //Sensor Units 3 - Modifier Unit
- 0x0, //Linerization
- 0x2, //M
- ((0x2>>2)&0xC0)+(0x0&0x3F), //M,Tolerance
- 0x0, //B
- ((0x0>>2)&0xC0)+(0x0&0x3F), //B,Accuracy
- ((0x0>>2)&0xF0)+(0x0&0x0C)+0x0, //Accuracy,Accuracy exponent
- (0x0<<4)+(0x0&0x0F), //R exponent,B exponent
- 0x0, //Analog Characteristics Flags
- 0x7f, //Nominal Reading
- 0x7f, //Normal Maximum
- 0x80, //Normal Minimum
- 0x7f, //Sensor Maximum Reading
- 0x80, //Sensor Minimum Reading
- 0x7f, //Upper Non-Recoverable Threshold
- 0x7f, //Upper Critical Threshold
- 0x7f, //Upper Non-Critical Threshold
- 0x80, //Lower Non-Recoverable Threshold
- 0x80, //Lower Critical Threshold
- 0x80, //Lower Non-Critical threshold
- 0x0, //Positive - threshold Hysteresis value
- 0x0, //Negative - threshold Hysteresis value
- 0x0, //Reserved
- 0x0, //Reserved
- 0x0, //OEM
- 0xC0+MAX_ID_STR_LEN, //ID String Type / Length Code
- "lm73_2"
- },
- /*
- * * sensor number: 1
- * * sensor name: LM73
- * * brief: temporary
- * */
- (FullSensorRec_T){
- /* SDR Record Header */
- 0x04, //Record ID_H
- 0x51, //SDR Version
- 0x01, //Record Type
- 43+MAX_ID_STR_LEN, //Record Length = 43+string length
- /* Record Key Bytes */
- 0x20, //Sensor Owner ID
- 0x0, //Sensor Owner LUN
- 0x2,//sensor_tbl[2].sensor_number, //Sensor Number
- /* Record Body Bytes */
- 0x8, //Entity ID
- 0x1, //Entity Instance
- 0x7f, //Entity Initialization
- 0x68, //Sensor Capabilities
- 0x02, //Sensor Type
- 0x01, //Event / Reading Type
- 0x7a95, //Lower Threshold Reading Mask
- 0x7a95, //Upper Threshold Reading Mask
- 0x3f3f, //Settable / Readable Threshold Mask
- (0x00<<6)+(0x0<<3)+(0x0<<1)+0x0, //Sensor Units 1
- 0x4, //Sensor Units 2 - Base Unit
- 0x0, //Sensor Units 3 - Modifier Unit
- 0x0, //Linerization
- 16, //M
- ((0x2>>2)&0xC0)+(0x0&0x3F), //M,Tolerance
- 0x0, //B
- ((0x0>>2)&0xC0)+(0x0&0x3F), //B,Accuracy
- ((0x0>>2)&0xF0)+(0x0&0x0C)+0x0, //Accuracy,Accuracy exponent
- (13<<4)+(0x0&0x0F), //R exponent,B exponent
- 0x0, //Analog Characteristics Flags
- 0x0, //Nominal Reading
- 0xff, //Normal Maximum
- 0x00, //Normal Minimum
- 0xff, //Sensor Maximum Reading
- 0x00, //Sensor Minimum Reading
- 0xff, //Upper Non-Recoverable Threshold
- 0xff, //Upper Critical Threshold
- 0xff, //Upper Non-Critical Threshold
- 0x00, //Lower Non-Recoverable Threshold
- 0x00, //Lower Critical Threshold
- 0x00, //Lower Non-Critical threshold
- 0x0, //Positive - threshold Hysteresis value
- 0x0, //Negative - threshold Hysteresis value
- 0x0, //Reserved
- 0x0, //Reserved
- 0x0, //OEM
- 0xC0+MAX_ID_STR_LEN, //ID String Type / Length Code
- "3V3_Vlot"
- },
- (FullSensorRec_T){
- /* SDR Record Header */
- 0x05, //Record ID_H
- 0x51, //SDR Version
- 0x01, //Record Type
- 43+MAX_ID_STR_LEN, //Record Length = 43+string length
- /* Record Key Bytes */
- 0x20, //Sensor Owner ID
- 0x0, //Sensor Owner LUN
- 0x3,//sensor_tbl[2].sensor_number, //Sensor Number
- /* Record Body Bytes */
- 0x8, //Entity ID
- 0x1, //Entity Instance
- 0x7f, //Entity Initialization
- 0x68, //Sensor Capabilities
- 0x02, //Sensor Type
- 0x01, //Event / Reading Type
- 0x7a95, //Lower Threshold Reading Mask
- 0x7a95, //Upper Threshold Reading Mask
- 0x3f3f, //Settable / Readable Threshold Mask
- (0x00<<6)+(0x0<<3)+(0x0<<1)+0x0, //Sensor Units 1
- 0x4, //Sensor Units 2 - Base Unit
- 0x0, //Sensor Units 3 - Modifier Unit
- 0x0, //Linerization
- 32, //M
- ((0x2>>2)&0xC0)+(0x0&0x3F), //M,Tolerance
- 0x0, //B
- ((0x0>>2)&0xC0)+(0x0&0x3F), //B,Accuracy
- ((0x0>>2)&0xF0)+(0x0&0x0C)+0x0, //Accuracy,Accuracy exponent
- (13<<4)+(0x0&0x0F), //R exponent,B exponent
- 0x0, //Analog Characteristics Flags
- 0x0, //Nominal Reading
- 0xff, //Normal Maximum
- 0x00, //Normal Minimum
- 0xff, //Sensor Maximum Reading
- 0x00, //Sensor Minimum Reading
- 0xff, //Upper Non-Recoverable Threshold
- 0xff, //Upper Critical Threshold
- 0xff, //Upper Non-Critical Threshold
- 0x00, //Lower Non-Recoverable Threshold
- 0x00, //Lower Critical Threshold
- 0x00, //Lower Non-Critical threshold
- 0x0, //Positive - threshold Hysteresis value
- 0x0, //Negative - threshold Hysteresis value
- 0x0, //Reserved
- 0x0, //Reserved
- 0x0, //OEM
- 0xC0+MAX_ID_STR_LEN, //ID String Type / Length Code
- "5V0_Volt"
- },
- (FullSensorRec_T){
- /* SDR Record Header */
- 0x06, //Record ID_H
- 0x51, //SDR Version
- 0x01, //Record Type
- 43+MAX_ID_STR_LEN, //Record Length = 43+string length
- /* Record Key Bytes */
- 0x20, //Sensor Owner ID
- 0x0, //Sensor Owner LUN
- 0x4,//sensor_tbl[2].sensor_number, //Sensor Number
- /* Record Body Bytes */
- 0x8, //Entity ID
- 0x1, //Entity Instance
- 0x7f, //Entity Initialization
- 0x68, //Sensor Capabilities
- 0x02, //Sensor Type
- 0x01, //Event / Reading Type
- 0x7a95, //Lower Threshold Reading Mask
- 0x7a95, //Upper Threshold Reading Mask
- 0x3f3f, //Settable / Readable Threshold Mask
- (0x00<<6)+(0x0<<3)+(0x0<<1)+0x0, //Sensor Units 1
- 0x4, //Sensor Units 2 - Base Unit
- 0x0, //Sensor Units 3 - Modifier Unit
- 0x0, //Linerization
- 64, //M
- ((0x2>>2)&0xC0)+(0x0&0x3F), //M,Tolerance
- 0x0, //B
- ((0x0>>2)&0xC0)+(0x0&0x3F), //B,Accuracy
- ((0x0>>2)&0xF0)+(0x0&0x0C)+0x0, //Accuracy,Accuracy exponent
- (13<<4)+(0x0&0x0F), //R exponent,B exponent
- 0x0, //Analog Characteristics Flags
- 0x0, //Nominal Reading
- 0xff, //Normal Maximum
- 0x00, //Normal Minimum
- 0xff, //Sensor Maximum Reading
- 0x00, //Sensor Minimum Reading
- 0xff, //Upper Non-Recoverable Threshold
- 0xff, //Upper Critical Threshold
- 0xff, //Upper Non-Critical Threshold
- 0x00, //Lower Non-Recoverable Threshold
- 0x00, //Lower Critical Threshold
- 0x00, //Lower Non-Critical threshold
- 0x0, //Positive - threshold Hysteresis value
- 0x0, //Negative - threshold Hysteresis value
- 0x0, //Reserved
- 0x0, //Reserved
- 0x0, //OEM
- 0xC0+MAX_ID_STR_LEN, //ID String Type / Length Code
- "12V0_Volt"
- },
- (FullSensorRec_T){
- /* SDR Record Header */
- 0x07, //Record ID_H
- 0x51, //SDR Version
- 0x01, //Record Type
- 43+MAX_ID_STR_LEN, //Record Length = 43+string length
- /* Record Key Bytes */
- 0x20, //Sensor Owner ID
- 0x0, //Sensor Owner LUN
- 0x5,//sensor_tbl[2].sensor_number, //Sensor Number
- /* Record Body Bytes */
- 0x8, //Entity ID
- 0x1, //Entity Instance
- 0x7f, //Entity Initialization
- 0x68, //Sensor Capabilities
- 0x03, //Sensor Type
- 0x01, //Event / Reading Type
- 0x7a95, //Lower Threshold Reading Mask
- 0x7a95, //Upper Threshold Reading Mask
- 0x3f3f, //Settable / Readable Threshold Mask
- (0x00<<6)+(0x0<<3)+(0x0<<1)+0x0, //Sensor Units 1
- 0x5, //Sensor Units 2 - Base Unit
- 0x0, //Sensor Units 3 - Modifier Unit
- 0x0, //Linerization
- 2, //M
- ((0x2>>2)&0xC0)+(0x0&0x3F), //M,Tolerance
- 0x0, //B
- ((0x0>>2)&0xC0)+(0x0&0x3F), //B,Accuracy
- ((0x0>>2)&0xF0)+(0x0&0x0C)+0x0, //Accuracy,Accuracy exponent
- (14<<4)+(0x0&0x0F), //R exponent,B exponent
- 0x0, //Analog Characteristics Flags
- 0x0, //Nominal Reading
- 0xff, //Normal Maximum
- 0x00, //Normal Minimum
- 0xff, //Sensor Maximum Reading
- 0x00, //Sensor Minimum Reading
- 0xff, //Upper Non-Recoverable Threshold
- 0xff, //Upper Critical Threshold
- 0xff, //Upper Non-Critical Threshold
- 0x00, //Lower Non-Recoverable Threshold
- 0x00, //Lower Critical Threshold
- 0x00, //Lower Non-Critical threshold
- 0x0, //Positive - threshold Hysteresis value
- 0x0, //Negative - threshold Hysteresis value
- 0x0, //Reserved
- 0x0, //Reserved
- 0x0, //OEM
- 0xC0+MAX_ID_STR_LEN, //ID String Type / Length Code
- "3V3_Amps"
- },
- (FullSensorRec_T){
- /* SDR Record Header */
- 0x08, //Record ID_H
- 0x51, //SDR Version
- 0x01, //Record Type
- 43+MAX_ID_STR_LEN, //Record Length = 43+string length
- /* Record Key Bytes */
- 0x20, //Sensor Owner ID
- 0x0, //Sensor Owner LUN
- 0x6,//sensor_tbl[2].sensor_number, //Sensor Number
- /* Record Body Bytes */
- 0x8, //Entity ID
- 0x1, //Entity Instance
- 0x7f, //Entity Initialization
- 0x68, //Sensor Capabilities
- 0x03, //Sensor Type
- 0x01, //Event / Reading Type
- 0x7a95, //Lower Threshold Reading Mask
- 0x7a95, //Upper Threshold Reading Mask
- 0x3f3f, //Settable / Readable Threshold Mask
- (0x00<<6)+(0x0<<3)+(0x0<<1)+0x0, //Sensor Units 1
- 0x5, //Sensor Units 2 - Base Unit
- 0x0, //Sensor Units 3 - Modifier Unit
- 0x0, //Linerization
- 2, //M
- ((0x2>>2)&0xC0)+(0x0&0x3F), //M,Tolerance
- 0x0, //B
- ((0x0>>2)&0xC0)+(0x0&0x3F), //B,Accuracy
- ((0x0>>2)&0xF0)+(0x0&0x0C)+0x0, //Accuracy,Accuracy exponent
- (14<<4)+(0x0&0x0F), //R exponent,B exponent
- 0x0, //Analog Characteristics Flags
- 0x0, //Nominal Reading
- 0xff, //Normal Maximum
- 0x00, //Normal Minimum
- 0xff, //Sensor Maximum Reading
- 0x00, //Sensor Minimum Reading
- 0xff, //Upper Non-Recoverable Threshold
- 0xff, //Upper Critical Threshold
- 0xff, //Upper Non-Critical Threshold
- 0x00, //Lower Non-Recoverable Threshold
- 0x00, //Lower Critical Threshold
- 0x00, //Lower Non-Critical threshold
- 0x0, //Positive - threshold Hysteresis value
- 0x0, //Negative - threshold Hysteresis value
- 0x0, //Reserved
- 0x0, //Reserved
- 0x0, //OEM
- 0xC0+MAX_ID_STR_LEN, //ID String Type / Length Code
- "5V0_Amps"
- },
- (FullSensorRec_T){
- /* SDR Record Header */
- 0x09, //Record ID_H
- 0x51, //SDR Version
- 0x01, //Record Type
- 43+MAX_ID_STR_LEN, //Record Length = 43+string length
- /* Record Key Bytes */
- 0x20, //Sensor Owner ID
- 0x0, //Sensor Owner LUN
- 0x7,//sensor_tbl[2].sensor_number, //Sensor Number
- /* Record Body Bytes */
- 0x8, //Entity ID
- 0x1, //Entity Instance
- 0x7f, //Entity Initialization
- 0x68, //Sensor Capabilities
- 0x03, //Sensor Type
- 0x01, //Event / Reading Type
- 0x7a95, //Lower Threshold Reading Mask
- 0x7a95, //Upper Threshold Reading Mask
- 0x3f3f, //Settable / Readable Threshold Mask
- (0x00<<6)+(0x0<<3)+(0x0<<1)+0x0, //Sensor Units 1
- 0x5, //Sensor Units 2 - Base Unit
- 0x0, //Sensor Units 3 - Modifier Unit
- 0x0, //Linerization
- 2, //M
- ((0x2>>2)&0xC0)+(0x0&0x3F), //M,Tolerance
- 0x0, //B
- ((0x0>>2)&0xC0)+(0x0&0x3F), //B,Accuracy
- ((0x0>>2)&0xF0)+(0x0&0x0C)+0x0, //Accuracy,Accuracy exponent
- (14<<4)+(0x0&0x0F), //R exponent,B exponent
- 0x0, //Analog Characteristics Flags
- 0x0, //Nominal Reading
- 0xff, //Normal Maximum
- 0x00, //Normal Minimum
- 0xff, //Sensor Maximum Reading
- 0x00, //Sensor Minimum Reading
- 0xff, //Upper Non-Recoverable Threshold
- 0xff, //Upper Critical Threshold
- 0xff, //Upper Non-Critical Threshold
- 0x00, //Lower Non-Recoverable Threshold
- 0x00, //Lower Critical Threshold
- 0x00, //Lower Non-Critical threshold
- 0x0, //Positive - threshold Hysteresis value
- 0x0, //Negative - threshold Hysteresis value
- 0x0, //Reserved
- 0x0, //Reserved
- 0x0, //OEM
- 0xC0+MAX_ID_STR_LEN, //ID String Type / Length Code
- "12V0_Amps"
- },
- {0} //dummy sdr when 0 sensors
- };
- SDRRec_T *getSensorSdr(uint8_t sensorNum)
- {
- uint8_t temp = 0;
- temp = sizeof(sdr_tbl)/sizeof(SDRRec_T);
- if(temp != MAX_SENSOR_NUM+1) //there is a dummy sdr
- {
- printf("Error:Invalid sdr table!\n");
- return NULL;
- }
- if(sensorNum >= MAX_SENSOR_NUM)
- {
- printf("Error: Invalid sensor number!\n");
- return NULL;
- }
- return &sdr_tbl[sensorNum];
- }
- /*---------------------------------------
- * * GetSDRRepositoryInfo
- * *---------------------------------------*/
- int
- GetSDRRepositoryInfo (_NEAR_ INT8U* pReq, INT8U ReqLen, _NEAR_ INT8U* pRes,_NEAR_ int BMCInst)
- {
- // printf("start GetSDRRepositoryInfo\n");
- _NEAR_ SDRRepositoryInfo_T* pSDRRepInfoRes =(_NEAR_ SDRRepositoryInfo_T*) pRes;
-
- memset (pSDRRepInfoRes, 0, sizeof (SDRRepositoryInfo_T));
- pSDRRepInfoRes->CompletionCode = 0x00;
- pSDRRepInfoRes->Version=0x51;
- pSDRRepInfoRes->RecCt=MAX_SENSOR_NUM+1;
- pSDRRepInfoRes->FreeSpace=0x5023;
- pSDRRepInfoRes->AddTimeStamp=0x00;
- pSDRRepInfoRes->EraseTimeStamp=0x00;
- pSDRRepInfoRes->OpSupport=0x27;
- SessionSequenceNumberCount=SessionSequenceNumberCount+1;
- return sizeof (SDRRepositoryInfo_T);
- }
- /*---------------------------------------
- * * ReserveSDRRepository
- * *---------------------------------------*/
- int ReserveSDRRepository (_NEAR_ INT8U* pReq, INT8U ReqLen, _NEAR_ INT8U* pRes,_NEAR_ int BMCInst)
- {
- BMCInfo_t *pBMCInfo = &g_BMCInfo;//[BMCInst];
- _NEAR_ ReserveSDRRepositoryRes_T* pResSDRRepRes =
- (_NEAR_ ReserveSDRRepositoryRes_T*) pRes;
- INT16U ID;
- memset(pResSDRRepRes,0,sizeof(ReserveSDRRepositoryRes_T)-1);
- ID=SDR_ReserveSDRRepository();
- // printf("ID is %d\n",ID);
- pResSDRRepRes->ReservationID_H = ID&0x00ff;//ID>>8;
- pResSDRRepRes->ReservationID_L = ID>>8;
- pResSDRRepRes->CompletionCode = 0x00;//CC_NORMAL;
- SessionSequenceNumberCount=SessionSequenceNumberCount+1;
- return sizeof (ReserveSDRRepositoryRes_T);
- }
- /*---------------------------------------
- * * GetSDR
- * *---------------------------------------*/
- int
- GetSDR (_NEAR_ INT8U* pReq, INT8U ReqLen, _NEAR_ INT8U* pRes,_NEAR_ int BMCInst)
- {
- // printf("start GetSDR:\n");
- char * pFullSensorRec;
- int i=0;
- _NEAR_ GetSDRReq_T* pGetSDRReq = (_NEAR_ GetSDRReq_T*) pReq;
- _NEAR_ GetSDRRes_T* pGetSDRRes = (_NEAR_ GetSDRRes_T*) pRes;
- _FAR_ BMCInfo_t* pBMCInfo = &g_BMCInfo;//[BMCInst];
- char RecID = pGetSDRReq->RecID;
- INT16U recordoffset=pGetSDRReq->Offset;
-
- if(RecID==0)
- pFullSensorRec=&MgmtCtrlrDevLocator;
- else
- {
- if(RecID != pBMCInfo->sensorInfo[RecID-2].sensorSdr->full_sensor_rec.hdr.ID)
- {
- printf("sdr_tbl ID err\n");
- return 1;
- }
- pFullSensorRec=&pBMCInfo->sensorInfo[RecID-2].sensorSdr->Data;
- }
- pGetSDRRes->CompletionCode = 0x00;
- if(RecID==0)
- {
- pGetSDRRes->NextRecID = 0x02;
- }
- else if(RecID==MAX_SENSOR_NUM+1)
- {
- pGetSDRRes->NextRecID = 0xffff;
- }
- else
- {
- pGetSDRRes->NextRecID = RecID+1;
- }
- /*from 4 byte to 1byte change*/
- uint8_t *Res=pGetSDRRes;
- memcpy(&Res[3],&pFullSensorRec[recordoffset],pGetSDRReq->Size);
- SessionSequenceNumberCount=SessionSequenceNumberCount+1;
- return sizeof (GetSDRRes_T) + pGetSDRReq->Size;
- }
- static INT16U SDR_ReserveSDRRepository ()
- {
- BMCInfo_t *pBMCInfo = &g_BMCInfo;
-
- // printf("pBMCInfo->SDRConfig.ReservationID is %d,\n",pBMCInfo->SDRConfig.ReservationID);
- if (0xffff == pBMCInfo->SDRConfig.ReservationID)
- {
- pBMCInfo->SDRConfig.ReservationID = 1;
- }else
- {
- pBMCInfo->SDRConfig.ReservationID++;
- }
- SessionSequenceNumberCount=SessionSequenceNumberCount+1;
- return pBMCInfo->SDRConfig.ReservationID;
- }
|