📄 dtdecode.h
字号:
/*******************************************************************************
* Filename : dtdecode.h
* Description : Data Decoder header file
* * decode the data structures of MIC interface and I2 Client API.
* Created on : 03/20/2003
* CVS Version : $Id: dtdecode.h,v 1.64 2004/03/23 03:54:53 zhengj Exp $
*
* (C) Copyright Promise Technology Inc., 2003
* All Rights Reserved
******************************************************************************/
#ifndef __PI_DATADECODER_H__
#define __PI_DATADECODER_H__
/* --- standard C lib header files ----------------------------------------- */
#include <time.h>
/* --- internal header files ----------------------------------------------- */
#include "pibasic.h"
#include "i2types.h"
/* --- constant definitions ------------------------------------------------ */
#define OPSTATUS_UNKNOWN 0
#define OPSTATUS_OTHER 1
#define OPSTATUS_OK 2
#define OPSTATUS_DEGRADED 3
#define OPSTATUS_STRESSED 4
#define OPSTATUS_PFA 5
#define OPSTATUS_ERROR 6
#define OPSTATUS_FATAL 7
#define OPSTATUS_STARTING 8
#define OPSTATUS_STOPPING 9
#define OPSTATUS_STOPPED 10
#define OPSTATUS_INSERVICE 11
#define OPSTATUS_NOCONTACT 12
#define OPSTATUS_LOSTCOMM 13
#define OPSTATUS_ABORTED 14
#define OPSTATUS_DORMANT 15
#define OPSTATUS_SUPENTITYERR 16
#define OPSTATUS_COMPLETED 17
/* 18, 19 reserved */
/* other for CIM */
#define CIM_OPSTATUS_END 19
/* physical drive op status */
#define OPSTATUS_PHYDRV (CIM_OPSTATUS_END+1)
#define OPSTATUS_DEAD (OPSTATUS_PHYDRV+0)
#define OPSTATUS_MISSING (OPSTATUS_PHYDRV+1)
#define OPSTATUS_FORCED_ONLINE (OPSTATUS_PHYDRV+2)
#define OPSTATUS_FORCED_OFFLINE (OPSTATUS_PHYDRV+3)
#define OPSTATUS_TEMP_OFFLINE (OPSTATUS_PHYDRV+4)
#define OPSTATUS_REBUILDING (OPSTATUS_PHYDRV+5)
#define OPSTATUS_MPRUNNING (OPSTATUS_PHYDRV+6)
#define OPSTATUS_ACCESSIBLE (OPSTATUS_PHYDRV+7)
#define OPSTATUS_NOT_ACCESSIBLE (OPSTATUS_PHYDRV+8)
#define OPSTATUS_NOT_PRESENT (OPSTATUS_PHYDRV+9)
#define OPSTATUS_MIGRATING (OPSTATUS_PHYDRV+10)
#define OPSTATUS_TRANSITIONING (OPSTATUS_PHYDRV+11)
#define OPSTATUS_PDMRUNNING (OPSTATUS_PHYDRV+12)
/* 33, 34 reserved */
/* logical drive op status */
#define OPSTATUS_LOGDRV (CIM_OPSTATUS_END+16)
#define OPSTATUS_CRITICAL (OPSTATUS_LOGDRV+0)
#define OPSTATUS_OFFLINE (OPSTATUS_LOGDRV+1)
#define OPSTATUS_INITIALIZING (OPSTATUS_LOGDRV+2)
#define OPSTATUS_INITIALIZED (OPSTATUS_LOGDRV+3)
/* 39, 40 reserved */
/* Disk Array op status */
#define OPSTATUS_DISKARRAY (CIM_OPSTATUS_END+22)
#define OPSTATUS_INCOMPLETE (OPSTATUS_DISKARRAY+0)
#define OPSTATUS_MISSING_PD (OPSTATUS_DISKARRAY+1)
/* 43,44 reserved */
#define OPSTATUS_NA (CIM_OPSTATUS_END+31)
#define MAX_OPSTATUS OPSTATUS_NA
/* BGA S/W State */
#define BGA_STATE_INACTIVE 0xFF
/* --- data structures ----------------------------------------------------- */
/*
* The free fragments of a disk array. It have the info about the starting
* address and the size of each of the fragment. Assuming that the fragments
* are located at the same place and have the same size on each of the physical
* drives of the disk array.
* A disk array can have up to MAX_LOGDRV_PER_POOL free fragments.
*/
#define MIN_FRAGMENT_SIZE (4*1024*1024) /* 4MB - the max stripe size */
typedef struct
{
u32 daff_u32Count;
u32 daff_u32Reserved;
struct
{
u64 daff_u64Addr; /* starting address, in bytes */
u64 daff_u64Size; /* in bytes */
} daff_fragments[MAX_LOGDRV_PER_ARRAY];
} disk_array_free_fragment_t;
/* --- functional routines ------------------------------------------------- */
/* --- general ----------------------------------------------------------- */
/***************************************************************************
* Function Name: decod_getStringUserPrivilege
* Description: get the User Privilege string
* Parameters:
* [in] u8OpUserPrivilege
* Return: The User Privilege string
* Remarks: none.
****************************************************************************/
const char * decod_getStringUserPrivilege(const u8 u8UserPrivilege);
/***************************************************************************
* Function Name: decod_getStringDaemonStatus
* Description: get the string of daemon status and startup type
* Parameters: [in] status/type
* Return: the string of status/type
* Remarks: none.
****************************************************************************/
const char * decod_getStringDaemonStatus(const u8 u8DaemonStatus);
const char * decod_getStringDaemonStartupType(const u8 u8DaemonStartupType);
void decod_getStringSATAFRUInfo(char * pstrInfo,
const u8 * pu8Info, const u32 u32Length);
/***************************************************************************
* Function Name: decod_getStringNotApplicable
* Description: get the string of not applicable "N/A".
* Parameters: none.
* Return: the string of not applicable.
* Remarks: none.
****************************************************************************/
const char * decod_getStringNotApplicable();
const char * decod_getStringNotSupported();
/***************************************************************************
* Function Name: decod_getStringWWN
* Description: get the string of WWN in the format of "xxxx-xxxx-xxxx-xxxx".
* The MSB is at the beginning and the LSB is at the end.
* Parameters:
* [out] pstrWWN, the string buffer where the WWN string will return
* [in] pu8WWN, the pointer to the WWN array
* Return: None.
* Remarks: This function does not check the size of the string buffer.
* please make sure it is big enough to avoid memory access violation.
****************************************************************************/
void decod_getStringWWN(char * pstrWWN, const u8 * pu8WWN);
/***************************************************************************
* Function Name: decod_getStringAlias
* Description: get the string of Alias
* Parameters:
* [out] pstrAlias, the string buffer where the alias string will return
* [in] pu8Alias, the pointer to the alias array
* Return: None.
* Remarks: This function does not check the size of the string buffer.
* please make sure it is big enough to avoid memory access violation.
****************************************************************************/
void decod_getStringAlias(char * pstrAlias, const u8 *pu8Alias);
/***************************************************************************
* Function Name: decod_getStringIPAddress
* Description: get the string of IP Address according to the IP address type
* Parameters:
* [out] pstrIPAddr, the string buffer where the IP address string will return
* [in] u8IPAddrType, the ip address type.
* [in] pu8IPAddr, the ip addr info
* Return: PIERR_NO_ERROR, PIERR_INVALID_IP_ADDR_TYPE.
* Remarks: This function does not check the size of the string buffer.
* please make sure it is big enough to avoid memory access violation.
****************************************************************************/
u32 decod_retrieveIPAddress(char * pIPString, u8 u8IPType, u8 * pu8Value);
u32 decod_getStringIPAddress(char * pstrIPAddr,
const u8 u8IPAddrType, const u8 * pu8IPAddr);
u32 decod_retrieveDate(char * pDateString, int * pYear, int * pMonth, int * pDay);
u32 decod_retrieveTime(char * pTimeString, int * pHour, int * pMin, int * pSec);
/***************************************************************************
* Function Name: decod_getStringMACAddress
* Description: get the string of MAC Address
* Parameters:
* [out] pstrMACAddr, the string buffer where the MAC address string will return
* [in] pu8MACAddr, the MAC addr info
* Return: PIERR_NO_ERROR
* Remarks: This function does not check the size of the string buffer.
* please make sure it is big enough to avoid memory access violation.
****************************************************************************/
u32 decod_getStringMACAddress(char * pstrMACAddr, const u8 * pu8MACAddr);
/***************************************************************************
* Function Name: decod_getStringCustName
* Description: get the string of customer name.
* Parameters:
* [out] pstrCustName, the string buffer where the customer name
* string will return
* [in] pu8Custname, the pointer to the customer name in SATA FRU format
* Return: None.
* Remarks: This function does not check the size of the string buffer.
* please make sure it is big enough to avoid memory access violation.
****************************************************************************/
void decod_getStringCustName(char * pstrCustName, const u8 * pu8CustName);
/***************************************************************************
* Function Name: decod_getStringCustModel
* Description: get the string of customer model.
* Parameters:
* [out] pstrCustModel, the string buffer where the customer model
* string will return
* [in] pu8CustModel, the pointer to the customer model in SATA FRU
* format
* Return: None.
* Remarks: This function does not check the size of the string buffer.
* please make sure it is big enough to avoid memory access violation.
****************************************************************************/
void decod_getStringCustModel(char * pstrCustModel, const u8 * pu8CustModel);
/***************************************************************************
* Function Name: decod_getStringCustPartNo
* Description: get the string of customer part number.
* Parameters:
* [out] pstrCustPartNo, the string buffer where the customer part no
* string will return
* [in] pu8CustPartNo, the pointer to the customer part no in SATA FRU
* format
* Return: None.
* Remarks: This function does not check the size of the string buffer.
* please make sure it is big enough to avoid memory access violation.
****************************************************************************/
void decod_getStringCustPartNo(char * pstrCustPartNo, const u8 * pu8CustPartNo);
/***************************************************************************
* Function Name: decod_getStringCustSerialNo
* Description: get the string of customer serial number.
* Parameters:
* [out] pstrCustSerialNo, the string buffer where the customer serial
* number string will return
* [in] pu8CustSerialNo, the pointer to the customer serial no in SATA
* FRU format
* Return: None.
* Remarks: This function does not check the size of the string buffer.
* please make sure it is big enough to avoid memory access violation.
****************************************************************************/
void decod_getStringCustSerialNo(char * pstrCustSerialNo, const u8 * pu8CustSerialNo);
/***************************************************************************
* Function Name: decod_getStringCustRev
* Description: get the string of customer Revision.
* Parameters:
* [out] pstrCustRev, the string buffer where the customer revision
* number string will return
* [in] pu8CustRev, the pointer to the customer revision in SATA FRU
* format
* Return: None.
* Remarks: This function does not check the size of the string buffer.
* please make sure it is big enough to avoid memory access violation.
****************************************************************************/
void decod_getStringCustRev(char * pstrCustRev, const u8 * pu8CustRev);
/***************************************************************************
* Function Name: decod_getStringDate
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -