From bdb44128a211422c42a5181969ffee7a4196e216 Mon Sep 17 00:00:00 2001 From: hadaq Date: Fri, 11 Jun 2010 21:08:26 +0000 Subject: [PATCH] update --- trbrich/trbflash.c | 47 ++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/trbrich/trbflash.c b/trbrich/trbflash.c index 66b9575..5b69b86 100644 --- a/trbrich/trbflash.c +++ b/trbrich/trbflash.c @@ -78,19 +78,26 @@ typedef enum { } FlashType; -static const char FlashTypeStr[][32] = +static const char FlashTypeStr[16][32] = { "INVALID", - "RICH_ADCM_V1", "RICH_ADCM_V2", "RICH_ADCM_V3", - "MDC_HUB_V2_FPGA1234", "MDC_HUB_V2_FPGA5", - "MDC_OEP_V2", "MDC_OEP_V3", - "SHOWER_ADDON_V2_FPGA1", "SHOWER_ADDON_V2_FPGA2", "SHOWER_ADDON_V2_FPGA3", - "CTS_FPGA1", "CTS_FPGA2" + "RICH_ADCM_V1", + "RICH_ADCM_V2", + "RICH_ADCM_V3", + "MDC_HUB_V2_FPGA1234", + "MDC_HUB_V2_FPGA5", + "MDC_OEP_V2", + "MDC_OEP_V3", + "SHOWER_ADDON_V2_FPGA1", + "SHOWER_ADDON_V2_FPGA2", + "SHOWER_ADDON_V2_FPGA3", + "CTS_FPGA1", + "CTS_FPGA2" }; static FlashType flashType = FLASH_INVALID; static uint32_t manId = 0; -static const char trbflash_version[] = "$Revision: 2.18 $"; +static const char trbflash_version[] = "$Revision: 2.19 $"; static uint32_t mdcFlashSelect = 1; @@ -131,7 +138,7 @@ static int writeSetupRegister(uint16_t trb_address, uint8_t value) if ((status = trb_register_write(trb_address, SetupReg, (uint32_t)(value << 24))) == -1) { fprintf(logFile, "Error > writeSetupRegister: TRBNet %s\n", - trb_strerror(trb_errno)); + trb_strerrorf()); return -1; } @@ -146,7 +153,7 @@ static int writeSetupRegister(uint16_t trb_address, uint8_t value) if (trb_term.status_channel != 0) { fprintf(logFile, "Error > writeSetupRegister: invalid Status returned %s\n", - trb_strerror(trb_errno)); + trb_strerrorf()); return -1; } @@ -166,7 +173,7 @@ static int readCtrlRegister(uint16_t trb_address, if ((status = trb_register_read(trb_address, CtrlReg, trbBuffer, TRB_BUFFER_SIZE)) == -1) { fprintf(logFile, "Error > readCtrlRegister: TRBNet %s\n", - trb_strerror(trb_errno)); + trb_strerrorf()); return -1; } @@ -202,7 +209,7 @@ static int writeCtrlRegister(uint16_t trb_address, uint32_t value) if ((status = trb_register_write(trb_address, CtrlReg, value)) == -1) { fprintf(logFile, "Error > writeCtrlRegister: TRBNet %s\n", - trb_strerror(trb_errno)); + trb_strerrorf()); return -1; } @@ -249,7 +256,7 @@ static int checkStatus(uint16_t trb_address) trb_register_read(trb_address, BlockRam, trbBuffer, TRB_BUFFER_SIZE)) == -1) { fprintf(logFile, "Error > checkStatus: TRBNet %s\n", - trb_strerror(trb_errno)); + trb_strerrorf()); return -1; } @@ -288,7 +295,7 @@ static int writeStatusRegister(uint16_t trb_address, uint8_t value) if (trb_register_write(trb_address, BlockRam, (uint32_t)value) == -1) { fprintf(logFile, "Error > writeStatusRegister: TRBNet %s\n", - trb_strerror(trb_errno)); + trb_strerrorf()); return -1; } if (sendCommand(trb_address, 0x01 << 24, 0) == -1) { @@ -319,8 +326,8 @@ static int initTransfer(uint16_t trb_address) if ((status = trb_register_read(trb_address, HardwareId, trbBuffer, TRB_BUFFER_SIZE)) == -1) { - fprintf(logFile, "Error > initTransfer: read HardwareIds TRBNet %s\n", - trb_strerror(trb_errno)); + fprintf(logFile, "Error > initTransfer, read HardwareIds: TRBNet %s\n", + trb_strerrorf()); return -1; } @@ -407,8 +414,8 @@ static int initTransfer(uint16_t trb_address) if ((status = trb_register_read(trb_address, BlockRam, trbBuffer, TRB_BUFFER_SIZE)) == -1) { - fprintf(logFile, "Error > initTransfer: read ManIds TRBNet %s\n", - trb_strerror(trb_errno)); + fprintf(logFile, "Error > initTransfer, read ManIds: TRBNet %s\n", + trb_strerrorf()); return -1; } @@ -499,7 +506,7 @@ static int readPage(uint16_t trb_address, uint32_t pageNumber, trbBuffer, TRB_BUFFER_SIZE)) == -1) { fprintf(logFile, "Error > readPage: TRBNet %s\n", - trb_strerror(trb_errno)); + trb_strerrorf()); return -1; } @@ -566,7 +573,7 @@ static int writePage(uint16_t trb_address, uint32_t pageNumber, trbBuffer, size)) == -1) { fprintf(logFile, "Error > writePage: TRBNet %s\n", - trb_strerror(trb_errno)); + trb_strerrorf()); return -1; } @@ -1044,7 +1051,7 @@ static int selectMdcFlashRom(uint16_t trb_address, uint8_t number) { if (trb_register_write(trb_address, MDCFlashRomSelect, (uint32_t)number) == -1) { fprintf(logFile, "\nError > selcetMdcFlashRom: TRBNet %s\n", - trb_strerror(trb_errno)); + trb_strerrorf()); return -1; } -- 2.43.0