//================================================================================================ /*! \file hs1.c \brief receives a FIFO frame from hs0, process the data, and pass a SD_PKT to datapack This module implements task hs1. This task waits on the virtuoso FRAME_QUEUE which is filled by hs0. Specifically hs0 puts a nessage in the queue as soon as a whole FIFO frame has been acquired. In the message hs1 can find the fifo_id of the block where the data are stored. From the fifo_id hs1 understands in which of the two possibles hifi_pools (WBS or HRS) the data are stored. The hs1 module process the frames and specifically: makes basic processing (like reordering of the data or masking) of the HK and of the SD. Make coaddition where necessary. Eventually it writes the HK data in the HK handler for delivery to HK _ask task, and, if the coadditions are over (as can be known by calling function complete_pkt) sends the SD to Data_hdl. The SD are send by writing them in a block from the SD_POOL and by sending a message to the SD_PKT_QUEUE. */ //================================================================================================ /*! \fn void hs1( void ); Waits for the packet, pass the packet to the processing functions, signals to data_hdl that a frame has been recived and updates th counters that allow to determine to which buffer the next frame shall be coadded */ //================================================================================================ /*! \fn void init_hs1 (void) Inits the static variable of the file. Allocates a block for each fifo and for each buffer. */ //================================================================================================ /*! \fn void reset_hs1 (void) Inits the static variable of the file. */ //================================================================================================ /*! \fn void update_counters(int fifo_id) Updates the counters that keep track, for each fifo, of the number of frames already processed within this measurement. This is necessary in slow chop and in frequency switch measurements in order to know to which buffer (phase) each frame belongs */ //================================================================================================ /*! \fn void fast_chop_update_counters (int fifo_id) Updates the counters that keep track, for each fifo, of the number of frames already processed within this measurement. This function is to be used during fast chop only. */ //================================================================================================ /*! \fn void process_fifo(unsigned int fifo_id, int block_nr); Detects what is the pool where the FIFO data are stored, process the data, frees the pool block and checks whether all the coadditions have been done for this fifo, by calling a service of the data_hdl module (complete_pkt). If yes delivers the frame to data_hdl by pushing a packet in the SD queue. */ //================================================================================================ /*! \fn void process_hk_frame(int fifo_id, int* pdata, unsigned int * scan_count); Checks what is the current instrument (HRS or WBS) and calls the appropriate function for processing the science data of the frame. */ //================================================================================================ /*! \fn void process_sd_frame(int fifo_id, int *pdata); Checks what is the current measurement running and calls the appropriate function for processing the housekeeping data of the frame. */ //================================================================================================ /*! \fn void total_power(int fifo_id, int *pdata); Implements a total power measurement. Checks what is the current instrument (HRS or WBS) and calls the appropriate processing function. */ //================================================================================================ /*! \fn void total_power_wbs(int fifo_id, int *source); Total power processing for WBS */ //================================================================================================ /*! \fn void total_power_hrs(int fifo_id, int *source); Total power processing for HRS */ //================================================================================================ /*! \fn void deliver_sd_packet( int fifo_id, unsigned int scan_count); Sends a message to data_hdl by means of the SD_PKT_QUEUE, with the coordinates of block of the SD_POOL where the last processed SD can be found. Allocates a new block from the SD_POOL. */ //================================================================================================ /*! \fn void deliver_frame_completed_pkt (int fifo_id) Puts a special packet into the sd queue in order to force data_hdl to decrease the pending frames counters for the relative fifo. */