Release v1.2.0 #47
@ -433,12 +433,6 @@ void ObjectFactory::produce(){
|
|||||||
gpioCookie->addGpio(gpioIds::TEST_ID_0, gpioConfigMio0);
|
gpioCookie->addGpio(gpioIds::TEST_ID_0, gpioConfigMio0);
|
||||||
new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie);
|
new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie);
|
||||||
#elif TE0720 == 1
|
#elif TE0720 == 1
|
||||||
/* Configuration for MIO0 on TE0720-03-1CFA */
|
|
||||||
GpiodRegular* heaterGpio = new GpiodRegular(std::string("gpiochip0"), 0, std::string("MIO0"), gpio::IN, 0);
|
|
||||||
GpioCookie* gpioCookie = new GpioCookie;
|
|
||||||
gpioCookie->addGpio(gpioIds::HEATER_0, heaterGpio);
|
|
||||||
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER,
|
|
||||||
pcduSwitches::TCS_BOARD_8V_HEATER_IN);
|
|
||||||
|
|
||||||
UartCookie* plocUartCookie = new UartCookie(std::string("/dev/ttyPS1"), 115200,
|
UartCookie* plocUartCookie = new UartCookie(std::string("/dev/ttyPS1"), 115200,
|
||||||
PLOC::MAX_REPLY_SIZE);
|
PLOC::MAX_REPLY_SIZE);
|
||||||
@ -448,6 +442,15 @@ void ObjectFactory::produce(){
|
|||||||
plocHandler->setStartUpImmediately();
|
plocHandler->setStartUpImmediately();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TE0720 == 1 && TE0720_HEATER_TEST == 1
|
||||||
|
/* Configuration for MIO0 on TE0720-03-1CFA */
|
||||||
|
GpiodRegular* heaterGpio = new GpiodRegular(std::string("gpiochip0"), 0, std::string("MIO0"), gpio::IN, 0);
|
||||||
|
GpioCookie* gpioCookie = new GpioCookie;
|
||||||
|
gpioCookie->addGpio(gpioIds::HEATER_0, heaterGpio);
|
||||||
|
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER,
|
||||||
|
pcduSwitches::TCS_BOARD_8V_HEATER_IN);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if Q7S_ADD_SPI_TEST == 1
|
#if Q7S_ADD_SPI_TEST == 1
|
||||||
new SpiTestClass(objects::SPI_TEST, gpioComIF);
|
new SpiTestClass(objects::SPI_TEST, gpioComIF);
|
||||||
#endif
|
#endif
|
||||||
|
@ -21,7 +21,8 @@ debugging. */
|
|||||||
#define OBSW_ADD_TEST_CODE 1
|
#define OBSW_ADD_TEST_CODE 1
|
||||||
#define TEST_LIBGPIOD 0
|
#define TEST_LIBGPIOD 0
|
||||||
|
|
||||||
#define TE0720 0
|
#define TE0720 1
|
||||||
|
#define TE0720_HEATER_TEST 0
|
||||||
|
|
||||||
#define P60DOCK_DEBUG 0
|
#define P60DOCK_DEBUG 0
|
||||||
#define PDU1_DEBUG 0
|
#define PDU1_DEBUG 0
|
||||||
|
@ -156,6 +156,7 @@ ReturnValue_t PlocHandler::prepareTcMemWriteCommand(const uint8_t * commandData,
|
|||||||
| *(commandData + 2) << 8 | *(commandData + 3);
|
| *(commandData + 2) << 8 | *(commandData + 3);
|
||||||
const uint32_t memoryData = *(commandData + 4) << 24 | *(commandData + 5) << 16
|
const uint32_t memoryData = *(commandData + 4) << 24 | *(commandData + 5) << 16
|
||||||
| *(commandData + 6) << 8 | *(commandData + 7);
|
| *(commandData + 6) << 8 | *(commandData + 7);
|
||||||
|
packetSequenceCount = (packetSequenceCount + 1) & PACKET_SEQUENCE_COUNT_MASK;
|
||||||
PLOC::TcMemWrite tcMemWrite(memoryAddress, memoryData, packetSequenceCount);
|
PLOC::TcMemWrite tcMemWrite(memoryAddress, memoryData, packetSequenceCount);
|
||||||
if (tcMemWrite.getFullSize() > PLOC::MAX_COMMAND_SIZE) {
|
if (tcMemWrite.getFullSize() > PLOC::MAX_COMMAND_SIZE) {
|
||||||
sif::debug << "PlocHandler::prepareTcMemWriteCommand: Command too big" << std::endl;
|
sif::debug << "PlocHandler::prepareTcMemWriteCommand: Command too big" << std::endl;
|
||||||
@ -172,6 +173,7 @@ ReturnValue_t PlocHandler::prepareTcMemReadCommand(const uint8_t * commandData,
|
|||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
const uint32_t memoryAddress = *(commandData) << 24 | *(commandData + 1) << 16
|
const uint32_t memoryAddress = *(commandData) << 24 | *(commandData + 1) << 16
|
||||||
| *(commandData + 2) << 8 | *(commandData + 3);
|
| *(commandData + 2) << 8 | *(commandData + 3);
|
||||||
|
packetSequenceCount = (packetSequenceCount + 1) & PACKET_SEQUENCE_COUNT_MASK;
|
||||||
PLOC::TcMemRead tcMemRead(memoryAddress, packetSequenceCount);
|
PLOC::TcMemRead tcMemRead(memoryAddress, packetSequenceCount);
|
||||||
if (tcMemRead.getFullSize() > PLOC::MAX_COMMAND_SIZE) {
|
if (tcMemRead.getFullSize() > PLOC::MAX_COMMAND_SIZE) {
|
||||||
sif::debug << "PlocHandler::prepareTcMemReadCommand: Command too big" << std::endl;
|
sif::debug << "PlocHandler::prepareTcMemReadCommand: Command too big" << std::endl;
|
||||||
@ -482,14 +484,15 @@ void PlocHandler::disableExeReportReply() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocHandler::checkPacketSequenceCount(const uint8_t* data) {
|
ReturnValue_t PlocHandler::checkPacketSequenceCount(const uint8_t* data) {
|
||||||
uint16_t receivedSequenceCount = *(data + 2) << 8 | *(data + 3) & PACKET_SEQUENCE_COUNT_MASK;
|
uint16_t receivedSequenceCount = (*(data + 2) << 8 | *(data + 3)) & PACKET_SEQUENCE_COUNT_MASK;
|
||||||
if (receivedSequenceCount != ((packetSequenceCount + 1) & PACKET_SEQUENCE_COUNT_MASK)) {
|
uint16_t expectedPacketSequenceCount = ((packetSequenceCount + 1) & PACKET_SEQUENCE_COUNT_MASK);
|
||||||
sif::debug << "PlocHandler::checkPacketSequenceCount: Packet sequence count mismatch"
|
if (receivedSequenceCount != expectedPacketSequenceCount) {
|
||||||
|
sif::debug
|
||||||
|
<< "PlocHandler::checkPacketSequenceCount: Packet sequence count mismatch. "
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
/** The packet sequence count is corrected here to match the sequence count of the PLOC */
|
sif::debug << "Received sequence count: " << receivedSequenceCount << ". OBSW sequence "
|
||||||
packetSequenceCount = (receivedSequenceCount + 1) & PACKET_SEQUENCE_COUNT_MASK;
|
<< "count: " << expectedPacketSequenceCount << std::endl;
|
||||||
return SUBSEQUENCE_COUNT_FAILURE;
|
|
||||||
}
|
}
|
||||||
packetSequenceCount = (packetSequenceCount + 1) & PACKET_SEQUENCE_COUNT_MASK;
|
packetSequenceCount = receivedSequenceCount;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
/**
|
/**
|
||||||
* @brief This is the device handler for the PLOC.
|
* @brief This is the device handler for the PLOC.
|
||||||
*
|
*
|
||||||
* @details The PLOC uses the space packet protocol for communication. On each command the PLOC
|
* @details The PLOC uses the space packet protocol for communication. To each command the PLOC
|
||||||
* answers at least with one acknowledgment and one execution report.
|
* answers with at least one acknowledgment and one execution report.
|
||||||
*
|
*
|
||||||
* @author J. Meier
|
* @author J. Meier
|
||||||
*/
|
*/
|
||||||
@ -53,7 +53,6 @@ private:
|
|||||||
static const ReturnValue_t RECEIVED_ACK_FAILURE = MAKE_RETURN_CODE(0xA1); //!> Received ACK failure reply from PLOC
|
static const ReturnValue_t RECEIVED_ACK_FAILURE = MAKE_RETURN_CODE(0xA1); //!> Received ACK failure reply from PLOC
|
||||||
static const ReturnValue_t RECEIVED_EXE_FAILURE = MAKE_RETURN_CODE(0xA2); //!> Received execution failure reply from PLOC
|
static const ReturnValue_t RECEIVED_EXE_FAILURE = MAKE_RETURN_CODE(0xA2); //!> Received execution failure reply from PLOC
|
||||||
static const ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(0xA3); //!> Received space packet with invalid APID from PLOC
|
static const ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(0xA3); //!> Received space packet with invalid APID from PLOC
|
||||||
static const ReturnValue_t SUBSEQUENCE_COUNT_FAILURE = MAKE_RETURN_CODE(0xA4); //!> The packet sequence count does not match the expected packet sequence count. There may be one packet lost.
|
|
||||||
|
|
||||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_HANDLER;
|
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_HANDLER;
|
||||||
|
|
||||||
@ -63,7 +62,7 @@ private:
|
|||||||
static const Event CRC_FAILURE_EVENT = MAKE_EVENT(4, severity::LOW); //!> PLOC reply has invalid crc
|
static const Event CRC_FAILURE_EVENT = MAKE_EVENT(4, severity::LOW); //!> PLOC reply has invalid crc
|
||||||
|
|
||||||
static const uint16_t APID_MASK = 0x7FF;
|
static const uint16_t APID_MASK = 0x7FF;
|
||||||
static const unit16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
|
static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
|
||||||
|
|
||||||
uint8_t commandBuffer[PLOC::MAX_COMMAND_SIZE];
|
uint8_t commandBuffer[PLOC::MAX_COMMAND_SIZE];
|
||||||
|
|
||||||
@ -184,14 +183,19 @@ private:
|
|||||||
void disableExeReportReply();
|
void disableExeReportReply();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function checks the subsequence count of a received space packet to detect
|
* @brief This function checks and increments the packet sequence count of a received space
|
||||||
* lost packets.
|
* packet.
|
||||||
*
|
*
|
||||||
* @param data Pointer to a space packet.
|
* @param data Pointer to a space packet.
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if successful, else SUBSEQUENCE_COUNT_FAILURE
|
* @return RETURN_OK if successful
|
||||||
|
*
|
||||||
|
* @details There should be never a case in which a wrong packet sequence count is received
|
||||||
|
* because the communication scheme between PLOC and OBC always follows a strict
|
||||||
|
* procedure. Thus this function mainly serves for debugging purposes to detected an
|
||||||
|
* invalid handling of the packet sequence count.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t checkSubsequenceCount(const uint8_t* data);
|
ReturnValue_t checkPacketSequenceCount(const uint8_t* data);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_DEVICES_PLOCHANDLER_H_ */
|
#endif /* MISSION_DEVICES_PLOCHANDLER_H_ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user