/**
 * @file comms_sband_intf.h
 *
 * @brief This file has the control blocks, enumeration and function prototypes of SDR control layer of S-Band module
 *
 * @copyright Copyright 2023 Antaris, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#ifndef COMMS_SBAND_INTF_H
#define COMMS_SBAND_INTF_H
#define SBAND_REINIT_TMR 5 * 60 * 1000

#ifdef __cplusplus
extern "C" {
#endif


/**
* @brief This function config the tx parameter into the comms module
*
* @param[in] tx_cfg : Transmit config
*
* @return sts : status of transmit
*/
e_comms_tx_cfg_sts comms_tx_cfg(s_comms_tx_cfg tx_cfg);

/**
* @brief This function config the rx parameter into the comms module
*
* @param[in] rx_cfg : Receive config
*
* @return sts : status of receive
*/
e_comms_rx_cfg_sts comms_rx_cfg(s_comms_rx_cfg rx_cfg);

/**
* @brief This function config the sys parameter into the comms module
*
* @param[in] sys_cfg : comms sys config
*
* @return sts : status of sys
*/
e_comms_sys_cfg_sts comms_sys_cfg(s_comms_sys_cfg sys_cfg);

/**
* @brief This function reset the comms modeule
*
* @return sts : status of reset
*/
e_comms_reset_sts comms_reset(void);

/**
* @brief This function check the boot for various parameter and initialize
*  respective boot mode
*
* @param[in] mode : comms boot mode
*
* @return sts : status of initialize boot
*/
e_comms_boot_cfg_sts comms_boot_cfg(e_comms_boot_mode mode);

/**
* @brief This function trigger the calibration of the comms module based
* on the configured calibration parameter
*
* @param[in] type : comms calibrate type
*
* @return sts : status of triggered calib comms module
*/
e_comms_calib_trgr_sts comms_calib_trgr(e_comms_calib_type type);

/**
* @brief This function enables the type of tx_rx mode of the comms module
*
* @param[in] mode : comms tx_rx mode
*
* @return sts : status of enabled tx_rx mode type
*/
e_comms_tx_rx_enbl_sts comms_tx_rx_enbl(e_comms_tx_rx_mode mode);

/**
* @brief This function config the tx parameter into the comms module
*
* @param[in] params : pointer to u8
*
* @return sts : status of comms triggered dfu
*/
e_comms_dfu_trgr_sts comms_dfu_trg(u8 *params);

/**
* @brief This function read the telemetry into comms module
*
* @param[in] type : comms telemetry type
*
* @return sts : status
*/
e_comms_read_tm_sts comms_read_tm(e_comms_tm_type type);

/**
* @brief This function config the tx parameter into the comms module
*
* @param[in] tx_cfg : Transmit config
*
* @return sts : status of transmit
*/
e_comms_tx_cfg_sts comms_set_tx_cfg(s_comms_tx_cfg *tx_cfg);

/**
* @brief This function config the rx parameter into the comms module
*
* @param[in] rx_cfg : Receive config
*
* @return sts : status of receive
*/
e_comms_rx_cfg_sts comms_set_rx_cfg(s_comms_rx_cfg *rx_cfg);

/**
* @brief This function get the comms transmit configuration.
*
* @param tx_cfg : pointer to Transmit config
* @param size : pointer to size of transmit message
*
* @return status of get tx config
*/
e_comms_tx_cfg_sts comms_get_tx_cfg(s_comms_tx_cfg *tx_cfg, uint16_t *size);

/**
* @brief This function get the comms receive configuration.
*
* @param rx_cfg : pointer to receive config
* @param size : pointer to size of receive message
*
* @return status of get rx config
*/
e_comms_rx_cfg_sts comms_get_rx_cfg(s_comms_rx_cfg *rx_cfg, uint16_t *size);

/**
* @brief This function set the comms system configuration.
*
* @param sys_cfg : pointer to system config
*
* @return status of set system config
*/
e_comms_sys_cfg_sts comms_set_sys_cfg(s_comms_sys_cfg *sys_cfg);

/**
* @brief This function get the comms system configuration.
*
* @param sys_cfg : pointer to system config
* @param size : pointer to size of system message
*
* @return status of get system config
*/
e_comms_sys_cfg_sts comms_get_sys_cfg(s_comms_sys_cfg *sys_cfg, uint16_t* size);

int8_t sdr_app_sdr_ctrl_sband_mh_req(void *pld);
int8_t sdr_app_sdr_ctrl_sband_sdr_cfg_req(void *pld);
int8_t sdr_app_sdr_ctrl_sband_mode_cfg_req(void *pld);
int8_t sdr_app_sdr_ctrl_sband_tmr_cfg_req(void *pld);
int8_t sdr_app_sdr_ctrl_sband_rssi_cfg_req(void *pld);
int8_t sdr_app_sdr_ctrl_sband_tm_cfg_req(void *pld);
int8_t sdr_app_sdr_ctrl_sband_sens_cfg_req(void *pld);
int8_t sdr_app_sdr_ctrl_sband_sdr_gpass_cfg_req(void *pld);




int8_t comms_tctm_hdlr(uint8_t radio_id, uint16_t msg_id, void *pld_ptr,uint16_t pld_len);
void comms_srs4_tctm_hdlr(uint16_t msg_id,uint16_t pld_len, void *pld_ptr);
void comms_xlink_s_tctm_hdlr(uint16_t msg_id,uint16_t pld_len, void *pld_ptr);
void comms_sband_initial_sync_hdlr(uint8_t *tc_tm_data);
void comms_sband_rssi_hdlr(uint16_t event_id);
int8_t comms_sband_rx_switch(void);
float comms_xlink_s_get_rssi(uint8_t rcv_ch_no);
float comms_xlink_s_get_avg_rssi(uint8_t rcv_ch_no);
float comms_sband_get_avg_rssi(uint8_t rx);
uint8_t comms_sband_rx_get_sync_state(uint8_t rcv_ch_no);
uint8_t comms_sband_proc_fw_cfg(void);
uint8_t comms_sband_get_curr_rx(void);
uint8_t comms_sband_xlink_tx_cpy(void);
uint8_t comms_sband_xlink_rx_cpy(void);
uint8_t comms_sband_proc_fw_cfg_upd(uint8_t *pld);
uint8_t comms_sband_rx_port_sel_enb(uint8_t rx_sel);
uint8_t comms_sband_rx_port_sel_dsb(void);
void sband_xlinks_health_check(void);
uint8 	sband_get_state_X(void);
uint8_t comms_sband_get_vers(void);
void comms_sband_switch_rx_cfg(void);
void comms_sband_reset_rssi_proc(void);

#ifdef __cplusplus
}
#endif
#endif /*COMMS_CSW_H */
