diff --git a/Fw/Com/ComPacket.hpp b/Fw/Com/ComPacket.hpp index a5be0c522c..bd0dda59c2 100644 --- a/Fw/Com/ComPacket.hpp +++ b/Fw/Com/ComPacket.hpp @@ -9,15 +9,15 @@ #define COMPACKET_HPP_ #include -#include "config/APIDEnumAc.hpp" +#include "config/ApidEnumAc.hpp" // Packet format: -// |32-bit packet type|packet type-specific data| +// | packet type (width = FwPacketDescriptorType) | packet type-specific data | namespace Fw { // This type is defined in config/ComCfg.fpp -using ComPacketType = ComCfg::APID::T; +using ComPacketType = ComCfg::Apid::T; class ComPacket : public Serializable { public: diff --git a/Ref/test/int/ref_integration_test.py b/Ref/test/int/ref_integration_test.py index d621e74080..651d9e05e0 100644 --- a/Ref/test/int/ref_integration_test.py +++ b/Ref/test/int/ref_integration_test.py @@ -276,7 +276,7 @@ def test_seqgen(fprime_test_api): subprocess.run( [ "fprime-seqgen", - "-d", + "--dictionary", str(fprime_test_api.dictionaries.dictionary_path), str(sequence), "/tmp/ref_test_int.bin", diff --git a/Svc/Ccsds/ApidManager/ApidManager.cpp b/Svc/Ccsds/ApidManager/ApidManager.cpp index 1fc4b27c6e..53d36ddfa1 100644 --- a/Svc/Ccsds/ApidManager/ApidManager.cpp +++ b/Svc/Ccsds/ApidManager/ApidManager.cpp @@ -21,7 +21,7 @@ ApidManager ::ApidManager(const char* const compName) : ApidManagerComponentBase // Handler implementations for typed input ports // ---------------------------------------------------------------------- -U16 ApidManager ::validateApidSeqCountIn_handler(FwIndexType portNum, const ComCfg::APID& apid, U16 receivedSeqCount) { +U16 ApidManager ::validateApidSeqCountIn_handler(FwIndexType portNum, const ComCfg::Apid& apid, U16 receivedSeqCount) { U16 expectedSequenceCount = this->getAndIncrementSeqCount(apid); if (receivedSeqCount != expectedSequenceCount && receivedSeqCount != SEQUENCE_COUNT_ERROR) { // Likely a packet was dropped or out of order @@ -32,7 +32,7 @@ U16 ApidManager ::validateApidSeqCountIn_handler(FwIndexType portNum, const ComC return receivedSeqCount; } -U16 ApidManager ::getApidSeqCountIn_handler(FwIndexType portNum, const ComCfg::APID& apid, U16 unused) { +U16 ApidManager ::getApidSeqCountIn_handler(FwIndexType portNum, const ComCfg::Apid& apid, U16 unused) { return this->getAndIncrementSeqCount(apid); } @@ -40,7 +40,7 @@ U16 ApidManager ::getApidSeqCountIn_handler(FwIndexType portNum, const ComCfg::A // Helpers // ---------------------------------------------------------------------- -U16 ApidManager ::getAndIncrementSeqCount(ComCfg::APID::T apid) { +U16 ApidManager ::getAndIncrementSeqCount(ComCfg::Apid::T apid) { U16 seqCount = SEQUENCE_COUNT_ERROR; // Default to error value // Search the APID in the sequence table for (U16 i = 0; i < MAX_TRACKED_APIDS; i++) { @@ -54,7 +54,7 @@ U16 ApidManager ::getAndIncrementSeqCount(ComCfg::APID::T apid) { } // If not found, search for an uninitialized entry to track this APID for (U16 i = 0; i < MAX_TRACKED_APIDS; i++) { - if (this->m_apidSequences[i].apid == ComCfg::APID::INVALID_UNINITIALIZED) { + if (this->m_apidSequences[i].apid == ComCfg::Apid::INVALID_UNINITIALIZED) { this->m_apidSequences[i].apid = apid; // Initialize this entry with the new APID seqCount = this->m_apidSequences[i].sequenceCount; // Entries default to 0 unless otherwise specified // Increment entry for next call @@ -67,7 +67,7 @@ U16 ApidManager ::getAndIncrementSeqCount(ComCfg::APID::T apid) { return SEQUENCE_COUNT_ERROR; } -void ApidManager::setNextSeqCount(ComCfg::APID::T apid, U16 seqCount) { +void ApidManager::setNextSeqCount(ComCfg::Apid::T apid, U16 seqCount) { for (U16 i = 0; i < MAX_TRACKED_APIDS; i++) { if (this->m_apidSequences[i].apid == apid) { this->m_apidSequences[i].sequenceCount = seqCount; diff --git a/Svc/Ccsds/ApidManager/ApidManager.hpp b/Svc/Ccsds/ApidManager/ApidManager.hpp index 458a333e01..4fba5a2df0 100644 --- a/Svc/Ccsds/ApidManager/ApidManager.hpp +++ b/Svc/Ccsds/ApidManager/ApidManager.hpp @@ -14,28 +14,28 @@ namespace Svc { namespace Ccsds { -static_assert(ComCfg::APID::SPP_IDLE_PACKET == 0x07FF, +static_assert(ComCfg::Apid::SPP_IDLE_PACKET == 0x07FF, "SPP_IDLE_PACKET must exist and equal 0x07FF (as specified by standard)"); -static_assert(ComCfg::APID::INVALID_UNINITIALIZED == 0x0800, +static_assert(ComCfg::Apid::INVALID_UNINITIALIZED == 0x0800, "Invalid APID must be 0x0800 (11 bits values allow 0-2047)"); -static_assert(ComCfg::APID::FW_PACKET_COMMAND == Fw::ComPacketType::FW_PACKET_COMMAND, +static_assert(ComCfg::Apid::FW_PACKET_COMMAND == Fw::ComPacketType::FW_PACKET_COMMAND, "APID FW_PACKET_COMMAND must exist, used by the Framework"); -static_assert(ComCfg::APID::FW_PACKET_TELEM == Fw::ComPacketType::FW_PACKET_TELEM, +static_assert(ComCfg::Apid::FW_PACKET_TELEM == Fw::ComPacketType::FW_PACKET_TELEM, "APID FW_PACKET_TELEM must exist, used by the Framework"); -static_assert(ComCfg::APID::FW_PACKET_LOG == Fw::ComPacketType::FW_PACKET_LOG, +static_assert(ComCfg::Apid::FW_PACKET_LOG == Fw::ComPacketType::FW_PACKET_LOG, "APID FW_PACKET_LOG must exist, used by the Framework"); -static_assert(ComCfg::APID::FW_PACKET_FILE == Fw::ComPacketType::FW_PACKET_FILE, +static_assert(ComCfg::Apid::FW_PACKET_FILE == Fw::ComPacketType::FW_PACKET_FILE, "APID FW_PACKET_FILE must exist, used by the Framework"); -static_assert(ComCfg::APID::FW_PACKET_PACKETIZED_TLM == Fw::ComPacketType::FW_PACKET_PACKETIZED_TLM, +static_assert(ComCfg::Apid::FW_PACKET_PACKETIZED_TLM == Fw::ComPacketType::FW_PACKET_PACKETIZED_TLM, "APID FW_PACKET_PACKETIZED_TLM must exist, used by the Framework"); -static_assert(ComCfg::APID::FW_PACKET_UNKNOWN == Fw::ComPacketType::FW_PACKET_UNKNOWN, +static_assert(ComCfg::Apid::FW_PACKET_UNKNOWN == Fw::ComPacketType::FW_PACKET_UNKNOWN, "APID FW_PACKET_UNKNOWN must exist, used by the Framework"); class ApidManager final : public ApidManagerComponentBase { friend class ApidManagerTester; //!< Friend class for testing public: - static constexpr U16 MAX_TRACKED_APIDS = ComCfg::APID::NUM_CONSTANTS; + static constexpr U16 MAX_TRACKED_APIDS = ComCfg::Apid::NUM_CONSTANTS; static constexpr U16 SEQUENCE_COUNT_ERROR = std::numeric_limits::max(); // ---------------------------------------------------------------------- // Component construction and destruction @@ -55,12 +55,12 @@ class ApidManager final : public ApidManagerComponentBase { //! Handler implementation for validateApidSeqCountIn U16 validateApidSeqCountIn_handler(FwIndexType portNum, //!< The port number - const ComCfg::APID& apid, + const ComCfg::Apid& apid, U16 seqCount) override; //! Handler implementation for validateApidSeqCountIn U16 getApidSeqCountIn_handler(FwIndexType portNum, //!< The port number - const ComCfg::APID& apid, + const ComCfg::Apid& apid, U16 seqCount) override; private: @@ -69,15 +69,15 @@ class ApidManager final : public ApidManagerComponentBase { // ---------------------------------------------------------------------- //! Get the sequence count for a given APID and increment it for the next //! Wraps around at 14 bits - U16 getAndIncrementSeqCount(ComCfg::APID::T apid); + U16 getAndIncrementSeqCount(ComCfg::Apid::T apid); //! Set the next expected sequence count for a given APID - void setNextSeqCount(ComCfg::APID::T apid, U16 seqCount); + void setNextSeqCount(ComCfg::Apid::T apid, U16 seqCount); //! This struct helps track sequence counts per APID //! Future work: update to using a map from Fw/DataStructures when available struct ApidSequenceEntry { - ComCfg::APID::T apid = ComCfg::APID::INVALID_UNINITIALIZED; + ComCfg::Apid::T apid = ComCfg::Apid::INVALID_UNINITIALIZED; U16 sequenceCount = 0; }; diff --git a/Svc/Ccsds/ApidManager/test/ut/ApidManagerTester.cpp b/Svc/Ccsds/ApidManager/test/ut/ApidManagerTester.cpp index 50efe47997..603ff973aa 100644 --- a/Svc/Ccsds/ApidManager/test/ut/ApidManagerTester.cpp +++ b/Svc/Ccsds/ApidManager/test/ut/ApidManagerTester.cpp @@ -12,9 +12,9 @@ namespace Svc { namespace Ccsds { -static constexpr ComCfg::APID::T TEST_REGISTERED_APIDS[] = {ComCfg::APID::FW_PACKET_COMMAND, - ComCfg::APID::FW_PACKET_TELEM, ComCfg::APID::FW_PACKET_LOG, - ComCfg::APID::FW_PACKET_FILE}; +static constexpr ComCfg::Apid::T TEST_REGISTERED_APIDS[] = {ComCfg::Apid::FW_PACKET_COMMAND, + ComCfg::Apid::FW_PACKET_TELEM, ComCfg::Apid::FW_PACKET_LOG, + ComCfg::Apid::FW_PACKET_FILE}; // ---------------------------------------------------------------------- // Construction and destruction @@ -43,7 +43,7 @@ bool ApidManagerTester::GetExistingSeqCount::precondition(const ApidManagerTeste void ApidManagerTester::GetExistingSeqCount::action(ApidManagerTester& testerState) { testerState.clearHistory(); - ComCfg::APID::T apid = testerState.shadow_getRandomTrackedApid(); + ComCfg::Apid::T apid = testerState.shadow_getRandomTrackedApid(); U16 seqCount = testerState.invoke_to_getApidSeqCountIn(0, apid, 0); U16 shadowSeqCount = testerState.shadow_getAndIncrementSeqCount(apid); ASSERT_EQ(seqCount, shadowSeqCount) << "Sequence count for APID " << static_cast(apid) @@ -65,7 +65,7 @@ void ApidManagerTester::GetNewSeqCountOk::action(ApidManagerTester& testerState) return; // Cannot get new sequence count if table is full - skip action } - ComCfg::APID::T apid = testerState.shadow_getRandomUntrackedApid(); + ComCfg::Apid::T apid = testerState.shadow_getRandomUntrackedApid(); U16 seqCount = testerState.invoke_to_getApidSeqCountIn(0, apid, 0); U16 shadowSeqCount = testerState.shadow_getAndIncrementSeqCount(apid); ASSERT_EQ(seqCount, shadowSeqCount) << "Sequence count for APID " << static_cast(apid) @@ -79,7 +79,7 @@ bool ApidManagerTester::GetNewSeqCountTableFull::precondition(const ApidManagerT void ApidManagerTester::GetNewSeqCountTableFull::action(ApidManagerTester& testerState) { testerState.clearHistory(); - ComCfg::APID::T apid = testerState.shadow_getRandomUntrackedApid(); + ComCfg::Apid::T apid = testerState.shadow_getRandomUntrackedApid(); U16 seqCount = testerState.invoke_to_getApidSeqCountIn(0, apid, 0); // Use local constexpr to potentially avoid ODR-use of ApidManager::SEQUENCE_COUNT_ERROR constexpr U16 sequenceCountErrorVal = ApidManager::SEQUENCE_COUNT_ERROR; @@ -95,7 +95,7 @@ bool ApidManagerTester::ValidateSeqCountOk::precondition(const ApidManagerTester void ApidManagerTester::ValidateSeqCountOk::action(ApidManagerTester& testerState) { testerState.clearHistory(); - ComCfg::APID::T apid = testerState.shadow_getRandomTrackedApid(); + ComCfg::Apid::T apid = testerState.shadow_getRandomTrackedApid(); U16 shadow_expectedSeqCount = testerState.shadow_seqCounts[apid]; testerState.invoke_to_validateApidSeqCountIn(0, apid, shadow_expectedSeqCount); testerState.shadow_validateApidSeqCount(apid, shadow_expectedSeqCount); // keep shadow state in sync @@ -109,7 +109,7 @@ bool ApidManagerTester::ValidateSeqCountFailure::precondition(const ApidManagerT void ApidManagerTester::ValidateSeqCountFailure::action(ApidManagerTester& testerState) { testerState.clearHistory(); - ComCfg::APID::T apid = testerState.shadow_getRandomTrackedApid(); + ComCfg::Apid::T apid = testerState.shadow_getRandomTrackedApid(); U16 shadow_expectedSeqCount = testerState.shadow_seqCounts.at(apid); U16 invalidSeqCount = static_cast( (shadow_expectedSeqCount + 1) % @@ -128,7 +128,7 @@ void ApidManagerTester::ValidateSeqCountFailure::action(ApidManagerTester& teste // Helpers // ---------------------------------------------------------------------- -U16 ApidManagerTester::shadow_getAndIncrementSeqCount(ComCfg::APID::T apid) { +U16 ApidManagerTester::shadow_getAndIncrementSeqCount(ComCfg::Apid::T apid) { // This is a shadow function to simulate the getAndIncrementSeqCount behavior // without modifying the actual component state. auto found = this->shadow_seqCounts.find(apid); @@ -147,7 +147,7 @@ U16 ApidManagerTester::shadow_getAndIncrementSeqCount(ComCfg::APID::T apid) { return this->component.SEQUENCE_COUNT_ERROR; // Return error if APID not found } -void ApidManagerTester::shadow_validateApidSeqCount(ComCfg::APID::T apid, U16 expectedSeqCount) { +void ApidManagerTester::shadow_validateApidSeqCount(ComCfg::Apid::T apid, U16 expectedSeqCount) { // This simply updates the shadow state to the next expected sequence count auto found = this->shadow_seqCounts.find(apid); if (found != this->shadow_seqCounts.end()) { @@ -155,19 +155,19 @@ void ApidManagerTester::shadow_validateApidSeqCount(ComCfg::APID::T apid, U16 ex } } -ComCfg::APID::T ApidManagerTester::shadow_getRandomTrackedApid() { +ComCfg::Apid::T ApidManagerTester::shadow_getRandomTrackedApid() { // Select a random APID from the sequence counts map U32 mapSize = static_cast(this->shadow_seqCounts.size()); U32 randomIndex = STest::Random::lowerUpper(0, mapSize - 1); - ComCfg::APID apid = std::next(this->shadow_seqCounts.begin(), randomIndex)->first; + ComCfg::Apid apid = std::next(this->shadow_seqCounts.begin(), randomIndex)->first; return apid; } -ComCfg::APID::T ApidManagerTester::shadow_getRandomUntrackedApid() { +ComCfg::Apid::T ApidManagerTester::shadow_getRandomUntrackedApid() { // Select a random APID that is not currently tracked - ComCfg::APID::T apid; + ComCfg::Apid::T apid; do { - apid = static_cast(STest::Random::lowerUpper(10, ComCfg::APID::SPP_IDLE_PACKET)); + apid = static_cast(STest::Random::lowerUpper(10, ComCfg::Apid::SPP_IDLE_PACKET)); } while (this->shadow_seqCounts.find(apid) != this->shadow_seqCounts.end()); return apid; } diff --git a/Svc/Ccsds/ApidManager/test/ut/ApidManagerTester.hpp b/Svc/Ccsds/ApidManager/test/ut/ApidManagerTester.hpp index 1dabd69037..579f2f9bbc 100644 --- a/Svc/Ccsds/ApidManager/test/ut/ApidManagerTester.hpp +++ b/Svc/Ccsds/ApidManager/test/ut/ApidManagerTester.hpp @@ -59,20 +59,20 @@ class ApidManagerTester : public ApidManagerGTestBase { ApidManager component; // Shadow test state - std::map shadow_seqCounts; //!< Map to hold expected sequence counts for APIDs + std::map shadow_seqCounts; //!< Map to hold expected sequence counts for APIDs bool shadow_isTableFull = false; // ---------------------------------------------------------------------- // Helpers for tracking the shadow test state // ---------------------------------------------------------------------- - U16 shadow_getAndIncrementSeqCount(ComCfg::APID::T apid); + U16 shadow_getAndIncrementSeqCount(ComCfg::Apid::T apid); - void shadow_validateApidSeqCount(ComCfg::APID::T apid, U16 expectedSeqCount); + void shadow_validateApidSeqCount(ComCfg::Apid::T apid, U16 expectedSeqCount); - ComCfg::APID::T shadow_getRandomTrackedApid(); + ComCfg::Apid::T shadow_getRandomTrackedApid(); - ComCfg::APID::T shadow_getRandomUntrackedApid(); + ComCfg::Apid::T shadow_getRandomUntrackedApid(); // ---------------------------------------------------------------------- // Tests: Rule Based Testing diff --git a/Svc/Ccsds/Ports/Ports.fpp b/Svc/Ccsds/Ports/Ports.fpp index 360bf71542..6575c4e1d7 100644 --- a/Svc/Ccsds/Ports/Ports.fpp +++ b/Svc/Ccsds/Ports/Ports.fpp @@ -2,7 +2,7 @@ module Svc { module Ccsds { @ Port for requesting a sequence count for a given APID - port ApidSequenceCount (apid: ComCfg.APID, sequenceCount: U16) -> U16 + port ApidSequenceCount (apid: ComCfg.Apid, sequenceCount: U16) -> U16 } } diff --git a/Svc/Ccsds/SpacePacketDeframer/SpacePacketDeframer.cpp b/Svc/Ccsds/SpacePacketDeframer/SpacePacketDeframer.cpp index ed56871078..a3d933be90 100644 --- a/Svc/Ccsds/SpacePacketDeframer/SpacePacketDeframer.cpp +++ b/Svc/Ccsds/SpacePacketDeframer/SpacePacketDeframer.cpp @@ -57,7 +57,7 @@ void SpacePacketDeframer ::dataIn_handler(FwIndexType portNum, Fw::Buffer& data, } U16 apidValue = header.get_packetIdentification() & SpacePacketSubfields::ApidMask; - ComCfg::APID::T apid = static_cast(apidValue); + ComCfg::Apid::T apid = static_cast(apidValue); ComCfg::FrameContext contextCopy = context; contextCopy.set_apid(apid); diff --git a/Svc/Ccsds/SpacePacketDeframer/test/ut/SpacePacketDeframerTester.cpp b/Svc/Ccsds/SpacePacketDeframer/test/ut/SpacePacketDeframerTester.cpp index 39e0d3d9f2..09981516df 100644 --- a/Svc/Ccsds/SpacePacketDeframer/test/ut/SpacePacketDeframerTester.cpp +++ b/Svc/Ccsds/SpacePacketDeframer/test/ut/SpacePacketDeframerTester.cpp @@ -41,7 +41,7 @@ void SpacePacketDeframerTester ::testDataReturnPassthrough() { } void SpacePacketDeframerTester ::testNominalDeframing() { - ComCfg::APID::T apid = static_cast(STest::Random::lowerUpper(0, 0x7FF)); // random 11 bit APID + ComCfg::Apid::T apid = static_cast(STest::Random::lowerUpper(0, 0x7FF)); // random 11 bit APID U16 seqCount = static_cast(STest::Random::lowerUpper(0, 0x3FFF)); // random 14 bit sequence count U16 dataLength = static_cast(STest::Random::lowerUpper(1, MAX_TEST_PACKET_DATA_SIZE)); // bytes of data, random length @@ -72,7 +72,7 @@ void SpacePacketDeframerTester ::testNominalDeframing() { } void SpacePacketDeframerTester ::testDeframingIncorrectLength() { - ComCfg::APID::T apid = static_cast(STest::Random::lowerUpper(0, 0x7FF)); // random 11 bit APID + ComCfg::Apid::T apid = static_cast(STest::Random::lowerUpper(0, 0x7FF)); // random 11 bit APID U16 seqCount = static_cast(STest::Random::lowerUpper(0, 0x3FFF)); // random 14 bit sequence count U16 realDataLength = static_cast(STest::Random::lowerUpper(1, MAX_TEST_PACKET_DATA_SIZE)); // bytes of data, random length diff --git a/Svc/Ccsds/SpacePacketFramer/SpacePacketFramer.cpp b/Svc/Ccsds/SpacePacketFramer/SpacePacketFramer.cpp index 68194004d7..b59ff10ed2 100644 --- a/Svc/Ccsds/SpacePacketFramer/SpacePacketFramer.cpp +++ b/Svc/Ccsds/SpacePacketFramer/SpacePacketFramer.cpp @@ -44,7 +44,7 @@ void SpacePacketFramer ::dataIn_handler(FwIndexType portNum, Fw::Buffer& data, c // PVN is always 0 per Standard - Packet Type is 0 for Telemetry (downlink) - SecHdr flag is 0 for no secondary // header U16 packetIdentification = 0; - ComCfg::APID::T apid = context.get_apid(); + ComCfg::Apid::T apid = context.get_apid(); FW_ASSERT((apid >> SpacePacketSubfields::ApidWidth) == 0, static_cast(apid)); // apid must fit in 11 bits packetIdentification |= static_cast(apid) & static_cast(SpacePacketSubfields::ApidMask); // 11 bit APID diff --git a/Svc/Ccsds/SpacePacketFramer/SpacePacketFramer.hpp b/Svc/Ccsds/SpacePacketFramer/SpacePacketFramer.hpp index 3b5292fb2c..69f3dee80b 100644 --- a/Svc/Ccsds/SpacePacketFramer/SpacePacketFramer.hpp +++ b/Svc/Ccsds/SpacePacketFramer/SpacePacketFramer.hpp @@ -8,7 +8,7 @@ #define Svc_Ccsds_SpacePacketFramer_HPP #include "Svc/Ccsds/SpacePacketFramer/SpacePacketFramerComponentAc.hpp" -#include "config/APIDEnumAc.hpp" +#include "config/ApidEnumAc.hpp" namespace Svc { diff --git a/Svc/Ccsds/SpacePacketFramer/test/ut/SpacePacketFramerTester.cpp b/Svc/Ccsds/SpacePacketFramer/test/ut/SpacePacketFramerTester.cpp index 2d100f8a0c..d08beb08a1 100644 --- a/Svc/Ccsds/SpacePacketFramer/test/ut/SpacePacketFramerTester.cpp +++ b/Svc/Ccsds/SpacePacketFramer/test/ut/SpacePacketFramerTester.cpp @@ -59,7 +59,7 @@ void SpacePacketFramerTester::testNominalFraming() { payload[i] = static_cast(STest::Random::lowerUpper(0, 0xFF)); } Fw::Buffer data(payload, sizeof(payload)); - ComCfg::APID::T apid = static_cast(STest::Random::lowerUpper(0, 0x7FF)); // random 11 bit APID + ComCfg::Apid::T apid = static_cast(STest::Random::lowerUpper(0, 0x7FF)); // random 11 bit APID U16 seqCount = static_cast(STest::Random::lowerUpper(0, 0x3FFF)); // random 14 bit sequence count ComCfg::FrameContext context; context.set_apid(apid); @@ -86,7 +86,7 @@ void SpacePacketFramerTester::testNominalFraming() { // ---------------------------------------------------------------------- U16 SpacePacketFramerTester ::from_getApidSeqCount_handler(FwIndexType portNum, - const ComCfg::APID& apid, + const ComCfg::Apid& apid, U16 sequenceCount) { return this->m_nextSeqCount; } diff --git a/Svc/Ccsds/SpacePacketFramer/test/ut/SpacePacketFramerTester.hpp b/Svc/Ccsds/SpacePacketFramer/test/ut/SpacePacketFramerTester.hpp index 2638d7c98e..6d1e2f1a5a 100644 --- a/Svc/Ccsds/SpacePacketFramer/test/ut/SpacePacketFramerTester.hpp +++ b/Svc/Ccsds/SpacePacketFramer/test/ut/SpacePacketFramerTester.hpp @@ -62,7 +62,7 @@ class SpacePacketFramerTester final : public SpacePacketFramerGTestBase { // Test Harness: output port overrides // ---------------------------------------------------------------------- U16 from_getApidSeqCount_handler(FwIndexType portNum, //!< The port number - const ComCfg::APID& apid, + const ComCfg::Apid& apid, U16 sequenceCount) override; Fw::Buffer from_bufferAllocate_handler(FwIndexType portNum, FwSizeType size) override; diff --git a/Svc/Ccsds/TmFramer/TmFramer.cpp b/Svc/Ccsds/TmFramer/TmFramer.cpp index 6df6326b5b..1f02f4f598 100644 --- a/Svc/Ccsds/TmFramer/TmFramer.cpp +++ b/Svc/Ccsds/TmFramer/TmFramer.cpp @@ -107,7 +107,7 @@ void TmFramer ::dataReturnIn_handler(FwIndexType portNum, void TmFramer ::fill_with_idle_packet(Fw::SerializeBufferBase& serializer) { constexpr U16 endIndex = ComCfg::TmFrameFixedSize - TMTrailer::SERIALIZED_SIZE; - constexpr U16 idleApid = static_cast(ComCfg::APID::SPP_IDLE_PACKET); + constexpr U16 idleApid = static_cast(ComCfg::Apid::SPP_IDLE_PACKET); const U16 startIndex = static_cast(serializer.getBuffLength()); const U16 idlePacketSize = static_cast(endIndex - startIndex); // Length token is defined as the number of bytes of payload data minus 1 diff --git a/Svc/CmdDispatcher/test/ut/CommandDispatcherTester.cpp b/Svc/CmdDispatcher/test/ut/CommandDispatcherTester.cpp index 4c640dcdbd..917b507b1c 100644 --- a/Svc/CmdDispatcher/test/ut/CommandDispatcherTester.cpp +++ b/Svc/CmdDispatcher/test/ut/CommandDispatcherTester.cpp @@ -648,7 +648,9 @@ void CommandDispatcherTester::runInvalidCommand() { FwOpcodeType testOpCode = 0x50; this->clearEvents(); Fw::ComBuffer buff; - ASSERT_EQ(buff.serializeFrom(static_cast(100)), Fw::FW_SERIALIZE_OK); + // Serialize a log packet type instead of command packet type to cause flawed command + ASSERT_EQ(buff.serializeFrom(static_cast(Fw::ComPacketType::FW_PACKET_LOG)), + Fw::FW_SERIALIZE_OK); ASSERT_EQ(buff.serializeFrom(testOpCode), Fw::FW_SERIALIZE_OK); ASSERT_EQ(buff.serializeFrom(testCmdArg), Fw::FW_SERIALIZE_OK); diff --git a/Svc/CmdSequencer/test/int/test_cmd_sequencer.py b/Svc/CmdSequencer/test/int/test_cmd_sequencer.py index 3172974eb4..802b9e5906 100644 --- a/Svc/CmdSequencer/test/int/test_cmd_sequencer.py +++ b/Svc/CmdSequencer/test/int/test_cmd_sequencer.py @@ -139,7 +139,7 @@ def test_seqgen(fprime_test_api): subprocess.run( [ "fprime-seqgen", - "-d", + "--dictionary", str(fprime_test_api.pipeline.dictionary_path), str(sequence), "ref_test_seq.bin", diff --git a/Svc/ComQueue/ComQueue.cpp b/Svc/ComQueue/ComQueue.cpp index 7181a50ea1..5075b88837 100644 --- a/Svc/ComQueue/ComQueue.cpp +++ b/Svc/ComQueue/ComQueue.cpp @@ -257,7 +257,7 @@ void ComQueue::sendComBuffer(Fw::ComBuffer& comBuffer, FwIndexType queueIndex) { FwPacketDescriptorType descriptor; Fw::SerializeStatus status = comBuffer.deserializeTo(descriptor); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, static_cast(status)); - context.set_apid(static_cast(descriptor)); + context.set_apid(static_cast(descriptor)); context.set_comQueueIndex(queueIndex); this->dataOut_out(0, outBuffer, context); @@ -274,7 +274,7 @@ void ComQueue::sendBuffer(Fw::Buffer& buffer, FwIndexType queueIndex) { FwPacketDescriptorType descriptor; Fw::SerializeStatus status = buffer.getDeserializer().deserializeTo(descriptor); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, static_cast(status)); - context.set_apid(static_cast(descriptor)); + context.set_apid(static_cast(descriptor)); context.set_comQueueIndex(queueIndex); this->dataOut_out(0, buffer, context); diff --git a/Svc/FprimeDeframer/FprimeDeframer.cpp b/Svc/FprimeDeframer/FprimeDeframer.cpp index 172559fbec..aec2cdfd44 100644 --- a/Svc/FprimeDeframer/FprimeDeframer.cpp +++ b/Svc/FprimeDeframer/FprimeDeframer.cpp @@ -65,8 +65,8 @@ void FprimeDeframer ::dataIn_handler(FwIndexType portNum, Fw::Buffer& data, cons FW_ASSERT(status == Fw::SerializeStatus::FW_SERIALIZE_OK, status); ComCfg::FrameContext contextCopy = context; // If a valid descriptor is deserialized, set it in the context - if (packetDescriptor < ComCfg::APID::INVALID_UNINITIALIZED) { - contextCopy.set_apid(static_cast(packetDescriptor)); + if (packetDescriptor < ComCfg::Apid::INVALID_UNINITIALIZED) { + contextCopy.set_apid(static_cast(packetDescriptor)); } // ---------------- Validate Frame Trailer ---------------- diff --git a/Svc/FprimeDeframer/test/ut/FprimeDeframerTester.cpp b/Svc/FprimeDeframer/test/ut/FprimeDeframerTester.cpp index 522ee373db..a41ee6272d 100644 --- a/Svc/FprimeDeframer/test/ut/FprimeDeframerTester.cpp +++ b/Svc/FprimeDeframer/test/ut/FprimeDeframerTester.cpp @@ -40,16 +40,15 @@ void FprimeDeframerTester ::testNominalFrame() { // Assert that the data that was emitted on dataOut is equal to Data field above (randomByte) ASSERT_EQ(this->fromPortHistory_dataOut->at(0).data.getData()[0], randomByte); // Not enough data to read a valid APID -> should default to FW_PACKET_UNKNOWN - ASSERT_EQ(this->fromPortHistory_dataOut->at(0).context.get_apid(), ComCfg::APID::FW_PACKET_UNKNOWN); + ASSERT_EQ(this->fromPortHistory_dataOut->at(0).context.get_apid(), ComCfg::Apid::FW_PACKET_UNKNOWN); ASSERT_EVENTS_SIZE(0); // no events emitted } void FprimeDeframerTester ::testNominalFrameApid() { // Get random byte of data which represents the APID (PacketDescriptor) U8 randomByte = static_cast(STest::Random::lowerUpper(0, 255)); - // | F´ start word | Length (= 4) | PacketDescriptor (APID) | Checksum (4 bytes) | - U8 data[16] = {0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x00, 0x00, 0x04, - 0x00, 0x00, 0x00, randomByte, 0x00, 0x00, 0x00, 0x00}; + // | F´ start word | Length (= 2) | Data (APID) | Checksum (4 bytes) | + U8 data[14] = {0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x00, 0x00, 0x02, 0x00, randomByte, 0x00, 0x00, 0x00, 0x00}; // Inject the checksum into the data and send it to the component under test this->injectChecksum(data, sizeof(data)); this->mockReceiveData(data, sizeof(data)); diff --git a/Svc/FprimeRouter/FprimeRouter.cpp b/Svc/FprimeRouter/FprimeRouter.cpp index 41c5c4c334..e669791878 100644 --- a/Svc/FprimeRouter/FprimeRouter.cpp +++ b/Svc/FprimeRouter/FprimeRouter.cpp @@ -8,7 +8,7 @@ #include "Fw/Com/ComPacket.hpp" #include "Fw/FPrimeBasicTypes.hpp" #include "Fw/Logger/Logger.hpp" -#include "config/APIDEnumAc.hpp" +#include "config/ApidEnumAc.hpp" namespace Svc { diff --git a/Svc/FprimeRouter/test/ut/FprimeRouterTester.cpp b/Svc/FprimeRouter/test/ut/FprimeRouterTester.cpp index 2301a0cca3..037bad1ba4 100644 --- a/Svc/FprimeRouter/test/ut/FprimeRouterTester.cpp +++ b/Svc/FprimeRouter/test/ut/FprimeRouterTester.cpp @@ -90,7 +90,7 @@ void FprimeRouterTester::mockReceivePacketType(Fw::ComPacketType packetType) { U8 data[sizeof descriptorType]; Fw::Buffer buffer(data, sizeof(data)); ComCfg::FrameContext context; - context.set_apid(static_cast(descriptorType)); + context.set_apid(static_cast(descriptorType)); this->invoke_to_dataIn(0, buffer, context); } diff --git a/Svc/FpySequencer/test/ut/FpySequencerTestMain.cpp b/Svc/FpySequencer/test/ut/FpySequencerTestMain.cpp index b359445918..8eb0d5c1a7 100644 --- a/Svc/FpySequencer/test/ut/FpySequencerTestMain.cpp +++ b/Svc/FpySequencer/test/ut/FpySequencerTestMain.cpp @@ -201,7 +201,8 @@ TEST_F(FpySequencerTester, cmd) { ASSERT_EQ(result, Signal::stmtResponse_keepWaiting); Fw::ComBuffer expected; - ASSERT_EQ(expected.serialize(Fw::ComPacketType::FW_PACKET_COMMAND), Fw::SerializeStatus::FW_SERIALIZE_OK); + ASSERT_EQ(expected.serialize(static_cast(Fw::ComPacketType::FW_PACKET_COMMAND)), + Fw::SerializeStatus::FW_SERIALIZE_OK); ASSERT_EQ(expected.serialize(directive.get_opCode()), Fw::SerializeStatus::FW_SERIALIZE_OK); ASSERT_EQ(expected.serialize(data, sizeof(data), Fw::Serialization::OMIT_LENGTH), Fw::SerializeStatus::FW_SERIALIZE_OK); diff --git a/cmake/test/data/TestConfigDeployment/override/project/FpConfig.fpp b/cmake/test/data/TestConfigDeployment/override/project/FpConfig.fpp index f47a87575c..b33367ac03 100644 --- a/cmake/test/data/TestConfigDeployment/override/project/FpConfig.fpp +++ b/cmake/test/data/TestConfigDeployment/override/project/FpConfig.fpp @@ -67,9 +67,6 @@ type FwEventIdType = FwIdType @ The type of a command opcode type FwOpcodeType = FwIdType -@ The type of a com packet descriptor -type FwPacketDescriptorType = FwIdType - @ The type of a parameter identifier type FwPrmIdType = FwIdType diff --git a/default/config/ComCfg.fpp b/default/config/ComCfg.fpp index 2954d98d9f..5d3ceb3013 100644 --- a/default/config/ComCfg.fpp +++ b/default/config/ComCfg.fpp @@ -6,6 +6,9 @@ # defined # ====================================================================== +@ The width of packet descriptors when they are serialized by the framework +type FwPacketDescriptorType = U16 + module ComCfg { # Needed in dictionary: @@ -16,7 +19,7 @@ module ComCfg { constant TmFrameFixedSize = 1024 # Needs to be at least COM_BUFFER_MAX_SIZE + (2 * SpacePacketHeaderSize) + 1 @ APIDs are 11 bits in the Space Packet protocol, so we use U16. Max value 7FF - enum APID : U16 { + enum Apid : FwPacketDescriptorType { # APIDs prefixed with FW are reserved for F Prime and need to be present # in the enumeration. Their values can be changed FW_PACKET_COMMAND = 0x0000 @< Command packet type - incoming @@ -35,12 +38,12 @@ module ComCfg { @ Type used to pass context info between components during framing/deframing struct FrameContext { comQueueIndex: FwIndexType @< Queue Index used by the ComQueue, other components shall not modify - apid: APID @< 11 bits APID in CCSDS + apid: Apid @< 11 bits APID in CCSDS sequenceCount: U16 @< 14 bit Sequence count - sequence count is incremented per APID vcId: U8 @< 6 bit Virtual Channel ID - used for TC and TM } default { comQueueIndex = 0 - apid = APID.FW_PACKET_UNKNOWN + apid = Apid.FW_PACKET_UNKNOWN sequenceCount = 0 vcId = 1 } diff --git a/default/config/FpConfig.fpp b/default/config/FpConfig.fpp index bed897cd9d..b857081eab 100644 --- a/default/config/FpConfig.fpp +++ b/default/config/FpConfig.fpp @@ -64,9 +64,6 @@ type FwEventIdType = FwIdType @ The type of a command opcode type FwOpcodeType = FwIdType -@ The type of a com packet descriptor -type FwPacketDescriptorType = FwIdType - @ The type of a parameter identifier type FwPrmIdType = FwIdType diff --git a/requirements.txt b/requirements.txt index e1ae8ee471..42c8fc6f20 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,7 +21,7 @@ Flask-RESTful==0.3.10 fprime-fpl-layout==1.0.3 fprime-fpl-write-pic==1.0.3 fprime-fpp==3.0.1a1 -fprime-gds==4.0.2a4 +fprime-gds==4.0.2a6 fprime-tools==4.0.2a1 fprime-visual==1.0.2 gcovr==8.2