v1.6.0 #78
@ -802,7 +802,7 @@ void ObjectFactory::createTestComponents() {
|
||||
radSensor->setStartUpImmediately();
|
||||
#endif
|
||||
|
||||
#if BOARD_TE0720 == 1 && TEST_PLOC_HANDLER == 1
|
||||
#if BOARD_TE0720 == 1 && ADD_PLOC_MPSOC == 1
|
||||
UartCookie* plocUartCookie = new UartCookie(std::string("/dev/ttyPS1"), 115200,
|
||||
PLOC_MPSOC::MAX_REPLY_SIZE);
|
||||
/* Testing PlocMPSoCHandler on TE0720-03-1CFA */
|
||||
@ -820,7 +820,7 @@ void ObjectFactory::createTestComponents() {
|
||||
pcduSwitches::TCS_BOARD_8V_HEATER_IN);
|
||||
#endif
|
||||
|
||||
#if TE0720 == 1 && ADD_PLOC_SUPERVISOR == 1
|
||||
#if BOARD_TE0720 == 1 && ADD_PLOC_SUPERVISOR == 1
|
||||
/* Configuration for MIO0 on TE0720-03-1CFA */
|
||||
UartCookie* plocSupervisorCookie = new UartCookie(objects::PLOC_SUPERVISOR_HANDLER,
|
||||
std::string("/dev/ttyPS1"), UartModes::NON_CANONICAL, 115200,
|
||||
|
@ -120,6 +120,10 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(
|
||||
prepareWatchdogsEnableCmd(commandData);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::WATCHDOGS_CONFIG_TIMEOUT): {
|
||||
result = prepareWatchdogsConfigTimeoutCmd(commandData);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sif::debug << "PlocSupervisorHandler::buildCommandFromCommand: Command not implemented"
|
||||
@ -152,6 +156,7 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
||||
this->insertInCommandMap(PLOC_SPV::GET_BOOT_STATUS_REPORT);
|
||||
this->insertInCommandMap(PLOC_SPV::UPDATE_AVAILABLE);
|
||||
this->insertInCommandMap(PLOC_SPV::WATCHDOGS_ENABLE);
|
||||
this->insertInCommandMap(PLOC_SPV::WATCHDOGS_CONFIG_TIMEOUT);
|
||||
this->insertInReplyMap(PLOC_SPV::ACK_REPORT, 3, nullptr, PLOC_SPV::SIZE_ACK_REPORT);
|
||||
this->insertInReplyMap(PLOC_SPV::EXE_REPORT, 3, nullptr, PLOC_SPV::SIZE_EXE_REPORT);
|
||||
this->insertInReplyMap(PLOC_SPV::HK_REPORT, 3, &hkset, PLOC_SPV::SIZE_HK_REPORT);
|
||||
@ -539,6 +544,7 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
|
||||
case PLOC_SPV::SET_TIME_REF:
|
||||
case PLOC_SPV::UPDATE_AVAILABLE:
|
||||
case PLOC_SPV::WATCHDOGS_ENABLE:
|
||||
case PLOC_SPV::WATCHDOGS_CONFIG_TIMEOUT:
|
||||
enabledReplies = 2;
|
||||
break;
|
||||
default:
|
||||
@ -728,6 +734,26 @@ void PlocSupervisorHandler::prepareWatchdogsEnableCmd(const uint8_t * commandDat
|
||||
nextReplyId = PLOC_SPV::ACK_REPORT;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::prepareWatchdogsConfigTimeoutCmd(const uint8_t * commandData) {
|
||||
uint8_t offset = 0;
|
||||
uint8_t watchdog = *(commandData + offset);
|
||||
offset += 1;
|
||||
if (watchdog > 2) {
|
||||
return INVALID_WATCHDOG;
|
||||
}
|
||||
uint32_t timeout = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16
|
||||
| *(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
||||
if (timeout < 1000 || timeout > 360000) {
|
||||
return INVALID_WATCHDOG_TIMEOUT;
|
||||
}
|
||||
PLOC_SPV::WatchdogsConfigTimeout packet(watchdog, timeout);
|
||||
memcpy(commandBuffer, packet.getWholeData(), packet.getFullSize());
|
||||
rawPacket = commandBuffer;
|
||||
rawPacketLen = packet.getFullSize();
|
||||
nextReplyId = PLOC_SPV::ACK_REPORT;
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::disableAllReplies() {
|
||||
|
||||
DeviceReplyMap::iterator iter;
|
||||
|
@ -63,6 +63,10 @@ private:
|
||||
static const ReturnValue_t GET_TIME_FAILURE = MAKE_RETURN_CODE(0xA4);
|
||||
//! [EXPORT] : [COMMENT] Invalid communication interface specified
|
||||
static const ReturnValue_t INVALID_UART_COM_IF = MAKE_RETURN_CODE(0xA5);
|
||||
//! [EXPORT] : [COMMENT] Received command with invalid watchdog parameter. Valid watchdogs are 0 for PS, 1 for PL and 2 for INT
|
||||
static const ReturnValue_t INVALID_WATCHDOG = MAKE_RETURN_CODE(0xA6);
|
||||
//! [EXPORT] : [COMMENT] Received watchdog timeout config command with invalid timeout. Valid timeouts must be in the range between 1000 and 360000 ms.
|
||||
static const ReturnValue_t INVALID_WATCHDOG_TIMEOUT = MAKE_RETURN_CODE(0xA6);
|
||||
|
||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_SUPERVISOR_HANDLER;
|
||||
|
||||
@ -205,6 +209,12 @@ private:
|
||||
*/
|
||||
void prepareWatchdogsEnableCmd(const uint8_t * commandData);
|
||||
|
||||
/**
|
||||
* @brief This function fills the command buffer with the packet to set the watchdog timer
|
||||
* of one of the three watchdogs (PS, PL, INT).
|
||||
*/
|
||||
ReturnValue_t prepareWatchdogsConfigTimeoutCmd(const uint8_t * commandData);
|
||||
|
||||
/**
|
||||
* @brief In case an acknowledgment failure reply has been received this function disables
|
||||
* all previously enabled commands and resets the exepected replies variable of an
|
||||
|
@ -24,6 +24,7 @@ static const DeviceCommandId_t GET_BOOT_STATUS_REPORT = 11;
|
||||
/** Notifies the supervisor that a new update is available for the MPSoC */
|
||||
static const DeviceCommandId_t UPDATE_AVAILABLE = 12;
|
||||
static const DeviceCommandId_t WATCHDOGS_ENABLE = 13;
|
||||
static const DeviceCommandId_t WATCHDOGS_CONFIG_TIMEOUT = 14;
|
||||
|
||||
/** Reply IDs */
|
||||
static const DeviceCommandId_t ACK_REPORT = 50;
|
||||
@ -492,6 +493,52 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class packages the command to set the timeout of one of the three watchdogs (PS,
|
||||
* PL, INT)
|
||||
*/
|
||||
class WatchdogsConfigTimeout: public SpacePacket {
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param watchdogPs Selects the watchdog to configure (0 - PS, 1 - PL, 2 - INT)
|
||||
* @param timeout The timeout to set
|
||||
*/
|
||||
WatchdogsConfigTimeout(uint8_t watchdog, uint32_t timeout) :
|
||||
SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_WTD_CONFIG_TIMEOUT,
|
||||
DEFAULT_SEQUENCE_COUNT), watchdog(watchdog), timeout(timeout) {
|
||||
initPacket();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static const uint16_t DATA_FIELD_LENGTH = 7;
|
||||
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
|
||||
|
||||
static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2;
|
||||
|
||||
uint8_t watchdog = 0;
|
||||
uint32_t timeout = 0;
|
||||
|
||||
void initPacket() {
|
||||
size_t serializedSize = 0;
|
||||
uint8_t* data_field_ptr = this->localData.fields.buffer;
|
||||
SerializeAdapter::serialize<uint8_t>(&watchdog, &data_field_ptr, &serializedSize,
|
||||
sizeof(watchdog), SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
SerializeAdapter::serialize<uint32_t>(&timeout, &data_field_ptr, &serializedSize,
|
||||
sizeof(timeout), SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
|
||||
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
|
||||
uint8_t* crcPos = this->localData.fields.buffer + CRC_OFFSET;
|
||||
SerializeAdapter::serialize<uint16_t>(&crc, &crcPos, &serializedSize, sizeof(crc),
|
||||
SerializeIF::Endianness::BIG);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This dataset stores the boot status report of the supervisor.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user