meier/deviceHandlerUpdate #192
@ -191,9 +191,8 @@ void ObjectFactory::produce(void* args) {
|
|||||||
uart::STAR_TRACKER_BAUD, startracker::MAX_FRAME_SIZE * 2 + 2);
|
uart::STAR_TRACKER_BAUD, startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||||
starTrackerCookie->setNoFixedSizeReply();
|
starTrackerCookie->setNoFixedSizeReply();
|
||||||
StrHelper* strHelper = new StrHelper(objects::STR_HELPER);
|
StrHelper* strHelper = new StrHelper(objects::STR_HELPER);
|
||||||
StarTrackerHandler* starTrackerHandler = new StarTrackerHandler(
|
new StarTrackerHandler(objects::STAR_TRACKER, objects::UART_COM_IF, starTrackerCookie, strHelper,
|
||||||
objects::STAR_TRACKER, objects::UART_COM_IF, starTrackerCookie, strHelper);
|
pcduSwitches::PDU1_CH2_STAR_TRACKER_5V);
|
||||||
starTrackerHandler->setStartUpImmediately();
|
|
||||||
|
|
||||||
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
||||||
|
|
||||||
@ -643,7 +642,8 @@ void ObjectFactory::createSyrlinksComponents() {
|
|||||||
uart::SYRLINKS_BAUD, SYRLINKS::MAX_REPLY_SIZE);
|
uart::SYRLINKS_BAUD, SYRLINKS::MAX_REPLY_SIZE);
|
||||||
syrlinksUartCookie->setParityEven();
|
syrlinksUartCookie->setParityEven();
|
||||||
|
|
||||||
new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie);
|
new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie,
|
||||||
|
pcduSwitches::PDU1_CH1_SYRLINKS_12V);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
|
void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
|
||||||
@ -661,10 +661,9 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
|
UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
|
||||||
mpsocCookie->setNoFixedSizeReply();
|
mpsocCookie->setNoFixedSizeReply();
|
||||||
auto plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
|
auto plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
|
||||||
auto plocMPSoC =
|
|
||||||
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocCookie,
|
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocCookie,
|
||||||
plocMpsocHelper, Gpio(gpioIds::ENABLE_MPSOC_UART, gpioComIF));
|
plocMpsocHelper, Gpio(gpioIds::ENABLE_MPSOC_UART, gpioComIF),
|
||||||
plocMPSoC->setStartUpImmediately();
|
objects::PLOC_SUPERVISOR_HANDLER);
|
||||||
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
|
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
|
||||||
|
|
||||||
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
||||||
@ -676,10 +675,11 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
gpioComIF->addGpios(supvGpioCookie);
|
gpioComIF->addGpios(supvGpioCookie);
|
||||||
auto supervisorCookie = new UartCookie(
|
auto supervisorCookie = new UartCookie(
|
||||||
objects::PLOC_SUPERVISOR_HANDLER, q7s::UART_PLOC_SUPERVSIOR_DEV, UartModes::NON_CANONICAL,
|
objects::PLOC_SUPERVISOR_HANDLER, q7s::UART_PLOC_SUPERVSIOR_DEV, UartModes::NON_CANONICAL,
|
||||||
uart::PLOC_SUPERVISOR_BAUD, PLOC_SPV::MAX_PACKET_SIZE * 20);
|
uart::PLOC_SUPERVISOR_BAUD, supv::MAX_PACKET_SIZE * 20);
|
||||||
supervisorCookie->setNoFixedSizeReply();
|
supervisorCookie->setNoFixedSizeReply();
|
||||||
new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF,
|
new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF,
|
||||||
supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF));
|
supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF),
|
||||||
|
pcduSwitches::PDU1_CH6_PLOC_12V);
|
||||||
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
||||||
static_cast<void>(consumer);
|
static_cast<void>(consumer);
|
||||||
}
|
}
|
||||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
|||||||
Subproject commit 127fbeb98020e091f9b5a385fd2a2ca47ccbc02f
|
Subproject commit fbf9626fde2961cf08bd88bf87f5c1bca900e287
|
@ -25,6 +25,8 @@ class MPSoCReturnValuesIF {
|
|||||||
static const ReturnValue_t MPSOC_FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xA7);
|
static const ReturnValue_t MPSOC_FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xA7);
|
||||||
//! [EXPORT] : [COMMENT] Command has invalid parameter
|
//! [EXPORT] : [COMMENT] Command has invalid parameter
|
||||||
static const ReturnValue_t INVALID_PARAMETER = MAKE_RETURN_CODE(0xA8);
|
static const ReturnValue_t INVALID_PARAMETER = MAKE_RETURN_CODE(0xA8);
|
||||||
|
//! [EXPORT] : [COMMENT] Received command has file string with invalid length
|
||||||
|
static const ReturnValue_t NAME_TOO_LONG = MAKE_RETURN_CODE(0xA9);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MPSOC_RETURN_VALUES_IF_H_ */
|
#endif /* MPSOC_RETURN_VALUES_IF_H_ */
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <fsfw/timemanager/Clock.h>
|
#include <fsfw/timemanager/Clock.h>
|
||||||
#include <fsfw/tmtcpacket/SpacePacket.h>
|
#include <fsfw/tmtcpacket/SpacePacket.h>
|
||||||
|
|
||||||
namespace PLOC_SPV {
|
namespace supv {
|
||||||
|
|
||||||
/** Command IDs */
|
/** Command IDs */
|
||||||
static const DeviceCommandId_t NONE = 0;
|
static const DeviceCommandId_t NONE = 0;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "PlocMPSoCHandler.h"
|
#include "PlocMPSoCHandler.h"
|
||||||
|
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
#include "fsfw/datapool/PoolReadGuard.h"
|
#include "fsfw/datapool/PoolReadGuard.h"
|
||||||
@ -6,14 +7,18 @@
|
|||||||
|
|
||||||
PlocMPSoCHandler::PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid,
|
PlocMPSoCHandler::PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid,
|
||||||
CookieIF* comCookie, PlocMPSoCHelper* plocMPSoCHelper,
|
CookieIF* comCookie, PlocMPSoCHelper* plocMPSoCHelper,
|
||||||
Gpio uartIsolatorSwitch)
|
Gpio uartIsolatorSwitch, object_id_t supervisorHandler)
|
||||||
: DeviceHandlerBase(objectId, uartComIFid, comCookie),
|
: DeviceHandlerBase(objectId, uartComIFid, comCookie),
|
||||||
plocMPSoCHelper(plocMPSoCHelper),
|
plocMPSoCHelper(plocMPSoCHelper),
|
||||||
uartIsolatorSwitch(uartIsolatorSwitch) {
|
uartIsolatorSwitch(uartIsolatorSwitch),
|
||||||
|
supervisorHandler(supervisorHandler),
|
||||||
|
commandActionHelper(this) {
|
||||||
if (comCookie == nullptr) {
|
if (comCookie == nullptr) {
|
||||||
sif::error << "PlocMPSoCHandler: Invalid communication cookie" << std::endl;
|
sif::error << "PlocMPSoCHandler: Invalid communication cookie" << std::endl;
|
||||||
}
|
}
|
||||||
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
||||||
|
commandActionHelperQueue =
|
||||||
|
QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlocMPSoCHandler::~PlocMPSoCHandler() {}
|
PlocMPSoCHandler::~PlocMPSoCHandler() {}
|
||||||
@ -60,6 +65,10 @@ ReturnValue_t PlocMPSoCHandler::initialize() {
|
|||||||
}
|
}
|
||||||
plocMPSoCHelper->setComCookie(comCookie);
|
plocMPSoCHelper->setComCookie(comCookie);
|
||||||
plocMPSoCHelper->setSequenceCount(&sequenceCount);
|
plocMPSoCHelper->setSequenceCount(&sequenceCount);
|
||||||
|
result = commandActionHelper.initialize();
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,6 +86,14 @@ void PlocMPSoCHandler::performOperationHook() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CommandMessage message;
|
||||||
|
for (ReturnValue_t result = commandActionHelperQueue->receiveMessage(&message); result == RETURN_OK;
|
||||||
|
result = commandActionHelperQueue->receiveMessage(&message)) {
|
||||||
|
result = commandActionHelper.handleReply(&message);
|
||||||
|
if (result == RETURN_OK) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
@ -116,17 +133,33 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlocMPSoCHandler::doStartUp() {
|
void PlocMPSoCHandler::doStartUp() {
|
||||||
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
|
switch(powerState) {
|
||||||
setMode(MODE_NORMAL);
|
case PowerState::OFF:
|
||||||
#else
|
commandActionHelper.commandAction(supervisorHandler, supv::START_MPSOC);
|
||||||
|
powerState = PowerState::BOOTING;
|
||||||
|
break;
|
||||||
|
case PowerState::ON:
|
||||||
setMode(_MODE_TO_ON);
|
setMode(_MODE_TO_ON);
|
||||||
#endif
|
|
||||||
uartIsolatorSwitch.pullHigh();
|
uartIsolatorSwitch.pullHigh();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocMPSoCHandler::doShutDown() {
|
void PlocMPSoCHandler::doShutDown() {
|
||||||
|
switch(powerState) {
|
||||||
|
case PowerState::ON:
|
||||||
uartIsolatorSwitch.pullLow();
|
uartIsolatorSwitch.pullLow();
|
||||||
|
commandActionHelper.commandAction(supervisorHandler, supv::SHUTDOWN_MPSOC);
|
||||||
|
powerState = PowerState::SHUTDOWN;
|
||||||
|
break;
|
||||||
|
case PowerState::OFF:
|
||||||
setMode(_MODE_POWER_DOWN);
|
setMode(_MODE_POWER_DOWN);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
||||||
@ -134,7 +167,7 @@ ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
ReturnValue_t PlocMPSoCHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return NOTHING_TO_SEND;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
@ -279,7 +312,7 @@ ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const
|
|||||||
|
|
||||||
void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() {}
|
void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() {}
|
||||||
|
|
||||||
uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
|
uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 5000; }
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t PlocMPSoCHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) {
|
LocalDataPoolManager& poolManager) {
|
||||||
@ -331,7 +364,7 @@ ReturnValue_t PlocMPSoCHandler::prepareTcMemRead(const uint8_t* commandData,
|
|||||||
ReturnValue_t PlocMPSoCHandler::prepareTcFlashDelete(const uint8_t* commandData,
|
ReturnValue_t PlocMPSoCHandler::prepareTcFlashDelete(const uint8_t* commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
if (commandDataLen > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) {
|
if (commandDataLen > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) {
|
||||||
return NAME_TOO_LONG;
|
return MPSoCReturnValuesIF::NAME_TOO_LONG;
|
||||||
}
|
}
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
@ -670,6 +703,66 @@ size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId) {
|
|||||||
return replyLen;
|
return replyLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageQueueIF* PlocMPSoCHandler::getCommandQueuePtr() {
|
||||||
|
return commandActionHelperQueue;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocMPSoCHandler::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocMPSoCHandler::stepFailedReceived(ActionId_t actionId, uint8_t step,
|
||||||
|
ReturnValue_t returnCode) {
|
||||||
|
switch (actionId) {
|
||||||
|
case supv::START_MPSOC:
|
||||||
|
sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to start MPSoC"
|
||||||
|
<< std::endl;
|
||||||
|
powerState = PowerState::OFF;
|
||||||
|
break;
|
||||||
|
case supv::SHUTDOWN_MPSOC:
|
||||||
|
triggerEvent(MPSOC_SHUTDOWN_FAILED);
|
||||||
|
sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to shutdown MPSoC"
|
||||||
|
<< std::endl;
|
||||||
|
// TODO: Setting state to on or off here?
|
||||||
|
powerState = PowerState::ON;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sif::debug
|
||||||
|
<< "PlocMPSoCHandler::stepFailedReceived: Received unexpected action reply"
|
||||||
|
<< std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocMPSoCHandler::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocMPSoCHandler::completionSuccessfulReceived(ActionId_t actionId) {
|
||||||
|
if (actionId != supv::EXE_REPORT) {
|
||||||
|
sif::debug << "PlocMPSoCHandler::completionSuccessfulReceived: Did not expect this action "
|
||||||
|
<< "ID" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch(powerState) {
|
||||||
|
case PowerState::BOOTING: {
|
||||||
|
powerState = PowerState::ON;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PowerState::SHUTDOWN: {
|
||||||
|
powerState = PowerState::OFF;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocMPSoCHandler::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) {
|
||||||
|
handleActionCommandFailure(actionId);
|
||||||
|
}
|
||||||
|
|
||||||
void PlocMPSoCHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
|
void PlocMPSoCHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
|
||||||
DeviceCommandId_t replyId) {
|
DeviceCommandId_t replyId) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
@ -725,7 +818,7 @@ void PlocMPSoCHandler::disableAllReplies() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We must always disable the execution report reply here */
|
/* We always need to disable the execution report reply here */
|
||||||
disableExeReportReply();
|
disableExeReportReply();
|
||||||
nextReplyId = mpsoc::NONE;
|
nextReplyId = mpsoc::NONE;
|
||||||
}
|
}
|
||||||
@ -764,3 +857,32 @@ void PlocMPSoCHandler::printStatus(const uint8_t* data) {
|
|||||||
uint16_t PlocMPSoCHandler::getStatus(const uint8_t* data) {
|
uint16_t PlocMPSoCHandler::getStatus(const uint8_t* data) {
|
||||||
return *(data + STATUS_OFFSET) << 8 | *(data + STATUS_OFFSET + 1);
|
return *(data + STATUS_OFFSET) << 8 | *(data + STATUS_OFFSET + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlocMPSoCHandler::handleActionCommandFailure(ActionId_t actionId) {
|
||||||
|
switch (actionId) {
|
||||||
|
case supv::ACK_REPORT:
|
||||||
|
case supv::EXE_REPORT:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sif::debug << "PlocMPSoCHandler::handleActionCommandFailure: Did not expect this action ID "
|
||||||
|
<< std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch(powerState) {
|
||||||
|
case PowerState::BOOTING: {
|
||||||
|
sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to boot MPSoC"
|
||||||
|
<< std::endl;
|
||||||
|
powerState = PowerState::OFF;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PowerState::SHUTDOWN: {
|
||||||
|
sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to shutdown MPSoC"
|
||||||
|
<< std::endl;
|
||||||
|
powerState = PowerState::ON;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "PlocMPSoCHelper.h"
|
#include "PlocMPSoCHelper.h"
|
||||||
|
#include "fsfw/action/CommandActionHelper.h"
|
||||||
|
#include "fsfw/action/CommandsActionsIF.h"
|
||||||
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
||||||
#include "fsfw/ipc/QueueFactory.h"
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
|
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
|
||||||
@ -26,15 +28,33 @@
|
|||||||
*
|
*
|
||||||
* @author J. Meier
|
* @author J. Meier
|
||||||
*/
|
*/
|
||||||
class PlocMPSoCHandler : public DeviceHandlerBase {
|
class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructor
|
||||||
|
*
|
||||||
|
* @param ojectId Object ID of the MPSoC handler
|
||||||
|
* @param uartcomIFid Object ID of the UART communication interface
|
||||||
|
* @param comCookie UART communication cookie
|
||||||
|
* @param plocMPSoCHelper Pointer to MPSoC helper object
|
||||||
|
* @param uartIsolatorSwitch Gpio object representing the GPIO connected to the UART isolator
|
||||||
|
* module in the programmable logic
|
||||||
|
* @param supervisorHandler Object ID of the supervisor handler
|
||||||
|
*/
|
||||||
PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie,
|
PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie,
|
||||||
PlocMPSoCHelper* plocMPSoCHelper, Gpio uartIsolatorSwitch);
|
PlocMPSoCHelper* plocMPSoCHelper, Gpio uartIsolatorSwitch,
|
||||||
|
object_id_t supervisorHandler);
|
||||||
virtual ~PlocMPSoCHandler();
|
virtual ~PlocMPSoCHandler();
|
||||||
virtual ReturnValue_t initialize() override;
|
virtual ReturnValue_t initialize() override;
|
||||||
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
const uint8_t* data, size_t size) override;
|
const uint8_t* data, size_t size) override;
|
||||||
void performOperationHook() override;
|
void performOperationHook() override;
|
||||||
|
MessageQueueIF* getCommandQueuePtr() override;
|
||||||
|
void stepSuccessfulReceived(ActionId_t actionId, uint8_t step) override;
|
||||||
|
void stepFailedReceived(ActionId_t actionId, uint8_t step, ReturnValue_t returnCode) override;
|
||||||
|
void dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) override;
|
||||||
|
void completionSuccessfulReceived(ActionId_t actionId) override;
|
||||||
|
void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void doStartUp() override;
|
void doStartUp() override;
|
||||||
@ -74,15 +94,16 @@ class PlocMPSoCHandler : public DeviceHandlerBase {
|
|||||||
//! [EXPORT] : [COMMENT] Packet sequence count in received space packet does not match expected
|
//! [EXPORT] : [COMMENT] Packet sequence count in received space packet does not match expected
|
||||||
//! count P1: Expected sequence count P2: Received sequence count
|
//! count P1: Expected sequence count P2: Received sequence count
|
||||||
static const Event MPSOC_HANDLER_SEQ_CNT_MISMATCH = MAKE_EVENT(5, severity::LOW);
|
static const Event MPSOC_HANDLER_SEQ_CNT_MISMATCH = MAKE_EVENT(5, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and
|
||||||
//! [EXPORT] : [COMMENT] Received command has file string with invalid length
|
//! thus also to shutdown the supervisor.
|
||||||
static const ReturnValue_t NAME_TOO_LONG = MAKE_RETURN_CODE(0xD0);
|
static const Event MPSOC_SHUTDOWN_FAILED = MAKE_EVENT(6, severity::HIGH);
|
||||||
|
|
||||||
static const uint16_t APID_MASK = 0x7FF;
|
static const uint16_t APID_MASK = 0x7FF;
|
||||||
static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
|
static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
|
||||||
static const uint8_t STATUS_OFFSET = 10;
|
static const uint8_t STATUS_OFFSET = 10;
|
||||||
|
|
||||||
MessageQueueIF* eventQueue = nullptr;
|
MessageQueueIF* eventQueue = nullptr;
|
||||||
|
MessageQueueIF* commandActionHelperQueue = nullptr;
|
||||||
|
|
||||||
SourceSequenceCounter sequenceCount;
|
SourceSequenceCounter sequenceCount;
|
||||||
|
|
||||||
@ -99,6 +120,8 @@ class PlocMPSoCHandler : public DeviceHandlerBase {
|
|||||||
|
|
||||||
PlocMPSoCHelper* plocMPSoCHelper = nullptr;
|
PlocMPSoCHelper* plocMPSoCHelper = nullptr;
|
||||||
Gpio uartIsolatorSwitch;
|
Gpio uartIsolatorSwitch;
|
||||||
|
object_id_t supervisorHandler = 0;
|
||||||
|
CommandActionHelper commandActionHelper;
|
||||||
|
|
||||||
// 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;
|
||||||
@ -111,6 +134,10 @@ class PlocMPSoCHandler : public DeviceHandlerBase {
|
|||||||
|
|
||||||
TmMemReadReport tmMemReadReport;
|
TmMemReadReport tmMemReadReport;
|
||||||
|
|
||||||
|
enum class PowerState { OFF, BOOTING, SHUTDOWN, ON };
|
||||||
|
|
||||||
|
PowerState powerState = PowerState::OFF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Handles events received from the PLOC MPSoC helper
|
* @brief Handles events received from the PLOC MPSoC helper
|
||||||
*/
|
*/
|
||||||
@ -212,6 +239,8 @@ class PlocMPSoCHandler : public DeviceHandlerBase {
|
|||||||
ReturnValue_t prepareTcModeReplay();
|
ReturnValue_t prepareTcModeReplay();
|
||||||
|
|
||||||
uint16_t getStatus(const uint8_t* data);
|
uint16_t getStatus(const uint8_t* data);
|
||||||
|
|
||||||
|
void handleActionCommandFailure(ActionId_t actionId);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ */
|
#endif /* BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ */
|
||||||
|
@ -105,10 +105,10 @@ void PlocMemoryDumper::doStateMachine() {
|
|||||||
case State::IDLE:
|
case State::IDLE:
|
||||||
break;
|
break;
|
||||||
case State::COMMAND_FIRST_MRAM_DUMP:
|
case State::COMMAND_FIRST_MRAM_DUMP:
|
||||||
commandNextMramDump(PLOC_SPV::FIRST_MRAM_DUMP);
|
commandNextMramDump(supv::FIRST_MRAM_DUMP);
|
||||||
break;
|
break;
|
||||||
case State::COMMAND_CONSECUTIVE_MRAM_DUMP:
|
case State::COMMAND_CONSECUTIVE_MRAM_DUMP:
|
||||||
commandNextMramDump(PLOC_SPV::CONSECUTIVE_MRAM_DUMP);
|
commandNextMramDump(supv::CONSECUTIVE_MRAM_DUMP);
|
||||||
break;
|
break;
|
||||||
case State::EXECUTING_MRAM_DUMP:
|
case State::EXECUTING_MRAM_DUMP:
|
||||||
break;
|
break;
|
||||||
@ -127,8 +127,8 @@ void PlocMemoryDumper::dataReceived(ActionId_t actionId, const uint8_t* data, ui
|
|||||||
|
|
||||||
void PlocMemoryDumper::completionSuccessfulReceived(ActionId_t actionId) {
|
void PlocMemoryDumper::completionSuccessfulReceived(ActionId_t actionId) {
|
||||||
switch (pendingCommand) {
|
switch (pendingCommand) {
|
||||||
case (PLOC_SPV::FIRST_MRAM_DUMP):
|
case (supv::FIRST_MRAM_DUMP):
|
||||||
case (PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
|
case (supv::CONSECUTIVE_MRAM_DUMP):
|
||||||
if (mram.endAddress == mram.startAddress) {
|
if (mram.endAddress == mram.startAddress) {
|
||||||
triggerEvent(MRAM_DUMP_FINISHED);
|
triggerEvent(MRAM_DUMP_FINISHED);
|
||||||
state = State::IDLE;
|
state = State::IDLE;
|
||||||
@ -146,8 +146,8 @@ void PlocMemoryDumper::completionSuccessfulReceived(ActionId_t actionId) {
|
|||||||
|
|
||||||
void PlocMemoryDumper::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) {
|
void PlocMemoryDumper::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) {
|
||||||
switch (pendingCommand) {
|
switch (pendingCommand) {
|
||||||
case (PLOC_SPV::FIRST_MRAM_DUMP):
|
case (supv::FIRST_MRAM_DUMP):
|
||||||
case (PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
|
case (supv::CONSECUTIVE_MRAM_DUMP):
|
||||||
triggerEvent(MRAM_DUMP_FAILED, mram.lastStartAddress);
|
triggerEvent(MRAM_DUMP_FAILED, mram.lastStartAddress);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -25,7 +25,7 @@
|
|||||||
class PlocSupervisorHandler : public DeviceHandlerBase {
|
class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||||
public:
|
public:
|
||||||
PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie,
|
PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie,
|
||||||
Gpio uartIsolatorSwitch);
|
Gpio uartIsolatorSwitch, power::Switch_t powerSwitch);
|
||||||
virtual ~PlocSupervisorHandler();
|
virtual ~PlocSupervisorHandler();
|
||||||
|
|
||||||
virtual ReturnValue_t initialize() override;
|
virtual ReturnValue_t initialize() override;
|
||||||
@ -105,24 +105,24 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
static const uint16_t APID_MASK = 0x7FF;
|
static const uint16_t APID_MASK = 0x7FF;
|
||||||
static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
|
static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
|
||||||
|
|
||||||
uint8_t commandBuffer[PLOC_SPV::MAX_COMMAND_SIZE];
|
uint8_t commandBuffer[supv::MAX_COMMAND_SIZE];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This variable is used to store the id of the next reply to receive. This is necessary
|
* This variable is used to store the id of the next reply to receive. This is necessary
|
||||||
* because the PLOC sends as reply to each command at least one acknowledgment and execution
|
* because the PLOC sends as reply to each command at least one acknowledgment and execution
|
||||||
* report.
|
* report.
|
||||||
*/
|
*/
|
||||||
DeviceCommandId_t nextReplyId = PLOC_SPV::NONE;
|
DeviceCommandId_t nextReplyId = supv::NONE;
|
||||||
|
|
||||||
UartComIF* uartComIf = nullptr;
|
UartComIF* uartComIf = nullptr;
|
||||||
LinuxLibgpioIF* gpioComIF = nullptr;
|
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||||
Gpio uartIsolatorSwitch;
|
Gpio uartIsolatorSwitch;
|
||||||
|
|
||||||
PLOC_SPV::HkSet hkset;
|
supv::HkSet hkset;
|
||||||
PLOC_SPV::BootStatusReport bootStatusReport;
|
supv::BootStatusReport bootStatusReport;
|
||||||
PLOC_SPV::LatchupStatusReport latchupStatusReport;
|
supv::LatchupStatusReport latchupStatusReport;
|
||||||
|
|
||||||
const power::Switch_t powerSwitch = pcduSwitches::PDU1_CH6_PLOC_12V;
|
const power::Switch_t powerSwitch = power::NO_SWITCH;
|
||||||
|
|
||||||
/** Number of expected replies following the MRAM dump command */
|
/** Number of expected replies following the MRAM dump command */
|
||||||
uint32_t expectedMramDumpPackets = 0;
|
uint32_t expectedMramDumpPackets = 0;
|
||||||
@ -133,7 +133,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
uint16_t bufferTop = 0;
|
uint16_t bufferTop = 0;
|
||||||
|
|
||||||
/** This buffer is used to concatenate space packets received in two different read steps */
|
/** This buffer is used to concatenate space packets received in two different read steps */
|
||||||
uint8_t spacePacketBuffer[PLOC_SPV::MAX_PACKET_SIZE];
|
uint8_t spacePacketBuffer[supv::MAX_PACKET_SIZE];
|
||||||
|
|
||||||
#ifdef TE0720_1CFA
|
#ifdef TE0720_1CFA
|
||||||
SdCardManager* sdcMan = nullptr;
|
SdCardManager* sdcMan = nullptr;
|
||||||
|
@ -123,9 +123,6 @@ void PlocUpdater::readCommandQueue() {
|
|||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
sif::debug << "PlocUpdater::readCommandQueue: Received message with invalid format"
|
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +142,6 @@ void PlocUpdater::doStateMachine() {
|
|||||||
case State::COMMAND_EXECUTING:
|
case State::COMMAND_EXECUTING:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sif::debug << "PlocUpdater::doStateMachine: Invalid state" << std::endl;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,10 +195,10 @@ void PlocUpdater::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_
|
|||||||
|
|
||||||
void PlocUpdater::completionSuccessfulReceived(ActionId_t actionId) {
|
void PlocUpdater::completionSuccessfulReceived(ActionId_t actionId) {
|
||||||
switch (pendingCommand) {
|
switch (pendingCommand) {
|
||||||
case (PLOC_SPV::UPDATE_AVAILABLE):
|
case (supv::UPDATE_AVAILABLE):
|
||||||
state = State::UPDATE_TRANSFER;
|
state = State::UPDATE_TRANSFER;
|
||||||
break;
|
break;
|
||||||
case (PLOC_SPV::UPDATE_IMAGE_DATA):
|
case (supv::UPDATE_IMAGE_DATA):
|
||||||
if (remainingPackets == 0) {
|
if (remainingPackets == 0) {
|
||||||
packetsSent = 0; // Reset packets sent variable for next update sequence
|
packetsSent = 0; // Reset packets sent variable for next update sequence
|
||||||
state = State::UPDATE_VERIFY;
|
state = State::UPDATE_VERIFY;
|
||||||
@ -210,14 +206,12 @@ void PlocUpdater::completionSuccessfulReceived(ActionId_t actionId) {
|
|||||||
state = State::UPDATE_TRANSFER;
|
state = State::UPDATE_TRANSFER;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (PLOC_SPV::UPDATE_VERIFY):
|
case (supv::UPDATE_VERIFY):
|
||||||
triggerEvent(UPDATE_FINISHED);
|
triggerEvent(UPDATE_FINISHED);
|
||||||
state = State::IDLE;
|
state = State::IDLE;
|
||||||
pendingCommand = PLOC_SPV::NONE;
|
pendingCommand = supv::NONE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sif::debug << "PlocUpdater::completionSuccessfulReceived: Invalid pending command"
|
|
||||||
<< std::endl;
|
|
||||||
state = State::IDLE;
|
state = State::IDLE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -225,20 +219,19 @@ void PlocUpdater::completionSuccessfulReceived(ActionId_t actionId) {
|
|||||||
|
|
||||||
void PlocUpdater::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) {
|
void PlocUpdater::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) {
|
||||||
switch (pendingCommand) {
|
switch (pendingCommand) {
|
||||||
case (PLOC_SPV::UPDATE_AVAILABLE): {
|
case (supv::UPDATE_AVAILABLE): {
|
||||||
triggerEvent(UPDATE_AVAILABLE_FAILED);
|
triggerEvent(UPDATE_AVAILABLE_FAILED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (PLOC_SPV::UPDATE_IMAGE_DATA): {
|
case (supv::UPDATE_IMAGE_DATA): {
|
||||||
triggerEvent(UPDATE_TRANSFER_FAILED, packetsSent);
|
triggerEvent(UPDATE_TRANSFER_FAILED, packetsSent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (PLOC_SPV::UPDATE_VERIFY): {
|
case (supv::UPDATE_VERIFY): {
|
||||||
triggerEvent(UPDATE_VERIFY_FAILED);
|
triggerEvent(UPDATE_VERIFY_FAILED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
sif::debug << "PlocUpdater::completionFailedReceived: Invalid pending command " << std::endl;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
state = State::IDLE;
|
state = State::IDLE;
|
||||||
@ -268,23 +261,23 @@ void PlocUpdater::commandUpdateAvailable() {
|
|||||||
|
|
||||||
calcImageCrc();
|
calcImageCrc();
|
||||||
|
|
||||||
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_AVAILABLE, static_cast<uint8_t>(image),
|
supv::UpdateInfo packet(supv::APID_UPDATE_AVAILABLE, static_cast<uint8_t>(image),
|
||||||
static_cast<uint8_t>(partition), imageSize, imageCrc,
|
static_cast<uint8_t>(partition), imageSize, imageCrc,
|
||||||
numOfUpdatePackets);
|
numOfUpdatePackets);
|
||||||
|
|
||||||
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
||||||
PLOC_SPV::UPDATE_AVAILABLE, packet.getWholeData(),
|
supv::UPDATE_AVAILABLE, packet.getWholeData(),
|
||||||
packet.getFullSize());
|
packet.getFullSize());
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
|
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
|
||||||
<< " packet to supervisor handler" << std::endl;
|
<< " packet to supervisor handler" << std::endl;
|
||||||
triggerEvent(ACTION_COMMANDING_FAILED, result, PLOC_SPV::UPDATE_AVAILABLE);
|
triggerEvent(ACTION_COMMANDING_FAILED, result, supv::UPDATE_AVAILABLE);
|
||||||
state = State::IDLE;
|
state = State::IDLE;
|
||||||
pendingCommand = PLOC_SPV::NONE;
|
pendingCommand = supv::NONE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pendingCommand = PLOC_SPV::UPDATE_AVAILABLE;
|
pendingCommand = supv::UPDATE_AVAILABLE;
|
||||||
state = State::COMMAND_EXECUTING;
|
state = State::COMMAND_EXECUTING;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -308,56 +301,56 @@ void PlocUpdater::commandUpdatePacket() {
|
|||||||
payloadLength = MAX_SP_DATA;
|
payloadLength = MAX_SP_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
PLOC_SPV::UpdatePacket packet(payloadLength);
|
supv::UpdatePacket packet(payloadLength);
|
||||||
file.read(reinterpret_cast<char*>(packet.getDataFieldPointer()), payloadLength);
|
file.read(reinterpret_cast<char*>(packet.getDataFieldPointer()), payloadLength);
|
||||||
file.close();
|
file.close();
|
||||||
// sequence count of first packet is 1
|
// sequence count of first packet is 1
|
||||||
packet.setPacketSequenceCount((packetsSent + 1) & PLOC_SPV::SEQUENCE_COUNT_MASK);
|
packet.setPacketSequenceCount((packetsSent + 1) & supv::SEQUENCE_COUNT_MASK);
|
||||||
if (numOfUpdatePackets > 1) {
|
if (numOfUpdatePackets > 1) {
|
||||||
adjustSequenceFlags(packet);
|
adjustSequenceFlags(packet);
|
||||||
}
|
}
|
||||||
packet.makeCrc();
|
packet.makeCrc();
|
||||||
|
|
||||||
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
||||||
PLOC_SPV::UPDATE_IMAGE_DATA, packet.getWholeData(),
|
supv::UPDATE_IMAGE_DATA, packet.getWholeData(),
|
||||||
packet.getFullSize());
|
packet.getFullSize());
|
||||||
|
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update"
|
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update"
|
||||||
<< " packet to supervisor handler" << std::endl;
|
<< " packet to supervisor handler" << std::endl;
|
||||||
triggerEvent(ACTION_COMMANDING_FAILED, result, PLOC_SPV::UPDATE_IMAGE_DATA);
|
triggerEvent(ACTION_COMMANDING_FAILED, result, supv::UPDATE_IMAGE_DATA);
|
||||||
state = State::IDLE;
|
state = State::IDLE;
|
||||||
pendingCommand = PLOC_SPV::NONE;
|
pendingCommand = supv::NONE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
remainingPackets--;
|
remainingPackets--;
|
||||||
packetsSent++;
|
packetsSent++;
|
||||||
|
|
||||||
pendingCommand = PLOC_SPV::UPDATE_IMAGE_DATA;
|
pendingCommand = supv::UPDATE_IMAGE_DATA;
|
||||||
state = State::COMMAND_EXECUTING;
|
state = State::COMMAND_EXECUTING;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocUpdater::commandUpdateVerify() {
|
void PlocUpdater::commandUpdateVerify() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_VERIFY, static_cast<uint8_t>(image),
|
supv::UpdateInfo packet(supv::APID_UPDATE_VERIFY, static_cast<uint8_t>(image),
|
||||||
static_cast<uint8_t>(partition), imageSize, imageCrc,
|
static_cast<uint8_t>(partition), imageSize, imageCrc,
|
||||||
numOfUpdatePackets);
|
numOfUpdatePackets);
|
||||||
|
|
||||||
result =
|
result =
|
||||||
commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, PLOC_SPV::UPDATE_VERIFY,
|
commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, supv::UPDATE_VERIFY,
|
||||||
packet.getWholeData(), packet.getFullSize());
|
packet.getWholeData(), packet.getFullSize());
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
|
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
|
||||||
<< " packet to supervisor handler" << std::endl;
|
<< " packet to supervisor handler" << std::endl;
|
||||||
triggerEvent(ACTION_COMMANDING_FAILED, result, PLOC_SPV::UPDATE_VERIFY);
|
triggerEvent(ACTION_COMMANDING_FAILED, result, supv::UPDATE_VERIFY);
|
||||||
state = State::IDLE;
|
state = State::IDLE;
|
||||||
pendingCommand = PLOC_SPV::NONE;
|
pendingCommand = supv::NONE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state = State::COMMAND_EXECUTING;
|
state = State::COMMAND_EXECUTING;
|
||||||
pendingCommand = PLOC_SPV::UPDATE_VERIFY;
|
pendingCommand = supv::UPDATE_VERIFY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,12 +377,12 @@ void PlocUpdater::calcImageCrc() {
|
|||||||
imageCrc = (remainder ^ FINAL_XOR_VALUE_32);
|
imageCrc = (remainder ^ FINAL_XOR_VALUE_32);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocUpdater::adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet) {
|
void PlocUpdater::adjustSequenceFlags(supv::UpdatePacket& packet) {
|
||||||
if (packetsSent == 0) {
|
if (packetsSent == 0) {
|
||||||
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT));
|
packet.setSequenceFlags(static_cast<uint8_t>(supv::SequenceFlags::FIRST_PKT));
|
||||||
} else if (remainingPackets == 1) {
|
} else if (remainingPackets == 1) {
|
||||||
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::LAST_PKT));
|
packet.setSequenceFlags(static_cast<uint8_t>(supv::SequenceFlags::LAST_PKT));
|
||||||
} else {
|
} else {
|
||||||
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::CONTINUED_PKT));
|
packet.setSequenceFlags(static_cast<uint8_t>(supv::SequenceFlags::CONTINUED_PKT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ class PlocUpdater : public SystemObject,
|
|||||||
|
|
||||||
State state = State::IDLE;
|
State state = State::IDLE;
|
||||||
|
|
||||||
ActionId_t pendingCommand = PLOC_SPV::NONE;
|
ActionId_t pendingCommand = supv::NONE;
|
||||||
|
|
||||||
enum class Image : uint8_t { NONE, A, B };
|
enum class Image : uint8_t { NONE, A, B };
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ class PlocUpdater : public SystemObject,
|
|||||||
|
|
||||||
void calcImageCrc();
|
void calcImageCrc();
|
||||||
|
|
||||||
void adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet);
|
void adjustSequenceFlags(supv::UpdatePacket& packet);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_DEVICES_PLOCUPDATER_H_ */
|
#endif /* MISSION_DEVICES_PLOCUPDATER_H_ */
|
||||||
|
@ -15,7 +15,7 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StarTrackerHandler::StarTrackerHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
|
StarTrackerHandler::StarTrackerHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
|
||||||
StrHelper* strHelper)
|
StrHelper* strHelper, power::Switch_t powerSwitch)
|
||||||
: DeviceHandlerBase(objectId, comIF, comCookie),
|
: DeviceHandlerBase(objectId, comIF, comCookie),
|
||||||
temperatureSet(this),
|
temperatureSet(this),
|
||||||
versionSet(this),
|
versionSet(this),
|
||||||
@ -39,7 +39,8 @@ StarTrackerHandler::StarTrackerHandler(object_id_t objectId, object_id_t comIF,
|
|||||||
subscriptionSet(this),
|
subscriptionSet(this),
|
||||||
logSubscriptionSet(this),
|
logSubscriptionSet(this),
|
||||||
debugCameraSet(this),
|
debugCameraSet(this),
|
||||||
strHelper(strHelper) {
|
strHelper(strHelper),
|
||||||
|
powerSwitch(powerSwitch) {
|
||||||
if (comCookie == nullptr) {
|
if (comCookie == nullptr) {
|
||||||
sif::error << "StarTrackerHandler: Invalid com cookie" << std::endl;
|
sif::error << "StarTrackerHandler: Invalid com cookie" << std::endl;
|
||||||
}
|
}
|
||||||
@ -1223,6 +1224,15 @@ ReturnValue_t StarTrackerHandler::doSendReadHook() {
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t StarTrackerHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) {
|
||||||
|
if (powerSwitch == power::NO_SWITCH) {
|
||||||
|
return DeviceHandlerBase::NO_SWITCH;
|
||||||
|
}
|
||||||
|
*numberOfSwitches = 1;
|
||||||
|
*switches = &powerSwitch;
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::checkMode(ActionId_t actionId) {
|
ReturnValue_t StarTrackerHandler::checkMode(ActionId_t actionId) {
|
||||||
switch (actionId) {
|
switch (actionId) {
|
||||||
case startracker::UPLOAD_IMAGE:
|
case startracker::UPLOAD_IMAGE:
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "fsfw/timemanager/Countdown.h"
|
#include "fsfw/timemanager/Countdown.h"
|
||||||
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
||||||
#include "thirdparty/arcsec_star_tracker/common/SLIP.h"
|
#include "thirdparty/arcsec_star_tracker/common/SLIP.h"
|
||||||
|
#include "devices/powerSwitcherList.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is the device handler for the star tracker from arcsec.
|
* @brief This is the device handler for the star tracker from arcsec.
|
||||||
@ -34,7 +35,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
|
|||||||
* to high to enable the device.
|
* to high to enable the device.
|
||||||
*/
|
*/
|
||||||
StarTrackerHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
|
StarTrackerHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
|
||||||
StrHelper* strHelper);
|
StrHelper* strHelper, power::Switch_t powerSwitch);
|
||||||
virtual ~StarTrackerHandler();
|
virtual ~StarTrackerHandler();
|
||||||
|
|
||||||
ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
@ -75,6 +76,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
|
|||||||
*/
|
*/
|
||||||
virtual size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
|
virtual size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
|
||||||
virtual ReturnValue_t doSendReadHook() override;
|
virtual ReturnValue_t doSendReadHook() override;
|
||||||
|
ReturnValue_t getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) override;
|
||||||
virtual void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override;
|
virtual void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -161,14 +163,12 @@ class StarTrackerHandler : public DeviceHandlerBase {
|
|||||||
static const uint32_t BOOT_TIMEOUT = 1000;
|
static const uint32_t BOOT_TIMEOUT = 1000;
|
||||||
static const uint32_t DEFAULT_TRANSITION_DELAY = 15000;
|
static const uint32_t DEFAULT_TRANSITION_DELAY = 15000;
|
||||||
|
|
||||||
class FlashReadCmd {
|
struct FlashReadCmd {
|
||||||
public:
|
|
||||||
// Minimum length of a read command (region, length and filename)
|
// Minimum length of a read command (region, length and filename)
|
||||||
static const size_t MIN_LENGTH = 7;
|
static const size_t MIN_LENGTH = 7;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ChecksumCmd {
|
struct ChecksumCmd {
|
||||||
public:
|
|
||||||
static const uint8_t ADDRESS_OFFSET = 1;
|
static const uint8_t ADDRESS_OFFSET = 1;
|
||||||
static const uint8_t LENGTH_OFFSET = 5;
|
static const uint8_t LENGTH_OFFSET = 5;
|
||||||
// Length of checksum command
|
// Length of checksum command
|
||||||
@ -268,6 +268,8 @@ class StarTrackerHandler : public DeviceHandlerBase {
|
|||||||
|
|
||||||
bool strHelperExecuting = false;
|
bool strHelperExecuting = false;
|
||||||
|
|
||||||
|
const power::Switch_t powerSwitch = power::NO_SWITCH;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Handles internal state
|
* @brief Handles internal state
|
||||||
*/
|
*/
|
||||||
|
@ -326,6 +326,7 @@ void PdecHandler::handleNewTc() {
|
|||||||
printTC(tcLength);
|
printTC(tcLength);
|
||||||
#endif /* OBSW_DEBUG_PDEC_HANDLER */
|
#endif /* OBSW_DEBUG_PDEC_HANDLER */
|
||||||
|
|
||||||
|
#if OBSW_TC_FROM_PDEC == 1
|
||||||
store_address_t storeId;
|
store_address_t storeId;
|
||||||
result = tcStore->addData(&storeId, tcSegment + 1, tcLength - 1);
|
result = tcStore->addData(&storeId, tcSegment + 1, tcLength - 1);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
@ -343,6 +344,7 @@ void PdecHandler::handleNewTc() {
|
|||||||
tcStore->deleteData(storeId);
|
tcStore->deleteData(storeId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif /* OBSW_TC_FROM_PDEC == 1 */
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -91,6 +91,16 @@ ReturnValue_t RadiationSensorHandler::buildCommandFromCommand(DeviceCommandId_t
|
|||||||
rawPacketLen = RAD_SENSOR::READ_SIZE;
|
rawPacketLen = RAD_SENSOR::READ_SIZE;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
case RAD_SENSOR::ENABLE_DEBUG_OUTPUT: {
|
||||||
|
printPeriodicData = true;
|
||||||
|
rawPacketLen = 0;
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
case RAD_SENSOR::DISABLE_DEBUG_OUTPUT: {
|
||||||
|
rawPacketLen = 0;
|
||||||
|
printPeriodicData = false;
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
@ -100,6 +110,8 @@ ReturnValue_t RadiationSensorHandler::buildCommandFromCommand(DeviceCommandId_t
|
|||||||
void RadiationSensorHandler::fillCommandAndReplyMap() {
|
void RadiationSensorHandler::fillCommandAndReplyMap() {
|
||||||
this->insertInCommandMap(RAD_SENSOR::WRITE_SETUP);
|
this->insertInCommandMap(RAD_SENSOR::WRITE_SETUP);
|
||||||
this->insertInCommandMap(RAD_SENSOR::START_CONVERSION);
|
this->insertInCommandMap(RAD_SENSOR::START_CONVERSION);
|
||||||
|
this->insertInCommandMap(RAD_SENSOR::ENABLE_DEBUG_OUTPUT);
|
||||||
|
this->insertInCommandMap(RAD_SENSOR::DISABLE_DEBUG_OUTPUT);
|
||||||
this->insertInCommandAndReplyMap(RAD_SENSOR::READ_CONVERSIONS, 1, &dataset,
|
this->insertInCommandAndReplyMap(RAD_SENSOR::READ_CONVERSIONS, 1, &dataset,
|
||||||
RAD_SENSOR::READ_SIZE);
|
RAD_SENSOR::READ_SIZE);
|
||||||
}
|
}
|
||||||
@ -111,18 +123,23 @@ ReturnValue_t RadiationSensorHandler::scanForReply(const uint8_t *start, size_t
|
|||||||
switch (*foundId) {
|
switch (*foundId) {
|
||||||
case RAD_SENSOR::START_CONVERSION:
|
case RAD_SENSOR::START_CONVERSION:
|
||||||
case RAD_SENSOR::WRITE_SETUP:
|
case RAD_SENSOR::WRITE_SETUP:
|
||||||
|
*foundLen = remainingSize;
|
||||||
return IGNORE_REPLY_DATA;
|
return IGNORE_REPLY_DATA;
|
||||||
case RAD_SENSOR::READ_CONVERSIONS: {
|
case RAD_SENSOR::READ_CONVERSIONS: {
|
||||||
ReturnValue_t result = gpioIF->pullLow(gpioIds::ENABLE_RADFET);
|
ReturnValue_t result = gpioIF->pullLow(gpioIds::ENABLE_RADFET);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
#if OBSW_VERBOSE_LEVEL >= 1
|
#if OBSW_VERBOSE_LEVEL >= 1
|
||||||
sif::warning << "RadiationSensorHandler::buildCommandFromCommand; Pulling RADFET Enale pin "
|
sif::warning << "RadiationSensorHandler::scanForReply; Pulling RADFET Enale pin "
|
||||||
"low failed"
|
"low failed"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case RAD_SENSOR::ENABLE_DEBUG_OUTPUT:
|
||||||
|
case RAD_SENSOR::DISABLE_DEBUG_OUTPUT:
|
||||||
|
sif::info << "RadiationSensorHandler::scanForReply: " << remainingSize << std::endl;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,12 @@
|
|||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
|
|
||||||
SyrlinksHkHandler::SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie)
|
SyrlinksHkHandler::SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
|
||||||
: DeviceHandlerBase(objectId, comIF, comCookie), rxDataset(this), txDataset(this) {
|
power::Switch_t powerSwitch)
|
||||||
|
: DeviceHandlerBase(objectId, comIF, comCookie),
|
||||||
|
rxDataset(this),
|
||||||
|
txDataset(this),
|
||||||
|
powerSwitch(powerSwitch) {
|
||||||
if (comCookie == NULL) {
|
if (comCookie == NULL) {
|
||||||
sif::error << "SyrlinksHkHandler: Invalid com cookie" << std::endl;
|
sif::error << "SyrlinksHkHandler: Invalid com cookie" << std::endl;
|
||||||
}
|
}
|
||||||
@ -41,6 +45,22 @@ ReturnValue_t SyrlinksHkHandler::buildNormalDeviceCommand(DeviceCommandId_t* id)
|
|||||||
break;
|
break;
|
||||||
case (SYRLINKS::READ_TX_AGC_VALUE_LOW_BYTE):
|
case (SYRLINKS::READ_TX_AGC_VALUE_LOW_BYTE):
|
||||||
*id = SYRLINKS::READ_TX_AGC_VALUE_LOW_BYTE;
|
*id = SYRLINKS::READ_TX_AGC_VALUE_LOW_BYTE;
|
||||||
|
nextCommand = SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE;
|
||||||
|
break;
|
||||||
|
case (SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE):
|
||||||
|
*id = SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE;
|
||||||
|
nextCommand = SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE;
|
||||||
|
break;
|
||||||
|
case (SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE):
|
||||||
|
*id = SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE;
|
||||||
|
nextCommand = SYRLINKS::TEMP_BASEBAND_BOARD_HIGH_BYTE;
|
||||||
|
break;
|
||||||
|
case (SYRLINKS::TEMP_BASEBAND_BOARD_HIGH_BYTE):
|
||||||
|
*id = SYRLINKS::TEMP_BASEBAND_BOARD_HIGH_BYTE;
|
||||||
|
nextCommand = SYRLINKS::TEMP_BASEBAND_BOARD_LOW_BYTE;
|
||||||
|
break;
|
||||||
|
case (SYRLINKS::TEMP_BASEBAND_BOARD_LOW_BYTE):
|
||||||
|
*id = SYRLINKS::TEMP_BASEBAND_BOARD_LOW_BYTE;
|
||||||
nextCommand = SYRLINKS::READ_RX_STATUS_REGISTERS;
|
nextCommand = SYRLINKS::READ_RX_STATUS_REGISTERS;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -84,6 +104,12 @@ ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(DeviceCommandId_t devic
|
|||||||
rawPacket = commandBuffer;
|
rawPacket = commandBuffer;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
case (SYRLINKS::WRITE_LCL_CONFIG): {
|
||||||
|
writeLclConfig.copy(reinterpret_cast<char*>(commandBuffer), writeLclConfig.size(), 0);
|
||||||
|
rawPacketLen = writeLclConfig.size();
|
||||||
|
rawPacket = commandBuffer;
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
case (SYRLINKS::READ_RX_STATUS_REGISTERS): {
|
case (SYRLINKS::READ_RX_STATUS_REGISTERS): {
|
||||||
readRxStatusRegCommand.copy(reinterpret_cast<char*>(commandBuffer),
|
readRxStatusRegCommand.copy(reinterpret_cast<char*>(commandBuffer),
|
||||||
readRxStatusRegCommand.size(), 0);
|
readRxStatusRegCommand.size(), 0);
|
||||||
@ -91,6 +117,13 @@ ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(DeviceCommandId_t devic
|
|||||||
rawPacket = commandBuffer;
|
rawPacket = commandBuffer;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
case (SYRLINKS::READ_LCL_CONFIG): {
|
||||||
|
readLclConfig.copy(reinterpret_cast<char*>(commandBuffer), readLclConfig.size(), 0);
|
||||||
|
rawPacketLen = readLclConfig.size();
|
||||||
|
rawPacket = commandBuffer;
|
||||||
|
rememberCommandId = SYRLINKS::READ_LCL_CONFIG;
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
case (SYRLINKS::READ_TX_STATUS): {
|
case (SYRLINKS::READ_TX_STATUS): {
|
||||||
readTxStatus.copy(reinterpret_cast<char*>(commandBuffer), readTxStatus.size(), 0);
|
readTxStatus.copy(reinterpret_cast<char*>(commandBuffer), readTxStatus.size(), 0);
|
||||||
rawPacketLen = readTxStatus.size();
|
rawPacketLen = readTxStatus.size();
|
||||||
@ -99,26 +132,53 @@ ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(DeviceCommandId_t devic
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
case (SYRLINKS::READ_TX_WAVEFORM): {
|
case (SYRLINKS::READ_TX_WAVEFORM): {
|
||||||
readTxWaveform.copy(reinterpret_cast<char*>(commandBuffer), readTxStatus.size(), 0);
|
readTxWaveform.copy(reinterpret_cast<char*>(commandBuffer), readTxWaveform.size(), 0);
|
||||||
rawPacketLen = readTxWaveform.size();
|
rawPacketLen = readTxWaveform.size();
|
||||||
rememberCommandId = SYRLINKS::READ_TX_WAVEFORM;
|
rememberCommandId = SYRLINKS::READ_TX_WAVEFORM;
|
||||||
rawPacket = commandBuffer;
|
rawPacket = commandBuffer;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
case (SYRLINKS::READ_TX_AGC_VALUE_HIGH_BYTE): {
|
case (SYRLINKS::READ_TX_AGC_VALUE_HIGH_BYTE): {
|
||||||
readTxAgcValueHighByte.copy(reinterpret_cast<char*>(commandBuffer), readTxStatus.size(), 0);
|
readTxAgcValueHighByte.copy(reinterpret_cast<char*>(commandBuffer), readTxAgcValueHighByte.size(), 0);
|
||||||
rawPacketLen = readTxAgcValueHighByte.size();
|
rawPacketLen = readTxAgcValueHighByte.size();
|
||||||
rememberCommandId = SYRLINKS::READ_TX_AGC_VALUE_HIGH_BYTE;
|
rememberCommandId = SYRLINKS::READ_TX_AGC_VALUE_HIGH_BYTE;
|
||||||
rawPacket = commandBuffer;
|
rawPacket = commandBuffer;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
case (SYRLINKS::READ_TX_AGC_VALUE_LOW_BYTE): {
|
case (SYRLINKS::READ_TX_AGC_VALUE_LOW_BYTE): {
|
||||||
readTxAgcValueLowByte.copy(reinterpret_cast<char*>(commandBuffer), readTxStatus.size(), 0);
|
readTxAgcValueLowByte.copy(reinterpret_cast<char*>(commandBuffer), readTxAgcValueLowByte.size(), 0);
|
||||||
rawPacketLen = readTxAgcValueLowByte.size();
|
rawPacketLen = readTxAgcValueLowByte.size();
|
||||||
rememberCommandId = SYRLINKS::READ_TX_AGC_VALUE_LOW_BYTE;
|
rememberCommandId = SYRLINKS::READ_TX_AGC_VALUE_LOW_BYTE;
|
||||||
rawPacket = commandBuffer;
|
rawPacket = commandBuffer;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
case (SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE):
|
||||||
|
tempPowerAmpBoardHighByte.copy(reinterpret_cast<char*>(commandBuffer), tempPowerAmpBoardHighByte.size(),
|
||||||
|
0);
|
||||||
|
rawPacketLen = tempPowerAmpBoardHighByte.size();
|
||||||
|
rememberCommandId = SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE;
|
||||||
|
rawPacket = commandBuffer;
|
||||||
|
return RETURN_OK;
|
||||||
|
case (SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE):
|
||||||
|
tempPowerAmpBoardLowByte.copy(reinterpret_cast<char*>(commandBuffer), tempPowerAmpBoardLowByte.size(),
|
||||||
|
0);
|
||||||
|
rawPacketLen = tempPowerAmpBoardLowByte.size();
|
||||||
|
rememberCommandId = SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE;
|
||||||
|
rawPacket = commandBuffer;
|
||||||
|
return RETURN_OK;
|
||||||
|
case (SYRLINKS::TEMP_BASEBAND_BOARD_HIGH_BYTE):
|
||||||
|
tempBasebandBoardHighByte.copy(reinterpret_cast<char*>(commandBuffer), tempBasebandBoardHighByte.size(),
|
||||||
|
0);
|
||||||
|
rawPacketLen = tempBasebandBoardHighByte.size();
|
||||||
|
rememberCommandId = SYRLINKS::TEMP_BASEBAND_BOARD_HIGH_BYTE;
|
||||||
|
rawPacket = commandBuffer;
|
||||||
|
return RETURN_OK;
|
||||||
|
case (SYRLINKS::TEMP_BASEBAND_BOARD_LOW_BYTE):
|
||||||
|
tempBasebandBoardLowByte.copy(reinterpret_cast<char*>(commandBuffer), tempBasebandBoardLowByte.size(), 0);
|
||||||
|
rawPacketLen = tempBasebandBoardLowByte.size();
|
||||||
|
rememberCommandId = SYRLINKS::TEMP_BASEBAND_BOARD_LOW_BYTE;
|
||||||
|
rawPacket = commandBuffer;
|
||||||
|
return RETURN_OK;
|
||||||
default:
|
default:
|
||||||
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
@ -134,6 +194,10 @@ void SyrlinksHkHandler::fillCommandAndReplyMap() {
|
|||||||
false, true, SYRLINKS::ACK_REPLY);
|
false, true, SYRLINKS::ACK_REPLY);
|
||||||
this->insertInCommandAndReplyMap(SYRLINKS::SET_TX_MODE_CW, 1, nullptr, SYRLINKS::ACK_SIZE, false,
|
this->insertInCommandAndReplyMap(SYRLINKS::SET_TX_MODE_CW, 1, nullptr, SYRLINKS::ACK_SIZE, false,
|
||||||
true, SYRLINKS::ACK_REPLY);
|
true, SYRLINKS::ACK_REPLY);
|
||||||
|
this->insertInCommandAndReplyMap(SYRLINKS::WRITE_LCL_CONFIG, 1, nullptr, SYRLINKS::ACK_SIZE,
|
||||||
|
false, true, SYRLINKS::ACK_REPLY);
|
||||||
|
this->insertInCommandAndReplyMap(SYRLINKS::READ_LCL_CONFIG, 1, nullptr,
|
||||||
|
SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
|
||||||
this->insertInCommandAndReplyMap(SYRLINKS::READ_TX_STATUS, 1, &txDataset,
|
this->insertInCommandAndReplyMap(SYRLINKS::READ_TX_STATUS, 1, &txDataset,
|
||||||
SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
|
SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
|
||||||
this->insertInCommandAndReplyMap(SYRLINKS::READ_TX_WAVEFORM, 1, &txDataset,
|
this->insertInCommandAndReplyMap(SYRLINKS::READ_TX_WAVEFORM, 1, &txDataset,
|
||||||
@ -142,6 +206,14 @@ void SyrlinksHkHandler::fillCommandAndReplyMap() {
|
|||||||
SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
|
SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
|
||||||
this->insertInCommandAndReplyMap(SYRLINKS::READ_TX_AGC_VALUE_LOW_BYTE, 1, &txDataset,
|
this->insertInCommandAndReplyMap(SYRLINKS::READ_TX_AGC_VALUE_LOW_BYTE, 1, &txDataset,
|
||||||
SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
|
SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
|
||||||
|
this->insertInCommandAndReplyMap(SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE, 1, nullptr,
|
||||||
|
SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
|
||||||
|
this->insertInCommandAndReplyMap(SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE, 1, nullptr,
|
||||||
|
SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
|
||||||
|
this->insertInCommandAndReplyMap(SYRLINKS::TEMP_BASEBAND_BOARD_HIGH_BYTE, 1, nullptr,
|
||||||
|
SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
|
||||||
|
this->insertInCommandAndReplyMap(SYRLINKS::TEMP_BASEBAND_BOARD_LOW_BYTE, 1, nullptr,
|
||||||
|
SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
|
||||||
this->insertInCommandAndReplyMap(SYRLINKS::READ_RX_STATUS_REGISTERS, 1, &rxDataset,
|
this->insertInCommandAndReplyMap(SYRLINKS::READ_RX_STATUS_REGISTERS, 1, &rxDataset,
|
||||||
SYRLINKS::RX_STATUS_REGISTERS_REPLY_SIZE);
|
SYRLINKS::RX_STATUS_REGISTERS_REPLY_SIZE);
|
||||||
}
|
}
|
||||||
@ -177,6 +249,15 @@ ReturnValue_t SyrlinksHkHandler::scanForReply(const uint8_t* start, size_t remai
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t SyrlinksHkHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) {
|
||||||
|
if (powerSwitch == power::NO_SWITCH) {
|
||||||
|
return DeviceHandlerBase::NO_SWITCH;
|
||||||
|
}
|
||||||
|
*numberOfSwitches = 1;
|
||||||
|
*switches = &powerSwitch;
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
|
ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
|
|
||||||
@ -184,7 +265,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
|
|||||||
case (SYRLINKS::ACK_REPLY):
|
case (SYRLINKS::ACK_REPLY):
|
||||||
result = verifyReply(packet, SYRLINKS::ACK_SIZE);
|
result = verifyReply(packet, SYRLINKS::ACK_SIZE);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::error << "SyrlinksHkHandler::interpretDeviceReply: Acknowledgement reply has "
|
sif::error << "SyrlinksHkHandler::interpretDeviceReply: Acknowledgment reply has "
|
||||||
"invalid crc"
|
"invalid crc"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return CRC_FAILURE;
|
return CRC_FAILURE;
|
||||||
@ -204,6 +285,15 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
|
|||||||
}
|
}
|
||||||
parseRxStatusRegistersReply(packet);
|
parseRxStatusRegistersReply(packet);
|
||||||
break;
|
break;
|
||||||
|
case (SYRLINKS::READ_LCL_CONFIG):
|
||||||
|
result = verifyReply(packet, SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::error << "SyrlinksHkHandler::interpretDeviceReply: Read config lcl reply "
|
||||||
|
<< "has invalid crc" << std::endl;
|
||||||
|
return CRC_FAILURE;
|
||||||
|
}
|
||||||
|
parseLclConfigReply(packet);
|
||||||
|
break;
|
||||||
case (SYRLINKS::READ_TX_STATUS):
|
case (SYRLINKS::READ_TX_STATUS):
|
||||||
result = verifyReply(packet, SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
|
result = verifyReply(packet, SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
@ -240,6 +330,56 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
|
|||||||
}
|
}
|
||||||
parseAgcLowByte(packet);
|
parseAgcLowByte(packet);
|
||||||
break;
|
break;
|
||||||
|
case (SYRLINKS::TEMP_BASEBAND_BOARD_HIGH_BYTE):
|
||||||
|
result = verifyReply(packet, SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::error << "SyrlinksHkHandler::interpretDeviceReply: Read temperature baseband board "
|
||||||
|
<< "high byte reply has invalid crc" << std::endl;
|
||||||
|
return CRC_FAILURE;
|
||||||
|
}
|
||||||
|
rawTempBasebandBoard = convertHexStringToUint8(reinterpret_cast<const char*>(
|
||||||
|
packet + SYRLINKS::MESSAGE_HEADER_SIZE))
|
||||||
|
<< 8;
|
||||||
|
break;
|
||||||
|
case (SYRLINKS::TEMP_BASEBAND_BOARD_LOW_BYTE):
|
||||||
|
result = verifyReply(packet, SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::error << "SyrlinksHkHandler::interpretDeviceReply: Read temperature baseband board"
|
||||||
|
" low byte reply has invalid crc"
|
||||||
|
<< std::endl;
|
||||||
|
return CRC_FAILURE;
|
||||||
|
}
|
||||||
|
rawTempBasebandBoard |= convertHexStringToUint8(
|
||||||
|
reinterpret_cast<const char*>(packet + SYRLINKS::MESSAGE_HEADER_SIZE));
|
||||||
|
tempBasebandBoard = calcTempVal(rawTempBasebandBoard);
|
||||||
|
sif::info << "Syrlinks temperature baseband board: " << tempBasebandBoard << " °C"
|
||||||
|
<< std::endl;
|
||||||
|
break;
|
||||||
|
case (SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE):
|
||||||
|
result = verifyReply(packet, SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::error << "SyrlinksHkHandler::interpretDeviceReply: Read temperature power amplifier "
|
||||||
|
<< "board high byte reply has invalid crc" << std::endl;
|
||||||
|
return CRC_FAILURE;
|
||||||
|
}
|
||||||
|
rawTempPowerAmplifier = 0;
|
||||||
|
rawTempPowerAmplifier = convertHexStringToUint8(reinterpret_cast<const char*>(
|
||||||
|
packet + SYRLINKS::MESSAGE_HEADER_SIZE))
|
||||||
|
<< 8;
|
||||||
|
break;
|
||||||
|
case (SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE):
|
||||||
|
result = verifyReply(packet, SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::error << "SyrlinksHkHandler::interpretDeviceReply: Read temperature power amplifier"
|
||||||
|
<< " board low byte reply has invalid crc" << std::endl;
|
||||||
|
return CRC_FAILURE;
|
||||||
|
}
|
||||||
|
rawTempPowerAmplifier |= convertHexStringToUint8(
|
||||||
|
reinterpret_cast<const char*>(packet + SYRLINKS::MESSAGE_HEADER_SIZE));
|
||||||
|
tempPowerAmplifier = calcTempVal(rawTempPowerAmplifier);
|
||||||
|
sif::info << "Syrlinks temperature power amplifier board: " << tempPowerAmplifier << " °C"
|
||||||
|
<< std::endl;
|
||||||
|
break;
|
||||||
default: {
|
default: {
|
||||||
sif::debug << "SyrlinksHkHandler::interpretDeviceReply: Unknown device reply id" << std::endl;
|
sif::debug << "SyrlinksHkHandler::interpretDeviceReply: Unknown device reply id" << std::endl;
|
||||||
return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY;
|
return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY;
|
||||||
@ -390,6 +530,13 @@ void SyrlinksHkHandler::parseRxStatusRegistersReply(const uint8_t* packet) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SyrlinksHkHandler::parseLclConfigReply(const uint8_t* packet) {
|
||||||
|
uint16_t offset = SYRLINKS::MESSAGE_HEADER_SIZE;
|
||||||
|
uint8_t lclConfig = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
|
||||||
|
sif::info << "SyrlinksHkHandler::parseRxStatusRegistersReply: Lcl config: "
|
||||||
|
<< static_cast<unsigned int>(lclConfig) << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
void SyrlinksHkHandler::parseTxStatusReply(const uint8_t* packet) {
|
void SyrlinksHkHandler::parseTxStatusReply(const uint8_t* packet) {
|
||||||
PoolReadGuard readHelper(&txDataset);
|
PoolReadGuard readHelper(&txDataset);
|
||||||
uint16_t offset = SYRLINKS::MESSAGE_HEADER_SIZE;
|
uint16_t offset = SYRLINKS::MESSAGE_HEADER_SIZE;
|
||||||
@ -449,3 +596,5 @@ ReturnValue_t SyrlinksHkHandler::initializeLocalDataPool(localpool::DataPool& lo
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SyrlinksHkHandler::setModeNormal() { mode = MODE_NORMAL; }
|
void SyrlinksHkHandler::setModeNormal() { mode = MODE_NORMAL; }
|
||||||
|
|
||||||
|
float SyrlinksHkHandler::calcTempVal(uint16_t raw) { return 0.126984 * raw - 67.87; }
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
#ifndef MISSION_DEVICES_SYRLINKSHKHANDLER_H_
|
#ifndef MISSION_DEVICES_SYRLINKSHKHANDLER_H_
|
||||||
#define MISSION_DEVICES_SYRLINKSHKHANDLER_H_
|
#define MISSION_DEVICES_SYRLINKSHKHANDLER_H_
|
||||||
|
|
||||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
#include "devices/powerSwitcherList.h"
|
||||||
#include <mission/devices/devicedefinitions/SyrlinksDefinitions.h>
|
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
||||||
|
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
class SyrlinksHkHandler : public DeviceHandlerBase {
|
class SyrlinksHkHandler : public DeviceHandlerBase {
|
||||||
public:
|
public:
|
||||||
SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie);
|
SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
|
||||||
|
power::Switch_t powerSwitch);
|
||||||
virtual ~SyrlinksHkHandler();
|
virtual ~SyrlinksHkHandler();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,12 +30,13 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
|
|||||||
void doShutDown() override;
|
void doShutDown() override;
|
||||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
||||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
|
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
|
||||||
void fillCommandAndReplyMap() override;
|
|
||||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
|
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
|
||||||
size_t commandDataLen) override;
|
size_t commandDataLen) override;
|
||||||
|
void fillCommandAndReplyMap() override;
|
||||||
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
|
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
|
||||||
size_t* foundLen) override;
|
size_t* foundLen) override;
|
||||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
||||||
|
ReturnValue_t getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) override;
|
||||||
void setNormalDatapoolEntriesInvalid() override;
|
void setNormalDatapoolEntriesInvalid() override;
|
||||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
@ -55,16 +58,23 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
|
|||||||
|
|
||||||
static const uint8_t CRC_INITIAL_VALUE = 0x0;
|
static const uint8_t CRC_INITIAL_VALUE = 0x0;
|
||||||
|
|
||||||
|
// Uses CRC-16/XMODEM
|
||||||
std::string resetCommand = "<C04:5A5A:FF41>";
|
std::string resetCommand = "<C04:5A5A:FF41>";
|
||||||
std::string readRxStatusRegCommand = "<E00::825B>";
|
std::string readRxStatusRegCommand = "<E00::825B>";
|
||||||
std::string setTxModeStandby = "<W04:4000:7E58>";
|
std::string setTxModeStandby = "<W04:4000:7E58>";
|
||||||
/** W - write, 04 - 4 bytes in data field, 01 - value, 40 register to write value */
|
/** W - write, 04 - 4 bytes in data field, 01 - value, 40 register to write value */
|
||||||
std::string setTxModeModulation = "<W04:4001:4D69>";
|
std::string setTxModeModulation = "<W04:4001:4D69>";
|
||||||
std::string setTxModeCw = "<W04:4010:4968>";
|
std::string setTxModeCw = "<W04:4010:4968>";
|
||||||
|
std::string writeLclConfig = "<W04:0707:3FE4>";
|
||||||
std::string readTxStatus = "<R02:40:7555>";
|
std::string readTxStatus = "<R02:40:7555>";
|
||||||
std::string readTxWaveform = "<R02:44:B991>";
|
std::string readTxWaveform = "<R02:44:B991>";
|
||||||
std::string readTxAgcValueHighByte = "<R02:46:DFF3>";
|
std::string readTxAgcValueHighByte = "<R02:46:DFF3>";
|
||||||
std::string readTxAgcValueLowByte = "<R02:47:ECC2>";
|
std::string readTxAgcValueLowByte = "<R02:47:ECC2>";
|
||||||
|
std::string readLclConfig = "<R02:07:3002>";
|
||||||
|
std::string tempPowerAmpBoardHighByte = "<R02:C0:28CD>";
|
||||||
|
std::string tempPowerAmpBoardLowByte = "<R02:C1:1BFC>";
|
||||||
|
std::string tempBasebandBoardHighByte = "<R02:C2:4EAF>";
|
||||||
|
std::string tempBasebandBoardLowByte = "<R02:C3:7D9E>";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In some cases it is not possible to extract from the received reply the information about
|
* In some cases it is not possible to extract from the received reply the information about
|
||||||
@ -75,7 +85,13 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
|
|||||||
SYRLINKS::RxDataset rxDataset;
|
SYRLINKS::RxDataset rxDataset;
|
||||||
SYRLINKS::TxDataset txDataset;
|
SYRLINKS::TxDataset txDataset;
|
||||||
|
|
||||||
uint8_t agcValueHighByte;
|
const power::Switch_t powerSwitch = power::NO_SWITCH;
|
||||||
|
|
||||||
|
uint8_t agcValueHighByte = 0;
|
||||||
|
uint16_t rawTempPowerAmplifier = 0;
|
||||||
|
uint16_t rawTempBasebandBoard = 0;
|
||||||
|
float tempPowerAmplifier = 0;
|
||||||
|
float tempBasebandBoard = 0;
|
||||||
|
|
||||||
uint8_t commandBuffer[SYRLINKS::MAX_COMMAND_SIZE];
|
uint8_t commandBuffer[SYRLINKS::MAX_COMMAND_SIZE];
|
||||||
|
|
||||||
@ -152,6 +168,8 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
|
|||||||
*/
|
*/
|
||||||
void parseRxStatusRegistersReply(const uint8_t* packet);
|
void parseRxStatusRegistersReply(const uint8_t* packet);
|
||||||
|
|
||||||
|
void parseLclConfigReply(const uint8_t* packet);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function writes the read tx status register to the txStatusDataset.
|
* @brief This function writes the read tx status register to the txStatusDataset.
|
||||||
* @param packet Pointer to the received packet.
|
* @param packet Pointer to the received packet.
|
||||||
@ -169,6 +187,11 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
|
|||||||
*/
|
*/
|
||||||
void parseAgcLowByte(const uint8_t* packet);
|
void parseAgcLowByte(const uint8_t* packet);
|
||||||
void parseAgcHighByte(const uint8_t* packet);
|
void parseAgcHighByte(const uint8_t* packet);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Calculates temperature in degree celcius form raw value
|
||||||
|
*/
|
||||||
|
float calcTempVal(uint16_t);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_DEVICES_SYRLINKSHKHANDLER_H_ */
|
#endif /* MISSION_DEVICES_SYRLINKSHKHANDLER_H_ */
|
||||||
|
@ -9,9 +9,11 @@ static const DeviceCommandId_t NONE = 0x0; // Set when no command is pending
|
|||||||
* This command initiates the ADC conversion for all channels including the internal
|
* This command initiates the ADC conversion for all channels including the internal
|
||||||
* temperature sensor.
|
* temperature sensor.
|
||||||
*/
|
*/
|
||||||
static const DeviceCommandId_t WRITE_SETUP = 0x1;
|
static const DeviceCommandId_t WRITE_SETUP = 1;
|
||||||
static const DeviceCommandId_t START_CONVERSION = 0x2;
|
static const DeviceCommandId_t START_CONVERSION = 2;
|
||||||
static const DeviceCommandId_t READ_CONVERSIONS = 0x3;
|
static const DeviceCommandId_t READ_CONVERSIONS = 3;
|
||||||
|
static const DeviceCommandId_t ENABLE_DEBUG_OUTPUT = 4;
|
||||||
|
static const DeviceCommandId_t DISABLE_DEBUG_OUTPUT = 5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is the configuration byte which will be written to the setup register after
|
* @brief This is the configuration byte which will be written to the setup register after
|
||||||
|
@ -3,21 +3,27 @@
|
|||||||
|
|
||||||
namespace SYRLINKS {
|
namespace SYRLINKS {
|
||||||
|
|
||||||
static const DeviceCommandId_t NONE = 0x0;
|
static const DeviceCommandId_t NONE = 0;
|
||||||
static const DeviceCommandId_t RESET_UNIT = 0x01;
|
static const DeviceCommandId_t RESET_UNIT = 1;
|
||||||
/** Reads out all status registers */
|
/** Reads out all status registers */
|
||||||
static const DeviceCommandId_t READ_RX_STATUS_REGISTERS = 0x02;
|
static const DeviceCommandId_t READ_RX_STATUS_REGISTERS = 2;
|
||||||
/** Sets Tx mode to standby */
|
/** Sets Tx mode to standby */
|
||||||
static const DeviceCommandId_t SET_TX_MODE_STANDBY = 0x03;
|
static const DeviceCommandId_t SET_TX_MODE_STANDBY = 3;
|
||||||
/** Starts transmission mode. Only reached when clock signal is applying to the data tx input */
|
/** Starts transmission mode. Only reached when clock signal is applying to the data tx input */
|
||||||
static const DeviceCommandId_t SET_TX_MODE_MODULATION = 0x04;
|
static const DeviceCommandId_t SET_TX_MODE_MODULATION = 4;
|
||||||
/** Sends out a single carrier wave for testing purpose */
|
/** Sends out a single carrier wave for testing purpose */
|
||||||
static const DeviceCommandId_t SET_TX_MODE_CW = 0x05;
|
static const DeviceCommandId_t SET_TX_MODE_CW = 5;
|
||||||
static const DeviceCommandId_t ACK_REPLY = 0x06;
|
static const DeviceCommandId_t ACK_REPLY = 6;
|
||||||
static const DeviceCommandId_t READ_TX_STATUS = 0x07;
|
static const DeviceCommandId_t READ_TX_STATUS = 7;
|
||||||
static const DeviceCommandId_t READ_TX_WAVEFORM = 0x08;
|
static const DeviceCommandId_t READ_TX_WAVEFORM = 8;
|
||||||
static const DeviceCommandId_t READ_TX_AGC_VALUE_HIGH_BYTE = 0x09;
|
static const DeviceCommandId_t READ_TX_AGC_VALUE_HIGH_BYTE = 9;
|
||||||
static const DeviceCommandId_t READ_TX_AGC_VALUE_LOW_BYTE = 0x0A;
|
static const DeviceCommandId_t READ_TX_AGC_VALUE_LOW_BYTE = 10;
|
||||||
|
static const DeviceCommandId_t WRITE_LCL_CONFIG = 11;
|
||||||
|
static const DeviceCommandId_t READ_LCL_CONFIG = 12;
|
||||||
|
static const DeviceCommandId_t TEMP_POWER_AMPLIFIER_HIGH_BYTE = 13;
|
||||||
|
static const DeviceCommandId_t TEMP_POWER_AMPLIFIER_LOW_BYTE = 14;
|
||||||
|
static const DeviceCommandId_t TEMP_BASEBAND_BOARD_HIGH_BYTE = 15;
|
||||||
|
static const DeviceCommandId_t TEMP_BASEBAND_BOARD_LOW_BYTE = 16;
|
||||||
|
|
||||||
/** Size of a simple transmission success response */
|
/** Size of a simple transmission success response */
|
||||||
static const uint8_t ACK_SIZE = 12;
|
static const uint8_t ACK_SIZE = 12;
|
||||||
|
@ -313,7 +313,7 @@ void CCSDSHandler::enableTransmit() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
transmitterCountdown.setTimeout(TRANSMITTER_TIMEOUT);
|
transmitterCountdown.setTimeout(TRANSMITTER_TIMEOUT);
|
||||||
#ifdef TE0720_1CFA
|
#ifndef TE0720_1CFA
|
||||||
gpioIF->pullHigh(enTxClock);
|
gpioIF->pullHigh(enTxClock);
|
||||||
gpioIF->pullHigh(enTxData);
|
gpioIF->pullHigh(enTxData);
|
||||||
#endif /* BOARD_TE0720 == 0 */
|
#endif /* BOARD_TE0720 == 0 */
|
||||||
|
Loading…
Reference in New Issue
Block a user