/* Get counter value or permitted range value of watchdog timer from the desired timeout period (in us).  */
uint32_t wdt_get_timeout_value(uint32_t ul_us, uint32_t ul_sclk)
/* Get counter value or permitted range value of watchdog timer from the desired timeout period (in us).  */
uint32_t wdt_get_timeout_value(uint32_t ul_us, uint32_t ul_sclk)
{
	uint32_t max, min;
	min = WDT_SLCK_DIV * 1000000 / ul_sclk;
	max = min * WDT_MAX_VALUE;
	if ((ul_us < min) || (ul_us > max)) {
		return WDT_INVALID_ARGUMENT;
	}
	return WDT_MR_WDV(ul_us / min);
}