From cf9007b8fec9e0bf5e5c7e8cae885ed6aff484d7 Mon Sep 17 00:00:00 2001 From: hadaq Date: Thu, 4 Mar 2010 23:24:02 +0000 Subject: [PATCH] added shower support --- trbrich/trbflash.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/trbrich/trbflash.c b/trbrich/trbflash.c index d59fa4a..6316b2a 100644 --- a/trbrich/trbflash.c +++ b/trbrich/trbflash.c @@ -58,15 +58,16 @@ static const unsigned int timeout = 10000; typedef enum { FLASH_INVALID = 0, FLASH_ADCM1 = 1, - FLASH_ADCM23 = 2, + FLASH_ADCM23_SHOWER = 2, FLASH_MDC = 3 } FlashType; -static const char FlashTypeStr[][16] = {"INVALID", "ADCM1", "ADCM2&3", "MDC"}; +static const char FlashTypeStr[][16] = + {"INVALID", "ADCM1", "ADCM2&3 / SHOWER", "MDC"}; static FlashType flashType = FLASH_INVALID; -static const char trbflash_version[] = "$Revision: 2.10 $"; +static const char trbflash_version[] = "$Revision: 2.11 $"; static uint32_t mdcFlashSelect = 1; @@ -276,8 +277,8 @@ static int checkStatus(uint16_t trb_address) ret = 0; for (i = 0; i < status; i += 2) { - if ((flashType == FLASH_ADCM1) || (flashType == FLASH_ADCM23)) { - /* Check EPE Bit (ADCM only) */ + if ((flashType == FLASH_ADCM1) || (flashType == FLASH_ADCM23_SHOWER)) { + /* Check EPE Bit (ADCM and Shower only) */ if (((trbBuffer[i + 1] >> 5) & 0x01) == 1) { fprintf(logFile, "Error > checkStatus: Erase or program error on " "EndPoint 0x%04x\n", trbBuffer[i] & 0xffff); @@ -365,11 +366,11 @@ static int initTransfer(uint16_t trb_address) case 0x00471f: /* ADCM */ - if ((flashType != FLASH_INVALID) && (flashType != FLASH_ADCM23)) { + if ((flashType != FLASH_INVALID) && (flashType != FLASH_ADCM23_SHOWER)) { success = -2; } NUM_PAGES = 16384; - flashType = FLASH_ADCM23; + flashType = FLASH_ADCM23_SHOWER; break; case 0x1520c2: @@ -630,7 +631,7 @@ static int programImageBuffer(uint16_t trb_address, unsigned int size, if ((mode != PMODE_VERIFY) && ((bytesWritten > 0) || (writeInfoPage == 1))) { - if ((flashType == FLASH_ADCM1) || (flashType == FLASH_ADCM23)) { + if ((flashType == FLASH_ADCM1) || (flashType == FLASH_ADCM23_SHOWER)) { /* Enable writing */ if (sendCommand(trb_address, 0x06 << 24, 0) == -1) { fprintf(stderr, "\nError > program: write enable, aborting\n"); @@ -701,7 +702,7 @@ static int programImageBuffer(uint16_t trb_address, unsigned int size, } } - if ((flashType == FLASH_ADCM1) || (flashType == FLASH_ADCM23)) { + if ((flashType == FLASH_ADCM1) || (flashType == FLASH_ADCM23_SHOWER)) { /* Enable writing */ if (sendCommand(trb_address, 0x06 << 24, 0x00) == -1) { fprintf(stderr, "\nError > program: write enable, aborting\n"); @@ -850,7 +851,7 @@ static int readImageFile(const char *imageFileName) static int prepareImageBuffer() { - char strId[2][32] = {"", ""}; + char strId[3][32] = {"", ""}; unsigned int numIds = 0; int found; unsigned int end; @@ -864,10 +865,11 @@ static int prepareImageBuffer() numIds = 1; break; - case FLASH_ADCM23: + case FLASH_ADCM23_SHOWER: strncpy(strId[0], "edif_adcmv2", 32); strncpy(strId[1], "edif_adcmv3", 32); - numIds = 2; + strncpy(strId[2], "edif_shower", 32); + numIds = 3; break; case FLASH_MDC: -- 2.43.0