diff --git a/Svc/CmdSequencer/CMakeLists.txt b/Svc/CmdSequencer/CMakeLists.txt index 6b98cf3f05..197fdc194d 100644 --- a/Svc/CmdSequencer/CMakeLists.txt +++ b/Svc/CmdSequencer/CMakeLists.txt @@ -13,6 +13,8 @@ set(SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/FPrimeSequence.cpp" "${CMAKE_CURRENT_LIST_DIR}/Sequence.cpp" "${CMAKE_CURRENT_LIST_DIR}/formats/AMPCSSequence.cpp" + "${CMAKE_CURRENT_LIST_DIR}/CmdSequencer_FileReadStageEnumAi.xml" + "${CMAKE_CURRENT_LIST_DIR}/CmdSequencer_SeqModeEnumAi.xml" ) register_fprime_module() diff --git a/Svc/CmdSequencer/CmdSequencer.fpp b/Svc/CmdSequencer/CmdSequencer.fpp new file mode 100644 index 0000000000..128fafa063 --- /dev/null +++ b/Svc/CmdSequencer/CmdSequencer.fpp @@ -0,0 +1,44 @@ +module Svc { + + active component CmdSequencer { + + @ FPP from XML: original path was Svc/CmdSequencer/Commands.xml + include "Commands.fppi" + + @ FPP from XML: original path was Svc/CmdSequencer/Telemetry.xml + include "Telemetry.fppi" + + @ FPP from XML: original path was Svc/CmdSequencer/Events.xml + include "Events.fppi" + + command reg port cmdRegOut + + text event port LogText + + async input port pingIn: [1] Svc.Ping + + telemetry port tlmOut + + command resp port cmdResponseOut + + time get port timeCaller + + output port comCmdOut: [1] Fw.Com + + output port pingOut: [1] Svc.Ping + + async input port cmdResponseIn: [1] Fw.CmdResponse + + command recv port cmdIn + + async input port schedIn: [1] Svc.Sched + + async input port seqRunIn: [1] Svc.CmdSeqIn + + event port logOut + + output port seqDone: [1] Fw.CmdResponse + + } + +} diff --git a/Svc/CmdSequencer/CmdSequencerComponentAi.xml b/Svc/CmdSequencer/CmdSequencerComponentAi.xml index fad24d7eab..2825723bd3 100755 --- a/Svc/CmdSequencer/CmdSequencerComponentAi.xml +++ b/Svc/CmdSequencer/CmdSequencerComponentAi.xml @@ -1,65 +1,485 @@ - + + - Fw/Cmd/CmdRegPortAi.xml - Fw/Log/LogTextPortAi.xml - Svc/Ping/PingPortAi.xml - Fw/Tlm/TlmPortAi.xml - Fw/Cmd/CmdResponsePortAi.xml - Fw/Time/TimePortAi.xml - Fw/Com/ComPortAi.xml - Fw/Cmd/CmdPortAi.xml - Svc/Sched/SchedPortAi.xml - Svc/Seq/CmdSeqInPortAi.xml - Fw/Log/LogPortAi.xml - Svc/CmdSequencer/Commands.xml - Svc/CmdSequencer/Telemetry.xml - Svc/CmdSequencer/Events.xml - - + Svc/CmdSequencer/CmdSequencer_FileReadStageEnumAi.xml + Svc/CmdSequencer/CmdSequencer_SeqModeEnumAi.xml + Fw/Cmd/CmdPortAi.xml + Fw/Cmd/CmdRegPortAi.xml + Fw/Cmd/CmdResponsePortAi.xml + Fw/Com/ComPortAi.xml + Fw/Log/LogPortAi.xml + Fw/Log/LogTextPortAi.xml + Fw/Time/TimePortAi.xml + Fw/Tlm/TlmPortAi.xml + Svc/Ping/PingPortAi.xml + Svc/Sched/SchedPortAi.xml + Svc/Seq/CmdSeqInPortAi.xml - - + + + + + + + + + + + + + + + + - - + + + + Run a command sequence file + + + + + The name of the sequence file + + + + + + + Validate a command sequence file + + + + + The name of the sequence file + + + + + + + Cancel a command sequence + + + + + Start running a command sequence + + + + + Perform one step in a command sequence. Valid only if CmdSequencer is in MANUAL run mode. + + + + + Set the run mode to AUTO. + + + + + Set the run mode to MANUAL. + + + - - + + + + Sequence file was successfully loaded. + + + + + The name of the sequence file + + + + + + + A command sequence was successfully canceled. + + + + + The name of the sequence file + + + + + + + The Sequence File Loader could not read the sequence file. + + + + + The name of the sequence file + + + + + + + The sequence file format was invalid. + + + + + The name of the sequence file + + + + + The read stage + + + + + The error code + + + + + + + The format of a command record was invalid. + + + + + The name of the sequence file + + + + + The record number + + + + + The error code + + + + + + + The sequence file was too large. + + + + + The name of the sequence file + + + + + Invalid size + + + + + + + The sequence file was not found + + + + + The sequence file + + + + + + + The sequence file validation failed + + + + + The sequence file + + + + + The CRC stored in the file + + + + + The CRC computed over the file + + + + + + + The Command Sequencer issued a command and received a success status in return. + + + + + The name of the sequence file + + + + + The record number of the command + + + + + The command opcode + + + + + + + A command sequence successfully completed. + + + + + The name of the sequence file + + + + + + + The Command Sequencer issued a command and received an error status in return. + + + + + The name of the sequence file + + + + + The record number + + + + + The opcode + + + + + The error status + + + + + + + The Command Sequencer received a command that was invalid for its current mode. + + + + + Number of records in header doesn't match number in file + + + + + The name of the sequence file + + + + + The number of records in the header + + + + + The number of bytes beyond last record + + + + + + + The running time base doesn't match the time base in the sequence files + + + + + The name of the sequence file + + + + + The current time + + + + + The sequence time base + + + + + + + The running time base doesn't match the time base in the sequence files + + + + + The name of the sequence file + + + + + The current time base + + + + + The sequence time base + + + + + + + A local port request to run a sequence was started + + + + + The sequence file + + + + + + + A command status came back when no sequence was running + + + + + The reported opcode + + + + + + + Switched step mode + + + + + The new mode + + + + + + + A sequence related command came with no active sequence + + + + + A sequence passed validation + + + + + The sequence file + + + + + + + A sequence passed validation + + + + + The sequence file + + + + + The command that timed out + + + + + + + A command in a sequence was stepped through + + + + + The sequence file + + + + + The command that was stepped + + + + + + + A manual sequence was started + + + + + The sequence file + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + The number of Load commands executed + + + + + The number of Cancel commands executed + + + + + The number of errors that have occurred + + + + + The number of commands executed across all sequences. + + + + + The number of sequences completed. + + + diff --git a/Svc/CmdSequencer/CmdSequencerImpl.hpp b/Svc/CmdSequencer/CmdSequencerImpl.hpp index 7239c2a2c6..468f22c832 100644 --- a/Svc/CmdSequencer/CmdSequencerImpl.hpp +++ b/Svc/CmdSequencer/CmdSequencerImpl.hpp @@ -21,6 +21,9 @@ namespace Svc { + typedef CmdSequencer_FileReadStage FileReadStage; + typedef CmdSequencer_SeqMode SeqMode; + class CmdSequencerComponentImpl : public CmdSequencerComponentBase { diff --git a/Svc/CmdSequencer/CmdSequencer_FileReadStageEnumAi.xml b/Svc/CmdSequencer/CmdSequencer_FileReadStageEnumAi.xml new file mode 100644 index 0000000000..c71fc161a0 --- /dev/null +++ b/Svc/CmdSequencer/CmdSequencer_FileReadStageEnumAi.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + diff --git a/Svc/CmdSequencer/CmdSequencer_SeqModeEnumAi.xml b/Svc/CmdSequencer/CmdSequencer_SeqModeEnumAi.xml new file mode 100644 index 0000000000..29bd33c43f --- /dev/null +++ b/Svc/CmdSequencer/CmdSequencer_SeqModeEnumAi.xml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/Svc/CmdSequencer/Commands.fppi b/Svc/CmdSequencer/Commands.fppi new file mode 100644 index 0000000000..9d0184a2dc --- /dev/null +++ b/Svc/CmdSequencer/Commands.fppi @@ -0,0 +1,31 @@ +@ Run a command sequence file +async command CS_RUN( + fileName: string size 240 @< The name of the sequence file + ) \ + opcode 0 + +@ Validate a command sequence file +async command CS_VALIDATE( + fileName: string size 240 @< The name of the sequence file + ) \ + opcode 1 + +@ Cancel a command sequence +async command CS_CANCEL \ + opcode 2 + +@ Start running a command sequence +async command CS_START \ + opcode 3 + +@ Perform one step in a command sequence. Valid only if CmdSequencer is in MANUAL run mode. +async command CS_STEP \ + opcode 4 + +@ Set the run mode to AUTO. +async command CS_AUTO \ + opcode 5 + +@ Set the run mode to MANUAL. +async command CS_MANUAL \ + opcode 6 diff --git a/Svc/CmdSequencer/Events.fppi b/Svc/CmdSequencer/Events.fppi new file mode 100644 index 0000000000..fe46c3632a --- /dev/null +++ b/Svc/CmdSequencer/Events.fppi @@ -0,0 +1,217 @@ +@ Sequence file was successfully loaded. +event CS_SequenceLoaded( + fileName: string size 60 @< The name of the sequence file + ) \ + severity activity low \ + id 0 \ + format "Loaded sequence {}" + +@ A command sequence was successfully canceled. +event CS_SequenceCanceled( + fileName: string size 60 @< The name of the sequence file + ) \ + severity activity high \ + id 1 \ + format "Sequence file {} canceled" + +@ The Sequence File Loader could not read the sequence file. +event CS_FileReadError( + fileName: string size 60 @< The name of the sequence file + ) \ + severity warning high \ + id 2 \ + format "Error reading sequence file {}" + +enum FileReadStage { + SEQ_READ_HEADER = 0 + SEQ_READ_HEADER_SIZE = 1 + SEQ_DESER_SIZE = 2 + SEQ_DESER_NUM_RECORDS = 3 + SEQ_DESER_TIME_BASE = 4 + SEQ_DESER_TIME_CONTEXT = 5 + SEQ_READ_SEQ_CRC = 6 + SEQ_READ_SEQ_DATA = 7 + SEQ_READ_SEQ_DATA_SIZE = 8 +} + +@ The sequence file format was invalid. +event CS_FileInvalid( + fileName: string size 60 @< The name of the sequence file + stage: FileReadStage @< The read stage + error: I32 @< The error code + ) \ + severity warning high \ + id 3 \ + format "Sequence file {} invalid. Stage: {} Error: {}" + +@ The format of a command record was invalid. +event CS_RecordInvalid( + fileName: string size 60 @< The name of the sequence file + recordNumber: U32 @< The record number + error: I32 @< The error code + ) \ + severity warning high \ + id 4 \ + format "Sequence file {}: Record {} invalid. Err: {}" + +@ The sequence file was too large. +event CS_FileSizeError( + fileName: string size 60 @< The name of the sequence file + $size: U32 @< Invalid size + ) \ + severity warning high \ + id 5 \ + format "Sequence file {} too large. Size: {}" + +@ The sequence file was not found +event CS_FileNotFound( + fileName: string size 60 @< The sequence file + ) \ + severity warning high \ + id 6 \ + format "Sequence file {} not found." + + +@ The sequence file validation failed +event CS_FileCrcFailure( + fileName: string size 60 @< The sequence file + storedCRC: U32 @< The CRC stored in the file + computedCRC: U32 @< The CRC computed over the file + ) \ + severity warning high \ + id 7 \ + format "Sequence file {} had invalid CRC. Stored {}, Computed {}." + +@ The Command Sequencer issued a command and received a success status in return. +event CS_CommandComplete( + fileName: string size 60 @< The name of the sequence file + recordNumber: U32 @< The record number of the command + opCode: U32 @< The command opcode + ) \ + severity activity low \ + id 8 \ + format "Sequence file {}: Command {} (opcode {}) complete" + +@ A command sequence successfully completed. +event CS_SequenceComplete( + fileName: string size 60 @< The name of the sequence file + ) \ + severity activity high \ + id 9 \ + format "Sequence file {} complete" + +@ The Command Sequencer issued a command and received an error status in return. +event CS_CommandError( + fileName: string size 60 @< The name of the sequence file + recordNumber: U32 @< The record number + opCode: U32 @< The opcode + errorStatus: U32 @< The error status + ) \ + severity warning high \ + id 10 \ + format "Sequence file {}: Command {} (opcode {}) completed with error {}" + +@ The Command Sequencer received a command that was invalid for its current mode. +event CS_InvalidMode \ + severity warning high \ + id 11 \ + format "Invalid mode" + +@ Number of records in header doesn't match number in file +event CS_RecordMismatch( + fileName: string size 60 @< The name of the sequence file + header_records: U32 @< The number of records in the header + extra_bytes: U32 @< The number of bytes beyond last record + ) \ + severity warning high \ + id 12 \ + format "Sequence file {} header records mismatch: {} in header, found {} extra bytes." + +@ The running time base doesn't match the time base in the sequence files +event CS_TimeBaseMismatch( + fileName: string size 60 @< The name of the sequence file + time_base: U16 @< The current time + seq_time_base: U16 @< The sequence time base + ) \ + severity warning high \ + id 13 \ + format "Sequence file {}: Current time base doesn't match sequence time: base: {} seq: {}" + +@ The running time base doesn't match the time base in the sequence files +event CS_TimeContextMismatch( + fileName: string size 60 @< The name of the sequence file + currTimeBase: U8 @< The current time base + seqTimeBase: U8 @< The sequence time base + ) \ + severity warning high \ + id 14 \ + format "Sequence file {}: Current time context doesn't match sequence context: base: {} seq: {}" + +@ A local port request to run a sequence was started +event CS_PortSequenceStarted( + filename: string size 60 @< The sequence file + ) \ + severity activity high \ + id 15 \ + format "Local request for sequence {} started." + +@ A command status came back when no sequence was running +event CS_UnexpectedCompletion( + $opcode: U32 @< The reported opcode + ) \ + severity warning high \ + id 16 \ + format "Command complete status received while no sequences active. Opcode: {}" + +enum SeqMode { + SEQ_STEP_MODE = 0 + SEQ_AUTO_MODE = 1 +} + +@ Switched step mode +event CS_ModeSwitched( + mode: SeqMode @< The new mode + ) \ + severity activity high \ + id 17 \ + format "Sequencer switched to {} step mode" + +@ A sequence related command came with no active sequence +event CS_NoSequenceActive \ + severity warning low \ + id 18 \ + format "No sequence active." + +@ A sequence passed validation +event CS_SequenceValid( + filename: string size 60 @< The sequence file + ) \ + severity activity high \ + id 19 \ + format "Sequence {} is valid." + +@ A sequence passed validation +event CS_SequenceTimeout( + filename: string size 60 @< The sequence file + $command: U32 @< The command that timed out + ) \ + severity warning high \ + id 20 \ + format "Sequence {} timed out on command {}" + +@ A command in a sequence was stepped through +event CS_CmdStepped( + filename: string size 60 @< The sequence file + $command: U32 @< The command that was stepped + ) \ + severity activity high \ + id 21 \ + format "Sequence {} command {} stepped" + +@ A manual sequence was started +event CS_CmdStarted( + filename: string size 60 @< The sequence file + ) \ + severity activity high \ + id 22 \ + format "Sequence {} started" diff --git a/Svc/CmdSequencer/Telemetry.fppi b/Svc/CmdSequencer/Telemetry.fppi new file mode 100644 index 0000000000..9c06f7b122 --- /dev/null +++ b/Svc/CmdSequencer/Telemetry.fppi @@ -0,0 +1,14 @@ +@ The number of Load commands executed +telemetry CS_LoadCommands: U32 id 0 + +@ The number of Cancel commands executed +telemetry CS_CancelCommands: U32 id 1 + +@ The number of errors that have occurred +telemetry CS_Errors: U32 id 2 + +@ The number of commands executed across all sequences. +telemetry CS_CommandsExecuted: U32 id 3 + +@ The number of sequences completed. +telemetry CS_SequencesCompleted: U32 id 4 diff --git a/Svc/CmdSequencer/all.do b/Svc/CmdSequencer/all.do new file mode 100644 index 0000000000..4fbace832f --- /dev/null +++ b/Svc/CmdSequencer/all.do @@ -0,0 +1,6 @@ +#!/bin/sh -e + +. ./defs.sh + +redo-ifchange xml +update xml/*.xml diff --git a/Svc/CmdSequencer/clean.do b/Svc/CmdSequencer/clean.do new file mode 100644 index 0000000000..37a3c7ba6c --- /dev/null +++ b/Svc/CmdSequencer/clean.do @@ -0,0 +1,5 @@ +#!/bin/sh -e + +. ./defs.sh + +clean_do diff --git a/Svc/CmdSequencer/defs.sh b/Svc/CmdSequencer/defs.sh new file mode 100644 index 0000000000..eb20074a48 --- /dev/null +++ b/Svc/CmdSequencer/defs.sh @@ -0,0 +1,6 @@ +#!/bin/sh -e + +export FPRIME_ROOT=../.. +export FPP_FILES=`basename $PWD`.fpp + +. $FPRIME_ROOT/defs-root.sh diff --git a/Svc/CmdSequencer/depend.do b/Svc/CmdSequencer/depend.do new file mode 100644 index 0000000000..f4477b9979 --- /dev/null +++ b/Svc/CmdSequencer/depend.do @@ -0,0 +1,5 @@ +#!/bin/sh -e + +. ./defs.sh + +depend_do "$@" diff --git a/Svc/CmdSequencer/locate-uses.do b/Svc/CmdSequencer/locate-uses.do new file mode 100644 index 0000000000..2a645b6cab --- /dev/null +++ b/Svc/CmdSequencer/locate-uses.do @@ -0,0 +1,6 @@ +#!/bin/sh -e + +. ./defs.sh + +redo-always +locate_uses_do "$@" 1>&2 diff --git a/Svc/CmdSequencer/xml.do b/Svc/CmdSequencer/xml.do new file mode 100644 index 0000000000..ceffc51020 --- /dev/null +++ b/Svc/CmdSequencer/xml.do @@ -0,0 +1,5 @@ +#!/bin/sh + +. ./defs.sh + +xml_do "$@"