commands for ploc memory dumper #20

Merged
muellerr merged 1 commits from meier/plocMemoryDumper into develop 2021-09-02 09:17:59 +02:00
7 changed files with 54 additions and 19 deletions
Showing only changes of commit 9b176aebfa - Show all commits

View File

@ -30,5 +30,6 @@ class CustomServiceList(enum.Enum):
RAD_SENSOR = "rad_sensor" RAD_SENSOR = "rad_sensor"
PLOC_SUPV = "ploc_supv" PLOC_SUPV = "ploc_supv"
PLOC_UPDATER = "ploc_updater" PLOC_UPDATER = "ploc_updater"
PLOC_MEMORY_DUMPER = "ploc_memory_dumper"
CORE = 'core' CORE = 'core'
STAR_TRACKER = 'star_tracker' STAR_TRACKER = 'star_tracker'

View File

@ -106,6 +106,11 @@ class EiveHookObject(TmTcHookBase):
} }
service_rad_sensor_tuple = ("Radiation Sensor", op_code_dict_srv_rad_sensor) service_rad_sensor_tuple = ("Radiation Sensor", op_code_dict_srv_rad_sensor)
op_code_dict_ploc_mem_dumper = {
"0": ("PLOC Memory Dumper: MRAM dump", {OpCodeDictKeys.TIMEOUT: 2.0}),
}
service_ploc_memory_dumper_tuple = ("Radiation Sensor", op_code_dict_ploc_mem_dumper)
op_code_dict_srv_ploc_supv = { op_code_dict_srv_ploc_supv = {
"0": ("PLOC Supervisor: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}), "0": ("PLOC Supervisor: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}),
"1": ("PLOC Supervisor: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}), "1": ("PLOC Supervisor: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}),
@ -139,7 +144,6 @@ class EiveHookObject(TmTcHookBase):
"29": ("PLOC Supervisor: Select NVM", {OpCodeDictKeys.TIMEOUT: 2.0}), "29": ("PLOC Supervisor: Select NVM", {OpCodeDictKeys.TIMEOUT: 2.0}),
"30": ("PLOC Supervisor: Run auto EM tests", {OpCodeDictKeys.TIMEOUT: 2.0}), "30": ("PLOC Supervisor: Run auto EM tests", {OpCodeDictKeys.TIMEOUT: 2.0}),
"31": ("PLOC Supervisor: MRAM Wipe", {OpCodeDictKeys.TIMEOUT: 2.0}), "31": ("PLOC Supervisor: MRAM Wipe", {OpCodeDictKeys.TIMEOUT: 2.0}),
"32": ("PLOC Supervisor: MRAM Dump", {OpCodeDictKeys.TIMEOUT: 2.0}),
"33": ("PLOC Supervisor: Print CPU stats", {OpCodeDictKeys.TIMEOUT: 2.0}), "33": ("PLOC Supervisor: Print CPU stats", {OpCodeDictKeys.TIMEOUT: 2.0}),
"34": ("PLOC Supervisor: Set debug verbosity", {OpCodeDictKeys.TIMEOUT: 2.0}), "34": ("PLOC Supervisor: Set debug verbosity", {OpCodeDictKeys.TIMEOUT: 2.0}),
"35": ("PLOC Supervisor: Set GPIO", {OpCodeDictKeys.TIMEOUT: 2.0}), "35": ("PLOC Supervisor: Set GPIO", {OpCodeDictKeys.TIMEOUT: 2.0}),
@ -182,6 +186,7 @@ class EiveHookObject(TmTcHookBase):
service_op_code_dict[CustomServiceList.PLOC_SUPV.value] = service_ploc_supv_tuple service_op_code_dict[CustomServiceList.PLOC_SUPV.value] = service_ploc_supv_tuple
service_op_code_dict[CustomServiceList.PLOC_UPDATER.value] = service_ploc_updater_tuple service_op_code_dict[CustomServiceList.PLOC_UPDATER.value] = service_ploc_updater_tuple
service_op_code_dict[CustomServiceList.STAR_TRACKER.value] = service_star_tracker_tuple service_op_code_dict[CustomServiceList.STAR_TRACKER.value] = service_star_tracker_tuple
service_op_code_dict[CustomServiceList.PLOC_MEMORY_DUMPER.value] = service_ploc_memory_dumper_tuple
return service_op_code_dict return service_op_code_dict
def get_json_config_file_path(self) -> str: def get_json_config_file_path(self) -> str:

View File

@ -28,6 +28,7 @@ RAD_SENSOR_ID = bytes([0x44, 0x32, 0x00, 0xA5])
PLOC_SUPV_ID = bytes([0x44, 0x33, 0x00, 0x16]) PLOC_SUPV_ID = bytes([0x44, 0x33, 0x00, 0x16])
PLOC_UPDATER_ID = bytes([0x44, 0x33, 0x00, 0x00]) PLOC_UPDATER_ID = bytes([0x44, 0x33, 0x00, 0x00])
CORE_CONTROLLER_ID = bytes([0x43, 0x00, 0x00, 0x03]) CORE_CONTROLLER_ID = bytes([0x43, 0x00, 0x00, 0x03])
PLOC_MEMORY_DUMPER_ID = bytes([0x44, 0x33, 0x00, 0x01])
def get_object_ids() -> Dict[bytes, list]: def get_object_ids() -> Dict[bytes, list]:

View File

@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
"""
@file ploc_memory_dumper.py
@brief This file implements the command to dump memory sectors of the PLOC. Memories of the PLOC which can be dumped
are one MRAM, two flash memories and the SRAM.
@author J. Meier
@date 31.08.2021
"""
import struct
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
from tmtccmd.ecss.tc import PusTelecommand
class ActionIds:
DUMP_MRAM = 1
def pack_ploc_memory_dumper_cmd(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
tc_queue.appendleft(
(QueueCommands.PRINT,
"Testing PLOC memory dumper with object id: 0x" + object_id.hex())
)
if op_code == "0":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Dump MRAM"))
command = pack_mram_dump_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
def pack_mram_dump_cmd(object_id: bytearray) -> bytearray:
start = int(input("Start address: 0x"), 16)
end = int(input("End address: 0x"), 16)
command = bytearray()
command = object_id + struct.pack('!I', ActionIds.DUMP_MRAM)
command = command + struct.pack('!I', start)
command = command + struct.pack('!I', end)
return command

View File

@ -232,11 +232,6 @@ def pack_ploc_supv_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
command = pack_mram_wipe_cmd(object_id) command = pack_mram_wipe_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=46, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=46, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "32":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Dump MRAM"))
command = pack_mram_dump_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=47, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "33": elif op_code == "33":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Print CPU stats")) tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Print CPU stats"))
command = pack_print_cpu_stats_cmd(object_id) command = pack_print_cpu_stats_cmd(object_id)
@ -508,16 +503,6 @@ def pack_mram_wipe_cmd(object_id: bytearray) -> bytearray:
return command return command
def pack_mram_dump_cmd(object_id: bytearray) -> bytearray:
start = int(input("Start address: 0x"), 16)
stop = int(input("Stop address: 0x"), 16)
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.DUMP_MRAM)
command = command + struct.pack('!I', start)
command = command + struct.pack('!I', stop)
return command
def pack_print_cpu_stats_cmd(object_id: bytearray) -> bytearray: def pack_print_cpu_stats_cmd(object_id: bytearray) -> bytearray:
en = 1 en = 1
command = bytearray() command = bytearray()

View File

@ -13,9 +13,7 @@ from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT from tmtccmd.tc.packer import TcQueueT
from tmtccmd.ecss.tc import PusTelecommand from tmtccmd.ecss.tc import PusTelecommand
from tmtccmd.utility.logger import get_console_logger
LOGGER = get_console_logger()
latchup_id_dict = { latchup_id_dict = {
"0": "0.85V", "0": "0.85V",

View File

@ -27,12 +27,13 @@ from pus_tc.heater import pack_heater_test_into
from pus_tc.reaction_wheels import pack_single_rw_test_into from pus_tc.reaction_wheels import pack_single_rw_test_into
from pus_tc.rad_sensor import pack_rad_sensor_test_into from pus_tc.rad_sensor import pack_rad_sensor_test_into
from pus_tc.ploc_upater import pack_ploc_updater_test_into from pus_tc.ploc_upater import pack_ploc_updater_test_into
from pus_tc.ploc_memory_dumper import pack_ploc_memory_dumper_cmd
from pus_tc.core import pack_core_commands from pus_tc.core import pack_core_commands
from pus_tc.star_tracker import pack_star_tracker_commands_into from pus_tc.star_tracker import pack_star_tracker_commands_into
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
from config.object_ids import P60_DOCK_HANDLER, PDU_1_HANDLER_ID, PDU_2_HANDLER_ID, ACU_HANDLER_ID, \ from config.object_ids import P60_DOCK_HANDLER, PDU_1_HANDLER_ID, PDU_2_HANDLER_ID, ACU_HANDLER_ID, \
TMP_1075_1_HANDLER_ID, TMP_1075_2_HANDLER_ID, HEATER_ID, IMTQ_HANDLER_ID, PLOC_MPSOC_ID, RW1_ID, RW2_ID, RW3_ID, RW4_ID, \ TMP_1075_1_HANDLER_ID, TMP_1075_2_HANDLER_ID, HEATER_ID, IMTQ_HANDLER_ID, PLOC_MPSOC_ID, RW1_ID, RW2_ID, RW3_ID, RW4_ID, \
RAD_SENSOR_ID, PLOC_SUPV_ID, PLOC_UPDATER_ID, STAR_TRACKER_ID RAD_SENSOR_ID, PLOC_SUPV_ID, PLOC_UPDATER_ID, STAR_TRACKER_ID, PLOC_MEMORY_DUMPER_ID
LOGGER = get_console_logger() LOGGER = get_console_logger()
@ -98,6 +99,9 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu
return pack_star_tracker_commands_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) return pack_star_tracker_commands_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
if service == CustomServiceList.CORE.value: if service == CustomServiceList.CORE.value:
return pack_core_commands(tc_queue=service_queue, op_code=op_code) return pack_core_commands(tc_queue=service_queue, op_code=op_code)
if service == CustomServiceList.PLOC_MEMORY_DUMPER.value:
object_id = PLOC_MEMORY_DUMPER_ID
return pack_ploc_memory_dumper_cmd(object_id=object_id, tc_queue=service_queue, op_code=op_code)
LOGGER.warning("Invalid Service !") LOGGER.warning("Invalid Service !")