Azure Sphere MT3620 M4 API Reference Manual
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Function

This section provides Fixed APIs(defined as Common Interface) to fully control the MediaTek WDT HW. More...

Overview

This section provides Fixed APIs(defined as Common Interface) to fully control the MediaTek WDT HW.

Functions

int mtk_mhal_wdt_enable (struct hal_wdt_dev *wdt_dev, u32 en)
 This function is used to enable or disable WDT. More...
 
int mtk_mhal_wdt_config (struct hal_wdt_dev *wdt_dev, u8 irq)
 This function is used to configure WDT mode. More...
 
int mtk_mhal_wdt_set_timeout (struct hal_wdt_dev *wdt_dev, u32 sec)
 This function is used to set WDT timeout value. More...
 
int mtk_mhal_wdt_restart (struct hal_wdt_dev *wdt_dev)
 This function is used to restart WDT counter. More...
 
int mtk_mhal_wdt_hwrst (struct hal_wdt_dev *wdt_dev)
 This function is used to reset immediately by WDT HW-RST. More...
 
int mtk_mhal_wdt_swrst (struct hal_wdt_dev *wdt_dev)
 This function is used to reset immediately by WDT SW-RST. More...
 
int mtk_mhal_wdt_get_status (struct hal_wdt_dev *wdt_dev, unsigned int *rst_sta)
 This function is used to get WDT reset status. More...
 

Function Documentation

int mtk_mhal_wdt_enable ( struct hal_wdt_dev wdt_dev,
u32  en 
)

This function is used to enable or disable WDT.

Parameters
[in]wdt_dev: A pointer of struct hal_wdt_dev.
[in]en: Disable (= 0) or enable (= 1) WDT.
Returns
0: Success.
-WDT_EPTR: Failure if wdt_dev or wdt_dev->cm4_wdt_base is NULL pointer.
int mtk_mhal_wdt_config ( struct hal_wdt_dev wdt_dev,
u8  irq 
)

This function is used to configure WDT mode.

Parameters
[in]wdt_dev: A pointer of struct hal_wdt_dev.
[in]irq: WDT trigger reset (= 0) or trigger irq (= 1) event.
Returns
0: Success.
-WDT_EPTR: Failure if wdt_dev or wdt_dev->cm4_wdt_base is NULL pointer.
int mtk_mhal_wdt_set_timeout ( struct hal_wdt_dev wdt_dev,
u32  sec 
)

This function is used to set WDT timeout value.

Parameters
[in]wdt_dev: A pointer of struct hal_wdt_dev.
[in]sec: WDT timeout value (unit: second).
Returns
0: Success.
-WDT_EPTR: Failure if wdt_dev or wdt_dev->cm4_wdt_base is NULL pointer.
-WDT_EINVAL: Failure if timeout value exceeds HW setting limitation.
int mtk_mhal_wdt_restart ( struct hal_wdt_dev wdt_dev)

This function is used to restart WDT counter.

Parameters
[in]wdt_dev: A pointer of struct hal_wdt_dev.
Returns
0: Success.
-WDT_EPTR: Failure if wdt_dev or wdt_dev->cm4_wdt_base is NULL pointer.
int mtk_mhal_wdt_hwrst ( struct hal_wdt_dev wdt_dev)

This function is used to reset immediately by WDT HW-RST.


Parameters
[in]wdt_dev: A pointer of struct hal_wdt_dev.
Returns
never return by reset: Success.
-WDT_EPTR: Failure if wdt_dev or wdt_dev->cm4_wdt_base is NULL pointer.
-WDT_EFAULT: Failure if reset failure.
int mtk_mhal_wdt_swrst ( struct hal_wdt_dev wdt_dev)

This function is used to reset immediately by WDT SW-RST.


Parameters
[in]wdt_dev: A pointer of struct hal_wdt_dev.
Returns
never return by reset: Success.
-WDT_EPTR: Failure if wdt_dev or wdt_dev->cm4_wdt_base is NULL pointer.
-WDT_EFAULT: Failure if reset failure.
int mtk_mhal_wdt_get_status ( struct hal_wdt_dev wdt_dev,
unsigned int *  rst_sta 
)

This function is used to get WDT reset status.

Parameters
[in]wdt_dev: A pointer of struct hal_wdt_dev
[out]rst_sta: A pointer to a variable which is used to return reset status.
0: No reset state.
1: Software reset (by WDT SW-RST) state.
2: Hardware reset (by WDT timeout) state.
Returns
0: Get reset status successfully.
-WDT_EPTR: Failure if wdt_dev, wdt_dev->cm4_wdt_base or rst_sta is NULL pointer.