bool Usb0IspModeEnable(void)
{
// This info is from a LPC55S6x_LPC55S2x_LPC552x Protected Flash Region v1.3.ods
// which is an attachment to the UM11126 LPC55S6x/LPC55S2x/LPC552x User Manual
// The register is configured to enable the USB FS ISP interface.
#define FLASH_CMPA_BOOT_CFG_USB_ISP_MODE_MASK (((1U << 9) | (1U << 10)))
#define FLASH_CMPA_BOOT_CFG_USB_ISP_MODE_SHIFT (9U)
#define FLASH_CMPA_BOOT_CFG_USB0_FS_ISP_MODE (1U)
#define FLASH_CMPA_BOOT_CFG_USB1_HS_ISP_MODE (2U)
static cmpa_cfg_info_t cmpa = {0};
const uint32_t size = sizeof(cmpa);
uint32_t status = FFR_GetCustomerData(&flashConfig, (uint8_t *)&cmpa, 0x0, size);
if (status != kStatus_FLASH_Success) {
return false;
}
cmpa.bootCfg &= (~FLASH_CMPA_BOOT_CFG_USB_ISP_MODE_MASK); // clear bits
cmpa.bootCfg |=
((FLASH_CMPA_BOOT_CFG_USB0_FS_ISP_MODE << FLASH_CMPA_BOOT_CFG_USB_ISP_MODE_SHIFT)
& FLASH_CMPA_BOOT_CFG_USB_ISP_MODE_MASK);
status = FFR_CustFactoryPageWrite(&flashConfig, (uint8_t *)&cmpa, 0);
if (status != kStatus_FLASH_Success) {
return false;
}
return true;
}