WATCHDOG

    If an error occurs in the main program of the system, for example, if the program crashes or the watchdog timer is not reset in time, the watchdog timer generates a reset signal, and the system restores from the suspending state to the normal state.

    Since:

    1.0

    Summary

    Files

    Enumerations

    Enumeration Name

    Description

    { WATCHDOG_STOP, }

    Enumerates watchdog statuses.

    Functions

    Function Name

    Description

    (int16_t wdtId)

    struct DevHandle  

    Opens a watchdog.

    (struct DevHandle handle)

    void 

    Closes a watchdog.

    (struct DevHandle handle, int32_t status)

    int32_t 

    Obtains the watchdog status.

    (struct DevHandle handle)

    int32_t 

    Starts a watchdog.

    (struct DevHandle handle)

    int32_t 

    Stops a watchdog.

    (struct DevHandle handle, uint32_t seconds)

    int32_t 

    Sets the watchdog timeout duration.

    (struct DevHandle handle, uint32_t seconds)

    int32_t 

    Obtains the watchdog timeout duration.

    (struct DevHandle handle)

    Feeds a watchdog, that is, resets a watchdog timer.

    Enumeration Type Documentation

    WatchdogStatus

    Description:

    Enumerates watchdog statuses.

    To obtain the watchdog status, call the function.

    Enumerator

    Description

    WATCHDOG_STOP 

    Stopped

    WATCHDOG_START 

    Started

    Function Documentation

    WatchdogClose()

    Description:

    Closes a watchdog.

    If you no longer need a watchdog, call this function to close it and release its device handle to prevent unnecessary use of memory resources.

    Parameters:

    1. int32_t WatchdogFeed (struct [DevHandle]($api-api-SmartVision-Devices-DevHandle.md) * handle)

    Description:

    Feeds a watchdog, that is, resets a watchdog timer.

    After a watchdog is started, you must feed it to reset the watchdog timer periodically. If you do not do so, the watchdog hardware will reset the system upon a timeout.

    Parameters:

    Name

    Description

    handle Indicates the pointer to the watchdog handle, which is obtained via .

    Returns:

    Returns 0 if the watchdog is fed; returns a negative value otherwise.

    WatchdogGetStatus()

    Description:

    Obtains the watchdog status.

    For the available watchdog statuses, see WatchdogStatus.

    Parameters:

    Name

    Description

    handle Indicates the pointer to the watchdog handle, which is obtained via WatchdogOpen.
    status Indicates the pointer to the watchdog status.

    Returns:

    Returns 0 if the watchdog status is obtained; returns a negative value otherwise.

    WatchdogGetTimeout()

    Description:

    Obtains the watchdog timeout duration.

    Parameters:

    Description

    handle Indicates the pointer to the watchdog handle, which is obtained via WatchdogOpen.
    seconds Indicates the pointer to the timeout duration, in seconds.

    Returns:

    Returns 0 if the watchdog timeout duration is obtained; returns a negative value otherwise.

    WatchdogOpen()

    1. struct [DevHandle]($api-api-SmartVision-Devices-DevHandle.md)* WatchdogOpen (int16_t wdtId)

    Description:

    Opens a watchdog.

    Before operating a watchdog, you must call this function to open it and obtain its device handle.

    Parameters:

    Returns:

    Returns the pointer to the device handle of the watch dog if the operation is successful; returns NULL otherwise.

    WatchdogSetTimeout()

    Description:

    Sets the watchdog timeout duration.

    Parameters:

    Name

    Description

    handle Indicates the pointer to the watchdog handle, which is obtained via .
    seconds Indicates the timeout duration, in seconds.

    Returns:

    Returns 0 if the setting is successful; returns a negative value otherwise.

    Description:

    Starts a watchdog.

    This function starts the watchdog timer. You must feed the watchdog periodically; otherwise, the watchdog hardware will reset the system upon a timeout.

    Parameters:

    Name

    Description

    handle Indicates the pointer to the watchdog handle, which is obtained via .

    Returns:

    Returns 0 if the watchdog is successfully started; returns a negative value otherwise.

    Attention:

    If the watchdog timer has started before this function is called, calling this function will succeed; however, the watchdog hardware determines whether to reset the timer.

    WatchdogStop()

    1. int32_t WatchdogStop (struct [DevHandle]($api-api-SmartVision-Devices-DevHandle.md) * handle)

    Description:

    Stops a watchdog.

    If the watchdog has stopped before this function is called, calling this function will succeed.

    Parameters:

    Name

    Description

    handle Indicates the pointer to the watchdog handle, which is obtained via .

    Returns 0 if the watchdog is successfully stopped; returns a negative value otherwise.