Skip to content

Commit

Permalink
Applied fprime-util formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Reg Marr committed Nov 26, 2024
1 parent 6898925 commit 4b61454
Show file tree
Hide file tree
Showing 16 changed files with 794 additions and 693 deletions.
1 change: 0 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ BIN_DIR="${DEPLOYMENT_ROOT}/build-artifacts/Linux/FlightComputer/bin/"
DICT_DIR="${DEPLOYMENT_ROOT}/build-artifacts/Linux/FlightComputer/dict/"
START_MODE=${START_MODE:-"--rm"}
GDS_IP="127.0.0.1"
SCRIPT_DIR="."
23 changes: 18 additions & 5 deletions FlightComputer/CCSDSTester/CCSDSTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,13 @@ void CCSDSTester::PING_cmdHandler(const FwOpcodeType opCode, const U32 cmdSeq) {

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

PktSend_out(0, com, 0);

// cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
}
void CCSDSTester::MESSAGE_cmdHandler(const FwOpcodeType opCode,
Expand All @@ -142,10 +144,13 @@ void CCSDSTester::MESSAGE_cmdHandler(const FwOpcodeType opCode,
Fw::Logger::log("Not Ready");
}
Fw::ComBuffer com;

com.resetSer();

// U32 starter = 0xFFFF;
// com.serialize(starter);
U8 packetType = Fw::ComPacket::ComPacketType::FW_PACKET_FILE;

com.serialize(packetType);
com.serialize(str1);

Expand All @@ -154,16 +159,24 @@ void CCSDSTester::MESSAGE_cmdHandler(const FwOpcodeType opCode,
// cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
}

Drv::SendStatus CCSDSTester::drvSend_handler(FwIndexType portNum, Fw::Buffer & buffer) {
Drv::SendStatus CCSDSTester::drvSend_handler(FwIndexType portNum,
Fw::Buffer &buffer) {

Types::CircularBuffer circBoi(buffer.getData(), buffer.getSize());
Fw::SerializeStatus stat = circBoi.serialize(buffer.getData(), buffer.getSize());
Fw::SerializeStatus stat =
circBoi.serialize(buffer.getData(), buffer.getSize());
circBoi.print();
U8 btt = 0;
circBoi.peek(btt, 0);
Fw::Logger::log("circBoi %x %d alloc %d cap %d\n", btt, stat, circBoi.get_allocated_size(), circBoi.get_capacity());
Fw::Logger::log("circBoi %x %d alloc %d cap %d\n", btt, stat, "THis is bad",
circBoi.get_allocated_size(), circBoi.get_capacity());

Fw::Logger::log("I dont now");

circBoi.print();

// Svc::FrameDetector::Status status = Svc::FrameDetector::Status::FRAME_DETECTED;
// Svc::FrameDetector::Status status =
// Svc::FrameDetector::Status::FRAME_DETECTED;
// Svc::FrameDetectors::TMSpaceDataLinkDetector ccsdsFrameDetector;

// FwSizeType size_out = 0;
Expand Down
143 changes: 71 additions & 72 deletions FlightComputer/CCSDSTester/CCSDSTester.fpp
Original file line number Diff line number Diff line change
@@ -1,99 +1,98 @@
module FlightComputer {
@ Loopback CCSDS Testing component
active component CCSDSTester {
###############################################################################
# Standard AC Ports: Required for Channels, Events, Commands, and Parameters #
###############################################################################
@ Port for requesting the current time
time get port timeCaller

@ Port for sending command registrations
command reg port cmdRegOut
@ Loopback CCSDS Testing component
active component CCSDSTester {

@ Port for receiving commands
command recv port cmdIn
###############################################################################
# Standard AC Ports: Required for Channels, Events, Commands, and Parameters #
###############################################################################
@ Port for requesting the current time
time get port timeCaller

@ Port for sending command responses
command resp port cmdResponseOut
@ Port for sending command registrations
command reg port cmdRegOut

@ Port for sending textual representation of events
text event port logTextOut
@ Port for receiving commands
command recv port cmdIn

@ Port for sending events to downlink
event port logOut
@ Port for sending command responses
command resp port cmdResponseOut

@ Port for sending telemetry channels to downlink
telemetry port tlmOut
@ Port for sending textual representation of events
text event port logTextOut

@ Port to return the value of a parameter
param get port prmGetOut
@ Port for sending events to downlink
event port logOut

@Port to set the value of a parameter
param set port prmSetOut
@ Port for sending telemetry channels to downlink
telemetry port tlmOut

@ Port to return the value of a parameter
param get port prmGetOut

##############################################################################
#### Test interface ####
##############################################################################
@ Port to set the value of a parameter
param set port prmSetOut

@ Output Command Status Port
output port seqCmdStatus: [CmdDispatcherSequencePorts] Fw.CmdResponse
##############################################################################
#### Test interface ####
##############################################################################
@ Output Command Status Port
output port seqCmdStatus: [CmdDispatcherSequencePorts] Fw.CmdResponse

@ Command buffer input port for sequencers or other sources of command buffers
async input port seqCmdBuff: [CmdDispatcherSequencePorts] Fw.Com
@ Command buffer input port for sequencers or other sources of command buffers
async input port seqCmdBuff: [CmdDispatcherSequencePorts] Fw.Com

# ----------------------------------------------------------------------
# Port matching specifiers
# ----------------------------------------------------------------------
match seqCmdStatus with seqCmdBuff
# ----------------------------------------------------------------------
# Port matching specifiers
# ----------------------------------------------------------------------
match seqCmdStatus with seqCmdBuff

# ----------------------------------------------------------------------
# General Ports
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# General Ports
# ----------------------------------------------------------------------
@ Buffer send in
async input port bufferSendIn: Fw.BufferSend

@ Buffer send in
async input port bufferSendIn: Fw.BufferSend
@ Buffer send out
output port bufferSendOut: Fw.BufferSend

@ Buffer send out
output port bufferSendOut: Fw.BufferSend
@ Packet send port
output port PktSend: Fw.Com

@ Packet send port
output port PktSend: Fw.Com
@ Port for receiving the status signal
async input port comStatusIn: Fw.SuccessCondition

@ 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

# 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 drvRcv: Drv.ByteStreamRecv

@ Port invoked when driver has received data
output port drvRcv: Drv.ByteStreamRecv
@ Port invoked to send data out the driver
guarded input port drvSend: Drv.ByteStreamSend

@ Port invoked to send data out the driver
guarded input port drvSend: Drv.ByteStreamSend
# @ Buffer return input port
# async input port bufferReturn: Fw.BufferSend
# @ Receives raw data from a ByteStreamDriver, ComStub, or other buffer producing component
# guarded input port dataIn: Drv.ByteStreamRecv
# Loopback output
# @ Port invoked when driver has received data
# output port $recv: Drv.ByteStreamRecv
# @ Port invoked to send data out the driver
# guarded input port $send: Drv.ByteStreamSend
# output port allocate: Fw.BufferGet
output port bufferDeallocate: Fw.BufferSend

# @ Buffer return input port
# async input port bufferReturn: Fw.BufferSend
@ Simple command received interface
async command PING

# @ Receives raw data from a ByteStreamDriver, ComStub, or other buffer producing component
# guarded input port dataIn: Drv.ByteStreamRecv
@ Simple command received interface
# async command LONG_MESSAGE(str1: string)
async command MESSAGE(
str1: string size 50
)

# Loopback output
# @ Port invoked when driver has received data
# output port $recv: Drv.ByteStreamRecv
}

# @ Port invoked to send data out the driver
# guarded input port $send: Drv.ByteStreamSend

# output port allocate: Fw.BufferGet
output port bufferDeallocate: Fw.BufferSend

@ Simple command received interface
async command PING

@ Simple command received interface
async command MESSAGE(str1: string size 50)
# async command LONG_MESSAGE(str1: string)
}
}
2 changes: 1 addition & 1 deletion FlightComputer/CCSDSTester/CCSDSTester.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CCSDSTester : public CCSDSTesterComponentBase {
Fw::Success &condition //!< Condition success/failure
);

Drv::SendStatus drvSend_handler(FwIndexType, Fw::Buffer&);
Drv::SendStatus drvSend_handler(FwIndexType, Fw::Buffer &);

// Commands
void PING_cmdHandler(const FwOpcodeType opCode, const U32 cmdSeq);
Expand Down
16 changes: 8 additions & 8 deletions FlightComputer/Common/Common.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#ifndef COMMON_H_
#define COMMON_H_

#define FW_CHECK(cond, err_string, ...) \
do { \
if (!(cond)) { \
Fw::Logger::log(err_string); \
__VA_ARGS__; \
break; \
} \
} while(0);
#define FW_CHECK(cond, err_string, ...) \
do { \
if (!(cond)) { \
Fw::Logger::log(err_string); \
__VA_ARGS__; \
break; \
} \
} while (0);

#endif // COMMON_H_
Loading

0 comments on commit 4b61454

Please sign in to comment.