Skip to content

Commit

Permalink
Initial TC Loopback test
Browse files Browse the repository at this point in the history
  • Loading branch information
Reg Marr committed Nov 13, 2024
1 parent b2fc834 commit c8982a1
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Upgrade to Ubuntu 22.04 as recommended
# Upgrade to Ubuntu 24.04 as recommended
FROM ubuntu:22.04 AS fprime_deps

# Set non-interactive installation mode for apt packages
Expand Down
19 changes: 19 additions & 0 deletions FlightComputer/CCSDSTester/CCSDSTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
#include "FpConfig.h"
#include "FpConfig.hpp"
#include "Fw/Com/ComBuffer.hpp"
#include "Fw/Com/ComPacket.hpp"
#include "Fw/Logger/Logger.hpp"
#include "Fw/Types/Serializable.hpp"
#include "Svc/FrameAccumulator/FrameDetector.hpp"
#include "Svc/FrameAccumulator/FrameDetector/CCSDSFrameDetector.hpp"
#include "Utils/Types/CircularBuffer.hpp"

namespace FlightComputer {

Expand Down Expand Up @@ -116,6 +121,7 @@ void CCSDSTester::PING_cmdHandler(const FwOpcodeType opCode, const U32 cmdSeq) {

U32 dfltMessage = 0x9944fead;
com.resetSer();
com.serialize(Fw::ComPacket::ComPacketType::FW_PACKET_COMMAND);
com.serialize(dfltMessage);

this->PktSend_out(0, com, 0);
Expand Down Expand Up @@ -150,6 +156,19 @@ Drv::SendStatus CCSDSTester::drvSend_handler(FwIndexType, Fw::Buffer & buffer) {
}
Fw::Logger::log("\n");

Types::CircularBuffer circBoi(buffer.getData(), buffer.getSize());
Fw::SerializeStatus stat = circBoi.serialize(buffer.getData(), buffer.getSize());
Fw::Logger::log("circBoi %d alloc %d cap %d\n",stat, circBoi.get_allocated_size(), circBoi.get_capacity());

Svc::FrameDetector::Status status = Svc::FrameDetector::Status::FRAME_DETECTED;
Svc::FrameDetectors::CCSDSFrameDetector ccsdsFrameDetector;

FwSizeType size_out = 0;
status = ccsdsFrameDetector.detect(circBoi, size_out);
Fw::Logger::log("Status %d out %d\n", status, size_out);

drvRcv_out(0, buffer, Drv::RecvStatus::RECV_OK);

return Drv::SendStatus::SEND_OK;
}

Expand Down
3 changes: 1 addition & 2 deletions FlightComputer/CCSDSTester/CCSDSTester.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,12 @@ module FlightComputer {
@ Port for receiving the status signal
async input port comStatusIn: Fw.SuccessCondition


# DrvMockPorts
@ Port invoked when the driver is ready to send/receive data
output port drvReady: Drv.ByteStreamReady

@ Port invoked when driver has received data
output port drvRecv: Drv.ByteStreamRecv
output port drvRcv: Drv.ByteStreamRecv

@ Port invoked to send data out the driver
guarded input port drvSend: Drv.ByteStreamSend
Expand Down
17 changes: 3 additions & 14 deletions FlightComputer/Top/topology.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ module FlightComputer {
# Rate group 2 (1/2Hz)
rateGroupDriverComp.CycleOut[Ports_RateGroups.rateGroup2] -> rateGroup2Comp.CycleIn
rateGroup2Comp.RateGroupMemberOut[0] -> cmdSeq.schedIn
rateGroup2Comp.RateGroupMemberOut[1] -> flightSequencer.run
rateGroup2Comp.RateGroupMemberOut[2] -> $health.Run
rateGroup2Comp.RateGroupMemberOut[1] -> $health.Run

# Rate group 3 (1/4Hz)
rateGroupDriverComp.CycleOut[Ports_RateGroups.rateGroup3] -> rateGroup3Comp.CycleIn
Expand Down Expand Up @@ -148,23 +147,15 @@ module FlightComputer {

connections ccsds {

# ccsdsTcpLink.allocate -> commsBufferManager.bufferGetCallee
# ccsdsTcpLink.$recv -> fprimeFrameAccumulator.dataIn
# tcFramer.framedOut -> ccsdsTcpLink.$send
# ccsdsNode.allocate -> commsBufferManager.bufferGetCallee
# ccsdsNode.$recv -> ccsdsFrameAccumulator.dataIn

ccsdsNode.bufferSendOut -> tcFramer.bufferIn
ccsdsNode.PktSend -> tcFramer.comIn

tcFramer.framedAllocate -> commsBufferManager.bufferGetCallee
# tcFramer.bufferDeallocate -> ccsdsNode.bufferReturn
tcFramer.framedOut -> ccsdsLink.comDataIn
ccsdsLink.comStatus -> ccsdsNode.comStatusIn
ccsdsNode.drvReady -> ccsdsLink.drvConnected
# ccsdsNode.drvRecv -> ccsdsLink.drvDataIn
# ccsdsLink.drvDataOut -> ccsdsNode.drvSend
ccsdsLink.drvDataOut -> ccsdsLink.drvDataIn
ccsdsLink.drvDataOut -> ccsdsNode.drvSend
ccsdsNode.drvRcv -> ccsdsLink.drvDataIn

ccsdsLink.comDataOut -> ccsdsFrameAccumulator.dataIn

Expand All @@ -178,8 +169,6 @@ module FlightComputer {
ccsdsUplinkRouter.bufferDeallocate -> commsBufferManager.bufferSendIn

ccsdsNode.seqCmdStatus -> ccsdsUplinkRouter.cmdResponseIn

# ccsdsNode.bufferSendOut -> commsBufferManager.bufferSendIn
}

}
Expand Down

0 comments on commit c8982a1

Please sign in to comment.