|
|
@ -10,23 +10,24 @@ import enum
|
|
|
|
import logging
|
|
|
|
import logging
|
|
|
|
import struct
|
|
|
|
import struct
|
|
|
|
|
|
|
|
|
|
|
|
from eive_tmtc.config.object_ids import PLOC_SUPV_ID, get_object_ids
|
|
|
|
|
|
|
|
from eive_tmtc.config.definitions import CustomServiceList
|
|
|
|
|
|
|
|
from eive_tmtc.pus_tm.defs import PrintWrapper
|
|
|
|
|
|
|
|
from spacepackets.ecss.tc import PusTelecommand
|
|
|
|
from spacepackets.ecss.tc import PusTelecommand
|
|
|
|
from tmtccmd.pus.tc.s3_fsfw_hk import generate_one_hk_command, make_sid
|
|
|
|
|
|
|
|
from tmtccmd.config import TmtcDefinitionWrapper
|
|
|
|
from tmtccmd.config import TmtcDefinitionWrapper
|
|
|
|
from tmtccmd.config.tmtc import tmtc_definitions_provider, OpCodeEntry
|
|
|
|
from tmtccmd.config.tmtc import OpCodeEntry, tmtc_definitions_provider
|
|
|
|
|
|
|
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
|
|
|
|
|
|
|
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
|
|
|
|
|
|
|
|
from tmtccmd.pus.s200_fsfw_mode import Mode, pack_mode_data
|
|
|
|
|
|
|
|
from tmtccmd.pus.tc.s3_fsfw_hk import generate_one_hk_command, make_sid
|
|
|
|
from tmtccmd.tmtc import service_provider
|
|
|
|
from tmtccmd.tmtc import service_provider
|
|
|
|
from tmtccmd.tmtc.decorator import ServiceProviderParams
|
|
|
|
from tmtccmd.tmtc.decorator import ServiceProviderParams
|
|
|
|
from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode
|
|
|
|
|
|
|
|
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
|
|
|
|
from eive_tmtc.config.definitions import CustomServiceList
|
|
|
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
|
|
|
from eive_tmtc.config.object_ids import PLOC_SUPV_ID, get_object_ids
|
|
|
|
|
|
|
|
from eive_tmtc.pus_tm.defs import PrintWrapper
|
|
|
|
from eive_tmtc.utility.input_helper import InputHelper
|
|
|
|
from eive_tmtc.utility.input_helper import InputHelper
|
|
|
|
|
|
|
|
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
latchup_id_dict = {
|
|
|
|
LATCHUP_ID_DICT = {
|
|
|
|
"0": "0.85V",
|
|
|
|
"0": "0.85V",
|
|
|
|
"1": "1.8V",
|
|
|
|
"1": "1.8V",
|
|
|
|
"2": "MISC",
|
|
|
|
"2": "MISC",
|
|
|
@ -40,7 +41,7 @@ HARDCODED = "0"
|
|
|
|
MANUAL_INPUT = "1"
|
|
|
|
MANUAL_INPUT = "1"
|
|
|
|
HARDCODED_FILE = "/home/rmueller/EIVE/mpsoc_boot.bin"
|
|
|
|
HARDCODED_FILE = "/home/rmueller/EIVE/mpsoc_boot.bin"
|
|
|
|
|
|
|
|
|
|
|
|
update_file_dict = {
|
|
|
|
UPDATE_FILE_DICT = {
|
|
|
|
HARDCODED: ["hardcoded", ""],
|
|
|
|
HARDCODED: ["hardcoded", ""],
|
|
|
|
MANUAL_INPUT: ["manual input", ""],
|
|
|
|
MANUAL_INPUT: ["manual input", ""],
|
|
|
|
"2": ["/mnt/sd0/ploc/supervisor/update.bin", "/mnt/sd0/ploc/supervisor/update.bin"],
|
|
|
|
"2": ["/mnt/sd0/ploc/supervisor/update.bin", "/mnt/sd0/ploc/supervisor/update.bin"],
|
|
|
@ -58,7 +59,7 @@ update_file_dict = {
|
|
|
|
],
|
|
|
|
],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
event_buffer_path_dict = {
|
|
|
|
EVENT_BUFFER_PATH_DICT = {
|
|
|
|
MANUAL_INPUT: ["manual input", ""],
|
|
|
|
MANUAL_INPUT: ["manual input", ""],
|
|
|
|
"2": ["/mnt/sd0/ploc/supervisor", "/mnt/sd0/ploc/supervisor"],
|
|
|
|
"2": ["/mnt/sd0/ploc/supervisor", "/mnt/sd0/ploc/supervisor"],
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -84,7 +85,7 @@ FACTORY_RESET_OPS = {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SupvActionId(enum.IntEnum):
|
|
|
|
class SupvActionId(enum.IntEnum):
|
|
|
|
HK_REPORT = 1
|
|
|
|
REQUEST_HK_REPORT = 1
|
|
|
|
START_MPSOC = 3
|
|
|
|
START_MPSOC = 3
|
|
|
|
SHUTWOWN_MPSOC = 4
|
|
|
|
SHUTWOWN_MPSOC = 4
|
|
|
|
SEL_MPSOC_BOOT_IMAGE = 5
|
|
|
|
SEL_MPSOC_BOOT_IMAGE = 5
|
|
|
@ -111,7 +112,7 @@ class SupvActionId(enum.IntEnum):
|
|
|
|
SET_GPIO = 34
|
|
|
|
SET_GPIO = 34
|
|
|
|
READ_GPIO = 35
|
|
|
|
READ_GPIO = 35
|
|
|
|
RESTART_SUPERVISOR = 36
|
|
|
|
RESTART_SUPERVISOR = 36
|
|
|
|
LOGGING_REQUEST_COUNTERS = 38
|
|
|
|
REQUEST_LOGGING_COUNTERS = 38
|
|
|
|
FACTORY_RESET = 39
|
|
|
|
FACTORY_RESET = 39
|
|
|
|
START_MPSOC_QUIET = 45
|
|
|
|
START_MPSOC_QUIET = 45
|
|
|
|
SET_SHUTDOWN_TIMEOUT = 46
|
|
|
|
SET_SHUTDOWN_TIMEOUT = 46
|
|
|
@ -130,27 +131,32 @@ class SupvActionId(enum.IntEnum):
|
|
|
|
MEM_CHECK = 61
|
|
|
|
MEM_CHECK = 61
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SetIds(enum.IntEnum):
|
|
|
|
class SetId(enum.IntEnum):
|
|
|
|
HK_REPORT = 102
|
|
|
|
HK_REPORT = 102
|
|
|
|
BOOT_STATUS_REPORT = 103
|
|
|
|
BOOT_STATUS_REPORT = 103
|
|
|
|
|
|
|
|
LATCHUP_REPORT = 104
|
|
|
|
|
|
|
|
COUNTERS_REPORT = 105
|
|
|
|
|
|
|
|
ADC_REPORT = 106
|
|
|
|
|
|
|
|
UPDATE_STATUS_REPORT = 107
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class OpCodes:
|
|
|
|
class OpCode:
|
|
|
|
OFF = ["0", "off"]
|
|
|
|
OFF = "off"
|
|
|
|
ON = ["1", "on"]
|
|
|
|
ON = "on"
|
|
|
|
NORMAL = ["2", "nml"]
|
|
|
|
NORMAL = "nml"
|
|
|
|
HK_TO_OBC = ["3", "hk_to_obc"]
|
|
|
|
HK_TO_OBC = "hk_to_obc"
|
|
|
|
REQUEST_HK = ["4", "req_hk"]
|
|
|
|
REQUEST_HK_SET_FROM_DEV = "req_hk_from_dev"
|
|
|
|
START_MPSOC = ["5", "start_mpsoc"]
|
|
|
|
REQUEST_HK_SET = "req_hk"
|
|
|
|
SHUTDOWN_MPSOC = ["6", "stop_mpsoc"]
|
|
|
|
START_MPSOC = "start_mpsoc"
|
|
|
|
SEL_NVM = ["7", "sel_nvm"]
|
|
|
|
SHUTDOWN_MPSOC = "stop_mpsoc"
|
|
|
|
SET_TIME_REF = ["set_time_ref"]
|
|
|
|
SEL_NVM = "sel_nvm"
|
|
|
|
FACTORY_FLASH = ["factory_flash"]
|
|
|
|
SET_TIME_REF = "set_time_ref"
|
|
|
|
REQ_BOOT_STATUS_REPORT = ["13", "boot_report"]
|
|
|
|
FACTORY_FLASH = "factory_flash"
|
|
|
|
START_UPDATE = ["42", "start_update"]
|
|
|
|
REQ_BOOT_STATUS_REPORT = "boot_report"
|
|
|
|
PERFORM_UPDATE = ["update"]
|
|
|
|
START_UPDATE = "start_update"
|
|
|
|
FACTORY_RESET = ["factory_reset"]
|
|
|
|
PERFORM_UPDATE = "update"
|
|
|
|
MEM_CHECK = ["mem_check"]
|
|
|
|
FACTORY_RESET = "factory_reset"
|
|
|
|
|
|
|
|
MEM_CHECK = "mem_check"
|
|
|
|
RESET_MPSOC = "reset_mpsoc"
|
|
|
|
RESET_MPSOC = "reset_mpsoc"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -160,7 +166,8 @@ class Info(str, enum.Enum):
|
|
|
|
ON = "Switch On"
|
|
|
|
ON = "Switch On"
|
|
|
|
NML = "Switch Normal"
|
|
|
|
NML = "Switch Normal"
|
|
|
|
HK_TO_OBC = "Request HK from PLOC SUPV"
|
|
|
|
HK_TO_OBC = "Request HK from PLOC SUPV"
|
|
|
|
REQUEST_HK = "Request HK set from PLOC Handler"
|
|
|
|
REQUEST_HK_SET_FROM_DEV = "Request HK set from the device to the PLOC Handler"
|
|
|
|
|
|
|
|
REQUEST_HK_SET = "Request HK set from PLOC Handler"
|
|
|
|
SET_TIME_REF = "Set time reference"
|
|
|
|
SET_TIME_REF = "Set time reference"
|
|
|
|
FACTORY_FLASH = "Factory Flash Mode"
|
|
|
|
FACTORY_FLASH = "Factory Flash Mode"
|
|
|
|
PERFORM_UPDATE = "Start or continue MPSoC SW update at starting bytes"
|
|
|
|
PERFORM_UPDATE = "Start or continue MPSoC SW update at starting bytes"
|
|
|
@ -175,21 +182,22 @@ class Info(str, enum.Enum):
|
|
|
|
@tmtc_definitions_provider
|
|
|
|
@tmtc_definitions_provider
|
|
|
|
def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper):
|
|
|
|
def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper):
|
|
|
|
oce = OpCodeEntry()
|
|
|
|
oce = OpCodeEntry()
|
|
|
|
oce.add(OpCodes.OFF, Info.OFF)
|
|
|
|
oce.add(OpCode.OFF, Info.OFF)
|
|
|
|
oce.add(OpCodes.ON, Info.ON)
|
|
|
|
oce.add(OpCode.ON, Info.ON)
|
|
|
|
oce.add(OpCodes.NORMAL, Info.NML)
|
|
|
|
oce.add(OpCode.NORMAL, Info.NML)
|
|
|
|
oce.add(OpCodes.HK_TO_OBC, Info.HK_TO_OBC)
|
|
|
|
oce.add(OpCode.HK_TO_OBC, Info.HK_TO_OBC)
|
|
|
|
oce.add(OpCodes.REQUEST_HK, Info.REQUEST_HK)
|
|
|
|
oce.add(OpCode.REQUEST_HK_SET, Info.REQUEST_HK_SET)
|
|
|
|
oce.add(OpCodes.START_MPSOC, "PLOC Supervisor: Start MPSoC")
|
|
|
|
oce.add(OpCode.REQUEST_HK_SET_FROM_DEV, Info.REQUEST_HK_SET_FROM_DEV)
|
|
|
|
oce.add(OpCodes.SHUTDOWN_MPSOC, "PLOC Supervisor: Shutdown MPSoC")
|
|
|
|
oce.add(OpCode.START_MPSOC, "PLOC Supervisor: Start MPSoC")
|
|
|
|
oce.add(OpCodes.SEL_NVM, Info.SEL_NVM)
|
|
|
|
oce.add(OpCode.SHUTDOWN_MPSOC, "PLOC Supervisor: Shutdown MPSoC")
|
|
|
|
oce.add(OpCodes.SET_TIME_REF, Info.SET_TIME_REF)
|
|
|
|
oce.add(OpCode.SEL_NVM, Info.SEL_NVM)
|
|
|
|
oce.add(OpCodes.FACTORY_RESET, Info.FACTORY_RESET)
|
|
|
|
oce.add(OpCode.SET_TIME_REF, Info.SET_TIME_REF)
|
|
|
|
oce.add(OpCodes.RESET_MPSOC, Info.RESET_MPSOC)
|
|
|
|
oce.add(OpCode.FACTORY_RESET, Info.FACTORY_RESET)
|
|
|
|
|
|
|
|
oce.add(OpCode.RESET_MPSOC, Info.RESET_MPSOC)
|
|
|
|
oce.add("8", "PLOC Supervisor: Set max restart tries")
|
|
|
|
oce.add("8", "PLOC Supervisor: Set max restart tries")
|
|
|
|
oce.add("11", "PLOC Supervisor: Set boot timeout")
|
|
|
|
oce.add("11", "PLOC Supervisor: Set boot timeout")
|
|
|
|
oce.add("12", "PLOC Supervisor: Disable Hk")
|
|
|
|
oce.add("12", "PLOC Supervisor: Disable Hk")
|
|
|
|
oce.add(OpCodes.REQ_BOOT_STATUS_REPORT, Info.REQ_BOOT_STATUS_REPORT)
|
|
|
|
oce.add(OpCode.REQ_BOOT_STATUS_REPORT, Info.REQ_BOOT_STATUS_REPORT)
|
|
|
|
oce.add("17", "PLOC Supervisor: Enable latchup alert")
|
|
|
|
oce.add("17", "PLOC Supervisor: Enable latchup alert")
|
|
|
|
oce.add("18", "PLOC Supervisor: Disable latchup alert")
|
|
|
|
oce.add("18", "PLOC Supervisor: Disable latchup alert")
|
|
|
|
oce.add("20", "PLOC Supervisor: Set alert limit")
|
|
|
|
oce.add("20", "PLOC Supervisor: Set alert limit")
|
|
|
@ -203,12 +211,12 @@ def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper):
|
|
|
|
oce.add("35", "PLOC Supervisor: Set GPIO")
|
|
|
|
oce.add("35", "PLOC Supervisor: Set GPIO")
|
|
|
|
oce.add("36", "PLOC Supervisor: Read GPIO")
|
|
|
|
oce.add("36", "PLOC Supervisor: Read GPIO")
|
|
|
|
oce.add("37", "PLOC Supervisor: Restart supervisor")
|
|
|
|
oce.add("37", "PLOC Supervisor: Restart supervisor")
|
|
|
|
oce.add(OpCodes.PERFORM_UPDATE, Info.PERFORM_UPDATE)
|
|
|
|
oce.add(OpCode.PERFORM_UPDATE, Info.PERFORM_UPDATE)
|
|
|
|
oce.add(OpCodes.START_UPDATE, Info.START_UPDATE)
|
|
|
|
oce.add(OpCode.START_UPDATE, Info.START_UPDATE)
|
|
|
|
oce.add("43", "PLOC Supervisor: Terminate supervisor process")
|
|
|
|
oce.add("43", "PLOC Supervisor: Terminate supervisor process")
|
|
|
|
oce.add("44", "PLOC Supervisor: Start MPSoC quiet")
|
|
|
|
oce.add("44", "PLOC Supervisor: Start MPSoC quiet")
|
|
|
|
oce.add("45", "PLOC Supervisor: Set shutdown timeout")
|
|
|
|
oce.add("45", "PLOC Supervisor: Set shutdown timeout")
|
|
|
|
oce.add(OpCodes.FACTORY_FLASH, Info.FACTORY_FLASH)
|
|
|
|
oce.add(OpCode.FACTORY_FLASH, Info.FACTORY_FLASH)
|
|
|
|
oce.add("47", "PLOC Supervisor: Enable auto TM")
|
|
|
|
oce.add("47", "PLOC Supervisor: Enable auto TM")
|
|
|
|
oce.add("48", "PLOC Supervisor: Disable auto TM")
|
|
|
|
oce.add("48", "PLOC Supervisor: Disable auto TM")
|
|
|
|
oce.add("51", "PLOC Supervisor: Logging request event buffers")
|
|
|
|
oce.add("51", "PLOC Supervisor: Logging request event buffers")
|
|
|
@ -219,7 +227,7 @@ def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper):
|
|
|
|
oce.add("56", "PLOC Supervisor: Reset PL")
|
|
|
|
oce.add("56", "PLOC Supervisor: Reset PL")
|
|
|
|
oce.add("57", "PLOC Supervisor: Enable NVMs")
|
|
|
|
oce.add("57", "PLOC Supervisor: Enable NVMs")
|
|
|
|
oce.add("58", "PLOC Supervisor: Continue update")
|
|
|
|
oce.add("58", "PLOC Supervisor: Continue update")
|
|
|
|
oce.add(OpCodes.MEM_CHECK, Info.MEM_CHECK)
|
|
|
|
oce.add(OpCode.MEM_CHECK, Info.MEM_CHECK)
|
|
|
|
defs.add_service(CustomServiceList.PLOC_SUPV.value, "PLOC Supervisor", oce)
|
|
|
|
defs.add_service(CustomServiceList.PLOC_SUPV.value, "PLOC Supervisor", oce)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -228,39 +236,56 @@ def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901
|
|
|
|
q = p.queue_helper
|
|
|
|
q = p.queue_helper
|
|
|
|
op_code = p.op_code
|
|
|
|
op_code = p.op_code
|
|
|
|
object_id = get_object_ids().get(PLOC_SUPV_ID)
|
|
|
|
object_id = get_object_ids().get(PLOC_SUPV_ID)
|
|
|
|
|
|
|
|
assert object_id is not None
|
|
|
|
q.add_log_cmd(f"Testing PLOC Supervisor with object id: {object_id.as_hex_string}")
|
|
|
|
q.add_log_cmd(f"Testing PLOC Supervisor with object id: {object_id.as_hex_string}")
|
|
|
|
obyt = object_id.as_bytes
|
|
|
|
obyt = object_id.as_bytes
|
|
|
|
prefix = "PLOC Supervisor"
|
|
|
|
prefix = "PLOC Supervisor"
|
|
|
|
if op_code in OpCodes.OFF:
|
|
|
|
if op_code == OpCode.OFF:
|
|
|
|
q.add_log_cmd(f"{prefix}: {Info.OFF}")
|
|
|
|
q.add_log_cmd(f"{prefix}: {Info.OFF}")
|
|
|
|
command = pack_mode_data(object_id.as_bytes, Mode.OFF, 0)
|
|
|
|
command = pack_mode_data(object_id.as_bytes, Mode.OFF, 0)
|
|
|
|
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
|
|
|
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
|
|
|
if op_code in OpCodes.ON:
|
|
|
|
if op_code == OpCode.ON:
|
|
|
|
q.add_log_cmd(f"{prefix}: {Info.ON}")
|
|
|
|
q.add_log_cmd(f"{prefix}: {Info.ON}")
|
|
|
|
command = pack_mode_data(object_id.as_bytes, Mode.ON, 0)
|
|
|
|
command = pack_mode_data(object_id.as_bytes, Mode.ON, 0)
|
|
|
|
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
|
|
|
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
|
|
|
if op_code in OpCodes.NORMAL:
|
|
|
|
if op_code == OpCode.NORMAL:
|
|
|
|
q.add_log_cmd(f"{prefix}: {Info.NML}")
|
|
|
|
q.add_log_cmd(f"{prefix}: {Info.NML}")
|
|
|
|
command = pack_mode_data(object_id.as_bytes, Mode.NORMAL, 0)
|
|
|
|
command = pack_mode_data(object_id.as_bytes, Mode.NORMAL, 0)
|
|
|
|
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
|
|
|
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
|
|
|
if op_code in OpCodes.HK_TO_OBC:
|
|
|
|
if op_code == OpCode.HK_TO_OBC:
|
|
|
|
q.add_log_cmd(f"{prefix}: {Info.HK_TO_OBC}")
|
|
|
|
q.add_log_cmd(f"{prefix}: {Info.HK_TO_OBC}")
|
|
|
|
command = obyt + struct.pack("!I", SupvActionId.HK_REPORT)
|
|
|
|
command = obyt + struct.pack("!I", SupvActionId.REQUEST_HK_REPORT)
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
if op_code in OpCodes.REQUEST_HK:
|
|
|
|
if op_code == OpCode.REQUEST_HK_SET:
|
|
|
|
q.add_log_cmd(f"{prefix}: {Info.REQUEST_HK}")
|
|
|
|
q.add_log_cmd(f"{prefix}: {Info.REQUEST_HK_SET}")
|
|
|
|
sid = make_sid(object_id.as_bytes, SetIds.HK_REPORT)
|
|
|
|
sid = make_sid(object_id.as_bytes, prompt_set_id())
|
|
|
|
cmd = generate_one_hk_command(sid)
|
|
|
|
cmd = generate_one_hk_command(sid)
|
|
|
|
q.add_pus_tc(cmd)
|
|
|
|
q.add_pus_tc(cmd)
|
|
|
|
elif op_code in OpCodes.START_MPSOC:
|
|
|
|
if op_code == OpCode.REQUEST_HK_SET_FROM_DEV:
|
|
|
|
|
|
|
|
q.add_log_cmd(f"{prefix}: {Info.REQUEST_HK_SET_FROM_DEV}")
|
|
|
|
|
|
|
|
set_id = prompt_set_id()
|
|
|
|
|
|
|
|
action_cmd = None
|
|
|
|
|
|
|
|
if set_id == SetId.HK_REPORT:
|
|
|
|
|
|
|
|
action_cmd = create_action_cmd(PLOC_SUPV_ID, SupvActionId.REQUEST_HK_REPORT)
|
|
|
|
|
|
|
|
if set_id == SetId.ADC_REPORT:
|
|
|
|
|
|
|
|
action_cmd = create_action_cmd(
|
|
|
|
|
|
|
|
PLOC_SUPV_ID, SupvActionId.REQUEST_ADC_REPORT
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
if set_id == SetId.COUNTERS_REPORT:
|
|
|
|
|
|
|
|
action_cmd = create_action_cmd(
|
|
|
|
|
|
|
|
PLOC_SUPV_ID, SupvActionId.REQUEST_LOGGING_COUNTERS
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
assert action_cmd is not None
|
|
|
|
|
|
|
|
q.add_pus_tc(action_cmd)
|
|
|
|
|
|
|
|
elif op_code == OpCode.START_MPSOC:
|
|
|
|
q.add_log_cmd("PLOC Supervisor: Start MPSoC")
|
|
|
|
q.add_log_cmd("PLOC Supervisor: Start MPSoC")
|
|
|
|
command = obyt + struct.pack("!I", SupvActionId.START_MPSOC)
|
|
|
|
command = obyt + struct.pack("!I", SupvActionId.START_MPSOC)
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
if op_code in OpCodes.SHUTDOWN_MPSOC:
|
|
|
|
if op_code == OpCode.SHUTDOWN_MPSOC:
|
|
|
|
q.add_log_cmd("PLOC Supervisor: Shutdown MPSoC")
|
|
|
|
q.add_log_cmd("PLOC Supervisor: Shutdown MPSoC")
|
|
|
|
command = object_id.as_bytes + struct.pack("!I", SupvActionId.SHUTWOWN_MPSOC)
|
|
|
|
command = object_id.as_bytes + struct.pack("!I", SupvActionId.SHUTWOWN_MPSOC)
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
if op_code in OpCodes.SEL_NVM:
|
|
|
|
if op_code == OpCode.SEL_NVM:
|
|
|
|
q.add_log_cmd("PLOC Supervisor: Select MPSoC boot image")
|
|
|
|
q.add_log_cmd("PLOC Supervisor: Select MPSoC boot image")
|
|
|
|
mem = int(input("MEM (NVM0 - 0 or NVM1 - 1): "))
|
|
|
|
mem = int(input("MEM (NVM0 - 0 or NVM1 - 1): "))
|
|
|
|
bp0 = int(input("BP0 (0 or 1): "))
|
|
|
|
bp0 = int(input("BP0 (0 or 1): "))
|
|
|
@ -268,7 +293,7 @@ def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901
|
|
|
|
bp2 = int(input("BP2 (0 or 1): "))
|
|
|
|
bp2 = int(input("BP2 (0 or 1): "))
|
|
|
|
command = pack_sel_boot_image_cmd(object_id.as_bytes, mem, bp0, bp1, bp2)
|
|
|
|
command = pack_sel_boot_image_cmd(object_id.as_bytes, mem, bp0, bp1, bp2)
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
if op_code in OpCodes.FACTORY_RESET:
|
|
|
|
if op_code == OpCode.FACTORY_RESET:
|
|
|
|
q.add_log_cmd(f"{prefix}: {Info.FACTORY_RESET}")
|
|
|
|
q.add_log_cmd(f"{prefix}: {Info.FACTORY_RESET}")
|
|
|
|
while True:
|
|
|
|
while True:
|
|
|
|
print("Please select the key for a factory reset operation")
|
|
|
|
print("Please select the key for a factory reset operation")
|
|
|
@ -294,11 +319,11 @@ def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901
|
|
|
|
+ struct.pack("!B", restart_tries)
|
|
|
|
+ struct.pack("!B", restart_tries)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
if op_code == OpCodes.RESET_MPSOC:
|
|
|
|
if op_code == OpCode.RESET_MPSOC:
|
|
|
|
q.add_log_cmd(Info.RESET_MPSOC)
|
|
|
|
q.add_log_cmd(Info.RESET_MPSOC)
|
|
|
|
command = object_id.as_bytes + struct.pack("!I", SupvActionId.RESET_MPSOC)
|
|
|
|
command = object_id.as_bytes + struct.pack("!I", SupvActionId.RESET_MPSOC)
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
if op_code in OpCodes.SET_TIME_REF:
|
|
|
|
if op_code == OpCode.SET_TIME_REF:
|
|
|
|
q.add_log_cmd("PLOC Supervisor: Set time reference")
|
|
|
|
q.add_log_cmd("PLOC Supervisor: Set time reference")
|
|
|
|
command = object_id.as_bytes + struct.pack("!I", SupvActionId.SET_TIME_REF)
|
|
|
|
command = object_id.as_bytes + struct.pack("!I", SupvActionId.SET_TIME_REF)
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
@ -315,14 +340,14 @@ def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901
|
|
|
|
q.add_log_cmd("PLOC Supervisor: Disable HK")
|
|
|
|
q.add_log_cmd("PLOC Supervisor: Disable HK")
|
|
|
|
command = object_id.as_bytes + struct.pack("!I", SupvActionId.DISABLE_HK)
|
|
|
|
command = object_id.as_bytes + struct.pack("!I", SupvActionId.DISABLE_HK)
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
if op_code in OpCodes.REQ_BOOT_STATUS_REPORT:
|
|
|
|
if op_code in OpCode.REQ_BOOT_STATUS_REPORT:
|
|
|
|
q.add_log_cmd(f"{prefix}: {Info.REQ_BOOT_STATUS_REPORT}")
|
|
|
|
q.add_log_cmd(f"{prefix}: {Info.REQ_BOOT_STATUS_REPORT}")
|
|
|
|
command = object_id.as_bytes + struct.pack(
|
|
|
|
command = object_id.as_bytes + struct.pack(
|
|
|
|
"!I", SupvActionId.GET_BOOT_STATUS_REPORT
|
|
|
|
"!I", SupvActionId.GET_BOOT_STATUS_REPORT
|
|
|
|
)
|
|
|
|
)
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
q.add_wait_seconds(2.0)
|
|
|
|
q.add_wait_seconds(2.0)
|
|
|
|
sid = make_sid(object_id.as_bytes, SetIds.BOOT_STATUS_REPORT)
|
|
|
|
sid = make_sid(object_id.as_bytes, SetId.BOOT_STATUS_REPORT)
|
|
|
|
req_hk = generate_one_hk_command(sid)
|
|
|
|
req_hk = generate_one_hk_command(sid)
|
|
|
|
q.add_pus_tc(req_hk)
|
|
|
|
q.add_pus_tc(req_hk)
|
|
|
|
if op_code == "17":
|
|
|
|
if op_code == "17":
|
|
|
@ -383,11 +408,11 @@ def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901
|
|
|
|
"!I", SupvActionId.RESTART_SUPERVISOR
|
|
|
|
"!I", SupvActionId.RESTART_SUPERVISOR
|
|
|
|
)
|
|
|
|
)
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
if op_code in OpCodes.START_UPDATE:
|
|
|
|
if op_code in OpCode.START_UPDATE:
|
|
|
|
q.add_log_cmd("PLOC Supversior: Start new MPSoC SW update")
|
|
|
|
q.add_log_cmd("PLOC Supversior: Start new MPSoC SW update")
|
|
|
|
command = pack_update_command(object_id.as_bytes, True)
|
|
|
|
command = pack_update_command(object_id.as_bytes, True)
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
if op_code in OpCodes.PERFORM_UPDATE:
|
|
|
|
if op_code in OpCode.PERFORM_UPDATE:
|
|
|
|
q.add_log_cmd("PLOC Supervisor: Perform MPSoC SW update")
|
|
|
|
q.add_log_cmd("PLOC Supervisor: Perform MPSoC SW update")
|
|
|
|
command = pack_update_command(object_id.as_bytes, False)
|
|
|
|
command = pack_update_command(object_id.as_bytes, False)
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
@ -405,7 +430,7 @@ def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901
|
|
|
|
q.add_log_cmd("PLOC Supervisor: Set shutdown timeout")
|
|
|
|
q.add_log_cmd("PLOC Supervisor: Set shutdown timeout")
|
|
|
|
command = pack_set_shutdown_timeout_command(object_id.as_bytes)
|
|
|
|
command = pack_set_shutdown_timeout_command(object_id.as_bytes)
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
if op_code in OpCodes.FACTORY_FLASH:
|
|
|
|
if op_code in OpCode.FACTORY_FLASH:
|
|
|
|
q.add_log_cmd(f"{prefix}: {Info.FACTORY_FLASH}")
|
|
|
|
q.add_log_cmd(f"{prefix}: {Info.FACTORY_FLASH}")
|
|
|
|
command = object_id.as_bytes + struct.pack("!I", SupvActionId.FACTORY_FLASH)
|
|
|
|
command = object_id.as_bytes + struct.pack("!I", SupvActionId.FACTORY_FLASH)
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
@ -434,7 +459,7 @@ def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901
|
|
|
|
if op_code == "54":
|
|
|
|
if op_code == "54":
|
|
|
|
q.add_log_cmd("PLOC Supervisor: Logging request counters")
|
|
|
|
q.add_log_cmd("PLOC Supervisor: Logging request counters")
|
|
|
|
command = object_id.as_bytes + struct.pack(
|
|
|
|
command = object_id.as_bytes + struct.pack(
|
|
|
|
"!I", SupvActionId.LOGGING_REQUEST_COUNTERS
|
|
|
|
"!I", SupvActionId.REQUEST_LOGGING_COUNTERS
|
|
|
|
)
|
|
|
|
)
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
if op_code == "55":
|
|
|
|
if op_code == "55":
|
|
|
@ -462,7 +487,7 @@ def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901
|
|
|
|
q.add_log_cmd("PLOC Supervisor: Continue update")
|
|
|
|
q.add_log_cmd("PLOC Supervisor: Continue update")
|
|
|
|
command = object_id.as_bytes + struct.pack("!I", SupvActionId.CONTINUE_UPDATE)
|
|
|
|
command = object_id.as_bytes + struct.pack("!I", SupvActionId.CONTINUE_UPDATE)
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
|
|
|
if op_code in OpCodes.MEM_CHECK:
|
|
|
|
if op_code == OpCode.MEM_CHECK:
|
|
|
|
custom_data = bytearray()
|
|
|
|
custom_data = bytearray()
|
|
|
|
update_file = get_update_file()
|
|
|
|
update_file = get_update_file()
|
|
|
|
memory_id = int(input("Specify memory ID: "))
|
|
|
|
memory_id = int(input("Specify memory ID: "))
|
|
|
@ -481,6 +506,20 @@ def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901
|
|
|
|
q.add_pus_tc(command)
|
|
|
|
q.add_pus_tc(command)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def prompt_set_id() -> SetId:
|
|
|
|
|
|
|
|
for set_id in SetId:
|
|
|
|
|
|
|
|
print(f"{set_id}: {set_id.name}")
|
|
|
|
|
|
|
|
while True:
|
|
|
|
|
|
|
|
set_id = int(input("Please select the set ID to request: "))
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
set_id_typed = SetId(set_id)
|
|
|
|
|
|
|
|
except ValueError:
|
|
|
|
|
|
|
|
_LOGGER.warning("invalid set ID, try again")
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
return set_id_typed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def pack_sel_boot_image_cmd(
|
|
|
|
def pack_sel_boot_image_cmd(
|
|
|
|
object_id: bytes, mem: int, bp0: int, bp1: int, bp2: int
|
|
|
|
object_id: bytes, mem: int, bp0: int, bp1: int, bp2: int
|
|
|
|
) -> bytearray:
|
|
|
|
) -> bytearray:
|
|
|
@ -545,9 +584,9 @@ def get_latchup_id() -> int:
|
|
|
|
description_string = "Description".ljust(description_column_width)
|
|
|
|
description_string = "Description".ljust(description_column_width)
|
|
|
|
print(f"{key_string} | {description_string}")
|
|
|
|
print(f"{key_string} | {description_string}")
|
|
|
|
print(separator_string)
|
|
|
|
print(separator_string)
|
|
|
|
for key in latchup_id_dict:
|
|
|
|
for key in LATCHUP_ID_DICT:
|
|
|
|
key_string = key.ljust(key_column_width)
|
|
|
|
key_string = key.ljust(key_column_width)
|
|
|
|
description_string = latchup_id_dict[key].ljust(description_column_width)
|
|
|
|
description_string = LATCHUP_ID_DICT[key].ljust(description_column_width)
|
|
|
|
print(f"{key_string} | {description_string}")
|
|
|
|
print(f"{key_string} | {description_string}")
|
|
|
|
return int(input("Specify latchup ID: "))
|
|
|
|
return int(input("Specify latchup ID: "))
|
|
|
|
|
|
|
|
|
|
|
@ -676,10 +715,10 @@ def pack_set_gpio_cmd(object_id: bytes) -> bytearray:
|
|
|
|
port = int(input("Specify port: 0x"), 16)
|
|
|
|
port = int(input("Specify port: 0x"), 16)
|
|
|
|
pin = int(input("Specify pin: 0x"), 16)
|
|
|
|
pin = int(input("Specify pin: 0x"), 16)
|
|
|
|
val = int(input("Specify val: 0x"), 16)
|
|
|
|
val = int(input("Specify val: 0x"), 16)
|
|
|
|
command = object_id + struct.pack("!I", SupvActionId.SET_GPIO)
|
|
|
|
command = bytearray(object_id + struct.pack("!I", SupvActionId.SET_GPIO))
|
|
|
|
command = command + struct.pack("!B", port)
|
|
|
|
command.append(port)
|
|
|
|
command = command + struct.pack("!B", pin)
|
|
|
|
command.append(pin)
|
|
|
|
command = command + struct.pack("!B", val)
|
|
|
|
command.append(val)
|
|
|
|
return bytearray(command)
|
|
|
|
return bytearray(command)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -701,25 +740,25 @@ def pack_logging_set_topic(object_id: bytes) -> bytearray:
|
|
|
|
|
|
|
|
|
|
|
|
def get_update_file() -> str:
|
|
|
|
def get_update_file() -> str:
|
|
|
|
_LOGGER.info("Specify update file ")
|
|
|
|
_LOGGER.info("Specify update file ")
|
|
|
|
input_helper = InputHelper(update_file_dict)
|
|
|
|
input_helper = InputHelper(UPDATE_FILE_DICT)
|
|
|
|
key = input_helper.get_key()
|
|
|
|
key = input_helper.get_key()
|
|
|
|
if key == HARDCODED:
|
|
|
|
if key == HARDCODED:
|
|
|
|
file = HARDCODED_FILE
|
|
|
|
file = HARDCODED_FILE
|
|
|
|
elif key == MANUAL_INPUT:
|
|
|
|
elif key == MANUAL_INPUT:
|
|
|
|
file = input("Ploc Supervisor: Specify absolute name of update file: ")
|
|
|
|
file = input("Ploc Supervisor: Specify absolute name of update file: ")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
file = update_file_dict[key][1]
|
|
|
|
file = UPDATE_FILE_DICT[key][1]
|
|
|
|
return file
|
|
|
|
return file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_event_buffer_path() -> str:
|
|
|
|
def get_event_buffer_path() -> str:
|
|
|
|
_LOGGER.info("Specify path where to store event buffer file ")
|
|
|
|
_LOGGER.info("Specify path where to store event buffer file ")
|
|
|
|
input_helper = InputHelper(event_buffer_path_dict)
|
|
|
|
input_helper = InputHelper(EVENT_BUFFER_PATH_DICT)
|
|
|
|
key = input_helper.get_key()
|
|
|
|
key = input_helper.get_key()
|
|
|
|
if key == MANUAL_INPUT:
|
|
|
|
if key == MANUAL_INPUT:
|
|
|
|
file = input("Ploc Supervisor: Specify path: ")
|
|
|
|
file = input("Ploc Supervisor: Specify path: ")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
file = event_buffer_path_dict[key][1]
|
|
|
|
file = EVENT_BUFFER_PATH_DICT[key][1]
|
|
|
|
return file
|
|
|
|
return file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -731,62 +770,152 @@ class SocState(enum.IntEnum):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def handle_supv_hk_data(set_id: int, hk_data: bytes, pw: PrintWrapper):
|
|
|
|
def handle_supv_hk_data(set_id: int, hk_data: bytes, pw: PrintWrapper):
|
|
|
|
current_idx = 0
|
|
|
|
if set_id == SetId.HK_REPORT:
|
|
|
|
if set_id == SetIds.HK_REPORT:
|
|
|
|
handle_hk_report(hk_data, pw)
|
|
|
|
fmt_str = "!IIIQIIIIIBBBB"
|
|
|
|
elif set_id == SetId.BOOT_STATUS_REPORT:
|
|
|
|
inc_len = struct.calcsize(fmt_str)
|
|
|
|
handle_boot_report(hk_data, pw)
|
|
|
|
(
|
|
|
|
elif set_id == SetId.ADC_REPORT:
|
|
|
|
temp_ps,
|
|
|
|
handle_adc_report(hk_data)
|
|
|
|
temp_pl,
|
|
|
|
elif set_id == SetId.COUNTERS_REPORT:
|
|
|
|
temp_sup,
|
|
|
|
handle_counters_report(hk_data)
|
|
|
|
uptime,
|
|
|
|
|
|
|
|
cpu_load,
|
|
|
|
|
|
|
|
avail_heap,
|
|
|
|
|
|
|
|
num_tcs,
|
|
|
|
|
|
|
|
num_tms,
|
|
|
|
|
|
|
|
soc_state,
|
|
|
|
|
|
|
|
nvm_0_1_state,
|
|
|
|
|
|
|
|
nvm_3_state,
|
|
|
|
|
|
|
|
mission_io_state,
|
|
|
|
|
|
|
|
fmc_state,
|
|
|
|
|
|
|
|
) = struct.unpack(fmt_str, hk_data[:inc_len])
|
|
|
|
|
|
|
|
pw.dlog(f"Temp PS {temp_ps} C | Temp PL {temp_pl} C | Temp SUP {temp_sup} C")
|
|
|
|
|
|
|
|
pw.dlog(f"Uptime {uptime} | CPU Load {cpu_load} | Avail Heap {avail_heap}")
|
|
|
|
|
|
|
|
pw.dlog(f"Number TCs {num_tcs} | Number TMs {num_tms}")
|
|
|
|
|
|
|
|
pw.dlog(f"SOC state {SocState(soc_state)}")
|
|
|
|
|
|
|
|
pw.dlog(f"NVM 01 State {nvm_0_1_state}")
|
|
|
|
|
|
|
|
pw.dlog(f"NVM 3 State {nvm_3_state}")
|
|
|
|
|
|
|
|
pw.dlog(f"Mission IO state {mission_io_state}")
|
|
|
|
|
|
|
|
pw.dlog(f"FMC state {fmc_state}")
|
|
|
|
|
|
|
|
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[inc_len:], 13))
|
|
|
|
|
|
|
|
elif set_id == SetIds.BOOT_STATUS_REPORT:
|
|
|
|
|
|
|
|
fmt_str = "!BBIIBBBBBB"
|
|
|
|
|
|
|
|
inc_len = struct.calcsize(fmt_str)
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
soc_state,
|
|
|
|
|
|
|
|
power_cycles,
|
|
|
|
|
|
|
|
boot_after_ms,
|
|
|
|
|
|
|
|
boot_timeout_ms,
|
|
|
|
|
|
|
|
active_nvm,
|
|
|
|
|
|
|
|
bp_0_state,
|
|
|
|
|
|
|
|
bp_1_state,
|
|
|
|
|
|
|
|
bp_2_state,
|
|
|
|
|
|
|
|
boot_state,
|
|
|
|
|
|
|
|
boot_cycles,
|
|
|
|
|
|
|
|
) = struct.unpack(fmt_str, hk_data[0 : 0 + inc_len])
|
|
|
|
|
|
|
|
current_idx += inc_len
|
|
|
|
|
|
|
|
pw.dlog(
|
|
|
|
|
|
|
|
"SoC state (0:off, 1:booting, 2:update, 3:operating, 4:shutdown, 5:reset):"
|
|
|
|
|
|
|
|
f" {soc_state}"
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
pw.dlog(f"Power Cycles {power_cycles}")
|
|
|
|
|
|
|
|
pw.dlog(f"Boot after {boot_after_ms} ms | Boot timeout {boot_timeout_ms} ms")
|
|
|
|
|
|
|
|
pw.dlog(f"Active NVM: {active_nvm}")
|
|
|
|
|
|
|
|
pw.dlog(
|
|
|
|
|
|
|
|
f"BP0 State {bp_0_state} | BP1 State {bp_1_state} | BP2 State {bp_2_state}"
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
pw.dlog(f"Boot State {boot_state} | Boot Cycles {boot_cycles}")
|
|
|
|
|
|
|
|
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], 10)
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
pw.dlog(f"PLOC SUPV: HK handling not implemented for set ID {set_id}")
|
|
|
|
pw.dlog(f"PLOC SUPV: HK handling not implemented for set ID {set_id}")
|
|
|
|
pw.dlog(f"Raw Data: 0x[{hk_data.hex(sep=',')}]")
|
|
|
|
pw.dlog(f"Raw Data: 0x[{hk_data.hex(sep=',')}]")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def handle_hk_report(hk_data: bytes, pw: PrintWrapper):
|
|
|
|
|
|
|
|
fmt_str = "!IIIQIIIIIBBBB"
|
|
|
|
|
|
|
|
inc_len = struct.calcsize(fmt_str)
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
temp_ps,
|
|
|
|
|
|
|
|
temp_pl,
|
|
|
|
|
|
|
|
temp_sup,
|
|
|
|
|
|
|
|
uptime,
|
|
|
|
|
|
|
|
cpu_load,
|
|
|
|
|
|
|
|
avail_heap,
|
|
|
|
|
|
|
|
num_tcs,
|
|
|
|
|
|
|
|
num_tms,
|
|
|
|
|
|
|
|
soc_state,
|
|
|
|
|
|
|
|
nvm_0_1_state,
|
|
|
|
|
|
|
|
nvm_3_state,
|
|
|
|
|
|
|
|
mission_io_state,
|
|
|
|
|
|
|
|
fmc_state,
|
|
|
|
|
|
|
|
) = struct.unpack(fmt_str, hk_data[:inc_len])
|
|
|
|
|
|
|
|
pw.dlog(f"Temp PS {temp_ps} C | Temp PL {temp_pl} C | Temp SUP {temp_sup} C")
|
|
|
|
|
|
|
|
pw.dlog(f"Uptime {uptime} | CPU Load {cpu_load} | Avail Heap {avail_heap}")
|
|
|
|
|
|
|
|
pw.dlog(f"Number TCs {num_tcs} | Number TMs {num_tms}")
|
|
|
|
|
|
|
|
pw.dlog(f"SOC state {SocState(soc_state)}")
|
|
|
|
|
|
|
|
pw.dlog(f"NVM 01 State {nvm_0_1_state}")
|
|
|
|
|
|
|
|
pw.dlog(f"NVM 3 State {nvm_3_state}")
|
|
|
|
|
|
|
|
pw.dlog(f"Mission IO state {mission_io_state}")
|
|
|
|
|
|
|
|
pw.dlog(f"FMC state {fmc_state}")
|
|
|
|
|
|
|
|
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[inc_len:], 13))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def handle_boot_report(hk_data: bytes, pw: PrintWrapper):
|
|
|
|
|
|
|
|
current_idx = 0
|
|
|
|
|
|
|
|
fmt_str = "!BBIIBBBBBB"
|
|
|
|
|
|
|
|
inc_len = struct.calcsize(fmt_str)
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
soc_state,
|
|
|
|
|
|
|
|
power_cycles,
|
|
|
|
|
|
|
|
boot_after_ms,
|
|
|
|
|
|
|
|
boot_timeout_ms,
|
|
|
|
|
|
|
|
active_nvm,
|
|
|
|
|
|
|
|
bp_0_state,
|
|
|
|
|
|
|
|
bp_1_state,
|
|
|
|
|
|
|
|
bp_2_state,
|
|
|
|
|
|
|
|
boot_state,
|
|
|
|
|
|
|
|
boot_cycles,
|
|
|
|
|
|
|
|
) = struct.unpack(fmt_str, hk_data[0 : 0 + inc_len])
|
|
|
|
|
|
|
|
current_idx += inc_len
|
|
|
|
|
|
|
|
pw.dlog(
|
|
|
|
|
|
|
|
"SoC state (0:off, 1:booting, 2:update, 3:operating, 4:shutdown, 5:reset):"
|
|
|
|
|
|
|
|
f" {soc_state}"
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
pw.dlog(f"Power Cycles {power_cycles}")
|
|
|
|
|
|
|
|
pw.dlog(f"Boot after {boot_after_ms} ms | Boot timeout {boot_timeout_ms} ms")
|
|
|
|
|
|
|
|
pw.dlog(f"Active NVM: {active_nvm}")
|
|
|
|
|
|
|
|
pw.dlog(f"BP0 State {bp_0_state} | BP1 State {bp_1_state} | BP2 State {bp_2_state}")
|
|
|
|
|
|
|
|
pw.dlog(f"Boot State {boot_state} | Boot Cycles {boot_cycles}")
|
|
|
|
|
|
|
|
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], 10)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def handle_adc_report(hk_data: bytes):
|
|
|
|
|
|
|
|
if len(hk_data) < 64:
|
|
|
|
|
|
|
|
_LOGGER.warning("ADC report smaller than 64 bytes")
|
|
|
|
|
|
|
|
current_idx = 0
|
|
|
|
|
|
|
|
adc_raw = []
|
|
|
|
|
|
|
|
adc_eng = []
|
|
|
|
|
|
|
|
for _ in range(16):
|
|
|
|
|
|
|
|
adc_raw.append(struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0])
|
|
|
|
|
|
|
|
current_idx += 2
|
|
|
|
|
|
|
|
for _ in range(16):
|
|
|
|
|
|
|
|
adc_eng.append(struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0])
|
|
|
|
|
|
|
|
current_idx += 2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print(f"{'Index'.ljust(10)} | {'ADC RAW'.ljust(10)} | {'ADC ENG'.ljust(10)}")
|
|
|
|
|
|
|
|
for i in range(16):
|
|
|
|
|
|
|
|
print(f"{i: >10} | {adc_raw[i]: >10} | {adc_eng[i]: >10}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def handle_counters_report(hk_data: bytes):
|
|
|
|
|
|
|
|
current_idx = 0
|
|
|
|
|
|
|
|
signature = struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
|
|
|
|
|
|
|
current_idx += 4
|
|
|
|
|
|
|
|
latchup_counters = []
|
|
|
|
|
|
|
|
for _ in range(7):
|
|
|
|
|
|
|
|
latchup_counters.append(
|
|
|
|
|
|
|
|
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
current_idx += 4
|
|
|
|
|
|
|
|
fmt_str = "!IIIIIIIIIIIIIIIIIIII"
|
|
|
|
|
|
|
|
inc_len = struct.calcsize(fmt_str)
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
adc_deviation_triggers_cnt,
|
|
|
|
|
|
|
|
tc_received_cnt,
|
|
|
|
|
|
|
|
tm_available_cnt,
|
|
|
|
|
|
|
|
supervisor_boots,
|
|
|
|
|
|
|
|
mpsoc_boots,
|
|
|
|
|
|
|
|
mpsoc_boot_failed_attempts,
|
|
|
|
|
|
|
|
mpsoc_powerup,
|
|
|
|
|
|
|
|
mpsoc_updates,
|
|
|
|
|
|
|
|
mpsoc_heartbeat_resets,
|
|
|
|
|
|
|
|
cpu_wdt_resets,
|
|
|
|
|
|
|
|
ps_heartbeats_lost,
|
|
|
|
|
|
|
|
pl_heartbeats_lost,
|
|
|
|
|
|
|
|
eb_task_lost,
|
|
|
|
|
|
|
|
bm_task_lost,
|
|
|
|
|
|
|
|
lm_task_lost,
|
|
|
|
|
|
|
|
am_task_lost,
|
|
|
|
|
|
|
|
tctmm_task_lost,
|
|
|
|
|
|
|
|
mm_task_lost,
|
|
|
|
|
|
|
|
hk_task_lost,
|
|
|
|
|
|
|
|
dl_task_lost,
|
|
|
|
|
|
|
|
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
|
|
|
|
|
|
|
current_idx += inc_len
|
|
|
|
|
|
|
|
_redwire_tasks_lost = []
|
|
|
|
|
|
|
|
for _ in range(3):
|
|
|
|
|
|
|
|
_redwire_tasks_lost.append(
|
|
|
|
|
|
|
|
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
print(f"Signature: {signature}")
|
|
|
|
|
|
|
|
print(f"Latchup Counters: {latchup_counters}")
|
|
|
|
|
|
|
|
print(f"ADC Deviation Triggers Count: {adc_deviation_triggers_cnt}")
|
|
|
|
|
|
|
|
print(f"TCs received: {tc_received_cnt} | TMs Available: {tm_available_cnt}")
|
|
|
|
|
|
|
|
print(f"Supervisor Boots: {supervisor_boots} | MPSoC boots: {mpsoc_boots}")
|
|
|
|
|
|
|
|
print(f"MPSoC boot failed attempts: {mpsoc_boot_failed_attempts}")
|
|
|
|
|
|
|
|
print(f"MPSoC powerup: {mpsoc_powerup}")
|
|
|
|
|
|
|
|
print(f"MPSoC updates: {mpsoc_updates}")
|
|
|
|
|
|
|
|
print(f"MPSoC heartbeat resets: {mpsoc_heartbeat_resets}")
|
|
|
|
|
|
|
|
print(f"CPU WDT resets: {cpu_wdt_resets}")
|
|
|
|
|
|
|
|
print(f"PS heartbeats lost: {ps_heartbeats_lost}")
|
|
|
|
|
|
|
|
print(f"PL heartbeats lost: {pl_heartbeats_lost}")
|
|
|
|
|
|
|
|
print(f"EB task lost: {eb_task_lost}")
|
|
|
|
|
|
|
|
print(f"BM task lost: {bm_task_lost}")
|
|
|
|
|
|
|
|
print(f"LM task lost: {lm_task_lost}")
|
|
|
|
|
|
|
|
print(f"AM task lost: {am_task_lost}")
|
|
|
|
|
|
|
|
print(f"TCTMM task lost: {tctmm_task_lost}")
|
|
|
|
|
|
|
|
print(f"MM task lost: {mm_task_lost}")
|
|
|
|
|
|
|
|
print(f"HK task lost: {hk_task_lost}")
|
|
|
|
|
|
|
|
print(f"DL task lost: {dl_task_lost}")
|
|
|
|