/************************************************************************* $Archive: /PACS/OnBoard/Hk.h $ $Revision: 28 $ $Date: 3/14/06 4:31p $ $Author: Pacs Egse $ $Log: /PACS/OnBoard/Hk.h $ * * 28 3/14/06 4:31p Pacs Egse * Version 6.001 * Cleaned and commented ************************************************************************/ #define HK_H #ifndef CSL_TYPE_H #include "csl_type.h" #endif //CSL_TYPE_H #define HK_VALID TRUE #define HK_INVALID FALSE #define MEMORY_SCRUBBING_BUFFER_SIZE 256 /*if you change it here, change it also in smcs.s*/ //**************************************************************** // TYPES DEFINITION //**************************************************************** /* STRUCT : MemoryScrubbingParams ******************************* AUTHOR : Amazy USE : This structure groups all data related to the memory scrubbing. This includes arrays of corrupted addresses, current position in these arrays and current position of the scrubbing process */ typedef struct { unsigned int dmAddress; unsigned int pmAddress; unsigned int indexNextSfDmCorruptedAddress; unsigned int indexNextSfPmCorruptedAddress; unsigned int indexNextDfDmCorruptedAddress; unsigned int indexNextDfPmCorruptedAddress; unsigned int lastSfDmCorruptedAddresses[MEMORY_SCRUBBING_BUFFER_SIZE]; unsigned int lastSfPmCorruptedAddresses[MEMORY_SCRUBBING_BUFFER_SIZE]; unsigned int lastDfDmCorruptedAddresses[MEMORY_SCRUBBING_BUFFER_SIZE]; unsigned int lastDfPmCorruptedAddresses[MEMORY_SCRUBBING_BUFFER_SIZE]; } MemoryScrubbingParams; /* ENUM : HkMode ************* AUTHOR : Amazy USE : Defines the housekeeping modes (nominal or diagnostic) */ typedef enum { HK_NOM = 1, HK_DIAG = 2, HK_ALL = HK_NOM | HK_DIAG, } HkMode; /* STRUCT : HkControllerParams *************************** AUTHOR : Amazy USE : This structure contains all data related to the HK task */ typedef struct { int TaskStatus; } HkControllerParams; /* STRUCT : HkDiagnosticControllerParams ************************************* AUTHOR : Amazy USE : This structure contains all data related to the diagnostic HK task */ typedef struct { int TaskStatus; int HkDiagnosticPeriod; //0=synchronized on any detector, otherwise, it is the period in ms between 2 HK acquisition int HkDiagnosticPeriodCommanded; //the parameter that has been sent via the command (it is reported in the header of the packet) int HkDiagList[16]; //the list of measure id to acquire (the last one must be 0xFFFF) int CurrentSizeOfHkDiagBuffer; //the HkDiagBuffer is filled at each sample, this variable is used to know where we are in the buffer } HkDiagnosticControllerParams; //HkDiagnosticControllerStatus enum { K_BMASK_TASK_STATUS_HK_DIAG_DIAGNOSTIC_MODE_ACTIVE = 1 << 20, }; // define a type for pointer on function called by the PerformHkAcquisitions function. typedef void (*PerformHkAcquisitionFunction)(); /* STRUCT : HkMeasureDescription ***************************** AUTHOR : AMazy USE : This structure contains all the information related to a housekeeping measure. It is used to describe the acquisition process of each of the measure. */ typedef struct { const int* pVariable; int SizeInWords; int SizeInBytes; PerformHkAcquisitionFunction AcquisitionFunction; BOOL Valid; } HkMeasureDescription; //**************************************************************** // EXTERNAL FUNCTION //**************************************************************** extern void PerformHkAcquisitions(HkMode mode, int* p_taskStatus, int* p_hkList, int* p_hkBuffer, int* p_currentPosInBuffer, int maxSizeOfHkBuffer); //in "Hk.c" extern void GetSizeOfSample(int* p_hkList, int* p_sizeOfSample, int* p_nbMeasureBySample); extern int GetHkValue(int hkId); #define VALIDATE_HK(hkId) gaHkMeasure[hkId].Valid = TRUE; #define INVALIDATE_HK(hkId) gaHkMeasure[hkId].Valid = FALSE; /* ENUM : HkId *********** AUTHOR : AMazy USE : enumerates the id of the Hk Measures. NOTE : The id shall never be used directly in the DEC_MEC software; It shall be used by ground software only. However, during development, it is usefull. */ #define HK_MEASURE(HkMode, HkId, Variable, SizeWords, SizeBytes, Function, Display, ValidityAtStartup) HkId, enum HkId { #include "HkList.h" NB_HK_MEASURES, END_OF_HK_LIST = 0xFFFF }; //**************************************************************** // EXTERNAL VARIABLES //**************************************************************** extern int gDummyVariable; // this variable is only used to be referenced by the custom entries of the Hk Measure table. #define SIZE_OF_HK_DIAG_PACKET_HEADER_IN_BYTES 72 //In Bytes #define MAXIMUM_SIZE_OF_HK_DIAG_PACKET_IN_BYTES 1000 //In Bytes #define MAXIMUM_SIZE_OF_HK_DIAG_PACKET_IN_WORDS 250 //In Words #define MAXIMUM_SIZE_OF_HK_PACKET_IN_WORDS 510 //In Words extern int gaaHkDiagPacketBuffer[2][MAXIMUM_SIZE_OF_HK_DIAG_PACKET_IN_WORDS]; extern int gHkPacketBuffer[MAXIMUM_SIZE_OF_HK_PACKET_IN_WORDS]; // this buffer is shared between HkController and DpuSender (it is protected by EVENT_HK_PACKET_BUFFER_AVAILABLE) extern HkMeasureDescription gaHkMeasure[NB_HK_MEASURES]; extern int gaCustomHkEntry[10];