//============================================================================== /*! \file cmd_seq.c \brief This file hosts a big part of the command sequencer task, which receives telecommands from task tmtc. This file contains two functions: - function cmd_seq(), which is the "main" of the cmd_seq task, gets from the TC_QUEUE a message (containing reference to the TC_POOL memory block which hosts the TC packet), then calls the function TC_acceptance(), passing to it the pointer to the TC packet; - function TC_acceptance(), depending on type, subtype, fid and aid, performs the proper action, which can be of two types: 1) immediately execute the telecommand (for the so called "short telecommands"); 2) push a message in one of the two fifos LS_HDL_QUEUE, HS_HDL_QUEUE, triggering tasks ls_hdl, hs_hdl respectively. */ //============================================================================== //============================================================================== /*! \fn void cmd_seq (void) Main function of task cmd_seq; waits on the TC_QUEUE for a message to be available; when the message is read from the fifo, the pointer to the incoming TC packet (stored in a memory block of the TC_POOL) is passed to function TC_acceptance(); when control returns from that function, the TC_POOL block is freed. */ //============================================================================== //============================================================================== /*! \fn int TC_acceptance (TC_packet * packet) This function receives the pointer to the incoming TC packet; performs some acceptance checks on the incoming TC: CRC, length (packet_length field against # of octets received from the 1553), APID (only 1024 allowed); if any of these tests fails, the packet is rejected producing an acceptance failure TM packet. Then the function extracts from the TC packet type, subtype and, if necessary, FID and AID in order to command the action requested by the TC (this is most often accomplished by calling a function contained in file cmd_exec.c). Invalid values of any of type, subtype, FID, AID, result in the generation of an acceptance failure TM packet. */ //============================================================================== //============================================================================== /*! \fn int check_TC_length (TC_packet * packet) This function is called by task cmd_seq to verify that a received TC paket has a correct lenght. The OBS has a table (TC_len_tab) where the length (in bytes) of some of the TCs are stored. The function checks whether the TC paket is one of those stored in the table. If yes its lenght is checked against the lenght stored by the OBS and if the two do not match a value RC_FAIL is returned to signal that the tast wae not passed. If the two match or if the TC is not found in the length table a value RC_OK is returned to signal that the test was passed. */ //==============================================================================