NANO102/112 BSP V3.03.003
The Board Support Package for Nano102/112 Series
Macros | Functions
Collaboration diagram for SYS Exported Functions:

Macros

#define SYS_CLEAR_BOD_INT_FLAG()   (SYS->BODSTS |= SYS_BODSTS_BOD_INT_Msk)
 Clear Brown-out detector interrupt flag. More...
 
#define SYS_DISABLE_BOD25()   (SYS->BODCTL &= ~SYS_BODCTL_BOD25_EN_Msk)
 Disable Brown-out 2.5V detector function. More...
 
#define SYS_ENABLE_BOD25()   (SYS->BODCTL |= SYS_BODCTL_BOD25_EN_Msk)
 Enable Brown-out 2.5V detector function. More...
 
#define SYS_DISABLE_BOD20()   (SYS->BODCTL &= ~SYS_BODCTL_BOD20_EN_Msk)
 Disable Brown-out 2.0V detector function. More...
 
#define SYS_ENABLE_BOD20()   (SYS->BODCTL |= SYS_BODCTL_BOD20_EN_Msk)
 Enable Brown-out 2.0V detector function. More...
 
#define SYS_DISABLE_BOD17()   (SYS->BODCTL &= ~SYS_BODCTL_BOD17_EN_Msk)
 Disable Brown-out 1.7V detector function. More...
 
#define SYS_ENABLE_BOD17()   (SYS->BODCTL |= SYS_BODCTL_BOD17_EN_Msk)
 Enable Brown-out 1.7V detector function. More...
 
#define SYS_GET_BOD_INT_FLAG()   (SYS->BODSTS & SYS_BODSTS_BOD_INT_Msk)
 Get Brown-out detector interrupt flag. More...
 
#define SYS_GET_BOD25_OUTPUT()   (SYS->BODSTS & SYS_BODSTS_BOD25_drop_Msk)
 Get Brown-out 2.5V detector status. More...
 
#define SYS_GET_BOD20_OUTPUT()   (SYS->BODSTS & SYS_BODSTS_BOD20_drop_Msk)
 Get Brown-out 2.0V detector status. More...
 
#define SYS_GET_BOD17_OUTPUT()   (SYS->BODSTS & SYS_BODSTS_BOD17_drop_Msk)
 Get Brown-out 1.7V detector status. More...
 
#define SYS_DISABLE_BOD25_RST()   (SYS->BODCTL &= ~SYS_BODCTL_BOD25_RST_EN_Msk)
 Disable Brown-out 2.5V detector interrupt function. More...
 
#define SYS_ENABLE_BOD25_RST()   (SYS->BODCTL |= SYS_BODCTL_BOD25_RST_EN_Msk)
 Enable Brown-out 2.5V detector reset function. More...
 
#define SYS_DISABLE_BOD20_RST()   (SYS->BODCTL &= ~SYS_BODCTL_BOD20_RST_EN_Msk)
 Disable Brown-out 2.0V detector interrupt function. More...
 
#define SYS_ENABLE_BOD20_RST()   (SYS->BODCTL |= SYS_BODCTL_BOD20_RST_EN_Msk)
 Enable Brown-out 2.0V detector reset function. More...
 
#define SYS_DISABLE_BOD17_RST()   (SYS->BODCTL &= ~SYS_BODCTL_BOD17_RST_EN_Msk)
 Disable Brown-out 1.7V detector interrupt function. More...
 
#define SYS_ENABLE_BOD17_RST()   (SYS->BODCTL |= SYS_BODCTL_BOD17_RST_EN_Msk)
 Enable Brown-out 1.7V detector reset function. More...
 
#define SYS_IS_BOD_RST()   (SYS->RST_SRC & SYS_RST_SRC_RSTS_BOD_Msk)
 Get reset source is from Brown-out detector reset. More...
 
#define SYS_IS_CPU_RST()   (SYS->RST_SRC & SYS_RST_SRC_RSTS_CPU_Msk)
 Get reset source is from CPU reset. More...
 
#define SYS_IS_POR_RST()   (SYS->RST_SRC & SYS_RST_SRC_RSTS_POR_Msk)
 Get reset source is from Power-on Reset. More...
 
#define SYS_IS_RSTPIN_RST()   (SYS->RST_SRC & SYS_RST_SRC_RSTS_PAD_Msk)
 Get reset source is from reset pin reset. More...
 
#define SYS_IS_SYSTEM_RST()   (SYS->RST_SRC & SYS_RST_SRC_RSTS_SYS_Msk)
 Get reset source is from system reset. More...
 
#define SYS_IS_WDT_RST()   (SYS->RST_SRC & SYS_RST_SRC_RSTS_WDT_Msk)
 Get reset source is from window watch dog reset. More...
 
#define SYS_DISABLE_POR()   (SYS->PORCTL = 0x5AA5)
 Disable Power-on Reset function. More...
 
#define SYS_ENABLE_POR()   (SYS->PORCTL = 0)
 Enable Power-on Reset function. More...
 
#define SYS_CLEAR_RST_SOURCE(u32RstSrc)   (SYS->RST_SRC |= u32RstSrc )
 Clear reset source flag. More...
 
#define SYS_GET_IRCTRIM_INT_FLAG()   (SYS->IRCTRIMINT)
 Get HIRC trim status. More...
 
#define SYS_CLEAR_IRCTRIM_INT_FLAG(u32IRCTrimFlg)   (SYS->IRCTRIMINT = u32IRCTrimFlg )
 Clear HIRC trim flag. More...
 

Functions

__STATIC_INLINE void SYS_UnlockReg (void)
 Disable register write-protection function. More...
 
__STATIC_INLINE void SYS_LockReg (void)
 Enable register write-protection function. More...
 
void SYS_ClearResetSrc (uint32_t u32Src)
 This function clear the selected system reset source. More...
 
uint32_t SYS_GetBODStatus ()
 This function get Brown-out detector output status. More...
 
uint32_t SYS_GetResetSrc (void)
 This function get the system reset source register value. More...
 
uint32_t SYS_IsRegLocked (void)
 This function check register write-protection bit setting. More...
 
uint32_t SYS_ReadPDID (void)
 This function get product ID. More...
 
void SYS_ResetChip (void)
 This function reset chip. More...
 
void SYS_ResetCPU (void)
 This function reset CPU. More...
 
void SYS_ResetModule (uint32_t u32ModuleIndex)
 This function reset selected modules. More...
 
void SYS_EnableBOD (int32_t i32Mode, uint32_t u32BODLevel)
 This function configure BOD function. Configure BOD reset or interrupt mode and set Brown-out voltage level. Enable Brown-out function. More...
 
void SYS_DisableBOD (void)
 This function disable BOD function. More...
 
void SYS_EnableIRCTrim (uint32_t u32TrimSel, uint32_t u32TrimEnInt)
 This function enable HIRC trim function. More...
 
void SYS_DisableIRCTrim (void)
 This function disable HIRC trim function. More...
 

Detailed Description

Macro Definition Documentation

◆ SYS_CLEAR_BOD_INT_FLAG

#define SYS_CLEAR_BOD_INT_FLAG ( )    (SYS->BODSTS |= SYS_BODSTS_BOD_INT_Msk)

Clear Brown-out detector interrupt flag.

Parameters
None
Returns
None

This macro clear Brown-out detector interrupt flag.

Definition at line 563 of file sys.h.

◆ SYS_CLEAR_IRCTRIM_INT_FLAG

#define SYS_CLEAR_IRCTRIM_INT_FLAG (   u32IRCTrimFlg)    (SYS->IRCTRIMINT = u32IRCTrimFlg )

Clear HIRC trim flag.

Parameters
[in]u32IRCTrimFlgis HIRC trim flags. Including:
Returns
None

This macro clear HIRC trim flag.

Definition at line 833 of file sys.h.

◆ SYS_CLEAR_RST_SOURCE

#define SYS_CLEAR_RST_SOURCE (   u32RstSrc)    (SYS->RST_SRC |= u32RstSrc )

Clear reset source flag.

Parameters
[in]u32RstSrcis reset source. Including:
Returns
None

This macro clear reset source flag.

Definition at line 785 of file sys.h.

◆ SYS_DISABLE_BOD17

#define SYS_DISABLE_BOD17 ( )    (SYS->BODCTL &= ~SYS_BODCTL_BOD17_EN_Msk)

Disable Brown-out 1.7V detector function.

Parameters
None
Returns
None

This macro disable Brown-out 1.7V detector function.

Definition at line 603 of file sys.h.

◆ SYS_DISABLE_BOD17_RST

#define SYS_DISABLE_BOD17_RST ( )    (SYS->BODCTL &= ~SYS_BODCTL_BOD17_RST_EN_Msk)

Disable Brown-out 1.7V detector interrupt function.

Parameters
None
Returns
None

This macro enable Brown-out detector interrupt function.

Definition at line 690 of file sys.h.

◆ SYS_DISABLE_BOD20

#define SYS_DISABLE_BOD20 ( )    (SYS->BODCTL &= ~SYS_BODCTL_BOD20_EN_Msk)

Disable Brown-out 2.0V detector function.

Parameters
None
Returns
None

This macro disable Brown-out 2.0V detector function.

Definition at line 587 of file sys.h.

◆ SYS_DISABLE_BOD20_RST

#define SYS_DISABLE_BOD20_RST ( )    (SYS->BODCTL &= ~SYS_BODCTL_BOD20_RST_EN_Msk)

Disable Brown-out 2.0V detector interrupt function.

Parameters
None
Returns
None

This macro enable Brown-out detector interrupt function.

Definition at line 674 of file sys.h.

◆ SYS_DISABLE_BOD25

#define SYS_DISABLE_BOD25 ( )    (SYS->BODCTL &= ~SYS_BODCTL_BOD25_EN_Msk)

Disable Brown-out 2.5V detector function.

Parameters
None
Returns
None

This macro disable Brown-out 2.5V detector function.

Definition at line 571 of file sys.h.

◆ SYS_DISABLE_BOD25_RST

#define SYS_DISABLE_BOD25_RST ( )    (SYS->BODCTL &= ~SYS_BODCTL_BOD25_RST_EN_Msk)

Disable Brown-out 2.5V detector interrupt function.

Parameters
None
Returns
None

This macro enable Brown-out detector interrupt function.

Definition at line 658 of file sys.h.

◆ SYS_DISABLE_POR

#define SYS_DISABLE_POR ( )    (SYS->PORCTL = 0x5AA5)

Disable Power-on Reset function.

Parameters
None
Returns
None

This macro disable Power-on Reset function.

Definition at line 762 of file sys.h.

◆ SYS_ENABLE_BOD17

#define SYS_ENABLE_BOD17 ( )    (SYS->BODCTL |= SYS_BODCTL_BOD17_EN_Msk)

Enable Brown-out 1.7V detector function.

Parameters
None
Returns
None

This macro enable Brown-out 1.7V detector function.

Definition at line 611 of file sys.h.

◆ SYS_ENABLE_BOD17_RST

#define SYS_ENABLE_BOD17_RST ( )    (SYS->BODCTL |= SYS_BODCTL_BOD17_RST_EN_Msk)

Enable Brown-out 1.7V detector reset function.

Parameters
None
Returns
None

This macro enable Brown-out detect reset function.

Definition at line 698 of file sys.h.

◆ SYS_ENABLE_BOD20

#define SYS_ENABLE_BOD20 ( )    (SYS->BODCTL |= SYS_BODCTL_BOD20_EN_Msk)

Enable Brown-out 2.0V detector function.

Parameters
None
Returns
None

This macro enable Brown-out 2.0V detector function.

Definition at line 595 of file sys.h.

◆ SYS_ENABLE_BOD20_RST

#define SYS_ENABLE_BOD20_RST ( )    (SYS->BODCTL |= SYS_BODCTL_BOD20_RST_EN_Msk)

Enable Brown-out 2.0V detector reset function.

Parameters
None
Returns
None

This macro enable Brown-out detect reset function.

Definition at line 682 of file sys.h.

◆ SYS_ENABLE_BOD25

#define SYS_ENABLE_BOD25 ( )    (SYS->BODCTL |= SYS_BODCTL_BOD25_EN_Msk)

Enable Brown-out 2.5V detector function.

Parameters
None
Returns
None

This macro enable Brown-out 2.5V detector function.

Definition at line 579 of file sys.h.

◆ SYS_ENABLE_BOD25_RST

#define SYS_ENABLE_BOD25_RST ( )    (SYS->BODCTL |= SYS_BODCTL_BOD25_RST_EN_Msk)

Enable Brown-out 2.5V detector reset function.

Parameters
None
Returns
None

This macro enable Brown-out detect reset function.

Definition at line 666 of file sys.h.

◆ SYS_ENABLE_POR

#define SYS_ENABLE_POR ( )    (SYS->PORCTL = 0)

Enable Power-on Reset function.

Parameters
None
Returns
None

This macro enable Power-on Reset function.

Definition at line 770 of file sys.h.

◆ SYS_GET_BOD17_OUTPUT

#define SYS_GET_BOD17_OUTPUT ( )    (SYS->BODSTS & SYS_BODSTS_BOD17_drop_Msk)

Get Brown-out 1.7V detector status.

Parameters
None
Return values
0System voltage is higher than 1.7V setting or BOD_EN is 0.
>=1System voltage is lower than 1.7V setting.

This macro get Brown-out detector output status. If the BOD_EN is 0, this function always return 0.

Definition at line 650 of file sys.h.

◆ SYS_GET_BOD20_OUTPUT

#define SYS_GET_BOD20_OUTPUT ( )    (SYS->BODSTS & SYS_BODSTS_BOD20_drop_Msk)

Get Brown-out 2.0V detector status.

Parameters
None
Return values
0System voltage is higher than 2.0V setting or BOD_EN is 0.
>=1System voltage is lower than 2.0V setting.

This macro get Brown-out detector output status. If the BOD_EN is 0, this function always return 0.

Definition at line 640 of file sys.h.

◆ SYS_GET_BOD25_OUTPUT

#define SYS_GET_BOD25_OUTPUT ( )    (SYS->BODSTS & SYS_BODSTS_BOD25_drop_Msk)

Get Brown-out 2.5V detector status.

Parameters
None
Return values
0System voltage is higher than 2.5V setting or BOD_EN is 0.
>=1System voltage is lower than 2.5V setting.

This macro get Brown-out detector output status. If the BOD_EN is 0, this function always return 0.

Definition at line 630 of file sys.h.

◆ SYS_GET_BOD_INT_FLAG

#define SYS_GET_BOD_INT_FLAG ( )    (SYS->BODSTS & SYS_BODSTS_BOD_INT_Msk)

Get Brown-out detector interrupt flag.

Parameters
None
Return values
0Brown-out detect interrupt flag is not set.
>=1Brown-out detect interrupt flag is set.

This macro get Brown-out detector interrupt flag.

Definition at line 620 of file sys.h.

◆ SYS_GET_IRCTRIM_INT_FLAG

#define SYS_GET_IRCTRIM_INT_FLAG ( )    (SYS->IRCTRIMINT)

Get HIRC trim status.

Parameters
None
Return values
BIT0HIRC Frequency Lock
BIT1Trim Failure Interrupt
BIT2LXT Clock error

This macro get HIRC trim interrupt status register.

Definition at line 823 of file sys.h.

◆ SYS_IS_BOD_RST

#define SYS_IS_BOD_RST ( )    (SYS->RST_SRC & SYS_RST_SRC_RSTS_BOD_Msk)

Get reset source is from Brown-out detector reset.

Parameters
None
Return values
0Previous reset source is not from Brown-out detector reset
>=1Previous reset source is from Brown-out detector reset

This macro get previous reset source is from Brown-out detect reset or not.

Definition at line 707 of file sys.h.

◆ SYS_IS_CPU_RST

#define SYS_IS_CPU_RST ( )    (SYS->RST_SRC & SYS_RST_SRC_RSTS_CPU_Msk)

Get reset source is from CPU reset.

Parameters
None
Return values
0Previous reset source is not from CPU reset
>=1Previous reset source is from CPU reset

This macro get previous reset source is from CPU reset.

Definition at line 717 of file sys.h.

◆ SYS_IS_POR_RST

#define SYS_IS_POR_RST ( )    (SYS->RST_SRC & SYS_RST_SRC_RSTS_POR_Msk)

Get reset source is from Power-on Reset.

Parameters
None
Return values
0Previous reset source is not from Power-on Reset
>=1Previous reset source is from Power-on Reset

This macro get previous reset source is from Power-on Reset.

Definition at line 726 of file sys.h.

◆ SYS_IS_RSTPIN_RST

#define SYS_IS_RSTPIN_RST ( )    (SYS->RST_SRC & SYS_RST_SRC_RSTS_PAD_Msk)

Get reset source is from reset pin reset.

Parameters
None
Return values
0Previous reset source is not from reset pin reset
>=1Previous reset source is from reset pin reset

This macro get previous reset source is from reset pin reset.

Definition at line 735 of file sys.h.

◆ SYS_IS_SYSTEM_RST

#define SYS_IS_SYSTEM_RST ( )    (SYS->RST_SRC & SYS_RST_SRC_RSTS_SYS_Msk)

Get reset source is from system reset.

Parameters
None
Return values
0Previous reset source is not from system reset
>=1Previous reset source is from system reset

This macro get previous reset source is from system reset.

Definition at line 744 of file sys.h.

◆ SYS_IS_WDT_RST

#define SYS_IS_WDT_RST ( )    (SYS->RST_SRC & SYS_RST_SRC_RSTS_WDT_Msk)

Get reset source is from window watch dog reset.

Parameters
None
Return values
0Previous reset source is not from window watch dog reset
>=1Previous reset source is from window watch dog reset

This macro get previous reset source is from window watch dog reset.

Definition at line 754 of file sys.h.

Function Documentation

◆ SYS_ClearResetSrc()

void SYS_ClearResetSrc ( uint32_t  u32Src)

This function clear the selected system reset source.

Parameters
[in]u32Srcis system reset source
Returns
None

Definition at line 32 of file sys.c.

◆ SYS_DisableBOD()

void SYS_DisableBOD ( void  )

This function disable BOD function.

Parameters
None
Returns
None

Definition at line 156 of file sys.c.

◆ SYS_DisableIRCTrim()

void SYS_DisableIRCTrim ( void  )

This function disable HIRC trim function.

Parameters
None
Returns
None

Definition at line 184 of file sys.c.

◆ SYS_EnableBOD()

void SYS_EnableBOD ( int32_t  i32Mode,
uint32_t  u32BODLevel 
)

This function configure BOD function. Configure BOD reset or interrupt mode and set Brown-out voltage level. Enable Brown-out function.

Parameters
[in]i32Modeis reset or interrupt mode. Including :
[in]u32BODLevelis Brown-out voltage level. Including :
Returns
None

Definition at line 146 of file sys.c.

◆ SYS_EnableIRCTrim()

void SYS_EnableIRCTrim ( uint32_t  u32TrimSel,
uint32_t  u32TrimEnInt 
)

This function enable HIRC trim function.

Parameters
[in]u32TrimSelis trim frequency selection. Including :
[in]u32TrimEnIntis HIRC trim interrupt selection. Including :
Returns
None

Definition at line 173 of file sys.c.

◆ SYS_GetBODStatus()

uint32_t SYS_GetBODStatus ( void  )

This function get Brown-out detector output status.

Parameters
None
Returns
0: System voltage is higher than BOD_VL setting or BOD_EN is 0. 1: System voltage is lower than BOD_VL setting. Note : If the BOD_EN is 0, this function always return 0.

Definition at line 44 of file sys.c.

◆ SYS_GetResetSrc()

uint32_t SYS_GetResetSrc ( void  )

This function get the system reset source register value.

Parameters
None
Returns
Reset source

Definition at line 54 of file sys.c.

◆ SYS_IsRegLocked()

uint32_t SYS_IsRegLocked ( void  )

This function check register write-protection bit setting.

Parameters
None
Returns
0: Write-protection function is disabled. 1: Write-protection function is enabled.

Definition at line 65 of file sys.c.

◆ SYS_LockReg()

void SYS_LockReg ( void  )

Enable register write-protection function.

Parameters
None
Returns
None

This function is used to enable register write-protection function. To lock the protected register to forbid write access.

Definition at line 810 of file sys.h.

◆ SYS_ReadPDID()

uint32_t SYS_ReadPDID ( void  )

This function get product ID.

Parameters
None
Returns
Product ID

Definition at line 75 of file sys.c.

◆ SYS_ResetChip()

void SYS_ResetChip ( void  )

This function reset chip.

Parameters
None
Returns
None

Definition at line 85 of file sys.c.

◆ SYS_ResetCPU()

void SYS_ResetCPU ( void  )

This function reset CPU.

Parameters
None
Returns
None

Definition at line 95 of file sys.c.

◆ SYS_ResetModule()

void SYS_ResetModule ( uint32_t  u32ModuleIndex)

This function reset selected modules.

Parameters
[in]u32ModuleIndexis module index. Including :
Returns
None

Definition at line 125 of file sys.c.

◆ SYS_UnlockReg()

void SYS_UnlockReg ( void  )

Disable register write-protection function.

Parameters
None
Returns
None

This function disable register write-protection function. To unlock the protected register to allow write access.

Definition at line 794 of file sys.h.