/**
 * @file comms_sband_srs4_tctm_hdlr.c
 *
 * @brief This file has the S-Band driver FSM implemenation and the relevant functions
 *
 * @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.
 *
 */
/*********************************************************************/

#include <stdio.h>
#include "sm_api.h"
#include "comms_sband_sim.h"
#include "comms_sband_init.h"
#include "comms_ipc.h"
#include "comms_csw.h"
#include "exo_common.h"
#include "comms_sband_rx.h"
#include "comms_sband_csp.h"
#include "tc_tm_mngr.h"
#ifdef S_BAND_SIM_CB
#include "comms_sband_sim.h"
#endif
#include "comms_sband_intf.h"
#include "logger.h"
#include "comms_sband_api_map.h"
#include "obc_tc_tm.h"
#include "comms_sband_intf.h"
#include "exo_tctm_ipc.h"


/** S_Band driver configuration readback */
extern s_comms_tx_cfg PLACE_IN_EXT_RAM_MEM tx_cfg_rb; ///< S-Band TX configuration ringbuffer
extern s_comms_rx_cfg PLACE_IN_EXT_RAM_MEM rx_cfg_rb; ///< S-Band RX configuration ringbuffer

extern uint8_t PLACE_IN_EXT_RAM_MEM comms_csw_rx_buf[512]; ///< S-Band RX buffer

/**
 * @brief Handle SRS-4 TC/TM message.
 * 
 * Parses SRS-4 TC/TM packet and handles based on message type:
 * - TC: Validates sequence and issues command to subsystem.
 * - TM: Stores packet in telemetry buffer.
 * 
 * Performs sanity checks on packet:
 * - Valid message type 
 * - Correct length for message type
 * - Valid TC sequence number
 *
 * @param[in] msg_id Message ID (TC or TM).
 * @param[in] pld_len Payload length in bytes.
 * @param[in] pld_ptr Pointer to packet payload.
 */
void comms_srs4_tctm_hdlr(uint16_t msg_id,uint16_t pld_len, void *pld_ptr)
{
#ifdef SDR_SBAND_SRS4
    uint8_t *tc_tm_data;
    uint8_t status = 0;
    tc_tm_data = (uint8*)pld_ptr;

    //int8_t status = COMMS_IPC_OK;
    uint16_t rx_size = 0;

    uint16_t group = 0;
    uint8_t fallback = 0;


    switch(msg_id)
    {
        case TC_SBAND_GET_TM_STORE:

            break;

        case TC_SET_COMMS_TX_CFG:
            status = comms_set_tx_cfg((s_comms_tx_cfg *)&tc_tm_data[TC_PLD_IDX]);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_TX_CFG, status,tc_tm_data);
            break;

        case TC_SET_COMMS_RX_CFG:
            status = comms_set_rx_cfg((s_comms_rx_cfg *)&tc_tm_data[TC_PLD_IDX]);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_RX_CFG, status,tc_tm_data);
            break;

        case TC_SET_COMMS_SYS_CFG:
            status = comms_set_sys_cfg((s_comms_sys_cfg *)&tc_tm_data[TC_PLD_IDX]);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_SYS_CFG, status,tc_tm_data);
            break;

        case TC_GET_COMMS_TX_CFG:
            status = comms_get_tx_cfg((s_comms_tx_cfg *)&comms_csw_rx_buf[TM_PLD_IDX],&rx_size);
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TX_CFG, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_CFG:
            status = comms_get_rx_cfg((s_comms_rx_cfg *)&comms_csw_rx_buf[TM_PLD_IDX],&rx_size);
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_CFG, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_SYS_CFG:
            status = comms_get_sys_cfg((s_comms_sys_cfg *)&comms_csw_rx_buf[TM_PLD_IDX],&rx_size);
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_SYS_CFG, status,tc_tm_data, rx_size);
            break;

        case TC_SET_COMMS_TX_CFG_FREQ:
            os_memcpy(&tx_cfg_global.tx_cfg_freq, &tc_tm_data[TC_PLD_IDX], sizeof(tx_cfg_global.tx_cfg_freq));
            status = SDR_SBAND_SET_TX_CFG_FREQ(tx_cfg_global.tx_cfg_freq);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_TX_CFG_FREQ, status,tc_tm_data);
            break;

        case TC_SET_COMMS_TX_CFG_TYPE:
            os_memcpy(&tx_cfg_global.tx_cfg_type, &tc_tm_data[TC_PLD_IDX], sizeof(tx_cfg_global.tx_cfg_type));
            status = SDR_SBAND_SET_TX_CFG_TYPE(tx_cfg_global.tx_cfg_type);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_TX_CFG_TYPE, status,tc_tm_data);
            break;

        case TC_SET_COMMS_TX_CFG_RATE:
            os_memcpy(&tx_cfg_global.tx_cfg_rate, &tc_tm_data[TC_PLD_IDX], sizeof(tx_cfg_global.tx_cfg_rate));
            status = SDR_SBAND_SET_TX_CFG_RATE(tx_cfg_global.tx_cfg_rate);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_TX_CFG_RATE, status,tc_tm_data);
            break;

        case TC_SET_COMMS_TX_CFG_ROLLOFF:
            os_memcpy(&tx_cfg_global.tx_cfg_rolloff, &tc_tm_data[TC_PLD_IDX], sizeof(tx_cfg_global.tx_cfg_rolloff));
            status = SDR_SBAND_SET_TX_CFG_ROLLOFF(tx_cfg_global.tx_cfg_rolloff);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_TX_CFG_ROLLOFF, status,tc_tm_data);
            break;

        case TC_SET_COMMS_TX_CFG_POUT:

            os_memcpy(&tx_cfg_global.tx_cfg_pout, &tc_tm_data[TC_PLD_IDX], sizeof(tx_cfg_global.tx_cfg_pout));
            DEBUG_CPRINT(("tx_cfg_global.tx_cfg_pout : %f",tx_cfg_global.tx_cfg_pout));
            log_id_with_float(LOG_INFO_L2,LOG_COMMS,TX_CFG_GLOBAL_TX_CFG_POUT_u32,tx_cfg_global.tx_cfg_pout);
            status = SDR_SBAND_SET_TX_CFG_POUT(tx_cfg_global.tx_cfg_pout);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_TX_CFG_POUT, status,tc_tm_data);
            break;

        case TC_SET_COMMS_TX_CFG_ALC_MODE:
            os_memcpy(&tx_cfg_global.tx_cfg_alc_mode, &tc_tm_data[TC_PLD_IDX], sizeof(tx_cfg_global.tx_cfg_alc_mode));
            status = SDR_SBAND_SET_TX_CFG_ALC_MODE(tx_cfg_global.tx_cfg_alc_mode);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_TX_CFG_ALC_MODE, status,tc_tm_data);
            break;

        case TC_SET_COMMS_TX_CFG_RS:
            os_memcpy(&tx_cfg_global.tx_cfg_rs, &tc_tm_data[TC_PLD_IDX], sizeof(tx_cfg_global.tx_cfg_rs));
            status = SDR_SBAND_SET_TX_CFG_RS(tx_cfg_global.tx_cfg_rs);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_TX_CFG_RS, status,tc_tm_data);
            break;

        case TC_SET_COMMS_TX_CFG_CC:
            os_memcpy(&tx_cfg_global.tx_cfg_cc, &tc_tm_data[TC_PLD_IDX], sizeof(tx_cfg_global.tx_cfg_cc));
            status = SDR_SBAND_SET_TX_CFG_CC(tx_cfg_global.tx_cfg_cc);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_TX_CFG_CC, status,tc_tm_data);
            break;

        case TC_SET_COMMS_TX_CFG_RAND:
            os_memcpy(&tx_cfg_global.tx_cfg_rand, &tc_tm_data[TC_PLD_IDX], sizeof(tx_cfg_global.tx_cfg_rand));
            status = SDR_SBAND_SET_TX_CFG_RAND(tx_cfg_global.tx_cfg_rand);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_TX_CFG_RAND, status,tc_tm_data);
            break;

        case TC_SET_COMMS_TX_CFG_CRC:
            os_memcpy(&tx_cfg_global.tx_cfg_crc, &tc_tm_data[TC_PLD_IDX], sizeof(tx_cfg_global.tx_cfg_crc));
            status = SDR_SBAND_SET_TX_CFG_CRC(tx_cfg_global.tx_cfg_crc);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_TX_CFG_CRC, status,tc_tm_data);
            break;

        case TC_SET_COMMS_TX_CFG_IDLETIME:
            os_memcpy(&tx_cfg_global.tx_cfg_idletime, &tc_tm_data[TC_PLD_IDX], sizeof(tx_cfg_global.tx_cfg_idletime));
            status = SDR_SBAND_SET_TX_CFG_IDLETIME(tx_cfg_global.tx_cfg_idletime);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_TX_CFG_IDLETIME, status,tc_tm_data);
            break;

        case TC_SET_COMMS_TX_CFG_SIZE:
            os_memcpy(&tx_cfg_global.tx_cfg_size, &tc_tm_data[TC_PLD_IDX], sizeof(tx_cfg_global.tx_cfg_size));
            status = SDR_SBAND_SET_TX_CFG_SIZE(tx_cfg_global.tx_cfg_size);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_TX_CFG_SIZE, status,tc_tm_data);
            break;

        case TC_SET_COMMS_TX_CFG_ID:
            os_memcpy(&tx_cfg_global.tx_cfg_id, &tc_tm_data[TC_PLD_IDX], sizeof(tx_cfg_global.tx_cfg_id));
            status = SDR_SBAND_SET_TX_CFG_ID(tx_cfg_global.tx_cfg_id);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_TX_CFG_ID, status,tc_tm_data);
            break;

        case TC_SET_COMMS_TX_CFG_CRYPTO:
            os_memcpy(&tx_cfg_global.crypto_cfg, &tc_tm_data[TC_PLD_IDX], sizeof(s_comms_tx_crypto_cfg));
            status = SDR_SBAND_SET_TX_CFG_CRYPTO((s_comms_tx_crypto_cfg *)&tc_tm_data[TC_PLD_IDX]);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_TX_CFG_CRYPTO, status,tc_tm_data);
            break;

        case TC_SET_COMMS_TX_CFG_PA_TEMPLIMIT:
            os_memcpy(&tx_cfg_global.tx_cfg_pa_templimit, &tc_tm_data[TC_PLD_IDX], sizeof(tx_cfg_global.tx_cfg_pa_templimit));
            status = SDR_SBAND_SET_TX_CFG_PA_TEMPLIMIT(tx_cfg_global.tx_cfg_pa_templimit);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_TX_CFG_PA_TEMPLIMIT, status,tc_tm_data);
            break;

        case TC_SET_COMMS_RX_CFG_FREQ:
            os_memcpy(&rx_cfg_global.rx_cfg_freq, &tc_tm_data[TC_PLD_IDX], sizeof(rx_cfg_global.rx_cfg_freq));
            status = SDR_SBAND_SET_RX_CFG_FREQ(rx_cfg_global.rx_cfg_freq);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_RX_CFG_FREQ, status,tc_tm_data);
            break;

        case TC_SET_COMMS_RX_CFG_TYPE:
            os_memcpy(&rx_cfg_global.rx_cfg_type, &tc_tm_data[TC_PLD_IDX], sizeof(rx_cfg_global.rx_cfg_type));
            status = SDR_SBAND_SET_RX_CFG_TYPE(rx_cfg_global.rx_cfg_type);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_RX_CFG_TYPE, status,tc_tm_data);
            break;

        case TC_SET_COMMS_RX_CFG_RATE:
            os_memcpy(&rx_cfg_global.rx_cfg_rate, &tc_tm_data[TC_PLD_IDX], sizeof(rx_cfg_global.rx_cfg_rate));
            status = SDR_SBAND_SET_RX_CFG_RATE(rx_cfg_global.rx_cfg_rate);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_RX_CFG_RATE, status,tc_tm_data);
            break;

        case TC_SET_COMMS_RX_CFG_ROLLOFF:
            os_memcpy(&rx_cfg_global.rx_cfg_rolloff, &tc_tm_data[TC_PLD_IDX], sizeof(rx_cfg_global.rx_cfg_rolloff));
            status = SDR_SBAND_SET_RX_CFG_ROLLOFF(rx_cfg_global.rx_cfg_rolloff);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_RX_CFG_ROLLOFF, status,tc_tm_data);
            break;

        case TC_SET_COMMS_RX_CFG_AFC:
            os_memcpy(&rx_cfg_global.afc_cfg, &tc_tm_data[TC_PLD_IDX], sizeof(s_comms_rx_afc_cfg));
            status = SDR_SBAND_SET_RX_CFG_AFC((s_comms_rx_afc_cfg *)&tc_tm_data[TC_PLD_IDX]);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_RX_CFG_AFC, status,tc_tm_data);
            break;

        case TC_SET_COMMS_RX_CFG_RS:
            os_memcpy(&rx_cfg_global.rx_cfg_rs, &tc_tm_data[TC_PLD_IDX], sizeof(rx_cfg_global.rx_cfg_rs));
            status = SDR_SBAND_SET_RX_CFG_RS(rx_cfg_global.rx_cfg_rs);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_RX_CFG_RS, status,tc_tm_data);
            break;

        case TC_SET_COMMS_RX_CFG_CC:
            os_memcpy(&rx_cfg_global.rx_cfg_cc, &tc_tm_data[TC_PLD_IDX], sizeof(rx_cfg_global.rx_cfg_cc));
            status = SDR_SBAND_SET_RX_CFG_CC(rx_cfg_global.rx_cfg_cc);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_RX_CFG_CC, status,tc_tm_data);
            break;

        case TC_SET_COMMS_RX_CFG_RAND:
            os_memcpy(&rx_cfg_global.rx_cfg_rand, &tc_tm_data[TC_PLD_IDX], sizeof(rx_cfg_global.rx_cfg_rand));
            status = SDR_SBAND_SET_RX_CFG_RAND(rx_cfg_global.rx_cfg_rand);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_RX_CFG_RAND, status,tc_tm_data);

            break;

        case TC_SET_COMMS_RX_CFG_CRC:
            os_memcpy(&rx_cfg_global.rx_cfg_crc, &tc_tm_data[TC_PLD_IDX], sizeof(rx_cfg_global.rx_cfg_crc));
            status = SDR_SBAND_SET_RX_CFG_CRC(rx_cfg_global.rx_cfg_crc);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_RX_CFG_CRC, status,tc_tm_data);
            break;

        case TC_SET_COMMS_RX_CFG_SIZE:
            os_memcpy(&rx_cfg_global.rx_cfg_size, &tc_tm_data[TC_PLD_IDX], sizeof(rx_cfg_global.rx_cfg_size));
            status = SDR_SBAND_SET_RX_CFG_SIZE(rx_cfg_global.rx_cfg_size);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_RX_CFG_SIZE, status,tc_tm_data);

            break;

        case TC_SET_COMMS_RX_CFG_ID:
            os_memcpy(&rx_cfg_global.rx_cfg_id, &tc_tm_data[TC_PLD_IDX], sizeof(rx_cfg_global.rx_cfg_id));
            status = SDR_SBAND_SET_RX_CFG_ID(rx_cfg_global.rx_cfg_id);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_RX_CFG_ID, status,tc_tm_data);
            break;

        case TC_SET_COMMS_RX_CFG_CRYPTO:
            os_memcpy(&rx_cfg_global.crypto_cfg, &tc_tm_data[TC_PLD_IDX], sizeof(s_comms_rx_crypto_cfg));
            status = SDR_SBAND_SET_RX_CFG_CRYPTO((s_comms_rx_crypto_cfg *)&tc_tm_data[TC_PLD_IDX+1]);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_RX_CFG_CRYPTO, status,tc_tm_data);
            break;

            /*	case TC_SET_COMMS_SYS_NAME:
                os_memcpy(&sys_cfg_global.sys_name, &tc_tm_data[TC_PLD_IDX], sizeof(sys_cfg_global.sys_name));
                status = SDR_SBAND_SET_SYS_CFG_NAME(sys_cfg_global.sys_name);
                comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_SYS_NAME, status,tc_tm_data);
                break;*/

        case TC_SET_COMMS_BOOT_CFG:
            os_memcpy(&sys_cfg_global.boot_cfg, &tc_tm_data[TC_PLD_IDX], sizeof(s_comms_boot_cfg));
            status = SDR_SBAND_SET_SYS_CFG_BOOT_CFG((s_comms_boot_cfg *)&tc_tm_data[TC_PLD_IDX]);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_BOOT_CFG, status,tc_tm_data);
            break;

        case TC_SET_COMMS_GWDT_CFG:
            os_memcpy(&sys_cfg_global.gwdt_cfg, &tc_tm_data[TC_PLD_IDX], sizeof(s_comms_gwdt_cfg));
            status = SDR_SBAND_SET_SYS_CFG_GWDT_CFG((s_comms_gwdt_cfg *)&tc_tm_data[TC_PLD_IDX]);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_GWDT_CFG, status,tc_tm_data);
            break;

        case TC_SET_COMMS_CAN_CFG:
            os_memcpy(&sys_cfg_global.can_cfg, &tc_tm_data[TC_PLD_IDX], sizeof(s_comms_can_cfg));
            status = SDR_SBAND_SET_SYS_CFG_CAN_CFG((s_comms_can_cfg *)&tc_tm_data[TC_PLD_IDX]);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_CAN_CFG, status,tc_tm_data);
            break;

        case TC_SET_COMMS_UART_CFG:
            os_memcpy(&sys_cfg_global.uart_cfg, &tc_tm_data[TC_PLD_IDX], sizeof(s_comms_uart_cfg));
            status = SDR_SBAND_SET_SYS_CFG_UART_CFG((s_comms_uart_cfg *)&tc_tm_data[TC_PLD_IDX]);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_UART_CFG, status,tc_tm_data);
            break;

        case TC_SET_COMMS_CSP_CFG:
            os_memcpy(&sys_cfg_global.csp_cfg, &tc_tm_data[TC_PLD_IDX], sizeof(s_comms_csp_cfg));
            status = SDR_SBAND_SET_SYS_CFG_CSP_CFG((s_comms_csp_cfg *)&tc_tm_data[TC_PLD_IDX]);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_CSP_CFG, status,tc_tm_data);
            break;

        case TC_SET_COMMS_NET_CFG:
            os_memcpy(&sys_cfg_global.net_cfg, &tc_tm_data[TC_PLD_IDX], sizeof(s_comms_net_cfg));
            status = SDR_SBAND_SET_SYS_CFG_NET_CFG((s_comms_net_cfg *)&tc_tm_data[TC_PLD_IDX+4]);
            comms_tc_tm_set_rsp_hdlr(TM_SET_COMMS_NET_CFG, status,tc_tm_data);
            break;

        case TC_GET_COMMS_TX_CFG_FREQ:
            status = SDR_SBAND_GET_TX_CFG_FREQ(tx_cfg_rb.tx_cfg_freq,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&tx_cfg_rb.tx_cfg_freq, sizeof(tx_cfg_rb.tx_cfg_freq));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TX_CFG_FREQ, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_TX_CFG_TYPE:
            status = SDR_SBAND_GET_TX_CFG_TYPE(tx_cfg_rb.tx_cfg_type, &rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&tx_cfg_rb.tx_cfg_type, sizeof(tx_cfg_rb.tx_cfg_type));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TX_CFG_TYPE, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_TX_CFG_RATE:
            status = SDR_SBAND_GET_TX_CFG_RATE(tx_cfg_rb.tx_cfg_rate,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&tx_cfg_rb.tx_cfg_rate, sizeof(tx_cfg_rb.tx_cfg_rate));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TX_CFG_RATE, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_TX_CFG_ROLLOFF:
            status = SDR_SBAND_GET_TX_CFG_ROLLOFF(tx_cfg_rb.tx_cfg_rolloff,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&tx_cfg_rb.tx_cfg_rolloff, sizeof(tx_cfg_rb.tx_cfg_rolloff));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TX_CFG_ROLLOFF, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_TX_CFG_POUT:
            status = SDR_SBAND_GET_TX_CFG_POUT(tx_cfg_rb.tx_cfg_pout,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&tx_cfg_rb.tx_cfg_pout, sizeof(tx_cfg_rb.tx_cfg_pout));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TX_CFG_POUT, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_TX_CFG_ALC_MODE:
            status = SDR_SBAND_GET_TX_CFG_ALC_MODE(tx_cfg_rb.tx_cfg_alc_mode,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&tx_cfg_rb.tx_cfg_alc_mode, sizeof(tx_cfg_rb.tx_cfg_alc_mode));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TX_CFG_ALC_MODE, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_TX_CFG_RS:
            status = SDR_SBAND_GET_TX_CFG_RS(tx_cfg_rb.tx_cfg_rs,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&tx_cfg_rb.tx_cfg_rs, sizeof(tx_cfg_rb.tx_cfg_rs));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TX_CFG_RS, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_TX_CFG_CC:
            status = SDR_SBAND_GET_TX_CFG_CC(tx_cfg_rb.tx_cfg_cc,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&tx_cfg_rb.tx_cfg_cc, sizeof(tx_cfg_rb.tx_cfg_cc));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TX_CFG_CC, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_TX_CFG_RAND:
            status = SDR_SBAND_GET_TX_CFG_RAND(tx_cfg_rb.tx_cfg_rand,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&tx_cfg_rb.tx_cfg_rand, sizeof(tx_cfg_rb.tx_cfg_rand));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TX_CFG_RAND, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_TX_CFG_CRC:
            status = SDR_SBAND_GET_TX_CFG_CRC(tx_cfg_rb.tx_cfg_crc,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&tx_cfg_rb.tx_cfg_crc, sizeof(tx_cfg_rb.tx_cfg_crc));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TX_CFG_CRC, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_TX_CFG_IDLETIME:
            status = SDR_SBAND_GET_TX_CFG_IDLETIME(tx_cfg_rb.tx_cfg_idletime,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&tx_cfg_rb.tx_cfg_idletime, sizeof(tx_cfg_rb.tx_cfg_idletime));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TX_CFG_IDLETIME, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_TX_CFG_SIZE:
            status = SDR_SBAND_GET_TX_CFG_SIZE(tx_cfg_rb.tx_cfg_size,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&tx_cfg_rb.tx_cfg_size, sizeof(tx_cfg_rb.tx_cfg_size));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TX_CFG_SIZE, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_TX_CFG_ID:
            status = SDR_SBAND_GET_TX_CFG_ID(tx_cfg_rb.tx_cfg_id,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&tx_cfg_rb.tx_cfg_id, sizeof(tx_cfg_rb.tx_cfg_id));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TX_CFG_ID, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_TX_CFG_CRYPTO:
            status = SDR_SBAND_GET_TX_CFG_CRYPTO((s_comms_tx_crypto_cfg *)&comms_csw_rx_buf[TM_PLD_IDX],&rx_size);
            rx_size = sizeof(s_comms_tx_crypto_cfg);
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TX_CFG_CRYPTO, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_TX_CFG_PA_TEMPLIMIT:
            status = SDR_SBAND_GET_TX_CFG_PA_TEMPLIMIT(tx_cfg_rb.tx_cfg_pa_templimit,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&tx_cfg_rb.tx_cfg_pa_templimit, sizeof(tx_cfg_rb.tx_cfg_pa_templimit));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TX_CFG_PA_TEMPLIMIT, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_TX_CFG_FRAMES:
            status = SDR_SBAND_GET_TX_CFG_FRAMES(tx_cfg_rb.tx_cfg_frames,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&tx_cfg_rb.tx_cfg_frames, sizeof(tx_cfg_rb.tx_cfg_frames));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TX_CFG_FRAMES, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_TX_CFG_PWR_FWD:
            status = SDR_SBAND_GET_TX_CFG_PWR_FWD(tx_cfg_rb.tx_cfg_pwr_fwd,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&tx_cfg_rb.tx_cfg_pwr_fwd, sizeof(tx_cfg_rb.tx_cfg_pwr_fwd));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TX_CFG_PWR_FWD, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_TX_CFG_PWR_RFL:
            status = SDR_SBAND_GET_TX_CFG_PWR_RFL(tx_cfg_rb.tx_cfg_pwr_rfl,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&tx_cfg_rb.tx_cfg_pwr_rfl, sizeof(tx_cfg_rb.tx_cfg_pwr_rfl));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TX_CFG_PWR_RFL, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_CFG_FREQ:
            status = SDR_SBAND_GET_RX_CFG_FREQ(rx_cfg_rb.rx_cfg_freq,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&rx_cfg_rb.rx_cfg_freq, sizeof(rx_cfg_rb.rx_cfg_freq));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_CFG_FREQ, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_CFG_TYPE:
            status = SDR_SBAND_GET_RX_CFG_TYPE(rx_cfg_rb.rx_cfg_type,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&rx_cfg_rb.rx_cfg_type, sizeof(rx_cfg_rb.rx_cfg_type));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_CFG_TYPE, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_CFG_RATE:
            status = SDR_SBAND_GET_RX_CFG_RATE(rx_cfg_rb.rx_cfg_rate,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&rx_cfg_rb.rx_cfg_rate, sizeof(rx_cfg_rb.rx_cfg_rate));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_CFG_RATE, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_CFG_ROLLOFF:
            status = SDR_SBAND_GET_RX_CFG_ROLLOFF(rx_cfg_rb.rx_cfg_rolloff,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&rx_cfg_rb.rx_cfg_rolloff, sizeof(rx_cfg_rb.rx_cfg_rolloff));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_CFG_ROLLOFF, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_CFG_AFC:
            status = SDR_SBAND_GET_RX_CFG_AFC((s_comms_rx_afc_cfg *)&comms_csw_rx_buf[TM_PLD_IDX],&rx_size);
            rx_size = sizeof(s_comms_rx_afc_cfg);
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_CFG_AFC, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_CFG_RS:
            status = SDR_SBAND_GET_RX_CFG_RS(rx_cfg_rb.rx_cfg_rs,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&rx_cfg_rb.rx_cfg_rs, sizeof(rx_cfg_rb.rx_cfg_rs));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_CFG_RS, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_CFG_CC:
            status = SDR_SBAND_GET_RX_CFG_CC(rx_cfg_rb.rx_cfg_cc,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&rx_cfg_rb.rx_cfg_cc, sizeof(rx_cfg_rb.rx_cfg_cc));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_CFG_CC, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_CFG_RAND:
            status = SDR_SBAND_GET_RX_CFG_RAND(rx_cfg_rb.rx_cfg_rand,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&rx_cfg_rb.rx_cfg_rand, sizeof(rx_cfg_rb.rx_cfg_rand));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_CFG_RAND, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_CFG_CRC:
            status = SDR_SBAND_GET_RX_CFG_CRC(rx_cfg_rb.rx_cfg_crc,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&rx_cfg_rb.rx_cfg_crc, sizeof(rx_cfg_rb.rx_cfg_crc));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_CFG_CRC, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_CFG_SIZE:
            status = SDR_SBAND_GET_RX_CFG_SIZE(rx_cfg_rb.rx_cfg_size,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&rx_cfg_rb.rx_cfg_size, sizeof(rx_cfg_rb.rx_cfg_size));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_CFG_SIZE, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_CFG_ID:
            status = SDR_SBAND_GET_RX_CFG_ID(rx_cfg_rb.rx_cfg_id,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&rx_cfg_rb.rx_cfg_id, sizeof(rx_cfg_rb.rx_cfg_id));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_CFG_ID, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_CFG_CRYPTO:
            status = SDR_SBAND_GET_RX_CFG_CRYPTO((s_comms_rx_crypto_cfg *)&comms_csw_rx_buf[TM_PLD_IDX],&rx_size);
            rx_size = sizeof(s_comms_rx_crypto_cfg);
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_CFG_CRYPTO, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_CFG_FRAMES:
            status = SDR_SBAND_GET_RX_CFG_FRAMES(rx_cfg_rb.rx_cfg_frames,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&rx_cfg_rb.rx_cfg_frames, sizeof(rx_cfg_rb.rx_cfg_frames));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_CFG_FRAMES, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_CFG_DETECTED:
            status = SDR_SBAND_GET_RX_CFG_DETECTED(rx_cfg_rb.rx_cfg_detected,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&rx_cfg_rb.rx_cfg_detected, sizeof(rx_cfg_rb.rx_cfg_detected));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_CFG_DETECTED, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_CFG_RSSI:
            status = SDR_SBAND_GET_RX_CFG_RSSI(rx_cfg_rb.rx_cfg_rssi,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&rx_cfg_rb.rx_cfg_rssi, sizeof(rx_cfg_rb.rx_cfg_rssi));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_CFG_RSSI, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_CFG_FREQERR:
            status = SDR_SBAND_GET_RX_CFG_FREQERR(rx_cfg_rb.rx_cfg_freqerr,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&rx_cfg_rb.rx_cfg_freqerr, sizeof(rx_cfg_rb.rx_cfg_freqerr));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_CFG_FREQERR, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_CFG_SYMERR:
            status = SDR_SBAND_GET_RX_CFG_SYMERR(rx_cfg_rb.rx_cfg_symerr,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&rx_cfg_rb.rx_cfg_symerr, sizeof(rx_cfg_rb.rx_cfg_symerr));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_CFG_SYMERR, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_CFG_EBN0:
            status = SDR_SBAND_GET_RX_CFG_EBN0(rx_cfg_rb.rx_cfg_ebn0,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&rx_cfg_rb.rx_cfg_ebn0, sizeof(rx_cfg_rb.rx_cfg_ebn0));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_CFG_EBN0, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_CFG_CARRIER_LOCK:
            status = SDR_SBAND_GET_RX_CFG_CARRIER_LOCK(rx_cfg_rb.rx_cfg_carrier_lock,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&rx_cfg_rb.rx_cfg_carrier_lock, sizeof(rx_cfg_rb.rx_cfg_carrier_lock));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_CFG_CARRIER_LOCK, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_FRAME_LOCK:
            status = SDR_SBAND_GET_RX_CFG_FRAME_LOCK(rx_cfg_rb.rx_frame_lock,&rx_size);
            os_memcpy(&comms_csw_rx_buf[TM_PLD_IDX],&rx_cfg_rb.rx_frame_lock, sizeof(rx_cfg_rb.rx_frame_lock));
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_FRAME_LOCK, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_BOOT_CFG:
            status = SDR_SBAND_GET_SYS_CFG_BOOT_CFG((s_comms_boot_cfg *)&comms_csw_rx_buf[TM_PLD_IDX],&rx_size);
            rx_size = sizeof(s_comms_boot_cfg);
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_BOOT_CFG, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_GWDT_CFG:
#ifdef SDR_SBAND_SRS4
            status = SDR_SBAND_GET_SYS_CFG_GWDT_CFG((s_comms_gwdt_cfg *)&comms_csw_rx_buf[TM_PLD_IDX],&rx_size);
#endif
            rx_size = sizeof(s_comms_gwdt_cfg);
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_GWDT_CFG, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_CAN_CFG:
#ifdef SDR_SBAND_SRS4
            status = SDR_SBAND_GET_SYS_CFG_CAN_CFG((s_comms_can_cfg *)&comms_csw_rx_buf[TM_PLD_IDX],&rx_size);
#endif
            rx_size = sizeof(s_comms_can_cfg);
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_CAN_CFG, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_UART_CFG:
            status = SDR_SBAND_GET_SYS_CFG_UART_CFG((s_comms_uart_cfg *)&comms_csw_rx_buf[TM_PLD_IDX],&rx_size);
            rx_size = sizeof(s_comms_uart_cfg);
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_UART_CFG, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_CSP_CFG:
            status = SDR_SBAND_GET_SYS_CFG_CSP_CFG((s_comms_csp_cfg *)&comms_csw_rx_buf[TM_PLD_IDX],&rx_size);
            rx_size = sizeof(s_comms_csp_cfg);
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_CSP_CFG, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_NET_CFG:
            status = SDR_SBAND_GET_SYS_CFG_NET_CFG((s_comms_net_cfg *)&comms_csw_rx_buf[TM_PLD_IDX],&rx_size);
            rx_size = sizeof(s_comms_net_cfg);
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_NET_CFG, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_TM_INFO:
            status = SDR_SBAND_GET_TM_PROP((s_comms_tm_prop *)&comms_csw_rx_buf[TM_PLD_IDX],rx_size);
            rx_size = sizeof(s_comms_tm_prop);
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TM_INFO, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_RX_TM_INFO:
            status = SDR_SBAND_GET_RX_TM_PROP((s_comms_rx_tm *)&comms_csw_rx_buf[TM_PLD_IDX],&rx_size);
            rx_size = sizeof(s_comms_rx_tm);
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_RX_TM_INFO, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_TX_TM_INFO:
            status = SDR_SBAND_GET_TX_TM_PROP((s_comms_tx_tm *)&comms_csw_rx_buf[TM_PLD_IDX],&rx_size);
            rx_size = sizeof(s_comms_tx_tm);
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_TX_TM_INFO, status,tc_tm_data, rx_size);
            break;

        case TC_GET_COMMS_CSP_TM_INFO:
            status = SDR_SBAND_GET_CSP_TM_PROP((s_comms_csp_tm *)&comms_csw_rx_buf[TM_PLD_IDX],&rx_size);
            rx_size = sizeof(s_comms_csp_tm);
            comms_tc_tm_get_rsp_hdlr(TM_GET_COMMS_CSP_TM_INFO, status,tc_tm_data, rx_size);
            break;

        case TC_COMMS_LOAD_CFG:
            os_memcpy(&group,&tc_tm_data[TC_PLD_IDX],sizeof(uint16_t));
            os_memcpy(&fallback,&tc_tm_data[TC_PLD_IDX + 2],sizeof(uint8_t));
            status = SDR_SBAND_GROUP_LOAD_REQ(group,fallback);
            comms_tc_tm_set_rsp_hdlr(TM_COMMS_LOAD_CFG, status,tc_tm_data);
            break;

        case TC_COMMS_SAVE_CFG:
            os_memcpy(&group,&tc_tm_data[TC_PLD_IDX],sizeof(uint16_t));
            os_memcpy(&fallback,&tc_tm_data[TC_PLD_IDX + 2],sizeof(uint8_t));
            status = SDR_SBAND_GROUP_SAVE_REQ(group,fallback);
            comms_tc_tm_set_rsp_hdlr(TM_COMMS_SAVE_CFG, status,tc_tm_data);
            break;

        case TC_COMMS_RESET_CFG:
            os_memcpy(&group,&tc_tm_data[TC_PLD_IDX],sizeof(uint16_t));
            status = SDR_SBAND_RESET_REQ(group);
            comms_tc_tm_set_rsp_hdlr(TM_COMMS_RESET_CFG, status,tc_tm_data);
            break;

        case TC_COMMS_LOCK_CFG:
            os_memcpy(&group,&tc_tm_data[TC_PLD_IDX],sizeof(uint16_t));
            os_memcpy(&fallback,&tc_tm_data[TC_PLD_IDX + 2],sizeof(uint8_t));
            status = SDR_SBAND_GROUP_LOCK_REQ(group, fallback);
            comms_tc_tm_set_rsp_hdlr(TM_COMMS_LOCK_CFG, status,tc_tm_data);
            break;

        case TC_COMMS_UNLOCK_CFG:
            os_memcpy(&group,&tc_tm_data[TC_PLD_IDX],sizeof(uint16_t));
            os_memcpy(&fallback,&tc_tm_data[TC_PLD_IDX + 2],sizeof(uint8_t));
            status = SDR_SBAND_GROUP_UNLOCK_REQ(group, fallback);
            comms_tc_tm_set_rsp_hdlr(TM_COMMS_UNLOCK_CFG, status,tc_tm_data);
            break;

        case TC_COMMS_ERASE_CFG:
            os_memcpy(&group,&tc_tm_data[TC_PLD_IDX],sizeof(uint16_t));
            os_memcpy(&fallback,&tc_tm_data[TC_PLD_IDX + 2],sizeof(uint8_t));
            status = SDR_SBAND_GROUP_ERASE_REQ(group, fallback);
            comms_tc_tm_set_rsp_hdlr(TM_COMMS_ERASE_CFG, status,tc_tm_data);
            break;

        case TC_COMMS_FW_CFG:
            SDR_SBAND_FIRMWARE_CFG(&tc_tm_data[TC_PLD_IDX]);
            break;

        case TC_COMMS_CUSTOM_TX:
            comms_cust_pattern_rf_tx(tc_tm_data);
            sband_csp_ping(&tc_tm_data[TC_PLD_IDX]);
            comms_tc_tm_set_rsp_hdlr(TM_COMMS_CUSTOM_TX, 0 ,tc_tm_data);
            break;

        case TC_COMMS_RESERVED:
#if 0
            sband_csp_tx_data();
            comms_tc_tm_set_rsp_hdlr(TM_COMMS_CSP_TX_DATA, 0 ,tc_tm_data);
#endif
            break;

        case TC_COMMS_INITIAL_SYNC:
            comms_sband_initial_sync_hdlr(tc_tm_data);
            break;
    }
#endif
}
