well that was fast
Some checks are pending
EIVE/eive-obsw/pipeline/head Build started...
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2023-10-02 14:15:50 +02:00
parent 7d1d913220
commit 9c1eee075c
Signed by: muellerr
GPG Key ID: FCE0B2BD2195142F
8 changed files with 78 additions and 2 deletions

View File

@ -1 +1,2 @@
target_sources(${OBSW_NAME} PRIVATE CoreController.cpp WatchdogHandler.cpp) target_sources(${OBSW_NAME} PRIVATE CoreController.cpp WatchdogHandler.cpp
XiphosWdtHandler.cpp)

View File

@ -0,0 +1,39 @@
#include "XiphosWdtHandler.h"
XiphosWdtHandler::XiphosWdtHandler(object_id_t objectId) : SystemObject(objectId) {}
ReturnValue_t XiphosWdtHandler::initialize() {
int result = xsc_watchdog_init(&wdtHandle);
if (result != 0) {
sif::error << "XiphosWdtHandler: Initiating watchdog failed with code " << result << ": "
<< strerror(result) << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
}
if (wdtHandle == nullptr) {
sif::error << "XiphosWdtHandler: WDT handle is nullptr!" << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
}
result = xsc_watchdog_set_timeout(wdtHandle, timeoutSeconds);
if (result != 0) {
sif::error << "XiphosWdtHandler: Setting WDT timeout of " << timeoutSeconds
<< " seconds failed with code " << result << ": " << strerror(result) << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
}
result = xsc_watchdog_enable(wdtHandle);
if (result != 0) {
sif::error << "XiphosWdtHandler: Enabling WDT failed with code " << result << ": "
<< strerror(result) << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
}
return returnvalue::OK;
}
ReturnValue_t XiphosWdtHandler::performOperation(uint8_t opCode) {
int result = xsc_watchdog_keepalive(wdtHandle);
if (result != 0) {
sif::warning << "XiphosWdtHandler: Feeding WDT failed with code " << result << ": "
<< strerror(result) << std::endl;
return returnvalue::FAILED;
}
return returnvalue::OK;
}

View File

@ -0,0 +1,22 @@
#ifndef BSP_Q7S_CORE_XIPHOSWDTHANDLER_H_
#define BSP_Q7S_CORE_XIPHOSWDTHANDLER_H_
#include <fsfw/action/HasActionsIF.h>
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/tasks/ExecutableObjectIF.h>
#include <libxiphos.h>
class XiphosWdtHandler : public SystemObject, public ExecutableObjectIF {
public:
XiphosWdtHandler(object_id_t objectId);
ReturnValue_t performOperation(uint8_t opCode) override;
ReturnValue_t initialize() override;
private:
// Timeout duration range specified by Xiphos: 0.001 seconds to 171 seconds. The libxiphos API
// expects an int, so I guess this translates to 1 to 171 seconds.
uint32_t timeoutSeconds = 60;
struct watchdog_s* wdtHandle = nullptr;
};
#endif /* BSP_Q7S_CORE_XIPHOSWDTHANDLER_H_ */

View File

@ -1,4 +1,5 @@
#include <bsp_q7s/callbacks/q7sGpioCallbacks.h> #include <bsp_q7s/callbacks/q7sGpioCallbacks.h>
#include <bsp_q7s/core/XiphosWdtHandler.h>
#include <bsp_q7s/objectFactory.h> #include <bsp_q7s/objectFactory.h>
#include <dummies/ComCookieDummy.h> #include <dummies/ComCookieDummy.h>
#include <dummies/PcduHandlerDummy.h> #include <dummies/PcduHandlerDummy.h>
@ -37,6 +38,7 @@ void ObjectFactory::produce(void* args) {
PersistentTmStores stores; PersistentTmStores stores;
readFirmwareVersion(); readFirmwareVersion();
new XiphosWdtHandler(objects::XIPHOS_WDT);
ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel, ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel,
*SdCardManager::instance(), &ipcStore, &tmStore, stores, 200, *SdCardManager::instance(), &ipcStore, &tmStore, stores, 200,
enableHkSets); enableHkSets);

View File

@ -1,4 +1,5 @@
#include <bsp_q7s/callbacks/q7sGpioCallbacks.h> #include <bsp_q7s/callbacks/q7sGpioCallbacks.h>
#include <bsp_q7s/core/XiphosWdtHandler.h>
#include <bsp_q7s/objectFactory.h> #include <bsp_q7s/objectFactory.h>
#include <devices/gpioIds.h> #include <devices/gpioIds.h>
#include <fsfw/storagemanager/LocalPool.h> #include <fsfw/storagemanager/LocalPool.h>
@ -34,6 +35,7 @@ void ObjectFactory::produce(void* args) {
PersistentTmStores stores; PersistentTmStores stores;
readFirmwareVersion(); readFirmwareVersion();
new XiphosWdtHandler(objects::XIPHOS_WDT);
ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel, ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel,
*SdCardManager::instance(), &ipcStore, &tmStore, stores, 200, *SdCardManager::instance(), &ipcStore, &tmStore, stores, 200,
true); true);

View File

@ -82,6 +82,14 @@ void scheduling::initTasks() {
} }
#endif #endif
PeriodicTaskIF* xiphosWdtTask =
factory->createPeriodicTask("XIPHOS_WDT", 90, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4,
missedDeadlineFunc, &RR_SCHEDULING);
result = xiphosWdtTask->addComponent(objects::XIPHOS_WDT);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("XIPHOS_WDT", objects::XIPHOS_WDT);
}
PeriodicTaskIF* coreCtrlTask = factory->createPeriodicTask( PeriodicTaskIF* coreCtrlTask = factory->createPeriodicTask(
"CORE_CTRL", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc, &RR_SCHEDULING); "CORE_CTRL", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc, &RR_SCHEDULING);
result = coreCtrlTask->addComponent(objects::CORE_CONTROLLER); result = coreCtrlTask->addComponent(objects::CORE_CONTROLLER);
@ -410,6 +418,7 @@ void scheduling::initTasks() {
}; };
sif::info << "Starting tasks.." << std::endl; sif::info << "Starting tasks.." << std::endl;
xiphosWdtTask->startTask();
tmTcDistributor->startTask(); tmTcDistributor->startTask();
#if OBSW_ADD_TCPIP_SERVERS == 1 #if OBSW_ADD_TCPIP_SERVERS == 1

View File

@ -26,6 +26,7 @@ enum commonObjects : uint32_t {
THERMAL_CONTROLLER = 0x43400001, THERMAL_CONTROLLER = 0x43400001,
ACS_CONTROLLER = 0x43000002, ACS_CONTROLLER = 0x43000002,
CORE_CONTROLLER = 0x43000003, CORE_CONTROLLER = 0x43000003,
XIPHOS_WDT = 0x43000004,
GLOBAL_JSON_CFG = 0x43000006, GLOBAL_JSON_CFG = 0x43000006,
/* 0x44 ('D') for device handlers */ /* 0x44 ('D') for device handlers */

2
tmtc

@ -1 +1 @@
Subproject commit 22a42108b431bafa707de2b3a24cad9de95b70d0 Subproject commit 783bdd297a931a96c8b077ec2c2456a203b23ffc