/************************************************************************* $Archive: /PACS/OnBoard/error.h $ $Revision: 1.12 $ $Date: 2009/04/23 13:51:12 $ $Author: amazy $ $Log: error.h,v $ Revision 1.12 2009/04/23 13:51:12 amazy 6.029 * * 5 2/07/07 11:30a Amazy * - The open loop code for the grating has been updated and validated on * DMC FM with QM grating * - The position limit error is now signaled in the chopper controller * (error code 0x0b15). The position limit * is stored in the field 'scaling' of the chopper pid controller. Its * default value is 0x7FFFFFFF. * * 35 3/14/06 4:31p Pacs Egse * Version 6.001 * Cleaned and commented *************************************************************************/ #define ERROR_H #ifdef CSL_SHOW_INCLUDE #pragma message( "Including " __FILE__ ) #endif /* ENUM : Error Codes ****************** AUTHOR : AMazy USE : This enumeration contains all the error codes used in the whole application. This includes, the error codes returned in NACK packet sent to DPU and the error codes of all the tasks. Task error codes are stored in the 16 LSB of the Status field of the task. */ enum { NONE, // ERROR CODES USED IN COMMUNICATION WITH DPU //******************************************* INVALID_COMMAND = 0xA1, INVALID_MEMORY_ID = 0xA2, INVALID_ADDRESS = 0xA3, INVALID_LENGTH = 0xA4, INVALID_CHECKSUM_RECEIVED = 0xA5, INVALID_PARAMETER_ID = 0xA6, INVALID_TRIGGER_COMMAND_ID = 0xA7, INVALID_SID = 0xA8, INVALID_PARAMETER = 0xA9, COULD_NOT_EXECUTE_COMMAND = 0xAA, INVALID_CHECKSUM_AFTER_COPY = 0xAB, INVALID_MODE = 0xAC, // LINKS //****** ERR_LINK_SPU_BLUE = 0x0200, //not used yet ERR_LINK_SPU_RED = 0x0201, //not used yet ERR_LINK_DPU = 0x0202, // error on link 1355 coming from DPU ERR_LINK_BOL = 0x0203, // error on link 1355 coming to DPU ERR_LINK_DEC_BLUE = 0x0204, //not used yet ERR_LINK_DEC_RED = 0x0205, //not used yet ERR_SMCS_DRIVER_COULD_NOT_CREATE_TIMER = 0x0210, // SEQUENCER //********** ERR_SEQUENCER_UNKNOWN_COMMAND = 0x0300, ERR_SEQUENCER_INVALID_PARAMETERS = 0x0301, // param out of range ERR_SEQUENCER_COMMAND_NOT_AVAILABLE_IN_THIS_MODE = 0x0302, ERR_SEQUENCER_SYNC_TIME_OUT = 0x0303, // timeout reached while waiting for a ramp/readout synchro ERR_SEQUENCER_TOO_MANY_NESTED_LOOPS = 0x0304, // too many nested loops in the sequence (maximum is 3) ERR_SEQUENCER_LOOP_END_OF_LOOP_MISMATCH = 0x0305, // too many END_OF_LOOP. ERR_SEQUENCER_COULD_NOT_EXECUTE_COMMAND = 0x0307, // an error occurred while executing the command ERR_SEQUENCER_INVALID_SID = 0x0308, ERR_SEQUENCER_UNKNOWN_MESSAGE_TYPE = 0x0310, // DPU RECEIVER //************* ERR_DPU_RECEIVER_UNKNOWN_MSG_TYPE = 0x0400, // received a packet with unknown header ERR_DPU_RECEIVER_TIME_OUT_ON_DUMP_BUFFER = 0x0410, // time-out while waiting that the DPU sender sends the last Dump packet // DPU SENDER //*********** ERR_DPU_SENDER_UNKNOWN_FIFO_MSG = 0x0510, // could not interprete FIFO message ERR_DPU_SENDER_UNRECOGNISED_ERROR_CODE = 0x0511, // received an error code not valid for this type of message // DEC RECEIVER //************* ERR_DEC_RECEIVER_INVALID_READOUT_INTERVAL = 0x0600, // readouts are not received at the right interval ERR_DEC_RECEIVER_INVALID_READOUT_COUNTER = 0x0601, // when readout counter is bigger than ReadoutsPerRamp // PACKET ENCODER //*************** ERR_PACKET_ENCODER_INVALID_READOUT_COUNTER = 0x0C00, // when readout counter is bigger than ReadoutsPerRamp // DET SIMULATOR //************** ERR_DET_SIMULATOR_COULD_NOT_CREATE_TIMER = 0x0710, // HK CONTROLLER //************** ERR_HK_INVALID_MEASURE_ID = 0x0800, ERR_HK_MEASURE_NOT_AVAILABLE_IN_DIAG_MODE = 0x0801, ERR_HK_COULD_NOT_CREATE_HK_TIMER = 0x0810, ERR_HK_DIAG_COULD_NOT_CREATE_HK_DIAG_TIMER = 0x0811, // DEC CONTROLER //************** ERR_DEC_CONTROLLER_LINK_NOT_CONNECTED = 0x0900, // unable to send a command to DEC when its link is not connected ERR_DEC_CONTROLLER_NO_RAMP_AFTER_RESET = 0x0901, // after a reset (write parameters), no ramp has been received (time-out reached) ERR_DEC_CONTROLLER_OTHER_CRE_ON = 0x0902, // trying to switch on a DEC while the other CREs are powered ON ERR_DEC_CONTROLLER_UNKNOWN_FIFO_MSG = 0x0910, // could not interprete FIFO message // BOL CONTROLER //************** ERR_BOL_CONTROLLER_LINK_NOT_CONNECTED = 0x0A00, // unable to send a command to BOLC when its link is not connected ERR_BOL_CONTROLLER_UNKNOWN_FIFO_MSG = 0x0A10, // could not interprete FIFO message // MECHANISMS_CONTROLLER //********************** ERR_MEC_CONTROLLER_ACCUMULATOR_OUT_OF_RANGE = 0x0B00, // pid controller accumulator overflow ERR_MEC_CONTROLLER_OUTPUT_OUT_OF_RANGE = 0x0B01, ERR_MEC_CONTROLLER_FOLLOWING_ERROR = 0x0B03, ERR_MEC_CONTROLLER_POWER_LIMIT_ERROR = 0x0B04, ERR_MEC_CONTROLLER_POSITION_ERROR = 0x0B05, ERR_CHOPPER_CONTROLLER_ERROR_BIT = 0x0010, ERR_GRATING_CONTROLLER_ERROR_BIT = 0x0020, ERR_FW_SPEC_CONTROLLER_ERROR_BIT = 0x0030, ERR_FW_PHOTO_CONTROLLER_ERROR_BIT = 0x0040, ERR_CS1_CONTROLLER_ERROR_BIT = 0x0050, ERR_CS2_CONTROLLER_ERROR_BIT = 0x0060, ERR_CHOPPER_CONTROLLER_ACCUMULATOR_OUT_OF_RANGE = 0x0B10, ERR_CHOPPER_CONTROLLER_OUTPUT_OUT_OF_RANGE = 0x0B11, ERR_CHOPPER_CONTROLLER_FOLLOWING_ERROR = 0x0B13, ERR_GRATING_CONTROLLER_ACCUMULATOR_OUT_OF_RANGE = 0x0B20, ERR_GRATING_CONTROLLER_OUTPUT_OUT_OF_RANGE = 0x0B21, ERR_GRATING_CONTROLLER_FOLLOWING_ERROR = 0x0B23, ERR_GRATING_CONTROLLER_POWER_LIMIT_ERROR = 0x0B24, ERR_FW_SPEC_CONTROLLER_ACCUMULATOR_OUT_OF_RANGE = 0x0B30, ERR_FW_SPEC_CONTROLLER_OUTPUT_OUT_OF_RANGE = 0x0B31, ERR_FW_SPEC_CONTROLLER_FOLLOWING_ERROR = 0x0B33, ERR_FW_PHOTO_CONTROLLER_ACCUMULATOR_OUT_OF_RANGE = 0x0B40, ERR_FW_PHOTO_CONTROLLER_OUTPUT_OUT_OF_RANGE = 0x0B41, ERR_FW_PHOTO_CONTROLLER_FOLLOWING_ERROR = 0x0B43, ERR_CS1_CONTROLLER_ACCUMULATOR_OUT_OF_RANGE = 0x0B50, ERR_CS1_CONTROLLER_OUTPUT_OUT_OF_RANGE = 0x0B51, ERR_CS1_CONTROLLER_FOLLOWING_ERROR = 0x0B53, ERR_CS2_CONTROLLER_ACCUMULATOR_OUT_OF_RANGE = 0x0B60, ERR_CS2_CONTROLLER_OUTPUT_OUT_OF_RANGE = 0x0B61, ERR_CS2_CONTROLLER_FOLLOWING_ERROR = 0x0B63, }; extern int AddErrorInBuffer(void* p_lastError); // these variables are declared here only for housekeeping ("hk_list.h") extern int gaLastErrorsBuffer[]; extern int gLastErrorsBufferIndex; #define SetGlobalError(newError) \ {\ int error = newError; \ KS_CriticalSection(AddErrorInBuffer, (void*)&error); \ } #define SetErrorIn(taskStatus, newError) \ {\ SetGlobalError(newError);\ LOCK_WRITE_RES_PARAMS;\ SET_BITS(taskStatus, K_BMASK_TASK_STATUS_ERROR_STATUS | K_BMASK_TASK_STATUS_ERROR_CODE, K_BMASK_TASK_STATUS_TASK_IN_ERROR + newError); \ UNLOCK_WRITE_RES_PARAMS;\ }