/*
 * @file morpheus_multifeep_thruster.c
 *
 * @brief This file contains the driver function of multifeep thruster sensor
 *
 * @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 "morpheus_multifeep_thruster.h"

multifeep_housekeeping2 hsk2_info;
multifeep_housekeeping1 hsk1_info;
multifeep_sts sts_info;
uint8_t recieve_hsekp1[RCV_HOUSEKEEPING1_LEN];
uint8_t recieve_hsekp2[RCV_HOUSEKEEPING2_LEN];
uint8_t recieve_hsekp3[RCV_HOUSEKEEPING3_LEN];
uint8_t recieve_srl_num[RCV_SRL_NUM_LEN];

/*!
 * @brief This API is used to check null pointer
 */
static multifeep_err null_ptr_check(multifeep_intf *inst_ptr)
{
    multifeep_err rslt;
    if(inst_ptr==NULL || inst_ptr->transmit==NULL || inst_ptr->recieve==NULL)
    {
        rslt=MULTIFEEP_NULL_PTR_ERR;
    }
    else
    {
        rslt=MULTIFEEP_SUCCESS;
    }
    return rslt;
}

/*!
 * @brief  This API calculate the checksum for tx dataframe
 */
static multifeep_err multifeep_frame_calculate_tx_checksum(uint8_t *data,uint8_t len)
{
    multifeep_err sts=MULTIFEEP_ERR;
    uint16_t data_add;
    uint16_t data_check;
    uint8_t i;
    data_add=data[1];								/* For tx checksum first byte must not be added */
    for(i=2;i<len;i++)
    {
        data_add = data_add + data[i];
        if(data_add & 0xFF00)
        {
            data_check = (data_add>>8);
            data_add =   (data_add & 0xFF) + data_check;
        }
    }
    data[len]=data_add;
    sts = MULTIFEEP_SUCCESS;
    return sts;
}

/*!
 * @brief  This API calculate the checksum for rx dataframe
 */
static multifeep_err multifeep_frame_calculate_rx_checksum(uint8_t *data,uint8_t len)
{
    multifeep_err sts=MULTIFEEP_ERR;
    uint16_t data_add;
    uint16_t data_check;
    uint8_t i;
    data_add=data[0];											/* For rx checksum first byte must be added */
    for(i=1;i<len;i++)
    {
        data_add = data_add + data[i];
        if(data_add & 0xFF00)
        {
            data_check = (data_add>>8);
            data_add =   (data_add & 0xFF) + data_check;
        }
    }
    data[len]=data_add;
    sts = MULTIFEEP_SUCCESS;
    return sts;
}

/*!
 * @brief  This API is used to set the force in (micro Newton)
 */
multifeep_err multifeep_unit_thruster_set_force(multifeep_intf *inst_ptr,uint8_t system_id,float force)
{
    data_frame data;
    multifeep_err sts=MULTIFEEP_ERR;
    uint8_t *force_ptr;
    force_ptr=(uint8_t*)&force;
    sts=null_ptr_check(inst_ptr);
    if(sts!=MULTIFEEP_SUCCESS )
    {
        sts= MULTIFEEP_NULL_PTR_ERR;
    }
    else if((system_id >=MAX_UNIT && system_id != UNIT_ALL)|| force < 0.0 || force > 70.0)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        data.start=MULTIFEEP_START;
        data.system_id=system_id;
        data.device_id=MULTIFEEP_THRUSTER1;
        data.operator_id=MULTIFEEP_SET;
        data.parameter_id=MULTIFEEP_FORCE;
        data.value[0]=force_ptr[0];													/* Assigning the particular byte value to its respective position */
        data.value[1]=force_ptr[1];
        data.value[2]=force_ptr[2];
        data.value[3]=force_ptr[3];
        multifeep_frame_calculate_tx_checksum(&data.start,MORP_THRUST_CMD_LEN-2);   /* MORP_THRUST_CMD_LEN is the macro for tx dataframe length.Calculating checksum from the start byte to the value byte */
        data.stop=MULTIFEEP_STOP;
        DEBUG_CPRINT(("SET_FORCE:%x %x %x %x %x %x %x %x %x %x %x\r\n",data.start,data.system_id,data.device_id,data.operator_id,data.parameter_id,data.value[0],data.value[1],data.value[2],data.value[3],data.checksum,data.stop));
        DEBUG_CPRINT(("%x %x %x %x \r\n",data.value[0],data.value[1],data.value[2],data.value[3]));
        if(inst_ptr->transmit(inst_ptr->intf_hdl,inst_ptr-> slv_addr,&data.start,MORP_THRUST_CMD_LEN)==MULTIFEEP_SUCCESS)
        {
            sts= MULTIFEEP_SUCCESS;
        }
        else
        {
            sts= MULTIFEEP_COM_FAIL;
        }
    }
    return (sts);
}

/*!
 * @brief This API is used to reset the system
 */
multifeep_err multifeep_reset(multifeep_intf *inst_ptr)
{
    data_frame data;
    multifeep_err sts=MULTIFEEP_ERR;
    sts=null_ptr_check(inst_ptr);
    if(sts!=MULTIFEEP_SUCCESS )
    {
        sts= MULTIFEEP_NULL_PTR_ERR;
    }
    else
    {
        data.start=MULTIFEEP_START;
        data.system_id=MULTIFEEP_BACKPLANE;
        data.device_id=MULTIFEEP_BOARD;
        data.operator_id=MULTIFEEP_SET;
        data.parameter_id=MULTIFEEP_RST;
        data.value[0]=MULTIFEEP_RST_PASS>>24;											/* Assigning the reset password to its respective position */
        data.value[1]=(MULTIFEEP_RST_PASS>>16) & 0XFF;
        data.value[2]=(MULTIFEEP_RST_PASS>>8) & 0XFF;
        data.value[3]=MULTIFEEP_RST_PASS & 0XFF;
        multifeep_frame_calculate_tx_checksum(&data.start,MORP_THRUST_CMD_LEN-2);			/* MORP_THRUST_CMD_LEN is the macro for tx dataframe length.Calculating checksum from the start byte to the value byte */
        data.stop=MULTIFEEP_STOP;
        DEBUG_CPRINT(("SET_RESET:%x %x %x %x %x %x %x %x %x %x %x\r\n",data.start,data.system_id,data.device_id,data.operator_id,data.parameter_id,data.value[0],data.value[1],data.value[2],data.value[3],data.checksum,data.stop));
        if(inst_ptr->transmit(inst_ptr->intf_hdl,inst_ptr->slv_addr,&data.start,MORP_THRUST_CMD_LEN)==MULTIFEEP_SUCCESS)
        {
            sts= MULTIFEEP_SUCCESS;
        }
        else
        {
            sts= MULTIFEEP_COM_FAIL;
        }
    }
    return (sts);
}

/*!
 * @brief This API is used to boot the system
 */
multifeep_err multifeep_boot(multifeep_intf *inst_ptr)
{
    data_frame data;
    multifeep_err sts=MULTIFEEP_ERR;
    sts=null_ptr_check(inst_ptr);
    if(sts!=MULTIFEEP_SUCCESS)
    {
        sts= MULTIFEEP_NULL_PTR_ERR;
    }
    else
    {
        data.start=MULTIFEEP_START;
        data.system_id=MULTIFEEP_BACKPLANE;
        data.device_id=MULTIFEEP_BOARD;
        data.operator_id=MULTIFEEP_SET;
        data.parameter_id=MULTIFEEP_BOOT;												/* Assigning the boot password to its respective position */
        data.value[0]=MULTIFEEP_BOOT_PASS>>24;
        data.value[1]=(MULTIFEEP_BOOT_PASS>>16) & 0XFF;
        data.value[2]=(MULTIFEEP_BOOT_PASS>>8) & 0XFF;
        data.value[3]=MULTIFEEP_BOOT_PASS & 0XFF;
        multifeep_frame_calculate_tx_checksum(&data.start,MORP_THRUST_CMD_LEN-2);			/* MORP_THRUST_CMD_LEN is the macro for tx dataframe length.Calculating checksum from the start byte to the value byte */
        data.stop=MULTIFEEP_STOP;
        DEBUG_CPRINT(("SET_BOOT:%x %x %x %x %x %x %x %x %x %x %x\r\n",data.start,data.system_id,data.device_id,data.operator_id,data.parameter_id,data.value[0],data.value[1],data.value[2],data.value[3],data.checksum,data.stop));
        if(inst_ptr->transmit(inst_ptr->intf_hdl,inst_ptr->slv_addr,&data.start,MORP_THRUST_CMD_LEN)==MULTIFEEP_SUCCESS)
        {
            sts= MULTIFEEP_SUCCESS;
        }
        else
        {
            sts= MULTIFEEP_COM_FAIL;
        }
    }
    return (sts);
}

/*!
 * @brief This API is used to set to on or off state
 */
multifeep_err multifeep_unit_set_pwr_on_off(multifeep_intf *inst_ptr,uint8_t system_id,uint8_t on_off)
{
    data_frame data;
    multifeep_err sts=MULTIFEEP_ERR;
    sts=null_ptr_check(inst_ptr);
    if(sts!=MULTIFEEP_SUCCESS )
    {
        sts= MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id >= MAX_UNIT && on_off != MULTIFEEP_ON && on_off != MULTIFEEP_OFF)
    {
        sts=MULTIFEEP_INVLD_ARG;
    }
    else
    {
        data.start=MULTIFEEP_START;
        data.system_id=MULTIFEEP_BACKPLANE;
        data.device_id=MULTIFEEP_BOARD;
        data.operator_id=MULTIFEEP_SET;
        data.parameter_id=on_off;												/* Power includes the id of ON and OFF */
        data.value[0]=0;
        data.value[1]=0;
        data.value[2]=0;
        data.value[3]=system_id;												/* The system id is set in its respective position */
        multifeep_frame_calculate_tx_checksum(&data.start,MORP_THRUST_CMD_LEN-2);		/* MORP_THRUST_CMD_LEN is the macro for tx dataframe length.Calculating checksum from the start byte to the value byte */
        data.stop=MULTIFEEP_STOP;
        DEBUG_CPRINT(("SET_POWER:%x %x %x %x %x %x %x %x %x %x %x\r\n",data.start,data.system_id,data.device_id,data.operator_id,data.parameter_id,data.value[0],data.value[1],data.value[2],data.value[3],data.checksum,data.stop));
        if(inst_ptr->transmit(inst_ptr->intf_hdl,inst_ptr->slv_addr,&data.start,MORP_THRUST_CMD_LEN)==MULTIFEEP_SUCCESS)
        {
            sts= MULTIFEEP_SUCCESS;
        }
        else
        {
            sts= MULTIFEEP_COM_FAIL;
        }
    }
    return (sts);
}

/*!
 * @brief This API is used to set the mode of the thruster
 */
multifeep_err multifeep_unit_thruster_set_mode(multifeep_intf *inst_ptr,uint8_t system_id,uint8_t mode)
{
    data_frame data;
    multifeep_err sts=MULTIFEEP_ERR;
    sts=null_ptr_check(inst_ptr);
    if(sts!=MULTIFEEP_SUCCESS )
    {
        sts= MULTIFEEP_NULL_PTR_ERR;
    }
    else if((system_id >=MAX_UNIT && system_id != UNIT_ALL)|| mode>=MAX_MODE)
    {
        sts=MULTIFEEP_INVLD_ARG;
    }
    else
    {
        data.start=MULTIFEEP_START;
        data.system_id=system_id;
        data.device_id=MULTIFEEP_THRUSTER1;
        data.operator_id=MULTIFEEP_SET;
        data.parameter_id=MULTIFEEP_MODE;
        data.value[0]=0;																/* The corresponding mode id is set in its respective position */
        data.value[1]=0;
        data.value[2]=0;
        data.value[3]=mode;
        multifeep_frame_calculate_tx_checksum(&data.start,MORP_THRUST_CMD_LEN-2);		/* MORP_THRUST_CMD_LEN is the macro for tx dataframe length.Calculating checksum from the start byte to the value byte */
        data.stop=MULTIFEEP_STOP;
        DEBUG_CPRINT(("SET_THRUSTER_MODE:%x %x %x %x %x %x %x %x %x %x %x\r\n",data.start,data.system_id,data.device_id,data.operator_id,data.parameter_id,data.value[0],data.value[1],data.value[2],data.value[3],data.checksum,data.stop));
        if(inst_ptr->transmit(inst_ptr->intf_hdl,inst_ptr->slv_addr,&data.start,MORP_THRUST_CMD_LEN)==MULTIFEEP_SUCCESS)
        {
            sts= MULTIFEEP_SUCCESS;
        }
        else
        {
            sts= MULTIFEEP_COM_FAIL;
        }
    }
    return (sts);
}

/*!
 * @brief This API is used to set the mode of system
 */
multifeep_err multifeep_set_mode(multifeep_intf *inst_ptr,uint8_t system_id)
{
    data_frame data;
    multifeep_err sts=MULTIFEEP_ERR;
    sts=null_ptr_check(inst_ptr);
    if(sts!=MULTIFEEP_SUCCESS )
    {
        sts= MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id >=MAX_UNIT && system_id!=MULTIFEEP_BACKPLANE)
    {
        sts=MULTIFEEP_INVLD_ARG;
    }
    else
    {
        data.start=MULTIFEEP_START;
        data.system_id=system_id;
        data.device_id=MULTIFEEP_BOARD;
        data.operator_id=MULTIFEEP_SET;
        data.parameter_id=MULTIFEEP_MODE;
        data.value[0]=0;																	// Password has to be assigned
        data.value[1]=0;
        data.value[2]=0;
        data.value[3]=0;
        multifeep_frame_calculate_tx_checksum(&data.start,MORP_THRUST_CMD_LEN-2);			/* MORP_THRUST_CMD_LEN is the macro for tx dataframe length.Calculating checksum from the start byte to the value byte */
        data.stop=MULTIFEEP_STOP;
        DEBUG_CPRINT(("SET_MODE:%x %x %x %x %x %x %x %x %x %x %x\r\n",data.start,data.system_id,data.device_id,data.operator_id,data.parameter_id,data.value[0],data.value[1],data.value[2],data.value[3],data.checksum,data.stop));
        if(inst_ptr->transmit(inst_ptr->intf_hdl,inst_ptr->slv_addr,&data.start,MORP_THRUST_CMD_LEN)==MULTIFEEP_SUCCESS)
        {
            sts= MULTIFEEP_SUCCESS;
        }
        else
        {
            sts= MULTIFEEP_COM_FAIL;
        }
    }
    return (sts);
}

/*!
 * @brief This API is used to get the mode of the system
 */
multifeep_err multifeep_get_mode(multifeep_intf *inst_ptr,uint8_t system_id,uint8_t *mode)
{
    data_frame data;
    multifeep_err sts=MULTIFEEP_ERR;
    uint8_t recieve_sys_mode[RCV_MODE_LEN];
    uint8_t recieve_checksum;
    uint16_t rcv_len;
    if(null_ptr_check(inst_ptr)==MULTIFEEP_SUCCESS && mode!= NULL)
    {
        if(system_id >=MAX_UNIT )
        {
            sts=MULTIFEEP_INVLD_ARG;
        }
        else
        {
            data.start=MULTIFEEP_START;
            data.system_id=system_id;
            data.device_id=MULTIFEEP_BOARD;
            data.operator_id=MULTIFEEP_GET;
            data.parameter_id=MULTIFEEP_MODE;
            data.value[0]=0;
            data.value[1]=0;
            data.value[2]=0;
            data.value[3]=0;
            multifeep_frame_calculate_tx_checksum(&data.start,MORP_THRUST_CMD_LEN-2);							/* MORP_THRUST_CMD_LEN is the macro for tx dataframe length.Calculating checksum from the start byte to the value byte */
            data.stop=MULTIFEEP_STOP;
            DEBUG_CPRINT(("GET_MODE:%x %x %x %x %x %x %x %x %x %x %x\r\n",data.start,data.system_id,data.device_id,data.operator_id,data.parameter_id,data.value[0],data.value[1],data.value[2],data.value[3],data.checksum,data.stop));
            if(inst_ptr->transmit(inst_ptr->intf_hdl,inst_ptr->slv_addr,&data.start,MORP_THRUST_CMD_LEN)==MULTIFEEP_SUCCESS)
            {
                if(inst_ptr->recieve(inst_ptr->intf_hdl,inst_ptr->slv_addr,recieve_sys_mode,RCV_MODE_LEN)==MULTIFEEP_SUCCESS)
                {
                    recieve_checksum = recieve_sys_mode[RCV_MODE_LEN-1];										/* Checksum of the received byte stream */
                    rcv_len = RCV_MODE_LEN-1;																	/* For calculating checksum , received checksum byte is not needed */
                    if(multifeep_frame_calculate_rx_checksum(recieve_sys_mode,rcv_len) != MULTIFEEP_SUCCESS)     /*Calculating checksum for received byte stream */
                    {
                        sts = MULTIFEEP_CHECKSUM_ERR;
                    }
                    else
                    {
                        if(recieve_sys_mode[rcv_len] != recieve_checksum)					/* Comparing the received checksum and calculated checksum  */
                        {
                            sts = MULTIFEEP_CHECKSUM_ERR;
                        }
                        else
                        {
                            memcpy(mode,&recieve_sys_mode[3],(RCV_MODE_LEN-4));				/* Copying the data to the pointer */
                            sts = MULTIFEEP_SUCCESS;
                        }
                    }

                }
                else
                {
                    sts= MULTIFEEP_COM_FAIL;
                }
            }
            else
            {
                sts= MULTIFEEP_COM_FAIL;
            }
        }
    }
    else
    {
        sts= MULTIFEEP_NULL_PTR_ERR;
    }
    return (sts);
}

/*!
 * @brief This API is used to get the mode of the thruster
 */
multifeep_err multifeep_thruster_get_mode(multifeep_intf *inst_ptr,uint8_t system_id,uint8_t *mode)
{
    data_frame data;
    multifeep_err sts=MULTIFEEP_ERR;
    uint8_t recieve_thrst_mode[RCV_MODE_LEN];
    uint8_t recieve_checksum;
    uint16_t rcv_len;
    if(null_ptr_check(inst_ptr)==MULTIFEEP_SUCCESS && mode!= NULL)
    {
        if(system_id >=MAX_UNIT && system_id != UNIT_ALL)
        {
            sts=MULTIFEEP_INVLD_ARG;
        }
        else
        {
            data.start=MULTIFEEP_START;
            data.system_id=system_id;
            data.device_id=MULTIFEEP_THRUSTER1;
            data.operator_id=MULTIFEEP_GET;
            data.parameter_id=MULTIFEEP_MODE;
            data.value[0]=0;
            data.value[1]=0;//not yet confirmed
            data.value[2]=0;
            data.value[3]=0;
            multifeep_frame_calculate_tx_checksum(&data.start,MORP_THRUST_CMD_LEN-2);			/* MORP_THRUST_CMD_LEN is the macro for tx dataframe length.Calculating checksum from the start byte to the value byte */
            data.stop=MULTIFEEP_STOP;

            if(inst_ptr->transmit(inst_ptr->intf_hdl,inst_ptr->slv_addr,&data.start,MORP_THRUST_CMD_LEN)==MULTIFEEP_SUCCESS)
            {
                if(inst_ptr->recieve(inst_ptr->intf_hdl,inst_ptr->slv_addr,recieve_thrst_mode,RCV_MODE_LEN)==MULTIFEEP_SUCCESS)
                {
                    recieve_checksum = recieve_thrst_mode[RCV_MODE_LEN-1];													/* Checksum of the received byte stream */
                    rcv_len = RCV_MODE_LEN-1;																				/* For calculating checksum , received checksum byte is not needed */
                    if(multifeep_frame_calculate_rx_checksum(recieve_thrst_mode,rcv_len) != MULTIFEEP_SUCCESS)				/*Calculating checksum for received byte stream */
                    {
                        sts = MULTIFEEP_CHECKSUM_ERR;
                    }
                    else
                    {
                        if(recieve_thrst_mode[rcv_len] != recieve_checksum)					/* Comparing the received checksum and calculated checksum  */
                        {
                            sts = MULTIFEEP_CHECKSUM_ERR;
                        }
                        else
                        {
                            memcpy(mode,&recieve_thrst_mode[3],(RCV_MODE_LEN-4));			/* Copying the data to the pointer */
                            sts = MULTIFEEP_SUCCESS;
                        }
                    }

                }
                else
                {
                    sts= MULTIFEEP_COM_FAIL;
                }
            }
            else
            {
                sts= MULTIFEEP_COM_FAIL;
            }
        }
    }
    else
    {
        sts= MULTIFEEP_NULL_PTR_ERR;
    }
    return (sts);
}

/*!
 * @brief This API is used to get the status of the system
 */
multifeep_err multifeep_system_get_status(multifeep_intf *inst_ptr, uint8_t system_id,multifeep_sts *sts_info)
{
    data_frame data;
    multifeep_err sts=MULTIFEEP_ERR;
    uint8_t recieve_sts[RCV_STS_LEN];
    uint8_t recieve_checksum;
    uint16_t rcv_len;
    if(null_ptr_check(inst_ptr)==MULTIFEEP_SUCCESS && sts_info!= NULL)
    {
        if(system_id>= MAX_UNIT && system_id!=MULTIFEEP_BACKPLANE)
        {
            sts=MULTIFEEP_INVLD_ARG;
        }
        else
        {
            data.start=MULTIFEEP_START;
            data.system_id=system_id;
            data.device_id=MULTIFEEP_BOARD;
            data.operator_id=MULTIFEEP_GET;
            data.parameter_id=MULTIFEEP_STATUS;
            data.value[0]=0;
            data.value[1]=0;
            data.value[2]=0;
            data.value[3]=0;
            multifeep_frame_calculate_tx_checksum(&data.start,MORP_THRUST_CMD_LEN-2);				/* MORP_THRUST_CMD_LEN is the macro for tx dataframe length.Calculating checksum from the start byte to the value byte */
            data.stop=MULTIFEEP_STOP;
            DEBUG_CPRINT(("_GET_STATUS:%x %x %x %x %x %x %x %x %x %x %x\r\n",data.start,data.system_id,data.device_id,data.operator_id,data.parameter_id,data.value[0],data.value[1],data.value[2],data.value[3],data.checksum,data.stop));
            if(inst_ptr->transmit(inst_ptr->intf_hdl,inst_ptr->slv_addr,&data.start,MORP_THRUST_CMD_LEN)==MULTIFEEP_SUCCESS)
            {
                if(inst_ptr->recieve(inst_ptr->intf_hdl,inst_ptr->slv_addr,recieve_sts,RCV_STS_LEN)==MULTIFEEP_SUCCESS)
                {
                    recieve_checksum = recieve_sts[RCV_STS_LEN-1];											/* Checksum of the received byte stream */
                    rcv_len = RCV_STS_LEN-1;																/* For calculating checksum , received checksum byte is not needed */
                    if(multifeep_frame_calculate_rx_checksum(recieve_sts,rcv_len) != MULTIFEEP_SUCCESS)		/* Calculating checksum for received byte stream */
                    {
                        sts = MULTIFEEP_CHECKSUM_ERR;
                    }
                    else
                    {
                        if(recieve_sts[rcv_len] != recieve_checksum)									/* Comparing the received checksum and calculated checksum  */
                        {
                            sts = MULTIFEEP_CHECKSUM_ERR;
                        }
                        else
                        {
                            memcpy(sts_info,&recieve_sts[3],sizeof(multifeep_sts));						/* Copying the data to the pointer */
                            sts = MULTIFEEP_SUCCESS;
                        }
                    }

                }
                else
                {
                    sts= MULTIFEEP_COM_FAIL;
                }
            }
            else
            {
                sts= MULTIFEEP_COM_FAIL;
            }
        }
    }
    else
    {
        sts= MULTIFEEP_NULL_PTR_ERR;
    }
    return(sts);
}

/*!
 * @brief This API is used to get the serial number of the system
 */
multifeep_err multifeep_system_get_serial_number(multifeep_intf *inst_ptr,uint8_t system_id,uint8_t *srl_num)
{
    data_frame data;
    multifeep_err sts;
    uint8_t recieve_checksum;
    uint16_t rcv_len;
    if(null_ptr_check(inst_ptr)==MULTIFEEP_SUCCESS && srl_num!= NULL)
    {
        if(system_id>=MAX_UNIT  && system_id !=MULTIFEEP_BACKPLANE)
        {
            sts=MULTIFEEP_INVLD_ARG;
        }
        else
        {
            data.start=MULTIFEEP_START;
            data.system_id=system_id;
            data.device_id=MULTIFEEP_BOARD;
            data.operator_id=MULTIFEEP_GET;
            data.parameter_id=MULTIFEEP_SERIAL_NUMBER;
            data.value[0]=0;
            data.value[1]=0;
            data.value[2]=0;
            data.value[3]=0;
            multifeep_frame_calculate_tx_checksum(&data.start,MORP_THRUST_CMD_LEN-2);				/* MORP_THRUST_CMD_LEN is the macro for tx dataframe length.Calculating checksum from the start byte to the value byte */
            data.stop=MULTIFEEP_STOP;
            DEBUG_CPRINT(("_GET_SERAIL_NUMBER:%x %x %x %x %x %x %x %x %x %x %x\r\n",data.start,data.system_id,data.device_id,data.operator_id,data.parameter_id,data.value[0],data.value[1],data.value[2],data.value[3],data.checksum,data.stop));
            if(inst_ptr->transmit(inst_ptr->intf_hdl,inst_ptr->slv_addr,&data.start,MORP_THRUST_CMD_LEN)==MULTIFEEP_SUCCESS)
            {
                if(inst_ptr->recieve(inst_ptr->intf_hdl,inst_ptr->slv_addr,recieve_srl_num,RCV_SRL_NUM_LEN)==MULTIFEEP_SUCCESS)
                {
                    recieve_checksum = recieve_srl_num[RCV_SRL_NUM_LEN-1];												/* Checksum of the received byte stream */
                    rcv_len = RCV_SRL_NUM_LEN-1;																		/* For calculating checksum , received checksum byte is not needed */
                    if(multifeep_frame_calculate_rx_checksum(recieve_srl_num,rcv_len) != MULTIFEEP_SUCCESS)				/* Calculating checksum for received byte stream */
                    {
                        sts = MULTIFEEP_CHECKSUM_ERR;
                    }
                    else
                    {
                        if(recieve_srl_num[rcv_len] != recieve_checksum)								/* Comparing the received checksum and calculated checksum  */
                        {
                            sts = MULTIFEEP_CHECKSUM_ERR;
                        }
                        else
                        {
                            memcpy(srl_num,&recieve_srl_num[3],(RCV_SRL_NUM_LEN-4));					/* Copying the data to the pointer */
                            sts = MULTIFEEP_SUCCESS;
                        }
                    }

                }
                else
                {
                    sts= MULTIFEEP_COM_FAIL;
                }
            }
            else
            {
                sts= MULTIFEEP_COM_FAIL;
            }
        }
    }
    else
    {
        sts= MULTIFEEP_NULL_PTR_ERR;
    }
    return (sts);
}

/*
 * This API copy the received housekeeping1 byte stream to its structure member
 */
static void hsekp1_get_data(multifeep_housekeeping1* hsekp1_info, uint8_t* rcv_hsekp1)
{
    hsekp1_info->master_tm = rcv_hsekp1[0]|(rcv_hsekp1[1]<<8)|(rcv_hsekp1[2]<<16)|(rcv_hsekp1[3]<<24);
    hsekp1_info->sts = rcv_hsekp1[4];
    hsekp1_info->temp = rcv_hsekp1[5];
    hsekp1_info->tot_force = rcv_hsekp1[6]|(rcv_hsekp1[7]<<8);
    hsekp1_info->tot_azmth = rcv_hsekp1[8]|(rcv_hsekp1[9]<<8);
    hsekp1_info->tot_polar = rcv_hsekp1[10];
    hsekp1_info->tot_pwr_cnsp = rcv_hsekp1[11]|(rcv_hsekp1[12]<<8);
    hsekp1_info->unreg_vol = rcv_hsekp1[13];
    hsekp1_info->prplt = rcv_hsekp1[14]|(rcv_hsekp1[15]<<8);
    hsekp1_info->force_unit1 = rcv_hsekp1[16]|(rcv_hsekp1[17]<<8);
    hsekp1_info->azmth_unit1 = rcv_hsekp1[18];
    hsekp1_info->polar_unit1 = rcv_hsekp1[19]|(rcv_hsekp1[20]<<8);
    hsekp1_info->pwr_unit1 = rcv_hsekp1[21]|(rcv_hsekp1[22]<<8);
    hsekp1_info->mode_unit1 = rcv_hsekp1[23];
    hsekp1_info->force_unit2 = rcv_hsekp1[24]|(rcv_hsekp1[25]<<8);
    hsekp1_info->polar_unit2 = rcv_hsekp1[26];
    hsekp1_info->azmth_unit2 = rcv_hsekp1[27]|(rcv_hsekp1[28]<<8);
    hsekp1_info->pwr_unit2 = rcv_hsekp1[29]|(rcv_hsekp1[30]<<8);
    hsekp1_info->mode_unit2 = rcv_hsekp1[31];
}

/*!
 * @brief This API is used to get the housekeeping1 data
 */
multifeep_err multifeep_get_housekeeping1_data(multifeep_intf *inst_ptr,multifeep_housekeeping1 *hsekp1_data)
{
    data_frame data;
    multifeep_err sts=MULTIFEEP_ERR;
    uint8_t recieve_checksum;
    uint16_t rcv_len;
    if(null_ptr_check(inst_ptr)!=MULTIFEEP_SUCCESS && hsekp1_data== NULL)
    {
        sts= MULTIFEEP_NULL_PTR_ERR;
    }
    else
    {
        data.start=MULTIFEEP_START;
        data.system_id=MULTIFEEP_BACKPLANE;
        data.device_id=MULTIFEEP_BOARD;
        data.operator_id=MULTIFEEP_GET;
        data.parameter_id=MULTIFEEP_HOUSEKEEPING1;
        data.value[0]=0;
        data.value[1]=0;
        data.value[2]=0;
        data.value[3]=0;
        multifeep_frame_calculate_tx_checksum(&data.start,MORP_THRUST_CMD_LEN-2);					/* MORP_THRUST_CMD_LEN is the macro for tx dataframe length.Calculating checksum from the start byte to the value byte */
        data.stop=MULTIFEEP_STOP;
        DEBUG_CPRINT(("GET_HOUSEKEEPING_1:%x %x %x %x %x %x %x %x %x %x %x\r\n",data.start,data.system_id,data.device_id,data.operator_id,data.parameter_id,data.value[0],data.value[1],data.value[2],data.value[3],data.checksum,data.stop));
        if(inst_ptr->transmit(inst_ptr->intf_hdl,inst_ptr->slv_addr,&data.start,MORP_THRUST_CMD_LEN)==MULTIFEEP_SUCCESS)
        {
            if(inst_ptr->recieve(inst_ptr->intf_hdl,inst_ptr->slv_addr,recieve_hsekp1,RCV_HOUSEKEEPING1_LEN)==MULTIFEEP_SUCCESS)
            {
                recieve_checksum = recieve_hsekp1[RCV_HOUSEKEEPING1_LEN-1];									/* Checksum of the received byte stream */
                rcv_len = RCV_HOUSEKEEPING1_LEN-1;															/* For calculating checksum , received checksum byte is not needed */
                if(multifeep_frame_calculate_rx_checksum(recieve_hsekp1,rcv_len) != MULTIFEEP_SUCCESS)		/* Calculating checksum for received byte stream */
                {
                    sts = MULTIFEEP_CHECKSUM_ERR;
                }
                else
                {
                    if(recieve_hsekp1[rcv_len] != recieve_checksum)										/* Comparing the received checksum and calculated checksum  */
                    {
                        sts = MULTIFEEP_CHECKSUM_ERR;
                    }
                    else
                    {
                        hsekp1_get_data(hsekp1_data,&recieve_hsekp1[3]);									/* Copying the data manually to the structure member */
                        sts = MULTIFEEP_SUCCESS;
                    }
                }

            }
            else
            {
                sts= MULTIFEEP_COM_FAIL;
            }
        }
        else
        {
            sts= MULTIFEEP_COM_FAIL;
        }
    }
    return (sts);
}

/*
 * This API copy the received housekeeping2 byte stream to its structure member
 */
static void hsekp2_get_data(multifeep_housekeeping2* hsekp2_info, uint8_t* rcv_hsekp2)
{
    hsekp2_info->bkpln_master_tm = rcv_hsekp2[0]|(rcv_hsekp2[1]<<8)|(rcv_hsekp2[2]<<16)|(rcv_hsekp2[3]<<24);
    hsekp2_info->sts = rcv_hsekp2[4];
    hsekp2_info->rst_backplane = rcv_hsekp2[5];
    hsekp2_info->pwr = rcv_hsekp2[6]|(rcv_hsekp2[7]<<8);
    hsekp2_info->unreg_vol = rcv_hsekp2[8]|(rcv_hsekp2[9]<<8);
    hsekp2_info->unit_master_tm = rcv_hsekp2[10]|(rcv_hsekp2[11]<<8)|(rcv_hsekp2[12]<<16)|(rcv_hsekp2[13]<<24);
    hsekp2_info->mode = rcv_hsekp2[14];
    hsekp2_info->dev_on_sts = rcv_hsekp2[15]|(rcv_hsekp2[16]<<8);
    hsekp2_info->rst_sts_unit = rcv_hsekp2[17];
    hsekp2_info->temp = rcv_hsekp2[18];
    hsekp2_info->prplt = rcv_hsekp2[19]|(rcv_hsekp2[20]<<8);
    hsekp2_info->force = rcv_hsekp2[21]|(rcv_hsekp2[22]<<8);
    hsekp2_info->azmth = rcv_hsekp2[23]|(rcv_hsekp2[24]<<8);
    hsekp2_info->polar = rcv_hsekp2[25];
    hsekp2_info->unregu_vol = rcv_hsekp2[26]|(rcv_hsekp2[27]<<8);
    hsekp2_info->calib_data[0] = rcv_hsekp2[28]|(rcv_hsekp2[29]<<8)|(rcv_hsekp2[30]<<16)|(rcv_hsekp2[31]<<24);
    hsekp2_info->calib_data[1] = rcv_hsekp2[32]|(rcv_hsekp2[33]<<8)|(rcv_hsekp2[34]<<16)|(rcv_hsekp2[35]<<24);
    hsekp2_info->calib_data[2] = rcv_hsekp2[36]|(rcv_hsekp2[37]<<8)|(rcv_hsekp2[38]<<16)|(rcv_hsekp2[39]<<24);
    hsekp2_info->calib_data[3] = rcv_hsekp2[40]|(rcv_hsekp2[41]<<8)|(rcv_hsekp2[42]<<16)|(rcv_hsekp2[43]<<24);
    hsekp2_info->calib_data[4] = rcv_hsekp2[44]|(rcv_hsekp2[45]<<8)|(rcv_hsekp2[46]<<16)|(rcv_hsekp2[47]<<24);
    hsekp2_info->calib_data[5] = rcv_hsekp2[48]|(rcv_hsekp2[49]<<8)|(rcv_hsekp2[50]<<16)|(rcv_hsekp2[51]<<24);
    hsekp2_info->calib_data[6] = rcv_hsekp2[52]|(rcv_hsekp2[53]<<8)|(rcv_hsekp2[54]<<16)|(rcv_hsekp2[55]<<24);
    hsekp2_info->heat_err = rcv_hsekp2[56];
    hsekp2_info->heat_duty = rcv_hsekp2[57];
    hsekp2_info->heat_temp = rcv_hsekp2[58];
    hsekp2_info->heat_targ_temp = rcv_hsekp2[59];
    hsekp2_info->emit_vol = rcv_hsekp2[60]|(rcv_hsekp2[61]<<8);
    hsekp2_info->emit_cur = rcv_hsekp2[62]|(rcv_hsekp2[63]<<8);
    hsekp2_info->emit_ip_cur = rcv_hsekp2[64]|(rcv_hsekp2[65]<<8);
    hsekp2_info->ext1_vol = rcv_hsekp2[66]|(rcv_hsekp2[67]<<8);
    hsekp2_info->ext1_cur = rcv_hsekp2[68]|(rcv_hsekp2[69]<<8);
    hsekp2_info->ext1_ip_cur = rcv_hsekp2[70]|(rcv_hsekp2[71]<<8);
    hsekp2_info->ext2_vol = rcv_hsekp2[72]|(rcv_hsekp2[73]<<8);
    hsekp2_info->ext2_cur = rcv_hsekp2[74]|(rcv_hsekp2[75]<<8);
    hsekp2_info->ext2_ip_cur = rcv_hsekp2[76]|(rcv_hsekp2[77]<<8);
    hsekp2_info->ext3_vol = rcv_hsekp2[78]|(rcv_hsekp2[79]<<8);
    hsekp2_info->ext3_cur = rcv_hsekp2[80]|(rcv_hsekp2[81]<<8);
    hsekp2_info->ext3_ip_cur = rcv_hsekp2[82]|(rcv_hsekp2[83]<<8);
    hsekp2_info->ext4_vol = rcv_hsekp2[84]|(rcv_hsekp2[85]<<8);
    hsekp2_info->ext4_cur = rcv_hsekp2[86]|(rcv_hsekp2[87]<<8);
    hsekp2_info->ext4_ip_cur = rcv_hsekp2[88]|(rcv_hsekp2[89]<<8);
    hsekp2_info->ext5_vol = rcv_hsekp2[90]|(rcv_hsekp2[91]<<8);
    hsekp2_info->ext5_cur = rcv_hsekp2[92]|(rcv_hsekp2[93]<<8);
    hsekp2_info->ext5_ip_cur = rcv_hsekp2[94]|(rcv_hsekp2[95]<<8);
    hsekp2_info->ext6_vol = rcv_hsekp2[96]|(rcv_hsekp2[97]<<8);
    hsekp2_info->ext6_cur = rcv_hsekp2[98]|(rcv_hsekp2[99]<<8);
    hsekp2_info->ext6_ip_cur = rcv_hsekp2[100]|(rcv_hsekp2[101]<<8);
    hsekp2_info->ext7_vol = rcv_hsekp2[102]|(rcv_hsekp2[103]<<8);
    hsekp2_info->ext7_cur = rcv_hsekp2[104]|(rcv_hsekp2[105]<<8);
    hsekp2_info->ext7_ip_cur = rcv_hsekp2[106]|(rcv_hsekp2[107]<<8);
    hsekp2_info->neut1_vol = rcv_hsekp2[108]|(rcv_hsekp2[109]<<8);
    hsekp2_info->neut1_cur = rcv_hsekp2[110]|(rcv_hsekp2[111]<<8);
    hsekp2_info->neut1_ip_cur = rcv_hsekp2[112]|(rcv_hsekp2[113]<<8);
    hsekp2_info->neut1_ret_cur = rcv_hsekp2[114]|(rcv_hsekp2[115]<<8);
    hsekp2_info->neut2_vol = rcv_hsekp2[116]|(rcv_hsekp2[117]<<8);
    hsekp2_info->neut2_cur = rcv_hsekp2[118]|(rcv_hsekp2[119]<<8);
    hsekp2_info->neut2_ip_cur = rcv_hsekp2[120]|(rcv_hsekp2[121]<<8);
    hsekp2_info->neut2_ret_cur = rcv_hsekp2[122]|(rcv_hsekp2[123]<<8);
}

/*!
 * @brief This API is used to get the housekeeping2 data
 */
multifeep_err  multifeep_get_housekeeping2_data(multifeep_intf *inst_ptr,multifeep_housekeeping2 *hsekp2_data,uint8_t system_id)
{
    data_frame data;
    multifeep_err sts=MULTIFEEP_ERR;
    uint8_t recieve_checksum;
    uint16_t rcv_len;
    if(null_ptr_check(inst_ptr)==MULTIFEEP_SUCCESS && hsekp2_data != NULL)
    {
        if(system_id>= MAX_UNIT)
        {
            sts= MULTIFEEP_INVLD_ARG;
        }
        else
        {
            data.start=MULTIFEEP_START;
            data.system_id=MULTIFEEP_BACKPLANE;
            data.device_id=MULTIFEEP_BOARD;
            data.operator_id=MULTIFEEP_GET;
            data.parameter_id=MULTIFEEP_HOUSEKEEPING2;
            data.value[0]=0;
            data.value[1]=0;
            data.value[2]=0;
            data.value[3]=system_id;														/* The system id is set in its respective position */
            multifeep_frame_calculate_tx_checksum(&data.start,MORP_THRUST_CMD_LEN-2);		/* MORP_THRUST_CMD_LEN is the macro for tx dataframe length.Calculating checksum from the start byte to the value byte */
            data.stop=MULTIFEEP_STOP;
            DEBUG_CPRINT(("GET_HOUSEKEEPING_2:%x %x %x %x %x %x %x %x %x %x %x\r\n",data.start,data.system_id,data.device_id,data.operator_id,data.parameter_id,data.value[0],data.value[1],data.value[2],data.value[3],data.checksum,data.stop));
            if(inst_ptr->transmit(inst_ptr->intf_hdl,inst_ptr->slv_addr,&data.start,MORP_THRUST_CMD_LEN)==MULTIFEEP_SUCCESS)
            {
                if(inst_ptr->recieve(inst_ptr->intf_hdl,inst_ptr->slv_addr,recieve_hsekp2,RCV_HOUSEKEEPING2_LEN)==MULTIFEEP_SUCCESS)
                {
                    recieve_checksum = recieve_hsekp2[RCV_HOUSEKEEPING2_LEN-1];										/* Checksum of the received byte stream */
                    rcv_len = RCV_HOUSEKEEPING2_LEN-1;																/* For calculating checksum , received checksum byte is not needed */
                    if(multifeep_frame_calculate_rx_checksum(recieve_hsekp2,rcv_len) != MULTIFEEP_SUCCESS)			/* Calculating checksum for received byte stream */
                    {
                        sts = MULTIFEEP_CHECKSUM_ERR;
                    }
                    else
                    {
                        if(recieve_hsekp2[rcv_len] != recieve_checksum)					/* Comparing the received checksum and calculated checksum  */
                        {
                            sts = MULTIFEEP_CHECKSUM_ERR;
                        }
                        else
                        {
                            hsekp2_get_data(hsekp2_data,&recieve_hsekp2[3]);			/* Copying the data manually to the structure member */
                            sts = MULTIFEEP_SUCCESS;
                        }
                    }

                }
                else
                {
                    sts= MULTIFEEP_COM_FAIL;
                }
            }
            else
            {
                sts= MULTIFEEP_COM_FAIL;
            }
        }
    }
    else
    {
        sts= MULTIFEEP_NULL_PTR_ERR;
    }
    return (sts);
}

/*!
 * @brief This API is used to get the housekeeping3 data
 */
multifeep_err multifeep_get_housekeeping3_data(multifeep_intf *inst_ptr,uint8_t *hsekp3_data)
{
    data_frame data;
    multifeep_err sts=MULTIFEEP_ERR;
    uint8_t recieve_checksum;
    uint16_t rcv_len;
    if(null_ptr_check(inst_ptr)!=MULTIFEEP_SUCCESS && hsekp3_data == NULL)
    {
        sts= MULTIFEEP_NULL_PTR_ERR;
    }
    else
    {
        data.start=MULTIFEEP_START;
        data.system_id=MULTIFEEP_BACKPLANE;
        data.device_id=MULTIFEEP_BOARD;
        data.operator_id=MULTIFEEP_GET;
        data.parameter_id=MULTIFEEP_HOUSEKEEPING3;
        data.value[0]=0;
        data.value[1]=0;
        data.value[2]=0;
        data.value[3]=0;
        multifeep_frame_calculate_tx_checksum(&data.start,MORP_THRUST_CMD_LEN-2);				/* MORP_THRUST_CMD_LEN is the macro for tx dataframe length.Calculating checksum from the start byte to the value byte */
        data.stop=MULTIFEEP_STOP;
        DEBUG_CPRINT(("GET_HOUSEKEEPING_3:%x %x %x %x %x %x %x %x %x %x %x\r\n",data.start,data.system_id,data.device_id,data.operator_id,data.parameter_id,data.value[0],data.value[1],data.value[2],data.value[3],data.checksum,data.stop));
        if(inst_ptr->transmit(inst_ptr->intf_hdl,inst_ptr->slv_addr,&data.start,MORP_THRUST_CMD_LEN)==MULTIFEEP_SUCCESS)
        {
            if(inst_ptr->recieve(inst_ptr->intf_hdl,inst_ptr->slv_addr,recieve_hsekp3,RCV_HOUSEKEEPING3_LEN)==MULTIFEEP_SUCCESS)
            {
                recieve_checksum = recieve_hsekp3[RCV_HOUSEKEEPING3_LEN-1];									/* Checksum of the received byte stream */
                rcv_len = RCV_HOUSEKEEPING3_LEN-1;															/* For calculating checksum , received checksum byte is not needed */
                if(multifeep_frame_calculate_rx_checksum(recieve_hsekp3,rcv_len) != MULTIFEEP_SUCCESS)		/* Calculating checksum for received byte stream */
                {
                    sts = MULTIFEEP_CHECKSUM_ERR;
                }
                else
                {
                    if(recieve_hsekp3[rcv_len] != recieve_checksum)										/* Comparing the received checksum and calculated checksum  */
                    {
                        sts = MULTIFEEP_CHECKSUM_ERR;
                    }
                    else
                    {
                        memcpy(hsekp3_data,&recieve_hsekp3[3],(RCV_HOUSEKEEPING3_LEN-4));				/* Copying the data to the pointer */
                        sts = MULTIFEEP_SUCCESS;
                    }
                }

            }
            else
            {
                sts= MULTIFEEP_COM_FAIL;
            }
        }
        else
        {
            sts= MULTIFEEP_COM_FAIL;
        }
    }
    return (sts);
}

/*!
 * @brief This API is used to get the power status of the system
 */
multifeep_err multifeep_unit_get_pwr_on_off(multifeep_intf *inst_ptr,uint8_t *on_off,uint8_t system_id)
{
    data_frame data;
    multifeep_err sts=MULTIFEEP_ERR;
    uint8_t recieve_on_off[RCV_PWR_STE_LEN];
    uint8_t recieve_checksum;
    uint16_t rcv_len;
    if(null_ptr_check(inst_ptr)!=MULTIFEEP_SUCCESS && on_off== NULL)
    {
        sts= MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id>=MAX_UNIT)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        data.start=MULTIFEEP_START;
        data.system_id=MULTIFEEP_BACKPLANE;
        data.device_id=MULTIFEEP_BOARD;
        data.operator_id=MULTIFEEP_GET;
        data.parameter_id=MULTIFEEP_ON;
        data.value[0]=0;
        data.value[1]=0;
        data.value[2]=0;
        data.value[3]=system_id;																/* The system id is set in its respective position */
        multifeep_frame_calculate_tx_checksum(&data.start,MORP_THRUST_CMD_LEN-2);				/* MORP_THRUST_CMD_LEN is the macro for tx dataframe length.Calculating checksum from the start byte to the value byte */
        data.stop=MULTIFEEP_STOP;
        DEBUG_CPRINT(("GET_POWER:%x %x %x %x %x %x %x %x %x %x %x\r\n",data.start,data.system_id,data.device_id,data.operator_id,data.parameter_id,data.value[0],data.value[1],data.value[2],data.value[3],data.checksum,data.stop));
        if(inst_ptr->transmit(inst_ptr->intf_hdl,inst_ptr->slv_addr,&data.start,MORP_THRUST_CMD_LEN)==MULTIFEEP_SUCCESS)
        {
            if(inst_ptr->recieve(inst_ptr->intf_hdl,inst_ptr->slv_addr,recieve_on_off,RCV_PWR_STE_LEN)==MULTIFEEP_SUCCESS)
            {
                recieve_checksum = recieve_on_off[RCV_PWR_STE_LEN-1];						    				/* Checksum of the received byte stream */
                rcv_len = RCV_PWR_STE_LEN-1;																	/* For calculating checksum , received checksum byte is not needed */
                if(multifeep_frame_calculate_rx_checksum(recieve_on_off,rcv_len) != MULTIFEEP_SUCCESS)			/* Calculating checksum for received byte stream */
                {
                    sts = MULTIFEEP_CHECKSUM_ERR;
                }
                else
                {
                    if(recieve_on_off[rcv_len] != recieve_checksum)							/* Comparing the received checksum and calculated checksum  */
                    {
                        sts = MULTIFEEP_CHECKSUM_ERR;
                    }
                    else
                    {
                        memcpy(on_off,&recieve_on_off[3],(RCV_PWR_STE_LEN-4));					/* Copying the data to the pointer */
                        sts = MULTIFEEP_SUCCESS;
                    }
                }

            }
            else
            {
                sts= MULTIFEEP_COM_FAIL;
            }
        }
        else
        {
            sts= MULTIFEEP_COM_FAIL;
        }
    }
    return (sts);
}

/*!
 * @brief This API is used to get the force in (micro Newton)
 */
multifeep_err multifeep_unit_thruster_get_force(multifeep_intf *inst_ptr,uint8_t system_id,uint8_t *frc)
{
    data_frame data	;
    multifeep_err sts=MULTIFEEP_ERR;
    uint8_t recieve_frc[RCV_FRC_LEN];
    uint8_t recieve_checksum;
    uint16_t rcv_len;
    if(null_ptr_check(inst_ptr)!=MULTIFEEP_SUCCESS && frc== NULL)
    {
        sts= MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id >=MAX_UNIT && system_id != UNIT_ALL)
    {
        sts=MULTIFEEP_INVLD_ARG;
    }
    else
    {
        data.start=MULTIFEEP_START;
        data.system_id=system_id;
        data.device_id=MULTIFEEP_THRUSTER1;
        data.operator_id=MULTIFEEP_GET;
        data.parameter_id=MULTIFEEP_FORCE;
        data.value[0]=0;
        data.value[1]=0;
        data.value[2]=0;
        data.value[3]=0;		//system_id												/* The system id is set in its respective position */
        multifeep_frame_calculate_tx_checksum(&data.start,MORP_THRUST_CMD_LEN-2);		/* MORP_THRUST_CMD_LEN is the macro for tx dataframe length.Calculating checksum from the start byte to the value byte */
        data.stop=MULTIFEEP_STOP;
        DEBUG_CPRINT(("GET_FORCE:%x %x %x %x %x %x %x %x %x %x %x\r\n",data.start,data.system_id,data.device_id,data.operator_id,data.parameter_id,data.value[0],data.value[1],data.value[2],data.value[3],data.checksum,data.stop));
        if(inst_ptr->transmit(inst_ptr->intf_hdl,inst_ptr->slv_addr,&data.start,MORP_THRUST_CMD_LEN)==MULTIFEEP_SUCCESS)
        {
            if(inst_ptr->recieve(inst_ptr->intf_hdl,inst_ptr->slv_addr,recieve_frc,RCV_FRC_LEN)==MULTIFEEP_SUCCESS)
            {
                recieve_checksum = recieve_frc[RCV_FRC_LEN-1];												/* Checksum of the received byte stream */
                rcv_len = RCV_FRC_LEN-1;																	/* For calculating checksum , received checksum byte is not needed */
                if(multifeep_frame_calculate_rx_checksum(recieve_frc,rcv_len) != MULTIFEEP_SUCCESS)			/* Calculating checksum for received byte stream */
                {
                    sts = MULTIFEEP_CHECKSUM_ERR;
                }
                else
                {
                    if(recieve_frc[rcv_len] != recieve_checksum)					/* Comparing the received checksum and calculated checksum  */
                    {
                        sts = MULTIFEEP_CHECKSUM_ERR;
                    }
                    else
                    {
                        memcpy(frc,&recieve_frc[3],(RCV_PWR_STE_LEN-4));			/* Copying the data to the pointer */
                        sts = MULTIFEEP_SUCCESS;
                    }
                }

            }
            else
            {
                sts= MULTIFEEP_COM_FAIL;
            }
        }
        else
        {
            sts= MULTIFEEP_COM_FAIL;
        }
    }
    return (sts);
}

/*!
 * @brief This API is used to get the master time from housekeeping1 data
 */
multifeep_err multifeep_get_master_time(multifeep_intf *inst_ptr,uint32_t *mst_tm)
{
    multifeep_err sts=MULTIFEEP_ERR;

    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && mst_tm== NULL)
    {
        sts= MULTIFEEP_NULL_PTR_ERR;
    }
    else
    {
        multifeep_get_housekeeping1_data(inst_ptr,&hsk1_info);
        *mst_tm=hsk1_info.master_tm;
        sts= MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the backplane temperature
 */
multifeep_err multifeep_get_backplane_temp(multifeep_intf *inst_ptr,uint8_t* bckpln_temp)
{
    multifeep_err sts=MULTIFEEP_ERR;

    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && bckpln_temp== NULL)
    {
        sts= MULTIFEEP_NULL_PTR_ERR;
    }
    else
    {
        multifeep_get_housekeeping1_data(inst_ptr,&hsk1_info);
        *bckpln_temp=hsk1_info.temp;
        sts= MULTIFEEP_SUCCESS;
    }
    return sts;

}

/*!
 * @brief This API is used to get the total force of thruster
 */
multifeep_err multifeep_get_backplane_total_force(multifeep_intf *inst_ptr,uint16_t* bckpln_frc)
{
    multifeep_err sts=MULTIFEEP_ERR;

    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && bckpln_frc== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else
    {
        multifeep_get_housekeeping1_data(inst_ptr,&hsk1_info);
        *bckpln_frc= hsk1_info.tot_force;
        sts= MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the total azimuthal angle
 */
multifeep_err multifeep_get_total_azimuthal_angle(multifeep_intf *inst_ptr,uint16_t* tot_azmth)
{
    multifeep_err sts=MULTIFEEP_ERR;

    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && tot_azmth== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else
    {
        multifeep_get_housekeeping1_data(inst_ptr,&hsk1_info);
        *tot_azmth=hsk1_info.tot_azmth;
        sts= MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the total polar angle
 */
multifeep_err multifeep_get_total_polar_angle(multifeep_intf *inst_ptr,uint8_t *tot_plr)
{
    multifeep_err sts=MULTIFEEP_ERR;

    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && tot_plr== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else
    {
        multifeep_get_housekeeping1_data(inst_ptr,&hsk1_info);
        *tot_plr=hsk1_info.tot_polar;
        sts= MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the total power consumption
 */
multifeep_err multifeep_get_total_pwr_cnsp(multifeep_intf *inst_ptr,uint16_t *pwr_cnsp)
{
    multifeep_err sts=MULTIFEEP_ERR;

    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && pwr_cnsp== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else
    {
        multifeep_get_housekeeping1_data(inst_ptr,&hsk1_info);
        *pwr_cnsp=hsk1_info.tot_pwr_cnsp;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get unregulated voltage
 */
multifeep_err multifeep_get_unreg_vol(multifeep_intf *inst_ptr,uint8_t *unreg_vol)
{
    multifeep_err sts=MULTIFEEP_ERR;

    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && unreg_vol== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else
    {
        multifeep_get_housekeeping1_data(inst_ptr,&hsk1_info);
        *unreg_vol=hsk1_info.unreg_vol;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the remaining propellant
 */
multifeep_err multifeep_get_remn_prplt(multifeep_intf *inst_ptr,uint16_t *prplt)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && prplt== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else
    {
        multifeep_get_housekeeping1_data(inst_ptr,&hsk1_info);
        *prplt=hsk1_info.prplt;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the polar angle of the system
 */
multifeep_err multifeep_get_unit_polar_angle(multifeep_intf *inst_ptr,uint8_t system_id,uint8_t *polar)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && polar== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id!= UNIT_1 && system_id!= UNIT_2)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping1_data(inst_ptr,&hsk1_info);
        sts=MULTIFEEP_SUCCESS;
        if(system_id==MULTIFEEP_UNIT1)
        {
            *polar=hsk1_info.polar_unit1;
        }
        else
        {
            *polar=hsk1_info.polar_unit2;
        }
    }
    return sts;
}

/*!
 * @brief This API is used to get the azimuthal angle of the system
 */
multifeep_err multifeep_get_unit_azimuthal_angle(multifeep_intf *inst_ptr,uint8_t system_id,uint16_t *azimuthal)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && azimuthal== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id!= UNIT_1 && system_id!= UNIT_2)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping1_data(inst_ptr,&hsk1_info);
        sts=MULTIFEEP_SUCCESS;
        if(system_id==MULTIFEEP_UNIT1)
        {
            *azimuthal=hsk1_info.azmth_unit1;
        }
        else
        {
            *azimuthal=hsk1_info.azmth_unit2;
        }

    }
    return sts;
}

/*!
 * @brief This API is used to get the Power-Consumption of the system
 */
multifeep_err multifeep_get_unit_pwr(multifeep_intf *inst_ptr,uint8_t system_id,uint16_t *power)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && power== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id!= UNIT_1 && system_id!= UNIT_2)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping1_data(inst_ptr,&hsk1_info);
        sts=MULTIFEEP_SUCCESS;
        if(system_id==MULTIFEEP_UNIT1)
        {
            *power=hsk1_info.pwr_unit1;
        }
        else
        {
            *power=hsk1_info.pwr_unit2;
        }
    }
    return sts;
}

/*!
 * @brief This API is used to get the reset status
 */
multifeep_err multifeep_get_rst_sts(multifeep_intf *inst_ptr,uint8_t system_id,uint8_t *rst_sts)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && rst_sts== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3)
    {
        sts=MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        *rst_sts=hsk2_info.rst_backplane;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the total power
 */
multifeep_err multifeep_get_total_pwr(multifeep_intf *inst_ptr,uint8_t system_id,uint16_t *pwr)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && pwr== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        *pwr=hsk2_info.pwr;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the unregulated Voltage
 */
multifeep_err multifeep_get_unreg_voltage(multifeep_intf *inst_ptr,uint8_t system_id,uint16_t *unreg_vol)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && unreg_vol== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        *unreg_vol=hsk2_info.unreg_vol;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the ON status of the device
 */
multifeep_err multifeep_get_device_on_sts(multifeep_intf *inst_ptr,uint8_t system_id,uint16_t *dev_sts)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && dev_sts== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        *dev_sts=hsk2_info.dev_on_sts;
        sts=MULTIFEEP_ERR;
    }
    return sts;
}

/*!
 * @brief This API is used to get the reset status
 */
multifeep_err multifeep_get_unit_rst_sts(multifeep_intf *inst_ptr,uint8_t system_id,uint8_t *rst_sts)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && rst_sts== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        *rst_sts=hsk2_info.rst_sts_unit;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the board temperature
 */
multifeep_err multifeep_get_board_temp(multifeep_intf *inst_ptr,uint8_t system_id,uint8_t *temp)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && temp== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        *temp=hsk2_info.temp;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the remaining propellant
 */
multifeep_err multifeep_get_unit_prplt(multifeep_intf *inst_ptr,uint8_t system_id,uint16_t *prplt)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && prplt== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        *prplt=hsk2_info.prplt;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}


/*!
 * @brief This API is used to get the Unregulated Voltage
 */
multifeep_err multifeep_get_ureg_voltage(multifeep_intf *inst_ptr,uint8_t system_id,uint16_t *unreg_vol)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && unreg_vol== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        *unreg_vol=hsk2_info.unreg_vol;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the calibration values
 */
multifeep_err multifeep_get_calibration(multifeep_intf *inst_ptr,uint8_t system_id,uint32_t *calib)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && calib== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        calib=hsk2_info.calib_data;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the heater error code
 */
multifeep_err multifeep_get_heater_err_code(multifeep_intf *inst_ptr,uint8_t system_id,uint8_t *err_cde)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && err_cde== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        *err_cde=hsk2_info.heat_err;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the Duty cycle of the heater
 */
multifeep_err multifeep_get_heater_duty_cycle(multifeep_intf *inst_ptr,uint8_t system_id,uint8_t *duty_cycle)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && duty_cycle== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        *duty_cycle=hsk2_info.heat_duty;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the temperature of heater
 */
multifeep_err multifeep_get_heater_temp(multifeep_intf *inst_ptr,uint8_t system_id,int8_t *temp)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && temp== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        *temp=hsk2_info.heat_temp;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the target temperature of heater
 */
multifeep_err multifeep_get_heater_target_temp(multifeep_intf *inst_ptr,uint8_t system_id,int8_t *trgt_temp)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && trgt_temp== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        *trgt_temp=hsk2_info.heat_targ_temp;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the emitter voltage
 */
multifeep_err multifeep_get_emitter_voltage(multifeep_intf *inst_ptr,uint8_t system_id,uint16_t *emt_vol)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && emt_vol== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        *emt_vol=hsk2_info.emit_vol;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the emitter current
 */
multifeep_err multifeep_get_emitter_current(multifeep_intf *inst_ptr,uint8_t system_id,uint16_t *emt_cur)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && emt_cur== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        *emt_cur=hsk2_info.emit_cur;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the emitter current
 */
multifeep_err multifeep_get_emitter_input_current(multifeep_intf *inst_ptr,uint8_t system_id,uint16_t *emt_ip_cur)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && emt_ip_cur== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        *emt_ip_cur=hsk2_info.emit_ip_cur;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the extractor voltage
 */
multifeep_err multifeep_get_extractor_voltage(multifeep_intf *inst_ptr,uint8_t ext_id,uint8_t system_id,uint16_t *ext_vol)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && ext_vol== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3 && ext_id >= MAX_EXTRACTOR)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        sts=MULTIFEEP_SUCCESS;
        switch(ext_id)
        {
            case 1:
                *ext_vol=hsk2_info.ext1_vol;
                break;
            case 2:
                *ext_vol=hsk2_info.ext2_vol;
                break;
            case 3:
                *ext_vol=hsk2_info.ext3_vol;
                break;
            case 4:
                *ext_vol=hsk2_info.ext4_vol;
                break;
            case 5:
                *ext_vol=hsk2_info.ext5_vol;
                break;
            case 6:
                *ext_vol=hsk2_info.ext6_vol;
                break;
            case 7:
                *ext_vol=hsk2_info.ext7_vol;
                break;
        }
    }
    return sts;
}

/*!
 * @brief This API is used to get the extractor current
 */
multifeep_err multifeep_get_extractor_current(multifeep_intf *inst_ptr,uint8_t ext_id,uint8_t system_id,uint16_t *ext_cur)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && ext_cur== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3 && ext_id >= MAX_EXTRACTOR)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        sts=MULTIFEEP_SUCCESS;
        switch(ext_id)
        {
            case 1:
                *ext_cur=hsk2_info.ext1_cur;
                break;
            case 2:
                *ext_cur=hsk2_info.ext2_cur;
                break;
            case 3:
                *ext_cur=hsk2_info.ext3_cur;
                break;
            case 4:
                *ext_cur=hsk2_info.ext4_cur;
                break;
            case 5:
                *ext_cur=hsk2_info.ext5_cur;
                break;
            case 6:
                *ext_cur=hsk2_info.ext6_cur;
                break;
            case 7:
                *ext_cur=hsk2_info.ext7_cur;
                break;
        }
    }
    return sts;
}

/*!
 * @brief This API is used to get the extractor input current
 */
multifeep_err multifeep_get_extractor_input_current(multifeep_intf *inst_ptr,uint8_t ext_id,uint8_t system_id,uint16_t *ext_ip_cur)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && ext_ip_cur== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3 && ext_id >= MAX_EXTRACTOR)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        sts=MULTIFEEP_SUCCESS;
        switch(ext_id)
        {
            case 1:
                *ext_ip_cur=hsk2_info.ext1_ip_cur;
                break;
            case 2:
                *ext_ip_cur=hsk2_info.ext2_ip_cur;
                break;
            case 3:
                *ext_ip_cur=hsk2_info.ext3_ip_cur;
                break;
            case 4:
                *ext_ip_cur=hsk2_info.ext4_ip_cur;
                break;
            case 5:
                *ext_ip_cur=hsk2_info.ext5_ip_cur;
                break;
            case 6:
                *ext_ip_cur=hsk2_info.ext6_ip_cur;
                break;
            case 7:
                *ext_ip_cur=hsk2_info.ext7_ip_cur;
                break;
        }
    }
    return sts;
}


/*!
 * @brief This API is used to get the neutralizer voltage
 */
multifeep_err  multifeep_get_neutralizer_voltage(multifeep_intf *inst_ptr,uint8_t neut_id,uint8_t system_id,uint16_t *neut_vol)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && neut_vol== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3 && neut_id >= MAX_NEUT)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        sts=MULTIFEEP_SUCCESS;
        if(neut_id==NEUT_ID)
        {
            *neut_vol=hsk2_info.neut1_vol;
        }
        else
        {
            *neut_vol=hsk2_info.neut2_vol;
        }
    }
    return sts;

}

/*!
 * @brief This API is used to get the neutralizer current
 */
multifeep_err multifeep_get_neutralizer_current(multifeep_intf *inst_ptr,uint8_t neut_id,uint8_t system_id,uint16_t *neut_cur)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && neut_cur== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3 && neut_id >= MAX_NEUT)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        sts=MULTIFEEP_SUCCESS;
        if(neut_id==NEUT_ID)
        {
            *neut_cur=hsk2_info.neut1_cur;
        }
        else
        {
            *neut_cur=hsk2_info.neut2_cur;
        }
    }
    return sts;
}

/*!
 * @brief This API is used to get the neutralizer input current
 */
multifeep_err multifeep_get_neutralizer_input_current(multifeep_intf *inst_ptr,uint8_t neut_id,uint8_t system_id,uint16_t *neut_ip_cur)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && neut_ip_cur== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3 && neut_id >= MAX_NEUT)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        sts=MULTIFEEP_SUCCESS;
        if(neut_id==NEUT_ID)
        {
            *neut_ip_cur=hsk2_info.neut1_ip_cur;
        }
        else
        {
            *neut_ip_cur=hsk2_info.neut2_ip_cur;
        }
    }
    return sts;
}

/*!
 * @brief This API is used to get the neutralizer return current
 */
multifeep_err multifeep_get_neutralizer_return_current(multifeep_intf *inst_ptr,uint8_t neut_id,uint8_t system_id,uint16_t *neut_ret_cur)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && neut_ret_cur== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3 && neut_id >= MAX_NEUT)
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_get_housekeeping2_data(inst_ptr,&hsk2_info,system_id);
        sts=MULTIFEEP_SUCCESS;
        if(neut_id==NEUT_ID)
        {
            *neut_ret_cur=hsk2_info.neut1_ret_cur;
        }
        else
        {
            *neut_ret_cur=hsk2_info.neut2_ret_cur;
        }
    }
    return sts;
}

/*!
 * @brief This API is used to get the major version number
 */
multifeep_err multifeep_get_major_vers_no(multifeep_intf *inst_ptr,uint8_t system_id,uint8_t *mjr_vers_no)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && mjr_vers_no== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3 )
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_system_get_status(inst_ptr,system_id,&sts_info);
        *mjr_vers_no=sts_info.mjr_vers_no;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the minor version number
 */
multifeep_err multifeep_get_minor_vers_no(multifeep_intf *inst_ptr,uint8_t system_id,uint8_t *mnr_vers_no)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && mnr_vers_no== NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3 )
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_system_get_status(inst_ptr,system_id,&sts_info);
        *mnr_vers_no=sts_info.mnr_vers_no;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the patch version number
 */
multifeep_err multifeep_get_patch_vers_no(multifeep_intf *inst_ptr,uint8_t system_id,uint16_t *ptch_vers_no)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && ptch_vers_no == NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3 )
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_system_get_status(inst_ptr,system_id,&sts_info);
        *ptch_vers_no=sts_info.ptch_vers_no;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the board error code
 */
multifeep_err multifeep_get_board_err_cde(multifeep_intf *inst_ptr,uint8_t system_id,uint8_t *err_cde)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && err_cde == NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3 )
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_system_get_status(inst_ptr,system_id,&sts_info);
        *err_cde=sts_info.brd_err_cde;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the error counter
 */
multifeep_err multifeep_get_err_counter(multifeep_intf *inst_ptr,uint8_t system_id,uint8_t *err_count)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && err_count == NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3 )
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_system_get_status(inst_ptr,system_id,&sts_info);
        *err_count=sts_info.brd_err_count;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

/*!
 * @brief This API is used to get the start time
 */
multifeep_err multifeep_get_strt_time(multifeep_intf *inst_ptr,uint8_t system_id,uint32_t *strt_time)
{
    multifeep_err sts=MULTIFEEP_ERR;
    if(null_ptr_check(inst_ptr)!= MULTIFEEP_SUCCESS && strt_time == NULL)
    {
        sts=MULTIFEEP_NULL_PTR_ERR;
    }
    else if(system_id > UNIT_3 )
    {
        sts= MULTIFEEP_INVLD_ARG;
    }
    else
    {
        multifeep_system_get_status(inst_ptr,system_id,&sts_info);
        *strt_time=sts_info.strt_tm;
        sts=MULTIFEEP_SUCCESS;
    }
    return sts;
}

