Skip to content

Commit be91bfa

Browse files
authored
Support non-default Fw type config (ie: U16, U64) (#3714)
* Add FwBaseIdType, updates ActiveLogger, CmdDispatcher, TlmPacketizer to use Fw types, update unit tests * Update unit tests, rename FwBaseIdType to FwIdType * Cleanup * Change type of sizeOfZeros * Add FwIdType to TestConfigDeployment overriden config * Add annotation * Update Ref linuxTimer base id
1 parent ea96da0 commit be91bfa

File tree

36 files changed

+125
-112
lines changed

36 files changed

+125
-112
lines changed

Fw/Comp/PassiveComponentBase.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ namespace Fw {
4444
}
4545

4646
void PassiveComponentBase ::
47-
setIdBase(const U32 idBase)
47+
setIdBase(const FwIdType idBase)
4848
{
4949
this->m_idBase = idBase;
5050
}
5151

52-
U32 PassiveComponentBase ::
52+
FwIdType PassiveComponentBase ::
5353
getIdBase() const
5454
{
5555
return this->m_idBase;

Fw/Comp/PassiveComponentBase.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ namespace Fw {
1111
public:
1212
//! Set the ID base
1313
void setIdBase(
14-
const U32 //< The new ID base
14+
const FwIdType //< The new ID base
1515
);
1616
//! Get the ID base
1717
//! \return The ID base
18-
U32 getIdBase() const;
18+
FwIdType getIdBase() const;
1919

2020
protected:
2121
PassiveComponentBase(const char* name); //!< Named constructor
@@ -29,7 +29,7 @@ namespace Fw {
2929
void toString(char* str, FwSizeType size) override; //!< returns string description of component
3030
#endif
3131
private:
32-
U32 m_idBase; //!< ID base for opcodes etc.
32+
FwIdType m_idBase; //!< ID base for opcodes etc.
3333
FwEnumStoreType m_instance; //!< instance of component object
3434

3535

Fw/Dp/test/ut/TestMain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ TEST(Header, BufferInConstructor) {
107107
// Fill with data
108108
fillWithData(buffer);
109109
// Use the buffer to create a container
110-
const FwDpIdType id = STest::Pick::lowerUpper(0, std::numeric_limits<FwDpIdType>::max());
110+
const FwDpIdType id = static_cast<FwDpIdType>(STest::Pick::lowerUpper(0, static_cast<U32>(std::numeric_limits<FwDpIdType>::max())));
111111
DpContainer container(id, buffer);
112112
// Check the header
113113
checkHeader(id, buffer, container);
@@ -144,7 +144,7 @@ TEST(Header, BufferSet) {
144144
// Fill with data
145145
fillWithData(buffer);
146146
// Use the buffer to create a container
147-
const FwDpIdType id = STest::Pick::lowerUpper(0, std::numeric_limits<FwDpIdType>::max());
147+
const FwDpIdType id = static_cast<FwDpIdType>(STest::Pick::lowerUpper(0, static_cast<U32>(std::numeric_limits<FwDpIdType>::max())));
148148
DpContainer container;
149149
container.setId(id);
150150
container.setBuffer(buffer);

Fw/FPrimeBasicTypes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ extern "C" {
3737
#include <config/FwTaskPriorityTypeAliasAc.h>
3838
#include <config/FwQueuePriorityTypeAliasAc.h>
3939

40+
#include <config/FwIdTypeAliasAc.h>
4041
#include <config/FwChanIdTypeAliasAc.h>
4142
#include <config/FwDpIdTypeAliasAc.h>
4243
#include <config/FwDpPriorityTypeAliasAc.h>

Fw/Tlm/test/ut/TlmTest.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ TEST(FwTlmTest,TlmPacketSerializeSingle) {
1010
Fw::TlmBuffer buffIn;
1111
ASSERT_EQ(Fw::FW_SERIALIZE_OK,buffIn.serialize(static_cast<U32>(12)));
1212
Fw::Time timeIn(TB_WORKSTATION_TIME,10,11);
13-
U32 id = 10;
13+
FwChanIdType id = 10;
1414

1515
ASSERT_EQ(Fw::FW_SERIALIZE_OK,pktIn.resetPktSer());
1616
ASSERT_EQ(Fw::FW_SERIALIZE_OK,pktIn.addValue(id,timeIn,buffIn));
@@ -58,7 +58,7 @@ TEST(FwTlmTest,TlmPacketSerializeFill) {
5858
Fw::TlmBuffer buffIn;
5959
ASSERT_EQ(Fw::FW_SERIALIZE_OK,buffIn.serialize(static_cast<U32>(entry)));
6060
Fw::Time timeIn(TB_WORKSTATION_TIME,entry+1,entry+2);
61-
U32 id = static_cast<U32>(NUM_ENTRIES-entry);
61+
FwChanIdType id = static_cast<FwChanIdType>(NUM_ENTRIES-entry);
6262

6363
ASSERT_EQ(Fw::FW_SERIALIZE_OK,pktIn.addValue(id,timeIn,buffIn));
6464
}
@@ -68,7 +68,7 @@ TEST(FwTlmTest,TlmPacketSerializeFill) {
6868
Fw::TlmBuffer buffIn;
6969
ASSERT_EQ(Fw::FW_SERIALIZE_OK,buffIn.serialize(static_cast<U32>(12)));
7070
Fw::Time timeIn(TB_WORKSTATION_TIME,10,11);
71-
U32 id = 10;
71+
FwChanIdType id = 10;
7272

7373
ASSERT_EQ(Fw::FW_SERIALIZE_NO_ROOM_LEFT,pktIn.addValue(id,timeIn,buffIn));
7474
}
@@ -85,7 +85,7 @@ TEST(FwTlmTest,TlmPacketSerializeFill) {
8585
// Deserialize data
8686
Fw::TlmBuffer buffOut;
8787
Fw::Time timeOut;
88-
U32 id = 0;
88+
FwChanIdType id = 0;
8989
ASSERT_EQ(Fw::FW_SERIALIZE_OK,pktOut.extractValue(id,timeOut,buffOut,sizeof(U32)));
9090
ASSERT_EQ(NUM_ENTRIES-entry,id);
9191
Fw::Time expTime(TB_WORKSTATION_TIME,entry+1,entry+2);
@@ -99,7 +99,7 @@ TEST(FwTlmTest,TlmPacketSerializeFill) {
9999
{
100100
Fw::TlmBuffer buffOut;
101101
Fw::Time timeOut;
102-
U32 id = 0;
102+
FwChanIdType id = 0;
103103
ASSERT_EQ(Fw::FW_DESERIALIZE_BUFFER_EMPTY,pktOut.extractValue(id,timeOut,buffOut,sizeof(U32)));
104104
}
105105

Svc/ActiveLogger/ActiveLogger.fpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ module Svc {
9393

9494
@ Filter a particular ID
9595
async command SET_ID_FILTER(
96-
ID: U32
96+
ID: FwEventIdType
9797
idFilterEnabled: Enabled @< ID filter state
9898
) \
9999
opcode 2
@@ -117,31 +117,31 @@ module Svc {
117117

118118
@ Indicate ID is filtered
119119
event ID_FILTER_ENABLED(
120-
ID: U32 @< The ID filtered
120+
ID: FwEventIdType @< The ID filtered
121121
) \
122122
severity activity high \
123123
id 1 \
124124
format "ID {} is filtered."
125125

126126
@ Attempted to add ID to full ID filter ID
127127
event ID_FILTER_LIST_FULL(
128-
ID: U32 @< The ID filtered
128+
ID: FwEventIdType @< The ID filtered
129129
) \
130130
severity warning low \
131131
id 2 \
132132
format "ID filter list is full. Cannot filter {} ."
133133

134134
@ Removed an ID from the filter
135135
event ID_FILTER_REMOVED(
136-
ID: U32 @< The ID removed
136+
ID: FwEventIdType @< The ID removed
137137
) \
138138
severity activity high \
139139
id 3 \
140140
format "ID filter ID {} removed."
141141

142142
@ ID not in filter
143143
event ID_FILTER_NOT_FOUND(
144-
ID: U32 @< The ID removed
144+
ID: FwEventIdType @< The ID removed
145145
) \
146146
severity warning low \
147147
id 4 \

Svc/ActiveLogger/ActiveLoggerImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ namespace Svc {
127127
void ActiveLoggerImpl::SET_ID_FILTER_cmdHandler(
128128
FwOpcodeType opCode, //!< The opcode
129129
U32 cmdSeq, //!< The command sequence number
130-
U32 ID,
130+
FwEventIdType ID,
131131
Enabled idEnabled //!< ID filter state
132132
) {
133133

Svc/ActiveLogger/ActiveLoggerImpl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace Svc {
3232
void SET_ID_FILTER_cmdHandler(
3333
FwOpcodeType opCode, //!< The opcode
3434
U32 cmdSeq, //!< The command sequence number
35-
U32 ID,
35+
FwEventIdType ID,
3636
ActiveLogger_Enabled idFilterEnabled //!< ID filter state
3737
);
3838

Svc/ActiveTextLogger/test/ut/ActiveTextLoggerTester.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ namespace Svc {
104104
std::cout << "readLine: " << buf << std::endl;
105105
char textStr[512];
106106
snprintf(textStr, sizeof(textStr),
107-
"EVENT: (%d) (%d:%d,%d) %s: %s",
107+
"EVENT: (%" PRI_FwEventIdType ") (%d:%d,%d) %s: %s",
108108
id,timeTag.getTimeBase(),timeTag.getSeconds(),timeTag.getUSeconds(),severityString,text.toChar());
109109
ASSERT_STREQ(textStr,buf);
110110
(void) Fw::StringUtils::string_copy(oldLine, buf, static_cast<FwSizeType>(sizeof(oldLine)));
@@ -145,7 +145,7 @@ namespace Svc {
145145
else {
146146
char textStr[512];
147147
snprintf(textStr, sizeof(textStr),
148-
"EVENT: (%d) (%d:%d,%d) %s: %s",
148+
"EVENT: (%" PRI_FwEventIdType ") (%d:%d,%d) %s: %s",
149149
id,timeTag.getTimeBase(),timeTag.getSeconds(),timeTag.getUSeconds(),severityString,text.toChar());
150150
ASSERT_EQ(0,strcmp(textStr,buf));
151151
}
@@ -207,7 +207,7 @@ namespace Svc {
207207
std::cout << "readLine: " << buf << std::endl;
208208
char textStr[512];
209209
snprintf(textStr, sizeof(textStr),
210-
"EVENT: (%d) (%d:%d,%d) %s: %s",
210+
"EVENT: (%" PRI_FwEventIdType ") (%d:%d,%d) %s: %s",
211211
id,timeTag.getTimeBase(),timeTag.getSeconds(),timeTag.getUSeconds(),severityString,text.toChar());
212212
ASSERT_EQ(0,strcmp(textStr,buf));
213213
(void) Fw::StringUtils::string_copy(oldLine, buf, static_cast<FwSizeType>(sizeof(oldLine)));
@@ -373,7 +373,7 @@ namespace Svc {
373373
std::cout << "readLine: " << buf << std::endl;
374374
char textStr[512];
375375
snprintf(textStr, sizeof(textStr),
376-
"EVENT: (%d) (%d:%d,%d) %s: %s",
376+
"EVENT: (%" PRI_FwEventIdType ") (%d:%d,%d) %s: %s",
377377
id,timeTag.getTimeBase(), timeTag.getSeconds(), timeTag.getUSeconds(), severityString, text.toChar());
378378
ASSERT_EQ(0, strcmp(textStr, buf));
379379
}

Svc/CmdDispatcher/CmdDispatcher.fpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ module Svc {
9393
# ----------------------------------------------------------------------
9494

9595
event OpCodeRegistered(
96-
Opcode: U32 @< The opcode to register
96+
Opcode: FwOpcodeType @< The opcode to register
9797
$port: I32 @< The registration port
9898
slot: I32 @< The dispatch slot it was placed in
9999
) \
@@ -103,7 +103,7 @@ module Svc {
103103

104104
@ Op code dispatched event
105105
event OpCodeDispatched(
106-
Opcode: U32 @< The opcode dispatched
106+
Opcode: FwOpcodeType @< The opcode dispatched
107107
$port: I32 @< The port dispatched to
108108
) \
109109
severity command \
@@ -112,15 +112,15 @@ module Svc {
112112

113113
@ Op code completed event
114114
event OpCodeCompleted(
115-
Opcode: U32 @< The I32 command argument
115+
Opcode: FwOpcodeType @< The I32 command argument
116116
) \
117117
severity command \
118118
id 2 \
119119
format "Opcode 0x{x} completed"
120120

121121
@ Op code completed with error event
122122
event OpCodeError(
123-
Opcode: U32 @< The opcode with the error
123+
Opcode: FwOpcodeType @< The opcode with the error
124124
error: Fw.CmdResponse @< The error value
125125
) \
126126
severity command \
@@ -137,15 +137,15 @@ module Svc {
137137

138138
@ Received an invalid opcode
139139
event InvalidCommand(
140-
Opcode: U32 @< Invalid opcode
140+
Opcode: FwOpcodeType @< Invalid opcode
141141
) \
142142
severity warning high \
143143
id 5 \
144144
format "Invalid opcode 0x{x} received"
145145

146146
@ Exceeded the number of commands that can be simultaneously executed
147147
event TooManyCommands(
148-
Opcode: U32 @< The opcode that overflowed the list
148+
Opcode: FwOpcodeType @< The opcode that overflowed the list
149149
) \
150150
severity warning high \
151151
id 6 \
@@ -177,7 +177,7 @@ module Svc {
177177

178178
@ Op code reregistered event
179179
event OpCodeReregistered(
180-
Opcode: U32 @< The opcode reregistered
180+
Opcode: FwOpcodeType @< The opcode reregistered
181181
$port: I32 @< The reregistration port
182182
) \
183183
severity diagnostic \

0 commit comments

Comments
 (0)