在线时间4 小时
UID3017366
注册时间2016-6-22
NXP金币0
该用户从未签到
新手上路

- 积分
- 32
- 最后登录
- 2016-7-5
|
看到这段代码,不知道是作何用处的呀?芯片手册里面有介绍吗?
/* ----------------------------------------------------------------------------
-- NV Peripheral Access Layer
---------------------------------------------------------------------------- */
/*!
* @addtogroup NV_Peripheral_Access_Layer NV Peripheral Access Layer
* @{
*/
/** NV - Register Layout Typedef */
typedef struct {
__I uint8_t BACKKEY0; /**< Backdoor Comparison Key 0, offset: 0x0 */
__I uint8_t BACKKEY1; /**< Backdoor Comparison Key 1, offset: 0x1 */
__I uint8_t BACKKEY2; /**< Backdoor Comparison Key 2, offset: 0x2 */
__I uint8_t BACKKEY3; /**< Backdoor Comparison Key 3, offset: 0x3 */
__I uint8_t BACKKEY4; /**< Backdoor Comparison Key 4, offset: 0x4 */
__I uint8_t BACKKEY5; /**< Backdoor Comparison Key 5, offset: 0x5 */
__I uint8_t BACKKEY6; /**< Backdoor Comparison Key 6, offset: 0x6 */
__I uint8_t BACKKEY7; /**< Backdoor Comparison Key 7, offset: 0x7 */
uint8_t RESERVED_0[4];
__I uint8_t EEPROT; /**< Non-volatile E-Flash Protection Register, offset: 0xC */
__I uint8_t FPROT; /**< Non-volatile P-Flash Protection Register, offset: 0xD */
__I uint8_t FSEC; /**< Non-volatile Flash Security Register, offset: 0xE */
__I uint8_t FOPT; /**< Non-volatile Flash Option Register, offset: 0xF */
} NV_Type;
/* ----------------------------------------------------------------------------
-- NV Register Masks
---------------------------------------------------------------------------- */
/*!
* @addtogroup NV_Register_Masks NV Register Masks
* @{
*/
/* BACKKEY0 Bit Fields */
#define NV_BACKKEY0_KEY_MASK 0xFFu
#define NV_BACKKEY0_KEY_SHIFT 0
#define NV_BACKKEY0_KEY(x) (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY0_KEY_SHIFT))&NV_BACKKEY0_KEY_MASK)
/* BACKKEY1 Bit Fields */
#define NV_BACKKEY1_KEY_MASK 0xFFu
#define NV_BACKKEY1_KEY_SHIFT 0
#define NV_BACKKEY1_KEY(x) (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY1_KEY_SHIFT))&NV_BACKKEY1_KEY_MASK)
/* BACKKEY2 Bit Fields */
#define NV_BACKKEY2_KEY_MASK 0xFFu
#define NV_BACKKEY2_KEY_SHIFT 0
#define NV_BACKKEY2_KEY(x) (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY2_KEY_SHIFT))&NV_BACKKEY2_KEY_MASK)
/* BACKKEY3 Bit Fields */
#define NV_BACKKEY3_KEY_MASK 0xFFu
#define NV_BACKKEY3_KEY_SHIFT 0
#define NV_BACKKEY3_KEY(x) (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY3_KEY_SHIFT))&NV_BACKKEY3_KEY_MASK)
/* BACKKEY4 Bit Fields */
#define NV_BACKKEY4_KEY_MASK 0xFFu
#define NV_BACKKEY4_KEY_SHIFT 0
#define NV_BACKKEY4_KEY(x) (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY4_KEY_SHIFT))&NV_BACKKEY4_KEY_MASK)
/* BACKKEY5 Bit Fields */
#define NV_BACKKEY5_KEY_MASK 0xFFu
#define NV_BACKKEY5_KEY_SHIFT 0
#define NV_BACKKEY5_KEY(x) (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY5_KEY_SHIFT))&NV_BACKKEY5_KEY_MASK)
/* BACKKEY6 Bit Fields */
#define NV_BACKKEY6_KEY_MASK 0xFFu
#define NV_BACKKEY6_KEY_SHIFT 0
#define NV_BACKKEY6_KEY(x) (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY6_KEY_SHIFT))&NV_BACKKEY6_KEY_MASK)
/* BACKKEY7 Bit Fields */
#define NV_BACKKEY7_KEY_MASK 0xFFu
#define NV_BACKKEY7_KEY_SHIFT 0
#define NV_BACKKEY7_KEY(x) (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY7_KEY_SHIFT))&NV_BACKKEY7_KEY_MASK)
/* EEPROT Bit Fields */
#define NV_EEPROT_DPS_MASK 0x7u
#define NV_EEPROT_DPS_SHIFT 0
#define NV_EEPROT_DPS(x) (((uint8_t)(((uint8_t)(x))<<NV_EEPROT_DPS_SHIFT))&NV_EEPROT_DPS_MASK)
#define NV_EEPROT_DPOPEN_MASK 0x80u
#define NV_EEPROT_DPOPEN_SHIFT 7
/* FPROT Bit Fields */
#define NV_FPROT_FPLS_MASK 0x3u
#define NV_FPROT_FPLS_SHIFT 0
#define NV_FPROT_FPLS(x) (((uint8_t)(((uint8_t)(x))<<NV_FPROT_FPLS_SHIFT))&NV_FPROT_FPLS_MASK)
#define NV_FPROT_FPLDIS_MASK 0x4u
#define NV_FPROT_FPLDIS_SHIFT 2
#define NV_FPROT_FPHS_MASK 0x18u
#define NV_FPROT_FPHS_SHIFT 3
#define NV_FPROT_FPHS(x) (((uint8_t)(((uint8_t)(x))<<NV_FPROT_FPHS_SHIFT))&NV_FPROT_FPHS_MASK)
#define NV_FPROT_FPHDIS_MASK 0x20u
#define NV_FPROT_FPHDIS_SHIFT 5
#define NV_FPROT_FPOPEN_MASK 0x80u
#define NV_FPROT_FPOPEN_SHIFT 7
/* FSEC Bit Fields */
#define NV_FSEC_SEC_MASK 0x3u
#define NV_FSEC_SEC_SHIFT 0
#define NV_FSEC_SEC(x) (((uint8_t)(((uint8_t)(x))<<NV_FSEC_SEC_SHIFT))&NV_FSEC_SEC_MASK)
#define NV_FSEC_KEYEN_MASK 0xC0u
#define NV_FSEC_KEYEN_SHIFT 6
#define NV_FSEC_KEYEN(x) (((uint8_t)(((uint8_t)(x))<<NV_FSEC_KEYEN_SHIFT))&NV_FSEC_KEYEN_MASK)
/*!
* @}
*/ /* end of group NV_Register_Masks */
/* NV - Peripheral instance base addresses */
/** Peripheral FTMRH_FlashConfig base address */
#define FTMRH_FlashConfig_BASE (0x400u)
/** Peripheral FTMRH_FlashConfig base pointer */
#define FTMRH_FlashConfig ((NV_Type *)FTMRH_FlashConfig_BASE)
/** Array initializer of NV peripheral base pointers */
#define NV_BASES { FTMRH_FlashConfig }
最佳答案
楼主你好!
这段讲的就是KE系列的flash configuration field.
具体在reference manual的第225页。
也就是在flash从0X400开始,放置了些关于该芯片的秘钥,flash保护,EEPROM保护,芯片secure等功能的配置字节。
具体 ...
|
|