| Nano103 BSP V3.01.002 The Board Support Package for Nano103 Series

Macros | Functions
SYS Exported Functions
NANO103 Device Driver » SYS Driver

## Macros
#define | SYS_CLEAR_BOD_INT_FLAG() (SYS->BODCTL |= SYS_BODCTL_BODIF_Msk)
| Clear Brown-out detector interrupt flag. More...
#define | SYS_GET_BOD_INT_FLAG() (SYS->BODCTL & SYS_BODCTL_BODIF_Msk)
| Get Brown-out detector interrupt flag. More...
#define | SYS_ENABLE_BOD() (SYS->BODCTL |= SYS_BODCTL_BODEN_Msk)
| Enable Brown-out detector function. More...
#define | SYS_DISABLE_BOD() (SYS->BODCTL &= ~SYS_BODCTL_BODEN_Msk)
| Disable Brown-out detector function. More...
#define | SYS_ENABLE_LPBOD() (SYS->BODCTL |= SYS_BODCTL_LPBODEN_Msk)
| Enable Low Power Brown-out detector function. More...
#define | SYS_DISABLE_LPBOD() (SYS->BODCTL &= ~SYS_BODCTL_LPBODEN_Msk)
| Disable Low Power Brown-out detector function. More...
#define | SYS_GET_BOD_OUTPUT() (SYS->BODCTL & SYS_BODCTL_BODOUT_Msk)
| Get Brown-out detector status. More...
#define | SYS_DISABLE_BOD_RST() (SYS->BODCTL &= ~SYS_BODCTL_BODREN_Msk)
| Disable Brown-out detector reset function. More...
#define | SYS_ENABLE_BOD_RST() (SYS->BODCTL |= SYS_BODCTL_BODREN_Msk)
| Enable Brown-out detector reset function. More...
#define | SYS_DISABLE_LPBOD_RST() (SYS->BODCTL &= ~SYS_BODCTL_LPBODREN_Msk)
| Disable Low Power Brown-out detector reset function. More...
#define | SYS_ENABLE_LPBOD_RST() (SYS->BODCTL |= SYS_BODCTL_LPBODREN_Msk)
| Enable Low Power Brown-out detector reset function. More...
#define | SYS_SET_BOD_LEVEL(u32Level) (SYS->BODCTL = (SYS->BODCTL & ~SYS_BODCTL_BODVL_Msk) | (u32Level))
| Set Brown-out detector voltage level. More...
#define | SYS_IS_BOD_RST() (SYS->RSTSTS & SYS_RSTSTS_BODRF_Msk)
| Get reset source is from Brown-out detector reset. More...
#define | SYS_IS_LVR_RST() (SYS->RSTSTS & SYS_RSTSTS_LVRF_Msk)
| Get reset source is from Low-voltage reset. More...
#define | SYS_IS_CPU_RST() (SYS->RSTSTS & SYS_RSTSTS_CPURF_Msk)
| Get reset source is from CPU reset. More...
#define | SYS_IS_LOCKUP_RST() (SYS->RSTSTS & SYS_RSTSTS_LOCKRF_Msk)
| Get reset source is from Cortex-M0 lockup event. More...
#define | SYS_IS_POR_RST() (SYS->RSTSTS & SYS_RSTSTS_PORF_Msk)
| Get reset source is from Power-on Reset. More...
#define | SYS_IS_RSTPIN_RST() (SYS->RSTSTS & SYS_RSTSTS_PINRF_Msk)
| Get reset source is from reset pin reset. More...
#define | SYS_IS_SYSTEM_RST() (SYS->RSTSTS & SYS_RSTSTS_SYSRF_Msk)
| Get reset source is from system reset. More...
#define | SYS_IS_WDT_RST() (SYS->RSTSTS & SYS_RSTSTS_WDTRF_Msk)
| Get reset source is from window watch dog reset. More...
#define | SYS_DISABLE_LVR() (SYS->BODCTL &= ~SYS_BODCTL_LVREN_Msk)
| Disable Low-Voltage-Reset function. More...
#define | SYS_ENABLE_LVR() (SYS->BODCTL |= SYS_BODCTL_LVREN_Msk)
| Enable Low-Voltage-Reset function. More...
#define | SYS_DISABLE_POR() do{SYS->PORCTL = 0x5AA5;SYS->MISCCTL = SYS_MISCCTL_POR33DIS_Msk | SYS_MISCCTL_POR18DIS_Msk;}while(0)
| Disable Power-on Reset function. More...
#define | SYS_ENABLE_POR() do{SYS->PORCTL = 0;SYS->MISCCTL = 0;}while(0)
| Enable Power-on Reset function. More...
#define | SYS_CLEAR_RST_SOURCE(u32RstSrc) (SYS->RSTSTS |= u32RstSrc)
| Clear reset source flag. More...
#define | SYS_GET_IRC0TRIM_INT_FLAG() (SYS->IRC0TISTS)
| Get HIRC0 trim status. More...
#define | SYS_CLEAR_IRC0TRIM_INT_FLAG(u32IRCTrimFlg) (SYS->IRC0TISTS = u32IRCTrimFlg)
| Clear HIRC0 trim flag. More...
#define | SYS_GET_IRC1TRIM_INT_FLAG() (SYS->IRC1TISTS)
| Get HIRC1 trim status. More...
#define | SYS_CLEAR_IRC1TRIM_INT_FLAG(u32IRCTrimFlg) (SYS->IRC1TISTS = u32IRCTrimFlg)
| Clear HIRC1 trim flag. More...
#define | SYS_GET_MIRCTRIM_INT_FLAG() (SYS->MIRCTISTS)
| Get MIRC trim status. More...
#define | SYS_CLEAR_MIRCTRIM_INT_FLAG(u32IRCTrimFlg) (SYS->MIRCTISTS = u32IRCTrimFlg)
| Clear MIRC 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)
| Clear reset source. More...
uint32_t | SYS_GetBODStatus (void)
| 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 Normal 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 Normal BOD function. More...
void | SYS_EnableLPBOD (int32_t i32Mode, uint32_t u32BODLevel)
| This function configure Low Power BOD function only valid in Power Down mode. Configure Low Power BOD reset or interrupt mode and set Low Power Brown-out voltage level. Enable Low Power Brown-out function. More...
void | SYS_DisableLPBOD (void)
| This function disable Low Power BOD function. More...
void | SYS_EnableHIRC0Trim (uint32_t u32TrimSel, uint32_t u32TrimEnInt)
| This function enable HIRC0 trim function. More...
void | SYS_DisableHIRC0Trim (void)
| This function disable HIRC0 trim function. More...
void | SYS_EnableHIRC1Trim (uint32_t u32TrimSel, uint32_t u32TrimEnInt)
| This function enable HIRC1 trim function. More...
void | SYS_DisableHIRC1Trim (void)
| This function disable HIRC1 trim function. More...
void | SYS_EnableMIRCTrim (uint32_t u32TrimSel, uint32_t u32TrimEnInt)
| This function enable MIRC trim function. More...
void | SYS_DisableMIRCTrim (void)
| This function disable HIRC0 trim function. More...

## Detailed Description

## Macro Definition Documentation

## ◆ SYS_CLEAR_BOD_INT_FLAG

#define SYS_CLEAR_BOD_INT_FLAG | ( |  | ) | (SYS->BODCTL |= SYS_BODCTL_BODIF_Msk)

Clear Brown-out detector interrupt flag.

Parameters

  None |

Returns
  None

This macro clear Brown-out detector interrupt flag.

Definition at line 375 of file sys.h.

## ◆ SYS_CLEAR_IRC0TRIM_INT_FLAG

#define SYS_CLEAR_IRC0TRIM_INT_FLAG | ( |  | u32IRCTrimFlg | ) | (SYS->IRC0TISTS = u32IRCTrimFlg)

Clear HIRC0 trim flag.

Parameters

  [in] | u32IRCTrimFlg | is HIRC0 trim flags. Including: SYS_IRCTISTS_FAIL_INT SYS_IRCTISTS_32KERR_INT

Returns
  None

This macro clear HIRC0 trim flag.

Definition at line 655 of file sys.h.

## ◆ SYS_CLEAR_IRC1TRIM_INT_FLAG

#define SYS_CLEAR_IRC1TRIM_INT_FLAG | ( |  | u32IRCTrimFlg | ) | (SYS->IRC1TISTS = u32IRCTrimFlg)

Clear HIRC1 trim flag.

Parameters

  [in] | u32IRCTrimFlg | is HIRC1 trim flags. Including: SYS_IRCTISTS_FAIL_INT SYS_IRCTISTS_32KERR_INT

Returns
  None

This macro clear HIRC1 trim flag.

Definition at line 675 of file sys.h.

## ◆ SYS_CLEAR_MIRCTRIM_INT_FLAG

#define SYS_CLEAR_MIRCTRIM_INT_FLAG | ( |  | u32IRCTrimFlg | ) | (SYS->MIRCTISTS = u32IRCTrimFlg)

Clear MIRC trim flag.

Parameters

  [in] | u32IRCTrimFlg | is MIRC trim flags. Including: SYS_IRCTISTS_FAIL_INT SYS_IRCTISTS_32KERR_INT

Returns
  None

This macro clear MIRC trim flag.

Definition at line 695 of file sys.h.

## ◆ SYS_CLEAR_RST_SOURCE

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

Clear reset source flag.

Parameters

  [in] | u32RstSrc | is reset source. Including: SYS_RSTSTS_PORF_Msk SYS_RSTSTS_PINRF_Msk SYS_RSTSTS_WDTRF_Msk SYS_RSTSTS_LVRF_Msk SYS_RSTSTS_BODRF_Msk SYS_RSTSTS_SYSRF_Msk SYS_RSTSTS_CPURF_Msk SYS_RSTSTS_LOCKRF_Msk

Returns
  None

This macro clear reset source flag.

Definition at line 606 of file sys.h.

## ◆ SYS_DISABLE_BOD

#define SYS_DISABLE_BOD | ( |  | ) | (SYS->BODCTL &= ~SYS_BODCTL_BODEN_Msk)

Disable Brown-out detector function.

Parameters

  None |

Returns
  None

This macro disable Brown-out detector function.

Definition at line 400 of file sys.h.

## ◆ SYS_DISABLE_BOD_RST

#define SYS_DISABLE_BOD_RST | ( |  | ) | (SYS->BODCTL &= ~SYS_BODCTL_BODREN_Msk)

Disable Brown-out detector reset function.

Parameters

  None |

Returns
  None

This macro disable Brown-out detector reset function.

Definition at line 434 of file sys.h.

## ◆ SYS_DISABLE_LPBOD

#define SYS_DISABLE_LPBOD | ( |  | ) | (SYS->BODCTL &= ~SYS_BODCTL_LPBODEN_Msk)

Disable Low Power Brown-out detector function.

Parameters

  None |

Returns
  None

This macro disable Low Power Brown-out detector function.

Definition at line 416 of file sys.h.

## ◆ SYS_DISABLE_LPBOD_RST

#define SYS_DISABLE_LPBOD_RST | ( |  | ) | (SYS->BODCTL &= ~SYS_BODCTL_LPBODREN_Msk)

Disable Low Power Brown-out detector reset function.

Parameters

  None |

Returns
  None

This macro disable Low Power Brown-out detector reset function.

Definition at line 450 of file sys.h.

## ◆ SYS_DISABLE_LVR

#define SYS_DISABLE_LVR | ( |  | ) | (SYS->BODCTL &= ~SYS_BODCTL_LVREN_Msk)

Disable Low-Voltage-Reset function.

Parameters

  None |

Returns
  None

This macro disable Low-Voltage-Reset function. The register write-protection function should be disabled before using this macro.

Definition at line 565 of file sys.h.

## ◆ SYS_DISABLE_POR

#define SYS_DISABLE_POR | ( |  | ) | do{SYS->PORCTL = 0x5AA5;SYS->MISCCTL = SYS_MISCCTL_POR33DIS_Msk | SYS_MISCCTL_POR18DIS_Msk;}while(0)

Disable Power-on Reset function.

Parameters

  None |

Returns
  None

This macro disable Power-on Reset function.

Definition at line 582 of file sys.h.

## ◆ SYS_ENABLE_BOD

#define SYS_ENABLE_BOD | ( |  | ) | (SYS->BODCTL |= SYS_BODCTL_BODEN_Msk)

Enable Brown-out detector function.

Parameters

  None |

Returns
  None

This macro enable Brown-out detector function.

Definition at line 392 of file sys.h.

## ◆ SYS_ENABLE_BOD_RST

#define SYS_ENABLE_BOD_RST | ( |  | ) | (SYS->BODCTL |= SYS_BODCTL_BODREN_Msk)

Enable Brown-out detector reset function.

Parameters

  None |

Returns
  None

This macro enable Brown-out detect reset function.

Definition at line 442 of file sys.h.

## ◆ SYS_ENABLE_LPBOD

#define SYS_ENABLE_LPBOD | ( |  | ) | (SYS->BODCTL |= SYS_BODCTL_LPBODEN_Msk)

Enable Low Power Brown-out detector function.

Parameters

  None |

Returns
  None

This macro enable Low Power Brown-out detector function.

Definition at line 408 of file sys.h.

## ◆ SYS_ENABLE_LPBOD_RST

#define SYS_ENABLE_LPBOD_RST | ( |  | ) | (SYS->BODCTL |= SYS_BODCTL_LPBODREN_Msk)

Enable Low Power Brown-out detector reset function.

Parameters

  None |

Returns
  None

This macro enable Low Power Brown-out detect reset function.

Definition at line 458 of file sys.h.

## ◆ SYS_ENABLE_LVR

#define SYS_ENABLE_LVR | ( |  | ) | (SYS->BODCTL |= SYS_BODCTL_LVREN_Msk)

Enable Low-Voltage-Reset function.

Parameters

  None |

Returns
  None

This macro enable Low-Voltage-Reset function. The register write-protection function should be disabled before using this macro.

Definition at line 574 of file sys.h.

## ◆ SYS_ENABLE_POR

#define SYS_ENABLE_POR | ( |  | ) | do{SYS->PORCTL = 0;SYS->MISCCTL = 0;}while(0)

Enable Power-on Reset function.

Parameters

  None |

Returns
  None

This macro enable Power-on Reset function.

Definition at line 590 of file sys.h.

## ◆ SYS_GET_BOD_INT_FLAG

#define SYS_GET_BOD_INT_FLAG | ( |  | ) | (SYS->BODCTL & SYS_BODCTL_BODIF_Msk)

Get Brown-out detector interrupt flag.

Parameters

  None |

Return values

  0 | Brown-out detect interrupt flag is not set.
  >=1 | Brown-out detect interrupt flag is set.

This macro get Brown-out detector interrupt flag.

Definition at line 384 of file sys.h.

## ◆ SYS_GET_BOD_OUTPUT

#define SYS_GET_BOD_OUTPUT | ( |  | ) | (SYS->BODCTL & SYS_BODCTL_BODOUT_Msk)

Get Brown-out detector status.

Parameters

  None |

Return values

  0 | System voltage is higher than BOD threshold voltage setting or BOD function is disabled.
  >=1 | System voltage is lower than BOD threshold voltage setting.

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

Definition at line 426 of file sys.h.

## ◆ SYS_GET_IRC0TRIM_INT_FLAG

#define SYS_GET_IRC0TRIM_INT_FLAG | ( |  | ) | (SYS->IRC0TISTS)

Get HIRC0 trim status.

Parameters

  None |

Return values

  BIT0 | HIRC0 Frequency Lock
  BIT1 | Trim Failure Interrupt
  BIT2 | LXT Clock error

This macro get HIRC0 trim interrupt status register.

Definition at line 645 of file sys.h.

## ◆ SYS_GET_IRC1TRIM_INT_FLAG

#define SYS_GET_IRC1TRIM_INT_FLAG | ( |  | ) | (SYS->IRC1TISTS)

Get HIRC1 trim status.

Parameters

  None |

Return values

  BIT0 | HIRC1 Frequency Lock
  BIT1 | Trim Failure Interrupt
  BIT2 | LXT Clock error

This macro get HIRC1 trim interrupt status register.

Definition at line 665 of file sys.h.

## ◆ SYS_GET_MIRCTRIM_INT_FLAG

#define SYS_GET_MIRCTRIM_INT_FLAG | ( |  | ) | (SYS->MIRCTISTS)

Get MIRC trim status.

Parameters

  None |

Return values

  BIT0 | MIRC Frequency Lock
  BIT1 | Trim Failure Interrupt
  BIT2 | LXT Clock error

This macro get MIRC trim interrupt status register.

Definition at line 685 of file sys.h.

## ◆ SYS_IS_BOD_RST

#define SYS_IS_BOD_RST | ( |  | ) | (SYS->RSTSTS & SYS_RSTSTS_BODRF_Msk)

Get reset source is from Brown-out detector reset.

Parameters

  None |

Return values

  0 | Previous reset source is not from Brown-out detector reset
  >=1 | Previous 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 491 of file sys.h.

## ◆ SYS_IS_CPU_RST

#define SYS_IS_CPU_RST | ( |  | ) | (SYS->RSTSTS & SYS_RSTSTS_CPURF_Msk)

Get reset source is from CPU reset.

Parameters

  None |

Return values

  0 | Previous reset source is not from CPU reset
  >=1 | Previous reset source is from CPU reset

This macro get previous reset source is from CPU reset.

Definition at line 509 of file sys.h.

## ◆ SYS_IS_LOCKUP_RST

#define SYS_IS_LOCKUP_RST | ( |  | ) | (SYS->RSTSTS & SYS_RSTSTS_LOCKRF_Msk)

Get reset source is from Cortex-M0 lockup event.

Parameters

  None |

Return values

  0 | Previous reset source is not from Cortex-M0 lockup event
  >=1 | Previous reset source is from Cortex-M0 lockup event

This macro get previous reset source is from Cortex-M0 lockup event.

Definition at line 519 of file sys.h.

## ◆ SYS_IS_LVR_RST

#define SYS_IS_LVR_RST | ( |  | ) | (SYS->RSTSTS & SYS_RSTSTS_LVRF_Msk)

Get reset source is from Low-voltage reset.

Parameters

  None |

Return values

  0 | Previous reset source is not from Low-voltage reset
  >=1 | Previous reset source is from Low-voltage reset

This macro get previous reset source is from Low-voltage reset or not.

Definition at line 500 of file sys.h.

## ◆ SYS_IS_POR_RST

#define SYS_IS_POR_RST | ( |  | ) | (SYS->RSTSTS & SYS_RSTSTS_PORF_Msk)

Get reset source is from Power-on Reset.

Parameters

  None |

Return values

  0 | Previous reset source is not from Power-on Reset
  >=1 | Previous reset source is from Power-on Reset

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

Definition at line 528 of file sys.h.

## ◆ SYS_IS_RSTPIN_RST

#define SYS_IS_RSTPIN_RST | ( |  | ) | (SYS->RSTSTS & SYS_RSTSTS_PINRF_Msk)

Get reset source is from reset pin reset.

Parameters

  None |

Return values

  0 | Previous reset source is not from reset pin reset
  >=1 | Previous reset source is from reset pin reset

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

Definition at line 537 of file sys.h.

## ◆ SYS_IS_SYSTEM_RST

#define SYS_IS_SYSTEM_RST | ( |  | ) | (SYS->RSTSTS & SYS_RSTSTS_SYSRF_Msk)

Get reset source is from system reset.

Parameters

  None |

Return values

  0 | Previous reset source is not from system reset
  >=1 | Previous reset source is from system reset

This macro get previous reset source is from system reset.

Definition at line 546 of file sys.h.

## ◆ SYS_IS_WDT_RST

#define SYS_IS_WDT_RST | ( |  | ) | (SYS->RSTSTS & SYS_RSTSTS_WDTRF_Msk)

Get reset source is from window watch dog reset.

Parameters

  None |

Return values

  0 | Previous reset source is not from window watch dog reset
  >=1 | Previous reset source is from window watch dog reset

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

Definition at line 556 of file sys.h.

## ◆ SYS_SET_BOD_LEVEL

#define SYS_SET_BOD_LEVEL | ( |  | u32Level | ) | (SYS->BODCTL = (SYS->BODCTL & ~SYS_BODCTL_BODVL_Msk) | (u32Level))

Set Brown-out detector voltage level.

Parameters

  [in] | u32Level | is Brown-out voltage level. Including : SYS_BODCTL_BODVL_1_7V SYS_BODCTL_BODVL_1_8V SYS_BODCTL_BODVL_1_9V SYS_BODCTL_BODVL_2_0V SYS_BODCTL_BODVL_2_1V SYS_BODCTL_BODVL_2_2V SYS_BODCTL_BODVL_2_3V SYS_BODCTL_BODVL_2_4V SYS_BODCTL_BODVL_2_5V SYS_BODCTL_BODVL_2_6V SYS_BODCTL_BODVL_2_7V SYS_BODCTL_BODVL_2_8V SYS_BODCTL_BODVL_2_9V SYS_BODCTL_BODVL_3_0V SYS_BODCTL_BODVL_3_1V

Returns
  None

This macro set Brown-out detector voltage level. The write-protection function should be disabled before using this macro.

Definition at line 482 of file sys.h.

## Function Documentation

## ◆ SYS_ClearResetSrc()

void SYS_ClearResetSrc | ( | uint32_t | u32Src | ) |

Clear reset source.

Parameters

  [in] | u32Src | is system reset source. Including : SYS_RSTSTS_CPURF_Msk SYS_RSTSTS_SYSRF_Msk SYS_RSTSTS_BODRF_Msk SYS_RSTSTS_LVRF_Msk SYS_RSTSTS_WDTRF_Msk SYS_RSTSTS_PINRF_Msk SYS_RSTSTS_PORF_Msk SYS_RSTSTS_LOCKRF_Msk

Returns
  None

This function clear the selected system reset source.

Definition at line 41 of file sys.c.

## ◆ SYS_DisableBOD()

void SYS_DisableBOD | ( | void |  | ) |

This function disable Normal BOD function.

Parameters

  None |

Returns
  None

Definition at line 176 of file sys.c.

## ◆ SYS_DisableHIRC0Trim()

void SYS_DisableHIRC0Trim | ( | void |  | ) |

This function disable HIRC0 trim function.

Parameters

  None |

Returns
  None

Definition at line 232 of file sys.c.

## ◆ SYS_DisableHIRC1Trim()

void SYS_DisableHIRC1Trim | ( | void |  | ) |

This function disable HIRC1 trim function.

Parameters

  None |

Returns
  None

Definition at line 258 of file sys.c.

## ◆ SYS_DisableLPBOD()

void SYS_DisableLPBOD | ( | void |  | ) |

This function disable Low Power BOD function.

Parameters

  None |

Returns
  None

Definition at line 203 of file sys.c.

## ◆ SYS_DisableMIRCTrim()

void SYS_DisableMIRCTrim | ( | void |  | ) |

This function disable HIRC0 trim function.

Parameters

  None |

Returns
  None

Definition at line 284 of file sys.c.

## ◆ SYS_EnableBOD()

void SYS_EnableBOD | ( | int32_t | i32Mode,
|  | uint32_t | u32BODLevel
| ) |  |

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

Parameters

  [in] | i32Mode | is reset or interrupt mode. SYS_BODCTL_BOD_RST_EN SYS_BODCTL_BOD_INTERRUPT_EN
  [in] | u32BODLevel | is Brown-out voltage level. Including : SYS_BODCTL_BODVL_1_7V SYS_BODCTL_BODVL_1_8V SYS_BODCTL_BODVL_1_9V SYS_BODCTL_BODVL_2_0V SYS_BODCTL_BODVL_2_1V SYS_BODCTL_BODVL_2_2V SYS_BODCTL_BODVL_2_3V SYS_BODCTL_BODVL_2_4V SYS_BODCTL_BODVL_2_5V SYS_BODCTL_BODVL_2_6V SYS_BODCTL_BODVL_2_7V SYS_BODCTL_BODVL_2_8V SYS_BODCTL_BODVL_2_9V SYS_BODCTL_BODVL_3_0V SYS_BODCTL_BODVL_3_1V

Returns
  None

Definition at line 166 of file sys.c.

## ◆ SYS_EnableHIRC0Trim()

void SYS_EnableHIRC0Trim | ( | uint32_t | u32TrimSel,
|  | uint32_t | u32TrimEnInt
| ) |  |

This function enable HIRC0 trim function.

Parameters

  [in] | u32TrimSel | is trim frequency selection. Including : SYS_IRC0TCTL_TRIM_11_0592M SYS_IRC0TCTL_TRIM_12M SYS_IRC0TCTL_TRIM_12_288M SYS_IRC0TCTL_TRIM_16M
  [in] | u32TrimEnInt | is HIRC0 trim interrupt selection. Including : SYS_IRCTIEN_FAIL_EN SYS_IRCTIEN_32KERR_EN SYS_IRCTIEN_DISABLE

Returns
  None

Definition at line 221 of file sys.c.

## ◆ SYS_EnableHIRC1Trim()

void SYS_EnableHIRC1Trim | ( | uint32_t | u32TrimSel,
|  | uint32_t | u32TrimEnInt
| ) |  |

This function enable HIRC1 trim function.

Parameters

  [in] | u32TrimSel | is trim frequency selection. SYS_IRC1TCTL_TRIM_36M
  [in] | u32TrimEnInt | is HIRC1 trim interrupt selection. Including : SYS_IRCTIEN_FAIL_EN SYS_IRCTIEN_32KERR_EN SYS_IRCTIEN_DISABLE

Returns
  None

Definition at line 247 of file sys.c.

## ◆ SYS_EnableLPBOD()

void SYS_EnableLPBOD | ( | int32_t | i32Mode,
|  | uint32_t | u32BODLevel
| ) |  |

This function configure Low Power BOD function only valid in Power Down mode. Configure Low Power BOD reset or interrupt mode and set Low Power Brown-out voltage level. Enable Low Power Brown-out function.

Parameters

  [in] | i32Mode | is reset or interrupt mode. SYS_BODCTL_LPBOD_RST_EN SYS_BODCTL_LPBOD_INTERRUPT_EN
  [in] | u32BODLevel | is Low Power Brown-out voltage level. Including : SYS_BODCTL_LPBODVL_2_0V SYS_BODCTL_LPBODVL_2_5V

Returns
  None

Definition at line 193 of file sys.c.

## ◆ SYS_EnableMIRCTrim()

void SYS_EnableMIRCTrim | ( | uint32_t | u32TrimSel,
|  | uint32_t | u32TrimEnInt
| ) |  |

This function enable MIRC trim function.

Parameters

  [in] | u32TrimSel | is trim frequency selection. SYS_MIRCTCTL_TRIM_4M
  [in] | u32TrimEnInt | is MIRC trim interrupt selection. Including : SYS_IRCTIEN_FAIL_EN SYS_IRCTIEN_32KERR_EN SYS_IRCTIEN_DISABLE

Returns
  None

Definition at line 273 of file sys.c.

## ◆ SYS_GetBODStatus()

uint32_t SYS_GetBODStatus | ( | void |  | ) |

Get Brown-out detector output status.

Parameters

  None |

Return values

  0 | System voltage is higher than BOD_VL setting or BOD_EN is 0.
  1 | System voltage is lower than BOD_VL setting.

This function get Brown-out detector output status.

Definition at line 53 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 63 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 74 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 632 of file sys.h.

## ◆ SYS_ReadPDID()

uint32_t SYS_ReadPDID | ( | void |  | ) |

This function get product ID.

Parameters

  None |

Returns
  Product ID

Definition at line 84 of file sys.c.

## ◆ SYS_ResetChip()

void SYS_ResetChip | ( | void |  | ) |

This function reset chip.

Parameters

  None |

Returns
  None

Definition at line 94 of file sys.c.

## ◆ SYS_ResetCPU()

void SYS_ResetCPU | ( | void |  | ) |

This function reset CPU.

Parameters

  None |

Returns
  None

Definition at line 104 of file sys.c.

## ◆ SYS_ResetModule()

void SYS_ResetModule | ( | uint32_t | u32ModuleIndex | ) |

This function reset selected modules.

Parameters

  [in] | u32ModuleIndex | is module index. Including : CHIP_RST CPU_RST DMA_RST SC1_RST SC0_RST ADC_RST ACMP0_RST PWM0_RST UART1_RST UART0_RST SPI3_RST SPI2_RST SPI1_RST SPI0_RST I2C1_RST I2C0_RST TMR3_RST TMR2_RST TMR1_RST TMR0_RST GPIO_RST

Returns
  None

Definition at line 135 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 615 of file sys.h.