Skip to content

Commit cac5166

Browse files
AlesKusthomas-bc
andauthored
Clarify invocation of seqCmdStatus port in CmdDispatcher (#3557)
Co-authored-by: Thomas Boyer-Chammard <49786685+thomas-bc@users.noreply.github.com>
1 parent 717731e commit cac5166

2 files changed

Lines changed: 17 additions & 11 deletions

File tree

Svc/CmdDispatcher/CommandDispatcherImpl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ namespace Svc {
8181
if (portToCall != -1) {
8282
// call port to report status
8383
if (this->isConnected_seqCmdStatus_OutputPort(portToCall)) {
84+
// NOTE: seqCmdStatus port forwards three arguments: (opCode, cmdSeq, response).
85+
// However, the cmdSeq value has no meaning for the calling sequencer.
86+
// Instead, the context value is forwarded to allow the caller to utilize it if needed.
8487
this->seqCmdStatus_out(portToCall,opCode,context,response);
8588
}
8689
}

Svc/CmdDispatcher/docs/sdd.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Requirement | Description | Verification Method
1313
CD-001 | The `Svc::CmdDispatcher` component shall accept command buffers and decode them into commands | Inspection, Unit Test
1414
CD-002 | The `Svc::CmdDispatcher` component shall dispatch commands to components | Unit Test
1515
CD-003 | The `Svc::CmdDispatcher` component shall provide an interface to register commands | Inspection
16-
CD-004 | The `Svc::CmdDispatcher` component shall process command status from components and report the results to the command buffer sender. | Unit Test
16+
CD-004 | The `Svc::CmdDispatcher` component shall process command status from components and report the results to the command buffer sender. | Unit Test
1717

1818
## 3. Design
1919

@@ -32,10 +32,10 @@ The `Svc::CmdDispatcher` component uses the following port types:
3232
Port Data Type | Name | Direction | Kind | Usage
3333
-------------- | ---- | --------- | ---- | -----
3434
[`Fw::Cmd`](../../../Fw/Cmd/docs/sdd.md) | cmdSend | Output | n/a | Send commands to components
35-
[`Fw::CmdResponse`](../../../Fw/Cmd/docs/sdd.md) | compStat | Input | Asynchronous | Port for components to report command status
36-
[`Fw::CmdResponse`](../../../Fw/Cmd/docs/sdd.md) | seqStatus | Output | n/a | Send command status to command buffer source
37-
[`Fw::Com`](../../../Fw/Com/docs/sdd.md) | cmdBuff | Input | Asynchronous | Receive command buffer
38-
[`Fw::CmdReg`](../../../Fw/Cmd/docs/sdd.md) | cmdReg | Input | Synchronous | Command Registration
35+
[`Fw::CmdResponse`](../../../Fw/Cmd/docs/sdd.md) | compCmdStat | Input | Asynchronous | Port for components to report command status
36+
[`Fw::CmdResponse`](../../../Fw/Cmd/docs/sdd.md) | seqCmdStatus | Output | n/a | Send command status to command buffer source
37+
[`Fw::Com`](../../../Fw/Com/docs/sdd.md) | seqCmdBuff | Input | Asynchronous | Receive command buffer
38+
[`Fw::CmdReg`](../../../Fw/Cmd/docs/sdd.md) | cmdReg | Input | Synchronous | Command Registration
3939

4040
### 3.2 Functional Description
4141

@@ -47,7 +47,9 @@ An autogenerated function on components create a public function `regCommands` t
4747

4848
#### 3.2.2 Command Dispatch
4949

50-
When the command dispatcher receives a command buffer, it decodes the opcode. It searches the dispatch table for the opcode, then assigns a sequence number to the command and stores the opcode, sequence number, context value and source port in a pending command table. The command is then dispatched to the component that implements the command. When the component completes execution of the command, it reports the status back via the `compStat` port. The sequence number is matched to the entry in the pending command table, and the `seqStatus` output port corresponding to the source port is called (if it is connected) with the status and the context value. Note that this requires that the component sending the command buffer have connections to the same `cmdBuff` and `seqStatus` port numbers.
50+
When the command dispatcher receives a command buffer, it decodes the opcode. It searches the dispatch table for the opcode, then assigns a sequence number to the command and stores the opcode, sequence number, context value and source port in a pending command table. The command is then dispatched to the component that implements the command. When the component completes execution of the command, it reports the status back via the `compCmdStat` port. The sequence number is matched to the entry in the pending command table, and the `seqCmdStatus` output port corresponding to the source port is called (if it is connected) with the status and the context value.
51+
Note #1: this requires that the component sending the command buffer have connections to the same `seqCmdBuff` and `seqCmdStatus` port numbers.
52+
Note #2: the `seqCmdStatus` port utilize the same type as the `compCmdStat`, the `Fw::CmdResponse`. This has been done to avoid creation of similar types for status ports. However, the `Fw::CmdResponse::cmdSeq` argument of the `seqCmdStatus` doesn't have any meaning for the calling sequencer. Therefore, as it has been mentioned before, instead of forwarding a command sequence number, the context value is transferred.
5153

5254
### 3.3 Scenarios
5355

@@ -78,14 +80,14 @@ The `Svc::CmdDispatcher` component dispatches commands to other components:
7880

7981
```mermaid
8082
sequenceDiagram
81-
Command Buffer Source->>CommandDispatcher: cmdBuff()
83+
Command Buffer Source->>CommandDispatcher: seqCmdBuff()
8284
activate Command Buffer Source
8385
activate CommandDispatcher
84-
CommandDispatcher->>Component: cmdBuff()
86+
CommandDispatcher->>Component: seqCmdBuff()
8587
activate Component
86-
Component->>CommandDispatcher: comStat()
88+
Component->>CommandDispatcher: compCmdStat()
8789
deactivate Component
88-
CommandDispatcher->>Command Buffer Source: seqStatus()
90+
CommandDispatcher->>Command Buffer Source: seqCmdStatus()
8991
deactivate CommandDispatcher
9092
deactivate Command Buffer Source
9193
```
@@ -115,10 +117,11 @@ To see unit test coverage run `fprime-util check --coverage`
115117
Date | Description
116118
---- | -----------
117119
6/25/2015 | Design review edits
118-
7/22/2015 | Design review actions
120+
7/22/2015 | Design review actions
119121
9/16/2015 | Unit Test additions
120122
1/28/2016 | Added context value discussion
121123
5/17/2021 | Added CMD Reregistration option
124+
5/05/2025 | Added a note about Fw::CmdResponse::cmdSeq usage in seqCmdStatus
122125

123126

124127

0 commit comments

Comments
 (0)