/* $Workfile: $ ** ** Title: hdr.h ** ** Author: J Chiralo the Hammers Company, Inc. ** ** $Revision: 1.22 $ ** ** Checked in $Date: 2006/09/29 15:40:12 $ ** Last Modified $Modtime: $ ** Last Modified By $Author: wang $ ** *********************************************************************** ** ** Purpose: Definitions for the decoding of the Secchi image header. ** ** Assumptions and External Effects: ** ** None ** ** Modification History: ** $Log: hdr.h,v $ ** Revision 1.22 2006/09/29 15:40:12 wang ** Linux pad words added to struct ** ** Revision 1.21 2006/07/13 19:32:54 nathan ** add detail to comment for imgBufferOffset ** ** Revision 1.20 2005/05/12 21:29:45 wang ** rdSh Version 4 ** ** Revision 1.19 2005/05/11 22:55:10 wang ** Version 4 header ** ** Revision 1.18 2005/05/11 14:50:29 wang ** VER4 header support ** ** Revision 1.17 2005/04/13 23:24:25 wang ** New IP codes and header VER3 changes ** ** Revision 1.16 2005/03/28 16:06:47 jchiralo ** Added decode of start time fields for CCD clear and image readout ** ** Revision 1.15 2005/03/21 15:08:13 wang ** numInSeq added and new IP codes ** ** Revision 1.14 2005/03/18 16:31:34 wang ** Updated IP codes and added version 1 (no bias vars) reader to Makefile as rdShv1 ** ** Revision 1.13 2005/03/18 08:27:45 wang ** Added bias mean and std ** ** Revision 1.12 2005/01/31 19:33:32 jchiralo ** Changes to reflect new spacewire error codes and door status values ** ** Revision 1.11 2004/11/04 20:24:48 jchiralo ** Changed ipCmdCnt type to match FSW defn ** ** Revision 1.10 2004/10/27 21:59:14 jchiralo ** Added value decoding for enums and time; reformatted output ** */ #define uint8 unsigned char #define uint16 unsigned short #define uint32 unsigned int #define int8 char #define int16 short #define int32 int #define SECONDS_IN_ONE_YEAR 31536000 #define SECONDS_IN_ONE_DAY 86400 #define SECONDS_IN_ONE_HOUR 3600 #define SECONDS_IN_ONE_MINUTE 60 // (Jan 1 '58 to Jan 1'70) #define SECONDS_FROM_EPOCH_TO_1970 378691200 // (Jan 1 '58 to Jan 1'70) + 10 years + 2 leap days #define SECONDS_SINCE_EPOCH_TO_DOS ( SECONDS_FROM_EPOCH_TO_1970 \ + ( SECONDS_IN_ONE_YEAR * 10 )\ + ( 2 * SECONDS_IN_ONE_DAY ) ) #define DOS_EPOCH_YEAR 1980 #define DOS_EPOCH_MONTH 1 #define DOS_EPOCH_DAY 1 // FPS Table structures and enumerations // // NOTE: Any modification of the following structure should // be reflected in the increase or decrease of spare in the // "sGtEngTlmPkt" structure defined in "gtpkts.h" typedef struct { int16 yCoordXform; int16 zCoordXform; int16 voltPredict[5]; int16 pidCoef[4]; // structure size is 22 bytes } sFpsPztCoef; typedef struct { sFpsPztCoef pzt[3]; // structure size is 66 bytes } sGtFpsCoefs; #ifdef VER3 #define N_IMG_PROC_CMD 20 #endif #ifdef VER2 #define N_IMG_PROC_CMD 10 #endif /////////////////////////////////////////////////////////// // EUVI FPS Image Header structures and enumerations // NOTE: Any modification of the following structure should // be reflected in the increase or decrease of spare in the // "sGtEngTlmPkt" structure defined in "gtpkts.h" typedef struct { uint16 imageNum; int16 yOffset; // Hfoy int16 zOffset; // Hfoz uint16 spare1; // Spare to maintain DWord Alignment uint32 numFpsSamples; // Hfn int32 fpsYSum; // Hfy1 int32 fpsZSum; // Hfz1 int32 fpsYSquare; // Hfy2 int32 fpsZSquare; // Hfz2 int32 pztErrSum[3]; // Hfe11, Hfe12, Hfe13 int32 pztErrSquare[3]; // Hfe21, Hfe22, Hfe23 int32 pztDacSum[3]; // Hfu11, Hfu12, Hfu13 int32 pztDacSquare[3]; // Hfu21, Hfu22, Hfu23 sGtFpsCoefs fpsCoefs; // uint16 spare2; // Spare to maintain DWord Alignment // structure size is 144 bytes } sGtFpsImageHdr; #ifdef VER4 #define N_IMG_PROC_CMD 20 /*////////////////////////////////////////////////////////////////////// Base Image Description */ struct { /** Processed image output filename */ char filename[13]; /** headers present ( 0-base, 1-base+nominal, 2-all 3 ) Determined by IP logic */ uint8 eHeaderTypeFlag; uint8 version; /** image sequence counter e.g. nth in sequence */ uint8 imgSeq; /** Total num in sequence */ uint8 numInSeq; /** on chip CCD binning as specified by camera readout sequence */ uint8 sumrow; uint8 sumcol; /** actual Filter wheel position */ uint8 actualFilterPosition; /** actual Polarization wheel or Quad position */ uint8 actualPolarPosition; /** actual Polarization wheel position 2*/ uint8 actualPolarPosition2; /** image processing binning as determined by IP task */ uint8 sebxsum; uint8 sebysum; /** IP processing log of commands */ uint8 ipCmdLog[N_IMG_PROC_CMD]; /** Ground Sofware usage */ uint16 osNumber; /** Critical Event Code - alert SECCHI OPs */ uint16 critEvent; /** image counter - added by IS [0-9999] */ uint16 imgCtr; /** Telescope image counter (same counter as HK packet ) */ uint16 telescopeImgCnt; /** CCD mean and stdev */ int32 meanBias; uint32 stddevBias; /** Actual exp duration 24 bits with LSB = 4 usec ( Close time minus Open time ) For HI the time is measured by FSW using a hardware timer and converted to 4 usec units. */ uint32 actualExpDuration; /** Actual for 2nd exposure duration ( 24 bits with LSB = 4 usec ) ( Close time minus Open time ) source: mechanism readback For HI the time is measured by FSW using a hardware timer and converted to 4 usec units. */ uint32 actualExpDuration_2; /** time (UTC) of actual exposure (Shutter command) NOT including lt_offset */ #ifdef LINUX uint32 spare; #endif double actualExpTime; /** time (UTC) of actual exposure #2 (Shutter command) NOT including lt_offset */ double actualExpTime_2; } m_baseHeader; /*///////////////////////////////////////////////////////////////////// // Nominal Image Description // */ struct { /** STEREO-A = 1 STEREO-B = 2 */ uint8 platformID; /** Telescope identification code 1 - 5 (see hkpdev.h) */ uint8 telescopeID; /** ID representing the type of image i.e. Dark image ( observing program id )*/ uint8 imageType; /** LED ID used or 0=no led used Physical location determines mechanism sequence */ uint8 cmdLEDMode; /** number of image processing commands determined by IP */ uint8 ipCmdCnt; /*//// // Actuals // */ /** Last status known of the spacewire interface to the CEB based on codes defined as specified in enum CAMERA_INTERFACE_STATUS */ uint8 CEBIntfStatus; /** Last status known of the CCD interface within the CEB based on codes as defined by enum CAMERA_PROGRAM_STATE */ uint8 CCDIntfStatus; /** sync - true = image synchronized to other Spacecraft */ uint8 sync; /** Commanded exposure duration in units of 1.024 msec ( max of 67.1 seconds) For longer exposures, set the image type to DOUBLE and set the 2nd duration value. For HI exposures the units are 2 msec. */ uint16 cmdExpDuration; /** Commanded 2nd exposure duration in units of 1.024 msec Image type is set to DOUBLE to use this value For HI exposures the units are 2 msec. */ uint16 cmdExpDuration_2; uint16 campaignSet; /*////////////////////////////////////////////////////////////////////// // Camera Setup params // */ /** camera offset value */ uint16 offset; /** camera gain value */ uint8 gain; /** camera gain mode value */ uint8 gainMode; /** Camera Readout table ID to use for Clearing CCD */ uint8 clrTableID; /** Camera Readout table ID to use for Readout of image */ uint8 readoutTableID; /** region of interest top left column of rectangle */ uint16 p1col; /** region of interest top left row of rectangle*/ uint16 p1row; /** region of interest lower right column of rectangle */ uint16 p2col; /** region of interest lower right row of rectangle*/ uint16 p2row; /*////////////////////////////////////////////////////////////////////// // Mechanism Setup / Actuals Data // */ /** Instrument uses a double format for time from epoch 1958 Jan 01 00:00:00 UTC time of exposure uploaded NOT including lt_offset */ #ifdef LINUX uint32 spare; #endif double cmdExpTime; /** light travel time offset in ms as set by IS */ uint32 lightTravelOffsetTime; /** SDRAM image buffer offset number for image capture [0-26] */ uint8 imgBufferOffset; /** Position of Filter wheel for EUVI */ uint8 cmdFilterPosition; /** Polarization wheel for CORs */ uint8 cmdPolarPosition; /** 2nd Polar Wheel Position ( for double exposures ) for CORs */ uint8 cmdPolarPosition_2; /** number of LED pulses used, 0 = no led used*/ uint32 cmdLEDPulses; /*//// // Actuals // */ /** Spacecraft Status byte PRE exposure */ uint16 preExpSCStatus; /** Spacecraft Status byte POST exposure */ uint16 postExpSCStatus; /** Readback of actual shutter open time (when the opening edge of the blade crosses the center of the CCD) source: mechanism readback*/ uint32 actualOpenTime; /** Readback of actual shutter close time (when the closing edge of the blade crosses the center of the CCD) source: mechanism readback*/ uint32 actualCloseTime; /** Readback of actual shutter open time #2 (when the opening edge of the blade crosses the center of the CCD) source: mechanism readback*/ uint32 actualOpenTime_2; /** Readback of actual shutter close time #2(when the closing edge of the blade crosses the center of the CCD) source: mechanism readback*/ uint32 actualCloseTime_2; /** State of shutter during exposure open=1 closed = 0*/ uint8 actualShutterPosition; /** Shutter rotational direction CW=1, CCW=2 */ uint8 actualShutterDirection; /** Filter wheel rotational direction for EUVI CW=1, CCW=2 */ uint8 actualFilterDirection; /** Polarization wheel for CORs CW=1, CCW=2 */ uint8 actualPolarDirection; /** State of door during exposure CLOSED 0 IN TRANSIT 1 OPEN 2 OFF 3 ERROR 4 No Data 255 */ uint8 actualDoorPosition; /*//////////////////////////////////////////////////////////////////// // Image Processing Params / Record // */ /** image processing function ID given to IP task from IS task */ uint8 ipFunction; /** IP processing commands */ uint8 ipCmd[N_IMG_PROC_CMD]; /** Time to readout raw image from camera in usec */ uint32 actualReadoutTime; /** IP Image Processing Time */ uint32 ipProcessingTime; #ifdef LINUX uint32 spare1; #endif /*//////////////////////////////////////////////////////////////////// // Time markers within the Image Taking logic // */ /** Time (UTC) of actual start of the CCD clear operation. Specifically, the start of the CEB command series to run the clear table. */ double actualCCDClearStartTime; /** Time (UTC) of actual start of the image retrieve Specifically, the start of the CEB command series to run the readout sequence. */ double actualImageRetrieveStartTime; } m_nominalHeader; /*////////////////////////////////////////////////////////////////////// // Extended Image Description // */ struct { /** command use FPS 1 = ON */ uint8 useFPS; /** state of FPS during exp for EUVI, FPS on=1 */ uint8 actualFPSMode; /** S/C fine point mode on = 1 */ uint8 actualScFinePointMode; /** EUVI Quadrant wheel position */ uint8 cmdQuadPosition; /*//////////////////////////////////////////////////////////////////// //// Guide Telescope and FPS statistics //// see Guide Telescope SICM for algorithm and variable definitions //// */ sGtFpsImageHdr fpsData; } m_extendedHeader; #else /*/////// // Definition of image header data sections. // m_baseHeader - defines the space weather header // m_nominalHeader - defines the nominal image data for CORs // m_extendedHeader - defines the additional image data for EUVI /////////////////////////////////////////////////////////////////////// // Base Image Description // */ struct { /** Processed image output filename */ char filename[13]; /** headers present ( 0-base, 1-base+nominal, 2-all 3 ) Determined by IP logic */ /*eHeaderType*/ uint8 eHeaderTypeFlag; /** header version (format) internal */ uint16 version; #ifdef VER3 /** Ground Software usage */ uint16 osNumber; #endif #ifdef VER2 /** Ground Software usage */ uint32 osNumber; #endif /** Critical Event Code - alert SECCHI OPs */ uint16 critEvent; /** image counter - added by planning tool 0-9999 */ uint16 imgCtr; /** image sequence counter e.g. nth in sequence */ uint16 imgSeq; /** number in sequence */ uint16 numInSeq; /** Telescope image counter (same counter as HK packet ) */ uint16 telescopeImgCnt; /** on chip CCD binning as specified by camera readout sequence */ uint16 sumrow; uint16 sumcol; /** Commanded exposure duration in units of 1.024 msec ( max of 67.1 seconds) For longer exposures, set the image type to DOUBLE and set the 2nd duration value. For HI exposures the units are 2 msec. */ uint16 cmdExpDuration; /** Commanded 2nd exposure duration in units of 1.024 msec Image type is set to DOUBLE to use this value*/ uint16 cmdExpDuration_2; /** actual Filter wheel position */ uint16 actualFilterPosition; /** actual Polarization wheel position */ uint16 actualPolarPosition; /** image processing binning as determined by IP task */ uint16 sebxsum; uint16 sebysum; #ifdef VER2 uint32 meanBias; uint32 stddevBias; #endif #ifdef VER3 int32 meanBias; uint32 stddevBias; #endif /** IP processing log of commands */ uint8 ipCmdLog[N_IMG_PROC_CMD]; /** Actual exp duration 24 bits with LSB = 4 usec ( Close time minus Open time )*/ uint32 actualExpDuration; /** time (UTC) of actual exposure (Shutter command) NOT including lt_offset */ double actualExpTime; /** time (UTC) of actual exposure #2 (Shutter command) NOT including lt_offset */ double actualExpTime_2; } m_baseHeader; /*////////////////////////////////////////////////////////////////////// // Nominal Image Description // */ struct { /** STEREO-A = 1 STEREO-B = 2 */ /*ePlatformTypes */ uint8 platformID; /** Telescope identification code 1 - 5 (see hkpdev.h) */ /*eHkpInstrument */ uint8 telescopeID; /** ID representing the type of image i.e. Dark image ( observing program id )*/ /*eImageTypeCodes */ uint8 imageType; /** number of image processing commands determined by IP */ uint8 ipCmdCnt; /** sync - true = image synchronized to other Spacecraft */ uint16 sync; uint16 campaignSet; /*////////////////////////////////////////////////////////////////////// // Camera Setup params // */ /** camera offset value */ uint16 offset; /** camera gain value */ uint16 gain; /** camera gain mode value */ uint16 gainMode; /** Camera Readout table ID to use for Clearing CCD */ uint16 clrTableID; /** Camera Readout table ID to use for Readout of image */ uint16 readoutTableID; /** region of interest top left column of rectangle */ uint16 p1col; /** region of interest top left row of rectangle*/ uint16 p1row; /** region of interest lower right column of rectangle */ uint16 p2col; /** region of interest lower right row of rectangle*/ uint16 p2row; /** SDRAM image buffer offset number for image capture */ uint16 imgBufferOffset; /*//// // Actuals // */ /** Last status known of the spacewire interface to the CEB based on codes defined as specified in enum CAMERA_INTERFACE_STATUS */ /*CAMERA_INTERFACE_STATUS */ uint8 CEBIntfStatus; /** Last status known of the CCD interface within the CEB based on codes as defined by enum CAMERA_PROGRAM_STATE */ /*CAMERA_PROGRAM_STATE */ uint8 CCDIntfStatus; /*////////////////////////////////////////////////////////////////////// // Mechanism Setup / Actuals Data // */ /** Instrument uses a double format for time from epoch 1958 Jan 01 00:00:00 UTC time of exposure uploaded NOT including lt_offset */ double cmdExpTime; /** light travel time offset in ms as set by IS */ uint32 lightTravelOffsetTime; /** Polarization wheel for CORs */ uint16 cmdPolarPosition; /** 2nd Position ( for double exposures ) for Polar wheel for CORs */ uint16 cmdPolarPosition_2; /** LED ID used or 0=no led used Physical location determines mechanism sequence */ /*eHkpCalLedColor */ uint8 cmdLEDMode; /** number of LED pulses used, 0 = no led used*/ uint32 cmdLEDPulses; /*//// // Actuals // */ /** Spacecraft Status byte PRE exposure */ uint16 preExpSCStatus; /** Spacecraft Status byte POST exposure */ uint16 postExpSCStatus; /** Readback of actual shutter open time (when the opening edge of the blade crosses the center of the CCD) source: mechanism readback*/ uint32 actualOpenTime; /** Readback of actual shutter close time (when the closing edge of the blade crosses the center of the CCD) source: mechanism readback*/ uint32 actualCloseTime; /** Readback of actual shutter open time #2 (when the opening edge of the blade crosses the center of the CCD) source: mechanism readback*/ uint32 actualOpenTime_2; /** Readback of actual shutter close time #2(when the closing edge of the blade crosses the center of the CCD) source: mechanism readback*/ uint32 actualCloseTime_2; /** Actual for 2nd exposure duration ( 24 bits with LSB = 4 usec ) ( Close time minus Open time ) source: mechanism readback*/ uint32 actualExpDuration_2; /** State of shutter during exposure open=1 closed = 0*/ uint16 actualShutterPosition; /** Shutter rotational direction */ uint16 actualShutterDirection; /** Polarization wheel for CORs */ uint16 actualPolarDirection; /** State of door during exposure CLOSED 0 IN TRANSIT 1 OPEN 2 OFF 3 ERROR 4 No Data 255 */ uint16 actualDoorPosition; /** Time to readout raw image from camera in usec */ uint32 actualReadoutTime; /*////////////////////////////////////////////////////////////////////// // Image Processing Params / Record // */ /** image processing function ID given to IP task from IS task */ uint16 ipFunction; /** IP processing commands */ uint8 ipCmd[N_IMG_PROC_CMD]; uint32 ipProcessingTime; /////////////////////////////////////////////////////////////////////// // Time markers within the Image Taking logic // /** Time (UTC) of actual start of the CCD clear operation. Specifically, the start of the CEB command series to run the clear table. */ double actualCCDClearStartTime; /** Time (UTC) of actual start of the image retrieve Specifically, the start of the CEB command series to run the readout sequence. */ double actualImageRetrieveStartTime; } m_nominalHeader; /////////////////////////////////////////////////////////////////////// // Extended Image Description // struct { /////////////////////////////////////////////////////////////////////// /** command use FPS 1 = ON */ uint16 useFPS; /** state of FPS during exp for EUVI, FPS on=1 */ uint16 actualFPSMode; /** S/C fine point mode on = 1 */ uint16 actualScFinePointMode; /** Position of Filter wheel for EUVI */ uint16 cmdFilterPosition; /** EUVI Quadrant wheel position */ uint16 cmdQuadPosition; /** Filter wheel rotational direction for EUVI */ uint16 actualFilterDirection; /** EUVI Quadrant Select wheel rotational direction */ uint16 actualQuadDirection; /*////////////////////////////////////////////////////////////////////// //// Guide Telescope and FPS statistics //// see Guide Telescope SICM for algorithm and variable definitions //// */ sGtFpsImageHdr fpsData; } m_extendedHeader; #endif