eive-tmtc/pus_tc/cmd_definitions.py

349 lines
14 KiB
Python
Raw Normal View History

2022-03-04 10:41:05 +01:00
from pus_tc.devs.bpx_batt import BpxOpCodes
2022-05-24 17:01:35 +02:00
from config.definitions import CustomServiceList
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
2022-08-12 10:22:33 +02:00
from tmtccmd.config.tmtc import (
tmtc_definitions_provider,
call_all_definitions_providers,
)
2022-07-04 18:14:51 +02:00
from tmtccmd.config.globals import get_default_tmtc_defs
def get_eive_service_op_code_dict() -> TmtcDefinitionWrapper:
2022-08-12 10:20:01 +02:00
"""Call all registered TMTC definition providers. They were registered using
the :py:func:`tmtc_definitions_provider` decorator.
"""
2022-07-04 18:14:51 +02:00
def_wrapper = get_default_tmtc_defs()
call_all_definitions_providers(def_wrapper)
2022-07-04 18:14:51 +02:00
return def_wrapper
@tmtc_definitions_provider
def add_tmp_sens_cmds(defs: TmtcDefinitionWrapper):
2022-07-05 02:12:54 +02:00
oce = OpCodeEntry()
oce.add("0", "TMP1075 Tests")
defs.add_service(CustomServiceList.TMP1075_1.value, "TMP1075 1", oce)
defs.add_service(CustomServiceList.TMP1075_2.value, "TMP1075 2", oce)
@tmtc_definitions_provider
def add_pdec_cmds(defs: TmtcDefinitionWrapper):
2022-07-05 02:12:54 +02:00
oce = OpCodeEntry()
oce.add("0", "PDEC Handler: Print CLCW")
oce.add("1", "PDEC Handler: Print PDEC monitor")
defs.add_service(CustomServiceList.PDEC_HANDLER.value, "PDEC Handler", oce)
@tmtc_definitions_provider
def add_ccsds_cmds(defs: TmtcDefinitionWrapper):
2022-07-05 02:12:54 +02:00
oce = OpCodeEntry()
oce.add("0", "CCSDS Handler: Set low rate")
oce.add("1", "CCSDS Handler: Set high rate")
oce.add("2", "CCSDS Handler: Enable transmitter")
oce.add("3", "CCSDS Handler: Disable transmitter")
oce.add("4", "CCSDS Handler: Set arbitrary bitrate")
oce.add("5", "CCSDS Handler: Enable tx clock manipulator")
oce.add("6", "CCSDS Handler: Disable tx clock manipulator")
oce.add("7", "CCSDS Handler: Update tx data on rising edge")
oce.add("8", "CCSDS Handler: Update tx data on falling edge")
defs.add_service(CustomServiceList.CCSDS_HANDLER.value, "CCSDS Handler", oce)
@tmtc_definitions_provider
def add_str_cmds(defs: TmtcDefinitionWrapper):
2022-07-05 02:12:54 +02:00
oce = OpCodeEntry()
oce.add("0", "Star Tracker: Mode On, Submode Bootloader")
oce.add("1", "Star Tracker: Mode On, Submode Firmware")
oce.add("2", "Star Tracker: Mode Normal")
oce.add("3", "Star Tracker: Mode Off")
oce.add("4", "Star Tracker: Mode Raw")
oce.add("5", "Star Tracker: Ping")
oce.add("6", "Star Tracker: Switch to bootloader program")
oce.add("7", "Star Tracker: Request temperature")
oce.add("8", "Star Tracker: Request version")
oce.add("9", "Star Tracker: Request interface")
oce.add("10", "Star Tracker: Request power")
oce.add("11", "Star Tracker: Set subscription parameters")
oce.add("12", "Star Tracker: Boot image (requires bootloader mode)")
oce.add("13", "Star Tracker: Request time")
oce.add("14", "Star Tracker: Request solution")
oce.add("15", "Star Tracker: Upload image")
oce.add("16", "Star Tracker: Download image")
oce.add("17", "Star Tracker: Set limit parameters")
oce.add("17", "Star Tracker: Set limit parameters")
oce.add("18", "Star Tracker: Set tracking parameters")
oce.add("19", "Star Tracker: Set mounting parameters")
oce.add("20", "Star Tracker: Set camera parameters")
oce.add("22", "Star Tracker: Set centroiding parameters")
oce.add("23", "Star Tracker: Set LISA parameters")
oce.add("24", "Star Tracker: Set matching parameters")
oce.add("25", "Star Tracker: Set validation parameters")
oce.add("26", "Star Tracker: Set algo parameters")
oce.add("27", "Star Tracker: Take image")
oce.add("28", "Star Tracker: Stop str helper")
oce.add("30", "Star Tracker: Set name of download image")
oce.add("31", "Star Tracker: Request histogram")
oce.add("32", "Star Tracker: Request contrast")
oce.add("33", "Star Tracker: Set json filename")
oce.add("35", "Star Tracker: Flash read")
oce.add("36", "Star Tracker: Set flash read filename")
oce.add("37", "Star Tracker: Get checksum")
oce.add("49", "Star Tracker: Request camera parameter")
oce.add("50", "Star Tracker: Request limits")
oce.add("51", "Star Tracker: Set image processor parameters")
oce.add("52", "Star Tracker: (EGSE only) Load camera ground config")
oce.add("53", "Star Tracker: (EGSE only) Load camera flight config")
oce.add("54", "Star Tracker: Request log level parameters")
oce.add("55", "Star Tracker: Request mounting parameters")
oce.add("56", "Star Tracker: Request image processor parameters")
oce.add("57", "Star Tracker: Request centroiding parameters")
oce.add("58", "Star Tracker: Request lisa parameters")
oce.add("59", "Star Tracker: Request matching parameters")
oce.add("60", "Star Tracker: Request tracking parameters")
oce.add("61", "Star Tracker: Request validation parameters")
oce.add("62", "Star Tracker: Request algo parameters")
oce.add("63", "Star Tracker: Request subscription parameters")
oce.add("64", "Star Tracker: Request log subscription parameters")
oce.add("65", "Star Tracker: Request debug camera parameters")
oce.add("66", "Star Tracker: Set log level parameters")
oce.add("67", "Star Tracker: Set log subscription parameters")
oce.add("68", "Star Tracker: Set debug camera parameters")
oce.add("69", "Star Tracker: Firmware update")
oce.add("70", "Star Tracker: Disable timestamp generation")
oce.add("71", "Star Tracker: Enable timestamp generation")
defs.add_service(CustomServiceList.STAR_TRACKER.value, "Star Tracker", oce)
@tmtc_definitions_provider
def add_syrlinks_cmds(defs: TmtcDefinitionWrapper):
2022-07-05 02:12:54 +02:00
oce = OpCodeEntry()
oce.add("0", "Syrlinks Handler: Set mode off")
oce.add("1", "Syrlinks Handler: Set mode on")
oce.add("2", "Syrlinks Handler: Set mode normal")
oce.add("3", "Syrlinks Handler: Set TX standby")
oce.add("4", "Syrlinks Handler: Set TX modulation")
oce.add("5", "Syrlinks Handler: Set TX carrier wave")
oce.add("6", "Syrlinks Handler: Read TX status")
oce.add("7", "Syrlinks Handler: Read TX waveform")
oce.add("8", "Syrlinks Handler: Read TX AGC value high byte")
oce.add("9", "Syrlinks Handler: Read TX AGC value low byte")
oce.add("12", "Syrlinks Handler: Write LCL config")
oce.add("13", "Syrlinks Handler: Read RX status registers")
oce.add("14", "Syrlinks Handler: Read LCL config register")
oce.add("15", "Syrlinks Handler: Set waveform OQPSK")
oce.add("16", "Syrlinks Handler: Set waveform BPSK")
oce.add("17", "Syrlinks Handler: Set second config")
oce.add("18", "Syrlinks Handler: Enable debug output")
oce.add("19", "Syrlinks Handler: Disable debug output")
defs.add_service(CustomServiceList.SYRLINKS.value, "Syrlinks Handler", oce)
@tmtc_definitions_provider
def add_bpx_cmd_definitions(defs: TmtcDefinitionWrapper):
2022-07-05 02:12:54 +02:00
oce = OpCodeEntry()
oce.add(keys=BpxOpCodes.HK, info="Request BPX HK")
oce.add(keys=BpxOpCodes.RST_BOOT_CNT, info="Reset Boot Count")
oce.add(keys=BpxOpCodes.REQUEST_CFG, info="Request Configuration Struct (Step 1)")
oce.add(
keys=BpxOpCodes.REQUEST_CFG_HK, info="Request Configuration Struct HK (Step 2)"
2022-05-03 18:36:28 +02:00
)
2022-07-05 02:12:54 +02:00
oce.add(keys=BpxOpCodes.REBOOT, info="Reboot Command")
defs.add_service(
2022-08-08 16:47:41 +02:00
name=CustomServiceList.BPX_BATTERY.value,
2022-02-03 16:02:55 +01:00
info="BPX Battery Handler",
2022-07-05 02:12:54 +02:00
op_code_entry=oce,
2022-02-03 16:02:55 +01:00
)
@tmtc_definitions_provider
def add_time_cmds(defs: TmtcDefinitionWrapper):
2022-04-09 18:44:04 +02:00
from pus_tc.system.time import OpCodes, Info
2022-07-05 02:12:54 +02:00
oce = OpCodeEntry()
oce.add(
2022-04-09 18:44:04 +02:00
keys=OpCodes.SET_CURRENT_TIME,
info=Info.SET_CURRENT_TIME,
)
2022-07-05 02:12:54 +02:00
defs.add_service(
2022-04-09 18:44:04 +02:00
name=CustomServiceList.TIME.value,
info="Time Service",
2022-07-05 02:12:54 +02:00
op_code_entry=oce,
2022-04-09 18:44:04 +02:00
)
@tmtc_definitions_provider
def add_imtq_cmds(defs: TmtcDefinitionWrapper):
2022-07-05 02:12:54 +02:00
oce = OpCodeEntry()
oce.add("0", "Mode Off")
oce.add("1", "Mode On")
oce.add("2", "Mode Normal")
oce.add("3", "IMTQ perform pos X self test")
oce.add("4", "IMTQ perform neg X self test")
oce.add("5", "IMTQ perform pos Y self test")
oce.add("6", "IMTQ perform neg Y self test")
oce.add("7", "IMTQ perform pos Z self test")
oce.add("8", "IMTQ perform neg Z self test")
oce.add("9", "IMTQ command dipole")
oce.add("10", "IMTQ get commanded dipole")
oce.add("11", "IMTQ get engineering hk set")
oce.add("12", "IMTQ get calibrated MTM measurement one shot")
oce.add("13", "IMTQ get raw MTM measurement one shot")
defs.add_service(CustomServiceList.IMTQ.value, "IMQT Device", oce)
@tmtc_definitions_provider
def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
2022-07-05 02:12:54 +02:00
oce = OpCodeEntry()
oce.add("0", "Ploc MPSoC: Set mode off")
oce.add("1", "Ploc MPSoC: Set mode on")
oce.add("2", "Ploc MPSoC: Set mode normal")
oce.add("3", "Ploc MPSoC: Memory write")
oce.add("4", "Ploc MPSoC: Memory read")
oce.add("5", "Ploc MPSoC: Flash write")
oce.add("6", "Ploc MPSoC: Flash delete")
oce.add("7", "Ploc MPSoC: Replay start")
oce.add("8", "Ploc MPSoC: Replay stop")
oce.add("9", "Ploc MPSoC: Downlink pwr on")
oce.add("10", "Ploc MPSoC: Downlink pwr off")
oce.add("11", "Ploc MPSoC: Replay write sequence")
oce.add("12", "Ploc MPSoC: OBSW reset sequence count")
oce.add("13", "Ploc MPSoC: Read DEADBEEF address")
oce.add("14", "Ploc MPSoC: Mode replay")
oce.add("15", "Ploc MPSoC: Mode idle")
oce.add("16", "Ploc MPSoC: Tc cam command send")
oce.add("17", "Ploc MPSoC: Set UART TX tristate")
oce.add("18", "Ploc MPSoC: Relesase UART TX")
defs.add_service(CustomServiceList.PLOC_MPSOC.value, "Ploc MPSoC", oce)
@tmtc_definitions_provider
def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper):
2022-07-05 02:12:54 +02:00
oce = OpCodeEntry()
oce.add("0", "PLOC Memory Dumper: MRAM dump")
defs.add_service(
CustomServiceList.PLOC_MEMORY_DUMPER.value, "PLOC Memory Dumper", oce
2022-03-02 11:44:39 +01:00
)
2022-07-05 02:12:54 +02:00
oce = OpCodeEntry()
oce.add("1", "PLOC Supervisor: Set mode off")
oce.add("2", "PLOC Supervisor: Set mode normal")
oce.add("3", "PLOC Supervisor: Get HK Report")
oce.add("5", "PLOC Supervisor: Start MPSoC")
oce.add("6", "PLOC Supervisor: Shutdown MPSoC")
oce.add("7", "PLOC Supervisor: Select MPSoC boot image")
oce.add("8", "PLOC Supervisor: Set max restart tries")
oce.add("9", "PLOC Supervisor: Reset MPSoC")
oce.add("10", "PLOC Supervisor: Set time reference")
oce.add("11", "PLOC Supervisor: Set boot timeout")
oce.add("12", "PLOC Supervisor: Disable Hk")
oce.add("13", "PLOC Supervisor: Request boot status report")
oce.add("17", "PLOC Supervisor: Enable latchup alert")
oce.add("18", "PLOC Supervisor: Disable latchup alert")
oce.add("20", "PLOC Supervisor: Set alert limit")
oce.add("23", "PLOC Supervisor: Set ADC enabled channels")
oce.add("24", "PLOC Supervisor: Set ADC window and stride")
oce.add("25", "PLOC Supervisor: Set ADC threshold")
oce.add("26", "PLOC Supervisor: Request latchup status report")
oce.add("27", "PLOC Supervisor: Copy ADC data to MRAM")
oce.add("30", "PLOC Supervisor: Run auto EM tests")
oce.add("31", "PLOC Supervisor: MRAM Wipe")
oce.add("35", "PLOC Supervisor: Set GPIO")
oce.add("36", "PLOC Supervisor: Read GPIO")
oce.add("37", "PLOC Supervisor: Restart supervisor")
oce.add("38", "PLOC Supervisor: Factory reset clear all")
oce.add("39", "PLOC Supervisor: Factory reset clear mirror entries")
oce.add("40", "PLOC Supervisor: Factory reset clear circular entries")
oce.add("42", "PLOC Supervisor: Perform update")
oce.add("43", "PLOC Supervisor: Terminate supervisor process")
oce.add("44", "PLOC Supervisor: Start MPSoC quiet")
oce.add("45", "PLOC Supervisor: Set shutdown timeout")
oce.add("46", "PLOC Supervisor: Factory flash")
oce.add("47", "PLOC Supervisor: Enable auto TM")
oce.add("48", "PLOC Supervisor: Disable auto TM")
oce.add("51", "PLOC Supervisor: Logging request event buffers")
oce.add("52", "PLOC Supervisor: Logging clear counters")
oce.add("53", "PLOC Supervisor: Logging set topic")
oce.add("54", "PLOC Supervisor: Logging request counters")
oce.add("55", "PLOC Supervisor: Request ADC Report")
oce.add("56", "PLOC Supervisor: Reset PL")
oce.add("57", "PLOC Supervisor: Enable NVMs")
oce.add("58", "PLOC Supervisor: Continue update")
defs.add_service(CustomServiceList.PLOC_SUPV.value, "PLOC Supervisor", oce)
@tmtc_definitions_provider
def add_system_cmds(defs: TmtcDefinitionWrapper):
2022-03-22 10:14:22 +01:00
from pus_tc.system.acs import AcsOpCodes, SusOpCodes
2022-03-22 19:29:55 +01:00
import pus_tc.system.tcs as tcs
import pus_tc.system.controllers as controllers
2022-07-05 02:12:54 +02:00
oce = OpCodeEntry()
oce.add(
2022-03-07 11:07:54 +01:00
keys=AcsOpCodes.ACS_ASS_A_SIDE,
info="Switch to ACS board A side",
2022-03-07 17:02:44 +01:00
)
2022-07-05 02:12:54 +02:00
oce.add(
2022-03-07 17:02:44 +01:00
keys=AcsOpCodes.ACS_ASS_B_SIDE,
info="Switch to ACS board B side",
)
2022-07-05 02:12:54 +02:00
oce.add(
2022-03-07 17:02:44 +01:00
keys=AcsOpCodes.ACS_ASS_DUAL_MODE,
info="Switch to ACS board dual mode",
)
2022-07-05 02:12:54 +02:00
oce.add(
2022-03-07 17:02:44 +01:00
keys=AcsOpCodes.ACS_ASS_A_ON,
info="Switch ACS board A side on",
)
2022-07-05 02:12:54 +02:00
oce.add(
2022-03-07 17:02:44 +01:00
keys=AcsOpCodes.ACS_ASS_B_ON,
info="Switch ACS board B side on",
)
2022-07-05 02:12:54 +02:00
oce.add(
2022-03-07 17:02:44 +01:00
keys=AcsOpCodes.ACS_ASS_DUAL_ON,
info="Switch ACS board dual mode on",
)
2022-07-05 02:12:54 +02:00
oce.add(
2022-03-07 17:02:44 +01:00
keys=AcsOpCodes.ACS_ASS_OFF,
info="Switch off ACS board",
2022-03-07 11:07:54 +01:00
)
2022-07-05 02:12:54 +02:00
defs.add_service(
name=CustomServiceList.ACS_ASS.value, info="ACS Assemblies", op_code_entry=oce
2022-03-07 11:07:54 +01:00
)
2022-03-22 10:14:22 +01:00
2022-07-05 02:12:54 +02:00
oce = OpCodeEntry()
oce.add(
2022-03-22 10:14:22 +01:00
keys=SusOpCodes.SUS_ASS_NOM_SIDE,
2022-03-22 09:54:57 +01:00
info="Switch SUS board to nominal side",
)
2022-07-05 02:12:54 +02:00
oce.add(
2022-03-22 10:14:22 +01:00
keys=SusOpCodes.SUS_ASS_RED_SIDE,
2022-03-22 09:54:57 +01:00
info="Switch SUS board to redundant side",
)
2022-07-05 02:12:54 +02:00
oce.add(
2022-03-22 10:14:22 +01:00
keys=SusOpCodes.SUS_ASS_OFF,
2022-03-22 09:54:57 +01:00
info="Switch off SUS board",
)
2022-07-05 02:12:54 +02:00
oce.add(
2022-03-22 11:05:48 +01:00
keys=SusOpCodes.SUS_ASS_DUAL_MODE,
info="Switch SUS board to dual mode",
)
2022-07-05 02:12:54 +02:00
defs.add_service(
2022-03-22 10:14:22 +01:00
name=CustomServiceList.SUS_ASS.value,
info="SUS Assembly",
2022-07-05 02:12:54 +02:00
op_code_entry=oce,
2022-03-07 11:07:54 +01:00
)
2022-03-22 19:29:55 +01:00
2022-07-05 02:12:54 +02:00
oce = OpCodeEntry()
oce.add(
keys=controllers.OpCodes.THERMAL_CONTROLLER,
info=controllers.Info.THERMAL_CONTROLLER,
)
2022-07-05 02:12:54 +02:00
oce.add(
keys=controllers.OpCodes.CORE_CONTROLLER,
info=controllers.Info.CORE_CONTROLLER,
)
2022-07-05 02:12:54 +02:00
defs.add_service(
name=CustomServiceList.CONTROLLERS.value,
info="Controllers",
2022-07-05 02:12:54 +02:00
op_code_entry=oce,
)