Skip to content

Commit dc3b07e

Browse files
committed
Add command sequencer
1 parent 44304a4 commit dc3b07e

File tree

11 files changed

+67
-20
lines changed

11 files changed

+67
-20
lines changed

FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ telemetry packets ReferenceDeploymentPackets {
99
ComCcsdsUart.commsBufferManager.HiBuffs
1010
ReferenceDeployment.rateGroup10Hz.RgMaxTime
1111
ReferenceDeployment.rateGroup1Hz.RgMaxTime
12+
# ReferenceDeployment.startupManager.BootCount
1213
}
1314

1415
packet HealthWarnings id 2 group 1 {
@@ -83,6 +84,11 @@ telemetry packets ReferenceDeploymentPackets {
8384
CdhCore.version.CustomVersion08
8485
CdhCore.version.CustomVersion09
8586
CdhCore.version.CustomVersion10
87+
ReferenceDeployment.cmdSeq.CS_LoadCommands
88+
ReferenceDeployment.cmdSeq.CS_CancelCommands
89+
ReferenceDeployment.cmdSeq.CS_CommandsExecuted
90+
ReferenceDeployment.cmdSeq.CS_SequencesCompleted
91+
ReferenceDeployment.cmdSeq.CS_Errors
8692
FileHandling.fileUplink.FilesReceived
8793
FileHandling.fileUplink.PacketsReceived
8894
FileHandling.fileDownlink.FilesSent

FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ U32 rateGroup1HzContext[Svc::ActiveRateGroup::CONNECTION_COUNT_MAX] = {getRateGr
5050
* desired, but is extracted here for clarity.
5151
*/
5252
void configureTopology() {
53-
prmDb.configure("/prmDb.dat");
53+
FileHandling::prmDb.configure("/prmDb.dat");
5454
// Rate group driver needs a divisor list
5555
rateGroupDriver.configure(rateGroupDivisorsSet);
5656
// Rate groups require context arrays.
@@ -60,6 +60,8 @@ void configureTopology() {
6060
gpioDriver.open(ledGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT);
6161
gpioBurnwire0.open(burnwire0Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT);
6262
gpioBurnwire1.open(burnwire1Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT);
63+
64+
cmdSeq.allocateBuffer(0, mallocator, 5 * 1024);
6365
}
6466

6567
// Public functions for use in main program are namespaced with deployment name ReferenceDeployment
@@ -78,7 +80,6 @@ void setupTopology(const TopologyState& state) {
7880
// Project-specific component configuration. Function provided above. May be inlined, if desired.
7981
configureTopology();
8082
// Autocoded parameter loading. Function provided by autocoder.
81-
prmDb.readParamFile();
8283
loadParameters();
8384
// Autocoded task kick-off (active components). Function provided by autocoder.
8485
startTasks(state);
@@ -106,5 +107,6 @@ void teardownTopology(const TopologyState& state) {
106107
stopTasks(state);
107108
freeThreads(state);
108109
tearDownComponents(state);
110+
cmdSeq.deallocateBuffer(mallocator);
109111
}
110112
}; // namespace ReferenceDeployment

FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopologyDefs.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ enum { WARN = 3, FATAL = 5 };
5454
namespace ReferenceDeployment_rateGroup1Hz {
5555
enum { WARN = 3, FATAL = 5 };
5656
}
57-
namespace ReferenceDeployment_prmDb {
57+
namespace ReferenceDeployment_cmdSeq {
5858
enum { WARN = 3, FATAL = 5 };
5959
}
6060
} // namespace PingEntries

FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ module ReferenceDeployment {
3030
instance rateGroup10Hz: Svc.ActiveRateGroup base id 0x10001000 \
3131
queue size Default.QUEUE_SIZE \
3232
stack size Default.STACK_SIZE \
33-
priority 3
33+
priority 2
3434

3535
instance rateGroup1Hz: Svc.ActiveRateGroup base id 0x10002000 \
3636
queue size Default.QUEUE_SIZE \
3737
stack size Default.STACK_SIZE \
38-
priority 4
38+
priority 3
3939

40-
instance prmDb: Svc.PrmDb base id 0x10003000 \
40+
instance cmdSeq: Svc.CmdSequencer base id 0x10006000 \
4141
queue size Default.QUEUE_SIZE \
4242
stack size Default.STACK_SIZE \
43-
priority 5
43+
priority 14
4444

4545
# ----------------------------------------------------------------------
4646
# Queued component instances

FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ module ReferenceDeployment {
3131
instance gpioBurnwire0
3232
instance gpioBurnwire1
3333
instance watchdog
34-
instance prmDb
3534
instance rtcManager
3635
instance imuManager
3736
instance lis2mdlManager
@@ -45,6 +44,8 @@ module ReferenceDeployment {
4544
# For UART sideband communication
4645
instance comDriver
4746
instance fsSpace
47+
instance cmdSeq
48+
#instance startupManager
4849

4950

5051
# ----------------------------------------------------------------------
@@ -85,6 +86,9 @@ module ReferenceDeployment {
8586

8687
ComCcsdsUart.fprimeRouter.commandOut -> CdhCore.cmdDisp.seqCmdBuff
8788
CdhCore.cmdDisp.seqCmdStatus -> ComCcsdsUart.fprimeRouter.cmdResponseIn
89+
90+
cmdSeq.comCmdOut -> CdhCore.cmdDisp.seqCmdBuff
91+
CdhCore.cmdDisp.seqCmdStatus -> cmdSeq.cmdResponseIn
8892
}
8993

9094
connections CommunicationsRadio {
@@ -126,6 +130,7 @@ module ReferenceDeployment {
126130
rateGroup10Hz.RateGroupMemberOut[1] -> ComCcsdsUart.aggregator.timeout
127131
rateGroup10Hz.RateGroupMemberOut[2] -> ComCcsds.aggregator.timeout
128132
rateGroup10Hz.RateGroupMemberOut[3] -> FileHandling.fileManager.schedIn
133+
rateGroup10Hz.RateGroupMemberOut[4] -> cmdSeq.schedIn
129134

130135
# Slow rate (1Hz) rate group
131136
rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup1Hz] -> rateGroup1Hz.CycleIn
@@ -140,7 +145,7 @@ module ReferenceDeployment {
140145
rateGroup1Hz.RateGroupMemberOut[8] -> antennaDeployer.schedIn
141146
rateGroup1Hz.RateGroupMemberOut[9] -> fsSpace.run
142147
rateGroup1Hz.RateGroupMemberOut[10] -> FileHandling.fileDownlink.Run
143-
rateGroup1Hz.RateGroupMemberOut[11] -> startupManager.run
148+
#rateGroup1Hz.RateGroupMemberOut[11] -> startupManager.run
144149

145150
}
146151

@@ -168,12 +173,12 @@ module ReferenceDeployment {
168173

169174
connections ComCcsds_FileHandling {
170175
# File Downlink <-> ComQueue
171-
FileHandling.fileDownlink.bufferSendOut -> ComCcsds.comQueue.bufferQueueIn[ComCcsds.Ports_ComBufferQueue.FILE]
172-
ComCcsds.comQueue.bufferReturnOut[ComCcsds.Ports_ComBufferQueue.FILE] -> FileHandling.fileDownlink.bufferReturn
176+
FileHandling.fileDownlink.bufferSendOut -> ComCcsdsUart.comQueue.bufferQueueIn[ComCcsds.Ports_ComBufferQueue.FILE]
177+
ComCcsdsUart.comQueue.bufferReturnOut[ComCcsds.Ports_ComBufferQueue.FILE] -> FileHandling.fileDownlink.bufferReturn
173178

174179
# Router <-> FileUplink
175-
ComCcsds.fprimeRouter.fileOut -> FileHandling.fileUplink.bufferSendIn
176-
FileHandling.fileUplink.bufferSendOut -> ComCcsds.fprimeRouter.fileBufferReturnIn
180+
ComCcsdsUart.fprimeRouter.fileOut -> FileHandling.fileUplink.bufferSendIn
181+
FileHandling.fileUplink.bufferSendOut -> ComCcsdsUart.fprimeRouter.fileBufferReturnIn
177182
}
178183

179184

FprimeZephyrReference/project/config/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ register_fprime_config(
1111
"${CMAKE_CURRENT_LIST_DIR}/ComCcsdsConfig.fpp"
1212
"${CMAKE_CURRENT_LIST_DIR}/ComCfg.fpp"
1313
"${CMAKE_CURRENT_LIST_DIR}/CommandDispatcherImplCfg.hpp"
14+
"${CMAKE_CURRENT_LIST_DIR}/FileHandlingConfig.fpp"
1415
"${CMAKE_CURRENT_LIST_DIR}/LoRaCfg.hpp"
1516
"${CMAKE_CURRENT_LIST_DIR}/FpConfig.h"
1617
"${CMAKE_CURRENT_LIST_DIR}/TlmPacketizerCfg.hpp"

FprimeZephyrReference/project/config/CdhCoreConfig.fpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ module CdhCoreConfig {
1717
}
1818

1919
module Priorities {
20-
constant cmdDisp = 10
21-
constant $health = 11
22-
constant events = 12
23-
constant tlmSend = 13
20+
constant cmdDisp = 7
21+
constant $health = 8
22+
constant events = 9
23+
constant tlmSend = 10
2424

2525
}
2626
}

FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Define configuration values for dispatcher
1212

1313
enum {
14-
CMD_DISPATCHER_DISPATCH_TABLE_SIZE = 50, // !< The size of the table holding opcodes to dispatch
14+
CMD_DISPATCHER_DISPATCH_TABLE_SIZE = 100, // !< The size of the table holding opcodes to dispatch
1515
CMD_DISPATCHER_SEQUENCER_TABLE_SIZE = 10, // !< The size of the table holding commands in progress
1616
};
1717

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module FileHandlingConfig {
2+
#Base ID for the FileHandling Subtopology, all components are offsets from this base ID
3+
constant BASE_ID = 0x05000000
4+
5+
module QueueSizes {
6+
constant fileUplink = 10
7+
constant fileDownlink = 10
8+
constant fileManager = 10
9+
constant prmDb = 10
10+
}
11+
12+
module StackSizes {
13+
constant fileUplink = 8 * 1024
14+
constant fileDownlink = 8 * 1024
15+
constant fileManager = 8 * 1024
16+
constant prmDb = 8 * 1024
17+
}
18+
19+
module Priorities {
20+
constant fileUplink = 11
21+
constant fileDownlink = 12
22+
constant fileManager = 13
23+
constant prmDb = 14
24+
}
25+
26+
# File downlink configuration constants
27+
module DownlinkConfig {
28+
constant timeout = 1000 # File downlink timeout in ms
29+
constant cooldown = 1000 # File downlink cooldown in ms
30+
constant cycleTime = 1000 # File downlink cycle time in ms
31+
constant fileQueueDepth = 3 # File downlink queue depth
32+
}
33+
}

0 commit comments

Comments
 (0)