|
| 1 | +module ComCcsdsUart { |
| 2 | + |
| 3 | + # ComPacket Queue enum for queue types |
| 4 | + enum Ports_ComPacketQueue { |
| 5 | + EVENTS, |
| 6 | + TELEMETRY |
| 7 | + } |
| 8 | + |
| 9 | + enum Ports_ComBufferQueue { |
| 10 | + FILE |
| 11 | + } |
| 12 | + |
| 13 | + # ---------------------------------------------------------------------- |
| 14 | + # Active Components |
| 15 | + # ---------------------------------------------------------------------- |
| 16 | + instance comQueue: Svc.ComQueue base id ComCcsdsConfig.BASE_ID_UART + 0x00000 \ |
| 17 | + queue size ComCcsdsConfig.QueueSizes.comQueue \ |
| 18 | + stack size ComCcsdsConfig.StackSizes.comQueue \ |
| 19 | + priority ComCcsdsConfig.Priorities.comQueue \ |
| 20 | + { |
| 21 | + phase Fpp.ToCpp.Phases.configComponents """ |
| 22 | + using namespace ComCcsdsUart; |
| 23 | + Svc::ComQueue::QueueConfigurationTable configurationTableUart; |
| 24 | +
|
| 25 | + // Events (highest-priority) |
| 26 | + configurationTableUart.entries[Ports_ComPacketQueue::EVENTS].depth = ComCcsdsConfig::QueueDepths::events; |
| 27 | + configurationTableUart.entries[Ports_ComPacketQueue::EVENTS].priority = ComCcsdsConfig::QueuePriorities::events; |
| 28 | +
|
| 29 | + // Telemetry |
| 30 | + configurationTableUart.entries[Ports_ComPacketQueue::TELEMETRY].depth = ComCcsdsConfig::QueueDepths::tlm; |
| 31 | + configurationTableUart.entries[Ports_ComPacketQueue::TELEMETRY].priority = ComCcsdsConfig::QueuePriorities::tlm; |
| 32 | +
|
| 33 | + // File Downlink Queue (buffer queue using NUM_CONSTANTS offset) |
| 34 | + configurationTableUart.entries[Ports_ComPacketQueue::NUM_CONSTANTS + Ports_ComBufferQueue::FILE].depth = ComCcsdsConfig::QueueDepths::file; |
| 35 | + configurationTableUart.entries[Ports_ComPacketQueue::NUM_CONSTANTS + Ports_ComBufferQueue::FILE].priority = ComCcsdsConfig::QueuePriorities::file; |
| 36 | +
|
| 37 | + // Allocation identifier is 0 as the MallocAllocator discards it |
| 38 | + ComCcsdsUart::comQueue.configure(configurationTableUart, 0, ComCcsds::Allocation::memAllocator); |
| 39 | + """ |
| 40 | + phase Fpp.ToCpp.Phases.tearDownComponents """ |
| 41 | + ComCcsdsUart::comQueue.cleanup(); |
| 42 | + """ |
| 43 | + } |
| 44 | + |
| 45 | + instance aggregator: Svc.ComAggregator base id ComCcsdsConfig.BASE_ID_UART + 0x06000 \ |
| 46 | + queue size ComCcsdsConfig.QueueSizes.aggregator \ |
| 47 | + stack size ComCcsdsConfig.StackSizes.aggregator |
| 48 | + |
| 49 | + # ---------------------------------------------------------------------- |
| 50 | + # Passive Components |
| 51 | + # ---------------------------------------------------------------------- |
| 52 | + instance frameAccumulator: Svc.FrameAccumulator base id ComCcsdsConfig.BASE_ID_UART + 0x01000 \ |
| 53 | + { |
| 54 | + |
| 55 | + phase Fpp.ToCpp.Phases.configObjects """ |
| 56 | + Svc::FrameDetectors::CcsdsTcFrameDetector frameDetector; |
| 57 | + """ |
| 58 | + phase Fpp.ToCpp.Phases.configComponents """ |
| 59 | + ComCcsdsUart::frameAccumulator.configure( |
| 60 | + ConfigObjects::ComCcsdsUart_frameAccumulator::frameDetector, |
| 61 | + 1, |
| 62 | + ComCcsds::Allocation::memAllocator, |
| 63 | + ComCcsdsConfig::BuffMgr::frameAccumulatorSize |
| 64 | + ); |
| 65 | + """ |
| 66 | + |
| 67 | + phase Fpp.ToCpp.Phases.tearDownComponents """ |
| 68 | + ComCcsdsUart::frameAccumulator.cleanup(); |
| 69 | + """ |
| 70 | + } |
| 71 | + |
| 72 | + instance commsBufferManager: Svc.BufferManager base id ComCcsdsConfig.BASE_ID_UART + 0x02000 \ |
| 73 | + { |
| 74 | + phase Fpp.ToCpp.Phases.configObjects """ |
| 75 | + Svc::BufferManager::BufferBins bins; |
| 76 | + """ |
| 77 | + |
| 78 | + phase Fpp.ToCpp.Phases.configComponents """ |
| 79 | + memset(&ConfigObjects::ComCcsdsUart_commsBufferManager::bins, 0, sizeof(ConfigObjects::ComCcsdsUart_commsBufferManager::bins)); |
| 80 | + ConfigObjects::ComCcsdsUart_commsBufferManager::bins.bins[0].bufferSize = ComCcsdsConfig::BuffMgr::commsBuffSize; |
| 81 | + ConfigObjects::ComCcsdsUart_commsBufferManager::bins.bins[0].numBuffers = ComCcsdsConfig::BuffMgr::commsBuffCount; |
| 82 | + ConfigObjects::ComCcsdsUart_commsBufferManager::bins.bins[1].bufferSize = ComCcsdsConfig::BuffMgr::commsFileBuffSize; |
| 83 | + ConfigObjects::ComCcsdsUart_commsBufferManager::bins.bins[1].numBuffers = ComCcsdsConfig::BuffMgr::commsFileBuffCount; |
| 84 | + ComCcsdsUart::commsBufferManager.setup( |
| 85 | + ComCcsdsConfig::BuffMgr::commsBuffMgrId, |
| 86 | + 0, |
| 87 | + ComCcsds::Allocation::memAllocator, |
| 88 | + ConfigObjects::ComCcsdsUart_commsBufferManager::bins |
| 89 | + ); |
| 90 | + """ |
| 91 | + |
| 92 | + phase Fpp.ToCpp.Phases.tearDownComponents """ |
| 93 | + ComCcsdsUart::commsBufferManager.cleanup(); |
| 94 | + """ |
| 95 | + } |
| 96 | + |
| 97 | + instance fprimeRouter: Svc.FprimeRouter base id ComCcsdsConfig.BASE_ID_UART + 0x03000 |
| 98 | + |
| 99 | + instance tcDeframer: Svc.Ccsds.TcDeframer base id ComCcsdsConfig.BASE_ID_UART + 0x04000 |
| 100 | + |
| 101 | + instance spacePacketDeframer: Svc.Ccsds.SpacePacketDeframer base id ComCcsdsConfig.BASE_ID_UART + 0x05000 |
| 102 | + |
| 103 | + # NOTE: name 'framer' is used for the framer that connects to the Com Adapter Interface for better subtopology interoperability |
| 104 | + instance framer: Svc.Ccsds.TmFramer base id ComCcsdsConfig.BASE_ID_UART + 0x07000 |
| 105 | + |
| 106 | + instance spacePacketFramer: Svc.Ccsds.SpacePacketFramer base id ComCcsdsConfig.BASE_ID_UART + 0x08000 |
| 107 | + |
| 108 | + instance apidManager: Svc.Ccsds.ApidManager base id ComCcsdsConfig.BASE_ID_UART + 0x09000 |
| 109 | + |
| 110 | + instance comStub: Svc.ComStub base id ComCcsdsConfig.BASE_ID_UART + 0x0A000 |
| 111 | + |
| 112 | + topology FramingSubtopology { |
| 113 | + # Usage Note: |
| 114 | + # |
| 115 | + # When importing this subtopology, users shall establish 5 port connections with a component implementing |
| 116 | + # the Svc.Com (Svc/Interfaces/Com.fpp) interface. They are as follows: |
| 117 | + # |
| 118 | + # 1) Outputs: |
| 119 | + # - ComCcsds.framer.dataOut -> [Svc.Com].dataIn |
| 120 | + # - ComCcsds.frameAccumulator.dataReturnOut -> [Svc.Com].dataReturnIn |
| 121 | + # 2) Inputs: |
| 122 | + # - [Svc.Com].dataReturnOut -> ComCcsds.framer.dataReturnIn |
| 123 | + # - [Svc.Com].comStatusOut -> ComCcsds.framer.comStatusIn |
| 124 | + # - [Svc.Com].dataOut -> ComCcsds.frameAccumulator.dataIn |
| 125 | + |
| 126 | + |
| 127 | + # Active Components |
| 128 | + instance comQueue |
| 129 | + |
| 130 | + # Passive Components |
| 131 | + instance commsBufferManager |
| 132 | + instance frameAccumulator |
| 133 | + instance fprimeRouter |
| 134 | + instance tcDeframer |
| 135 | + instance spacePacketDeframer |
| 136 | + instance framer |
| 137 | + instance spacePacketFramer |
| 138 | + instance apidManager |
| 139 | + instance aggregator |
| 140 | + |
| 141 | + connections Downlink { |
| 142 | + # ComQueue <-> SpacePacketFramer |
| 143 | + comQueue.dataOut -> spacePacketFramer.dataIn |
| 144 | + spacePacketFramer.dataReturnOut -> comQueue.dataReturnIn |
| 145 | + # SpacePacketFramer buffer and APID management |
| 146 | + spacePacketFramer.bufferAllocate -> commsBufferManager.bufferGetCallee |
| 147 | + spacePacketFramer.bufferDeallocate -> commsBufferManager.bufferSendIn |
| 148 | + spacePacketFramer.getApidSeqCount -> apidManager.getApidSeqCountIn |
| 149 | + # SpacePacketFramer <-> TmFramer |
| 150 | + spacePacketFramer.dataOut -> aggregator.dataIn |
| 151 | + aggregator.dataOut -> framer.dataIn |
| 152 | + |
| 153 | + framer.dataReturnOut -> aggregator.dataReturnIn |
| 154 | + aggregator.dataReturnOut -> spacePacketFramer.dataReturnIn |
| 155 | + |
| 156 | + # ComStatus |
| 157 | + framer.comStatusOut -> aggregator.comStatusIn |
| 158 | + aggregator.comStatusOut -> spacePacketFramer.comStatusIn |
| 159 | + spacePacketFramer.comStatusOut -> comQueue.comStatusIn |
| 160 | + # (Outgoing) Framer <-> ComInterface connections shall be established by the user |
| 161 | + } |
| 162 | + |
| 163 | + connections Uplink { |
| 164 | + # (Incoming) ComInterface <-> FrameAccumulator connections shall be established by the user |
| 165 | + # FrameAccumulator buffer allocations |
| 166 | + frameAccumulator.bufferDeallocate -> commsBufferManager.bufferSendIn |
| 167 | + frameAccumulator.bufferAllocate -> commsBufferManager.bufferGetCallee |
| 168 | + # FrameAccumulator <-> TcDeframer |
| 169 | + frameAccumulator.dataOut -> tcDeframer.dataIn |
| 170 | + tcDeframer.dataReturnOut -> frameAccumulator.dataReturnIn |
| 171 | + # TcDeframer <-> SpacePacketDeframer |
| 172 | + tcDeframer.dataOut -> spacePacketDeframer.dataIn |
| 173 | + spacePacketDeframer.dataReturnOut -> tcDeframer.dataReturnIn |
| 174 | + # SpacePacketDeframer APID validation |
| 175 | + spacePacketDeframer.validateApidSeqCount -> apidManager.validateApidSeqCountIn |
| 176 | + # SpacePacketDeframer <-> Router |
| 177 | + spacePacketDeframer.dataOut -> fprimeRouter.dataIn |
| 178 | + fprimeRouter.dataReturnOut -> spacePacketDeframer.dataReturnIn |
| 179 | + # Router buffer allocations |
| 180 | + fprimeRouter.bufferAllocate -> commsBufferManager.bufferGetCallee |
| 181 | + fprimeRouter.bufferDeallocate -> commsBufferManager.bufferSendIn |
| 182 | + } |
| 183 | + } # end FramingSubtopology |
| 184 | + |
| 185 | + # This subtopology uses FramingSubtopology with a ComStub component for Com Interface |
| 186 | + topology Subtopology { |
| 187 | + import FramingSubtopology |
| 188 | + |
| 189 | + instance comStub |
| 190 | + |
| 191 | + connections ComStub { |
| 192 | + # Framer <-> ComStub (Downlink) |
| 193 | + framer.dataOut -> comStub.dataIn |
| 194 | + comStub.dataReturnOut -> framer.dataReturnIn |
| 195 | + comStub.comStatusOut -> framer.comStatusIn |
| 196 | + |
| 197 | + # ComStub <-> FrameAccumulator (Uplink) |
| 198 | + comStub.dataOut -> frameAccumulator.dataIn |
| 199 | + frameAccumulator.dataReturnOut -> comStub.dataReturnIn |
| 200 | + } |
| 201 | + } # end Subtopology |
| 202 | + |
| 203 | +} # end ComCcsds |
0 commit comments