From 4d3a246fbc3bd71d6e8fd26d6f9ce7c38f4e0aec Mon Sep 17 00:00:00 2001 From: hadeshyp Date: Mon, 10 Oct 2011 11:52:19 +0000 Subject: [PATCH] now supports TRB3 --- libtrbnet/trbflash.c | 525 ++++++++++++++++++++++++++----------------- 1 file changed, 323 insertions(+), 202 deletions(-) diff --git a/libtrbnet/trbflash.c b/libtrbnet/trbflash.c index 53d9151..b99e4db 100644 --- a/libtrbnet/trbflash.c +++ b/libtrbnet/trbflash.c @@ -76,10 +76,16 @@ typedef enum FLASH_CTS_FPGA1 = 11, FLASH_CTS_FPGA2 = 12, - FLASH_PEXOR = 13 + + FLASH_TRB3_CENTRAL = 13, + FLASH_TRB3_PERIPH = 14, + FLASH_TRB3_FPGA_1 = 15, + FLASH_TRB3_FPGA_2 = 16, + FLASH_TRB3_FPGA_3 = 17, + FLASH_TRB3_FPGA_4 = 18 } FlashType; -static const char FlashTypeStr[16][32] = { +static const char FlashTypeStr[][32] = { "INVALID", "RICH_ADCM_V1", "RICH_ADCM_V2", @@ -93,12 +99,26 @@ static const char FlashTypeStr[16][32] = { "SHOWER_ADDON_V2_FPGA3", "CTS_FPGA1", "CTS_FPGA2", - "PEXOR" + "TRB3 CENTRAL FPGA", + "TRB3 PERIPHERAL FPGA", + "TRB3 FPGA 1", + "TRB3 FPGA 2", + "TRB3 FPGA 3", + "TRB3 FPGA 4" }; -static FlashType flashType = FLASH_INVALID; -static uint32_t manId = 0; -static const char trbflash_version[] = "$Revision: 2.31 $"; +typedef struct { + FlashType flashType; + uint32_t manId; + FlashType compatibleType[16]; + uint32_t compatibleManId[16]; + char allowedStringId[16][64]; + uint32_t numPages; + int sectorProtect; /* single = 1, all = 1 */ +} FlashParam; + +static FlashParam flashParamRef; +static const char trbflash_version[] = "$Revision: 2.32 $"; static uint32_t mdcFlashSelect = 1; @@ -108,6 +128,7 @@ static int skipFirmwareIdCheck = 0; static int skipVerify = 0; + /* ------ Local Functions ----------------------------------------------- */ static void atexit0() @@ -129,6 +150,187 @@ static void atexit0() free(imageBuffer); } +static int setFlashParam(FlashParam* flashParam, uint16_t hardwareId) +{ + unsigned int i; + + if (flashParam == NULL) return -1; + + flashParam->flashType = FLASH_INVALID; + flashParam->manId = 0x00; + flashParam->numPages = 0; + flashParam->sectorProtect = 0; + for (i = 0; i < 16; i++) { + flashParam->compatibleType[i] = FLASH_INVALID; + flashParam->compatibleManId[i] = 0x00; + flashParam->allowedStringId[i][0] = '\0'; + } + + switch (hardwareId) { + /* RICH */ + case 0x3100: + flashParam->flashType = FLASH_RICH_ADCM_V1; + flashParam->manId = 0x00461f; + strcpy(flashParam->allowedStringId[0], "adcmv1"); + flashParam->numPages = 8192; + flashParam->sectorProtect = 1; + break; + + case 0x3200: + flashParam->flashType = FLASH_RICH_ADCM_V2; + flashParam->manId = 0x00471f; + strcpy(flashParam->allowedStringId[0], "adcmv2"); + flashParam->numPages = 16384; + flashParam->sectorProtect = 1; + break; + + case 0x3300: + case 0x0002: + flashParam->flashType = FLASH_RICH_ADCM_V3; + flashParam->manId = 0x00471f; + strcpy(flashParam->allowedStringId[0], "adcmv3"); + flashParam->numPages = 16384; + flashParam->sectorProtect = 1; + break; + + /* MDC HUB */ + case 0x1210: + flashParam->flashType = FLASH_MDC_HUB_V2_FPGA1234; + flashParam->manId = 0x1520c2; + strcpy(flashParam->allowedStringId[0], "mdchub_fpga1234"); + flashParam->numPages = 8192; + flashParam->sectorProtect = 1; + break; + + case 0x1250: + flashParam->flashType = FLASH_MDC_HUB_V2_FPGA5; + flashParam->manId = 0x1520c2; + strcpy(flashParam->allowedStringId[0], "mdchub_fpga5"); + flashParam->numPages = 8192; + flashParam->sectorProtect = 1; + break; + + /* MDC OEP */ + case 0x2200: + flashParam->flashType = FLASH_MDC_OEP_V2; + flashParam->manId = 0x1520c2; + strcpy(flashParam->allowedStringId[0], "mdc_oepb"); + flashParam->numPages = 8192; + flashParam->sectorProtect = 1; + break; + + case 0x2300: + case 0x1234: + flashParam->flashType = FLASH_MDC_OEP_V3; + flashParam->manId = 0x1520c2; + strcpy(flashParam->allowedStringId[0], "mdc_oepb"); + flashParam->numPages = 8192; + flashParam->sectorProtect = 1; + break; + + /* SHOWER */ + case 0x4210: + flashParam->flashType = FLASH_SHOWER_ADDON_V2_FPGA1; + flashParam->manId = 0x1520c2; + strcpy(flashParam->allowedStringId[0], "shower_fpga1"); + flashParam->numPages = 8192; + flashParam->sectorProtect = 1; + break; + + case 0x4220: + flashParam->flashType = FLASH_SHOWER_ADDON_V2_FPGA2; + flashParam->manId = 0x1520c2; + strcpy(flashParam->allowedStringId[0], "shower_fpga2"); + flashParam->numPages = 8192; + flashParam->sectorProtect = 1; + break; + + case 0x4230: + flashParam->flashType = FLASH_SHOWER_ADDON_V2_FPGA3; + flashParam->manId = 0x1520c2; + strcpy(flashParam->allowedStringId[0], "adcmv3"); + flashParam->numPages = 8192; + flashParam->sectorProtect = 1; + break; + + /* TRB3 */ + case 0x9000: + flashParam->flashType = FLASH_TRB3_CENTRAL; + flashParam->manId = 0x1570c2; + strcpy(flashParam->allowedStringId[0], "trb3_central"); + strcpy(flashParam->allowedStringId[1], "trb3_fpga5"); + flashParam->numPages = 16384; + flashParam->sectorProtect = 1; + break; + + case 0x9100: + flashParam->flashType = FLASH_TRB3_PERIPH; + flashParam->manId = 0x1720c2; + strcpy(flashParam->allowedStringId[0], "trb3_periph"); + strcpy(flashParam->allowedStringId[1], "trb3_fpga1"); + strcpy(flashParam->allowedStringId[2], "trb3_fpga2"); + strcpy(flashParam->allowedStringId[3], "trb3_fpga3"); + strcpy(flashParam->allowedStringId[4], "trb3_fpga4"); + flashParam->numPages = 16384; + flashParam->sectorProtect = 1; + break; + + case 0x9110: + flashParam->flashType = FLASH_TRB3_FPGA_1; + flashParam->manId = 0x1720c2; + strcpy(flashParam->allowedStringId[0], "trb3_central"); + strcpy(flashParam->allowedStringId[1], "trb3_fpga1"); + strcpy(flashParam->allowedStringId[2], "trb3_fpga2"); + strcpy(flashParam->allowedStringId[3], "trb3_fpga3"); + strcpy(flashParam->allowedStringId[4], "trb3_fpga4"); + flashParam->numPages = 16384; + flashParam->sectorProtect = 1; + break; + + case 0x9120: + flashParam->flashType = FLASH_TRB3_FPGA_2; + flashParam->manId = 0x1720c2; + strcpy(flashParam->allowedStringId[0], "trb3_central"); + strcpy(flashParam->allowedStringId[1], "trb3_fpga1"); + strcpy(flashParam->allowedStringId[2], "trb3_fpga2"); + strcpy(flashParam->allowedStringId[3], "trb3_fpga3"); + strcpy(flashParam->allowedStringId[4], "trb3_fpga4"); + flashParam->numPages = 16384; + flashParam->sectorProtect = 1; + break; + + case 0x9130: + flashParam->flashType = FLASH_TRB3_FPGA_3; + flashParam->manId = 0x1720c2; + + strcpy(flashParam->allowedStringId[0], "trb3_central"); + strcpy(flashParam->allowedStringId[1], "trb3_fpga1"); + strcpy(flashParam->allowedStringId[2], "trb3_fpga2"); + strcpy(flashParam->allowedStringId[3], "trb3_fpga3"); + strcpy(flashParam->allowedStringId[4], "trb3_fpga4"); + flashParam->numPages = 16384; + flashParam->sectorProtect = 1; + break; + + case 0x9140: + flashParam->flashType = FLASH_TRB3_FPGA_4; + flashParam->manId = 0x1720c2; + strcpy(flashParam->allowedStringId[0], "trb3_central"); + strcpy(flashParam->allowedStringId[1], "trb3_fpga1"); + strcpy(flashParam->allowedStringId[2], "trb3_fpga2"); + strcpy(flashParam->allowedStringId[3], "trb3_fpga3"); + strcpy(flashParam->allowedStringId[4], "trb3_fpga4"); + flashParam->numPages = 16384; + flashParam->sectorProtect = 1; + break; + + default: + return -1; + } + + return 0; +} + static int writeSetupRegister(uint16_t trb_address, uint8_t value) { unsigned int ctr = 0; @@ -266,7 +468,8 @@ static int checkStatus(uint16_t trb_address) ret = 0; for (i = 0; i < status; i += 2) { - if ((manId == 0x01461f) || (manId == 0x00471f)) { + if ((flashParamRef.manId == 0x01461f) || + (flashParamRef.manId == 0x00471f)) { /* Check EPE Bit (ADCM and SHOWER) */ if (((trbBuffer[i + 1] >> 5) & 0x01) == 1) { fprintf(logFile, "Error > checkStatus: Erase or program error on " @@ -316,13 +519,14 @@ static int writeStatusRegister(uint16_t trb_address, uint8_t value) static int initTransfer(uint16_t trb_address) { - /* Find Endpoint(s) ManId and allocate needed memory */ + /* Find Endpoint(s) ManId(s) and allocate needed memory */ uint32_t trbcmd; int status; unsigned int counter = 0; int i; - /* Read HardwareIds from all Boards and validate (all must be the same) */ + /* Read HardwareIds from all Boards and validate + (all must be the same group ) */ if ((status = trb_register_read(trb_address, HardwareId, trbBuffer, TRB_BUFFER_SIZE)) == -1) { @@ -330,92 +534,54 @@ static int initTransfer(uint16_t trb_address) trb_strerror()); return -1; } - - flashType = FLASH_INVALID; + for (i = 0; i < status; i += 2) { - FlashType fType = FLASH_INVALID; - - uint16_t hardwareId = (uint16_t) ((trbBuffer[i + 1] >> 16) & 0xffff); - switch (hardwareId) { - - /* Rich */ - case 0x3100: - fType = FLASH_RICH_ADCM_V1; - break; - case 0x3200: - fType = FLASH_RICH_ADCM_V2; - break; - case 0x3300: - case 0x0002: - fType = FLASH_RICH_ADCM_V3; - break; - - /* MDC HUB */ - case 0x1210: - fType = FLASH_MDC_HUB_V2_FPGA1234; - break; - case 0x1250: - fType = FLASH_MDC_HUB_V2_FPGA5; - break; - - /* MDC OEP */ - case 0x2200: - fType = FLASH_MDC_OEP_V2; - break; - case 0x2300: - case 0x1234: - fType = FLASH_MDC_OEP_V3; - break; - - /* SHOWER */ - case 0x4210: - fType = FLASH_SHOWER_ADDON_V2_FPGA1; - break; - case 0x4220: - fType = FLASH_SHOWER_ADDON_V2_FPGA2; - break; - case 0x4230: - fType = FLASH_SHOWER_ADDON_V2_FPGA3; - break; - - /* CTS */ - case 0x5100: - fType = FLASH_CTS_FPGA1; - break; - case 0x5200: - fType = FLASH_CTS_FPGA2; - break; - - case 0x7300: - fType = FLASH_PEXOR; - break; - - default: - /* Error: Unknown FlashType */ + FlashParam flashParam; + uint16_t hardwareId = (trbBuffer[i + 1] >> 16) & 0xffff; + int match = 0; + unsigned int j = 0; + + if (i == 0) { + if (setFlashParam(&flashParamRef, hardwareId) == -1) { + fprintf(logFile, "Error > initTransfer: " + "Unsupported HardwareId 0x%04x on EndPoint 0x%04x\n", + hardwareId, trbBuffer[i] & 0xffff); + return -1; + } + continue; + } + + if (setFlashParam(&flashParam, hardwareId) == -1) { fprintf(logFile, "Error > initTransfer: " "Unsupported HardwareId 0x%04x on EndPoint 0x%04x\n", hardwareId, trbBuffer[i] & 0xffff); - return -1; - } - - if (flashType == FLASH_INVALID) { - flashType = fType; - continue; - } - if (fType != flashType) { + return -1; + } + + /* Check here for flash group compatibility */ + do { + if (( flashParam.flashType == flashParamRef.flashType) || + ( flashParam.flashType == flashParamRef.compatibleType[j])) { + match = 1; + break; + } + j++; + } while (flashParamRef.compatibleType[j] != FLASH_INVALID); + + if (match == 0) { fprintf(logFile, "Error > initTransfer: " - "HardwareId 0x%04x differs on EndPoint 0x%04x\n", + "Incompatible HardwareId: 0x%04x of EndPoint 0x%04x\n", hardwareId, trbBuffer[i] & 0xffff); return -1; } } - - /* Read ManIds from all Boards and validate (all must be the same as well) */ + + /* Read ManIds from all Boards and validate (all must be compatible) */ trbcmd = 0x9f << 24; if (sendCommand(trb_address, trbcmd, 2) == -1) { return -1; } - + if ((status = trb_register_read(trb_address, BlockRam, trbBuffer, TRB_BUFFER_SIZE)) == -1) { @@ -423,53 +589,35 @@ static int initTransfer(uint16_t trb_address) trb_strerror()); return -1; } - + if (status <= 0) { return -1; } - - manId = 0; + counter = 0; for (i = 0; i < status; i += 2, counter++) { - uint32_t tmpManId = (trbBuffer[i + 1] & 0x00ffffff); - - if (!((tmpManId == 0x01461f) || - (tmpManId == 0x00471f) || (tmpManId == 0x1520c2))) { - fprintf(logFile, "Error > initTransfer: " - "Unsupported ManId(s) 0x%04x on EndPoint 0x%04x\n", - tmpManId, trbBuffer[i] & 0xffff); - return -1; - } - if (manId == 0) { - manId = tmpManId; - continue; - } - if (tmpManId != manId) { - fprintf(logFile, "Error > initTransfer: ManId 0x%04x differs" + uint32_t manId = (trbBuffer[i + 1] & 0x00ffffff); + int match = 0; + unsigned int j = 0; + do { + if ((manId == flashParamRef.manId) || + (manId == flashParamRef.compatibleManId[j])) { + match = 1; + break; + } + j++; + } while (flashParamRef.compatibleManId[j] != 0x00); + + if (match == 0) { + fprintf(logFile, + "Error > initTransfer: ManId 0x%04x incompatible" "on EndPoint 0x%04x\n", manId, trbBuffer[i] & 0xffff); return -1; } } - fprintf(stderr, "manId is: 0x%x\n", manId); - /* Set NUM_PAGES */ - switch (manId) { - - case 0x01461f: - NUM_PAGES = 8192; - break; - - case 0x00471f: - NUM_PAGES = 16384; - break; - - case 0x1520c2: - NUM_PAGES = 8192; - break; - - default: - abort(); - } - + + + NUM_PAGES = flashParamRef.numPages; NUM_BLOCKS = (NUM_PAGES * PAGE_SIZE) / BLOCK_SIZE; /* Buffer holding the entire rom-image */ @@ -478,10 +626,10 @@ static int initTransfer(uint16_t trb_address) if (imageBuffer == NULL) { abort(); } - - fprintf(stderr, "Found %d Endpoint(s) of type %s\n", - counter, FlashTypeStr[flashType]); - + + fprintf(stderr, "Found %d Endpoint(s) of group %s\n", + counter, FlashTypeStr[flashParamRef.flashType]); + return 0; } @@ -628,7 +776,7 @@ static int programImageBuffer(uint16_t trb_address, if ((mode != PMODE_VERIFY) && (yesToAll == 0)) { /* Be nice and ask before start flashing the roms */ char c; - if ((flashType == FLASH_MDC_OEP_V2) || (flashType == FLASH_MDC_OEP_V3)) { + if ((flashParamRef.flashType == FLASH_MDC_OEP_V2) || (flashParamRef.flashType == FLASH_MDC_OEP_V3)) { if (mdcFlashSelect == 0) { fprintf(stdout, "You decided to reprogram the FlashRom(s) #0 of " @@ -638,7 +786,7 @@ static int programImageBuffer(uint16_t trb_address, } else { fprintf(stdout, "You decided to reprogram the FlashRom(s) of " - "%s, are you sure [N,y]: ", FlashTypeStr[flashType]); + "%s, are you sure [N,y]: ", FlashTypeStr[flashParamRef.flashType]); } fflush(stdout); @@ -670,7 +818,9 @@ static int programImageBuffer(uint16_t trb_address, errorCtr = 0; - if ((mode != PMODE_VERIFY) && (manId == 0x1520c2)) { + if ((mode != PMODE_VERIFY) && + ((flashParamRef.manId == 0x1520c2) || + (flashParamRef.manId == 0x1720c2))) { /* Unprotect all Sectors */ if (writeStatusRegister(trb_address, 0) == -1) { fprintf(stderr, "\nError > program: unprotect all sectors, aborting\n"); @@ -693,15 +843,16 @@ static int programImageBuffer(uint16_t trb_address, continue; } - if ((mode != PMODE_VERIFY) && + if ((mode != PMODE_VERIFY) && ((bytesWritten > 0) || (writeInfoPage == 1))) { - if ((manId == 0x01461f) || (manId == 0x00471f)) { + if ((flashParamRef.manId == 0x01461f) || + (flashParamRef.manId == 0x00471f)) { /* Enable writing */ if (sendCommand(trb_address, 0x06 << 24, 0) == -1) { fprintf(stderr, "\nError > program: write enable, aborting\n"); return -1; } - + /* Unprotect sector */ if (sendCommand(trb_address, 0x39 << 24 | (BLOCK_SIZE * block), 3) == -1) { @@ -711,13 +862,25 @@ static int programImageBuffer(uint16_t trb_address, return -1; } } - + /* Enable writing */ if (sendCommand(trb_address, 0x06 << 24, 0) == -1) { fprintf(stderr, "\nError > program: write enable, aborting\n"); return -1; } - + + if ((flashParamRef.manId == 0x01461f) || + (flashParamRef.manId == 0x00471f)) { + /* Unprotect sector */ + if (sendCommand(trb_address, 0x39 << 24 | (BLOCK_SIZE * block), 3) + == -1) { + fprintf(stderr, + "\nError > program: unprotect sector #%d, aborting\n", + block); + return -1; + } + } + /* Erase block */ fprintf(stdout, "E\b"); fflush(stdout); @@ -770,7 +933,8 @@ static int programImageBuffer(uint16_t trb_address, } } - if ((manId == 0x01461f) || (manId == 0x00471f)) { + if ((flashParamRef.manId == 0x01461f) || + (flashParamRef.manId == 0x00471f)) { /* Enable writing */ if (sendCommand(trb_address, 0x06 << 24, 0x00) == -1) { fprintf(stderr, "\nError > program: write enable, aborting\n"); @@ -858,7 +1022,9 @@ static int programImageBuffer(uint16_t trb_address, fflush(stdout); } - if ((mode != PMODE_VERIFY) && (manId == 0x1520c2)) { + if ((mode != PMODE_VERIFY) && + ((flashParamRef.manId == 0x1520c2) || + (flashParamRef.manId == 0x1720c2))) { /* Protect all Sectors i.e. write 0x3c to statusRegister */ if (writeStatusRegister(trb_address, 0x00) == -1) { fprintf(stderr, "\nError > program: protect all sectors, aborting\n"); @@ -918,76 +1084,31 @@ static int readImageFile(const char *imageFileName) static int prepareImageBuffer() { - char *strId = "INVALID"; - int found; + int match; unsigned int end; - unsigned int i; + unsigned int i = 0; /* Verify imageFile Id */ - switch (flashType) { - - case FLASH_RICH_ADCM_V1: - strId = "adcmv1"; - break; - - case FLASH_RICH_ADCM_V2: - strId = "adcmv2"; - break; - - case FLASH_RICH_ADCM_V3: - strId = "adcmv3"; - break; - - case FLASH_MDC_HUB_V2_FPGA1234: - strId = "mdchub_fpga1234"; - break; - case FLASH_MDC_HUB_V2_FPGA5: - strId = "mdchub_fpga5"; - break; - - case FLASH_MDC_OEP_V2: - case FLASH_MDC_OEP_V3: - strId = "mdc_oepb"; - break; - - case FLASH_SHOWER_ADDON_V2_FPGA1: - strId = "shower_fpga1"; - break; - case FLASH_SHOWER_ADDON_V2_FPGA2: - strId = "shower_fpga2"; - break; - case FLASH_SHOWER_ADDON_V2_FPGA3: - strId = "shower_fpga3"; - break; - - case FLASH_CTS_FPGA1: - strId = "cts_fpga1"; - case FLASH_CTS_FPGA2: - strId = "cts_fpga2"; - break; - case FLASH_PEXOR: - strId = "pexor"; - break; - default: - abort(); - break; - } - - /* Verify imageFile Id */ - found = 0; - for (i = 0; i < 2 * PAGE_SIZE; i++) { - if (memcmp(imageBuffer + i, strId, strlen(strId)) == 0) { - found = 1; - break; + i = 0; + match = 0; + for (i = 0; (i < 2 * PAGE_SIZE) && (match == 0); i++) { + unsigned int j = 0; + while (strlen(flashParamRef.allowedStringId[j]) > 0) { + if (memcmp(imageBuffer + i, + flashParamRef.allowedStringId[j], + strlen(flashParamRef.allowedStringId[j]))) { + match = 1; + break; + } } } - - if ((skipFirmwareIdCheck == 0) && (found == 0)) { + + if ((skipFirmwareIdCheck == 0) && (match == 0)) { fprintf(logFile, "Error > prepareImageBuffer: " - "invalid Firmware-Id of Image-File, should be: %s\n", strId); + "invalid Firmware-Id of Image-File\n"); return -1; } - + /* Overwrite Header with 0xff */ end = 0; for (i = 0; i < 2 * PAGE_SIZE; i++) { @@ -1233,7 +1354,7 @@ int main(int argc, char **argv) createInfoPage(imageFileName, userInfoStr); /* In case of MDC: select FlashRom */ - if ((flashType == FLASH_MDC_OEP_V2) || (flashType == FLASH_MDC_OEP_V3)) { + if ((flashParamRef.flashType == FLASH_MDC_OEP_V2) || (flashParamRef.flashType == FLASH_MDC_OEP_V3)) { if (selectMdcFlashRom(trb_address, mdcFlashSelect) == -1) { exit(EXIT_FAILURE); } @@ -1296,7 +1417,7 @@ int main(int argc, char **argv) } /* In case of MDC: select FlashRom */ - if ((flashType == FLASH_MDC_OEP_V2) || (flashType == FLASH_MDC_OEP_V3)) { + if ((flashParamRef.flashType == FLASH_MDC_OEP_V2) || (flashParamRef.flashType == FLASH_MDC_OEP_V3)) { if (selectMdcFlashRom(trb_address, mdcFlashSelect) == -1) { exit(EXIT_FAILURE); } @@ -1338,7 +1459,7 @@ int main(int argc, char **argv) } /* In case of MDC: select FlashRom */ - if ((flashType == FLASH_MDC_OEP_V2) || (flashType == FLASH_MDC_OEP_V3)) { + if ((flashParamRef.flashType == FLASH_MDC_OEP_V2) || (flashParamRef.flashType == FLASH_MDC_OEP_V3)) { if (selectMdcFlashRom(trb_address, mdcFlashSelect) == -1) { exit(EXIT_FAILURE); } @@ -1420,7 +1541,7 @@ int main(int argc, char **argv) /* Check ImageBuffer ??? */ /* In case of MDC: select FlashRom */ - if ((flashType == FLASH_MDC_OEP_V2) || (flashType == FLASH_MDC_OEP_V3)) { + if ((flashParamRef.flashType == FLASH_MDC_OEP_V2) || (flashParamRef.flashType == FLASH_MDC_OEP_V3)) { if (selectMdcFlashRom(trb_address, mdcFlashSelect) == -1) { exit(EXIT_FAILURE); } @@ -1466,7 +1587,7 @@ int main(int argc, char **argv) } /* In case of MDC: select FlashRom */ - if ((flashType == FLASH_MDC_OEP_V2) || (flashType == FLASH_MDC_OEP_V3)) { + if ((flashParamRef.flashType == FLASH_MDC_OEP_V2) || (flashParamRef.flashType == FLASH_MDC_OEP_V3)) { if (selectMdcFlashRom(trb_address, mdcFlashSelect) == -1) { exit(EXIT_FAILURE); } @@ -1522,7 +1643,7 @@ int main(int argc, char **argv) } /* In case of MDC: select FlashRom */ - if ((flashType == FLASH_MDC_OEP_V2) || (flashType == FLASH_MDC_OEP_V3)) { + if ((flashParamRef.flashType == FLASH_MDC_OEP_V2) || (flashParamRef.flashType == FLASH_MDC_OEP_V3)) { if (selectMdcFlashRom(trb_address, mdcFlashSelect) == -1) { exit(EXIT_FAILURE); } -- 2.43.0