]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Modifications to the decoder. Related to the new RCU firmware version (Per Thomas)
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 16 Jun 2008 21:41:49 +0000 (21:41 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 16 Jun 2008 21:41:49 +0000 (21:41 +0000)
RAW/AliAltroDecoder.cxx
RAW/AliAltroDecoder.h

index ee183be6f435fd11c4e866cf8e318984dcdb6e32..0c78c64c75af5e2f7fc7525f6fad09ba18a35c4e 100644 (file)
@@ -61,7 +61,8 @@ AliAltroDecoder::AliAltroDecoder() : f32DtaPtr(0),
                                     fInComplete(0),
                                     fDecodeIfCorruptedTrailer(kTRUE),
                                     fIsDecoded(kFALSE),
-                                    fIsFatalCorruptedTrailer(kTRUE) 
+                                     fIsFatalCorruptedTrailer(kTRUE) 
+//              fRcuFirmwareVersion(2)
 {
  // Default constructor
 }
@@ -149,13 +150,18 @@ Bool_t AliAltroDecoder::Decode()
 //       cout << "Size of datablock is  " << fSize   << endl;
 //       cout << "fN40AltroWords = "      << fN40AltroWords   << endl;
 //       cout << "fN40RcuAltroWords = "   << fN40RcuAltroWords  << endl;
+
+         printf("\n< ERROR: data integrity check failed, discarding data \n" );
+         printf( "Size of datablock is  %d\n", fSize);
+         printf( "fN40AltroWords =  %d\n", fN40AltroWords);
+         printf( "fN40RcuAltroWords =  %d\n", fN40RcuAltroWords);
          return kFALSE;
        }
-
     }
 }
 
 
+
 Bool_t AliAltroDecoder::NextChannel(AliAltroData *altroDataPtr)
 {
   // Reads the next altro channel in the RCU payload after the RCU payload
@@ -308,6 +314,8 @@ int AliAltroDecoder::SetMemory(UChar_t *dtaPtr, UInt_t size)
   // Sets the pointer to the memory block that should be decoded
   // Returns a negative value if an inconsistency in the data is detected
 
+
+
   if(dtaPtr == 0)
     {
       printf("\nAliAltroDecoder::SetMemory(UChar_t *dtaPtr, UInt_t size) FATAL ERROR, dtaPtr = ZERO !!!!!!!!!!!!\n");
@@ -315,7 +323,6 @@ int AliAltroDecoder::SetMemory(UChar_t *dtaPtr, UInt_t size)
       return -99;
     }
 
-
   int iRet = 0;
   Int_t tmpTrailerSize;
   fIsDecoded = kFALSE; 
@@ -323,7 +330,29 @@ int AliAltroDecoder::SetMemory(UChar_t *dtaPtr, UInt_t size)
   fSize = size;
   f8DtaPtr =f8DtaPtr + fSize;
   f32DtaPtr = (UInt_t *)f8DtaPtr;
-  tmpTrailerSize = *(f32DtaPtr - 1);
+  
+  // if(fRcuFirmwareVersion ==1)
+    //   {
+  
+  
+
+  //tmpTrailerSize = *(f32DtaPtr - 1);
+  tmpTrailerSize = (*(f32DtaPtr - 1))&(0x7f);
+  
+  //  printf("\nThe trailersize is %d\n", tmpTrailerSize);
+
+//   for(int i=0; i<tmpTrailerSize+2; i++)
+//     {
+//       printf("trailer %d = %d\n",  i, *(f32DtaPtr - i));
+
+//     }
+
+
+  //   }
+  //  else
+    //   {
+      
+      //   }
 
   if(tmpTrailerSize <=  MAX_TRAILER_WORDS)
     {
@@ -341,14 +370,43 @@ int AliAltroDecoder::SetMemory(UChar_t *dtaPtr, UInt_t size)
 
   if(tmpTrailerSize > 0 && tmpTrailerSize < 5)
     {
+      //if(fRcuFirmwareVersion ==1)
+      //       {
+      //  printf("\nfRcuFirmwareVersion ==1\n");
       f32DtaPtr =  f32DtaPtr -  tmpTrailerSize;
       fN40RcuAltroWords =  *f32DtaPtr;
       f32DtaPtr = (UInt_t *)dtaPtr + fkN32HeaderWords;
+  
+      //    printf("\nthe number of altrowords is %d\n", fN40RcuAltroWords);
+      //   printf("\nthe number of altrowords is %u\n", fN40RcuAltroWords); 
+
       fIsFatalCorruptedTrailer = kFALSE; 
+
+
+     
+         
+      //       } 
+
+      //      else if(fRcuFirmwareVersion ==2)
+      //       {
+      //         printf("\nfRcuFirmwareVersion ==2\n");            
+
+      //         f32DtaPtr =  f32DtaPtr -  tmpTrailerSize;
+      //         fN40RcuAltroWords =  *f32DtaPtr;
+      //         f32DtaPtr = (UInt_t *)dtaPtr + fkN32HeaderWords;
+      //         fIsFatalCorruptedTrailer = kFALSE; 
+
+      //       }
+      // }
+  
+      //  else
+      //  {
+      //    printf("ERROR, unknown RCU firmvare version");
+      //  }
     }
   else
     {
-      //     printf("\n AliAltroDecoder::SetMemory, ERROR\n, trailer is corrupted");
+      printf("\n AliAltroDecoder::SetMemory, ERROR\n, trailer is corrupted");
       fIsFatalCorruptedTrailer = kTRUE;
       iRet = -1;
     }
index e346f613277469fdd41e7ad6c0a62480e4290f67..3d429e57982c81fa793c86e6535724780459e1c9 100644 (file)
@@ -117,7 +117,8 @@ class AliAltroDecoder: public TObject {
   Int_t    fInComplete;                      // Number of altro channels that is read out properly
   Bool_t   fDecodeIfCorruptedTrailer;        // Wether or not to try to decode the data if the RCU trailer is incorrect (will succseed in most cases)
   Bool_t   fIsDecoded;                       // Wether or not the buffer set last by the "SetMemory()" function has been decoded
-  Bool_t  fIsFatalCorruptedTrailer;          // If trailer is fataly corrupted, not possible in any way to recover, then it is not allowed to decode the DDL payload.  
+  Bool_t   fIsFatalCorruptedTrailer;          // If trailer is fataly corrupted, not possible in any way to recover, then it is not allowed to decode the DDL payload.  
+  // const int fRcuFirmwareVersion;
 
   ClassDef(AliAltroDecoder, 0)  // class for decoding Altro payload
 };