G32R430 Device Driver Layer v1.0.4
G32R4xx Device Driver Layer API Reference
g32r4xx_ddl_bkp.h
Go to the documentation of this file.
1
42
43/* Define to prevent recursive inclusion -------------------------------------*/
44#ifndef G32R4xx_DDL_BKP_H
45#define G32R4xx_DDL_BKP_H
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51/* Includes ------------------------------------------------------------------*/
52#include "g32r4xx.h"
53
57
58#if defined(BKP)
59
63
64/* Private types -------------------------------------------------------------*/
65/* Private variables ---------------------------------------------------------*/
66/* Exported types ------------------------------------------------------------*/
67/* Exported constants --------------------------------------------------------*/
68/* Exported macro ------------------------------------------------------------*/
72
73#define DDL_BKP_DR0 (0x00000000UL)
74#define DDL_BKP_DR1 (0x00000001UL)
75#define DDL_BKP_DR2 (0x00000002UL)
76#define DDL_BKP_DR3 (0x00000003UL)
77#define DDL_BKP_DR4 (0x00000004UL)
78#define DDL_BKP_DR5 (0x00000005UL)
79#define DDL_BKP_DR6 (0x00000006UL)
80#define DDL_BKP_DR7 (0x00000007UL)
81#define DDL_BKP_DR8 (0x00000008UL)
82#define DDL_BKP_DR9 (0x00000009UL)
83#define DDL_BKP_DR10 (0x0000000AUL)
84#define DDL_BKP_DR11 (0x0000000BUL)
85#define DDL_BKP_DR12 (0x0000000CUL)
86#define DDL_BKP_DR13 (0x0000000DUL)
87#define DDL_BKP_DR14 (0x0000000EUL)
88#define DDL_BKP_DR15 (0x0000000FUL)
89
90#define DDL_BKP_LocateDataReg(__BASEADDR__, __REG__) ((__BASEADDR__) + (__REG__ << 2))
91
95
102#define DDL_BKP_WriteReg(__REG__, __VALUE__) WRITE_REG(BKP->__REG__, (__VALUE__))
103
109#define DDL_BKP_ReadReg(__REG__) READ_REG(BKP->__REG__)
110
114
118
119/* Exported functions --------------------------------------------------------*/
123
127
132__STATIC_INLINE void DDL_BKP_EnableReset(void)
133{
134 SET_BIT(PMU->CR, PMU_CR_BDRST);
135}
136
141__STATIC_INLINE void DDL_BKP_DisableReset(void)
142{
143 CLEAR_BIT(PMU->CR, PMU_CR_BDRST);
144}
145
168__STATIC_INLINE void DDL_BKP_SetDataBackUp(uint32_t Reg, uint32_t Data)
169{
170 volatile uint32_t *reg = (volatile uint32_t*)DDL_BKP_LocateDataReg((uint32_t)(&BKP->DR0), Reg);
171 MODIFY_REG((*reg), BKP_DR0_DATA, (Data & BKP_DR0_DATA));
172}
173
195__STATIC_INLINE uint32_t DDL_BKP_GetDataBackUp(uint32_t Reg)
196{
197 volatile uint32_t *reg = (volatile uint32_t*)DDL_BKP_LocateDataReg((uint32_t)(&BKP->DR0), Reg);
198 return (uint32_t)(READ_BIT((*reg), BKP_DR0_DATA));
199}
200
204
208
212
213#endif /* defined(BKP) */
214
218
219#ifdef __cplusplus
220}
221#endif
222
223#endif /* G32R4xx_DDL_BKP_H */
224
__STATIC_INLINE uint32_t DDL_BKP_GetDataBackUp(uint32_t Reg)
Read backup data from designative register.
__STATIC_INLINE void DDL_BKP_SetDataBackUp(uint32_t Reg, uint32_t Data)
Write backup data to designative register.
__STATIC_INLINE void DDL_BKP_EnableReset(void)
Enable reset the BKP register.
__STATIC_INLINE void DDL_BKP_DisableReset(void)
Disable reset the BKP register.
#define DDL_BKP_LocateDataReg(__BASEADDR__, __REG__)