]> jspc29.x-matter.uni-frankfurt.de Git - trbnettools.git/commitdiff
added shower support
authorhadaq <hadaq>
Thu, 4 Mar 2010 23:24:02 +0000 (23:24 +0000)
committerhadaq <hadaq>
Thu, 4 Mar 2010 23:24:02 +0000 (23:24 +0000)
trbrich/trbflash.c

index d59fa4a29a44d716bdbb31c3a57a4e7d4bf6f1f2..6316b2a4f3309c3fe8c9c58a730461b3bbae7988 100644 (file)
@@ -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: