Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions components/drivers/watchdog/watchdog-i6300esb.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ static rt_err_t i6300esb_timer_set_heartbeat(struct i6300esb_wdt *esb, rt_uint32
{
rt_uint32_t val;

if ((time < ESB_HEARTBEAT_MIN) || (time > ESB_HEARTBEAT_MAX))
{
return -RT_EINVAL;
}

/*
* We shift by 9, so if we are passed a value of 1 sec,
* val will be 1 << 9 = 512, then write that to two
Expand Down Expand Up @@ -152,6 +157,11 @@ static rt_err_t i6300esb_wdt_control(rt_watchdog_t *wdt, int cmd, void *args)
break;

case RT_DEVICE_CTRL_WDT_SET_TIMEOUT:
if (args == RT_NULL)
{
err = -RT_EINVAL;
break;
}
err = i6300esb_timer_set_heartbeat(esb, *(rt_uint32_t *)args);
break;

Expand Down
Loading