/*
 * ft_debug.h
 *
 *  Created on: 02-Jan-2023
 *      Author: Invcuser52
 */

#ifndef _INC_FT_DEBUG_H_
#define _INC_FT_DEBUG_H_

#include "stdint.h"

typedef enum ft_debug_sel_def
{
	e_ft_none          	         =0,
	e_ft_debug_gen_status  	     =1,
	e_ft_debug_sct_status 	     =2,
	e_ft_debug_terminate         =3,
    e_ft_get_version             =4,
	e_ft_reset 	                 =5,
	e_ft_debug_integ_test 	     =6,
	e_ft_debug_max

}ft_debug_sel;



typedef enum ft_debug_test_id_def
{
	e_ft_test_none          		=0,
	e_ft_test_ig_sus_rq  	        =1,
	e_ft_test_ig_sus_ack 	        =2,
	e_ft_test_ig_res_rq             =3,
	e_ft_test_ig_res_ack 			=4,
	e_ft_test_max

}ft_debug_test_id;


typedef struct ft_debug_sts_def
{
	uint32_t head_pos;
	uint8_t fsm_st;
	uint8_t sus_res_st;
	uint8_t ft_proc_st:       2;
	uint8_t seq_loss_st:      2;
	uint8_t service_run_sts:  4;
	uint8_t reserv2;
	uint16_t prev_tctm_id;
	uint16_t prev_tctm_response;
}ft_debug_gen_sts;



typedef struct ftm_debug_params_def
{
	uint8_t ignore_sus_request:1;
	uint8_t dont_send_ack_for_sus_rqst:1;
	uint8_t ignore_res_request:1;
	uint8_t dont_send_ack_for_res_rqst:1;
	uint8_t skip_all_sus_ack_:1;
	uint8_t skip_all_res_ack_:1;
	uint8_t skip_all_sus_req_:1;
	uint8_t skip_all_res_req_:1;
}ftm_db_params;


void ft_encode_debug_request(ft_debug_sel response_code);
void ft_decode_debug_request_frame(uint8_t *ftdb_data, uint16_t ftdb_data_length);
void ft_decode_debug_response_frame(uint8_t *ftdr_data, uint16_t ftdr_data_length);
void ft_debug_handle(void);
void ft_debug_save_prev_frame_info(uint16_t tctm_id , uint16_t response);
void ft_get_debug_last_tctm_and_response(uint16_t* tctm_id , uint16_t* response);


#endif /* _INC_FT_DEBUG_H_ */
