#!/usr/bin/env python3
#
# Copyright 2025 Ettus Research, a National Instruments Brand
#
# SPDX-License-Identifier: MIT
#

from hwtools.api import vapi

def do_options():
    vapi.set_project_name(name="X440_FPGA", pretty_name="USRP X440 FPGA")

def do_files():
    # x400 related files
    vapi.find_files_and_add_to_fileset(base="repo", path="fpga/usrp3/top/x400", tree=False)
    vapi.find_files_and_add_to_fileset(base="repo", path="fpga/usrp3/top/x400/cpld/common")
    vapi.find_files_and_add_to_fileset(base="repo", path="fpga/usrp3/top/x400/cpld/x440")
    vapi.find_files_and_add_to_fileset(base="repo", path="fpga/usrp3/top/x400/dboards", tree=False)
    vapi.find_files_and_add_to_fileset(base="repo", path="fpga/usrp3/top/x400/dboards/fbx")
    vapi.find_files_and_add_to_fileset(base="repo", path="fpga/usrp3/top/x400/rf/common")
    vapi.find_files_and_add_to_fileset(base="repo", path="fpga/usrp3/top/x400/rf/full")
    vapi.find_files_and_add_to_fileset(base="repo", path="fpga/usrp3/top/x400/ip/x4xx_ps_rfdc_bd/common/regmap")
    vapi.find_files_and_add_to_fileset(base="repo", path="fpga/usrp3/top/x400/ip/x4xx_ps_rfdc_bd/x440_ps_rfdc_bd/regmap")

    # library
    vapi.find_files_and_add_to_fileset(base="repo", path="fpga/usrp3/lib/rfnoc")

    # regmap files
    vapi.find_files_and_add_to_fileset(base="repo", path="fpga/usrp3/top/x400/regmap", tree=False)
    vapi.find_files_and_add_to_fileset(base="repo", path="fpga/usrp3/top/x400/regmap/x440", tree=False)
    vapi.find_files_and_add_to_fileset(base="repo", path="fpga/usrp3/top/x400/cpld/regmap", tree=False)
    vapi.find_files_and_add_to_fileset(base="repo", path="fpga/usrp3/top/x400/cpld/regmap/x440", tree=False)

def do_preparse():
    pass

def do_precompile():
    pass

def do_presynth():
    pass

def do_finish():
    vapi.run_user_function(function="update_xmlparse_files", base="self", path="../common.py")

def vhook_warn_filter(msgstr):
    return False
