/*
 * bt_manage.h
 *
 *  Created on: 11-Jul-2022
 *      Author: Invcuser52
 */


//#define BTABLE_PREPARE_H_

#ifndef BTABLE_PREPARE_H_
#define BTABLE_PREPARE_H_

#include "boot_lut_def.h"


#define SET_LOADING 	0x10
#define CLEAR_LOADING 	0x20
#define SET_CLEAR_UNDEF 0x00


typedef struct btable_api_list_def
{

	void      		(*btable_set_boot_selctor_fp)(e_sbl_list set);
	e_sbl_list 		(*btable_get_boot_selctor_fp)(void);
	void 			(*btable_set_lut_table_fp)(void);
	e_module_list 	(*btable_get_module_count_fp)(void);
	uint8_t 		(*btable_get_module_sts_fp)(e_module_list mouduleid);
	uint16_t 		(*btable_get_boot_sucees_sts_fp)(e_sbl_list boot_id);
	e_ffs_flag 		(*btable_get_ffs_sts_fp)(void);
	uint32_t 		(*btable_get_module_stored_address_fp)(e_module_list mouduleid);
	uint32_t 		(*btable_get_module_load_address_flash_fp)(e_module_list mouduleid);
	uint32_t 		(*btable_get_module_load_address_ram_fp)(e_module_list mouduleid);
	uint32_t 		(*btable_get_module_bin_size_fp)(e_module_list mouduleid);
	uint32_t 		(*btable_get_module_bin_size_for_flash_fp)(e_module_list mouduleid);
	e_sbl_list 		(*btable_get_swapped_btable_id_fp)(void);
	uint8_t 		(*btable_fwrite_stored_pos_fp)(uint8_t module_id, uint32_t stored_address, uint32_t, uint32_t, uint8_t);
	uint8_t 		(*btable_fwrite_mod_sts_fp)(uint8_t, uint8_t);
	uint8_t 		(*btable_fwrite_mod_load_success_sts_fp)(uint8_t module_id, uint8_t sts, uint32_t flash_loc, uint32_t ram_loc);
	uint8_t 		(*btable_fwrite_set_reboot_fp)(e_module_list module_cnt, e_ffs_flag);
	uint8_t			(*btable_fwrite_reboot_success_fp)(e_module_list module_cnt,e_ffs_flag ffs );
	uint8_t 		(*btable_boot_manager_fp)(void);
	void 			(*btable_swap_fp)(void);
	void			(*btable_erase_fp)(void);
	uint8_t 		(*btable_prepare_vfb_fp)(uint8_t module_id, uint32_t stored_address, uint32_t packets, uint32_t bin_size);
	void 			(*btable_activate_boot_lut_one_fp)(void);
	void 			(*btable_swap_for_reboot_fp)(void);
	uint8_t			(*btable_get_singlebin_boot_sts_fp)(void);
	void 			(*btable_get_singlebin_boot_clear_fp)(uint8_t clear);
	void 			(*btable_copyto_databank_fp)(void);
	void 			(*btable_set_bank_address_fp)(void);
	void 			(*btable_delete_databank_fp)(void);
	e_bank_selection (*btable_get_data_bank_id_fp)(void);
	void 			(*btable_module_copyto_previous_table_fp)(e_module_list module_cnt);
	uint8_t 		(*btable_fwrite_update_level1_fallback_info_fp)(e_sbl_list copy_from, e_sbl_list copy_to, uint32_t fallback_loc);
	uint8_t 		(*btable_new_software_validataion_flag_read_fp)(void);
	uint8_t			(*btable_fwrite_vfb_nor_cpy_state_update_fp)(uint8_t set);
	uint8_t 		(*btable_fwrite_clear_fallback_fp)(uint32_t fallback_code);
	uint32_t 		(*btable_get_fallback_code_fp)(e_sbl_list set);
	uint16_t 		(*btable_get_table_size_fp)(void);
	uint8_t 		(*btable_copy_blt_table_fp)(e_sbl_list table_id, uint8_t *write_buf);
	e_sbl_list 		(*btable_get_active_boottable_fp)(void);

}s_btable_api_list_def;


#define btable_set_boot_selctor                  btable_api->btable_set_boot_selctor_fp
#define btable_get_boot_selctor                  btable_api->btable_get_boot_selctor_fp
#define btable_set_lut_table                     btable_api->btable_set_lut_table_fp
#define btable_get_module_count                  btable_api->btable_get_module_count_fp
#define btable_get_module_sts                    btable_api->btable_get_module_sts_fp
#define btable_get_boot_sucees_sts               btable_api->btable_get_boot_sucees_sts_fp
#define btable_get_ffs_sts                       btable_api->btable_get_ffs_sts_fp
#define btable_get_module_stored_address         btable_api->btable_get_module_stored_address_fp
#define btable_get_module_load_address_flash     btable_api->btable_get_module_load_address_flas_fp
#define btable_get_module_load_address_ram       btable_api->btable_get_module_load_address_ram_fp
#define btable_get_module_bin_size               btable_api->btable_get_module_bin_size_fp
#define btable_get_module_bin_size_for_flash     btable_api->btable_get_module_bin_size_for_flash_fp
#define btable_get_swapped_btable_id             btable_api->btable_get_swapped_btable_id_fp
#define btable_fwrite_stored_pos                 btable_api->btable_fwrite_stored_pos_fp
#define btable_fwrite_mod_sts                    btable_api->btable_fwrite_mod_sts_fp
#define btable_fwrite_mod_load_success_sts       btable_api->btable_fwrite_mod_load_success_sts_fp
#define btable_fwrite_set_reboot                 btable_api->btable_fwrite_set_reboot_fp
#define btable_fwrite_reboot_success             btable_api->btable_fwrite_reboot_success_fp
#define btable_boot_manager                      btable_api->btable_boot_manager_fp
#define btable_swap                              btable_api->btable_swap_fp
#define btable_erase                             btable_api->btable_erase_fp
#define btable_prepare_vfb                       btable_api->btable_prepare_vfb_fp
#define btable_activate_boot_lut_one             btable_api->btable_activate_boot_lut_one_fp
#define btable_swap_for_reboot                   btable_api->btable_swap_for_reboot_fp
#define btable_get_singlebin_boot_sts            btable_api->btable_get_singlebin_boot_sts_fp
#define btable_get_singlebin_boot_clear          btable_api->btable_get_singlebin_boot_clear_fp
#define btable_copyto_databank                   btable_api->btable_copyto_databank_fp
#define btable_set_bank_address                  btable_api->btable_set_bank_address_fp
#define btable_delete_databank                   btable_api->btable_delete_databank_fp
#define btable_get_data_bank_id                  btable_api->btable_get_data_bank_id_fp
#define btable_module_copyto_previous_table      btable_api->btable_module_copyto_previous_table_fp
#define btable_fwrite_update_level1_fallback_info      btable_api->btable_fwrite_update_level1_fallback_info_fp
#define btable_new_software_validataion_flag_read      btable_api->btable_new_software_validataion_flag_read_fp
#define btable_fwrite_vfb_nor_cpy_state_update		   btable_api->btable_fwrite_vfb_nor_cpy_state_update_fp
#define btable_fwrite_clear_fallback			 btable_api->btable_fwrite_clear_fallback_fp
#define btable_get_fallback_code				 btable_api->btable_get_fallback_code_fp
#define btable_get_table_size    				 btable_api->btable_get_table_size_fp
#define btable_copy_blt_table				 	 btable_api->btable_copy_blt_table_fp
#define btable_get_active_boottable				 btable_api->btable_get_active_boottable_fp

#endif /* BTABLE_PREPARE_H_ */
