 #
 # Copyright (C) Jan 2013 Mellanox Technologies Ltd. All rights reserved.
 # Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 #
 # This software is available to you under a choice of one of two
 # licenses.  You may choose to be licensed under the terms of the GNU
 # General Public License (GPL) Version 2, available from the file
 # COPYING in the main directory of this source tree, or the
 # OpenIB.org BSD license below:
 #
 #     Redistribution and use in source and binary forms, with or
 #     without modification, are permitted provided that the following
 #     conditions are met:
 #
 #      - Redistributions of source code must retain the above
 #        copyright notice, this list of conditions and the following
 #        disclaimer.
 #
 #      - Redistributions in binary form must reproduce the above
 #        copyright notice, this list of conditions and the following
 #        disclaimer in the documentation and/or other materials
 #        provided with the distribution.
 #
 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 #


###############################################################################
#    This file was generated at "2025-05-22 10:50:05"
#    by:
#      > gen_adb_data.py -g retimers_prm_projects
###############################################################################

import os
import sys
import ctypes
import platform

import mtcr


class RTPPTT_REG_EXT(ctypes.Structure):
    _fields_ = [
        ("le", ctypes.c_uint8),
        ("ls", ctypes.c_uint8),
        ("en", ctypes.c_uint8),
        ("en_mis", ctypes.c_uint8),
        ("en_mis_cap", ctypes.c_uint8),
        ("data_path", ctypes.c_uint8),
        ("direction_sel", ctypes.c_uint8),
        ("lane", ctypes.c_uint8),
        ("prbs_config_cap", ctypes.c_uint8),
        ("prbs_config_admin", ctypes.c_uint8),
        ("prbs_mode_cap", ctypes.c_uint32),
        ("prbs_mode_cap_ex", ctypes.c_uint32),
        ("prbs_mode_admin", ctypes.c_uint8),
        ("ph_p", ctypes.c_uint8),
        ("lane_rate_cap", ctypes.c_uint16),
        ("lane_rate_admin", ctypes.c_uint16)
    ]

class RTPPRT_REG_EXT(ctypes.Structure):
    _fields_ = [
        ("le", ctypes.c_uint8),
        ("ls", ctypes.c_uint8),
        ("en", ctypes.c_uint8),
        ("en_mis", ctypes.c_uint8),
        ("en_mis_cap", ctypes.c_uint8),
        ("data_path", ctypes.c_uint8),
        ("direction_sel", ctypes.c_uint8),
        ("lane", ctypes.c_uint8),
        ("prbs_config_cap", ctypes.c_uint8),
        ("prbs_config_admin", ctypes.c_uint8),
        ("prbs_hist_fec_int", ctypes.c_uint8),
        ("prbs_hist_res", ctypes.c_uint8),
        ("prbs_hist_lane_sel", ctypes.c_uint8),
        ("prbs_mode_cap", ctypes.c_uint32),
        ("prbs_mode_cap_ex", ctypes.c_uint32),
        ("prbs_mode_admin", ctypes.c_uint8),
        ("ph_p", ctypes.c_uint8),
        ("msb_lsb_cnt", ctypes.c_uint8),
        ("cont_count", ctypes.c_uint8),
        ("hist_all_lanes_cap", ctypes.c_uint8),
        ("lane_rate_cap", ctypes.c_uint16),
        ("auto_pol_rev_fix_cap", ctypes.c_uint8),
        ("lane_rate_admin", ctypes.c_uint16),
        ("auto_pol_rev_fix_en", ctypes.c_uint8),
        ("prbs_lock_status", ctypes.c_uint8),
        ("prbs_tuning_status", ctypes.c_uint8),
        ("prbs_hist_fec_int_msb", ctypes.c_uint8),
        ("prbs_hist_fec_int_cap", ctypes.c_uint8)
    ]

class SLTP_28NM_40NM_EXT(ctypes.Structure):
    _fields_ = [
        ("ob_tap2", ctypes.c_uint8),
        ("ob_tap1", ctypes.c_uint8),
        ("ob_tap0", ctypes.c_uint8),
        ("polarity", ctypes.c_uint8),
        ("ob_bias", ctypes.c_uint8),
        ("ob_reg", ctypes.c_uint8),
        ("ob_preemp_mode", ctypes.c_uint8),
        ("ob_leva", ctypes.c_uint8),
        ("ob_bad_stat", ctypes.c_uint8),
        ("ob_norm", ctypes.c_uint8)
    ]

class SLTP_16NM_EXT(ctypes.Structure):
    _fields_ = [
        ("post_tap", ctypes.c_uint8),
        ("main_tap", ctypes.c_uint8),
        ("pre_tap", ctypes.c_uint8),
        ("pre_2_tap", ctypes.c_uint8),
        ("ob_alev_out", ctypes.c_uint8),
        ("ob_amp", ctypes.c_uint8),
        ("ob_m2lp", ctypes.c_uint8),
        ("ob_bad_stat", ctypes.c_uint16),
        ("regp_bfm1n", ctypes.c_uint8),
        ("regn_bfm1p", ctypes.c_uint8),
        ("obnlev", ctypes.c_uint8),
        ("obplev", ctypes.c_uint8)
    ]

class SLTP_7NM_EXT(ctypes.Structure):
    _fields_ = [
        ("fir_pre2", ctypes.c_uint8),
        ("fir_pre3", ctypes.c_uint8),
        ("ob_bad_stat", ctypes.c_uint8),
        ("drv_amp", ctypes.c_uint8),
        ("fir_post1", ctypes.c_uint8),
        ("fir_main", ctypes.c_uint8),
        ("fir_pre1", ctypes.c_uint8)
    ]

class SLTP_LUT_7NM_EXT(ctypes.Structure):
    _fields_ = [
        ("fir_pre2", ctypes.c_uint8),
        ("fir_pre3", ctypes.c_uint8),
        ("ob_bad_stat", ctypes.c_uint8),
        ("drv_amp", ctypes.c_uint8),
        ("lut0", ctypes.c_uint8),
        ("lut1", ctypes.c_uint8),
        ("lut2", ctypes.c_uint8),
        ("lut3", ctypes.c_uint8),
        ("lut4", ctypes.c_uint8),
        ("lut5", ctypes.c_uint8),
        ("lut6", ctypes.c_uint8),
        ("lut7", ctypes.c_uint8),
        ("lut8", ctypes.c_uint8),
        ("lut9", ctypes.c_uint8),
        ("lut10", ctypes.c_uint8),
        ("lut11", ctypes.c_uint8),
        ("lut12", ctypes.c_uint8),
        ("lut13", ctypes.c_uint8),
        ("lut14", ctypes.c_uint8),
        ("lut15", ctypes.c_uint8),
        ("lut16", ctypes.c_uint8),
        ("lut17", ctypes.c_uint8),
        ("lut18", ctypes.c_uint8),
        ("lut19", ctypes.c_uint8),
        ("lut20", ctypes.c_uint8),
        ("lut21", ctypes.c_uint8),
        ("lut22", ctypes.c_uint8),
        ("lut23", ctypes.c_uint8),
        ("lut24", ctypes.c_uint8),
        ("lut25", ctypes.c_uint8),
        ("lut26", ctypes.c_uint8),
        ("lut27", ctypes.c_uint8),
        ("lut28", ctypes.c_uint8),
        ("lut29", ctypes.c_uint8),
        ("lut30", ctypes.c_uint8),
        ("lut31", ctypes.c_uint8),
        ("lut32", ctypes.c_uint8),
        ("lut33", ctypes.c_uint8),
        ("lut34", ctypes.c_uint8),
        ("lut35", ctypes.c_uint8),
        ("lut36", ctypes.c_uint8),
        ("lut37", ctypes.c_uint8),
        ("lut38", ctypes.c_uint8),
        ("lut39", ctypes.c_uint8),
        ("lut40", ctypes.c_uint8),
        ("lut41", ctypes.c_uint8),
        ("lut42", ctypes.c_uint8),
        ("lut43", ctypes.c_uint8),
        ("lut44", ctypes.c_uint8),
        ("lut45", ctypes.c_uint8),
        ("lut46", ctypes.c_uint8),
        ("lut47", ctypes.c_uint8),
        ("lut48", ctypes.c_uint8),
        ("lut49", ctypes.c_uint8),
        ("lut50", ctypes.c_uint8),
        ("lut51", ctypes.c_uint8),
        ("lut52", ctypes.c_uint8),
        ("lut53", ctypes.c_uint8),
        ("lut54", ctypes.c_uint8),
        ("lut55", ctypes.c_uint8),
        ("lut56", ctypes.c_uint8),
        ("lut57", ctypes.c_uint8),
        ("lut58", ctypes.c_uint8),
        ("lut59", ctypes.c_uint8),
        ("lut60", ctypes.c_uint8),
        ("lut61", ctypes.c_uint8),
        ("lut62", ctypes.c_uint8),
        ("lut63", ctypes.c_uint8)
    ]

class SLTP_5NM_EXT(ctypes.Structure):
    _fields_ = [
        ("ob_bad_stat", ctypes.c_uint16),
        ("lt_preset_sel", ctypes.c_uint8),
        ("lt_preset_sel_cap", ctypes.c_uint8),
        ("no_db_set", ctypes.c_uint8),
        ("tap0", ctypes.c_uint8),
        ("tap1", ctypes.c_uint8),
        ("tap2", ctypes.c_uint8),
        ("tap3", ctypes.c_uint8),
        ("tap4", ctypes.c_uint8),
        ("tap5", ctypes.c_uint8),
        ("tap6", ctypes.c_uint8),
        ("tap7", ctypes.c_uint8),
        ("tap8", ctypes.c_uint8),
        ("tap9", ctypes.c_uint8),
        ("tap10", ctypes.c_uint8),
        ("tap11", ctypes.c_uint8)
    ]

class SLTP_REG_PAGE_DATA_AUTO_EXT(ctypes.Union):
    _fields_ = [
        ("sltp_28nm_40nm_ext", SLTP_28NM_40NM_EXT),
        ("sltp_16nm_ext", SLTP_16NM_EXT),
        ("sltp_7nm_ext", SLTP_7NM_EXT),
        ("sltp_lut_7nm_ext", SLTP_LUT_7NM_EXT),
        ("sltp_5nm_ext", SLTP_5NM_EXT)
    ]

class SLTP_REG_EXT(ctypes.Structure):
    _fields_ = [
        ("c_db", ctypes.c_uint8),
        ("port_type", ctypes.c_uint8),
        ("lane_speed", ctypes.c_uint8),
        ("lane", ctypes.c_uint8),
        ("conf_mod", ctypes.c_uint8),
        ("tx_policy", ctypes.c_uint8),
        ("pnat", ctypes.c_uint8),
        ("local_port", ctypes.c_uint8),
        ("version", ctypes.c_uint8),
        ("status", ctypes.c_uint8),
        ("lp_msb", ctypes.c_uint8),
        ("page_data", SLTP_REG_PAGE_DATA_AUTO_EXT)
    ]

class RTPAOS_REG_EXT(ctypes.Structure):
    _fields_ = [
        ("data_path", ctypes.c_uint8),
        ("eg_in_sep_cap", ctypes.c_uint8),
        ("retrain", ctypes.c_uint8),
        ("sleep_en", ctypes.c_uint8),
        ("sleep_cap", ctypes.c_uint8),
        ("egress_state_oper", ctypes.c_uint8),
        ("egress_state_admin", ctypes.c_uint8),
        ("ingress_state_oper", ctypes.c_uint8),
        ("ingress_state_admin", ctypes.c_uint8)
    ]

class RTLTC_REG_EXT(ctypes.Structure):
    _fields_ = [
        ("lane_mask", ctypes.c_uint8),
        ("data_path", ctypes.c_uint8),
        ("side_sel", ctypes.c_uint8),
        ("physical_lanes", ctypes.c_uint8),
        ("precoding_write_en", ctypes.c_uint8),
        ("polarity_write_en", ctypes.c_uint8),
        ("precoding_cap", ctypes.c_uint8),
        ("rx_precoding_admin", ctypes.c_uint8),
        ("rx_precoding_oper", ctypes.c_uint8),
        ("polarity_cap", ctypes.c_uint8),
        ("rx_polarity_admin", ctypes.c_uint8),
        ("rx_polarity_oper", ctypes.c_uint8),
        ("tx_precoding_admin", ctypes.c_uint8),
        ("tx_precoding_oper", ctypes.c_uint8),
        ("tx_polarity_admin", ctypes.c_uint8),
        ("tx_polarity_oper", ctypes.c_uint8)
    ]

class PHY_ERROR_CNTRS_EXT(ctypes.Structure):
    _fields_ = [
        ("time_since_last_clear_high", ctypes.c_uint32),
        ("time_since_last_clear_low", ctypes.c_uint32),
        ("phy_received_bits_high", ctypes.c_uint32),
        ("phy_received_bits_low", ctypes.c_uint32),
        ("phy_raw_errors_lane0_high", ctypes.c_uint32),
        ("phy_raw_errors_lane0_low", ctypes.c_uint32),
        ("phy_raw_errors_lane1_high", ctypes.c_uint32),
        ("phy_raw_errors_lane1_low", ctypes.c_uint32),
        ("phy_raw_errors_lane2_high", ctypes.c_uint32),
        ("phy_raw_errors_lane2_low", ctypes.c_uint32),
        ("phy_raw_errors_lane3_high", ctypes.c_uint32),
        ("phy_raw_errors_lane3_low", ctypes.c_uint32),
        ("phy_raw_errors_lane4_high", ctypes.c_uint32),
        ("phy_raw_errors_lane4_low", ctypes.c_uint32),
        ("phy_raw_errors_lane5_high", ctypes.c_uint32),
        ("phy_raw_errors_lane5_low", ctypes.c_uint32),
        ("phy_raw_errors_lane6_high", ctypes.c_uint32),
        ("phy_raw_errors_lane6_low", ctypes.c_uint32),
        ("phy_raw_errors_lane7_high", ctypes.c_uint32),
        ("phy_raw_errors_lane7_low", ctypes.c_uint32),
        ("raw_ber_coef", ctypes.c_uint8),
        ("raw_ber_coef_float", ctypes.c_uint8),
        ("raw_ber_magnitude", ctypes.c_uint8),
        ("fc_zero_hist", ctypes.c_uint8),
        ("raw_ber_coef_lane1", ctypes.c_uint8),
        ("raw_ber_coef_float_lane1", ctypes.c_uint8),
        ("raw_ber_magnitude_lane1", ctypes.c_uint8),
        ("raw_ber_coef_lane0", ctypes.c_uint8),
        ("raw_ber_coef_float_lane0", ctypes.c_uint8),
        ("raw_ber_magnitude_lane0", ctypes.c_uint8),
        ("raw_ber_coef_lane3", ctypes.c_uint8),
        ("raw_ber_coef_float_lane3", ctypes.c_uint8),
        ("raw_ber_magnitude_lane3", ctypes.c_uint8),
        ("raw_ber_coef_lane2", ctypes.c_uint8),
        ("raw_ber_coef_float_lane2", ctypes.c_uint8),
        ("raw_ber_magnitude_lane2", ctypes.c_uint8),
        ("raw_ber_coef_lane5", ctypes.c_uint8),
        ("raw_ber_coef_float_lane5", ctypes.c_uint8),
        ("raw_ber_magnitude_lane5", ctypes.c_uint8),
        ("raw_ber_coef_lane4", ctypes.c_uint8),
        ("raw_ber_coef_float_lane4", ctypes.c_uint8),
        ("raw_ber_magnitude_lane4", ctypes.c_uint8),
        ("raw_ber_coef_lane7", ctypes.c_uint8),
        ("raw_ber_coef_float_lane7", ctypes.c_uint8),
        ("raw_ber_magnitude_lane7", ctypes.c_uint8),
        ("raw_ber_coef_lane6", ctypes.c_uint8),
        ("raw_ber_coef_float_lane6", ctypes.c_uint8),
        ("raw_ber_magnitude_lane6", ctypes.c_uint8)
    ]

class L1_GENERAL_COUNTERS_DATA_LOW_EXT(ctypes.Structure):
    _fields_ = [
        ("l1_entry_lane0_high", ctypes.c_uint32),
        ("l1_entry_lane0_low", ctypes.c_uint32),
        ("l1_entry_lane1_high", ctypes.c_uint32),
        ("l1_entry_lane1_low", ctypes.c_uint32),
        ("l1_entry_lane2_high", ctypes.c_uint32),
        ("l1_entry_lane2_low", ctypes.c_uint32),
        ("l1_entry_lane3_high", ctypes.c_uint32),
        ("l1_entry_lane3_low", ctypes.c_uint32),
        ("l1_exit_lane0_high", ctypes.c_uint32),
        ("l1_exit_lane0_low", ctypes.c_uint32),
        ("l1_exit_lane1_high", ctypes.c_uint32),
        ("l1_exit_lane1_low", ctypes.c_uint32),
        ("l1_exit_lane2_high", ctypes.c_uint32),
        ("l1_exit_lane2_low", ctypes.c_uint32),
        ("l1_exit_lane3_high", ctypes.c_uint32),
        ("l1_exit_lane3_low", ctypes.c_uint32),
        ("l1_1024ns_sleeping_lane0_high", ctypes.c_uint32),
        ("l1_1024ns_sleeping_lane0_low", ctypes.c_uint32),
        ("l1_1024ns_sleeping_lane1_high", ctypes.c_uint32),
        ("l1_1024ns_sleeping_lane1_low", ctypes.c_uint32),
        ("l1_1024ns_sleeping_lane2_high", ctypes.c_uint32),
        ("l1_1024ns_sleeping_lane2_low", ctypes.c_uint32),
        ("l1_1024ns_sleeping_lane3_high", ctypes.c_uint32),
        ("l1_1024ns_sleeping_lane3_low", ctypes.c_uint32),
        ("l1_1024ns_wake_lane0_high", ctypes.c_uint32),
        ("l1_1024ns_wake_lane0_low", ctypes.c_uint32),
        ("l1_1024ns_wake_lane1_high", ctypes.c_uint32),
        ("l1_1024ns_wake_lane1_low", ctypes.c_uint32),
        ("l1_1024ns_wake_lane2_high", ctypes.c_uint32),
        ("l1_1024ns_wake_lane2_low", ctypes.c_uint32),
        ("l1_1024ns_wake_lane3_high", ctypes.c_uint32),
        ("l1_1024ns_wake_lane3_low", ctypes.c_uint32)
    ]

class L1_GENERAL_COUNTERS_DATA_HIGH_EXT(ctypes.Structure):
    _fields_ = [
        ("l1_entry_lane4_high", ctypes.c_uint32),
        ("l1_entry_lane4_low", ctypes.c_uint32),
        ("l1_entry_lane5_high", ctypes.c_uint32),
        ("l1_entry_lane5_low", ctypes.c_uint32),
        ("l1_entry_lane6_high", ctypes.c_uint32),
        ("l1_entry_lane6_low", ctypes.c_uint32),
        ("l1_entry_lane7_high", ctypes.c_uint32),
        ("l1_entry_lane7_low", ctypes.c_uint32),
        ("l1_exit_lane4_high", ctypes.c_uint32),
        ("l1_exit_lane4_low", ctypes.c_uint32),
        ("l1_exit_lane5_high", ctypes.c_uint32),
        ("l1_exit_lane5_low", ctypes.c_uint32),
        ("l1_exit_lane6_high", ctypes.c_uint32),
        ("l1_exit_lane6_low", ctypes.c_uint32),
        ("l1_exit_lane7_high", ctypes.c_uint32),
        ("l1_exit_lane7_low", ctypes.c_uint32),
        ("l1_1024ns_sleeping_lane4_high", ctypes.c_uint32),
        ("l1_1024ns_sleeping_lane4_low", ctypes.c_uint32),
        ("l1_1024ns_sleeping_lane5_high", ctypes.c_uint32),
        ("l1_1024ns_sleeping_lane5_low", ctypes.c_uint32),
        ("l1_1024ns_sleeping_lane6_high", ctypes.c_uint32),
        ("l1_1024ns_sleeping_lane6_low", ctypes.c_uint32),
        ("l1_1024ns_sleeping_lane7_high", ctypes.c_uint32),
        ("l1_1024ns_sleeping_lane7_low", ctypes.c_uint32),
        ("l1_1024ns_wake_lane4_high", ctypes.c_uint32),
        ("l1_1024ns_wake_lane4_low", ctypes.c_uint32),
        ("l1_1024ns_wake_lane5_high", ctypes.c_uint32),
        ("l1_1024ns_wake_lane5_low", ctypes.c_uint32),
        ("l1_1024ns_wake_lane6_high", ctypes.c_uint32),
        ("l1_1024ns_wake_lane6_low", ctypes.c_uint32),
        ("l1_1024ns_wake_lane7_high", ctypes.c_uint32),
        ("l1_1024ns_wake_lane7_low", ctypes.c_uint32)
    ]

class HISTOGRAM_COUNTERS_EXT(ctypes.Structure):
    _fields_ = [
        ("bin", ctypes.c_uint64 * 10)
    ]

class RTPCNT_DEBUG_COUNTERS_EXT(ctypes.Structure):
    _fields_ = [
        ("cdr_loss_lock_lane0_high", ctypes.c_uint32),
        ("cdr_loss_lock_lane0_low", ctypes.c_uint32),
        ("cdr_loss_lock_lane1_high", ctypes.c_uint32),
        ("cdr_loss_lock_lane1_low", ctypes.c_uint32),
        ("cdr_loss_lock_lane2_high", ctypes.c_uint32),
        ("cdr_loss_lock_lane2_low", ctypes.c_uint32),
        ("cdr_loss_lock_lane3_high", ctypes.c_uint32),
        ("cdr_loss_lock_lane3_low", ctypes.c_uint32),
        ("cdr_loss_lock_lane4_high", ctypes.c_uint32),
        ("cdr_loss_lock_lane4_low", ctypes.c_uint32),
        ("cdr_loss_lock_lane5_high", ctypes.c_uint32),
        ("cdr_loss_lock_lane5_low", ctypes.c_uint32),
        ("cdr_loss_lock_lane6_high", ctypes.c_uint32),
        ("cdr_loss_lock_lane6_low", ctypes.c_uint32),
        ("cdr_loss_lock_lane7_high", ctypes.c_uint32),
        ("cdr_loss_lock_lane7_low", ctypes.c_uint32)
    ]

class RTPCNT_REG_COUNTER_SET_AUTO_EXT(ctypes.Union):
    _fields_ = [
        ("phy_error_cntrs_ext", PHY_ERROR_CNTRS_EXT),
        ("l1_general_counters_data_low_ext", L1_GENERAL_COUNTERS_DATA_LOW_EXT),
        ("l1_general_counters_data_high_ext", L1_GENERAL_COUNTERS_DATA_HIGH_EXT),
        ("histogram_counters_ext", HISTOGRAM_COUNTERS_EXT),
        ("rtpcnt_debug_counters_ext", RTPCNT_DEBUG_COUNTERS_EXT)
    ]

class RTPCNT_REG_EXT(ctypes.Structure):
    _fields_ = [
        ("grp", ctypes.c_uint8),
        ("data_path", ctypes.c_uint8),
        ("side_sel", ctypes.c_uint8),
        ("l1_grp_support", ctypes.c_uint8),
        ("clr", ctypes.c_uint8),
        ("counter_set", RTPCNT_REG_COUNTER_SET_AUTO_EXT)
    ]

class MBTR_EXT(ctypes.Structure):
    _fields_ = [
        ("cmd", ctypes.c_uint8),
        ("status", ctypes.c_uint8)
    ]

class MRFV_CVB_EXT(ctypes.Structure):
    _fields_ = [
        ("cvb_data_index", ctypes.c_uint8),
        ("selector", ctypes.c_uint8),
        ("cvb_voltage", ctypes.c_uint16),
        ("tav_cvb_voltage", ctypes.c_uint16)
    ]

class MRFV_ULT_EXT(ctypes.Structure):
    _fields_ = [
        ("ult_lot_digit_1", ctypes.c_uint8),
        ("ult_lot_digit_2", ctypes.c_uint8),
        ("ult_lot_digit_3", ctypes.c_uint8),
        ("ult_lot_digit_4", ctypes.c_uint8),
        ("ult_lot_digit_5", ctypes.c_uint8),
        ("ult_lot_digit_6", ctypes.c_uint8),
        ("ult_lot_digit_7", ctypes.c_uint8),
        ("ult_lot_digit_8", ctypes.c_uint8),
        ("ult_y", ctypes.c_uint8),
        ("ult_x", ctypes.c_uint8),
        ("ult_wafer_number", ctypes.c_uint8),
        ("ult_err_detection", ctypes.c_uint8)
    ]

class MRFV_PVS_MAIN_EXT(ctypes.Structure):
    _fields_ = [
        ("pvs_main_data", ctypes.c_uint8)
    ]

class MRFV_PVS_TILE_EXT(ctypes.Structure):
    _fields_ = [
        ("pvs_tile_data", ctypes.c_uint8)
    ]

class MRFV_DATA_AUTO_EXT(ctypes.Union):
    _fields_ = [
        ("MRFV_CVB_ext", MRFV_CVB_EXT),
        ("MRFV_ULT_ext", MRFV_ULT_EXT),
        ("MRFV_PVS_MAIN_ext", MRFV_PVS_MAIN_EXT),
        ("MRFV_PVS_TILE_ext", MRFV_PVS_TILE_EXT)
    ]

class MRFV_EXT(ctypes.Structure):
    _fields_ = [
        ("fuse_id", ctypes.c_uint8),
        ("fm", ctypes.c_uint8),
        ("v", ctypes.c_uint8),
        ("data", MRFV_DATA_AUTO_EXT)
    ]

