Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ComStub and ComQueue #145

Merged
merged 8 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ cmake
cmakelists
cmp
commonprefix
comms
config
configparser
configs
Expand Down Expand Up @@ -50,7 +51,7 @@ dirone
dirs
distutils
doctest
Drv
drv
dumpable
Dxyz
elif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,22 @@ module {{cookiecutter.deployment_name}} {
stack size Default.STACK_SIZE \
priority 100

instance fileDownlink: Svc.FileDownlink base id 0x0700 \
instance comQueue: Svc.ComQueue base id 0x0700 \
queue size Default.QUEUE_SIZE \
stack size Default.STACK_SIZE \
priority 100 \

instance fileDownlink: Svc.FileDownlink base id 0x0800 \
queue size 30 \
stack size Default.STACK_SIZE \
priority 100

instance fileManager: Svc.FileManager base id 0x0800 \
instance fileManager: Svc.FileManager base id 0x0900 \
queue size 30 \
stack size Default.STACK_SIZE \
priority 100

instance fileUplink: Svc.FileUplink base id 0x0900 \
instance fileUplink: Svc.FileUplink base id 0x0A00 \
queue size 30 \
stack size Default.STACK_SIZE \
priority 100
Expand Down Expand Up @@ -95,7 +100,7 @@ module {{cookiecutter.deployment_name}} {

@ Communications driver. May be swapped with other comm drivers like UART
@ Note: Here we have TCP reliable uplink and UDP (low latency) downlink
instance comm: Drv.ByteStreamDriverModel base id 0x4000 \
instance comDriver: Drv.ByteStreamDriverModel base id 0x4000 \
type "Drv::TcpClient" \ # type specified to select implementor of ByteStreamDriverModel
at "../../Drv/TcpClient/TcpClient.hpp" # location of above implementor must also be specified

Expand All @@ -121,4 +126,6 @@ module {{cookiecutter.deployment_name}} {

instance systemResources: Svc.SystemResources base id 0x4A00

instance comStub: Svc.ComStub base id 0x4B00

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ module {{cookiecutter.deployment_name}} {
instance tlmSend
instance cmdDisp
instance cmdSeq
instance comm
instance comDriver
instance comQueue
instance comStub
instance downlink
instance eventLogger
instance fatalAdapter
Expand Down Expand Up @@ -70,15 +72,22 @@ module {{cookiecutter.deployment_name}} {

connections Downlink {

tlmSend.PktSend -> downlink.comIn
eventLogger.PktSend -> downlink.comIn
fileDownlink.bufferSendOut -> downlink.bufferIn
tlmSend.PktSend -> comQueue.comQueueIn[0]
eventLogger.PktSend -> comQueue.comQueueIn[1]
fileDownlink.bufferSendOut -> comQueue.buffQueueIn[0]

downlink.framedAllocate -> staticMemory.bufferAllocate[Ports_StaticMemory.downlink]
downlink.framedOut -> comm.send
downlink.framedOut -> comStub.comDataIn
downlink.bufferDeallocate -> fileDownlink.bufferReturn

comm.deallocate -> staticMemory.bufferDeallocate[Ports_StaticMemory.downlink]
comQueue.comQueueSend -> downlink.comIn
comQueue.buffQueueSend -> downlink.bufferIn

comDriver.deallocate -> staticMemory.bufferDeallocate[Ports_StaticMemory.downlink]
comDriver.ready -> comStub.drvConnected

comStub.comStatus -> comQueue.comStatusIn
comStub.drvDataOut -> comDriver.send

}

Expand Down Expand Up @@ -114,11 +123,13 @@ module {{cookiecutter.deployment_name}} {

connections Uplink {

comm.allocate -> staticMemory.bufferAllocate[Ports_StaticMemory.uplink]
comm.$recv -> uplink.framedIn
uplink.framedDeallocate -> staticMemory.bufferDeallocate[Ports_StaticMemory.uplink]
comDriver.allocate -> staticMemory.bufferAllocate[Ports_StaticMemory.uplink]
comDriver.$recv -> comStub.drvDataIn
comStub.comDataOut -> uplink.framedIn

uplink.framedDeallocate -> staticMemory.bufferDeallocate[Ports_StaticMemory.uplink]
uplink.comOut -> cmdDisp.seqCmdBuff

cmdDisp.seqCmdStatus -> uplink.cmdResponseIn

uplink.bufferAllocate -> fileUplinkBufferManager.bufferGetCallee
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
<channel name="blockDrv.BD_Cycles"/>
</packet>

<packet name="Comms" id="4" level="1">
<channel name="comQueue.comQueueDepth"/>
<channel name="comQueue.buffQueueDepth"/>
</packet>

<packet name="SystemRes1" id="5" level="2">
<channel name="systemResources.MEMORY_TOTAL"/>
<channel name="systemResources.MEMORY_USED"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Fw::MallocAllocator mallocator;
Svc::FprimeFraming framing;
Svc::FprimeDeframing deframing;

Svc::ComQueue::QueueConfigurationTable configurationTable;

// The reference topology divides the incoming clock signal (1Hz) into sub-signals: 1Hz, 1/2Hz, and 1/4Hz
NATIVE_INT_TYPE rateGroupDivisors[Svc::RateGroupDriver::DIVIDER_SIZE] = {1, 2, 4};

Expand Down Expand Up @@ -112,6 +114,15 @@ void configureTopology() {

// Note: Uncomment when using Svc:TlmPacketizer
//tlmSend.setPacketList({{cookiecutter.deployment_name}}PacketsPkts, {{cookiecutter.deployment_name}}PacketsIgnore, 1);

// Configure ComQueue
configurationTable.entries[0] = {.depth = 500, .priority = 2};
// Events , highest-priority
configurationTable.entries[1] = {.depth = 100, .priority = 0};
// File Downlink
configurationTable.entries[2] = {.depth = 100, .priority = 1};
// Allocation identifier is 0 as the MallocAllocator discards it
comQueue.configure(configurationTable, 0, mallocator);
}

// Public functions for use in main program are namespaced with deployment name {{cookiecutter.deployment_name}}
Expand All @@ -135,8 +146,8 @@ void setupTopology(const TopologyState& state) {
if (state.hostname != nullptr && state.port != 0) {
Os::TaskString name("ReceiveTask");
// Uplink is configured for receive so a socket task is started
comm.configure(state.hostname, state.port);
comm.startSocketTask(name, true, COMM_PRIORITY, Default::STACK_SIZE);
comDriver.configure(state.hostname, state.port);
comDriver.startSocketTask(name, true, COMM_PRIORITY, Default::STACK_SIZE);
}
}

Expand Down Expand Up @@ -172,8 +183,8 @@ void teardownTopology(const TopologyState& state) {
freeThreads(state);

// Other task clean-up.
comm.stopSocketTask();
(void)comm.joinSocketTask(nullptr);
comDriver.stopSocketTask();
(void)comDriver.joinSocketTask(nullptr);

// Resource deallocation
cmdSeq.deallocateBuffer(mallocator);
Expand Down