libero ProASIC3 A3P250 JTAG-DirectC 源码分析一 dp_erase
1、JTAG C代码 实现 JTAG-DirectC v2022.1 User Guide , 源码下载 DirectC | Microchip Technology
void dp_erase(void) {#ifdef ENABLE_DISPLAYdp_display_text("\r\nErasing. Please wait..."); #endif#ifdef CORE_SUPPORTif (dat_support_status & CORE_DAT_SUPPORT_BIT){#ifdef CORE_PLAINif ((dat_support_status & CORE_DAT_ENCRYPTION_BIT) == 0u){dp_disable_rlock();}#endif#ifdef CORE_ENCRYPTif (dat_support_status & CORE_DAT_ENCRYPTION_BIT){dp_enc_disable_rlock();}#endif}#endifdp_flush_global_buf1();global_buf1[0] = UROW_ERASE_BITS_BYTE0;global_buf1[1] = UROW_ERASE_BITS_BYTE1;global_buf1[2] = UROW_ERASE_BITS_BYTE2;#ifdef CORE_SUPPORTif (dat_support_status & CORE_DAT_SUPPORT_BIT){global_buf1[0] |= CORE_ERASE_BITS_BYTE0;global_buf1[1] |= CORE_ERASE_BITS_BYTE1;global_buf1[2] |= CORE_ERASE_BITS_BYTE2;}#endif/* This is for FROM erase. Need to get which bits are set to erase from the data file. */#ifdef FROM_SUPPORTif (dat_support_status & FROM_DAT_SUPPORT_BIT){global_uchar1 = (DPUCHAR) dp_get_bytes(FRomAddressMask_ID,0U,1U);if (global_uchar1 & 0x1U){global_buf1[1]|=0x80U;}global_buf1[2] |= (DPUCHAR)(global_uchar1 >> 1U);}#endif#ifdef SECURITY_SUPPORT/* This is for security erase */if (dat_support_status & SEC_DAT_SUPPORT_BIT){global_buf1[0] |= 0xeU;}#endifif (error_code == DPE_SUCCESS){dp_exe_erase();}return; }
分析:
JTAG 16种 状态图:
