
// 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 KOMWDG_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 
// KOMWDG_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 KomWdgApi.chm help file.

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


#ifdef __cplusplus
extern "C" {
#endif

#ifdef KOMWDG_EXPORTS
#define KOMWDG_API __declspec(dllexport)
#else
#define KOMWDG_API __declspec(dllimport)
#endif

#include <windows.h>

//tbd

#define KOMWDG_TIMEOUT_1		0x00
#define KOMWDG_TIMEOUT_2		0x01
#define KOMWDG_TIMEOUT_3		0x02
#define KOMWDG_TIMEOUT_4		0x03
#define KOMWDG_TIMEOUT_5		0x04
#define KOMWDG_TIMEOUT_6		0x05
#define KOMWDG_TIMEOUT_7		0x06
#define KOMWDG_TIMEOUT_8		0x07
#define KOMWDG_TIMEOUT_9		0x08
#define KOMWDG_TIMEOUT_10		0x09
#define KOMWDG_TIMEOUT_11		0x0a
#define KOMWDG_TIMEOUT_12		0x0b
#define KOMWDG_TIMEOUT_13		0x0c
#define KOMWDG_TIMEOUT_14		0x0d
#define KOMWDG_TIMEOUT_15		0x0e
#define KOMWDG_TIMEOUT_16		0x0f

#define KOMWDG_MODE_0			0x00
#define KOMWDG_MODE_1			0x01
#define KOMWDG_MODE_2			0x02
#define KOMWDG_MODE_3			0x03

#define KOMWDG_MAX_TIMEOUT_VAL	16
#define KOMWDG_TIMEOUT_NAME_LEN	20
#define KOMWDG_MAX_MODE_VAL		4
#define KOMWDG_MODE_NAME_LEN	20

typedef struct KomWdgConfig
{
	BYTE bTimeout;
	BYTE bMode;
	BOOLEAN fEnabled;
	BOOLEAN fIrqAvailable;
}tKomWdgConfig, *ptKomWdgConfig;

typedef struct KomWdgInfo
{
	DWORD dwValidTimeouts;
	char sTimeout[KOMWDG_MAX_TIMEOUT_VAL][KOMWDG_TIMEOUT_NAME_LEN];
	char sMode[KOMWDG_MAX_MODE_VAL][KOMWDG_MODE_NAME_LEN];
}tKomWdgInfo, *ptKomWdgInfo;


/*
const char sKomWdgTimeoutValue[][9] = 
{
	"125 msec",
	"250 msec",
	"500 msec",
	"1 sec",
	"2 sec",
	"4 sec",
	"8 sec",
	"16 sec",
	"32 sec",
	"64 sec",
	"128 sec",
	"256 sec"
};

const char sKomWdgMode[][11] = 
{
	"Timer only"
	"Reset",
	"IRQ",
	"Dual stage",
};
*/


//Library exports:
KOMWDG_API DWORD KomWdgSetRestoreStatus(BOOL fRestore);
KOMWDG_API DWORD KomWdgGetRestoreStatus(BOOL* pfRestore);
KOMWDG_API DWORD KomWdgSetTimeout(BYTE bTimeout);
KOMWDG_API DWORD KomWdgRetrigger(void);
KOMWDG_API DWORD KomWdgCheckTimeoutStatus(BOOL *pfTimeout);
KOMWDG_API DWORD KomWdgWaitForTimeout(BOOL *pfTimeout);
KOMWDG_API DWORD KomWdgGetInfo(ptKomWdgInfo pInfo);
KOMWDG_API DWORD KomWdgGetConfig(ptKomWdgConfig pConfig);
KOMWDG_API DWORD KomWdgSetMode(BYTE bMode);

#ifdef __cplusplus
}
#endif

//EOF