
// The following ifdef block is the standard way of creating macros which make exporting 
// from a DLL simpler. All files within this DLL are compiled with the KOMSYS_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see 
// KOMSYS_API functions as being imported from a DLL, where as this DLL sees symbols
// defined with this macro as being exported.

//For detailed description of this API please see KomSysApi.chm help file.

/*
modification history
--------------------
 2008-01-18   Created							                           Dzk
*/


#ifdef __cplusplus
extern "C" {
#endif

#ifdef KOMSYS_EXPORTS
#define KOMSYS_API __declspec(dllexport)
#else
#define KOMSYS_API __declspec(dllimport)
#endif

#include <windows.h>

// default for features not supported by certain boards
#define KOMSYS_NOT_SUPPORTED	0xFFFF

//system slot / peripheral slot
#define KOMSYS_SYSTEM_SLOT		0x01	//board is in system slot
#define KOMSYS_PERIPH_SLOT		0x00	//board is in peripheral slot

//HotSwap handle status
#define KOMSYS_HSWP_OPEN		0x00	//hotswap handle open
#define KOMSYS_HSWP_CLOSED		0x01	//hotswap handle closed

//reset source
#define KOMSYS_RESET_NONE		0x00	//unknown
#define KOMSYS_RESET_POWERON	0x01	//power - on
#define KOMSYS_RESET_IPMI		0x02	//IPMI reset
#define KOMSYS_RESET_BUTTON		0x04	//reset button pressed
#define KOMSYS_RESET_CPCI		0x08	//CPCI reset signal
#define	KOMSYS_RESET_WDG		0x10	//reset caused by watchdog

//general reset sources
#define KOMSYS_RESET_BIT7                0x80
#define KOMSYS_RESET_BIT6                0x40
#define KOMSYS_RESET_BIT5                0x20
#define KOMSYS_RESET_BIT4                0x10
#define KOMSYS_RESET_BIT3                0x08
#define KOMSYS_RESET_BIT2                0x04
#define KOMSYS_RESET_BIT1                0x02
#define KOMSYS_RESET_BIT0                0x01

//KomSys data types / structures:
#define MAX_BOARD_NAME		16		//max board name length
#define MAX_PROPERTY_NAME	40		//max board property name length

struct KomSysInfo
{
	UCHAR boardId;		//board ID e.g. 0xaa for CP6001
//	char  boardName[MAX_BOARD_NAME];
	WORD boardRev;		//board revision
	WORD geogrAddr;	//board's geographical address
	WORD systemSlot;	//flag if the board is in the system slot
	WORD resetSrc;		//last reset source	
	WORD hswpStatus;	//HotSwap handle status
};

//Library exports:

	//info
KOMSYS_API DWORD KomSysGetBoardId(UCHAR *pBoardId);
KOMSYS_API DWORD KomSysGetBoardInfo(KomSysInfo *pInfo);
KOMSYS_API DWORD KomSysClearResetSrc();

KOMSYS_API DWORD KomSysGetBoardPropertiesNumber(UCHAR *pNumber);
KOMSYS_API DWORD KomSysGetBoardProperty(UCHAR idx, char strPropName[MAX_PROPERTY_NAME],DWORD *pProp);

#ifdef __cplusplus
}
#endif

//EOF