#include <types.h>
#include <regs_base.h>
#include "sdrv_common.h"
Go to the source code of this file.
|
| #define | __I volatile const |
| |
| #define | __O volatile |
| |
| #define | __IO volatile |
| |
- Copyright
- Copyright (c) 2022 Semidrive Semiconductor. All rights reserved.
◆ __I
| #define __I volatile const |
Defines 'read only' permissions
◆ __IO
Defines 'read / write' permissions
◆ __O
Defines 'write only' permissions
◆ sdrv_wdt_clock_e
Definition for watchdog clock source.
◆ sdrv_wdt_config_t
Definition for watchdog initialize config.
◆ sdrv_wdt_external_reset_t
Definition for watchdog external reset config.
◆ sdrv_wdt_internal_reset_t
Definition for watchdog internal reset config.
◆ sdrv_wdt_intr_e
Definition for watchdog interrupt type.
◆ sdrv_wdt_refresh_e
Definition for watchdog refresh type.
◆ sdrv_wdt_t
Definition for sdrv watchdog register.
◆ sdrv_watchdog_error
watchdog status error code.
| Enumerator |
|---|
| SDRV_STATUS_TIMEOUT_FAILED | |
| SDRV_STATUS_DELTA_FAILED | |
| SDRV_STATUS_WINDOW_LOW_FAILED | |
| SDRV_STATUS_INTR_UNCLEARED | |
◆ sdrv_wdt_clock
Definition for watchdog clock source.
| Enumerator |
|---|
| WDT_MAIN_CLOCK | System 24M clock
|
| WDT_BUS_CLOCK | System bus clock
|
| WDT_EXT_CLOCK | External clock
|
| WDT_TIE_OFF | Tie off
|
| WDT_LP_CLOCK | System 32K clock
|
◆ sdrv_wdt_intr
Definition for watchdog interrupt type.
| Enumerator |
|---|
| WDT_ILL_WINDOW_REFRESH | WDT illeage window based counter refresh interrupt.
|
| WDT_ILL_SEQUENCE_RESRESH | WDT illeage sequential refresh interrupt.
|
| WDT_OVERFLOW | WDT timer overflow interrupt.
|
◆ sdrv_wdt_refresh
Definition for watchdog refresh type.
| Enumerator |
|---|
| WDT_DIRECT_REFRESH | WDT direct refresh, you must feed dog before timeout.
|
| WDT_WINDOW_REFRESH | WDT window based refresh, you must feed dog bewteen time low limit and timeout.
|
| WDT_SEQUENCE_REFRESH | WDT sequence based refresh, after you read current counter, you must write it to timestamp register before delta time.
|
| WDT_DIRECT_SEQUENCE_REFRESH | WDT direct/sequence base refresh combine.
|
| WDT_WINDOW_SEQUENCE_REFRESH | WDT window base/sequence base refresh combine.
|
◆ sdrv_wdt_clear_intr_status()
Clear watchdog interrupt status of specific type.
- Parameters
-
| [in] | base | WDT control base. |
| [in] | intr | interrupt type defined in sdrv_wdt_intr_e. |
- Returns
- SDRV_STATUS_OK represents success, SDRV_STATUS_FAIL represents failed.
◆ sdrv_wdt_deinit()
De-Initialize watchdog.
This function disable watchdog interrupt and clear interrupt status. Disable internal and external reset config.
- Parameters
-
| [in] | base | WDT control base. |
- Returns
- SDRV_STATUS_OK represents success, SDRV_STATUS_FAIL represents failed, SDRV_STATUS_INTR_UNCLEARED represents interrupt not cleared.
◆ sdrv_wdt_disable()
Disable watchdog.
This function disable watchdog timer counter.
- Parameters
-
- Returns
- SDRV_STATUS_OK represents success, SDRV_STATUS_FAIL represents failed.
◆ sdrv_wdt_enable()
Enable watchdog.
This function enable watchdog timer counter.
- Parameters
-
| [in] | base | WDT control base. |
- Returns
- SDRV_STATUS_OK represents success, SDRV_STATUS_FAIL represents failed.
◆ sdrv_wdt_get_default_config()
Get the default configuration for watchdog.
This function get the default configuration for watchdog. When you want initialize, you can call this function first and modify some of them, then call sdrv_wdt_init.
- Parameters
-
| [in] | config | WDT config struct. |
- Returns
- SDRV_STATUS_OK represents success, SDRV_STATUS_FAIL represents failed.
◆ sdrv_wdt_get_intr_status()
Get watchdog interrupt status of specific type.
This function get specific type interrupt status.
- Parameters
-
| [in] | base | WDT control base. |
| [in] | intr | interrupt type defined in sdrv_wdt_intr_e. |
- Returns
- true represents status is set, false represents status not set.
◆ sdrv_wdt_init()
Initialize watchdog with config parameters.
This function config watchdog with parameters in sdrv_wdt_config_t.
- Parameters
-
| [in] | base | WDT control base. |
| [in] | config | WDT config struct. |
- Returns
- Return SDRV_STATUS_OK or error code.
◆ sdrv_wdt_read_timestamp()
| uint32_t sdrv_wdt_read_timestamp |
( |
sdrv_wdt_t * |
base | ) |
|
Read watchdog current counter.
This function read watchdog current counter. When you enable sequence refresh, you need call this function first and store read value. Before time delta, use sdrv_wdt_write_timestamp with stored value. Otherwise, illeage sequential refresh interrupt status will set.
- Parameters
-
| [in] | base | WDT control base. |
- Returns
- current timer counter.
◆ sdrv_wdt_refresh()
Feed watchdog.
This function trigger watchdog do refresh.
- Parameters
-
| [in] | base | WDT control base. |
- Returns
- SDRV_STATUS_OK represents success, SDRV_STATUS_FAIL represents failed.
◆ sdrv_wdt_set_sequence_delta()
Set watchdog sequence delta value.
This function get sequence delta value in milliseconds and convert to timer counter according to clock source pre-configed.
- Parameters
-
| [in] | base | WDT control base. |
| [in] | delta | unit: ms. |
- Returns
- SDRV_STATUS_OK represents success, SDRV_STATUS_FAIL represents failed, SDRV_STATUS_INVALID_PARAM represents invalid paramemt.
◆ sdrv_wdt_set_timeout()
Set watchdog timeout value.
This function get timeout value in milliseconds and convert to timer counter according to clock source pre-configed.
- Parameters
-
| [in] | base | WDT control base. |
| [in] | timeout | unit: ms. |
- Returns
- SDRV_STATUS_OK represents success, SDRV_STATUS_FAIL represents failed, SDRV_STATUS_INVALID_PARAM represents invalid paramemt.
◆ sdrv_wdt_set_window_low()
Set watchdog time window low limit value.
This function get time window low limit value in milliseconds and convert to timer counter according to clock source pre-configed.
- Parameters
-
| [in] | base | WDT control base. |
| [in] | low_limit | unit: ms. |
- Returns
- SDRV_STATUS_OK represents success, SDRV_STATUS_FAIL represents failed, SDRV_STATUS_INVALID_PARAM represents invalid paramemt.
◆ sdrv_wdt_write_timestamp()
Write watchdog counter to TSW register.
This function write counter to TSW register. When config sequence base refresh, read timestamp first, then write read value to TSW before sequence delta.
- Parameters
-
| [in] | base | WDT control base. |
| [in] | timestamp | last read wdt conunter. |
- Returns
- SDRV_STATUS_OK represents success, SDRV_STATUS_FAIL represents failed.