v1.10.0 #220
@ -1203,100 +1203,6 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
|
||||
#if BOARD_TE0720 == 0
|
||||
new Q7STestTask(objects::TEST_TASK);
|
||||
#endif
|
||||
|
||||
#if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1
|
||||
#if OBSW_TEST_GPIO_OPEN_BYLABEL == 1
|
||||
/* Configure MIO0 as input */
|
||||
GpiodRegular* testGpio = new GpiodRegular("MIO0", Direction::OUT, 0, "/amba_pl/gpio@41200000", 0);
|
||||
#elif OBSW_TEST_GPIO_OPEN_BY_LINE_NAME
|
||||
GpiodRegularByLineName* testGpio =
|
||||
new GpiodRegularByLineName("test-name", "gpio-test", Direction::OUT, 0);
|
||||
#else
|
||||
/* Configure MIO0 as input */
|
||||
GpiodRegular* testGpio = new GpiodRegular("gpiochip0", 0, "MIO0", gpio::IN, 0);
|
||||
#endif /* OBSW_TEST_GPIO_LABEL == 1 */
|
||||
GpioCookie* gpioCookie = new GpioCookie;
|
||||
gpioCookie->addGpio(gpioIds::TEST_ID_0, testGpio);
|
||||
new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie);
|
||||
#endif
|
||||
|
||||
#if BOARD_TE0720 == 1 && OBSW_TEST_SUS == 1
|
||||
GpioCookie* gpioCookieSus = new GpioCookie;
|
||||
GpiodRegular* chipSelectSus = new GpiodRegular(
|
||||
std::string("gpiochip1"), 9, std::string("Chip Select Sus Sensor"), Direction::OUT, 1);
|
||||
gpioCookieSus->addGpio(gpioIds::CS_SUS_0, chipSelectSus);
|
||||
gpioComIF->addGpios(gpioCookieSus);
|
||||
|
||||
SpiCookie* spiCookieSus =
|
||||
new SpiCookie(addresses::SUS_0, std::string("/dev/spidev1.0"), SUS::MAX_CMD_SIZE,
|
||||
spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
||||
|
||||
new SusHandler(objects::SUS_0, objects::SPI_COM_IF, spiCookieSus, gpioComIF, gpioIds::CS_SUS_0);
|
||||
#endif
|
||||
|
||||
#if BOARD_TE0720 == 1 && OBSW_TEST_CCSDS_BRIDGE == 1
|
||||
GpioCookie* gpioCookieCcsdsIp = new GpioCookie;
|
||||
GpiodRegular* papbBusyN =
|
||||
new GpiodRegular(std::string("gpiochip0"), 0, std::string("PAPBBusy_VC0"));
|
||||
gpioCookieCcsdsIp->addGpio(gpioIds::PAPB_BUSY_N, papbBusyN);
|
||||
GpiodRegular* papbEmpty =
|
||||
new GpiodRegular(std::string("gpiochip0"), 1, std::string("PAPBEmpty_VC0"));
|
||||
gpioCookieCcsdsIp->addGpio(gpioIds::PAPB_EMPTY, papbEmpty);
|
||||
gpioComIF->addGpios(gpioCookieCcsdsIp);
|
||||
|
||||
new CCSDSIPCoreBridge(objects::CCSDS_IP_CORE_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR,
|
||||
objects::TM_STORE, objects::TC_STORE, gpioComIF, std::string("/dev/uio0"),
|
||||
gpioIds::PAPB_BUSY_N, gpioIds::PAPB_EMPTY);
|
||||
#endif
|
||||
|
||||
#if BOARD_TE0720 == 1 && OBSW_TEST_RAD_SENSOR == 1
|
||||
GpioCookie* gpioCookieRadSensor = new GpioCookie;
|
||||
GpiodRegular* chipSelectRadSensor = new GpiodRegular(
|
||||
std::string("gpiochip1"), 0, std::string("Chip select radiation sensor"), Direction::OUT, 1);
|
||||
gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor);
|
||||
gpioComIF->addGpios(gpioCookieRadSensor);
|
||||
|
||||
SpiCookie* spiCookieRadSensor =
|
||||
new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR, std::string("/dev/spidev1.0"),
|
||||
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
||||
|
||||
RadiationSensorHandler* radSensor =
|
||||
new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor);
|
||||
radSensor->setStartUpImmediately();
|
||||
#endif
|
||||
|
||||
#if BOARD_TE0720 == 1 && OBSW_ADD_PLOC_MPSOC == 1
|
||||
UartCookie* mpsocUartCookie =
|
||||
new UartCookie(objects::PLOC_MPSOC_HANDLER, std::string("/dev/ttyPS2"),
|
||||
UartModes::NON_CANONICAL, 115200, mpsoc::MAX_REPLY_SIZE);
|
||||
/* Testing PlocMPSoCHandler on TE0720-03-1CFA */
|
||||
PlocMPSoCHelper* plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
|
||||
PlocMPSoCHandler* plocMPSoCHandler = new PlocMPSoCHandler(
|
||||
objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocUartCookie, plocMpsocHelper);
|
||||
plocMPSoCHandler->setStartUpImmediately();
|
||||
#endif
|
||||
|
||||
#if BOARD_TE0720 == 1 && OBSW_TEST_TE7020_HEATER == 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 BOARD_TE0720 == 1 && OBSW_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, PLOC_SPV::MAX_PACKET_SIZE * 20);
|
||||
plocSupervisorCookie->setNoFixedSizeReply();
|
||||
PlocSupervisorHandler* plocSupervisor = new PlocSupervisorHandler(
|
||||
objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, plocSupervisorCookie);
|
||||
plocSupervisor->setStartUpImmediately();
|
||||
#endif
|
||||
|
||||
#if OBSW_ADD_SPI_TEST_CODE == 1
|
||||
new SpiTestClass(objects::SPI_TEST, gpioComIF);
|
||||
#endif
|
||||
|
@ -39,12 +39,95 @@ void ObjectFactory::produce(void* args) {
|
||||
|
||||
#if OBSW_ADD_PLOC_MPSOC == 1
|
||||
UartCookie* mpsocUartCookie =
|
||||
new UartCookie(objects::PLOC_MPSOC_HANDLER, te0720_1cfa::MPSOC_UART,
|
||||
UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
|
||||
new UartCookie(objects::PLOC_MPSOC_HANDLER, te0720_1cfa::MPSOC_UART, UartModes::NON_CANONICAL,
|
||||
uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
|
||||
mpsocUartCookie->setNoFixedSizeReply();
|
||||
PlocMPSoCHelper* plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
|
||||
new UartComIF(objects::UART_COM_IF);
|
||||
PlocMPSoCHandler* plocMPSoCHandler = new PlocMPSoCHandler(
|
||||
objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocUartCookie, plocMpsocHelper);
|
||||
plocMPSoCHandler->setStartUpImmediately();
|
||||
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
|
||||
|
||||
#if OBSW_TEST_LIBGPIOD == 1
|
||||
#if OBSW_TEST_GPIO_OPEN_BYLABEL == 1
|
||||
/* Configure MIO0 as input */
|
||||
GpiodRegular* testGpio = new GpiodRegular("MIO0", Direction::OUT, 0, "/amba_pl/gpio@41200000", 0);
|
||||
#elif OBSW_TEST_GPIO_OPEN_BY_LINE_NAME
|
||||
GpiodRegularByLineName* testGpio =
|
||||
new GpiodRegularByLineName("test-name", "gpio-test", Direction::OUT, 0);
|
||||
#else
|
||||
/* Configure MIO0 as input */
|
||||
GpiodRegular* testGpio = new GpiodRegular("gpiochip0", 0, "MIO0", gpio::IN, 0);
|
||||
#endif /* OBSW_TEST_GPIO_LABEL == 1 */
|
||||
GpioCookie* gpioCookie = new GpioCookie;
|
||||
gpioCookie->addGpio(gpioIds::TEST_ID_0, testGpio);
|
||||
new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie);
|
||||
#endif
|
||||
|
||||
#if OBSW_TEST_SUS == 1
|
||||
GpioCookie* gpioCookieSus = new GpioCookie;
|
||||
GpiodRegular* chipSelectSus = new GpiodRegular(
|
||||
std::string("gpiochip1"), 9, std::string("Chip Select Sus Sensor"), Direction::OUT, 1);
|
||||
gpioCookieSus->addGpio(gpioIds::CS_SUS_0, chipSelectSus);
|
||||
gpioComIF->addGpios(gpioCookieSus);
|
||||
|
||||
SpiCookie* spiCookieSus =
|
||||
new SpiCookie(addresses::SUS_0, std::string("/dev/spidev1.0"), SUS::MAX_CMD_SIZE,
|
||||
spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
||||
|
||||
new SusHandler(objects::SUS_0, objects::SPI_COM_IF, spiCookieSus, gpioComIF, gpioIds::CS_SUS_0);
|
||||
#endif
|
||||
|
||||
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
||||
GpioCookie* gpioCookieCcsdsIp = new GpioCookie;
|
||||
GpiodRegular* papbBusyN =
|
||||
new GpiodRegular(std::string("gpiochip0"), 0, std::string("PAPBBusy_VC0"));
|
||||
gpioCookieCcsdsIp->addGpio(gpioIds::PAPB_BUSY_N, papbBusyN);
|
||||
GpiodRegular* papbEmpty =
|
||||
new GpiodRegular(std::string("gpiochip0"), 1, std::string("PAPBEmpty_VC0"));
|
||||
gpioCookieCcsdsIp->addGpio(gpioIds::PAPB_EMPTY, papbEmpty);
|
||||
gpioComIF->addGpios(gpioCookieCcsdsIp);
|
||||
|
||||
new CCSDSIPCoreBridge(objects::CCSDS_IP_CORE_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR,
|
||||
objects::TM_STORE, objects::TC_STORE, gpioComIF, std::string("/dev/uio0"),
|
||||
gpioIds::PAPB_BUSY_N, gpioIds::PAPB_EMPTY);
|
||||
#endif
|
||||
|
||||
#if OBSW_TEST_RAD_SENSOR == 1
|
||||
GpioCookie* gpioCookieRadSensor = new GpioCookie;
|
||||
GpiodRegular* chipSelectRadSensor = new GpiodRegular(
|
||||
std::string("gpiochip1"), 0, std::string("Chip select radiation sensor"), Direction::OUT, 1);
|
||||
gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor);
|
||||
gpioComIF->addGpios(gpioCookieRadSensor);
|
||||
|
||||
SpiCookie* spiCookieRadSensor =
|
||||
new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR, std::string("/dev/spidev1.0"),
|
||||
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
||||
|
||||
RadiationSensorHandler* radSensor =
|
||||
new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor);
|
||||
radSensor->setStartUpImmediately();
|
||||
#endif
|
||||
|
||||
#if OBSW_TEST_TE7020_HEATER == 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 OBSW_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, PLOC_SPV::MAX_PACKET_SIZE * 20);
|
||||
plocSupervisorCookie->setNoFixedSizeReply();
|
||||
PlocSupervisorHandler* plocSupervisor = new PlocSupervisorHandler(
|
||||
objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, plocSupervisorCookie);
|
||||
plocSupervisor->setStartUpImmediately();
|
||||
#endif
|
||||
}
|
||||
|
@ -1,11 +1,12 @@
|
||||
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_
|
||||
#define MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "MPSoCReturnValuesIF.h"
|
||||
#include <fsfw/tmtcpacket/SpacePacket.h>
|
||||
#include <fsfw/globalfunctions/CRC.h>
|
||||
#include <fsfw/serialize/SerializeAdapter.h>
|
||||
#include <fsfw/tmtcpacket/SpacePacket.h>
|
||||
|
||||
#include "MPSoCReturnValuesIF.h"
|
||||
#include "OBSWConfig.h"
|
||||
|
||||
namespace mpsoc {
|
||||
|
||||
@ -54,11 +55,12 @@ namespace apid {
|
||||
static const uint16_t ACK_FAILURE = 0x401;
|
||||
static const uint16_t EXE_SUCCESS = 0x402;
|
||||
static const uint16_t EXE_FAILURE = 0x403;
|
||||
}
|
||||
} // namespace apid
|
||||
|
||||
/** Offset from first byte in space packet to first byte of data field */
|
||||
static const uint8_t DATA_FIELD_OFFSET = 6;
|
||||
static const size_t MEM_READ_RPT_LEN_OFFSET = 10;
|
||||
static const char NULL_TERMINATOR = '\0';
|
||||
|
||||
/**
|
||||
* The size of payload data which will be forwarded to the requesting object. e.g. PUS Service
|
||||
@ -81,16 +83,17 @@ static const size_t MAX_DATA_SIZE = 1016;
|
||||
|
||||
/**
|
||||
* The replay write sequence command has a maximum delay for the execution report which amounts to
|
||||
* 30 seconds (60 cycles * 0.5 seconds).
|
||||
* 30 seconds. (80 cycles * 0.5 seconds = 40 seconds).
|
||||
*/
|
||||
static const uint16_t TC_WRITE_SEQ_EXECUTION_DELAY = 60;
|
||||
static const uint16_t TC_WRITE_SEQ_EXECUTION_DELAY = 80;
|
||||
// Requires approx. 2 seconds for execution. 8 => 4 seconds
|
||||
static const uint16_t TC_DOWNLINK_PWR_ON_EXECUTION_DELAY = 8;
|
||||
|
||||
/**
|
||||
* @brief Abstract base class for TC space packet of MPSoC.
|
||||
*/
|
||||
class TcBase : public SpacePacket, public MPSoCReturnValuesIF {
|
||||
public:
|
||||
|
||||
// Initial length field of space packet. Will always be updated when packet is created.
|
||||
static const uint16_t INIT_LENGTH = 1;
|
||||
|
||||
@ -100,9 +103,8 @@ public:
|
||||
* @param sequenceCount Sequence count of space packet which will be incremented with each
|
||||
* sent and received packets.
|
||||
*/
|
||||
TcBase(uint16_t apid, uint16_t sequenceCount) :
|
||||
SpacePacket(INIT_LENGTH, true, apid, sequenceCount) {
|
||||
}
|
||||
TcBase(uint16_t apid, uint16_t sequenceCount)
|
||||
: SpacePacket(INIT_LENGTH, true, apid, sequenceCount) {}
|
||||
|
||||
/**
|
||||
* @brief Function to initialize the space packet
|
||||
@ -144,8 +146,8 @@ protected:
|
||||
size_t serializedSize = 0;
|
||||
uint32_t full_size = getFullSize();
|
||||
uint16_t crc = CRC::crc16ccitt(getWholeData(), full_size - CRC_SIZE);
|
||||
result = SerializeAdapter::serialize<uint16_t>(&crc,
|
||||
this->localData.byteStream + full_size - CRC_SIZE, &serializedSize, sizeof(crc),
|
||||
result = SerializeAdapter::serialize<uint16_t>(
|
||||
&crc, this->localData.byteStream + full_size - CRC_SIZE, &serializedSize, sizeof(crc),
|
||||
SerializeIF::Endianness::BIG);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::debug << "TcBase::addCrc: Failed to serialize crc field" << std::endl;
|
||||
@ -159,17 +161,16 @@ protected:
|
||||
*/
|
||||
class TmPacket : public SpacePacket, public MPSoCReturnValuesIF {
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief Constructor creates idle packet and sets length field to maximum allowed size.
|
||||
*/
|
||||
TmPacket() : SpacePacket(PACKET_MAX_SIZE) {
|
||||
}
|
||||
TmPacket() : SpacePacket(PACKET_MAX_SIZE) {}
|
||||
|
||||
ReturnValue_t checkCrc() {
|
||||
uint8_t* crcPtr = this->getPacketData() + this->getPacketDataLength() - 1;
|
||||
uint16_t receivedCrc = *(crcPtr) << 8 | *(crcPtr + 1);
|
||||
uint16_t recalculatedCrc = CRC::crc16ccitt(this->localData.byteStream, this->getFullSize());
|
||||
uint16_t recalculatedCrc =
|
||||
CRC::crc16ccitt(this->localData.byteStream, this->getFullSize() - CRC_SIZE);
|
||||
if (recalculatedCrc != receivedCrc) {
|
||||
return CRC_FAILURE;
|
||||
}
|
||||
@ -182,21 +183,16 @@ public:
|
||||
*/
|
||||
class TcMemRead : public TcBase {
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
TcMemRead(uint16_t sequenceCount) :
|
||||
TcBase(apid::TC_MEM_READ, sequenceCount) {
|
||||
TcMemRead(uint16_t sequenceCount) : TcBase(apid::TC_MEM_READ, sequenceCount) {
|
||||
this->setPacketDataLength(PACKET_LENGTH);
|
||||
}
|
||||
|
||||
uint16_t getMemLen() const {
|
||||
return memLen;
|
||||
}
|
||||
uint16_t getMemLen() const { return memLen; }
|
||||
|
||||
protected:
|
||||
|
||||
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
result = lengthCheck(commandDataLen);
|
||||
@ -204,12 +200,12 @@ protected:
|
||||
return result;
|
||||
}
|
||||
std::memcpy(this->localData.fields.buffer, commandData, MEM_ADDRESS_SIZE);
|
||||
std::memcpy(this->localData.fields.buffer + MEM_ADDRESS_SIZE,
|
||||
commandData + MEM_ADDRESS_SIZE, MEM_LEN_SIZE);
|
||||
std::memcpy(this->localData.fields.buffer + MEM_ADDRESS_SIZE, commandData + MEM_ADDRESS_SIZE,
|
||||
MEM_LEN_SIZE);
|
||||
size_t size = sizeof(memLen);
|
||||
const uint8_t* memLenPtr = commandData + MEM_ADDRESS_SIZE;
|
||||
result = SerializeAdapter::deSerialize(&memLen, &memLenPtr, &size,
|
||||
SerializeIF::Endianness::BIG);
|
||||
result =
|
||||
SerializeAdapter::deSerialize(&memLen, &memLenPtr, &size, SerializeIF::Endianness::BIG);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
@ -217,7 +213,6 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static const size_t COMMAND_LENGTH = 6;
|
||||
static const size_t MEM_ADDRESS_SIZE = 4;
|
||||
static const size_t MEM_LEN_SIZE = 2;
|
||||
@ -242,11 +237,9 @@ public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
TcMemWrite(uint16_t sequenceCount) : TcBase(apid::TC_MEM_WRITE, sequenceCount) {
|
||||
}
|
||||
TcMemWrite(uint16_t sequenceCount) : TcBase(apid::TC_MEM_WRITE, sequenceCount) {}
|
||||
|
||||
protected:
|
||||
|
||||
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
result = lengthCheck(commandDataLen);
|
||||
@ -254,14 +247,13 @@ protected:
|
||||
return result;
|
||||
}
|
||||
std::memcpy(this->localData.fields.buffer, commandData, commandDataLen);
|
||||
uint16_t memLen = *(commandData + MEM_ADDRESS_SIZE) << 8
|
||||
| *(commandData + MEM_ADDRESS_SIZE + 1);
|
||||
uint16_t memLen =
|
||||
*(commandData + MEM_ADDRESS_SIZE) << 8 | *(commandData + MEM_ADDRESS_SIZE + 1);
|
||||
this->setPacketDataLength(memLen * 4 + FIX_LENGTH - 1);
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// Min length consists of 4 byte address, 2 byte mem length field, 4 byte data (1 word)
|
||||
static const size_t MIN_COMMAND_DATA_LENGTH = 10;
|
||||
static const size_t MEM_ADDRESS_SIZE = 4;
|
||||
@ -281,29 +273,31 @@ private:
|
||||
*/
|
||||
class FlashFopen : public TcBase {
|
||||
public:
|
||||
|
||||
FlashFopen(uint16_t sequenceCount) :
|
||||
TcBase(apid::TC_FLASHFOPEN, sequenceCount) {
|
||||
}
|
||||
FlashFopen(uint16_t sequenceCount) : TcBase(apid::TC_FLASHFOPEN, sequenceCount) {}
|
||||
|
||||
static const char APPEND = 'a';
|
||||
static const char WRITE = 'w';
|
||||
static const char READ = 'r';
|
||||
|
||||
ReturnValue_t createPacket(std::string filename, char accessMode) {
|
||||
ReturnValue_t createPacket(std::string filename, char accessMode_) {
|
||||
accessMode = accessMode_;
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
size_t nameSize = filename.size();
|
||||
std::memcpy(this->getPacketData(), filename.c_str(),
|
||||
nameSize);
|
||||
std::memcpy(this->getPacketData() + nameSize + 1, &accessMode,
|
||||
std::memcpy(this->getPacketData(), filename.c_str(), nameSize);
|
||||
*(this->getPacketData() + nameSize) = NULL_TERMINATOR;
|
||||
std::memcpy(this->getPacketData() + nameSize + sizeof(NULL_TERMINATOR), &accessMode,
|
||||
sizeof(accessMode));
|
||||
this->setPacketDataLength(nameSize + CRC_SIZE - 1);
|
||||
this->setPacketDataLength(nameSize + sizeof(NULL_TERMINATOR) + sizeof(accessMode) + CRC_SIZE -
|
||||
1);
|
||||
result = addCrc();
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
char accessMode = APPEND;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -311,16 +305,14 @@ public:
|
||||
*/
|
||||
class FlashFclose : public TcBase {
|
||||
public:
|
||||
|
||||
FlashFclose(uint16_t sequenceCount) :
|
||||
TcBase(apid::TC_FLASHFCLOSE, sequenceCount) {
|
||||
}
|
||||
FlashFclose(uint16_t sequenceCount) : TcBase(apid::TC_FLASHFCLOSE, sequenceCount) {}
|
||||
|
||||
ReturnValue_t createPacket(std::string filename) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
size_t nameSize = filename.size();
|
||||
std::memcpy(this->getPacketData(), filename.c_str(), nameSize);
|
||||
this->setPacketDataLength(nameSize + CRC_SIZE - 1);
|
||||
*(this->getPacketData() + nameSize) = NULL_TERMINATOR;
|
||||
this->setPacketDataLength(nameSize + sizeof(NULL_TERMINATOR) + CRC_SIZE - 1);
|
||||
result = addCrc();
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
@ -334,25 +326,33 @@ public:
|
||||
*/
|
||||
class TcFlashWrite : public TcBase {
|
||||
public:
|
||||
TcFlashWrite(uint16_t sequenceCount) : TcBase(apid::TC_FLASHWRITE, sequenceCount) {}
|
||||
|
||||
TcFlashWrite(uint16_t sequenceCount) :
|
||||
TcBase(apid::TC_FLASHWRITE, sequenceCount) {
|
||||
}
|
||||
|
||||
ReturnValue_t createPacket(uint8_t* writeData, uint32_t writeLen) {
|
||||
ReturnValue_t createPacket(const uint8_t* writeData, uint32_t writeLen_) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
writeLen = writeLen_;
|
||||
if (writeLen > MAX_DATA_SIZE) {
|
||||
sif::debug << "FlashWrite::createPacket: Command data too big" << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
std::memcpy(this->getPacketData(), &writeLen, sizeof(writeLen));
|
||||
size_t serializedSize = 0;
|
||||
result =
|
||||
SerializeAdapter::serialize<uint32_t>(&writeLen, this->getPacketData(), &serializedSize,
|
||||
sizeof(writeLen), SerializeIF::Endianness::BIG);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
std::memcpy(this->getPacketData() + sizeof(writeLen), writeData, writeLen);
|
||||
this->setPacketDataLength(static_cast<uint16_t>(writeLen + CRC_SIZE - 1));
|
||||
ReturnValue_t result = addCrc();
|
||||
result = addCrc();
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
uint32_t writeLen = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -360,16 +360,14 @@ public:
|
||||
*/
|
||||
class TcFlashDelete : public TcBase {
|
||||
public:
|
||||
|
||||
TcFlashDelete(uint16_t sequenceCount) :
|
||||
TcBase(apid::TC_FLASHDELETE , sequenceCount) {
|
||||
}
|
||||
TcFlashDelete(uint16_t sequenceCount) : TcBase(apid::TC_FLASHDELETE, sequenceCount) {}
|
||||
|
||||
ReturnValue_t createPacket(std::string filename) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
size_t nameSize = filename.size();
|
||||
std::memcpy(this->getPacketData(), filename.c_str(), nameSize);
|
||||
this->setPacketDataLength(nameSize + CRC_SIZE - 1);
|
||||
*(this->getPacketData() + nameSize) = NULL_TERMINATOR;
|
||||
this->setPacketDataLength(nameSize + sizeof(NULL_TERMINATOR) + CRC_SIZE - 1);
|
||||
result = addCrc();
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
@ -383,10 +381,7 @@ public:
|
||||
*/
|
||||
class TcReplayStop : public TcBase {
|
||||
public:
|
||||
|
||||
TcReplayStop(uint16_t sequenceCount) :
|
||||
TcBase(apid::TC_REPLAY_STOP, sequenceCount) {
|
||||
}
|
||||
TcReplayStop(uint16_t sequenceCount) : TcBase(apid::TC_REPLAY_STOP, sequenceCount) {}
|
||||
|
||||
ReturnValue_t createPacket() {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
@ -407,11 +402,9 @@ public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
TcReplayStart(uint16_t sequenceCount) : TcBase(apid::TC_REPLAY_START, sequenceCount) {
|
||||
}
|
||||
TcReplayStart(uint16_t sequenceCount) : TcBase(apid::TC_REPLAY_START, sequenceCount) {}
|
||||
|
||||
protected:
|
||||
|
||||
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
result = lengthCheck(commandDataLen);
|
||||
@ -428,7 +421,6 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static const size_t COMMAND_DATA_LENGTH = 1;
|
||||
static const uint8_t REPEATING = 0;
|
||||
static const uint8_t ONCE = 1;
|
||||
@ -458,11 +450,9 @@ public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
TcDownlinkPwrOn(uint16_t sequenceCount) : TcBase(apid::TC_DOWNLINK_PWR_ON, sequenceCount) {
|
||||
}
|
||||
TcDownlinkPwrOn(uint16_t sequenceCount) : TcBase(apid::TC_DOWNLINK_PWR_ON, sequenceCount) {}
|
||||
|
||||
protected:
|
||||
|
||||
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
result = lengthCheck(commandDataLen);
|
||||
@ -485,7 +475,6 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::DWLPWRON_CMD;
|
||||
|
||||
//! [EXPORT] : [COMMENT] Received command has invalid JESD mode (valid modes are 0 - 5)
|
||||
@ -528,10 +517,7 @@ private:
|
||||
*/
|
||||
class TcDownlinkPwrOff : public TcBase {
|
||||
public:
|
||||
|
||||
TcDownlinkPwrOff(uint16_t sequenceCount) :
|
||||
TcBase(apid::TC_DOWNLINK_PWR_OFF, sequenceCount) {
|
||||
}
|
||||
TcDownlinkPwrOff(uint16_t sequenceCount) : TcBase(apid::TC_DOWNLINK_PWR_OFF, sequenceCount) {}
|
||||
|
||||
ReturnValue_t createPacket() {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
@ -544,7 +530,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief This class helps to build the replay start command.
|
||||
*/
|
||||
@ -553,10 +538,10 @@ public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
TcReplayWriteSeq(uint16_t sequenceCount) : TcBase(apid::TC_REPLAY_WRITE_SEQUENCE, sequenceCount) {}
|
||||
TcReplayWriteSeq(uint16_t sequenceCount)
|
||||
: TcBase(apid::TC_REPLAY_WRITE_SEQUENCE, sequenceCount) {}
|
||||
|
||||
protected:
|
||||
|
||||
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
result = lengthCheck(commandDataLen);
|
||||
@ -564,17 +549,18 @@ protected:
|
||||
return result;
|
||||
}
|
||||
std::memcpy(this->localData.fields.buffer, commandData, commandDataLen);
|
||||
this->setPacketDataLength(commandDataLen + CRC_SIZE - 1);
|
||||
*(this->localData.fields.buffer + commandDataLen) = NULL_TERMINATOR;
|
||||
this->setPacketDataLength(commandDataLen + sizeof(NULL_TERMINATOR) + CRC_SIZE - 1);
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static const size_t USE_DECODING_LENGTH = 1;
|
||||
|
||||
ReturnValue_t lengthCheck(size_t commandDataLen) {
|
||||
if (commandDataLen > USE_DECODING_LENGTH + MAX_FILENAME_SIZE) {
|
||||
sif::warning << "TcReplayWriteSeq: Command has invalid length " << commandDataLen << std::endl;
|
||||
sif::warning << "TcReplayWriteSeq: Command has invalid length " << commandDataLen
|
||||
<< std::endl;
|
||||
return INVALID_LENGTH;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
@ -601,16 +587,11 @@ class FlashWritePusCmd : public MPSoCReturnValuesIF {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
std::string getObcFile() {
|
||||
return obcFile;
|
||||
}
|
||||
std::string getObcFile() { return obcFile; }
|
||||
|
||||
std::string getMPSoCFile() {
|
||||
return mpsocFile;
|
||||
}
|
||||
std::string getMPSoCFile() { return mpsocFile; }
|
||||
|
||||
private:
|
||||
|
||||
static const size_t SIZE_NULL_TERMINATOR = 1;
|
||||
std::string obcFile = "";
|
||||
std::string mpsocFile = "";
|
||||
@ -621,10 +602,7 @@ class FlashWritePusCmd : public MPSoCReturnValuesIF {
|
||||
*/
|
||||
class TcModeReplay : public TcBase {
|
||||
public:
|
||||
|
||||
TcModeReplay(uint16_t sequenceCount) :
|
||||
TcBase(apid::TC_MODE_REPLAY, sequenceCount) {
|
||||
}
|
||||
TcModeReplay(uint16_t sequenceCount) : TcBase(apid::TC_MODE_REPLAY, sequenceCount) {}
|
||||
|
||||
ReturnValue_t createPacket() {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
@ -637,8 +615,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // namespace mpsoc
|
||||
|
||||
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ */
|
||||
|
@ -603,13 +603,15 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
|
||||
switch (command->first) {
|
||||
case mpsoc::TC_REPLAY_WRITE_SEQUENCE: {
|
||||
DeviceReplyIter iter = deviceReplyMap.find(mpsoc::EXE_REPORT);
|
||||
if (iter != deviceReplyMap.end()) {
|
||||
// Overwrite delay cycles because replay write sequence command can required up to
|
||||
// 30 seconds for execution
|
||||
iter->second.delayCycles = mpsoc::TC_WRITE_SEQ_EXECUTION_DELAY;
|
||||
} else {
|
||||
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Unknown reply id" << std::endl;
|
||||
break;
|
||||
}
|
||||
case mpsoc::TC_DOWNLINK_PWR_ON: {
|
||||
DeviceReplyIter iter = deviceReplyMap.find(mpsoc::EXE_REPORT);
|
||||
//
|
||||
iter->second.delayCycles = mpsoc::TC_DOWNLINK_PWR_ON;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -719,6 +721,7 @@ void PlocMPSoCHandler::disableAllReplies() {
|
||||
|
||||
/* We must always disable the execution report reply here */
|
||||
disableExeReportReply();
|
||||
nextReplyId = mpsoc::NONE;
|
||||
}
|
||||
|
||||
void PlocMPSoCHandler::sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status) {
|
||||
@ -743,7 +746,7 @@ void PlocMPSoCHandler::disableExeReportReply() {
|
||||
DeviceReplyInfo* info = &(iter->second);
|
||||
info->delayCycles = 0;
|
||||
info->command = deviceCommandMap.end();
|
||||
/* Expected replies is set to one here. The value will set to 0 in replyToReply() */
|
||||
/* Expected replies is set to one here. The value will be set to 0 in replyToReply() */
|
||||
info->command->second.expectedReplies = 0;
|
||||
}
|
||||
|
||||
|
@ -67,8 +67,9 @@ void PlocMPSoCHelper::setSequenceCount(SourceSequenceCounter* sequenceCount_) {
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string obcFile, std::string mpsocFile) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
#ifdef XIPHOS_Q7S
|
||||
ReturnValue_t result = FilesystemHelper::checkPath(obcFile);
|
||||
result = FilesystemHelper::checkPath(obcFile);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
@ -88,9 +89,19 @@ ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string obcFile, std::string
|
||||
flashWrite.obcFile = obcFile;
|
||||
flashWrite.mpsocFile = mpsocFile;
|
||||
internalState = InternalState::FLASH_WRITE;
|
||||
result = resetHelper();
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMPSoCHelper::resetHelper() {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
semaphore.release();
|
||||
terminate = false;
|
||||
return RETURN_OK;
|
||||
result = uartComIF->flushUartRxBuffer(comCookie);
|
||||
return result;
|
||||
}
|
||||
|
||||
void PlocMPSoCHelper::stopProcess() { terminate = true; }
|
||||
@ -108,6 +119,7 @@ ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
|
||||
// tellg returns position of character in input stream
|
||||
size_t remainingSize = file.tellg();
|
||||
size_t dataLength = 0;
|
||||
size_t bytesRead = 0;
|
||||
while (remainingSize > 0) {
|
||||
if (terminate) {
|
||||
return RETURN_OK;
|
||||
@ -117,19 +129,18 @@ ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
|
||||
} else {
|
||||
dataLength = remainingSize;
|
||||
}
|
||||
if (file.is_open()) {
|
||||
file.seekg(bytesRead, file.beg);
|
||||
file.read(reinterpret_cast<char*>(tempData), dataLength);
|
||||
bytesRead += dataLength;
|
||||
remainingSize -= dataLength;
|
||||
} else {
|
||||
return FILE_CLOSED_ACCIDENTALLY;
|
||||
}
|
||||
(*sequenceCount)++;
|
||||
mpsoc::TcFlashWrite tc(*sequenceCount);
|
||||
tc.createPacket(tempData, dataLength);
|
||||
result = sendCommand(&tc);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = handleAck();
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = handleExe();
|
||||
result = handlePacketTransmission(tc);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
@ -149,7 +160,7 @@ ReturnValue_t PlocMPSoCHelper::flashfopen() {
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = sendCommand(&flashFopen);
|
||||
result = handlePacketTransmission(flashFopen);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
@ -164,16 +175,33 @@ ReturnValue_t PlocMPSoCHelper::flashfclose() {
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = sendCommand(&flashFclose);
|
||||
result = handlePacketTransmission(flashFclose);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMPSoCHelper::sendCommand(mpsoc::TcBase* tc) {
|
||||
ReturnValue_t PlocMPSoCHelper::handlePacketTransmission(mpsoc::TcBase& tc) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
result = uartComIF->sendMessage(comCookie, tc->getWholeData(), tc->getFullSize());
|
||||
result = sendCommand(tc);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = handleAck();
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = handleExe();
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMPSoCHelper::sendCommand(mpsoc::TcBase& tc) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
result = uartComIF->sendMessage(comCookie, tc.getWholeData(), tc.getFullSize());
|
||||
if (result != RETURN_OK) {
|
||||
sif::warning << "PlocMPSoCHelper::sendCommand: Failed to send command" << std::endl;
|
||||
triggerEvent(SENDING_COMMAND_FAILED, result, static_cast<uint32_t>(internalState));
|
||||
@ -231,7 +259,7 @@ void PlocMPSoCHelper::handleExeApidFailure(uint16_t apid) {
|
||||
<< "report" << std::endl;
|
||||
} else {
|
||||
triggerEvent(EXE_INVALID_APID, apid, static_cast<uint32_t>(internalState));
|
||||
sif::warning << "PlocMPSoCHelper::handleAckApidFailure: Expected execution report "
|
||||
sif::warning << "PlocMPSoCHelper::handleExeApidFailure: Expected execution report "
|
||||
<< "but received space packet with apid " << std::hex << apid << std::endl;
|
||||
}
|
||||
}
|
||||
@ -239,12 +267,14 @@ void PlocMPSoCHelper::handleExeApidFailure(uint16_t apid) {
|
||||
ReturnValue_t PlocMPSoCHelper::handleTmReception(mpsoc::TmPacket* tmPacket, size_t remainingBytes) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
size_t readBytes = 0;
|
||||
size_t currentBytes = 0;
|
||||
for (int retries = 0; retries < RETRIES; retries++) {
|
||||
result = receive(tmPacket->getWholeData(), &readBytes, remainingBytes);
|
||||
result = receive(tmPacket->getWholeData() + readBytes, ¤tBytes, remainingBytes);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
remainingBytes = remainingBytes - readBytes;
|
||||
readBytes += currentBytes;
|
||||
remainingBytes = remainingBytes - currentBytes;
|
||||
if (remainingBytes == 0) {
|
||||
break;
|
||||
}
|
||||
@ -259,17 +289,18 @@ ReturnValue_t PlocMPSoCHelper::handleTmReception(mpsoc::TmPacket* tmPacket, size
|
||||
sif::warning << "PlocMPSoCHelper::handleTmReception: CRC check failed" << std::endl;
|
||||
return result;
|
||||
}
|
||||
(*sequenceCount)++;
|
||||
uint16_t recvSeqCnt = tmPacket->getPacketSequenceCount();
|
||||
if (recvSeqCnt != *sequenceCount) {
|
||||
triggerEvent(MPSOC_HELPER_SEQ_CNT_MISMATCH, *sequenceCount, recvSeqCnt);
|
||||
*sequenceCount = recvSeqCnt;
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMPSoCHelper::receive(uint8_t* data, size_t* readBytes, size_t requestBytes) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
uint8_t* buffer = nullptr;
|
||||
result = uartComIF->requestReceiveMessage(comCookie, requestBytes);
|
||||
if (result != RETURN_OK) {
|
||||
sif::warning << "PlocMPSoCHelper::receive: Failed to request reply" << std::endl;
|
||||
@ -277,11 +308,14 @@ ReturnValue_t PlocMPSoCHelper::receive(uint8_t* data, size_t* readBytes, size_t
|
||||
static_cast<uint32_t>(static_cast<uint32_t>(internalState)));
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
result = uartComIF->readReceivedMessage(comCookie, &data, readBytes);
|
||||
result = uartComIF->readReceivedMessage(comCookie, &buffer, readBytes);
|
||||
if (result != RETURN_OK) {
|
||||
sif::warning << "PlocMPSoCHelper::receive: Failed to read received message" << std::endl;
|
||||
triggerEvent(MPSOC_HELPER_READING_REPLY_FAILED, result, static_cast<uint32_t>(internalState));
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
if (*readBytes > 0) {
|
||||
std::memcpy(data, buffer, *readBytes);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -2,13 +2,14 @@
|
||||
#define BSP_Q7S_DEVICES_PLOCMPSOCHELPER_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "fsfw/devicehandlers/CookieIF.h"
|
||||
#include "fsfw/objectmanager/SystemObject.h"
|
||||
#include "fsfw/osal/linux/BinarySemaphore.h"
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
#include "fsfw/objectmanager/SystemObject.h"
|
||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||
#include "fsfw_hal/linux/uart/UartComIF.h"
|
||||
#include "fsfw/devicehandlers/CookieIF.h"
|
||||
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
|
||||
#include "fsfw_hal/linux/uart/UartComIF.h"
|
||||
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
|
||||
#ifdef XIPHOS_Q7S
|
||||
#include "bsp_q7s/memory/SdCardManager.h"
|
||||
@ -21,14 +22,14 @@
|
||||
*/
|
||||
class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF, public HasReturnvaluesIF {
|
||||
public:
|
||||
|
||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_MPSOC_HELPER;
|
||||
|
||||
//! [EXPORT] : [COMMENT] Flash write fails
|
||||
static const Event MPSOC_FLASH_WRITE_FAILED = MAKE_EVENT(0, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Flash write successful
|
||||
static const Event MPSOC_FLASH_WRITE_SUCCESSFUL = MAKE_EVENT(1, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Communication interface returned failure when trying to send the command ot the PLOC
|
||||
//! [EXPORT] : [COMMENT] Communication interface returned failure when trying to send the command
|
||||
//! ot the PLOC
|
||||
//! P1: Return value returned by the communication interface sendMessage function
|
||||
//! P2: Internal state of MPSoC helper
|
||||
static const Event SENDING_COMMAND_FAILED = MAKE_EVENT(2, severity::LOW);
|
||||
@ -97,12 +98,14 @@ public:
|
||||
void setSequenceCount(SourceSequenceCounter* sequenceCount_);
|
||||
|
||||
private:
|
||||
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_MPSOC_HELPER;
|
||||
|
||||
//! [EXPORT] : [COMMENT] File accidentally close
|
||||
static const ReturnValue_t FILE_CLOSED_ACCIDENTALLY = MAKE_RETURN_CODE(0xA0);
|
||||
|
||||
// Maximum number of times the communication interface retries polling data from the reply
|
||||
// buffer
|
||||
static const int RETRIES = 3;
|
||||
static const int RETRIES = 10000;
|
||||
|
||||
struct FlashWrite {
|
||||
std::string obcFile;
|
||||
@ -111,11 +114,7 @@ private:
|
||||
|
||||
struct FlashWrite flashWrite;
|
||||
|
||||
enum class InternalState {
|
||||
IDLE,
|
||||
FLASH_WRITE,
|
||||
FLASH_READ
|
||||
};
|
||||
enum class InternalState { IDLE, FLASH_WRITE, FLASH_READ };
|
||||
|
||||
InternalState internalState = InternalState::IDLE;
|
||||
|
||||
@ -137,10 +136,12 @@ private:
|
||||
// Sequence count, must be set by Ploc MPSoC Handler
|
||||
SourceSequenceCounter* sequenceCount;
|
||||
|
||||
ReturnValue_t resetHelper();
|
||||
ReturnValue_t performFlashWrite();
|
||||
ReturnValue_t flashfopen();
|
||||
ReturnValue_t flashfclose();
|
||||
ReturnValue_t sendCommand(mpsoc::TcBase* tc);
|
||||
ReturnValue_t handlePacketTransmission(mpsoc::TcBase& tc);
|
||||
ReturnValue_t sendCommand(mpsoc::TcBase& tc);
|
||||
ReturnValue_t receive(uint8_t* data, size_t* readBytes, size_t requestBytes);
|
||||
ReturnValue_t handleAck();
|
||||
ReturnValue_t handleExe();
|
||||
|
@ -102,6 +102,7 @@ debugging. */
|
||||
#define OBSW_STAR_TRACKER_GROUND_CONFIG 1
|
||||
#define OBSW_ENABLE_PERIODIC_HK 0
|
||||
#define OBSW_PRINT_CORE_HK 0
|
||||
#define OBSW_INITIALIZE_SWITCHES 0
|
||||
|
||||
#endif
|
||||
|
||||
@ -154,10 +155,16 @@ debugging. */
|
||||
#define OBSW_DEBUG_SYRLINKS 0
|
||||
#define OBSW_DEBUG_IMTQ 0
|
||||
#define OBSW_DEBUG_RW 0
|
||||
#define OBSW_DEBUG_PLOC_MPSOC 0
|
||||
#define OBSW_DEBUG_PLOC_SUPERVISOR 0
|
||||
#define OBSW_DEBUG_PDEC_HANDLER 0
|
||||
|
||||
#ifdef TE0720_1CFA
|
||||
#define OBSW_DEBUG_PLOC_SUPERVISOR 1
|
||||
#define OBSW_DEBUG_PLOC_MPSOC 1
|
||||
#else
|
||||
#define OBSW_DEBUG_PLOC_SUPERVISOR 0
|
||||
#define OBSW_DEBUG_PLOC_MPSOC 0
|
||||
#endif
|
||||
|
||||
#ifdef EGSE
|
||||
#define OBSW_DEBUG_STARTRACKER 1
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user