![]() |
PDL for FM0+
Version1.0
Peripheral Driverl Library for FM0+
|
Data Structures | |
struct | stc_ret_cause |
Deep standby mode return cause. More... | |
Defines | |
#define | CM0P_CORE_CSR *((volatile unsigned int*)(0xE000ED10UL)) |
#define | LPCM_BACKUP_REG_BASE ((volatile uint8_t*)0x40035900) |
#define | WIFSR_WRTCI (1ul<<0) |
#define | WIFSR_WLVDI (1ul<<1) |
#define | WIFSR_WUI0 (1ul<<2) |
#define | WIFSR_WUI1 (1ul<<3) |
#define | WIFSR_WUI2 (1ul<<4) |
#define | WIFSR_WUI3 (1ul<<5) |
#define | WIFSR_WUI4 (1ul<<6) |
#define | WIFSR_WUI5 (1ul<<7) |
#define | WIFSR_WCEC0I (1ul<<8) |
#define | WIFSR_WCEC1I (1ul<<9) |
#define | WRFSR_WINITX (1ul<<0) |
#define | WRFSR_WLVDH (1ul<<1) |
Typedefs | |
typedef enum en_lpm_mode | en_lpm_mode_t |
define standby mode type | |
typedef struct stc_ret_cause | stc_dstb_ret_cause_t |
Deep standby mode return cause. | |
typedef enum en_ret_cause_flag | en_dstb_ret_cause_t |
define deep standby mode return cause flag | |
typedef enum en_dstb_wkup_pin | en_dstb_wkup_pin_t |
define wkup pin index | |
typedef enum en_wkup_valid_level | en_wkup_valid_level_t |
Valid level of wakeup pin. | |
typedef enum en_dstb_bakup_reg | en_dstb_bakup_reg_t |
backup register index | |
Enumerations | |
enum | en_lpm_mode { StbSleepMode = 0u, StbTimerMode = 1u, StbStopMode = 2u, StbRtcMode = 3u, DeepStbRtcMode = 4u, DeepStbStopMode = 5u } |
define standby mode type More... | |
enum | en_ret_cause_flag { DeepStbNoFlag = 0u, DeepStbInitx = 1u, DeepStbLvdReset = 2u, DeepStbRtcInt = 3u, DeepStbLvdInt = 4u, DeepStbWkupPin0 = 5u, DeepStbWkupPin1 = 6u, DeepStbWkupPin2 = 7u, DeepStbWkupPin3 = 8u, DeepStbWkupPin4 = 9u, DeepStbWkupPin5 = 10u, DeepStbCec0 = 11u, DeepStbCec1 = 12u } |
define deep standby mode return cause flag More... | |
enum | en_dstb_wkup_pin { WkupPin1 = 0u, WkupPin2 = 1u, WkupPin3 = 2u, WkupPin4 = 3u, WkupPin5 = 4u } |
define wkup pin index More... | |
enum | en_wkup_valid_level { WkupLowLevelValid = 0u, WkupHighLevelValid = 1u } |
Valid level of wakeup pin. More... | |
enum | en_dstb_bakup_reg { BackupReg1 = 1u, BackupReg2 = 2u, BackupReg3 = 3u, BackupReg4 = 4u, BackupReg5 = 5u, BackupReg6 = 6u, BackupReg7 = 7u, BackupReg8 = 8u, BackupReg9 = 9u, BackupReg10 = 10u, BackupReg11 = 11u, BackupReg12 = 12u, BackupReg13 = 13u, BackupReg14 = 14u, BackupReg15 = 15u, BackupReg16 = 16u } |
backup register index More... | |
Functions | |
static uint16_t | WRFSRDummyRead (void) |
WRFSR dummy read. | |
static uint16_t | WIFSRDummyRead (void) |
WRFSR dummy read. | |
void | Lpm_GoToStandByMode (en_lpm_mode_t enMode, boolean_t bIoRemain) |
go to standby mode | |
en_result_t | Lpm_ConfigDeepStbRetCause (stc_dstb_ret_cause_t *pstcCause) |
Configure return cause from deep standby mode. | |
en_dstb_ret_cause_t | Lpm_ReadDeepStbRetCause (void) |
Read deep standby mode return cause flag. | |
en_result_t | Lpm_SetWkupPinLevel (en_dstb_wkup_pin_t enPinIndex, en_wkup_valid_level_t enLevel) |
Set the valid level of wkup pin. | |
en_result_t | Lpm_WriteBackupReg (en_dstb_bakup_reg_t enRegIndex, uint8_t u8Data) |
Write the backup register. | |
uint8_t | Lpm_ReadBackupReg (en_dstb_bakup_reg_t enRegIndex) |
Read the backup register. | |
en_result_t | Lpm_ConfigSubClk (boolean_t bSupplyCec, boolean_t bSupplyRtc) |
Configue the sub clock supply. | |
en_result_t | Lpm_ConfigDeepStbRAMRetention (boolean_t bRamRetain) |
Configure deep standby mode RAM retention. |
Provided functions of LPM module:
Lpm_GoToStandByMode() enters the low power consumption selected by the parameter Lpm_GoToStandByMode::enMode. Since MCU enters into low power consumption mode after calling this funciton, this function will not return until MCU is waken up. There are also different between waken up from Standby mode and deep standby mode. When MCU is waken up from standby mode, the program of MCU will run after this function, but when MCU is waken up from deep standby mode, the program of MCU will run from the reset vector.
Lpm_ConfigDeepStbRetCause() configures the return causes of deep standby mode and Lpm_ReadDeepStbRetCause() reads the return causes after MCU is waken up. Note that Wakeup from WKUP0 pin is always enabled.
Lpm_SetWkupPinLevel() is used to set the WKUP pin active level.
Lpm_ConfigSubClk() configures whether to supply Sub clock to RTC and CEC in deep standby mode. Not all FM0P+ product has this function. Please confirm it in the hardware manual.
Lpm_ConfigDeepStbRAMRetention() configures whether to retain RAM content after entering deep standby mode. Not all FM0P+ product has this function. Plesae comfirm it in the hardware manual.
Lpm_WriteBackupReg() writes the backup registers, which can retain in the deep standby mode. and Lpm_ReadBackupReg() reads the backup regisers after waken up from deep standby mode. Up to 16 byte backup registers can be used.
#define CM0P_CORE_CSR *((volatile unsigned int*)(0xE000ED10UL)) |
Definition at line 90 of file lpm.c.
Referenced by Lpm_GoToStandByMode().
#define LPCM_BACKUP_REG_BASE ((volatile uint8_t*)0x40035900) |
Definition at line 93 of file lpm.c.
Referenced by Lpm_ReadBackupReg(), and Lpm_WriteBackupReg().
#define WIFSR_WCEC0I (1ul<<8) |
Definition at line 127 of file lpm.h.
Referenced by Lpm_ReadDeepStbRetCause().
#define WIFSR_WCEC1I (1ul<<9) |
Definition at line 128 of file lpm.h.
Referenced by Lpm_ReadDeepStbRetCause().
#define WIFSR_WLVDI (1ul<<1) |
Definition at line 120 of file lpm.h.
Referenced by Lpm_ReadDeepStbRetCause().
#define WIFSR_WRTCI (1ul<<0) |
Definition at line 119 of file lpm.h.
Referenced by Lpm_ReadDeepStbRetCause().
#define WIFSR_WUI0 (1ul<<2) |
Definition at line 121 of file lpm.h.
Referenced by Lpm_ReadDeepStbRetCause().
#define WIFSR_WUI1 (1ul<<3) |
Definition at line 122 of file lpm.h.
Referenced by Lpm_ReadDeepStbRetCause().
#define WIFSR_WUI2 (1ul<<4) |
Definition at line 123 of file lpm.h.
Referenced by Lpm_ReadDeepStbRetCause().
#define WIFSR_WUI3 (1ul<<5) |
Definition at line 124 of file lpm.h.
Referenced by Lpm_ReadDeepStbRetCause().
#define WIFSR_WUI4 (1ul<<6) |
Definition at line 125 of file lpm.h.
Referenced by Lpm_ReadDeepStbRetCause().
#define WIFSR_WUI5 (1ul<<7) |
Definition at line 126 of file lpm.h.
Referenced by Lpm_ReadDeepStbRetCause().
#define WRFSR_WINITX (1ul<<0) |
Definition at line 130 of file lpm.h.
Referenced by Lpm_ReadDeepStbRetCause().
#define WRFSR_WLVDH (1ul<<1) |
typedef enum en_dstb_bakup_reg en_dstb_bakup_reg_t |
backup register index
typedef enum en_ret_cause_flag en_dstb_ret_cause_t |
define deep standby mode return cause flag
typedef enum en_dstb_wkup_pin en_dstb_wkup_pin_t |
define wkup pin index
typedef enum en_lpm_mode en_lpm_mode_t |
define standby mode type
typedef enum en_wkup_valid_level en_wkup_valid_level_t |
Valid level of wakeup pin.
typedef struct stc_ret_cause stc_dstb_ret_cause_t |
Deep standby mode return cause.
enum en_dstb_bakup_reg |
backup register index
enum en_dstb_wkup_pin |
enum en_lpm_mode |
enum en_ret_cause_flag |
define deep standby mode return cause flag
enum en_wkup_valid_level |
en_result_t Lpm_ConfigDeepStbRAMRetention | ( | boolean_t | bRamRetain | ) |
en_result_t Lpm_ConfigDeepStbRetCause | ( | stc_dstb_ret_cause_t * | pstcCause | ) |
Configure return cause from deep standby mode.
pstcCause | Pointer to structure of return cause types |
Ok | Deep standby mode is configured normally |
Definition at line 246 of file lpm.c.
References stc_ret_cause::bCec0En, stc_ret_cause::bCec1En, stc_ret_cause::bLvdEn, stc_ret_cause::bRtcEn, stc_ret_cause::bWakeup1En, stc_ret_cause::bWakeup2En, stc_ret_cause::bWakeup3En, stc_ret_cause::bWakeup4En, stc_ret_cause::bWakeup5En, and Ok.
en_result_t Lpm_ConfigSubClk | ( | boolean_t | bSupplyCec, |
boolean_t | bSupplyRtc | ||
) |
Configue the sub clock supply.
bSupplyCec | Whether to supply sub clock to CEC |
bSupplyRtc | Whether to supply sub clock to RTC |
Ok | The sub clock supply is configured normally |
void Lpm_GoToStandByMode | ( | en_lpm_mode_t | enMode, |
boolean_t | bIoRemain | ||
) |
go to standby mode
enMode | the type of standby mode. This parameter can be one of the following values:
|
bIoRemain | Set io status when enter standby mode. This parameter can be one of the following values:
|
Definition at line 155 of file lpm.c.
References CM0P_CORE_CSR, DeepStbRtcMode, DeepStbStopMode, StbRtcMode, StbSleepMode, StbStopMode, StbTimerMode, WIFSRDummyRead(), and WRFSRDummyRead().
uint8_t Lpm_ReadBackupReg | ( | en_dstb_bakup_reg_t | enRegIndex | ) |
Read the backup register.
enRegIndex | Backup register index
|
Definition at line 507 of file lpm.c.
References LPCM_BACKUP_REG_BASE.
Read deep standby mode return cause flag.
DeepStbNoFlag | No flag set |
DeepStbInitx | Wakeup from deep standby mode by INITX reset |
DeepStbLvdReset | Wakeup from deep standby mode by LVD reset |
DeepStbRtcInt | Wakeup from deep standby mode by RTC interrupt |
DeepStbLvdInt | Wakeup from deep standby mode by LVD interrupt |
DeepStbWkupPin0 | Wakeup from deep standby mode by WKUP0 |
DeepStbWkupPin1 | Wakeup from deep standby mode by WKUP1 |
DeepStbWkupPin2 | Wakeup from deep standby mode by WKUP2 |
DeepStbWkupPin3 | Wakeup from deep standby mode by WKUP3 |
DeepStbWkupPin4 | Wakeup from deep standby mode by WKUP4 |
DeepStbWkupPin5 | Wakeup from deep standby mode by WKUP5 |
DeepStbCec0 | Wakeup from deep standby mode by CEC0 interrupt |
DeepStbCec1 | Wakeup from deep standby mode by CEC1 interrupt |
Definition at line 351 of file lpm.c.
References DeepStbCec0, DeepStbCec1, DeepStbInitx, DeepStbLvdInt, DeepStbLvdReset, DeepStbNoFlag, DeepStbRtcInt, DeepStbWkupPin0, DeepStbWkupPin1, DeepStbWkupPin2, DeepStbWkupPin3, DeepStbWkupPin4, DeepStbWkupPin5, WIFSR_WCEC0I, WIFSR_WCEC1I, WIFSR_WLVDI, WIFSR_WRTCI, WIFSR_WUI0, WIFSR_WUI1, WIFSR_WUI2, WIFSR_WUI3, WIFSR_WUI4, WIFSR_WUI5, and WRFSR_WINITX.
en_result_t Lpm_SetWkupPinLevel | ( | en_dstb_wkup_pin_t | enPinIndex, |
en_wkup_valid_level_t | enLevel | ||
) |
Set the valid level of wkup pin.
enPinIndex | Pin index
|
enLevel | Wakeup pin valid value
|
Ok | The valid level of wkup pin is set normally |
ErrorInvalidParameter | Invalid value of enPinIndex |
Definition at line 429 of file lpm.c.
References ErrorInvalidParameter, Ok, and WkupPin5.
en_result_t Lpm_WriteBackupReg | ( | en_dstb_bakup_reg_t | enRegIndex, |
uint8_t | u8Data | ||
) |
Write the backup register.
enRegIndex | register index
|
u8Data | the data written into backup register |
Ok | The backup register written normally |
ErrorInvalidParameter | enRegIndex > BackupReg15 |
Definition at line 470 of file lpm.c.
References BackupReg15, ErrorInvalidParameter, LPCM_BACKUP_REG_BASE, and Ok.
static uint16_t WIFSRDummyRead | ( | void | ) | [static] |
WRFSR dummy read.
Definition at line 128 of file lpm.c.
Referenced by Lpm_GoToStandByMode().
static uint16_t WRFSRDummyRead | ( | void | ) | [static] |
WRFSR dummy read.
Definition at line 116 of file lpm.c.
Referenced by Lpm_GoToStandByMode().