plocHandler wip
This commit is contained in:
parent
400f60c7be
commit
5d4c2bd521
@ -574,3 +574,9 @@ When using Eclipse, there are two special build variables in the project propert
|
|||||||
→ C/C++ Build → Build Variables called `Q7S_SYSROOT` or `RPI_SYSROOT`. You can set
|
→ C/C++ Build → Build Variables called `Q7S_SYSROOT` or `RPI_SYSROOT`. You can set
|
||||||
the sysroot path in those variables to get any additional includes like `gpiod.h` in the
|
the sysroot path in those variables to get any additional includes like `gpiod.h` in the
|
||||||
Eclipse indexer.
|
Eclipse indexer.
|
||||||
|
|
||||||
|
## Xilinx UARTLIE
|
||||||
|
Get info about ttyUL* devices
|
||||||
|
````
|
||||||
|
cat /proc/tty/driver
|
||||||
|
````
|
@ -321,7 +321,7 @@ void ObjectFactory::produce(){
|
|||||||
Max31865PT1000Handler* rtdIc16 = new Max31865PT1000Handler(objects::RTD_IC16, objects::SPI_COM_IF, spiRtdIc16, 0);
|
Max31865PT1000Handler* rtdIc16 = new Max31865PT1000Handler(objects::RTD_IC16, objects::SPI_COM_IF, spiRtdIc16, 0);
|
||||||
Max31865PT1000Handler* rtdIc17 = new Max31865PT1000Handler(objects::RTD_IC17, objects::SPI_COM_IF, spiRtdIc17, 0);
|
Max31865PT1000Handler* rtdIc17 = new Max31865PT1000Handler(objects::RTD_IC17, objects::SPI_COM_IF, spiRtdIc17, 0);
|
||||||
Max31865PT1000Handler* rtdIc18 = new Max31865PT1000Handler(objects::RTD_IC18, objects::SPI_COM_IF, spiRtdIc18, 0);
|
Max31865PT1000Handler* rtdIc18 = new Max31865PT1000Handler(objects::RTD_IC18, objects::SPI_COM_IF, spiRtdIc18, 0);
|
||||||
rtdIc10->setStartUpImmediately();
|
// rtdIc10->setStartUpImmediately();
|
||||||
// rtdIc4->setStartUpImmediately();
|
// rtdIc4->setStartUpImmediately();
|
||||||
|
|
||||||
I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE,
|
I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE,
|
||||||
@ -329,9 +329,8 @@ void ObjectFactory::produce(){
|
|||||||
IMTQHandler* imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie);
|
IMTQHandler* imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie);
|
||||||
imtqHandler->setStartUpImmediately();
|
imtqHandler->setStartUpImmediately();
|
||||||
|
|
||||||
UartCookie* plocUartCookie = new UartCookie(std::string("/dev/ttyPS1"), 115200,
|
UartCookie* plocUartCookie = new UartCookie(std::string("/dev/ttyUL3"), 115200,
|
||||||
PLOC::MAX_REPLY_SIZE);
|
PLOC::MAX_REPLY_SIZE);
|
||||||
/* Testing PlocHandler on TE0720-03-1CFA */
|
|
||||||
PlocHandler* plocHandler = new PlocHandler(objects::PLOC_HANDLER, objects::UART_COM_IF,
|
PlocHandler* plocHandler = new PlocHandler(objects::PLOC_HANDLER, objects::UART_COM_IF,
|
||||||
plocUartCookie);
|
plocUartCookie);
|
||||||
plocHandler->setStartUpImmediately();
|
plocHandler->setStartUpImmediately();
|
||||||
|
1
fsfw_hal
Submodule
1
fsfw_hal
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 14fe32572d62db9d19707dc1f9bb6fecb1993b73
|
@ -19,7 +19,7 @@ debugging. */
|
|||||||
#define OBSW_ADD_TEST_CODE 1
|
#define OBSW_ADD_TEST_CODE 1
|
||||||
#define TEST_LIBGPIOD 0
|
#define TEST_LIBGPIOD 0
|
||||||
|
|
||||||
#define TE0720 1
|
#define TE0720 0
|
||||||
|
|
||||||
#define P60DOCK_DEBUG 0
|
#define P60DOCK_DEBUG 0
|
||||||
#define PDU1_DEBUG 0
|
#define PDU1_DEBUG 0
|
||||||
|
@ -21,7 +21,8 @@ enum: uint8_t {
|
|||||||
MGM_RM3100,
|
MGM_RM3100,
|
||||||
PCDU_HANDLER,
|
PCDU_HANDLER,
|
||||||
HEATER_HANDLER,
|
HEATER_HANDLER,
|
||||||
SA_DEPL_HANDLER
|
SA_DEPL_HANDLER,
|
||||||
|
PLOC_HANDLER
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +68,7 @@ ReturnValue_t PlocHandler::buildCommandFromCommand(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlocHandler::fillCommandAndReplyMap() {
|
void PlocHandler::fillCommandAndReplyMap() {
|
||||||
|
this->insertInCommandAndReplyMap(PLOC::TC_MEM_WRITE, 1, nullptr, PLOC::SIZE_ACK_REPORT);
|
||||||
this->insertInCommandAndReplyMap(PLOC::TC_MEM_READ, 1, nullptr, PLOC::SIZE_ACK_REPORT);
|
this->insertInCommandAndReplyMap(PLOC::TC_MEM_READ, 1, nullptr, PLOC::SIZE_ACK_REPORT);
|
||||||
this->insertInReplyMap(PLOC::ACK_SUCCESS, 1);
|
this->insertInReplyMap(PLOC::ACK_SUCCESS, 1);
|
||||||
this->insertInReplyMap(PLOC::ACK_FAILURE, 1);
|
this->insertInReplyMap(PLOC::ACK_FAILURE, 1);
|
||||||
@ -78,7 +79,7 @@ ReturnValue_t PlocHandler::scanForReply(const uint8_t *start,
|
|||||||
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
*foundId = *(start) << 8 | *(start + 1) & APID_MASK;
|
*foundId = (*(start) << 8 | *(start + 1)) & APID_MASK;
|
||||||
|
|
||||||
switch(*foundId) {
|
switch(*foundId) {
|
||||||
case(PLOC::ACK_SUCCESS):
|
case(PLOC::ACK_SUCCESS):
|
||||||
@ -100,7 +101,7 @@ ReturnValue_t PlocHandler::scanForReply(const uint8_t *start,
|
|||||||
|
|
||||||
ReturnValue_t PlocHandler::verifyPacket(const uint8_t* start, size_t* foundLen) {
|
ReturnValue_t PlocHandler::verifyPacket(const uint8_t* start, size_t* foundLen) {
|
||||||
|
|
||||||
uint16_t receivedCrc = *(start + *foundLen - 2) << 8 | *(start + *foundlen - 1);
|
uint16_t receivedCrc = *(start + *foundLen - 2) << 8 | *(start + *foundLen - 1);
|
||||||
|
|
||||||
if (receivedCrc != CRC::crc16ccitt(start, *foundLen, 0)) {
|
if (receivedCrc != CRC::crc16ccitt(start, *foundLen, 0)) {
|
||||||
return CRC_FAILURE;
|
return CRC_FAILURE;
|
||||||
@ -112,8 +113,6 @@ ReturnValue_t PlocHandler::verifyPacket(const uint8_t* start, size_t* foundLen)
|
|||||||
ReturnValue_t PlocHandler::interpretDeviceReply(DeviceCommandId_t id,
|
ReturnValue_t PlocHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||||
const uint8_t *packet) {
|
const uint8_t *packet) {
|
||||||
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case (PLOC::ACK_SUCCESS):
|
case (PLOC::ACK_SUCCESS):
|
||||||
receiveTm();
|
receiveTm();
|
||||||
@ -133,7 +132,7 @@ ReturnValue_t PlocHandler::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocHandler::receiveTm() {
|
void PlocHandler::receiveTm() {
|
||||||
switch (rememberCommandId) {
|
switch (rememberCommandId) {
|
||||||
case (PLOC::TC_MEM_WRITE):
|
case (PLOC::TC_MEM_WRITE):
|
||||||
break;
|
break;
|
||||||
@ -154,8 +153,8 @@ void PlocHandler::receiveExecutionReport() {
|
|||||||
communicationInterface->requestReceiveMessage(comCookie, PLOC::SIZE_EXE_REPORT);
|
communicationInterface->requestReceiveMessage(comCookie, PLOC::SIZE_EXE_REPORT);
|
||||||
communicationInterface->readReceivedMessage(comCookie, &receivedData, &receivedDataLen);
|
communicationInterface->readReceivedMessage(comCookie, &receivedData, &receivedDataLen);
|
||||||
|
|
||||||
if(!verifyPacket(receivedData, receivedDataLen)) {
|
if(!verifyPacket(receivedData, &receivedDataLen)) {
|
||||||
replyRawData(data, len, defaultRawReceiver);
|
replyRawData(receivedData, receivedDataLen, defaultRawReceiver);
|
||||||
triggerEvent(EXE_RPT_INVALID_CRC);
|
triggerEvent(EXE_RPT_INVALID_CRC);
|
||||||
sif::error << "PlocHandler::receiveExecutionReport: Execution report has invalid crc"
|
sif::error << "PlocHandler::receiveExecutionReport: Execution report has invalid crc"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -167,7 +166,7 @@ void PlocHandler::receiveExecutionReport() {
|
|||||||
|
|
||||||
void PlocHandler::handleExecutionReport(const uint8_t* receivedData, size_t receivedDataLen) {
|
void PlocHandler::handleExecutionReport(const uint8_t* receivedData, size_t receivedDataLen) {
|
||||||
|
|
||||||
uint16_t apid = *(start) << 8 | *(start + 1) & APID_MASK;
|
uint16_t apid = (*(receivedData) << 8 | *(receivedData + 1)) & APID_MASK;
|
||||||
|
|
||||||
switch (apid) {
|
switch (apid) {
|
||||||
case (PLOC::APID_EXE_SUCCESS): {
|
case (PLOC::APID_EXE_SUCCESS): {
|
||||||
@ -205,15 +204,15 @@ void PlocHandler::receiveTmMemoryReadReport() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t apid = *(start) << 8 | *(start + 1) & APID_MASK;
|
uint16_t apid = (*(receivedData) << 8 | *(receivedData + 1)) & APID_MASK;
|
||||||
if (apid != PLOC::APID_TM_READ_REPORT) {
|
if (apid != PLOC::APID_TM_READ_REPORT) {
|
||||||
sif::error << "PlocHandler::receiveTmReadReport: Tm read report has invalid apid"
|
sif::error << "PlocHandler::receiveTmReadReport: Tm read report has invalid apid"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!verifyPacket(receivedData, receivedDataLen)) {
|
if(!verifyPacket(receivedData, &receivedDataLen)) {
|
||||||
replyRawData(data, len, defaultRawReceiver);
|
replyRawData(receivedData, receivedDataLen, defaultRawReceiver);
|
||||||
triggerEvent(TM_READ_RPT_INVALID_CRC);
|
triggerEvent(TM_READ_RPT_INVALID_CRC);
|
||||||
sif::error << "PlocHandler::receiveTmReadReport: TM read report has invalid crc"
|
sif::error << "PlocHandler::receiveTmReadReport: TM read report has invalid crc"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -239,7 +238,7 @@ void PlocHandler::handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCom
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = actionHelper.reportData(queueId, replyId, dataSet);
|
result = actionHelper.reportData(queueId, replyId, data, dataSize);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::debug << "PlocHandler::handleDeviceTM: Failed to report data" << std::endl;
|
sif::debug << "PlocHandler::handleDeviceTM: Failed to report data" << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,8 @@ private:
|
|||||||
static const ReturnValue_t TC_ACK_FAILURE = MAKE_RETURN_CODE(0xA0);
|
static const ReturnValue_t TC_ACK_FAILURE = MAKE_RETURN_CODE(0xA0);
|
||||||
static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA1);
|
static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA1);
|
||||||
|
|
||||||
|
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_HANDLER;
|
||||||
|
|
||||||
static const Event REQUESTING_TM_READ_REPORT_FAILED = MAKE_EVENT(0, severity::LOW);
|
static const Event REQUESTING_TM_READ_REPORT_FAILED = MAKE_EVENT(0, severity::LOW);
|
||||||
static const Event TM_READ_RPT_INVALID_CRC = MAKE_EVENT(1, severity::LOW);
|
static const Event TM_READ_RPT_INVALID_CRC = MAKE_EVENT(1, severity::LOW);
|
||||||
static const Event ACK_FAILURE = MAKE_EVENT(2, severity::LOW);
|
static const Event ACK_FAILURE = MAKE_EVENT(2, severity::LOW);
|
||||||
@ -58,7 +60,7 @@ private:
|
|||||||
/**
|
/**
|
||||||
* @brief This function checks wheter a telemetry packet is expected or not.
|
* @brief This function checks wheter a telemetry packet is expected or not.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t receiveTm();
|
void receiveTm();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function checks the crc of the received PLOC reply.
|
* @brief This function checks the crc of the received PLOC reply.
|
||||||
|
@ -18,7 +18,7 @@ namespace IMTQ {
|
|||||||
static const uint8_t MAX_REPLY_SIZE = SIZE_ENG_HK_DATA_REPLY;
|
static const uint8_t MAX_REPLY_SIZE = SIZE_ENG_HK_DATA_REPLY;
|
||||||
static const uint8_t MAX_COMMAND_SIZE = 9;
|
static const uint8_t MAX_COMMAND_SIZE = 9;
|
||||||
|
|
||||||
static const uint8_t POOL_ENTRIES = 8;
|
static const uint8_t POOL_ENTRIES = 11;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command code definitions. Each command or reply of an IMTQ request will begin with one of
|
* Command code definitions. Each command or reply of an IMTQ request will begin with one of
|
||||||
|
@ -21,6 +21,7 @@ namespace PLOC {
|
|||||||
* SpacePacket apids of PLOC telecommands and telemetry.
|
* SpacePacket apids of PLOC telecommands and telemetry.
|
||||||
*/
|
*/
|
||||||
static const uint16_t APID_TC_MEM_WRITE = 0x714;
|
static const uint16_t APID_TC_MEM_WRITE = 0x714;
|
||||||
|
static const uint16_t APID_TC_MEM_READ = 0x715;
|
||||||
static const uint16_t APID_TM_READ_REPORT = 0x404;
|
static const uint16_t APID_TM_READ_REPORT = 0x404;
|
||||||
static const uint16_t APID_EXE_SUCCESS = 0x402;
|
static const uint16_t APID_EXE_SUCCESS = 0x402;
|
||||||
static const uint16_t APID_EXE_FAILURE = 0x403;
|
static const uint16_t APID_EXE_FAILURE = 0x403;
|
||||||
@ -62,7 +63,7 @@ namespace PLOC {
|
|||||||
*/
|
*/
|
||||||
void fillPacketDataField(const uint32_t* memAddrPtr) {
|
void fillPacketDataField(const uint32_t* memAddrPtr) {
|
||||||
/* Add memAddr to packet data field */
|
/* Add memAddr to packet data field */
|
||||||
memcpy(this->localData.fields.buffer, memAddrPtr, sizeof(memAddrPtr));
|
memcpy(this->localData.fields.buffer, memAddrPtr, sizeof(*memAddrPtr));
|
||||||
/* Add memLen to packet data field */
|
/* Add memLen to packet data field */
|
||||||
this->localData.fields.buffer[OFFSET_MEM_LEN_FIELD] = 0;
|
this->localData.fields.buffer[OFFSET_MEM_LEN_FIELD] = 0;
|
||||||
this->localData.fields.buffer[OFFSET_MEM_LEN_FIELD + 1] = 1;
|
this->localData.fields.buffer[OFFSET_MEM_LEN_FIELD + 1] = 1;
|
||||||
@ -107,13 +108,13 @@ namespace PLOC {
|
|||||||
*/
|
*/
|
||||||
void fillPacketDataField(const uint32_t* memAddrPtr, const uint32_t* memoryDataPtr) {
|
void fillPacketDataField(const uint32_t* memAddrPtr, const uint32_t* memoryDataPtr) {
|
||||||
/* Add memAddr to packet data field */
|
/* Add memAddr to packet data field */
|
||||||
memcpy(this->localData.fields.buffer, memAddrPtr, sizeof(memAddrPtr));
|
memcpy(this->localData.fields.buffer, memAddrPtr, sizeof(*memAddrPtr));
|
||||||
/* Add memLen to packet data field */
|
/* Add memLen to packet data field */
|
||||||
this->localData.fields.buffer[OFFSET_MEM_LEN_FIELD] = 0;
|
this->localData.fields.buffer[OFFSET_MEM_LEN_FIELD] = 0;
|
||||||
this->localData.fields.buffer[OFFSET_MEM_LEN_FIELD + 1] = 1;
|
this->localData.fields.buffer[OFFSET_MEM_LEN_FIELD + 1] = 1;
|
||||||
/* Add memData to packet data field */
|
/* Add memData to packet data field */
|
||||||
memcpy(this->localData.fields.buffer + OFFSET_MEM_DATA_FIELD, memAddrPtr,
|
memcpy(this->localData.fields.buffer + OFFSET_MEM_DATA_FIELD, memAddrPtr,
|
||||||
sizeof(memAddrPtr));
|
sizeof(*memAddrPtr));
|
||||||
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
|
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
|
||||||
sizeof(CCSDSPrimaryHeader) + LENGTH_TC_MEM_WRITE - CRC_SIZE, 0);
|
sizeof(CCSDSPrimaryHeader) + LENGTH_TC_MEM_WRITE - CRC_SIZE, 0);
|
||||||
/* Add crc to packet data field of space packet */
|
/* Add crc to packet data field of space packet */
|
||||||
|
Loading…
Reference in New Issue
Block a user