Update FSFW from upstream #71

Closed
muellerr wants to merge 1112 commits from development into eive/develop
3 changed files with 69 additions and 16 deletions
Showing only changes of commit da106fd96f - Show all commits

View File

@ -267,8 +267,7 @@ void CommandingServiceBase::handleRequestQueue() {
address = message.getStorageId();
result = setUpTcReader(address);
if (result != HasReturnvaluesIF::RETURN_OK) {
// TODO: Warning?
rejectPacket(tcverif::START_FAILURE, address, result);
rejectPacketInvalidTc(result, address);
continue;
}
if ((tcReader.getSubService() == 0) or
@ -384,15 +383,29 @@ void CommandingServiceBase::startExecution(store_address_t storeId, CommandMapIt
}
}
void CommandingServiceBase::rejectPacket(uint8_t reportId, store_address_t tcStoreId,
ReturnValue_t errorCode) {
verificationReporter->sendFailureReport(VerifFailureParams(reportId, tcReader, errorCode));
ReturnValue_t CommandingServiceBase::rejectPacketInvalidTc(ReturnValue_t errorCode,
store_address_t tcStoreId) {
failureParameter1 = INVALID_TC;
prepareVerificationFailureWithNoTcInfo(tcverif::START_FAILURE, errorCode, true);
if (tcStoreId != store_address_t::invalid()) {
tcStore->deleteData(tcStoreId);
}
return verificationReporter->sendFailureReport(failParams);
}
void CommandingServiceBase::acceptPacket(uint8_t reportId, store_address_t tcStoreId) {
ReturnValue_t CommandingServiceBase::rejectPacket(uint8_t reportId, store_address_t tcStoreId,
ReturnValue_t errorCode) {
ReturnValue_t result =
verificationReporter->sendFailureReport(VerifFailureParams(reportId, tcReader, errorCode));
tcStore->deleteData(tcStoreId);
return result;
}
ReturnValue_t CommandingServiceBase::acceptPacket(uint8_t reportId, store_address_t tcStoreId) {
ReturnValue_t result =
verificationReporter->sendSuccessReport(VerifSuccessParams(reportId, tcReader));
tcStore->deleteData(tcStoreId);
return result;
}
void CommandingServiceBase::checkAndExecuteFifo(CommandMapIter& iter) {
@ -437,10 +450,23 @@ void CommandingServiceBase::setTaskIF(PeriodicTaskIF* task_) { executingTask = t
void CommandingServiceBase::setCustomTmStore(StorageManagerIF& store) {
tmStoreHelper.setTmStore(store);
}
ReturnValue_t CommandingServiceBase::setUpTcReader(store_address_t storeId) {
return tc::prepareTcReader(*tcStore, storeId, tcReader);
}
void CommandingServiceBase::prepareVerificationFailureWithNoTcInfo(uint8_t reportId,
ReturnValue_t errorCode,
bool setCachedFailParams) {
failParams.resetTcFields();
failParams.resetFailParams();
failParams.reportId = reportId;
failParams.errorCode = errorCode;
if (setCachedFailParams) {
failParams.errorParam1 = failureParameter1;
failParams.errorParam2 = failureParameter2;
}
}
void CommandingServiceBase::prepareVerificationFailureWithFullInfo(uint8_t reportId,
CommandInfo::TcInfo& tcInfo,
ReturnValue_t errorCode,
@ -449,6 +475,7 @@ void CommandingServiceBase::prepareVerificationFailureWithFullInfo(uint8_t repor
failParams.tcPacketId = tcInfo.tcPacketId;
failParams.tcPsc = tcInfo.tcSequenceControl;
failParams.ackFlags = tcInfo.ackFlags;
failParams.resetFailParams();
failParams.errorCode = errorCode;
if (setCachedFailParams) {
failParams.errorParam1 = failureParameter1;

View File

@ -52,7 +52,13 @@ class CommandingServiceBase : public SystemObject,
static const ReturnValue_t EXECUTION_COMPLETE = MAKE_RETURN_CODE(1);
static const ReturnValue_t NO_STEP_MESSAGE = MAKE_RETURN_CODE(2);
/**
* Target object has too many pending requests
*/
static const ReturnValue_t OBJECT_BUSY = MAKE_RETURN_CODE(3);
/**
* Command map is full
*/
static const ReturnValue_t BUSY = MAKE_RETURN_CODE(4);
static const ReturnValue_t INVALID_TC = MAKE_RETURN_CODE(5);
static const ReturnValue_t INVALID_OBJECT = MAKE_RETURN_CODE(6);
@ -330,16 +336,24 @@ class CommandingServiceBase : public SystemObject,
ReturnValue_t setUpTcReader(store_address_t storeId);
void rejectPacket(uint8_t reportId, store_address_t tcStoreId, ReturnValue_t errorCode);
/**
* The TC format is invalid or there was an issue retrieving a TC packet from the store.
* @param errorCode Result of the failed operation, will be sent with the verification failure
* message
* @return
*/
ReturnValue_t rejectPacketInvalidTc(ReturnValue_t errorCode, store_address_t tcStoreId);
ReturnValue_t rejectPacket(uint8_t reportId, store_address_t tcStoreId, ReturnValue_t errorCode);
void acceptPacket(uint8_t reportId, store_address_t tcStoreId);
ReturnValue_t acceptPacket(uint8_t reportId, store_address_t tcStoreId);
void startExecution(store_address_t storeId, CommandMapIter& iter);
void handleCommandMessage(CommandMessage* reply);
void handleReplyHandlerResult(ReturnValue_t result, CommandMapIter iter,
CommandMessage* nextCommand, CommandMessage* reply, bool& isStep);
void prepareVerificationFailureWithNoTcInfo(uint8_t reportId, ReturnValue_t errorCode,
bool setCachedFailParams);
void prepareVerificationFailureWithFullInfo(uint8_t reportId, CommandInfo::TcInfo& tcInfo,
ReturnValue_t errorCode, bool setCachedFailParams);
void prepareVerificationSuccessWithFullInfo(uint8_t reportId, CommandInfo::TcInfo& tcInfo);

View File

@ -13,6 +13,12 @@ struct VerifParamsBase {
uint16_t tcPsc;
uint8_t ackFlags = ecss::ACK_ALL;
uint8_t step = 0;
void resetTcFields() {
tcPacketId = 0;
tcPsc = 0;
ackFlags = 0;
}
};
struct VerifSuccessParams : public VerifParamsBase {
@ -27,10 +33,10 @@ struct VerifFailureParams : public VerifParamsBase {
VerifFailureParams() = default;
VerifFailureParams(uint8_t reportId, uint16_t tcPacketId, uint16_t tcPsc, ReturnValue_t errorCode,
uint32_t errorParam1, uint32_t errorParams2)
: VerifParamsBase(reportId, tcPacketId, tcPsc), errorCode(errorCode) {
errorParam1 = errorParam1;
errorParams2 = errorParams2;
}
: VerifParamsBase(reportId, tcPacketId, tcPsc),
errorCode(errorCode),
errorParam1(errorParam1),
errorParam2(errorParams2) {}
VerifFailureParams(uint8_t reportId, uint16_t tcPacketId, uint16_t tcPsc, ReturnValue_t errorCode)
: VerifParamsBase(reportId, tcPacketId, tcPsc), errorCode(errorCode) {}
VerifFailureParams(uint8_t reportId, uint16_t tcPacketId, uint16_t tcPsc)
@ -41,7 +47,13 @@ struct VerifFailureParams : public VerifParamsBase {
VerifFailureParams(uint8_t reportId, PusTcIF& tc)
: VerifParamsBase(reportId, tc.getPacketIdRaw(), tc.getPacketSeqCtrlRaw()) {}
ReturnValue_t errorCode = result::OK;
void resetFailParams() {
errorCode = result::FAILED;
errorParam1 = 0;
errorParam2 = 0;
}
ReturnValue_t errorCode = result::FAILED;
uint8_t step = 0;
uint32_t errorParam1 = 0;
uint32_t errorParam2 = 0;