cam commands
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
This commit is contained in:
parent
23730349b0
commit
38ecb9e055
@ -255,7 +255,7 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
FixedTimeslotTaskIF* uartPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* uartPst = factory.createFixedTimeslotTask(
|
||||||
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1, missedDeadlineFunc);
|
||||||
result = pst::pstUart(uartPst);
|
result = pst::pstUart(uartPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||||
|
@ -82,7 +82,7 @@ void initmission::initTasks() {
|
|||||||
|
|
||||||
std::vector<PeriodicTaskIF*> pstTasks;
|
std::vector<PeriodicTaskIF*> pstTasks;
|
||||||
FixedTimeslotTaskIF* pst = factory->createFixedTimeslotTask(
|
FixedTimeslotTaskIF* pst = factory->createFixedTimeslotTask(
|
||||||
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
|
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
|
||||||
result = pst::pstUart(pst);
|
result = pst::pstUart(pst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
|
@ -44,16 +44,15 @@ void ObjectFactory::produce(void* args) {
|
|||||||
ObjectFactory::produceGenericObjects();
|
ObjectFactory::produceGenericObjects();
|
||||||
|
|
||||||
#if OBSW_ADD_PLOC_MPSOC == 1
|
#if OBSW_ADD_PLOC_MPSOC == 1
|
||||||
UartCookie* mpsocUartCookie =
|
UartCookie* mpsocUartCookie = new UartCookie(objects::PLOC_MPSOC_HANDLER, te0720_1cfa::MPSOC_UART,
|
||||||
new UartCookie(objects::PLOC_MPSOC_HANDLER, te0720_1cfa::MPSOC_UART, UartModes::NON_CANONICAL,
|
uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
|
||||||
uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
|
|
||||||
mpsocUartCookie->setNoFixedSizeReply();
|
mpsocUartCookie->setNoFixedSizeReply();
|
||||||
PlocMPSoCHelper* plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
|
PlocMPSoCHelper* plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
|
||||||
new UartComIF(objects::UART_COM_IF);
|
new UartComIF(objects::UART_COM_IF);
|
||||||
auto dummyGpioIF = new DummyGpioIF();
|
auto dummyGpioIF = new DummyGpioIF();
|
||||||
PlocMPSoCHandler* plocMPSoCHandler =
|
PlocMPSoCHandler* plocMPSoCHandler = new PlocMPSoCHandler(
|
||||||
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocUartCookie,
|
objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocUartCookie, plocMpsocHelper,
|
||||||
plocMpsocHelper, Gpio(gpioIds::ENABLE_MPSOC_UART, dummyGpioIF));
|
Gpio(gpioIds::ENABLE_MPSOC_UART, dummyGpioIF), objects::PLOC_SUPERVISOR_HANDLER);
|
||||||
plocMPSoCHandler->setStartUpImmediately();
|
plocMPSoCHandler->setStartUpImmediately();
|
||||||
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
|
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -26,6 +26,9 @@ static const DeviceCommandId_t TC_REPLAY_WRITE_SEQUENCE = 13;
|
|||||||
static const DeviceCommandId_t TC_DOWNLINK_PWR_ON = 14;
|
static const DeviceCommandId_t TC_DOWNLINK_PWR_ON = 14;
|
||||||
static const DeviceCommandId_t TC_DOWNLINK_PWR_OFF = 15;
|
static const DeviceCommandId_t TC_DOWNLINK_PWR_OFF = 15;
|
||||||
static const DeviceCommandId_t TC_MODE_REPLAY = 16;
|
static const DeviceCommandId_t TC_MODE_REPLAY = 16;
|
||||||
|
static const DeviceCommandId_t TC_CAM_CMD_SEND = 17;
|
||||||
|
static const DeviceCommandId_t TC_MODE_IDLE = 18;
|
||||||
|
static const DeviceCommandId_t TM_CAM_CMD_RPT = 19;
|
||||||
|
|
||||||
// Will reset the sequence count of the OBSW
|
// Will reset the sequence count of the OBSW
|
||||||
static const DeviceCommandId_t OBSW_RESET_SEQ_COUNT = 50;
|
static const DeviceCommandId_t OBSW_RESET_SEQ_COUNT = 50;
|
||||||
@ -33,6 +36,7 @@ static const DeviceCommandId_t OBSW_RESET_SEQ_COUNT = 50;
|
|||||||
static const uint16_t SIZE_ACK_REPORT = 14;
|
static const uint16_t SIZE_ACK_REPORT = 14;
|
||||||
static const uint16_t SIZE_EXE_REPORT = 14;
|
static const uint16_t SIZE_EXE_REPORT = 14;
|
||||||
static const uint16_t SIZE_TM_MEM_READ_REPORT = 18;
|
static const uint16_t SIZE_TM_MEM_READ_REPORT = 18;
|
||||||
|
static const uint16_t SIZE_TM_CAM_CMD_RPT = 18;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SpacePacket apids of PLOC telecommands and telemetry.
|
* SpacePacket apids of PLOC telecommands and telemetry.
|
||||||
@ -49,18 +53,23 @@ static const uint16_t TC_FLASHFOPEN = 0x119;
|
|||||||
static const uint16_t TC_FLASHFCLOSE = 0x11A;
|
static const uint16_t TC_FLASHFCLOSE = 0x11A;
|
||||||
static const uint16_t TC_FLASHDELETE = 0x11C;
|
static const uint16_t TC_FLASHDELETE = 0x11C;
|
||||||
static const uint16_t TC_MODE_REPLAY = 0x11F;
|
static const uint16_t TC_MODE_REPLAY = 0x11F;
|
||||||
|
static const uint16_t TC_MODE_IDLE = 0x11E;
|
||||||
static const uint16_t TC_DOWNLINK_PWR_OFF = 0x124;
|
static const uint16_t TC_DOWNLINK_PWR_OFF = 0x124;
|
||||||
|
static const uint16_t TC_CAM_CMD_SEND = 0x12C;
|
||||||
static const uint16_t TM_MEMORY_READ_REPORT = 0x404;
|
static const uint16_t TM_MEMORY_READ_REPORT = 0x404;
|
||||||
static const uint16_t ACK_SUCCESS = 0x400;
|
static const uint16_t ACK_SUCCESS = 0x400;
|
||||||
static const uint16_t ACK_FAILURE = 0x401;
|
static const uint16_t ACK_FAILURE = 0x401;
|
||||||
static const uint16_t EXE_SUCCESS = 0x402;
|
static const uint16_t EXE_SUCCESS = 0x402;
|
||||||
static const uint16_t EXE_FAILURE = 0x403;
|
static const uint16_t EXE_FAILURE = 0x403;
|
||||||
|
static const uint16_t TM_CAM_CMD_RPT = 0x407;
|
||||||
} // namespace apid
|
} // namespace apid
|
||||||
|
|
||||||
/** Offset from first byte in space packet to first byte of data field */
|
/** Offset from first byte in space packet to first byte of data field */
|
||||||
static const uint8_t DATA_FIELD_OFFSET = 6;
|
static const uint8_t DATA_FIELD_OFFSET = 6;
|
||||||
static const size_t MEM_READ_RPT_LEN_OFFSET = 10;
|
static const size_t MEM_READ_RPT_LEN_OFFSET = 10;
|
||||||
static const char NULL_TERMINATOR = '\0';
|
static const char NULL_TERMINATOR = '\0';
|
||||||
|
static const uint8_t MIN_SPACE_PACKET_LENGTH = 7;
|
||||||
|
static const uint8_t SPACE_PACKET_HEADER_SIZE = 6;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The size of payload data which will be forwarded to the requesting object. e.g. PUS Service
|
* The size of payload data which will be forwarded to the requesting object. e.g. PUS Service
|
||||||
@ -117,11 +126,11 @@ class TcBase : public SpacePacket, public MPSoCReturnValuesIF {
|
|||||||
virtual ReturnValue_t createPacket(const uint8_t* commandData, size_t commandDataLen) {
|
virtual ReturnValue_t createPacket(const uint8_t* commandData, size_t commandDataLen) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
result = initPacket(commandData, commandDataLen);
|
result = initPacket(commandData, commandDataLen);
|
||||||
if (result != HasReturnvaluesIF::HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = addCrc();
|
result = addCrc();
|
||||||
if (result != HasReturnvaluesIF::HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -615,6 +624,45 @@ class TcModeReplay : public TcBase {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Class to build mode idle command
|
||||||
|
*/
|
||||||
|
class TcModeIdle : public TcBase {
|
||||||
|
public:
|
||||||
|
TcModeIdle(uint16_t sequenceCount) : TcBase(apid::TC_MODE_IDLE, sequenceCount) {}
|
||||||
|
|
||||||
|
ReturnValue_t createPacket() {
|
||||||
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
result = addCrc();
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
this->setPacketDataLength(static_cast<uint16_t>(CRC_SIZE - 1));
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class TcCamcmdSend : public TcBase {
|
||||||
|
public:
|
||||||
|
TcCamcmdSend(uint16_t sequenceCount) : TcBase(apid::TC_CAM_CMD_SEND, sequenceCount) {}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
|
||||||
|
if (commandDataLen > MAX_DATA_LENGTH) {
|
||||||
|
return INVALID_LENGTH;
|
||||||
|
}
|
||||||
|
std::memcpy(this->getPacketData(), commandData, commandDataLen);
|
||||||
|
*(this->getPacketData() + commandDataLen) = CARRIAGE_RETURN;
|
||||||
|
uint16_t trueLength = commandDataLen + sizeof(CARRIAGE_RETURN) + CRC_SIZE;
|
||||||
|
this->setPacketDataLength(trueLength - 1);
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
static const uint8_t MAX_DATA_LENGTH = 10;
|
||||||
|
static const uint8_t CARRIAGE_RETURN = 0xD;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace mpsoc
|
} // namespace mpsoc
|
||||||
|
|
||||||
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ */
|
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ */
|
||||||
|
@ -133,6 +133,7 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlocMPSoCHandler::doStartUp() {
|
void PlocMPSoCHandler::doStartUp() {
|
||||||
|
#ifdef XIPHOS_Q7S
|
||||||
switch (powerState) {
|
switch (powerState) {
|
||||||
case PowerState::OFF:
|
case PowerState::OFF:
|
||||||
commandActionHelper.commandAction(supervisorHandler, supv::START_MPSOC);
|
commandActionHelper.commandAction(supervisorHandler, supv::START_MPSOC);
|
||||||
@ -145,6 +146,9 @@ void PlocMPSoCHandler::doStartUp() {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
setMode(_MODE_TO_ON);
|
||||||
|
#endif /* XIPHOS_Q7S */
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocMPSoCHandler::doShutDown() {
|
void PlocMPSoCHandler::doShutDown() {
|
||||||
@ -211,6 +215,14 @@ ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t device
|
|||||||
result = prepareTcModeReplay();
|
result = prepareTcModeReplay();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case (mpsoc::TC_MODE_IDLE): {
|
||||||
|
result = prepareTcModeIdle();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (mpsoc::TC_CAM_CMD_SEND): {
|
||||||
|
result = prepareTcCamCmdSend(commandData, commandDataLen);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
sif::debug << "PlocMPSoCHandler::buildCommandFromCommand: Command not implemented"
|
sif::debug << "PlocMPSoCHandler::buildCommandFromCommand: Command not implemented"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -238,16 +250,45 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() {
|
|||||||
this->insertInCommandMap(mpsoc::TC_DOWNLINK_PWR_OFF);
|
this->insertInCommandMap(mpsoc::TC_DOWNLINK_PWR_OFF);
|
||||||
this->insertInCommandMap(mpsoc::TC_REPLAY_WRITE_SEQUENCE);
|
this->insertInCommandMap(mpsoc::TC_REPLAY_WRITE_SEQUENCE);
|
||||||
this->insertInCommandMap(mpsoc::TC_MODE_REPLAY);
|
this->insertInCommandMap(mpsoc::TC_MODE_REPLAY);
|
||||||
this->insertInReplyMap(mpsoc::ACK_REPORT, 1, nullptr, mpsoc::SIZE_ACK_REPORT);
|
this->insertInCommandMap(mpsoc::TC_MODE_IDLE);
|
||||||
|
this->insertInCommandMap(mpsoc::TC_CAM_CMD_SEND);
|
||||||
|
this->insertInReplyMap(mpsoc::ACK_REPORT, 3, nullptr, mpsoc::SIZE_ACK_REPORT);
|
||||||
this->insertInReplyMap(mpsoc::EXE_REPORT, 3, nullptr, mpsoc::SIZE_EXE_REPORT);
|
this->insertInReplyMap(mpsoc::EXE_REPORT, 3, nullptr, mpsoc::SIZE_EXE_REPORT);
|
||||||
this->insertInReplyMap(mpsoc::TM_MEMORY_READ_REPORT, 2, nullptr, mpsoc::SIZE_TM_MEM_READ_REPORT);
|
this->insertInReplyMap(mpsoc::TM_MEMORY_READ_REPORT, 2, nullptr, mpsoc::SIZE_TM_MEM_READ_REPORT);
|
||||||
|
this->insertInReplyMap(mpsoc::TM_CAM_CMD_RPT, 2, nullptr, SpacePacket::PACKET_MAX_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
||||||
DeviceCommandId_t* foundId, size_t* foundLen) {
|
DeviceCommandId_t* foundId, size_t* foundLen) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
uint16_t apid = (*(start) << 8 | *(start + 1)) & APID_MASK;
|
SpacePacket spacePacket;
|
||||||
|
std::memcpy(spacePacket.getWholeData(), start, remainingSize);
|
||||||
|
|
||||||
|
// if (tmBuffer.length + remainingSize < SpacePacket::PACKET_MAX_SIZE) {
|
||||||
|
// std::memcpy(tmBuffer, start, remainingSize);
|
||||||
|
// tmBuffer.length += remainingSize;
|
||||||
|
// *foundLen = remainingSize;
|
||||||
|
// } else {
|
||||||
|
// std::memcpy(tmBuffer, start, remainingSize - (SpacePacket::PACKET_MAX_SIZE - tmBuffer.length));
|
||||||
|
// tmBuffer.length += (remainingSize - (SpacePacket::PACKET_MAX_SIZE - tmBuffer.length));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (remainingSize < mpsoc::MIN_SPACE_PACKET_LENGTH) {
|
||||||
|
// std::memcpy(tmBuffer, start + tmBuffer.length, remainingSize);
|
||||||
|
// tmBuffer.length += remainingSize;
|
||||||
|
// return IGNORE_REPLY_DATA;
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// spacePacket.addWholeData(start, remainingSize);
|
||||||
|
// if (spacePacket.getPacketDataLength() + 1 != remainingSize - mpsoc::SPACE_PACKET_HEADER_SIZE) {
|
||||||
|
// std::memcpy(tmBuffer, start + tmBuffer.length, remainingSize);
|
||||||
|
// tmBuffer.length += remainingSize;
|
||||||
|
// return IGNORE_REPLY_DATA;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
uint16_t apid = spacePacket.getAPID();
|
||||||
|
|
||||||
switch (apid) {
|
switch (apid) {
|
||||||
case (mpsoc::apid::ACK_SUCCESS):
|
case (mpsoc::apid::ACK_SUCCESS):
|
||||||
@ -262,6 +303,11 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
|
|||||||
*foundLen = tmMemReadReport.rememberRequestedSize;
|
*foundLen = tmMemReadReport.rememberRequestedSize;
|
||||||
*foundId = mpsoc::TM_MEMORY_READ_REPORT;
|
*foundId = mpsoc::TM_MEMORY_READ_REPORT;
|
||||||
break;
|
break;
|
||||||
|
case (mpsoc::apid::TM_CAM_CMD_RPT):
|
||||||
|
*foundLen = spacePacket.getFullSize();
|
||||||
|
tmCamCmdRpt.rememberSpacePacketSize = *foundLen;
|
||||||
|
*foundId = mpsoc::TM_CAM_CMD_RPT;
|
||||||
|
break;
|
||||||
case (mpsoc::apid::EXE_SUCCESS):
|
case (mpsoc::apid::EXE_SUCCESS):
|
||||||
*foundLen = mpsoc::SIZE_EXE_REPORT;
|
*foundLen = mpsoc::SIZE_EXE_REPORT;
|
||||||
*foundId = mpsoc::EXE_REPORT;
|
*foundId = mpsoc::EXE_REPORT;
|
||||||
@ -276,6 +322,7 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
|
|||||||
return MPSoCReturnValuesIF::INVALID_APID;
|
return MPSoCReturnValuesIF::INVALID_APID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
uint16_t recvSeqCnt = (*(start + 2) << 8 | *(start + 3)) & PACKET_SEQUENCE_COUNT_MASK;
|
uint16_t recvSeqCnt = (*(start + 2) << 8 | *(start + 3)) & PACKET_SEQUENCE_COUNT_MASK;
|
||||||
if (recvSeqCnt != sequenceCount) {
|
if (recvSeqCnt != sequenceCount) {
|
||||||
@ -297,6 +344,10 @@ ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const
|
|||||||
result = handleMemoryReadReport(packet);
|
result = handleMemoryReadReport(packet);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case (mpsoc::TM_CAM_CMD_RPT): {
|
||||||
|
result = handleCamCmdRpt(packet);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case (mpsoc::EXE_REPORT): {
|
case (mpsoc::EXE_REPORT): {
|
||||||
result = handleExecutionReport(packet);
|
result = handleExecutionReport(packet);
|
||||||
break;
|
break;
|
||||||
@ -463,6 +514,37 @@ ReturnValue_t PlocMPSoCHandler::prepareTcModeReplay() {
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t PlocMPSoCHandler::prepareTcModeIdle() {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
sequenceCount++;
|
||||||
|
mpsoc::TcModeIdle tcModeIdle(sequenceCount);
|
||||||
|
result = tcModeIdle.createPacket();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sequenceCount--;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
memcpy(commandBuffer, tcModeIdle.getWholeData(), tcModeIdle.getFullSize());
|
||||||
|
rawPacket = commandBuffer;
|
||||||
|
rawPacketLen = tcModeIdle.getFullSize();
|
||||||
|
nextReplyId = mpsoc::ACK_REPORT;
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t PlocMPSoCHandler::prepareTcCamCmdSend(const uint8_t* commandData,
|
||||||
|
size_t commandDataLen) {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
sequenceCount++;
|
||||||
|
mpsoc::TcCamcmdSend tcCamCmdSend(sequenceCount);
|
||||||
|
result = tcCamCmdSend.createPacket(commandData, commandDataLen);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sequenceCount--;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
copyToCommandBuffer(&tcCamCmdSend);
|
||||||
|
nextReplyId = mpsoc::TM_CAM_CMD_RPT;
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
void PlocMPSoCHandler::copyToCommandBuffer(mpsoc::TcBase* tc) {
|
void PlocMPSoCHandler::copyToCommandBuffer(mpsoc::TcBase* tc) {
|
||||||
if (tc == nullptr) {
|
if (tc == nullptr) {
|
||||||
sif::debug << "PlocMPSoCHandler::copyToCommandBuffer: Invalid TC" << std::endl;
|
sif::debug << "PlocMPSoCHandler::copyToCommandBuffer: Invalid TC" << std::endl;
|
||||||
@ -586,6 +668,25 @@ ReturnValue_t PlocMPSoCHandler::handleMemoryReadReport(const uint8_t* data) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
SpacePacket packet;
|
||||||
|
std::memcpy(packet.getWholeData(), data, tmCamCmdRpt.rememberSpacePacketSize);
|
||||||
|
result = verifyPacket(data, tmCamCmdRpt.rememberSpacePacketSize);
|
||||||
|
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
|
||||||
|
sif::warning << "PlocMPSoCHandler::handleCamCmdRpt: CRC failure" << std::endl;
|
||||||
|
}
|
||||||
|
const uint8_t* dataFieldPtr = data + mpsoc::SPACE_PACKET_HEADER_SIZE;
|
||||||
|
std::string camCmdRptMsg(reinterpret_cast<const char*>(
|
||||||
|
dataFieldPtr), tmCamCmdRpt.rememberSpacePacketSize - mpsoc::SPACE_PACKET_HEADER_SIZE - 3);
|
||||||
|
uint8_t ackValue = *(packet.getPacketData() + packet.getPacketDataLength() - 2);
|
||||||
|
sif::info << "CamCmdRpt message: " << camCmdRptMsg << std::endl;
|
||||||
|
sif::info << "CamCmdRpt Ack value: 0x" << std::hex << static_cast<unsigned int>(ackValue)
|
||||||
|
<< std::endl;
|
||||||
|
handleDeviceTM(packet.getPacketData(), packet.getPacketDataLength() - 1, mpsoc::TM_CAM_CMD_RPT);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator command,
|
ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator command,
|
||||||
uint8_t expectedReplies, bool useAlternateId,
|
uint8_t expectedReplies, bool useAlternateId,
|
||||||
DeviceCommandId_t alternateReplyID) {
|
DeviceCommandId_t alternateReplyID) {
|
||||||
@ -602,6 +703,7 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
|
|||||||
case mpsoc::TC_DOWNLINK_PWR_OFF:
|
case mpsoc::TC_DOWNLINK_PWR_OFF:
|
||||||
case mpsoc::TC_REPLAY_WRITE_SEQUENCE:
|
case mpsoc::TC_REPLAY_WRITE_SEQUENCE:
|
||||||
case mpsoc::TC_MODE_REPLAY:
|
case mpsoc::TC_MODE_REPLAY:
|
||||||
|
case mpsoc::TC_MODE_IDLE:
|
||||||
enabledReplies = 2;
|
enabledReplies = 2;
|
||||||
break;
|
break;
|
||||||
case mpsoc::TC_MEM_READ: {
|
case mpsoc::TC_MEM_READ: {
|
||||||
@ -611,6 +713,18 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
|
|||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id "
|
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id "
|
||||||
<< mpsoc::TM_MEMORY_READ_REPORT << " not in replyMap" << std::endl;
|
<< mpsoc::TM_MEMORY_READ_REPORT << " not in replyMap" << std::endl;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case mpsoc::TC_CAM_CMD_SEND: {
|
||||||
|
enabledReplies = 3;
|
||||||
|
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
||||||
|
mpsoc::TM_CAM_CMD_RPT);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id "
|
||||||
|
<< mpsoc::TM_CAM_CMD_RPT << " not in replyMap" << std::endl;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -690,6 +804,10 @@ size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId) {
|
|||||||
replyLen = tmMemReadReport.rememberRequestedSize;
|
replyLen = tmMemReadReport.rememberRequestedSize;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case mpsoc::TM_CAM_CMD_RPT:
|
||||||
|
// Read ACK, TM and EXE report in one go
|
||||||
|
replyLen = SpacePacket::PACKET_MAX_SIZE;
|
||||||
|
break;
|
||||||
default: {
|
default: {
|
||||||
replyLen = iter->second.replyLen;
|
replyLen = iter->second.replyLen;
|
||||||
break;
|
break;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "PlocMPSoCHelper.h"
|
#include "PlocMPSoCHelper.h"
|
||||||
|
#include "fsfw/tmtcpacket/SpacePacket.h"
|
||||||
#include "fsfw/action/CommandActionHelper.h"
|
#include "fsfw/action/CommandActionHelper.h"
|
||||||
#include "fsfw/action/CommandsActionsIF.h"
|
#include "fsfw/action/CommandsActionsIF.h"
|
||||||
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
||||||
@ -126,14 +127,26 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
|
|||||||
// Used to block incoming commands when MPSoC helper class is currently executing a command
|
// Used to block incoming commands when MPSoC helper class is currently executing a command
|
||||||
bool plocMPSoCHelperExecuting = false;
|
bool plocMPSoCHelperExecuting = false;
|
||||||
|
|
||||||
class TmMemReadReport {
|
struct TmMemReadReport {
|
||||||
public:
|
|
||||||
static const uint8_t FIX_SIZE = 14;
|
static const uint8_t FIX_SIZE = 14;
|
||||||
size_t rememberRequestedSize = 0;
|
size_t rememberRequestedSize = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
TmMemReadReport tmMemReadReport;
|
TmMemReadReport tmMemReadReport;
|
||||||
|
|
||||||
|
struct TmCamCmdRpt {
|
||||||
|
size_t rememberSpacePacketSize = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
TmCamCmdRpt tmCamCmdRpt;
|
||||||
|
|
||||||
|
struct TelemetryBuffer {
|
||||||
|
uint16_t length = 0;
|
||||||
|
uint8_t buffer[SpacePacket::PACKET_MAX_SIZE];
|
||||||
|
};
|
||||||
|
|
||||||
|
TelemetryBuffer tmBuffer;
|
||||||
|
|
||||||
enum class PowerState { OFF, BOOTING, SHUTDOWN, ON };
|
enum class PowerState { OFF, BOOTING, SHUTDOWN, ON };
|
||||||
|
|
||||||
PowerState powerState = PowerState::OFF;
|
PowerState powerState = PowerState::OFF;
|
||||||
@ -151,7 +164,8 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
|
|||||||
ReturnValue_t prepareTcDownlinkPwrOn(const uint8_t* commandData, size_t commandDataLen);
|
ReturnValue_t prepareTcDownlinkPwrOn(const uint8_t* commandData, size_t commandDataLen);
|
||||||
ReturnValue_t prepareTcDownlinkPwrOff();
|
ReturnValue_t prepareTcDownlinkPwrOff();
|
||||||
ReturnValue_t prepareTcReplayWriteSequence(const uint8_t* commandData, size_t commandDataLen);
|
ReturnValue_t prepareTcReplayWriteSequence(const uint8_t* commandData, size_t commandDataLen);
|
||||||
|
ReturnValue_t prepareTcCamCmdSend(const uint8_t* commandData, size_t commandDataLen);
|
||||||
|
ReturnValue_t prepareTcModeIdle();
|
||||||
/**
|
/**
|
||||||
* @brief Copies space packet into command buffer
|
* @brief Copies space packet into command buffer
|
||||||
*/
|
*/
|
||||||
@ -194,6 +208,8 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
|
|||||||
*/
|
*/
|
||||||
ReturnValue_t handleMemoryReadReport(const uint8_t* data);
|
ReturnValue_t handleMemoryReadReport(const uint8_t* data);
|
||||||
|
|
||||||
|
ReturnValue_t handleCamCmdRpt(const uint8_t* data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Depending on the current active command, this function sets the reply id of the
|
* @brief Depending on the current active command, this function sets the reply id of the
|
||||||
* next reply after a successful acknowledgment report has been received. This is
|
* next reply after a successful acknowledgment report has been received. This is
|
||||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
|||||||
Subproject commit 8a30f669f075c284494d7c1c6618e42e2aec8f15
|
Subproject commit c7da0103e8169136f0ba18254d0eb50e6958ba82
|
Loading…
Reference in New Issue
Block a user