| M480 BSP V3.05.001 The Board Support Package for M480 Series

Macros | Functions
SYS Exported Functions
Standard Driver » SYS Driver

## Macros
#define | SYS_CLEAR_BOD_INT_FLAG()
| Clear Brown-out detector interrupt flag. More...
#define | SYS_CLEAR_BOD_LPM()
| Set Brown-out detector function to normal mode. More...
#define | SYS_DISABLE_BOD()
| Disable Brown-out detector function. More...
#define | SYS_ENABLE_BOD()
| Enable Brown-out detector function. More...
#define | SYS_GET_BOD_INT_FLAG()
| Get Brown-out detector interrupt flag. More...
#define | SYS_GET_BOD_OUTPUT()
| Get Brown-out detector status. More...
#define | SYS_DISABLE_BOD_RST()
| Enable Brown-out detector interrupt function. More...
#define | SYS_ENABLE_BOD_RST()
| Enable Brown-out detector reset function. More...
#define | SYS_SET_BOD_LPM()
| Set Brown-out detector function low power mode. More...
#define | SYS_SET_BOD_LEVEL(u32Level)
| Set Brown-out detector voltage level. More...
#define | SYS_IS_BOD_RST()
| Get reset source is from Brown-out detector reset. More...
#define | SYS_IS_CPU_RST()
| Get reset source is from CPU reset. More...
#define | SYS_IS_LVR_RST()
| Get reset source is from LVR Reset. More...
#define | SYS_IS_POR_RST()
| Get reset source is from Power-on Reset. More...
#define | SYS_IS_RSTPIN_RST()
| Get reset source is from reset pin reset. More...
#define | SYS_IS_SYSTEM_RST()
| Get reset source is from system reset. More...
#define | SYS_IS_WDT_RST()
| Get reset source is from window watch dog reset. More...
#define | SYS_DISABLE_LVR()
| Disable Low-Voltage-Reset function. More...
#define | SYS_ENABLE_LVR()
| Enable Low-Voltage-Reset function. More...
#define | SYS_DISABLE_POR()
| Disable Power-on Reset function. More...
#define | SYS_ENABLE_POR()
| Enable Power-on Reset function. More...
#define | SYS_CLEAR_RST_SOURCE(u32RstSrc)
| Clear reset source 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)
| Get reset status register value. More...
uint32_t | SYS_IsRegLocked (void)
| Check if register is locked nor not. More...
uint32_t | SYS_ReadPDID (void)
| Get product ID. More...
void | SYS_ResetChip (void)
| Reset chip with chip reset. More...
void | SYS_ResetCPU (void)
| Reset chip with CPU reset. More...
void | SYS_ResetModule (uint32_t u32ModuleIndex)
| Reset selected module. More...
void | SYS_EnableBOD (int32_t i32Mode, uint32_t u32BODLevel)
| Enable and configure Brown-out detector function. More...
void | SYS_DisableBOD (void)
| Disable Brown-out detector function. More...
void | SYS_SetPowerLevel (uint32_t u32PowerLevel)
| Set Power Level. More...
void | SYS_SetVRef (uint32_t u32VRefCTL)
| Set Reference Voltage. More...

## Detailed Description

## Macro Definition Documentation

## ◆ SYS_CLEAR_BOD_INT_FLAG

#define SYS_CLEAR_BOD_INT_FLAG | ( |  | ) |

Clear Brown-out detector interrupt flag.

Parameters

  None |

Returns
  None

This macro clear Brown-out detector interrupt flag.

Definition at line 1343 of file sys.h.

## ◆ SYS_CLEAR_BOD_LPM

#define SYS_CLEAR_BOD_LPM | ( |  | ) |

Set Brown-out detector function to normal mode.

Parameters

  None |

Returns
  None

This macro set Brown-out detector to normal mode. The register write-protection function should be disabled before using this macro.

Definition at line 1353 of file sys.h.

## ◆ SYS_CLEAR_RST_SOURCE

#define SYS_CLEAR_RST_SOURCE | ( |  | 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_CPULKRF_Msk

Returns
  None

This macro clear reset source flag.

Definition at line 1569 of file sys.h.

## ◆ SYS_DISABLE_BOD

#define SYS_DISABLE_BOD | ( |  | ) |

Disable Brown-out detector function.

Parameters

  None |

Returns
  None

This macro disable Brown-out detector function. The register write-protection function should be disabled before using this macro.

Definition at line 1363 of file sys.h.

## ◆ SYS_DISABLE_BOD_RST

#define SYS_DISABLE_BOD_RST | ( |  | ) |

Enable Brown-out detector interrupt function.

Parameters

  None |

Returns
  None

This macro enable Brown-out detector interrupt function. The register write-protection function should be disabled before using this macro.

Definition at line 1404 of file sys.h.

## ◆ SYS_DISABLE_LVR

#define SYS_DISABLE_LVR | ( |  | ) |

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 1522 of file sys.h.

## ◆ SYS_DISABLE_POR

#define SYS_DISABLE_POR | ( |  | ) |

Disable Power-on Reset function.

Parameters

  None |

Returns
  None

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

Definition at line 1542 of file sys.h.

## ◆ SYS_ENABLE_BOD

#define SYS_ENABLE_BOD | ( |  | ) |

Enable Brown-out detector function.

Parameters

  None |

Returns
  None

This macro enable Brown-out detector function. The register write-protection function should be disabled before using this macro.

Definition at line 1373 of file sys.h.

## ◆ SYS_ENABLE_BOD_RST

#define SYS_ENABLE_BOD_RST | ( |  | ) |

Enable Brown-out detector reset function.

Parameters

  None |

Returns
  None

This macro enable Brown-out detect reset function. The register write-protection function should be disabled before using this macro.

Definition at line 1414 of file sys.h.

## ◆ SYS_ENABLE_LVR

#define SYS_ENABLE_LVR | ( |  | ) |

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 1532 of file sys.h.

## ◆ SYS_ENABLE_POR

#define SYS_ENABLE_POR | ( |  | ) |

Enable Power-on Reset function.

Parameters

  None |

Returns
  None

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

Definition at line 1552 of file sys.h.

## ◆ SYS_GET_BOD_INT_FLAG

#define SYS_GET_BOD_INT_FLAG | ( |  | ) |

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 1383 of file sys.h.

## ◆ SYS_GET_BOD_OUTPUT

#define SYS_GET_BOD_OUTPUT | ( |  | ) |

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 1394 of file sys.h.

## ◆ SYS_IS_BOD_RST

#define SYS_IS_BOD_RST | ( |  | ) |

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 1452 of file sys.h.

## ◆ SYS_IS_CPU_RST

#define SYS_IS_CPU_RST | ( |  | ) |

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 1462 of file sys.h.

## ◆ SYS_IS_LVR_RST

#define SYS_IS_LVR_RST | ( |  | ) |

Get reset source is from LVR 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.

Definition at line 1472 of file sys.h.

## ◆ SYS_IS_POR_RST

#define SYS_IS_POR_RST | ( |  | ) |

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 1482 of file sys.h.

## ◆ SYS_IS_RSTPIN_RST

#define SYS_IS_RSTPIN_RST | ( |  | ) |

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 1492 of file sys.h.

## ◆ SYS_IS_SYSTEM_RST

#define SYS_IS_SYSTEM_RST | ( |  | ) |

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 1502 of file sys.h.

## ◆ SYS_IS_WDT_RST

#define SYS_IS_WDT_RST | ( |  | ) |

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 1512 of file sys.h.

## ◆ SYS_SET_BOD_LEVEL

#define SYS_SET_BOD_LEVEL | ( |  | u32Level | ) |

Set Brown-out detector voltage level.

Parameters

  [in] | u32Level | is Brown-out voltage level. Including : SYS_BODCTL_BODVL_3_0V SYS_BODCTL_BODVL_2_8V SYS_BODCTL_BODVL_2_6V SYS_BODCTL_BODVL_2_4V SYS_BODCTL_BODVL_2_2V SYS_BODCTL_BODVL_2_0V SYS_BODCTL_BODVL_1_8V SYS_BODCTL_BODVL_1_6V

Returns
  None

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

Definition at line 1442 of file sys.h.

## ◆ SYS_SET_BOD_LPM

#define SYS_SET_BOD_LPM | ( |  | ) |

Set Brown-out detector function low power mode.

Parameters

  None |

Returns
  None

This macro set Brown-out detector to low power mode. The register write-protection function should be disabled before using this macro.

Definition at line 1424 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_CPULKRF_Msk 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

Returns
  None

This function clear the selected system reset source.

Definition at line 44 of file sys.c.

## ◆ SYS_DisableBOD()

void SYS_DisableBOD | ( | void |  | ) |

Disable Brown-out detector function.

Parameters

  None |

Returns
  None

This function disable Brown-out detector function. The register write-protection function should be disabled before using this function.

Definition at line 235 of file sys.c.

## ◆ SYS_EnableBOD()

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

Enable and configure Brown-out detector function.

Parameters

  [in] | i32Mode | is reset or interrupt mode. Including : SYS_BODCTL_BOD_RST_EN SYS_BODCTL_BOD_INTERRUPT_EN
  [in] | u32BODLevel | is Brown-out voltage level. Including : SYS_BODCTL_BODVL_3_0V SYS_BODCTL_BODVL_2_8V SYS_BODCTL_BODVL_2_6V SYS_BODCTL_BODVL_2_4V SYS_BODCTL_BODVL_2_2V SYS_BODCTL_BODVL_2_0V SYS_BODCTL_BODVL_1_8V SYS_BODCTL_BODVL_1_6V

Returns
  None

This function configure Brown-out detector reset or interrupt mode, enable Brown-out function and set Brown-out voltage level. The register write-protection function should be disabled before using this function.

Definition at line 216 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 BODVL setting or BODEN is 0.
  1 | System voltage is lower than BODVL setting.

This function get Brown-out detector output status.

Definition at line 56 of file sys.c.

## ◆ SYS_GetResetSrc()

uint32_t SYS_GetResetSrc | ( | void |  | ) |

Get reset status register value.

Parameters

  None |

Returns
  Reset source

This function get the system reset status register value.

Definition at line 67 of file sys.c.

## ◆ SYS_IsRegLocked()

uint32_t SYS_IsRegLocked | ( | void |  | ) |

Check if register is locked nor not.

Parameters

  None |

Return values

  0 | Write-protection function is disabled. 1 Write-protection function is enabled.

This function check register write-protection bit setting.

Definition at line 79 of file sys.c.

## ◆ SYS_LockReg()

__STATIC_INLINE 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 1604 of file sys.h.

## ◆ SYS_ReadPDID()

uint32_t SYS_ReadPDID | ( | void |  | ) |

Get product ID.

Parameters

  None |

Returns
  Product ID

This function get product ID.

Definition at line 90 of file sys.c.

## ◆ SYS_ResetChip()

void SYS_ResetChip | ( | void |  | ) |

Reset chip with chip reset.

Parameters

  None |

Returns
  None

This function reset chip with chip reset. The register write-protection function should be disabled before using this function.

Definition at line 102 of file sys.c.

## ◆ SYS_ResetCPU()

void SYS_ResetCPU | ( | void |  | ) |

Reset chip with CPU reset.

Parameters

  None |

Returns
  None

This function reset CPU with CPU reset. The register write-protection function should be disabled before using this function.

Definition at line 114 of file sys.c.

## ◆ SYS_ResetModule()

void SYS_ResetModule | ( | uint32_t | u32ModuleIndex | ) |

Reset selected module.

Parameters

  [in] | u32ModuleIndex | is module index. Including : PDMA_RST EBI_RST EMAC_RST SDH0_RST CRC_RST CCAP_RST HSUSBD_RST CRPT_RST SPIM_RST USBH_RST SDH1_RST GPIO_RST TMR0_RST TMR1_RST TMR2_RST TMR3_RST ACMP01_RST I2C0_RST I2C1_RST I2C2_RST QSPI0_RST SPI0_RST SPI1_RST SPI2_RST UART0_RST UART1_RST UART2_RST UART3_RST UART4_RST UART5_RST UART6_RST UART7_RST CAN0_RST CAN1_RST OTG_RST USBD_RST EADC_RST I2S0_RST HSOTG_RST TRNG_RST SC0_RST SC1_RST SC2_RST QSPI1_RST SPI3_RST USCI0_RST USCI1_RST DAC_RST EPWM0_RST EPWM1_RST BPWM0_RST BPWM1_RST QEI0_RST QEI1_RST ECAP0_RST ECAP1_RST CAN2_RST OPA_RST EADC1_RST

Returns
  None

This function reset selected module.

Definition at line 184 of file sys.c.

## ◆ SYS_SetPowerLevel()

void SYS_SetPowerLevel | ( | uint32_t | u32PowerLevel | ) |

Set Power Level.

Parameters

  [in] | u32PowerLevel | is power level setting. Including : SYS_PLCTL_PLSEL_PL0 SYS_PLCTL_PLSEL_PL1

Returns
  None

This function select power level. The register write-protection function should be disabled before using this function.

Definition at line 249 of file sys.c.

## ◆ SYS_SetVRef()

void SYS_SetVRef | ( | uint32_t | u32VRefCTL | ) |

Set Reference Voltage.

Parameters

  [in] | u32VRefCTL | is reference voltage setting. Including : SYS_VREFCTL_VREF_PIN SYS_VREFCTL_VREF_1_6V SYS_VREFCTL_VREF_2_0V SYS_VREFCTL_VREF_2_5V SYS_VREFCTL_VREF_3_0V SYS_VREFCTL_VREF_AVDD

Returns
  None

This function select reference voltage. The register write-protection function should be disabled before using this function.

Definition at line 268 of file sys.c.

## ◆ SYS_UnlockReg()

__STATIC_INLINE 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 1586 of file sys.h.