/* hwWatchdogK.h - header for the hardware watchdog driver */

/* Copyright 2004 - 2006 Kontron Modular Computers GmbH */

/*
modification history
--------------------
01d,25apr08,jed added vxBus methods
01c,19jun07,phd renamed and adjused to vxBus
01b,22dec06,jed adjusted to a new watchdog register layout
01a,12aug04,phd initially created
*/

#ifndef __INChwWatchdogK_h
#define __INChwWatchdogK_h

#ifdef __cplusplus
extern "C" {
#endif

/* includes */

#include <vxWorks.h>
#include "versionK.h"

/* defines */

KONTRON_VERSION(hwWatchdogK_h,01c)			/* version identifier */

/* the maximum length of the semaphore name */
#define HWD_SEM_NAME_MAX_LEN		(64)

/* common IOCTLs definitions */

#define HWD_START				0x30000000
#define HWD_MODE_SET			0x30000001
#define HWD_MODE_GET			0x30000002
#define HWD_TIMEOUT_SET			0x30000003
#define HWD_TIMEOUT_GET			0x30000004
#define HWD_TRIGGER				0x30000005
#define HWD_TIMEOUT_CHECK		0x30000006
#define HWD_TIMEOUT_CLEAR		0x30000007
#define HWD_SEM_NAME_GET		0x30000008

/* watchdog mode definitions */

#define	HWD_TIMER_MODE			0 			/* watchdog timer only mode */
#define	HWD_RESET_MODE			1 			/* watchdog reset mode */
#define	HWD_INTERRUPT_MODE		2 			/* watchdog interrupt mode */
#define	HWD_DUAL_STAGE_MODE		3 			/* watchdog dual stage mode */

/* watchdog timeout period definitions */

#define	HWD_WTCR_TIMEOUT_125MS			0		/*  125 ms timeout period */
#define	HWD_WTCR_TIMEOUT_250MS			1		/*  250 ms timeout period */
#define	HWD_WTCR_TIMEOUT_500MS			2		/*  500 ms timeout period */
#define	HWD_WTCR_TIMEOUT_1S				3		/*    1  s timeout period */
#define	HWD_WTCR_TIMEOUT_2S				4		/*    2  s timeout period */
#define	HWD_WTCR_TIMEOUT_4S				5		/*    4  s timeout period */
#define	HWD_WTCR_TIMEOUT_8S				6		/*    8  s timeout period */
#define	HWD_WTCR_TIMEOUT_16S			7		/*   16  s timeout period */
#define	HWD_WTCR_TIMEOUT_32S			8		/*   32  s timeout period */
#define	HWD_WTCR_TIMEOUT_64S			9		/*   64  s timeout period */
#define	HWD_WTCR_TIMEOUT_128S			10		/*  128  s timeout period */
#define	HWD_WTCR_TIMEOUT_256S			11		/*  256  s timeout period */
#define	HWD_WTCR_TIMEOUT_512S			12		/*  512  s timeout period */
#define	HWD_WTCR_TIMEOUT_1024S			13		/* 1024  s timeout period */
#define	HWD_WTCR_TIMEOUT_2046S			14		/* 2046  s timeout period */
#define	HWD_WTCR_TIMEOUT_4096S			15		/* 4096  s timeout period */
#define	HWD_WTCR_TIMEOUT_BITS			15		/* timeout bits */

/* watchdog control bit definitions */

#define	HWD_WTCR_WTE				(1<<7)		/* watchdog expired */
#define	HWD_WTCR_WEN				(1<<4)		/* watchdog enable */
#define	HWD_WTCR_WTR				(1<<4)		/* watchdog trigger */
#define	HWD_WTCR_TIMER_MODE			(0<<5)		/* watchdog timer only mode */
#define	HWD_WTCR_RESET_MODE			(1<<5)		/* watchdog reset mode */
#define	HWD_WTCR_INTERRUPT_MODE		(2<<5)		/* watchdog interrupt mode */
#define	HWD_WTCR_DUAL_STAGE_MODE	(3<<5)		/* watchdog dual stage mode */
#define	HWD_WTCR_MODE_BITS			(3<<5)		/* watchdog mode bits */

/* typedefs */
#ifdef __cplusplus
}
#endif

#endif /* __INChwWatchdogK_h */

/* eof */
