v1.10.0 #220

Merged
meierj merged 592 commits from develop into main 2022-04-22 07:42:20 +02:00
55 changed files with 2703 additions and 2637 deletions
Showing only changes of commit a9a6bbd948 - Show all commits

View File

@ -20,6 +20,9 @@ option(EIVE_ADD_JSON_LIB "Add JSON library" ON)
option(EIVE_SYSROOT_MAGIC "Perform sysroot magic which might not be necessary" OFF) option(EIVE_SYSROOT_MAGIC "Perform sysroot magic which might not be necessary" OFF)
option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name" ON) option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name" ON)
set(OBSW_ADD_STAR_TRACKER 0)
set(OBSW_DEBUG_STARTRACKER 0)
if(NOT FSFW_OSAL) if(NOT FSFW_OSAL)
set(FSFW_OSAL linux CACHE STRING "OS for the FSFW.") set(FSFW_OSAL linux CACHE STRING "OS for the FSFW.")
endif() endif()
@ -71,7 +74,7 @@ set(LIB_JSON_NAME nlohmann_json::nlohmann_json)
# Set path names # Set path names
set(FSFW_PATH fsfw) set(FSFW_PATH fsfw)
set(TEST_PATH test/testtasks) set(TEST_PATH test)
set(UNITTEST_PATH unittest) set(UNITTEST_PATH unittest)
set(LINUX_PATH linux) set(LINUX_PATH linux)
set(COMMON_PATH common) set(COMMON_PATH common)
@ -118,6 +121,8 @@ if(TGT_BSP)
# Used by configure file # Used by configure file
set(EGSE ON) set(EGSE ON)
set(FSFW_HAL_LINUX_ADD_LIBGPIOD OFF) set(FSFW_HAL_LINUX_ADD_LIBGPIOD OFF)
set(OBSW_ADD_STAR_TRACKER 1)
set(OBSW_DEBUG_STARTRACKER 1)
endif() endif()
if(TGT_BSP MATCHES "arm/beagleboneblack") if(TGT_BSP MATCHES "arm/beagleboneblack")
@ -205,7 +210,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(COMPILER_FLAGS "/permissive-") set(COMPILER_FLAGS "/permissive-")
endif() endif()
if (NOT(TGT_BSP MATCHES "arm/te0720-1cfa")) if (NOT(TGT_BSP MATCHES "arm/te0720-1cfa") AND NOT(TGT_BSP MATCHES "arm/q7s"))
# Not installed, so use FetchContent to download and provide Catch2 # Not installed, so use FetchContent to download and provide Catch2
if(NOT Catch2_FOUND) if(NOT Catch2_FOUND)
message(STATUS "Did not find a valid Catch2 installation. Using FetchContent to install it") message(STATUS "Did not find a valid Catch2 installation. Using FetchContent to install it")

View File

@ -385,20 +385,7 @@ more recent disitributions anymore.
## <a id="arm-toolchain"></a> Installing toolchain without Vivado ## <a id="arm-toolchain"></a> Installing toolchain without Vivado
You can download the toolchains for Windows and Linux You can download the toolchains for Windows and Linux
[from the EIVE cloud](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files?dir=/EIVE_IRS/Software/tools&fileid=831898). [from the EIVE cloud](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/tools).
If `wget` is available (e.g. MinGW64), you can use the following command to download the
toolchain for Windows
```sh
wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/rfoaistRd67yBbH/download/gcc-arm-linux-gnueabi-win.zip
```
or the following command for Linux (could be useful for CI/CD)
```sh
wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/MRaeA2XnMXpZ5Pp/download/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz
```
## Installing CMake and MSYS2 on Windows ## Installing CMake and MSYS2 on Windows

View File

@ -3,8 +3,8 @@
#include "InitMission.h" #include "InitMission.h"
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "OBSWVersion.h" #include "OBSWVersion.h"
#include "fsfw/version.h"
#include "fsfw/tasks/TaskFactory.h" #include "fsfw/tasks/TaskFactory.h"
#include "fsfw/version.h"
/** /**
* @brief This is the main program entry point for the egse (raspberry pi 4) * @brief This is the main program entry point for the egse (raspberry pi 4)

View File

@ -3,8 +3,8 @@
#include "InitMission.h" #include "InitMission.h"
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "OBSWVersion.h" #include "OBSWVersion.h"
#include "fsfw/version.h"
#include "fsfw/tasks/TaskFactory.h" #include "fsfw/tasks/TaskFactory.h"
#include "fsfw/version.h"
#ifdef RASPBERRY_PI #ifdef RASPBERRY_PI
static const char* const BOARD_NAME = "Raspberry Pi"; static const char* const BOARD_NAME = "Raspberry Pi";
@ -22,8 +22,7 @@ int main(void) {
std::cout << "-- EIVE OBSW --" << std::endl; std::cout << "-- EIVE OBSW --" << std::endl;
std::cout << "-- Compiled for Linux board " << BOARD_NAME << " --" << std::endl; std::cout << "-- Compiled for Linux board " << BOARD_NAME << " --" << std::endl;
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION << "." std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION << "."
<< SW_REVISION << ", FSFW v" << fsfw::FSFW_VERSION << SW_REVISION << ", FSFW v" << fsfw::FSFW_VERSION << "--" << std::endl;
<< "--" << std::endl;
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl; std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
initmission::initMission(); initmission::initMission();

View File

@ -94,6 +94,9 @@ static constexpr char PL_PCDU_ENABLE_HPA[] = "enable_plpcdu_hpa";
static constexpr char PL_PCDU_ENABLE_MPA[] = "enable_plpcdu_mpa"; static constexpr char PL_PCDU_ENABLE_MPA[] = "enable_plpcdu_mpa";
static constexpr char PL_PCDU_ADC_CS[] = "plpcdu_adc_chip_select"; static constexpr char PL_PCDU_ADC_CS[] = "plpcdu_adc_chip_select";
static constexpr char ENABLE_SUPV_UART[] = "enable_supv_uart";
static constexpr char ENABLE_MPSOC_UART[] = "enable_mpsoc_uart";
} // namespace gpioNames } // namespace gpioNames
} // namespace q7s } // namespace q7s

View File

@ -55,14 +55,12 @@ void initmission::initTasks() {
void (*missedDeadlineFunc)(void) = nullptr; void (*missedDeadlineFunc)(void) = nullptr;
#endif #endif
#if BOARD_TE0720 == 0
PeriodicTaskIF* coreController = factory->createPeriodicTask( PeriodicTaskIF* coreController = factory->createPeriodicTask(
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc); "CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
result = coreController->addComponent(objects::CORE_CONTROLLER); result = coreController->addComponent(objects::CORE_CONTROLLER);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER); initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
} }
#endif
/* TMTC Distribution */ /* TMTC Distribution */
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask( PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
@ -140,7 +138,6 @@ void initmission::initTasks() {
initmission::printAddObjectError("TCS_BOARD_ASS", objects::TCS_BOARD_ASS); initmission::printAddObjectError("TCS_BOARD_ASS", objects::TCS_BOARD_ASS);
} }
#if BOARD_TE0720 == 0
// FS task, task interval does not matter because it runs in permanent loop, priority low // FS task, task interval does not matter because it runs in permanent loop, priority low
// because it is a non-essential background task // because it is a non-essential background task
PeriodicTaskIF* fsTask = factory->createPeriodicTask( PeriodicTaskIF* fsTask = factory->createPeriodicTask(
@ -159,8 +156,6 @@ void initmission::initTasks() {
} }
#endif /* OBSW_ADD_STAR_TRACKER == 1 */ #endif /* OBSW_ADD_STAR_TRACKER == 1 */
#endif /* BOARD_TE0720 */
#if OBSW_ADD_PLOC_MPSOC == 1 #if OBSW_ADD_PLOC_MPSOC == 1
PeriodicTaskIF* mpsocHelperTask = factory->createPeriodicTask( PeriodicTaskIF* mpsocHelperTask = factory->createPeriodicTask(
"PLOC_MPSOC_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); "PLOC_MPSOC_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
@ -212,9 +207,7 @@ void initmission::initTasks() {
pdecHandlerTask->startTask(); pdecHandlerTask->startTask();
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */ #endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
#if BOARD_TE0720 == 0
coreController->startTask(); coreController->startTask();
#endif
taskStarter(pstTasks, "PST task vector"); taskStarter(pstTasks, "PST task vector");
taskStarter(pusTasks, "PUS task vector"); taskStarter(pusTasks, "PUS task vector");
@ -226,12 +219,10 @@ void initmission::initTasks() {
ptmeTestTask->startTask(); ptmeTestTask->startTask();
#endif #endif
#if BOARD_TE0720 == 0
fsTask->startTask(); fsTask->startTask();
#if OBSW_ADD_STAR_TRACKER == 1 #if OBSW_ADD_STAR_TRACKER == 1
strHelperTask > startTask(); strHelperTask > startTask();
#endif /* OBSW_ADD_STAR_TRACKER == 1 */ #endif /* OBSW_ADD_STAR_TRACKER == 1 */
#endif
#if OBSW_ADD_ACS_HANDLERS == 1 #if OBSW_ADD_ACS_HANDLERS == 1
acsTask->startTask(); acsTask->startTask();
@ -245,15 +236,16 @@ void initmission::createPstTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc, TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) { std::vector<PeriodicTaskIF*>& taskVec) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
#if BOARD_TE0720 == 0
/* Polling Sequence Table Default */ /* Polling Sequence Table Default */
#if OBSW_ADD_SPI_TEST_CODE == 0 #if OBSW_ADD_SPI_TEST_CODE == 0
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask( FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
"PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc); "PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
result = pst::pstSpi(spiPst); result = pst::pstSpi(spiPst);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) { if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl; sif::warning << "InitMission::initTasks: SPI PST is empty" << std::endl;
} else {
sif::error << "InitMission::initTasks: Creating SPI PST failed!" << std::endl;
} }
} else { } else {
taskVec.push_back(spiPst); taskVec.push_back(spiPst);
@ -264,43 +256,51 @@ void initmission::createPstTasks(TaskFactory& factory,
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc); "UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
result = pst::pstUart(uartPst); result = pst::pstUart(uartPst);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl; if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::warning << "InitMission::initTasks: UART PST is empty" << std::endl;
} else {
sif::error << "InitMission::initTasks: Creating UART PST failed!" << std::endl;
} }
} else {
taskVec.push_back(uartPst); taskVec.push_back(uartPst);
}
FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask( FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask(
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc); "GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
result = pst::pstGpio(gpioPst); result = pst::pstGpio(gpioPst);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl; if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::warning << "InitMission::initTasks: GPIO PST is empty" << std::endl;
} else {
sif::error << "InitMission::initTasks: Creating GPIO PST failed!" << std::endl;
} }
} else {
taskVec.push_back(gpioPst); taskVec.push_back(gpioPst);
}
#if OBSW_ADD_I2C_TEST_CODE == 0 #if OBSW_ADD_I2C_TEST_CODE == 0
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask( FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
"I2C_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc); "I2C_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
result = pst::pstI2c(i2cPst); result = pst::pstI2c(i2cPst);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl; if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::warning << "InitMission::initTasks: I2C PST is empty" << std::endl;
} else {
sif::error << "InitMission::initTasks: Creating I2C PST failed!" << std::endl;
} }
} else {
taskVec.push_back(i2cPst); taskVec.push_back(i2cPst);
}
#endif #endif
FixedTimeslotTaskIF* gomSpacePstTask = factory.createFixedTimeslotTask( FixedTimeslotTaskIF* gomSpacePstTask = factory.createFixedTimeslotTask(
"GS_PST_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc); "GS_PST_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
result = pst::pstGompaceCan(gomSpacePstTask); result = pst::pstGompaceCan(gomSpacePstTask);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl; sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl;
} }
taskVec.push_back(gomSpacePstTask);
#else /* BOARD_TE7020 == 0 */
FixedTimeslotTaskIF* pollingSequenceTaskTE0720 = factory.createFixedTimeslotTask(
"PST_TASK_TE0720", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 3.0, missedDeadlineFunc);
result = pst::pollingSequenceTE0720(pollingSequenceTaskTE0720);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating TE0720 PST failed!" << std::endl;
} }
taskVec.push_back(pollingSequenceTaskTE0720); taskVec.push_back(gomSpacePstTask);
#endif /* BOARD_TE7020 == 1 */
} }
void initmission::createPusTasks(TaskFactory& factory, void initmission::createPusTasks(TaskFactory& factory,
@ -407,12 +407,6 @@ void initmission::createTestTasks(TaskFactory& factory,
} }
#endif #endif
#if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1
result = testTask->addComponent(objects::LIBGPIOD_TEST);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
}
#endif /* BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1 */
taskVec.push_back(testTask); taskVec.push_back(testTask);
#endif // OBSW_ADD_TEST_TASK == 1 && OBSW_ADD_TEST_CODE == 1 #endif // OBSW_ADD_TEST_TASK == 1 && OBSW_ADD_TEST_CODE == 1

View File

@ -19,12 +19,6 @@
#include "bsp_q7s/callbacks/pcduSwitchCb.h" #include "bsp_q7s/callbacks/pcduSwitchCb.h"
#include "bsp_q7s/callbacks/rwSpiCallback.h" #include "bsp_q7s/callbacks/rwSpiCallback.h"
#include "bsp_q7s/core/CoreController.h" #include "bsp_q7s/core/CoreController.h"
#include "linux/devices/ploc/PlocMemoryDumper.h"
#include "linux/devices/ploc/PlocSupervisorHandler.h"
#include "linux/devices/ploc/PlocUpdater.h"
#include "linux/devices/ploc/PlocMPSoCHandler.h"
#include "linux/devices/ploc/PlocMPSoCHelper.h"
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
#include "bsp_q7s/memory/FileSystemHandler.h" #include "bsp_q7s/memory/FileSystemHandler.h"
#include "busConf.h" #include "busConf.h"
#include "ccsdsConfig.h" #include "ccsdsConfig.h"
@ -38,7 +32,13 @@
#include "linux/csp/CspComIF.h" #include "linux/csp/CspComIF.h"
#include "linux/csp/CspCookie.h" #include "linux/csp/CspCookie.h"
#include "linux/devices/GPSHyperionLinuxController.h" #include "linux/devices/GPSHyperionLinuxController.h"
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h" #include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
#include "linux/devices/ploc/PlocMPSoCHandler.h"
#include "linux/devices/ploc/PlocMPSoCHelper.h"
#include "linux/devices/ploc/PlocMemoryDumper.h"
#include "linux/devices/ploc/PlocSupervisorHandler.h"
#include "linux/devices/ploc/PlocUpdater.h"
#include "linux/devices/startracker/StarTrackerHandler.h" #include "linux/devices/startracker/StarTrackerHandler.h"
#include "linux/devices/startracker/StrHelper.h" #include "linux/devices/startracker/StrHelper.h"
#include "tmtc/apid.h" #include "tmtc/apid.h"
@ -55,6 +55,7 @@
#include "fsfw/tmtcservices/CommandingServiceBase.h" #include "fsfw/tmtcservices/CommandingServiceBase.h"
#include "fsfw/tmtcservices/PusServiceBase.h" #include "fsfw/tmtcservices/PusServiceBase.h"
#include "fsfw_hal/common/gpio/GpioCookie.h" #include "fsfw_hal/common/gpio/GpioCookie.h"
#include "fsfw_hal/common/gpio/gpioDefinitions.h"
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h" #include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h" #include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h"
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h" #include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
@ -135,7 +136,6 @@ void ObjectFactory::produce(void* args) {
PowerSwitchIF* pwrSwitcher = nullptr; PowerSwitchIF* pwrSwitcher = nullptr;
createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiComIF, &i2cComIF); createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiComIF, &i2cComIF);
createTmpComponents(); createTmpComponents();
#if BOARD_TE0720 == 0
new CoreController(objects::CORE_CONTROLLER); new CoreController(objects::CORE_CONTROLLER);
gpioCallbacks::disableAllDecoder(); gpioCallbacks::disableAllDecoder();
@ -154,6 +154,7 @@ void ObjectFactory::produce(void* args) {
createSyrlinksComponents(); createSyrlinksComponents();
#endif /* OBSW_ADD_SYRLINKS == 1 */ #endif /* OBSW_ADD_SYRLINKS == 1 */
createRtdComponents(gpioComIF, pwrSwitcher); createRtdComponents(gpioComIF, pwrSwitcher);
createPayloadComponents(gpioComIF);
#if OBSW_ADD_MGT == 1 #if OBSW_ADD_MGT == 1
I2cCookie* imtqI2cCookie = I2cCookie* imtqI2cCookie =
@ -161,8 +162,8 @@ void ObjectFactory::produce(void* args) {
auto imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie); auto imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie);
static_cast<void>(imtqHandler); static_cast<void>(imtqHandler);
#if OBSW_DEBUG_IMTQ == 1 #if OBSW_DEBUG_IMTQ == 1
imtqHandler->setToGoToNormal(true);
imtqHandler->setStartUpImmediately(); imtqHandler->setStartUpImmediately();
imtqHandler->setToGoToNormal(true);
#else #else
(void)imtqHandler; (void)imtqHandler;
#endif #endif
@ -181,26 +182,6 @@ void ObjectFactory::produce(void* args) {
#endif #endif
#endif #endif
#if OBSW_ADD_PLOC_MPSOC == 1
UartCookie* plocMpsocCookie = new UartCookie(objects::PLOC_MPSOC_HANDLER,
q7s::UART_PLOC_MPSOC_DEV, UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD,
mpsoc::MAX_REPLY_SIZE);
PlocMPSoCHelper* plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
PlocMPSoCHandler* plocMPSoCHandler = new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER,
objects::UART_COM_IF, plocMpsocCookie, plocMpsocHelper);
plocMPSoCHandler->setStartUpImmediately();
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
#if OBSW_ADD_PLOC_SUPERVISOR == 1
UartCookie* plocSupervisorCookie = new UartCookie(
objects::PLOC_SUPERVISOR_HANDLER, q7s::UART_PLOC_SUPERVSIOR_DEV, UartModes::NON_CANONICAL,
uart::PLOC_SUPERVISOR_BAUD, PLOC_SPV::MAX_PACKET_SIZE * 20);
plocSupervisorCookie->setNoFixedSizeReply();
PlocSupervisorHandler* plocSupervisor = new PlocSupervisorHandler(
objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, plocSupervisorCookie);
plocSupervisor->setStartUpImmediately();
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
new FileSystemHandler(objects::FILE_SYSTEM_HANDLER); new FileSystemHandler(objects::FILE_SYSTEM_HANDLER);
#if OBSW_ADD_STAR_TRACKER == 1 #if OBSW_ADD_STAR_TRACKER == 1
@ -215,8 +196,6 @@ void ObjectFactory::produce(void* args) {
#endif /* OBSW_ADD_STAR_TRACKER == 1 */ #endif /* OBSW_ADD_STAR_TRACKER == 1 */
#endif /* TE7020 == 0 */
#if OBSW_USE_CCSDS_IP_CORE == 1 #if OBSW_USE_CCSDS_IP_CORE == 1
createCcsdsComponents(gpioComIF); createCcsdsComponents(gpioComIF);
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */ #endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
@ -231,17 +210,10 @@ void ObjectFactory::produce(void* args) {
} }
void ObjectFactory::createTmpComponents() { void ObjectFactory::createTmpComponents() {
#if BOARD_TE0720 == 1
I2cCookie* i2cCookieTmp1075tcs1 =
new I2cCookie(addresses::TMP1075_TCS_1, TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0"));
I2cCookie* i2cCookieTmp1075tcs2 =
new I2cCookie(addresses::TMP1075_TCS_2, TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0"));
#else
I2cCookie* i2cCookieTmp1075tcs1 = I2cCookie* i2cCookieTmp1075tcs1 =
new I2cCookie(addresses::TMP1075_TCS_1, TMP1075::MAX_REPLY_LENGTH, q7s::I2C_DEFAULT_DEV); new I2cCookie(addresses::TMP1075_TCS_1, TMP1075::MAX_REPLY_LENGTH, q7s::I2C_DEFAULT_DEV);
I2cCookie* i2cCookieTmp1075tcs2 = I2cCookie* i2cCookieTmp1075tcs2 =
new I2cCookie(addresses::TMP1075_TCS_2, TMP1075::MAX_REPLY_LENGTH, q7s::I2C_DEFAULT_DEV); new I2cCookie(addresses::TMP1075_TCS_2, TMP1075::MAX_REPLY_LENGTH, q7s::I2C_DEFAULT_DEV);
#endif
/* Temperature sensors */ /* Temperature sensors */
Tmp1075Handler* tmp1075Handler_1 = Tmp1075Handler* tmp1075Handler_1 =
@ -266,10 +238,8 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, Ua
*uartComIF = new UartComIF(objects::UART_COM_IF); *uartComIF = new UartComIF(objects::UART_COM_IF);
*spiComIF = new SpiComIF(objects::SPI_COM_IF, *gpioComIF); *spiComIF = new SpiComIF(objects::SPI_COM_IF, *gpioComIF);
#if BOARD_TE0720 == 0
/* Adding gpios for chip select decoding to the gpioComIf */ /* Adding gpios for chip select decoding to the gpioComIf */
gpioCallbacks::initSpiCsDecoder(*gpioComIF); gpioCallbacks::initSpiCsDecoder(*gpioComIF);
#endif
} }
void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher) { void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher) {
@ -921,6 +891,7 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF
rtds[idx]->setParent(objects::TCS_BOARD_ASS); rtds[idx]->setParent(objects::TCS_BOARD_ASS);
rtdFdir = new RtdFdir(rtdIds[idx]); rtdFdir = new RtdFdir(rtdIds[idx]);
rtds[idx]->setCustomFdir(rtdFdir); rtds[idx]->setCustomFdir(rtdFdir);
rtds[idx]->setDeviceIdx(idx + 3);
} }
#if OBSW_TEST_RTD == 1 #if OBSW_TEST_RTD == 1
@ -939,6 +910,46 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF
#endif // OBSW_ADD_RTD_DEVICES == 1 #endif // OBSW_ADD_RTD_DEVICES == 1
} }
void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
using namespace gpio;
std::stringstream consumer;
#if OBSW_ADD_PLOC_MPSOC == 1
consumer << "0x" << std::hex << objects::PLOC_MPSOC_HANDLER;
auto gpioConfigMPSoC = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_MPSOC_UART, consumer.str(),
Direction::OUT, Levels::HIGH);
auto mpsocGpioCookie = new GpioCookie;
mpsocGpioCookie->addGpio(gpioIds::ENABLE_MPSOC_UART, gpioConfigMPSoC);
gpioComIF->addGpios(mpsocGpioCookie);
auto mpsocCookie =
new UartCookie(objects::PLOC_MPSOC_HANDLER, q7s::UART_PLOC_MPSOC_DEV,
UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
mpsocCookie->setNoFixedSizeReply();
auto plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
auto plocMPSoC =
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocCookie,
plocMpsocHelper, Gpio(gpioIds::ENABLE_MPSOC_UART, gpioComIF));
plocMPSoC->setStartUpImmediately();
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
#if OBSW_ADD_PLOC_SUPERVISOR == 1
consumer << "0x" << std::hex << objects::PLOC_SUPERVISOR_HANDLER;
auto gpioConfigSupv = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_SUPV_UART, consumer.str(),
Direction::OUT, Levels::HIGH);
auto supvGpioCookie = new GpioCookie;
supvGpioCookie->addGpio(gpioIds::ENABLE_SUPV_UART, gpioConfigSupv);
gpioComIF->addGpios(supvGpioCookie);
auto supervisorCookie = new UartCookie(
objects::PLOC_SUPERVISOR_HANDLER, q7s::UART_PLOC_SUPERVSIOR_DEV, UartModes::NON_CANONICAL,
uart::PLOC_SUPERVISOR_BAUD, PLOC_SPV::MAX_PACKET_SIZE * 20);
supervisorCookie->setNoFixedSizeReply();
PlocSupervisorHandler* plocSupervisor =
new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF,
supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF));
plocSupervisor->setStartUpImmediately();
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
static_cast<void>(consumer);
}
void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
using namespace gpio; using namespace gpio;
GpioCookie* gpioCookieRw = new GpioCookie; GpioCookie* gpioCookieRw = new GpioCookie;
@ -1090,9 +1101,15 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
AxiPtmeConfig* axiPtmeConfig = AxiPtmeConfig* axiPtmeConfig =
new AxiPtmeConfig(objects::AXI_PTME_CONFIG, q7s::UIO_PTME, q7s::uiomapids::PTME_CONFIG); new AxiPtmeConfig(objects::AXI_PTME_CONFIG, q7s::UIO_PTME, q7s::uiomapids::PTME_CONFIG);
PtmeConfig* ptmeConfig = new PtmeConfig(objects::PTME_CONFIG, axiPtmeConfig); PtmeConfig* ptmeConfig = new PtmeConfig(objects::PTME_CONFIG, axiPtmeConfig);
#if OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT == 1
// Set to high value when not sending via syrlinks
static const uint32_t TRANSMITTER_TIMEOUT = 86400000; // 1 day
#else
static const uint32_t TRANSMITTER_TIMEOUT = 900000; // 15 minutes
#endif
CCSDSHandler* ccsdsHandler = new CCSDSHandler( CCSDSHandler* ccsdsHandler = new CCSDSHandler(
objects::CCSDS_HANDLER, objects::PTME, objects::CCSDS_PACKET_DISTRIBUTOR, ptmeConfig, objects::CCSDS_HANDLER, objects::PTME, objects::CCSDS_PACKET_DISTRIBUTOR, ptmeConfig,
gpioComIF, gpioIds::RS485_EN_TX_CLOCK, gpioIds::RS485_EN_TX_DATA); gpioComIF, gpioIds::RS485_EN_TX_CLOCK, gpioIds::RS485_EN_TX_DATA, TRANSMITTER_TIMEOUT);
VirtualChannel* vc = nullptr; VirtualChannel* vc = nullptr;
vc = new VirtualChannel(ccsds::VC0, common::VC0_QUEUE_SIZE, objects::CCSDS_HANDLER); vc = new VirtualChannel(ccsds::VC0, common::VC0_QUEUE_SIZE, objects::CCSDS_HANDLER);
@ -1117,7 +1134,6 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
new PdecHandler(objects::PDEC_HANDLER, objects::CCSDS_HANDLER, gpioComIF, gpioIds::PDEC_RESET, new PdecHandler(objects::PDEC_HANDLER, objects::CCSDS_HANDLER, gpioComIF, gpioIds::PDEC_RESET,
q7s::UIO_PDEC_CONFIG_MEMORY, q7s::UIO_PDEC_RAM, q7s::UIO_PDEC_REGISTERS); q7s::UIO_PDEC_CONFIG_MEMORY, q7s::UIO_PDEC_RAM, q7s::UIO_PDEC_REGISTERS);
#if BOARD_TE0720 == 0
GpioCookie* gpioRS485Chip = new GpioCookie; GpioCookie* gpioRS485Chip = new GpioCookie;
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_TX_CLOCK, "RS485 Transceiver", gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_TX_CLOCK, "RS485 Transceiver",
Direction::OUT, Levels::LOW); Direction::OUT, Levels::LOW);
@ -1135,7 +1151,6 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
gpioRS485Chip->addGpio(gpioIds::RS485_EN_RX_DATA, gpio); gpioRS485Chip->addGpio(gpioIds::RS485_EN_RX_DATA, gpio);
gpioComIF->addGpios(gpioRS485Chip); gpioComIF->addGpios(gpioRS485Chip);
#endif /* BOARD_TE0720 == 0 */
} }
void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF) { void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF) {
@ -1200,103 +1215,7 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF*
} }
void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) { void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
#if BOARD_TE0720 == 0
new Q7STestTask(objects::TEST_TASK); 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 #if OBSW_ADD_SPI_TEST_CODE == 1
new SpiTestClass(objects::SPI_TEST, gpioComIF); new SpiTestClass(objects::SPI_TEST, gpioComIF);
#endif #endif

View File

@ -26,6 +26,7 @@ void createHeaterComponents();
void createSolarArrayDeploymentComponents(); void createSolarArrayDeploymentComponents();
void createSyrlinksComponents(); void createSyrlinksComponents();
void createRtdComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher); void createRtdComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher);
void createPayloadComponents(LinuxLibgpioIF* gpioComIF);
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF); void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF);
void createCcsdsComponents(LinuxLibgpioIF* gpioComIF); void createCcsdsComponents(LinuxLibgpioIF* gpioComIF);
void createTestComponents(LinuxLibgpioIF* gpioComIF); void createTestComponents(LinuxLibgpioIF* gpioComIF);

View File

@ -15,7 +15,7 @@ static int OBSW_ALREADY_RUNNING = -2;
int obsw::obsw() { int obsw::obsw() {
using namespace fsfw; using namespace fsfw;
std::cout << "-- EIVE OBSW --" << std::endl; std::cout << "-- EIVE OBSW --" << std::endl;
#if BOARD_TE0720 == 0 #ifdef TE0720_1CFA
std::cout << "-- Compiled for Linux (Xiphos Q7S) --" << std::endl; std::cout << "-- Compiled for Linux (Xiphos Q7S) --" << std::endl;
#else #else
std::cout << "-- Compiled for Linux (TE0720) --" << std::endl; std::cout << "-- Compiled for Linux (TE0720) --" << std::endl;

View File

@ -6,6 +6,7 @@
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "SdCardManager.h" #include "SdCardManager.h"
#include "eive/definitions.h"
#include "fsfw/ipc/MessageQueueIF.h" #include "fsfw/ipc/MessageQueueIF.h"
#include "fsfw/memory/HasFileSystemIF.h" #include "fsfw/memory/HasFileSystemIF.h"
#include "fsfw/objectmanager/SystemObject.h" #include "fsfw/objectmanager/SystemObject.h"

View File

@ -1,14 +1,14 @@
#include <fstream>
#include <filesystem>
#include "FilesystemHelper.h" #include "FilesystemHelper.h"
#include <filesystem>
#include <fstream>
#include "bsp_q7s/memory/SdCardManager.h" #include "bsp_q7s/memory/SdCardManager.h"
#include "fsfw/serviceinterface/ServiceInterfaceStream.h" #include "fsfw/serviceinterface/ServiceInterfaceStream.h"
FilesystemHelper::FilesystemHelper() { FilesystemHelper::FilesystemHelper() {}
}
FilesystemHelper::~FilesystemHelper() { FilesystemHelper::~FilesystemHelper() {}
}
ReturnValue_t FilesystemHelper::checkPath(std::string path) { ReturnValue_t FilesystemHelper::checkPath(std::string path) {
SdCardManager* sdcMan = SdCardManager::instance(); SdCardManager* sdcMan = SdCardManager::instance();
@ -16,14 +16,14 @@ ReturnValue_t FilesystemHelper::checkPath(std::string path) {
sif::warning << "FilesystemHelper::checkPath: Invalid SD card manager" << std::endl; sif::warning << "FilesystemHelper::checkPath: Invalid SD card manager" << std::endl;
return RETURN_FAILED; return RETURN_FAILED;
} }
if (path.substr(0, sizeof(SdCardManager::SD_0_MOUNT_POINT)) if (path.substr(0, sizeof(SdCardManager::SD_0_MOUNT_POINT)) ==
== std::string(SdCardManager::SD_0_MOUNT_POINT)) { std::string(SdCardManager::SD_0_MOUNT_POINT)) {
if (!sdcMan->isSdCardMounted(sd::SLOT_0)) { if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
sif::warning << "FilesystemHelper::checkPath: SD card 0 not mounted" << std::endl; sif::warning << "FilesystemHelper::checkPath: SD card 0 not mounted" << std::endl;
return SD_NOT_MOUNTED; return SD_NOT_MOUNTED;
} }
} else if (path.substr(0, sizeof(SdCardManager::SD_1_MOUNT_POINT)) } else if (path.substr(0, sizeof(SdCardManager::SD_1_MOUNT_POINT)) ==
== std::string(SdCardManager::SD_1_MOUNT_POINT)) { std::string(SdCardManager::SD_1_MOUNT_POINT)) {
if (!sdcMan->isSdCardMounted(sd::SLOT_0)) { if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
sif::warning << "FilesystemHelper::checkPath: SD card 1 not mounted" << std::endl; sif::warning << "FilesystemHelper::checkPath: SD card 1 not mounted" << std::endl;
return SD_NOT_MOUNTED; return SD_NOT_MOUNTED;

View File

@ -2,8 +2,9 @@
#define BSP_Q7S_MEMORY_FILESYSTEMHELPER_H_ #define BSP_Q7S_MEMORY_FILESYSTEMHELPER_H_
#include <string> #include <string>
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "commonClassIds.h" #include "commonClassIds.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
/** /**
* @brief This class implements often used functions concerning the file system management. * @brief This class implements often used functions concerning the file system management.
@ -12,7 +13,6 @@
*/ */
class FilesystemHelper : public HasReturnvaluesIF { class FilesystemHelper : public HasReturnvaluesIF {
public: public:
static const uint8_t INTERFACE_ID = CLASS_ID::FILE_SYSTEM_HELPER; static const uint8_t INTERFACE_ID = CLASS_ID::FILE_SYSTEM_HELPER;
//! [EXPORT] : [COMMENT] SD card specified with path string not mounted //! [EXPORT] : [COMMENT] SD card specified with path string not mounted

View File

@ -1,8 +1,9 @@
#include "ObjectFactory.h" #include "ObjectFactory.h"
#include <devConf.h> #include <devConf.h>
#include <fsfw_hal/linux/uart/UartComIF.h> #include "fsfw_hal/linux/uart/UartComIF.h"
#include <fsfw_hal/linux/uart/UartCookie.h> #include "fsfw_hal/linux/i2c/I2cComIF.h"
#include "fsfw_hal/linux/uart/UartCookie.h"
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "busConf.h" #include "busConf.h"
@ -11,11 +12,16 @@
#include "fsfw/tmtcpacket/pus/tm.h" #include "fsfw/tmtcpacket/pus/tm.h"
#include "fsfw/tmtcservices/CommandingServiceBase.h" #include "fsfw/tmtcservices/CommandingServiceBase.h"
#include "fsfw/tmtcservices/PusServiceBase.h" #include "fsfw/tmtcservices/PusServiceBase.h"
#include "fsfw_hal/linux/i2c/I2cCookie.h"
#include "linux/devices/ploc/PlocMPSoCHandler.h" #include "linux/devices/ploc/PlocMPSoCHandler.h"
#include "linux/devices/ploc/PlocMPSoCHelper.h" #include "linux/devices/ploc/PlocMPSoCHelper.h"
#include "mission/devices/Tmp1075Handler.h"
#include "mission/core/GenericFactory.h" #include "mission/core/GenericFactory.h"
#include "mission/utility/TmFunnel.h" #include "mission/utility/TmFunnel.h"
#include "test/gpio/DummyGpioIF.h"
#include "objects/systemObjectList.h" #include "objects/systemObjectList.h"
#include "devices/addresses.h"
#include "devices/gpioIds.h"
#include "tmtc/apid.h" #include "tmtc/apid.h"
#include "tmtc/pusIds.h" #include "tmtc/pusIds.h"
@ -39,12 +45,108 @@ void ObjectFactory::produce(void* args) {
#if OBSW_ADD_PLOC_MPSOC == 1 #if OBSW_ADD_PLOC_MPSOC == 1
UartCookie* mpsocUartCookie = UartCookie* mpsocUartCookie =
new UartCookie(objects::PLOC_MPSOC_HANDLER, te0720_1cfa::MPSOC_UART, new UartCookie(objects::PLOC_MPSOC_HANDLER, te0720_1cfa::MPSOC_UART, UartModes::NON_CANONICAL,
UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE); uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
mpsocUartCookie->setNoFixedSizeReply();
PlocMPSoCHelper* plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER); PlocMPSoCHelper* plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
new UartComIF(objects::UART_COM_IF); new UartComIF(objects::UART_COM_IF);
PlocMPSoCHandler* plocMPSoCHandler = new PlocMPSoCHandler( auto dummyGpioIF = new DummyGpioIF();
objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocUartCookie, plocMpsocHelper); PlocMPSoCHandler* plocMPSoCHandler =
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocUartCookie,
plocMpsocHelper, Gpio(gpioIds::ENABLE_MPSOC_UART, dummyGpioIF));
plocMPSoCHandler->setStartUpImmediately(); plocMPSoCHandler->setStartUpImmediately();
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */ #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
new I2cComIF(objects::I2C_COM_IF);
I2cCookie* i2cCookieTmp1075tcs1 =
new I2cCookie(addresses::TMP1075_TCS_1, TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0"));
I2cCookie* i2cCookieTmp1075tcs2 =
new I2cCookie(addresses::TMP1075_TCS_2, TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0"));
/* Temperature sensors */
new Tmp1075Handler(objects::TMP1075_HANDLER_1, objects::I2C_COM_IF, i2cCookieTmp1075tcs1);
new Tmp1075Handler(objects::TMP1075_HANDLER_2, objects::I2C_COM_IF, i2cCookieTmp1075tcs2);
} }

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# Run with: source q7s-env-win-sh [OPTIONS] # Run with: source win-q7s-env.sh [OPTIONS]
function help () { function help () {
echo "source q7s-env-win-sh [options] -t|--toolchain=<toolchain path> -s|--sysroot=<sysroot path>" echo "source win-q7s-env.sh [options] -t|--toolchain=<toolchain path> -s|--sysroot=<sysroot path>"
} }
TOOLCHAIN_PATH="/c/Xilinx/Vitis/2019.2/gnu/aarch32/nt/gcc-arm-linux-gnueabi/bin" TOOLCHAIN_PATH="/c/Xilinx/Vitis/2019.2/gnu/aarch32/nt/gcc-arm-linux-gnueabi/bin"

View File

@ -119,7 +119,11 @@ enum gpioId_t {
PLPCDU_ENB_TX, PLPCDU_ENB_TX,
PLPCDU_ENB_HPA, PLPCDU_ENB_HPA,
PLPCDU_ENB_MPA, PLPCDU_ENB_MPA,
PLPCDU_ADC_CS PLPCDU_ADC_CS,
ENABLE_MPSOC_UART,
ENABLE_SUPV_UART
}; };
} }

View File

@ -39,7 +39,7 @@ static const uint8_t OFF = 0;
const std::array<uint8_t, NUMBER_OF_SWITCHES> INIT_SWITCH_STATES = { const std::array<uint8_t, NUMBER_OF_SWITCHES> INIT_SWITCH_STATES = {
// PDU 1 // PDU 1
// Because the TE0720 is not connected to the PCDU, this switch is always on // Because the TE0720 is not connected to the PCDU, this switch is always on
#if BOARD_TE0720 == 1 #ifdef TE0720_1CFA
ON, ON,
#else #else
OFF, OFF,

View File

@ -0,0 +1,25 @@
#ifndef COMMON_CONFIG_DEFINITIONS_H_
#define COMMON_CONFIG_DEFINITIONS_H_
#include <cstdint>
namespace config {
static constexpr uint32_t PL_PCDU_TRANSITION_TIMEOUT_MS = 20 * 60 * 1000;
static constexpr uint32_t LONGEST_MODE_TIMEOUT_SECONDS = PL_PCDU_TRANSITION_TIMEOUT_MS / 1000;
/* Add mission configuration flags here */
static constexpr uint32_t OBSW_FILESYSTEM_HANDLER_QUEUE_SIZE = 50;
static constexpr uint32_t PLOC_UPDATER_QUEUE_SIZE = 50;
static constexpr uint32_t STR_IMG_HELPER_QUEUE_SIZE = 50;
static constexpr uint8_t LIVE_TM = 0;
/* Limits for filename and path checks */
static constexpr uint32_t MAX_PATH_SIZE = 100;
static constexpr uint32_t MAX_FILENAME_SIZE = 50;
}
#endif /* COMMON_CONFIG_DEFINITIONS_H_ */

2
fsfw

@ -1 +1 @@
Subproject commit bac8b4088009a71afbb0225e634dabcbff0d9ec1 Subproject commit b52f19254b8072a32203eaab91ea3c65b513ba7e

View File

@ -144,7 +144,7 @@
12016;0x2ef0;STR_HELPER_REQUESTING_MSG_FAILED;LOW;;linux/devices/startracker/StrHelper.h 12016;0x2ef0;STR_HELPER_REQUESTING_MSG_FAILED;LOW;;linux/devices/startracker/StrHelper.h
12100;0x2f44;MPSOC_FLASH_WRITE_FAILED;LOW;Flash write fails;linux/devices/ploc/PlocMPSoCHelper.h 12100;0x2f44;MPSOC_FLASH_WRITE_FAILED;LOW;Flash write fails;linux/devices/ploc/PlocMPSoCHelper.h
12101;0x2f45;MPSOC_FLASH_WRITE_SUCCESSFUL;LOW;Flash write successful;linux/devices/ploc/PlocMPSoCHelper.h 12101;0x2f45;MPSOC_FLASH_WRITE_SUCCESSFUL;LOW;Flash write successful;linux/devices/ploc/PlocMPSoCHelper.h
12102;0x2f46;SENDING_COMMAND_FAILED;LOW;Communication interface returned failure when trying to send the command ot the PLOCP1: Return value returned by the communication interface sendMessage functionP2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h 12102;0x2f46;SENDING_COMMAND_FAILED;LOW;;linux/devices/ploc/PlocMPSoCHelper.h
12103;0x2f47;MPSOC_HELPER_REQUESTING_REPLY_FAILED;LOW;Request receive message of communication interface failed P1: Return value returned by the communication interface requestReceiveMessage function P2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h 12103;0x2f47;MPSOC_HELPER_REQUESTING_REPLY_FAILED;LOW;Request receive message of communication interface failed P1: Return value returned by the communication interface requestReceiveMessage function P2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h
12104;0x2f48;MPSOC_HELPER_READING_REPLY_FAILED;LOW;Reading receive message of communication interface failed P1: Return value returned by the communication interface readingReceivedMessage function P2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h 12104;0x2f48;MPSOC_HELPER_READING_REPLY_FAILED;LOW;Reading receive message of communication interface failed P1: Return value returned by the communication interface readingReceivedMessage function P2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h
12105;0x2f49;MISSING_ACK;LOW;Did not receive acknowledgement report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h 12105;0x2f49;MISSING_ACK;LOW;Did not receive acknowledgement report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h

1 2200 0x0898 STORE_SEND_WRITE_FAILED LOW fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
144 12016 0x2ef0 STR_HELPER_REQUESTING_MSG_FAILED LOW linux/devices/startracker/StrHelper.h
145 12100 0x2f44 MPSOC_FLASH_WRITE_FAILED LOW Flash write fails linux/devices/ploc/PlocMPSoCHelper.h
146 12101 0x2f45 MPSOC_FLASH_WRITE_SUCCESSFUL LOW Flash write successful linux/devices/ploc/PlocMPSoCHelper.h
147 12102 0x2f46 SENDING_COMMAND_FAILED LOW linux/devices/ploc/PlocMPSoCHelper.h
148 12103 0x2f47 MPSOC_HELPER_REQUESTING_REPLY_FAILED LOW Request receive message of communication interface failed P1: Return value returned by the communication interface requestReceiveMessage function P2: Internal state of MPSoC helper linux/devices/ploc/PlocMPSoCHelper.h
149 12104 0x2f48 MPSOC_HELPER_READING_REPLY_FAILED LOW Reading receive message of communication interface failed P1: Return value returned by the communication interface readingReceivedMessage function P2: Internal state of MPSoC helper linux/devices/ploc/PlocMPSoCHelper.h
150 12105 0x2f49 MISSING_ACK LOW Did not receive acknowledgement report P1: Number of bytes missing P2: Internal state of MPSoC helper linux/devices/ploc/PlocMPSoCHelper.h

View File

@ -470,6 +470,7 @@
0x57e1;DWLPWRON_InvalidLaneRate;Received command has invalid lane rate (valid lane rate are 0 - 9);0xE1;linux/devices/devicedefinitions/PlocMPSoCDefinitions.h;DWLPWRON_CMD 0x57e1;DWLPWRON_InvalidLaneRate;Received command has invalid lane rate (valid lane rate are 0 - 9);0xE1;linux/devices/devicedefinitions/PlocMPSoCDefinitions.h;DWLPWRON_CMD
0x60a0;PLMEMDUMP_MramAddressTooHigh;The capacity of the MRAM amounts to 512 kB. Thus the maximum address must not be higher than 0x7d000.;0xA0;linux/devices/ploc/PlocMemoryDumper.h;PLOC_MEMORY_DUMPER 0x60a0;PLMEMDUMP_MramAddressTooHigh;The capacity of the MRAM amounts to 512 kB. Thus the maximum address must not be higher than 0x7d000.;0xA0;linux/devices/ploc/PlocMemoryDumper.h;PLOC_MEMORY_DUMPER
0x60a1;PLMEMDUMP_MramInvalidAddressCombination;The specified end address is lower than the start address;0xA1;linux/devices/ploc/PlocMemoryDumper.h;PLOC_MEMORY_DUMPER 0x60a1;PLMEMDUMP_MramInvalidAddressCombination;The specified end address is lower than the start address;0xA1;linux/devices/ploc/PlocMemoryDumper.h;PLOC_MEMORY_DUMPER
0x67a0; PLMPHLP_FileClosedAccidentally;File accidentally close;0xA0;linux/devices/ploc/PlocMPSoCHelper.h;PLOC_MPSOC_HELPER
0x5da0;PLUD_UpdaterBusy;Updater is already performing an update;0xA0;linux/devices/ploc/PlocUpdater.h;PLOC_UPDATER 0x5da0;PLUD_UpdaterBusy;Updater is already performing an update;0xA0;linux/devices/ploc/PlocUpdater.h;PLOC_UPDATER
0x5da1;PLUD_NameTooLong;Received update command with invalid path string (too long).;0xA1;linux/devices/ploc/PlocUpdater.h;PLOC_UPDATER 0x5da1;PLUD_NameTooLong;Received update command with invalid path string (too long).;0xA1;linux/devices/ploc/PlocUpdater.h;PLOC_UPDATER
0x5da2;PLUD_SdNotMounted;Received command to initiate update but SD card with update image not mounted.;0xA2;linux/devices/ploc/PlocUpdater.h;PLOC_UPDATER 0x5da2;PLUD_SdNotMounted;Received command to initiate update but SD card with update image not mounted.;0xA2;linux/devices/ploc/PlocUpdater.h;PLOC_UPDATER

Can't render this file because it has a wrong number of fields in line 18.

View File

@ -1,7 +1,7 @@
/** /**
* @brief Auto-generated event translation file. Contains 169 translations. * @brief Auto-generated event translation file. Contains 169 translations.
* @details * @details
* Generated on: 2022-03-25 18:53:13 * Generated on: 2022-03-28 09:51:17
*/ */
#include "translateEvents.h" #include "translateEvents.h"

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 117 translations. * Contains 117 translations.
* Generated on: 2022-03-25 18:53:22 * Generated on: 2022-03-28 09:51:13
*/ */
#include "translateObjects.h" #include "translateObjects.h"

View File

@ -1,11 +1,12 @@
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ #ifndef MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_
#define MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ #define MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_
#include "OBSWConfig.h"
#include "MPSoCReturnValuesIF.h" #include "MPSoCReturnValuesIF.h"
#include <fsfw/tmtcpacket/SpacePacket.h> #include "OBSWConfig.h"
#include <fsfw/globalfunctions/CRC.h> #include "eive/definitions.h"
#include <fsfw/serialize/SerializeAdapter.h> #include "fsfw/globalfunctions/CRC.h"
#include "fsfw/serialize/SerializeAdapter.h"
#include "fsfw/tmtcpacket/SpacePacket.h"
namespace mpsoc { namespace mpsoc {
@ -54,11 +55,12 @@ namespace apid {
static const uint16_t ACK_FAILURE = 0x401; static const uint16_t ACK_FAILURE = 0x401;
static const uint16_t EXE_SUCCESS = 0x402; static const uint16_t EXE_SUCCESS = 0x402;
static const uint16_t EXE_FAILURE = 0x403; static const uint16_t EXE_FAILURE = 0x403;
} } // namespace apid
/** Offset from first byte in space packet to first byte of data field */ /** Offset from first byte in space packet to first byte of data field */
static const uint8_t DATA_FIELD_OFFSET = 6; static const uint8_t DATA_FIELD_OFFSET = 6;
static const size_t MEM_READ_RPT_LEN_OFFSET = 10; 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 * 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 * 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. * @brief Abstract base class for TC space packet of MPSoC.
*/ */
class TcBase : public SpacePacket, public MPSoCReturnValuesIF { class TcBase : public SpacePacket, public MPSoCReturnValuesIF {
public: public:
// Initial length field of space packet. Will always be updated when packet is created. // Initial length field of space packet. Will always be updated when packet is created.
static const uint16_t INIT_LENGTH = 1; 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 * @param sequenceCount Sequence count of space packet which will be incremented with each
* sent and received packets. * sent and received packets.
*/ */
TcBase(uint16_t apid, uint16_t sequenceCount) : TcBase(uint16_t apid, uint16_t sequenceCount)
SpacePacket(INIT_LENGTH, true, apid, sequenceCount) { : SpacePacket(INIT_LENGTH, true, apid, sequenceCount) {}
}
/** /**
* @brief Function to initialize the space packet * @brief Function to initialize the space packet
@ -144,8 +146,8 @@ protected:
size_t serializedSize = 0; size_t serializedSize = 0;
uint32_t full_size = getFullSize(); uint32_t full_size = getFullSize();
uint16_t crc = CRC::crc16ccitt(getWholeData(), full_size - CRC_SIZE); uint16_t crc = CRC::crc16ccitt(getWholeData(), full_size - CRC_SIZE);
result = SerializeAdapter::serialize<uint16_t>(&crc, result = SerializeAdapter::serialize<uint16_t>(
this->localData.byteStream + full_size - CRC_SIZE, &serializedSize, sizeof(crc), &crc, this->localData.byteStream + full_size - CRC_SIZE, &serializedSize, sizeof(crc),
SerializeIF::Endianness::BIG); SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::debug << "TcBase::addCrc: Failed to serialize crc field" << std::endl; sif::debug << "TcBase::addCrc: Failed to serialize crc field" << std::endl;
@ -159,17 +161,16 @@ protected:
*/ */
class TmPacket : public SpacePacket, public MPSoCReturnValuesIF { class TmPacket : public SpacePacket, public MPSoCReturnValuesIF {
public: public:
/** /**
* @brief Constructor creates idle packet and sets length field to maximum allowed size. * @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() { ReturnValue_t checkCrc() {
uint8_t* crcPtr = this->getPacketData() + this->getPacketDataLength() - 1; uint8_t* crcPtr = this->getPacketData() + this->getPacketDataLength() - 1;
uint16_t receivedCrc = *(crcPtr) << 8 | *(crcPtr + 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) { if (recalculatedCrc != receivedCrc) {
return CRC_FAILURE; return CRC_FAILURE;
} }
@ -182,21 +183,16 @@ public:
*/ */
class TcMemRead : public TcBase { class TcMemRead : public TcBase {
public: public:
/** /**
* @brief Constructor * @brief Constructor
*/ */
TcMemRead(uint16_t sequenceCount) : TcMemRead(uint16_t sequenceCount) : TcBase(apid::TC_MEM_READ, sequenceCount) {
TcBase(apid::TC_MEM_READ, sequenceCount) {
this->setPacketDataLength(PACKET_LENGTH); this->setPacketDataLength(PACKET_LENGTH);
} }
uint16_t getMemLen() const { uint16_t getMemLen() const { return memLen; }
return memLen;
}
protected: protected:
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
result = lengthCheck(commandDataLen); result = lengthCheck(commandDataLen);
@ -204,12 +200,12 @@ protected:
return result; return result;
} }
std::memcpy(this->localData.fields.buffer, commandData, MEM_ADDRESS_SIZE); std::memcpy(this->localData.fields.buffer, commandData, MEM_ADDRESS_SIZE);
std::memcpy(this->localData.fields.buffer + MEM_ADDRESS_SIZE, std::memcpy(this->localData.fields.buffer + MEM_ADDRESS_SIZE, commandData + MEM_ADDRESS_SIZE,
commandData + MEM_ADDRESS_SIZE, MEM_LEN_SIZE); MEM_LEN_SIZE);
size_t size = sizeof(memLen); size_t size = sizeof(memLen);
const uint8_t* memLenPtr = commandData + MEM_ADDRESS_SIZE; const uint8_t* memLenPtr = commandData + MEM_ADDRESS_SIZE;
result = SerializeAdapter::deSerialize(&memLen, &memLenPtr, &size, result =
SerializeIF::Endianness::BIG); SerializeAdapter::deSerialize(&memLen, &memLenPtr, &size, SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
@ -217,7 +213,6 @@ protected:
} }
private: private:
static const size_t COMMAND_LENGTH = 6; static const size_t COMMAND_LENGTH = 6;
static const size_t MEM_ADDRESS_SIZE = 4; static const size_t MEM_ADDRESS_SIZE = 4;
static const size_t MEM_LEN_SIZE = 2; static const size_t MEM_LEN_SIZE = 2;
@ -242,11 +237,9 @@ public:
/** /**
* @brief Constructor * @brief Constructor
*/ */
TcMemWrite(uint16_t sequenceCount) : TcBase(apid::TC_MEM_WRITE, sequenceCount) { TcMemWrite(uint16_t sequenceCount) : TcBase(apid::TC_MEM_WRITE, sequenceCount) {}
}
protected: protected:
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
result = lengthCheck(commandDataLen); result = lengthCheck(commandDataLen);
@ -254,14 +247,13 @@ protected:
return result; return result;
} }
std::memcpy(this->localData.fields.buffer, commandData, commandDataLen); std::memcpy(this->localData.fields.buffer, commandData, commandDataLen);
uint16_t memLen = *(commandData + MEM_ADDRESS_SIZE) << 8 uint16_t memLen =
| *(commandData + MEM_ADDRESS_SIZE + 1); *(commandData + MEM_ADDRESS_SIZE) << 8 | *(commandData + MEM_ADDRESS_SIZE + 1);
this->setPacketDataLength(memLen * 4 + FIX_LENGTH - 1); this->setPacketDataLength(memLen * 4 + FIX_LENGTH - 1);
return result; return result;
} }
private: private:
// Min length consists of 4 byte address, 2 byte mem length field, 4 byte data (1 word) // 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 MIN_COMMAND_DATA_LENGTH = 10;
static const size_t MEM_ADDRESS_SIZE = 4; static const size_t MEM_ADDRESS_SIZE = 4;
@ -281,29 +273,31 @@ private:
*/ */
class FlashFopen : public TcBase { class FlashFopen : public TcBase {
public: 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 APPEND = 'a';
static const char WRITE = 'w'; static const char WRITE = 'w';
static const char READ = 'r'; 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; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
size_t nameSize = filename.size(); size_t nameSize = filename.size();
std::memcpy(this->getPacketData(), filename.c_str(), std::memcpy(this->getPacketData(), filename.c_str(), nameSize);
nameSize); *(this->getPacketData() + nameSize) = NULL_TERMINATOR;
std::memcpy(this->getPacketData() + nameSize + 1, &accessMode, std::memcpy(this->getPacketData() + nameSize + sizeof(NULL_TERMINATOR), &accessMode,
sizeof(accessMode)); sizeof(accessMode));
this->setPacketDataLength(nameSize + CRC_SIZE - 1); this->setPacketDataLength(nameSize + sizeof(NULL_TERMINATOR) + sizeof(accessMode) + CRC_SIZE -
1);
result = addCrc(); result = addCrc();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
return result; return result;
} }
private:
char accessMode = APPEND;
}; };
/** /**
@ -311,16 +305,14 @@ public:
*/ */
class FlashFclose : public TcBase { class FlashFclose : public TcBase {
public: 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 createPacket(std::string filename) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
size_t nameSize = filename.size(); size_t nameSize = filename.size();
std::memcpy(this->getPacketData(), filename.c_str(), nameSize); 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(); result = addCrc();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
@ -334,25 +326,33 @@ public:
*/ */
class TcFlashWrite : public TcBase { class TcFlashWrite : public TcBase {
public: public:
TcFlashWrite(uint16_t sequenceCount) : TcBase(apid::TC_FLASHWRITE, sequenceCount) {}
TcFlashWrite(uint16_t sequenceCount) : ReturnValue_t createPacket(const uint8_t* writeData, uint32_t writeLen_) {
TcBase(apid::TC_FLASHWRITE, sequenceCount) { ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
} writeLen = writeLen_;
ReturnValue_t createPacket(uint8_t* writeData, uint32_t writeLen) {
if (writeLen > MAX_DATA_SIZE) { if (writeLen > MAX_DATA_SIZE) {
sif::debug << "FlashWrite::createPacket: Command data too big" << std::endl; sif::debug << "FlashWrite::createPacket: Command data too big" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED; 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); std::memcpy(this->getPacketData() + sizeof(writeLen), writeData, writeLen);
this->setPacketDataLength(static_cast<uint16_t>(writeLen + CRC_SIZE - 1)); this->setPacketDataLength(static_cast<uint16_t>(writeLen + CRC_SIZE - 1));
ReturnValue_t result = addCrc(); result = addCrc();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
private:
uint32_t writeLen = 0;
}; };
/** /**
@ -360,16 +360,14 @@ public:
*/ */
class TcFlashDelete : public TcBase { class TcFlashDelete : public TcBase {
public: 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 createPacket(std::string filename) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
size_t nameSize = filename.size(); size_t nameSize = filename.size();
std::memcpy(this->getPacketData(), filename.c_str(), nameSize); 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(); result = addCrc();
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
@ -383,10 +381,7 @@ public:
*/ */
class TcReplayStop : public TcBase { class TcReplayStop : public TcBase {
public: 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 createPacket() {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
@ -407,11 +402,9 @@ public:
/** /**
* @brief Constructor * @brief Constructor
*/ */
TcReplayStart(uint16_t sequenceCount) : TcBase(apid::TC_REPLAY_START, sequenceCount) { TcReplayStart(uint16_t sequenceCount) : TcBase(apid::TC_REPLAY_START, sequenceCount) {}
}
protected: protected:
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
result = lengthCheck(commandDataLen); result = lengthCheck(commandDataLen);
@ -428,7 +421,6 @@ protected:
} }
private: private:
static const size_t COMMAND_DATA_LENGTH = 1; static const size_t COMMAND_DATA_LENGTH = 1;
static const uint8_t REPEATING = 0; static const uint8_t REPEATING = 0;
static const uint8_t ONCE = 1; static const uint8_t ONCE = 1;
@ -458,11 +450,9 @@ public:
/** /**
* @brief Constructor * @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: protected:
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
result = lengthCheck(commandDataLen); result = lengthCheck(commandDataLen);
@ -485,7 +475,6 @@ protected:
} }
private: private:
static const uint8_t INTERFACE_ID = CLASS_ID::DWLPWRON_CMD; static const uint8_t INTERFACE_ID = CLASS_ID::DWLPWRON_CMD;
//! [EXPORT] : [COMMENT] Received command has invalid JESD mode (valid modes are 0 - 5) //! [EXPORT] : [COMMENT] Received command has invalid JESD mode (valid modes are 0 - 5)
@ -528,10 +517,7 @@ private:
*/ */
class TcDownlinkPwrOff : public TcBase { class TcDownlinkPwrOff : public TcBase {
public: 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 createPacket() {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
@ -544,7 +530,6 @@ public:
} }
}; };
/** /**
* @brief This class helps to build the replay start command. * @brief This class helps to build the replay start command.
*/ */
@ -553,10 +538,10 @@ public:
/** /**
* @brief Constructor * @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: protected:
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
result = lengthCheck(commandDataLen); result = lengthCheck(commandDataLen);
@ -564,17 +549,18 @@ protected:
return result; return result;
} }
std::memcpy(this->localData.fields.buffer, commandData, commandDataLen); 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; return result;
} }
private: private:
static const size_t USE_DECODING_LENGTH = 1; static const size_t USE_DECODING_LENGTH = 1;
ReturnValue_t lengthCheck(size_t commandDataLen) { ReturnValue_t lengthCheck(size_t commandDataLen) {
if (commandDataLen > USE_DECODING_LENGTH + MAX_FILENAME_SIZE) { 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 INVALID_LENGTH;
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
@ -601,16 +587,11 @@ class FlashWritePusCmd : public MPSoCReturnValuesIF {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
std::string getObcFile() { std::string getObcFile() { return obcFile; }
return obcFile;
}
std::string getMPSoCFile() { std::string getMPSoCFile() { return mpsocFile; }
return mpsocFile;
}
private: private:
static const size_t SIZE_NULL_TERMINATOR = 1; static const size_t SIZE_NULL_TERMINATOR = 1;
std::string obcFile = ""; std::string obcFile = "";
std::string mpsocFile = ""; std::string mpsocFile = "";
@ -621,10 +602,7 @@ class FlashWritePusCmd : public MPSoCReturnValuesIF {
*/ */
class TcModeReplay : public TcBase { class TcModeReplay : public TcBase {
public: 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 createPacket() {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
@ -637,8 +615,6 @@ public:
} }
}; };
} } // namespace mpsoc
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ */ #endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ */

View File

@ -5,10 +5,13 @@
#include "fsfw/globalfunctions/CRC.h" #include "fsfw/globalfunctions/CRC.h"
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,
: DeviceHandlerBase(objectId, uartComIFid, comCookie), plocMPSoCHelper(plocMPSoCHelper) { Gpio uartIsolatorSwitch)
if (comCookie == NULL) { : DeviceHandlerBase(objectId, uartComIFid, comCookie),
sif::error << "PlocMPSoCHandler: Invalid com cookie" << std::endl; plocMPSoCHelper(plocMPSoCHelper),
uartIsolatorSwitch(uartIsolatorSwitch) {
if (comCookie == nullptr) {
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);
} }
@ -100,7 +103,11 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI
return result; return result;
} }
plocMPSoCHelperExecuting = true; plocMPSoCHelperExecuting = true;
break; return EXECUTION_FINISHED;
}
case (mpsoc::OBSW_RESET_SEQ_COUNT): {
sequenceCount = 0;
return EXECUTION_FINISHED;
} }
default: default:
break; break;
@ -114,9 +121,13 @@ void PlocMPSoCHandler::doStartUp() {
#else #else
setMode(_MODE_TO_ON); setMode(_MODE_TO_ON);
#endif #endif
uartIsolatorSwitch.pullHigh();
} }
void PlocMPSoCHandler::doShutDown() { setMode(_MODE_POWER_DOWN); } void PlocMPSoCHandler::doShutDown() {
uartIsolatorSwitch.pullLow();
setMode(_MODE_POWER_DOWN);
}
ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
return NOTHING_TO_SEND; return NOTHING_TO_SEND;
@ -167,10 +178,6 @@ ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t device
result = prepareTcModeReplay(); result = prepareTcModeReplay();
break; break;
} }
case (mpsoc::OBSW_RESET_SEQ_COUNT): {
sequenceCount = 0;
break;
}
default: default:
sif::debug << "PlocMPSoCHandler::buildCommandFromCommand: Command not implemented" sif::debug << "PlocMPSoCHandler::buildCommandFromCommand: Command not implemented"
<< std::endl; << std::endl;
@ -198,7 +205,6 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() {
this->insertInCommandMap(mpsoc::TC_DOWNLINK_PWR_OFF); this->insertInCommandMap(mpsoc::TC_DOWNLINK_PWR_OFF);
this->insertInCommandMap(mpsoc::TC_REPLAY_WRITE_SEQUENCE); this->insertInCommandMap(mpsoc::TC_REPLAY_WRITE_SEQUENCE);
this->insertInCommandMap(mpsoc::TC_MODE_REPLAY); this->insertInCommandMap(mpsoc::TC_MODE_REPLAY);
this->insertInCommandMap(mpsoc::OBSW_RESET_SEQ_COUNT);
this->insertInReplyMap(mpsoc::ACK_REPORT, 1, nullptr, mpsoc::SIZE_ACK_REPORT); this->insertInReplyMap(mpsoc::ACK_REPORT, 1, nullptr, mpsoc::SIZE_ACK_REPORT);
this->insertInReplyMap(mpsoc::EXE_REPORT, 3, nullptr, mpsoc::SIZE_EXE_REPORT); this->insertInReplyMap(mpsoc::EXE_REPORT, 3, nullptr, mpsoc::SIZE_EXE_REPORT);
this->insertInReplyMap(mpsoc::TM_MEMORY_READ_REPORT, 2, nullptr, mpsoc::SIZE_TM_MEM_READ_REPORT); this->insertInReplyMap(mpsoc::TM_MEMORY_READ_REPORT, 2, nullptr, mpsoc::SIZE_TM_MEM_READ_REPORT);
@ -603,13 +609,15 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
switch (command->first) { switch (command->first) {
case mpsoc::TC_REPLAY_WRITE_SEQUENCE: { case mpsoc::TC_REPLAY_WRITE_SEQUENCE: {
DeviceReplyIter iter = deviceReplyMap.find(mpsoc::EXE_REPORT); DeviceReplyIter iter = deviceReplyMap.find(mpsoc::EXE_REPORT);
if (iter != deviceReplyMap.end()) {
// Overwrite delay cycles because replay write sequence command can required up to // Overwrite delay cycles because replay write sequence command can required up to
// 30 seconds for execution // 30 seconds for execution
iter->second.delayCycles = mpsoc::TC_WRITE_SEQ_EXECUTION_DELAY; iter->second.delayCycles = mpsoc::TC_WRITE_SEQ_EXECUTION_DELAY;
} else { break;
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Unknown reply id" << std::endl;
} }
case mpsoc::TC_DOWNLINK_PWR_ON: {
DeviceReplyIter iter = deviceReplyMap.find(mpsoc::EXE_REPORT);
//
iter->second.delayCycles = mpsoc::TC_DOWNLINK_PWR_ON;
break; break;
} }
default: default:
@ -719,6 +727,7 @@ void PlocMPSoCHandler::disableAllReplies() {
/* We must always disable the execution report reply here */ /* We must always disable the execution report reply here */
disableExeReportReply(); disableExeReportReply();
nextReplyId = mpsoc::NONE;
} }
void PlocMPSoCHandler::sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status) { void PlocMPSoCHandler::sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status) {
@ -743,7 +752,7 @@ void PlocMPSoCHandler::disableExeReportReply() {
DeviceReplyInfo* info = &(iter->second); DeviceReplyInfo* info = &(iter->second);
info->delayCycles = 0; info->delayCycles = 0;
info->command = deviceCommandMap.end(); 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; info->command->second.expectedReplies = 0;
} }

View File

@ -2,32 +2,34 @@
#define BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ #define BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_
#include <string> #include <string>
#include "PlocMPSoCHelper.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h"
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw/ipc/QueueFactory.h" #include "fsfw/ipc/QueueFactory.h"
#include "fsfw/tmtcservices/SourceSequenceCounter.h" #include "fsfw/tmtcservices/SourceSequenceCounter.h"
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h" #include "fsfw_hal/linux/uart/UartComIF.h"
#include "PlocMPSoCHelper.h" #include "fsfw_hal/linux/gpio/Gpio.h"
#include "linux/devices/devicedefinitions/MPSoCReturnValuesIF.h" #include "linux/devices/devicedefinitions/MPSoCReturnValuesIF.h"
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
/** /**
* @brief This is the device handler for the MPSoC of the payload computer. * @brief This is the device handler for the MPSoC of the payload computer.
* *
* @details The PLOC uses the space packet protocol for communication. On each command the PLOC * @details The PLOC uses the space packet protocol for communication. Each command will be
* answers with at least one acknowledgment and one execution report. * answered with at least one acknowledgment and one execution report.
* Flight manual: https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/PLOC_MPSoC * Flight manual:
* ICD: https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_TAS-ILH-IRS/ICD-PLOC/ILH&fileid=1030263 * https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/PLOC_MPSoC ICD:
* https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_TAS-ILH-IRS/ICD-PLOC/ILH&fileid=1030263
* *
* @note The sequence count in the space packets must be incremented with each received and sent * @note The sequence count in the space packets must be incremented with each received and sent
* packet. * packet otherwise the MPSoC will reply with an acknowledgment failure report.
* *
* @author J. Meier * @author J. Meier
*/ */
class PlocMPSoCHandler : public DeviceHandlerBase { class PlocMPSoCHandler : public DeviceHandlerBase {
public: public:
PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie, PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie,
PlocMPSoCHelper* plocMPSoCHelper); PlocMPSoCHelper* plocMPSoCHelper, Gpio uartIsolatorSwitch);
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,
@ -40,12 +42,11 @@ protected:
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; void fillCommandAndReplyMap() override;
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
const uint8_t * commandData,size_t commandDataLen) override; size_t commandDataLen) override;
ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize, ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
DeviceCommandId_t *foundId, size_t *foundLen) override; size_t* foundLen) override;
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
const uint8_t *packet) 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,
@ -56,7 +57,6 @@ protected:
size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override; size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
private: private:
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_MPSOC_HANDLER; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_MPSOC_HANDLER;
//! [EXPORT] : [COMMENT] PLOC crc failure in telemetry packet //! [EXPORT] : [COMMENT] PLOC crc failure in telemetry packet
@ -71,9 +71,8 @@ private:
static const Event EXE_FAILURE = MAKE_EVENT(3, severity::LOW); static const Event EXE_FAILURE = MAKE_EVENT(3, severity::LOW);
//! [EXPORT] : [COMMENT] PLOC reply has invalid crc //! [EXPORT] : [COMMENT] PLOC reply has invalid crc
static const Event MPSOC_HANDLER_CRC_FAILURE = MAKE_EVENT(4, severity::LOW); static const Event MPSOC_HANDLER_CRC_FAILURE = MAKE_EVENT(4, severity::LOW);
//! [EXPORT] : [COMMENT] Packet sequence count in received space packet does not match expected count //! [EXPORT] : [COMMENT] Packet sequence count in received space packet does not match expected
//! P1: Expected sequence count //! count P1: Expected sequence count P2: Received 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] Received command has file string with invalid length //! [EXPORT] : [COMMENT] Received command has file string with invalid length
@ -99,6 +98,7 @@ private:
UartComIF* uartComIf = nullptr; UartComIF* uartComIf = nullptr;
PlocMPSoCHelper* plocMPSoCHelper = nullptr; PlocMPSoCHelper* plocMPSoCHelper = nullptr;
Gpio uartIsolatorSwitch;
// 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;

View File

@ -67,8 +67,9 @@ void PlocMPSoCHelper::setSequenceCount(SourceSequenceCounter* sequenceCount_) {
} }
ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string obcFile, std::string mpsocFile) { ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string obcFile, std::string mpsocFile) {
ReturnValue_t result = RETURN_OK;
#ifdef XIPHOS_Q7S #ifdef XIPHOS_Q7S
ReturnValue_t result = FilesystemHelper::checkPath(obcFile); result = FilesystemHelper::checkPath(obcFile);
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
} }
@ -88,9 +89,19 @@ ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string obcFile, std::string
flashWrite.obcFile = obcFile; flashWrite.obcFile = obcFile;
flashWrite.mpsocFile = mpsocFile; flashWrite.mpsocFile = mpsocFile;
internalState = InternalState::FLASH_WRITE; 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(); semaphore.release();
terminate = false; terminate = false;
return RETURN_OK; result = uartComIF->flushUartRxBuffer(comCookie);
return result;
} }
void PlocMPSoCHelper::stopProcess() { terminate = true; } void PlocMPSoCHelper::stopProcess() { terminate = true; }
@ -108,6 +119,7 @@ ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
// tellg returns position of character in input stream // tellg returns position of character in input stream
size_t remainingSize = file.tellg(); size_t remainingSize = file.tellg();
size_t dataLength = 0; size_t dataLength = 0;
size_t bytesRead = 0;
while (remainingSize > 0) { while (remainingSize > 0) {
if (terminate) { if (terminate) {
return RETURN_OK; return RETURN_OK;
@ -117,19 +129,18 @@ ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
} else { } else {
dataLength = remainingSize; dataLength = remainingSize;
} }
if (file.is_open()) {
file.seekg(bytesRead, file.beg);
file.read(reinterpret_cast<char*>(tempData), dataLength); file.read(reinterpret_cast<char*>(tempData), dataLength);
bytesRead += dataLength;
remainingSize -= dataLength;
} else {
return FILE_CLOSED_ACCIDENTALLY;
}
(*sequenceCount)++; (*sequenceCount)++;
mpsoc::TcFlashWrite tc(*sequenceCount); mpsoc::TcFlashWrite tc(*sequenceCount);
tc.createPacket(tempData, dataLength); tc.createPacket(tempData, dataLength);
result = sendCommand(&tc); result = handlePacketTransmission(tc);
if (result != RETURN_OK) {
return result;
}
result = handleAck();
if (result != RETURN_OK) {
return result;
}
result = handleExe();
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
} }
@ -149,7 +160,7 @@ ReturnValue_t PlocMPSoCHelper::flashfopen() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
} }
result = sendCommand(&flashFopen); result = handlePacketTransmission(flashFopen);
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
} }
@ -164,16 +175,33 @@ ReturnValue_t PlocMPSoCHelper::flashfclose() {
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
} }
result = sendCommand(&flashFclose); result = handlePacketTransmission(flashFclose);
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
} }
return RETURN_OK; return RETURN_OK;
} }
ReturnValue_t PlocMPSoCHelper::sendCommand(mpsoc::TcBase* tc) { ReturnValue_t PlocMPSoCHelper::handlePacketTransmission(mpsoc::TcBase& tc) {
ReturnValue_t result = RETURN_OK; 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) { if (result != RETURN_OK) {
sif::warning << "PlocMPSoCHelper::sendCommand: Failed to send command" << std::endl; sif::warning << "PlocMPSoCHelper::sendCommand: Failed to send command" << std::endl;
triggerEvent(SENDING_COMMAND_FAILED, result, static_cast<uint32_t>(internalState)); triggerEvent(SENDING_COMMAND_FAILED, result, static_cast<uint32_t>(internalState));
@ -231,7 +259,7 @@ void PlocMPSoCHelper::handleExeApidFailure(uint16_t apid) {
<< "report" << std::endl; << "report" << std::endl;
} else { } else {
triggerEvent(EXE_INVALID_APID, apid, static_cast<uint32_t>(internalState)); 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; << "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 PlocMPSoCHelper::handleTmReception(mpsoc::TmPacket* tmPacket, size_t remainingBytes) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
size_t readBytes = 0; size_t readBytes = 0;
size_t currentBytes = 0;
for (int retries = 0; retries < RETRIES; retries++) { for (int retries = 0; retries < RETRIES; retries++) {
result = receive(tmPacket->getWholeData(), &readBytes, remainingBytes); result = receive(tmPacket->getWholeData() + readBytes, &currentBytes, remainingBytes);
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
} }
remainingBytes = remainingBytes - readBytes; readBytes += currentBytes;
remainingBytes = remainingBytes - currentBytes;
if (remainingBytes == 0) { if (remainingBytes == 0) {
break; break;
} }
@ -259,17 +289,18 @@ ReturnValue_t PlocMPSoCHelper::handleTmReception(mpsoc::TmPacket* tmPacket, size
sif::warning << "PlocMPSoCHelper::handleTmReception: CRC check failed" << std::endl; sif::warning << "PlocMPSoCHelper::handleTmReception: CRC check failed" << std::endl;
return result; return result;
} }
(*sequenceCount)++;
uint16_t recvSeqCnt = tmPacket->getPacketSequenceCount(); uint16_t recvSeqCnt = tmPacket->getPacketSequenceCount();
if (recvSeqCnt != *sequenceCount) { if (recvSeqCnt != *sequenceCount) {
triggerEvent(MPSOC_HELPER_SEQ_CNT_MISMATCH, *sequenceCount, recvSeqCnt); triggerEvent(MPSOC_HELPER_SEQ_CNT_MISMATCH, *sequenceCount, recvSeqCnt);
*sequenceCount = recvSeqCnt; *sequenceCount = recvSeqCnt;
return result;
} }
return result; return result;
} }
ReturnValue_t PlocMPSoCHelper::receive(uint8_t* data, size_t* readBytes, size_t requestBytes) { ReturnValue_t PlocMPSoCHelper::receive(uint8_t* data, size_t* readBytes, size_t requestBytes) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
uint8_t* buffer = nullptr;
result = uartComIF->requestReceiveMessage(comCookie, requestBytes); result = uartComIF->requestReceiveMessage(comCookie, requestBytes);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "PlocMPSoCHelper::receive: Failed to request reply" << std::endl; 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))); static_cast<uint32_t>(static_cast<uint32_t>(internalState)));
return RETURN_FAILED; return RETURN_FAILED;
} }
result = uartComIF->readReceivedMessage(comCookie, &data, readBytes); result = uartComIF->readReceivedMessage(comCookie, &buffer, readBytes);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "PlocMPSoCHelper::receive: Failed to read received message" << std::endl; sif::warning << "PlocMPSoCHelper::receive: Failed to read received message" << std::endl;
triggerEvent(MPSOC_HELPER_READING_REPLY_FAILED, result, static_cast<uint32_t>(internalState)); triggerEvent(MPSOC_HELPER_READING_REPLY_FAILED, result, static_cast<uint32_t>(internalState));
return RETURN_FAILED; return RETURN_FAILED;
} }
if (*readBytes > 0) {
std::memcpy(data, buffer, *readBytes);
}
return result; return result;
} }

View File

@ -2,13 +2,14 @@
#define BSP_Q7S_DEVICES_PLOCMPSOCHELPER_H_ #define BSP_Q7S_DEVICES_PLOCMPSOCHELPER_H_
#include <string> #include <string>
#include "fsfw/devicehandlers/CookieIF.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/osal/linux/BinarySemaphore.h" #include "fsfw/osal/linux/BinarySemaphore.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/tasks/ExecutableObjectIF.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/tmtcservices/SourceSequenceCounter.h"
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h" #include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
#ifdef XIPHOS_Q7S #ifdef XIPHOS_Q7S
#include "bsp_q7s/memory/SdCardManager.h" #include "bsp_q7s/memory/SdCardManager.h"
@ -21,14 +22,14 @@
*/ */
class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF, public HasReturnvaluesIF { class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF, public HasReturnvaluesIF {
public: public:
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_MPSOC_HELPER; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_MPSOC_HELPER;
//! [EXPORT] : [COMMENT] Flash write fails //! [EXPORT] : [COMMENT] Flash write fails
static const Event MPSOC_FLASH_WRITE_FAILED = MAKE_EVENT(0, severity::LOW); static const Event MPSOC_FLASH_WRITE_FAILED = MAKE_EVENT(0, severity::LOW);
//! [EXPORT] : [COMMENT] Flash write successful //! [EXPORT] : [COMMENT] Flash write successful
static const Event MPSOC_FLASH_WRITE_SUCCESSFUL = MAKE_EVENT(1, severity::LOW); 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 //! P1: Return value returned by the communication interface sendMessage function
//! P2: Internal state of MPSoC helper //! P2: Internal state of MPSoC helper
static const Event SENDING_COMMAND_FAILED = MAKE_EVENT(2, severity::LOW); static const Event SENDING_COMMAND_FAILED = MAKE_EVENT(2, severity::LOW);
@ -97,12 +98,14 @@ public:
void setSequenceCount(SourceSequenceCounter* sequenceCount_); void setSequenceCount(SourceSequenceCounter* sequenceCount_);
private: private:
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_MPSOC_HELPER; 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 // Maximum number of times the communication interface retries polling data from the reply
// buffer // buffer
static const int RETRIES = 3; static const int RETRIES = 10000;
struct FlashWrite { struct FlashWrite {
std::string obcFile; std::string obcFile;
@ -111,11 +114,7 @@ private:
struct FlashWrite flashWrite; struct FlashWrite flashWrite;
enum class InternalState { enum class InternalState { IDLE, FLASH_WRITE, FLASH_READ };
IDLE,
FLASH_WRITE,
FLASH_READ
};
InternalState internalState = InternalState::IDLE; InternalState internalState = InternalState::IDLE;
@ -137,10 +136,12 @@ private:
// Sequence count, must be set by Ploc MPSoC Handler // Sequence count, must be set by Ploc MPSoC Handler
SourceSequenceCounter* sequenceCount; SourceSequenceCounter* sequenceCount;
ReturnValue_t resetHelper();
ReturnValue_t performFlashWrite(); ReturnValue_t performFlashWrite();
ReturnValue_t flashfopen(); ReturnValue_t flashfopen();
ReturnValue_t flashfclose(); 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 receive(uint8_t* data, size_t* readBytes, size_t requestBytes);
ReturnValue_t handleAck(); ReturnValue_t handleAck();
ReturnValue_t handleExe(); ReturnValue_t handleExe();

View File

@ -1,24 +1,30 @@
#include <sstream>
#include <string>
#include <fstream>
#include <filesystem>
#include "PlocSupervisorHandler.h" #include "PlocSupervisorHandler.h"
#include "OBSWConfig.h"
#include <fsfw/globalfunctions/CRC.h>
#include <fsfw/datapool/PoolReadGuard.h> #include <fsfw/datapool/PoolReadGuard.h>
#include <fsfw/globalfunctions/CRC.h>
#include <fsfw/timemanager/Clock.h> #include <fsfw/timemanager/Clock.h>
#include <filesystem>
#include <fstream>
#include <sstream>
#include <string>
#include "OBSWConfig.h"
PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid, PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid,
CookieIF * comCookie) : CookieIF* comCookie,
DeviceHandlerBase(objectId, uartComIFid, comCookie), hkset(this), bootStatusReport(this), latchupStatusReport( Gpio uartIsolatorSwitch)
this) { : DeviceHandlerBase(objectId, uartComIFid, comCookie),
uartIsolatorSwitch(uartIsolatorSwitch),
hkset(this),
bootStatusReport(this),
latchupStatusReport(this) {
if (comCookie == NULL) { if (comCookie == NULL) {
sif::error << "PlocSupervisorHandler: Invalid com cookie" << std::endl; sif::error << "PlocSupervisorHandler: Invalid com cookie" << std::endl;
} }
} }
PlocSupervisorHandler::~PlocSupervisorHandler() { PlocSupervisorHandler::~PlocSupervisorHandler() {}
}
ReturnValue_t PlocSupervisorHandler::initialize() { ReturnValue_t PlocSupervisorHandler::initialize() {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
@ -31,37 +37,36 @@ ReturnValue_t PlocSupervisorHandler::initialize() {
sif::warning << "PlocSupervisorHandler::initialize: Invalid uart com if" << std::endl; sif::warning << "PlocSupervisorHandler::initialize: Invalid uart com if" << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
#if BOARD_TE0720 == 0 #ifdef TE0720_1CFA
sdcMan = SdCardManager::instance(); sdcMan = SdCardManager::instance();
#endif /* BOARD_TE0720 == 0 */ #endif /* BOARD_TE0720 == 0 */
return result; return result;
} }
void PlocSupervisorHandler::doStartUp() { void PlocSupervisorHandler::doStartUp() {
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1 #if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
setMode(MODE_NORMAL); setMode(MODE_NORMAL);
#else #else
setMode(_MODE_TO_ON); setMode(_MODE_TO_ON);
#endif #endif
uartIsolatorSwitch.pullHigh();
} }
void PlocSupervisorHandler::doShutDown() { void PlocSupervisorHandler::doShutDown() {
setMode(_MODE_POWER_DOWN); setMode(_MODE_POWER_DOWN);
uartIsolatorSwitch.pullLow();
} }
ReturnValue_t PlocSupervisorHandler::buildNormalDeviceCommand( ReturnValue_t PlocSupervisorHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
DeviceCommandId_t * id) {
return NOTHING_TO_SEND; return NOTHING_TO_SEND;
} }
ReturnValue_t PlocSupervisorHandler::buildTransitionDeviceCommand( ReturnValue_t PlocSupervisorHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
DeviceCommandId_t * id){
return NOTHING_TO_SEND; return NOTHING_TO_SEND;
} }
ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand( ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
DeviceCommandId_t deviceCommand, const uint8_t * commandData, const uint8_t* commandData,
size_t commandDataLen) { size_t commandDataLen) {
ReturnValue_t result = RETURN_FAILED; ReturnValue_t result = RETURN_FAILED;
switch (deviceCommand) { switch (deviceCommand) {
@ -326,14 +331,12 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
PLOC_SPV::SIZE_LATCHUP_STATUS_REPORT); PLOC_SPV::SIZE_LATCHUP_STATUS_REPORT);
} }
ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t *start, ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t remainingSize,
size_t remainingSize, DeviceCommandId_t *foundId, size_t *foundLen) { DeviceCommandId_t* foundId, size_t* foundLen) {
if (nextReplyId == PLOC_SPV::FIRST_MRAM_DUMP) { if (nextReplyId == PLOC_SPV::FIRST_MRAM_DUMP) {
*foundId = PLOC_SPV::FIRST_MRAM_DUMP; *foundId = PLOC_SPV::FIRST_MRAM_DUMP;
return parseMramPackets(start, remainingSize, foundLen); return parseMramPackets(start, remainingSize, foundLen);
} } else if (nextReplyId == PLOC_SPV::CONSECUTIVE_MRAM_DUMP) {
else if (nextReplyId == PLOC_SPV::CONSECUTIVE_MRAM_DUMP) {
*foundId = PLOC_SPV::CONSECUTIVE_MRAM_DUMP; *foundId = PLOC_SPV::CONSECUTIVE_MRAM_DUMP;
return parseMramPackets(start, remainingSize, foundLen); return parseMramPackets(start, remainingSize, foundLen);
} }
@ -383,7 +386,6 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t *start,
ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id, ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
const uint8_t* packet) { const uint8_t* packet) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
switch (id) { switch (id) {
@ -412,7 +414,8 @@ ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
break; break;
} }
default: { default: {
sif::debug << "PlocSupervisorHandler::interpretDeviceReply: Unknown device reply id" << std::endl; sif::debug << "PlocSupervisorHandler::interpretDeviceReply: Unknown device reply id"
<< std::endl;
return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY; return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY;
} }
} }
@ -420,17 +423,12 @@ ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
return result; return result;
} }
void PlocSupervisorHandler::setNormalDatapoolEntriesInvalid(){ void PlocSupervisorHandler::setNormalDatapoolEntriesInvalid() {}
} uint32_t PlocSupervisorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
uint32_t PlocSupervisorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo){
return 500;
}
ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) { LocalDataPoolManager& poolManager) {
localDataPoolMap.emplace(PLOC_SPV::NUM_TMS, new PoolEntry<uint32_t>({0})); localDataPoolMap.emplace(PLOC_SPV::NUM_TMS, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(PLOC_SPV::TEMP_PS, new PoolEntry<uint32_t>({0})); localDataPoolMap.emplace(PLOC_SPV::TEMP_PS, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(PLOC_SPV::TEMP_PL, new PoolEntry<uint32_t>({0})); localDataPoolMap.emplace(PLOC_SPV::TEMP_PL, new PoolEntry<uint32_t>({0}));
@ -474,9 +472,9 @@ ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool
} }
ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::iterator command, ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::iterator command,
uint8_t expectedReplies, bool useAlternateId, uint8_t expectedReplies,
bool useAlternateId,
DeviceCommandId_t alternateReplyID) { DeviceCommandId_t alternateReplyID) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
uint8_t enabledReplies = 0; uint8_t enabledReplies = 0;
@ -581,15 +579,15 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
* Every command causes at least one acknowledgment and one execution report. Therefore both * Every command causes at least one acknowledgment and one execution report. Therefore both
* replies will be enabled here. * replies will be enabled here.
*/ */
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, result =
PLOC_SPV::ACK_REPORT); DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, PLOC_SPV::ACK_REPORT);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
<< PLOC_SPV::ACK_REPORT << " not in replyMap" << std::endl; << PLOC_SPV::ACK_REPORT << " not in replyMap" << std::endl;
} }
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, result =
PLOC_SPV::EXE_REPORT); DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, PLOC_SPV::EXE_REPORT);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
<< PLOC_SPV::EXE_REPORT << " not in replyMap" << std::endl; << PLOC_SPV::EXE_REPORT << " not in replyMap" << std::endl;
@ -608,7 +606,6 @@ ReturnValue_t PlocSupervisorHandler::verifyPacket(const uint8_t* start, size_t f
} }
ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) { ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
result = verifyPacket(data, PLOC_SPV::SIZE_ACK_REPORT); result = verifyPacket(data, PLOC_SPV::SIZE_ACK_REPORT);
@ -627,7 +624,8 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
switch (apid) { switch (apid) {
case PLOC_SPV::APID_ACK_FAILURE: { case PLOC_SPV::APID_ACK_FAILURE: {
// TODO: Interpretation of status field in acknowledgment report // TODO: Interpretation of status field in acknowledgment report
sif::debug << "PlocSupervisorHandler::handleAckReport: Received Ack failure report" << std::endl; sif::debug << "PlocSupervisorHandler::handleAckReport: Received Ack failure report"
<< std::endl;
DeviceCommandId_t commandId = getPendingCommand(); DeviceCommandId_t commandId = getPendingCommand();
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) { if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
triggerEvent(SUPV_ACK_FAILURE, commandId); triggerEvent(SUPV_ACK_FAILURE, commandId);
@ -643,7 +641,8 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
break; break;
} }
default: { default: {
sif::debug << "PlocSupervisorHandler::handleAckReport: Invalid APID in Ack report" << std::endl; sif::debug << "PlocSupervisorHandler::handleAckReport: Invalid APID in Ack report"
<< std::endl;
result = RETURN_FAILED; result = RETURN_FAILED;
break; break;
} }
@ -653,7 +652,6 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
} }
ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data) { ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
result = verifyPacket(data, PLOC_SPV::SIZE_EXE_REPORT); result = verifyPacket(data, PLOC_SPV::SIZE_EXE_REPORT);
@ -671,14 +669,15 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data)
} }
case (PLOC_SPV::APID_EXE_FAILURE): { case (PLOC_SPV::APID_EXE_FAILURE): {
// TODO: Interpretation of status field in execution report // TODO: Interpretation of status field in execution report
sif::error << "PlocSupervisorHandler::handleExecutionReport: Received execution failure report" sif::error
<< "PlocSupervisorHandler::handleExecutionReport: Received execution failure report"
<< std::endl; << std::endl;
DeviceCommandId_t commandId = getPendingCommand(); DeviceCommandId_t commandId = getPendingCommand();
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) { if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
triggerEvent(SUPV_EXE_FAILURE, commandId); triggerEvent(SUPV_EXE_FAILURE, commandId);
} } else {
else { sif::debug << "PlocSupervisorHandler::handleExecutionReport: Unknown command id"
sif::debug << "PlocSupervisorHandler::handleExecutionReport: Unknown command id" << std::endl; << std::endl;
} }
sendFailureReport(PLOC_SPV::EXE_REPORT, RECEIVED_EXE_FAILURE); sendFailureReport(PLOC_SPV::EXE_REPORT, RECEIVED_EXE_FAILURE);
disableExeReportReply(); disableExeReportReply();
@ -698,43 +697,41 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data)
} }
ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) { ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
result = verifyPacket(data, PLOC_SPV::SIZE_HK_REPORT); result = verifyPacket(data, PLOC_SPV::SIZE_HK_REPORT);
if (result == CRC_FAILURE) { if (result == CRC_FAILURE) {
sif::error << "PlocSupervisorHandler::handleHkReport: Hk report has invalid crc" sif::error << "PlocSupervisorHandler::handleHkReport: Hk report has invalid crc" << std::endl;
<< std::endl;
} }
uint16_t offset = PLOC_SPV::DATA_FIELD_OFFSET; uint16_t offset = PLOC_SPV::DATA_FIELD_OFFSET;
hkset.tempPs = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 hkset.tempPs = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
| *(data + offset + 3); *(data + offset + 3);
offset += 4; offset += 4;
hkset.tempPl = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 hkset.tempPl = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
| *(data + offset + 3); *(data + offset + 3);
offset += 4; offset += 4;
hkset.tempSup = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 hkset.tempSup = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
| *(data + offset + 3); *(data + offset + 3);
offset += 4; offset += 4;
hkset.uptime = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 hkset.uptime = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
| *(data + offset + 3); *(data + offset + 3);
offset += 4; offset += 4;
hkset.cpuLoad = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 hkset.cpuLoad = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
| *(data + offset + 3); *(data + offset + 3);
offset += 4; offset += 4;
hkset.availableHeap = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 hkset.availableHeap = *(data + offset) << 24 | *(data + offset + 1) << 16 |
| *(data + offset + 3); *(data + offset + 2) << 8 | *(data + offset + 3);
offset += 4; offset += 4;
hkset.numTcs = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 hkset.numTcs = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
| *(data + offset + 3); *(data + offset + 3);
offset += 4; offset += 4;
hkset.numTms = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 hkset.numTms = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
| *(data + offset + 3); *(data + offset + 3);
offset += 4; offset += 4;
hkset.socState = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 hkset.socState = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
| *(data + offset + 3); *(data + offset + 3);
offset += 4; offset += 4;
hkset.nvm0_1_state = *(data + offset); hkset.nvm0_1_state = *(data + offset);
offset += 1; offset += 1;
@ -753,7 +750,8 @@ ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
sif::info << "PlocSupervisorHandler::handleHkReport: temp_sup: " << hkset.tempSup << std::endl; sif::info << "PlocSupervisorHandler::handleHkReport: temp_sup: " << hkset.tempSup << std::endl;
sif::info << "PlocSupervisorHandler::handleHkReport: uptime: " << hkset.uptime << std::endl; sif::info << "PlocSupervisorHandler::handleHkReport: uptime: " << hkset.uptime << std::endl;
sif::info << "PlocSupervisorHandler::handleHkReport: cpu_load: " << hkset.cpuLoad << std::endl; sif::info << "PlocSupervisorHandler::handleHkReport: cpu_load: " << hkset.cpuLoad << std::endl;
sif::info << "PlocSupervisorHandler::handleHkReport: available_heap: " << hkset.availableHeap << std::endl; sif::info << "PlocSupervisorHandler::handleHkReport: available_heap: " << hkset.availableHeap
<< std::endl;
sif::info << "PlocSupervisorHandler::handleHkReport: num_tcs: " << hkset.numTcs << std::endl; sif::info << "PlocSupervisorHandler::handleHkReport: num_tcs: " << hkset.numTcs << std::endl;
sif::info << "PlocSupervisorHandler::handleHkReport: num_tms: " << hkset.numTms << std::endl; sif::info << "PlocSupervisorHandler::handleHkReport: num_tms: " << hkset.numTms << std::endl;
sif::info << "PlocSupervisorHandler::handleHkReport: soc_state: " << hkset.socState << std::endl; sif::info << "PlocSupervisorHandler::handleHkReport: soc_state: " << hkset.socState << std::endl;
@ -772,14 +770,14 @@ ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
} }
ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data) { ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
result = verifyPacket(data, PLOC_SPV::SIZE_BOOT_STATUS_REPORT); result = verifyPacket(data, PLOC_SPV::SIZE_BOOT_STATUS_REPORT);
if (result == CRC_FAILURE) { if (result == CRC_FAILURE) {
sif::error << "PlocSupervisorHandler::handleBootStatusReport: Boot status report has invalid" sif::error << "PlocSupervisorHandler::handleBootStatusReport: Boot status report has invalid"
" crc" << std::endl; " crc"
<< std::endl;
return result; return result;
} }
@ -827,7 +825,6 @@ ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data)
} }
ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* data) { ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* data) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
result = verifyPacket(data, PLOC_SPV::SIZE_LATCHUP_STATUS_REPORT); result = verifyPacket(data, PLOC_SPV::SIZE_LATCHUP_STATUS_REPORT);
@ -913,8 +910,8 @@ ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* da
<< latchupStatusReport.timeYear << std::endl; << latchupStatusReport.timeYear << std::endl;
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: Msec: " sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: Msec: "
<< latchupStatusReport.timeMsec << std::endl; << latchupStatusReport.timeMsec << std::endl;
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: isSet: 0x" sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: isSet: 0x" << std::hex
<< std::hex << latchupStatusReport.timeMsec << std::dec << std::endl; << latchupStatusReport.timeMsec << std::dec << std::endl;
#endif #endif
return result; return result;
@ -945,15 +942,13 @@ void PlocSupervisorHandler::setNextReplyId() {
} }
size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId) { size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId) {
size_t replyLen = 0; size_t replyLen = 0;
if (nextReplyId == PLOC_SPV::NONE) { if (nextReplyId == PLOC_SPV::NONE) {
return replyLen; return replyLen;
} }
if (nextReplyId == PLOC_SPV::FIRST_MRAM_DUMP if (nextReplyId == PLOC_SPV::FIRST_MRAM_DUMP || nextReplyId == PLOC_SPV::CONSECUTIVE_MRAM_DUMP) {
|| nextReplyId == PLOC_SPV::CONSECUTIVE_MRAM_DUMP) {
/** /**
* Try to read 20 MRAM packets. If reply is larger, the packets will be read with the * Try to read 20 MRAM packets. If reply is larger, the packets will be read with the
* next doSendRead call. The command will be as long active as the packet with the sequence * next doSendRead call. The command will be as long active as the packet with the sequence
@ -970,8 +965,7 @@ size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId){
return replyLen; return replyLen;
} }
replyLen = iter->second.replyLen; replyLen = iter->second.replyLen;
} } else {
else {
sif::debug << "PlocSupervisorHandler::getNextReplyLength: No entry for reply with reply id " sif::debug << "PlocSupervisorHandler::getNextReplyLength: No entry for reply with reply id "
<< std::hex << nextReplyId << " in deviceReplyMap" << std::endl; << std::hex << nextReplyId << " in deviceReplyMap" << std::endl;
} }
@ -979,8 +973,8 @@ size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId){
return replyLen; return replyLen;
} }
void PlocSupervisorHandler::handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId) { void PlocSupervisorHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
DeviceCommandId_t replyId) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
if (wiretappingMode == RAW) { if (wiretappingMode == RAW) {
@ -1035,8 +1029,8 @@ void PlocSupervisorHandler::prepareDisableHk() {
} }
void PlocSupervisorHandler::prepareSetBootTimeoutCmd(const uint8_t* commandData) { void PlocSupervisorHandler::prepareSetBootTimeoutCmd(const uint8_t* commandData) {
uint32_t timeout = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 uint32_t timeout = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 |
| *(commandData + 3); *(commandData + 3);
PLOC_SPV::SetBootTimeout packet(timeout); PLOC_SPV::SetBootTimeout packet(timeout);
packetToOutBuffer(packet.getWholeData(), packet.getFullSize()); packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
} }
@ -1065,8 +1059,8 @@ ReturnValue_t PlocSupervisorHandler::prepareWatchdogsConfigTimeoutCmd(const uint
if (watchdog > 2) { if (watchdog > 2) {
return INVALID_WATCHDOG; return INVALID_WATCHDOG;
} }
uint32_t timeout = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16 uint32_t timeout = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16 |
| *(commandData + offset + 2) << 8 | *(commandData + offset + 3); *(commandData + offset + 2) << 8 | *(commandData + offset + 3);
if (timeout < 1000 || timeout > 360000) { if (timeout < 1000 || timeout > 360000) {
return INVALID_WATCHDOG_TIMEOUT; return INVALID_WATCHDOG_TIMEOUT;
} }
@ -1107,8 +1101,8 @@ ReturnValue_t PlocSupervisorHandler::prepareAutoCalibrateAlertCmd(const uint8_t*
uint8_t offset = 0; uint8_t offset = 0;
uint8_t latchupId = *commandData; uint8_t latchupId = *commandData;
offset += 1; offset += 1;
uint32_t mg = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16 uint32_t mg = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16 |
| *(commandData + offset + 2) << 8 | *(commandData + offset + 3); *(commandData + offset + 2) << 8 | *(commandData + offset + 3);
if (latchupId > 6) { if (latchupId > 6) {
return INVALID_LATCHUP_ID; return INVALID_LATCHUP_ID;
} }
@ -1133,8 +1127,8 @@ ReturnValue_t PlocSupervisorHandler::prepareSetAlertLimitCmd(const uint8_t* comm
uint8_t offset = 0; uint8_t offset = 0;
uint8_t latchupId = *commandData; uint8_t latchupId = *commandData;
offset += 1; offset += 1;
uint32_t dutycycle = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16 uint32_t dutycycle = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16 |
| *(commandData + offset + 2) << 8 | *(commandData + offset + 3); *(commandData + offset + 2) << 8 | *(commandData + offset + 3);
if (latchupId > 6) { if (latchupId > 6) {
return INVALID_LATCHUP_ID; return INVALID_LATCHUP_ID;
} }
@ -1144,8 +1138,8 @@ ReturnValue_t PlocSupervisorHandler::prepareSetAlertLimitCmd(const uint8_t* comm
} }
ReturnValue_t PlocSupervisorHandler::prepareSetAdcSweetPeriodCmd(const uint8_t* commandData) { ReturnValue_t PlocSupervisorHandler::prepareSetAdcSweetPeriodCmd(const uint8_t* commandData) {
uint32_t sweepPeriod = *(commandData) << 24 | *(commandData + 1) << 16 uint32_t sweepPeriod = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 |
| *(commandData + 2) << 8 | *(commandData + 3); *(commandData + 3);
if (sweepPeriod < 21) { if (sweepPeriod < 21) {
return SWEEP_PERIOD_TOO_SMALL; return SWEEP_PERIOD_TOO_SMALL;
} }
@ -1170,8 +1164,8 @@ void PlocSupervisorHandler::prepareSetAdcWindowAndStrideCmd(const uint8_t* comma
} }
void PlocSupervisorHandler::prepareSetAdcThresholdCmd(const uint8_t* commandData) { void PlocSupervisorHandler::prepareSetAdcThresholdCmd(const uint8_t* commandData) {
uint32_t threshold = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 uint32_t threshold = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 |
| *(commandData + 3); *(commandData + 3);
PLOC_SPV::SetAdcThreshold packet(threshold); PLOC_SPV::SetAdcThreshold packet(threshold);
packetToOutBuffer(packet.getWholeData(), packet.getFullSize()); packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
} }
@ -1267,7 +1261,6 @@ void PlocSupervisorHandler::packetToOutBuffer(uint8_t* packetData, size_t fullSi
} }
void PlocSupervisorHandler::disableAllReplies() { void PlocSupervisorHandler::disableAllReplies() {
DeviceReplyMap::iterator iter; DeviceReplyMap::iterator iter;
/* Disable ack reply */ /* Disable ack reply */
@ -1297,7 +1290,6 @@ void PlocSupervisorHandler::disableAllReplies() {
} }
void PlocSupervisorHandler::sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status) { void PlocSupervisorHandler::sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status) {
DeviceReplyIter iter = deviceReplyMap.find(replyId); DeviceReplyIter iter = deviceReplyMap.find(replyId);
if (iter == deviceReplyMap.end()) { if (iter == deviceReplyMap.end()) {
@ -1308,7 +1300,8 @@ void PlocSupervisorHandler::sendFailureReport(DeviceCommandId_t replyId, ReturnV
DeviceCommandInfo* info = &(iter->second.command->second); DeviceCommandInfo* info = &(iter->second.command->second);
if (info == nullptr) { if (info == nullptr) {
sif::debug << "PlocSupervisorHandler::sendFailureReport: Reply has no active command" << std::endl; sif::debug << "PlocSupervisorHandler::sendFailureReport: Reply has no active command"
<< std::endl;
return; return;
} }
@ -1359,7 +1352,6 @@ ReturnValue_t PlocSupervisorHandler::parseMramPackets(const uint8_t *packet, siz
} }
ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket(DeviceCommandId_t id) { ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket(DeviceCommandId_t id) {
ReturnValue_t result = RETURN_FAILED; ReturnValue_t result = RETURN_FAILED;
// Prepare packet for downlink // Prepare packet for downlink
@ -1372,8 +1364,7 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket(DeviceCommandId_t id)
} }
handleMramDumpFile(id); handleMramDumpFile(id);
if (downlinkMramDump == true) { if (downlinkMramDump == true) {
handleDeviceTM(spacePacketBuffer + PLOC_SPV::SPACE_PACKET_HEADER_LENGTH, packetLen - 1, handleDeviceTM(spacePacketBuffer + PLOC_SPV::SPACE_PACKET_HEADER_LENGTH, packetLen - 1, id);
id);
} }
packetInBuffer = false; packetInBuffer = false;
receivedMramDumpPackets++; receivedMramDumpPackets++;
@ -1418,16 +1409,15 @@ void PlocSupervisorHandler::increaseExpectedMramReplies(DeviceCommandId_t id) {
return; return;
} }
uint8_t sequenceFlags = spacePacketBuffer[2] >> 6; uint8_t sequenceFlags = spacePacketBuffer[2] >> 6;
if (sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::LAST_PKT) if (sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::LAST_PKT) &&
&& (sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) { (sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) {
// Command expects at least one MRAM packet more and the execution report // Command expects at least one MRAM packet more and the execution report
info->expectedReplies = 2; info->expectedReplies = 2;
// Wait maximum of 2 cycles for next MRAM packet // Wait maximum of 2 cycles for next MRAM packet
mramReplyInfo->delayCycles = 2; mramReplyInfo->delayCycles = 2;
// Also adapting delay cycles for execution report // Also adapting delay cycles for execution report
exeReplyInfo->delayCycles = 3; exeReplyInfo->delayCycles = 3;
} } else {
else {
// Command expects the execution report // Command expects the execution report
info->expectedReplies = 1; info->expectedReplies = 1;
mramReplyInfo->delayCycles = 0; mramReplyInfo->delayCycles = 0;
@ -1448,8 +1438,8 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpFile(DeviceCommandId_t id) {
uint16_t packetLen = readSpacePacketLength(spacePacketBuffer); uint16_t packetLen = readSpacePacketLength(spacePacketBuffer);
uint8_t sequenceFlags = readSequenceFlags(spacePacketBuffer); uint8_t sequenceFlags = readSequenceFlags(spacePacketBuffer);
if (id == PLOC_SPV::FIRST_MRAM_DUMP) { if (id == PLOC_SPV::FIRST_MRAM_DUMP) {
if (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT) if (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT) ||
|| (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) { (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) {
result = createMramDumpFile(); result = createMramDumpFile();
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
@ -1487,7 +1477,7 @@ ReturnValue_t PlocSupervisorHandler::createMramDumpFile() {
std::string filename = "mram-dump--" + timeStamp + ".bin"; std::string filename = "mram-dump--" + timeStamp + ".bin";
#if BOARD_TE0720 == 0 #ifdef TE0720_1CFA
std::string currentMountPrefix = sdcMan->getCurrentMountPrefix(); std::string currentMountPrefix = sdcMan->getCurrentMountPrefix();
#else #else
std::string currentMountPrefix("/mnt/sd0"); std::string currentMountPrefix("/mnt/sd0");
@ -1515,8 +1505,8 @@ ReturnValue_t PlocSupervisorHandler::getTimeStampString(std::string& timeStamp)
<< std::endl; << std::endl;
return GET_TIME_FAILURE; return GET_TIME_FAILURE;
} }
timeStamp = std::to_string(time.year) + "-" + std::to_string(time.month) + "-" timeStamp = std::to_string(time.year) + "-" + std::to_string(time.month) + "-" +
+ std::to_string(time.day) + "--" + std::to_string(time.hour) + "-" std::to_string(time.day) + "--" + std::to_string(time.hour) + "-" +
+ std::to_string(time.minute) + "-" + std::to_string(time.second); std::to_string(time.minute) + "-" + std::to_string(time.second);
return RETURN_OK; return RETURN_OK;
} }

View File

@ -1,11 +1,14 @@
#ifndef MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_ #ifndef MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
#define MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_ #define MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
#include "bsp_q7s/memory/SdCardManager.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
#include "fsfw_hal/linux/gpio/Gpio.h"
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include <linux/devices/devicedefinitions/PlocSupervisorDefinitions.h>
#include <bsp_q7s/memory/SdCardManager.h>
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <fsfw_hal/linux/uart/UartComIF.h>
/** /**
* @brief This is the device handler for the supervisor of the PLOC which is programmed by * @brief This is the device handler for the supervisor of the PLOC which is programmed by
@ -21,8 +24,8 @@
*/ */
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);
virtual ~PlocSupervisorHandler(); virtual ~PlocSupervisorHandler();
virtual ReturnValue_t initialize() override; virtual ReturnValue_t initialize() override;
@ -33,12 +36,11 @@ protected:
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; void fillCommandAndReplyMap() override;
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
const uint8_t * commandData,size_t commandDataLen) override; size_t commandDataLen) override;
ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize, ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
DeviceCommandId_t *foundId, size_t *foundLen) override; size_t* foundLen) override;
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
const uint8_t *packet) 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,
@ -49,7 +51,6 @@ protected:
size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override; size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
private: private:
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_SUPERVISOR_HANDLER; static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_SUPERVISOR_HANDLER;
//! [EXPORT] : [COMMENT] Space Packet received from PLOC supervisor has invalid CRC //! [EXPORT] : [COMMENT] Space Packet received from PLOC supervisor has invalid CRC
@ -62,25 +63,32 @@ private:
static const ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(0xA3); static const ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(0xA3);
//! [EXPORT] : [COMMENT] Failed to read current system time //! [EXPORT] : [COMMENT] Failed to read current system time
static const ReturnValue_t GET_TIME_FAILURE = MAKE_RETURN_CODE(0xA4); static const ReturnValue_t GET_TIME_FAILURE = MAKE_RETURN_CODE(0xA4);
//! [EXPORT] : [COMMENT] Received command with invalid watchdog parameter. Valid watchdogs are 0 for PS, 1 for PL and 2 for INT //! [EXPORT] : [COMMENT] Received command with invalid watchdog parameter. Valid watchdogs are 0
//! for PS, 1 for PL and 2 for INT
static const ReturnValue_t INVALID_WATCHDOG = MAKE_RETURN_CODE(0xA5); static const ReturnValue_t INVALID_WATCHDOG = MAKE_RETURN_CODE(0xA5);
//! [EXPORT] : [COMMENT] Received watchdog timeout config command with invalid timeout. Valid timeouts must be in the range between 1000 and 360000 ms. //! [EXPORT] : [COMMENT] Received watchdog timeout config command with invalid timeout. Valid
//! timeouts must be in the range between 1000 and 360000 ms.
static const ReturnValue_t INVALID_WATCHDOG_TIMEOUT = MAKE_RETURN_CODE(0xA6); static const ReturnValue_t INVALID_WATCHDOG_TIMEOUT = MAKE_RETURN_CODE(0xA6);
//! [EXPORT] : [COMMENT] Received latchup config command with invalid latchup ID //! [EXPORT] : [COMMENT] Received latchup config command with invalid latchup ID
static const ReturnValue_t INVALID_LATCHUP_ID = MAKE_RETURN_CODE(0xA7); static const ReturnValue_t INVALID_LATCHUP_ID = MAKE_RETURN_CODE(0xA7);
//! [EXPORT] : [COMMENT] Received set adc sweep period command with invalid sweep period. Must be larger than 21. //! [EXPORT] : [COMMENT] Received set adc sweep period command with invalid sweep period. Must be
//! larger than 21.
static const ReturnValue_t SWEEP_PERIOD_TOO_SMALL = MAKE_RETURN_CODE(0xA8); static const ReturnValue_t SWEEP_PERIOD_TOO_SMALL = MAKE_RETURN_CODE(0xA8);
//! [EXPORT] : [COMMENT] Receive auto EM test command with invalid test param. Valid params are 1 and 2. //! [EXPORT] : [COMMENT] Receive auto EM test command with invalid test param. Valid params are 1
//! and 2.
static const ReturnValue_t INVALID_TEST_PARAM = MAKE_RETURN_CODE(0xA9); static const ReturnValue_t INVALID_TEST_PARAM = MAKE_RETURN_CODE(0xA9);
//! [EXPORT] : [COMMENT] Returned when scanning for MRAM dump packets failed. //! [EXPORT] : [COMMENT] Returned when scanning for MRAM dump packets failed.
static const ReturnValue_t MRAM_PACKET_PARSING_FAILURE = MAKE_RETURN_CODE(0xAA); static const ReturnValue_t MRAM_PACKET_PARSING_FAILURE = MAKE_RETURN_CODE(0xAA);
//! [EXPORT] : [COMMENT] Returned when the start and stop addresses of the MRAM dump or MRAM wipe commands are invalid (e.g. start address bigger than stop address) //! [EXPORT] : [COMMENT] Returned when the start and stop addresses of the MRAM dump or MRAM wipe
//! commands are invalid (e.g. start address bigger than stop address)
static const ReturnValue_t INVALID_MRAM_ADDRESSES = MAKE_RETURN_CODE(0xAB); static const ReturnValue_t INVALID_MRAM_ADDRESSES = MAKE_RETURN_CODE(0xAB);
//! [EXPORT] : [COMMENT] Expect reception of an MRAM dump packet but received space packet with other apid. //! [EXPORT] : [COMMENT] Expect reception of an MRAM dump packet but received space packet with
//! other apid.
static const ReturnValue_t NO_MRAM_PACKET = MAKE_RETURN_CODE(0xAC); static const ReturnValue_t NO_MRAM_PACKET = MAKE_RETURN_CODE(0xAC);
//! [EXPORT] : [COMMENT] Path to PLOC directory on SD card does not exist //! [EXPORT] : [COMMENT] Path to PLOC directory on SD card does not exist
static const ReturnValue_t PATH_DOES_NOT_EXIST = MAKE_RETURN_CODE(0xAD); static const ReturnValue_t PATH_DOES_NOT_EXIST = MAKE_RETURN_CODE(0xAD);
//! [EXPORT] : [COMMENT] MRAM dump file does not exists. The file should actually already have been created with the reception of the first dump packet. //! [EXPORT] : [COMMENT] MRAM dump file does not exists. The file should actually already have
//! been created with the reception of the first dump packet.
static const ReturnValue_t MRAM_FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xAE); static const ReturnValue_t MRAM_FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xAE);
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_SUPERVISOR_HANDLER; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_SUPERVISOR_HANDLER;
@ -107,6 +115,8 @@ private:
DeviceCommandId_t nextReplyId = PLOC_SPV::NONE; DeviceCommandId_t nextReplyId = PLOC_SPV::NONE;
UartComIF* uartComIf = nullptr; UartComIF* uartComIf = nullptr;
LinuxLibgpioIF* gpioComIF = nullptr;
Gpio uartIsolatorSwitch;
PLOC_SPV::HkSet hkset; PLOC_SPV::HkSet hkset;
PLOC_SPV::BootStatusReport bootStatusReport; PLOC_SPV::BootStatusReport bootStatusReport;
@ -123,7 +133,7 @@ private:
/** 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[PLOC_SPV::MAX_PACKET_SIZE];
#if BOARD_TE0720 == 0 #ifdef TE0720_1CFA
SdCardManager* sdcMan = nullptr; SdCardManager* sdcMan = nullptr;
#endif /* BOARD_TE0720 == 0 */ #endif /* BOARD_TE0720 == 0 */
@ -256,7 +266,6 @@ private:
void prepareSetGpioCmd(const uint8_t* commandData); void prepareSetGpioCmd(const uint8_t* commandData);
void prepareReadGpioCmd(const uint8_t* commandData); void prepareReadGpioCmd(const uint8_t* commandData);
/** /**
* @brief Copies the content of a space packet to the command buffer. * @brief Copies the content of a space packet to the command buffer.
*/ */

View File

@ -16,7 +16,7 @@ PlocUpdater::PlocUpdater(object_id_t objectId)
PlocUpdater::~PlocUpdater() {} PlocUpdater::~PlocUpdater() {}
ReturnValue_t PlocUpdater::initialize() { ReturnValue_t PlocUpdater::initialize() {
#if BOARD_TE0720 == 0 #ifdef XIPHOS_Q7S
sdcMan = SdCardManager::instance(); sdcMan = SdCardManager::instance();
#endif #endif
ReturnValue_t result = SystemObject::initialize(); ReturnValue_t result = SystemObject::initialize();
@ -163,7 +163,7 @@ ReturnValue_t PlocUpdater::getImageLocation(const uint8_t* data, size_t size) {
return result; return result;
} }
#if BOARD_TE0720 == 0 #ifdef XIPHOS_Q7S
// Check if file is stored on SD card and if associated SD card is mounted // Check if file is stored on SD card and if associated SD card is mounted
if (std::string(reinterpret_cast<const char*>(data), SD_PREFIX_LENGTH) == if (std::string(reinterpret_cast<const char*>(data), SD_PREFIX_LENGTH) ==
std::string(SdCardManager::SD_0_MOUNT_POINT)) { std::string(SdCardManager::SD_0_MOUNT_POINT)) {

View File

@ -1,10 +1,11 @@
#ifndef MISSION_DEVICES_PLOCUPDATER_H_ #ifndef MISSION_DEVICES_PLOCUPDATER_H_
#define MISSION_DEVICES_PLOCUPDATER_H_ #define MISSION_DEVICES_PLOCUPDATER_H_
#include "OBSWConfig.h"
#include <linux/devices/devicedefinitions/PlocSupervisorDefinitions.h> #include <linux/devices/devicedefinitions/PlocSupervisorDefinitions.h>
#include "fsfw/action/CommandActionHelper.h"
#include "OBSWConfig.h"
#include "bsp_q7s/memory/SdCardManager.h" #include "bsp_q7s/memory/SdCardManager.h"
#include "eive/definitions.h"
#include "fsfw/action/ActionHelper.h" #include "fsfw/action/ActionHelper.h"
#include "fsfw/action/CommandActionHelper.h" #include "fsfw/action/CommandActionHelper.h"
#include "fsfw/action/CommandsActionsIF.h" #include "fsfw/action/CommandsActionsIF.h"
@ -13,6 +14,7 @@
#include "fsfw/returnvalues/HasReturnvaluesIF.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/tasks/ExecutableObjectIF.h" #include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw/tmtcpacket/SpacePacket.h" #include "fsfw/tmtcpacket/SpacePacket.h"
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
#include "linux/fsfwconfig/objects/systemObjectList.h" #include "linux/fsfwconfig/objects/systemObjectList.h"
/** /**
@ -103,7 +105,7 @@ class PlocUpdater : public SystemObject,
MessageQueueIF* commandQueue = nullptr; MessageQueueIF* commandQueue = nullptr;
#if BOARD_TE0720 == 0 #ifdef XIPHOS_Q7S
SdCardManager* sdcMan = nullptr; SdCardManager* sdcMan = nullptr;
#endif #endif
CommandActionHelper commandActionHelper; CommandActionHelper commandActionHelper;

View File

@ -12,11 +12,6 @@
#cmakedefine EGSE #cmakedefine EGSE
#cmakedefine TE0720_1CFA #cmakedefine TE0720_1CFA
#ifdef RASPBERRY_PI
#include "rpiConfig.h"
#elif defined(XIPHOS_Q7S)
#include "q7sConfig.h"
#endif
#include "commonConfig.h" #include "commonConfig.h"
#include "OBSWVersion.h" #include "OBSWVersion.h"
@ -24,8 +19,7 @@
debugging. */ debugging. */
#define OBSW_VERBOSE_LEVEL 1 #define OBSW_VERBOSE_LEVEL 1
//! Board defines #define Q7S_EM 0
#define BOARD_TE0720 0
/*******************************************************************/ /*******************************************************************/
/** All of the following flags should be enabled for mission code */ /** All of the following flags should be enabled for mission code */
@ -37,7 +31,7 @@ debugging. */
#define Q7S_EM 0 #define Q7S_EM 0
#define OBSW_USE_CCSDS_IP_CORE 0 #define OBSW_USE_CCSDS_IP_CORE 1
// Set to 1 if all telemetry should be sent to the PTME IP Core // Set to 1 if all telemetry should be sent to the PTME IP Core
#define OBSW_TM_TO_PTME 0 #define OBSW_TM_TO_PTME 0
// Set to 1 if telecommands are received via the PDEC IP Core // Set to 1 if telecommands are received via the PDEC IP Core
@ -46,7 +40,7 @@ debugging. */
#define OBSW_ENABLE_TIMERS 1 #define OBSW_ENABLE_TIMERS 1
#define OBSW_ADD_MGT 1 #define OBSW_ADD_MGT 1
#define OBSW_ADD_BPX_BATTERY_HANDLER 1 #define OBSW_ADD_BPX_BATTERY_HANDLER 1
#define OBSW_ADD_STAR_TRACKER 0 #define OBSW_ADD_STAR_TRACKER @OBSW_ADD_STAR_TRACKER@
#define OBSW_ADD_PLOC_SUPERVISOR 0 #define OBSW_ADD_PLOC_SUPERVISOR 0
#define OBSW_ADD_PLOC_MPSOC 0 #define OBSW_ADD_PLOC_MPSOC 0
#define OBSW_ADD_SUN_SENSORS 1 #define OBSW_ADD_SUN_SENSORS 1
@ -60,7 +54,8 @@ debugging. */
#define OBSW_ADD_SYRLINKS 0 #define OBSW_ADD_SYRLINKS 0
#define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0 #define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0
#define OBSW_STAR_TRACKER_GROUND_CONFIG 1 #define OBSW_STAR_TRACKER_GROUND_CONFIG 1
#define OBSW_ENABLE_PERIODIC_HK 0
#endif // XIPHOS_Q7S
// This is a really tricky switch.. It initializes the PCDU switches to their default states // This is a really tricky switch.. It initializes the PCDU switches to their default states
// at powerup. I think it would be better // at powerup. I think it would be better
@ -68,12 +63,7 @@ debugging. */
// something the operators might want to do by giving the software too much intelligence // something the operators might want to do by giving the software too much intelligence
// at the wrong place. The system component might command all the Switches accordingly anyway // at the wrong place. The system component might command all the Switches accordingly anyway
#define OBSW_INITIALIZE_SWITCHES 0 #define OBSW_INITIALIZE_SWITCHES 0
#define OBSW_ENABLE_PERIODIC_HK 0
#endif
#ifdef EGSE
#define OBSW_ADD_STAR_TRACKER 1
#endif
#ifdef TE0720_1CFA #ifdef TE0720_1CFA
@ -102,6 +92,7 @@ debugging. */
#define OBSW_STAR_TRACKER_GROUND_CONFIG 1 #define OBSW_STAR_TRACKER_GROUND_CONFIG 1
#define OBSW_ENABLE_PERIODIC_HK 0 #define OBSW_ENABLE_PERIODIC_HK 0
#define OBSW_PRINT_CORE_HK 0 #define OBSW_PRINT_CORE_HK 0
#define OBSW_INITIALIZE_SWITCHES 0
#endif #endif
@ -154,10 +145,16 @@ debugging. */
#define OBSW_DEBUG_SYRLINKS 0 #define OBSW_DEBUG_SYRLINKS 0
#define OBSW_DEBUG_IMTQ 0 #define OBSW_DEBUG_IMTQ 0
#define OBSW_DEBUG_RW 0 #define OBSW_DEBUG_RW 0
#define OBSW_DEBUG_PLOC_MPSOC 0
#define OBSW_DEBUG_PLOC_SUPERVISOR 0
#define OBSW_DEBUG_PDEC_HANDLER 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 #ifdef EGSE
#define OBSW_DEBUG_STARTRACKER 1 #define OBSW_DEBUG_STARTRACKER 1
#else #else
@ -171,16 +168,20 @@ debugging. */
#define OBSW_ADD_PLOC_SUPERVISOR 0 #define OBSW_ADD_PLOC_SUPERVISOR 0
#define OBSW_ADD_PLOC_MPSOC 0 #define OBSW_ADD_PLOC_MPSOC 0
#define OBSW_ADD_SUN_SENSORS 0 #define OBSW_ADD_SUN_SENSORS 0
#define OBSW_ADD_MGT 0
#define OBSW_ADD_ACS_BOARD 0 #define OBSW_ADD_ACS_BOARD 0
#define OBSW_ADD_GPS_0 0 #define OBSW_ADD_GPS_0 0
#define OBSW_ADD_GPS_1 0 #define OBSW_ADD_GPS_1 0
#define OBSW_ADD_RW 0 #define OBSW_ADD_RW 0
#define OBSW_ADD_BPX_BATTERY_HANDLER 0
#define OBSW_ADD_RTD_DEVICES 0 #define OBSW_ADD_RTD_DEVICES 0
#define OBSW_ADD_PL_PCDU 0
#define OBSW_ADD_TMP_DEVICES 0 #define OBSW_ADD_TMP_DEVICES 0
#define OBSW_ADD_RAD_SENSORS 0 #define OBSW_ADD_RAD_SENSORS 0
#define OBSW_ADD_SYRLINKS 0 #define OBSW_ADD_SYRLINKS 0
#define OBSW_STAR_TRACKER_GROUND_CONFIG 1
#endif #endif // RASPBERRY_PI
#define TCP_SERVER_WIRETAPPING 0 #define TCP_SERVER_WIRETAPPING 0
@ -189,7 +190,11 @@ debugging. */
/*******************************************************************/ /*******************************************************************/
#cmakedefine EIVE_BUILD_GPSD_GPS_HANDLER #cmakedefine EIVE_BUILD_GPSD_GPS_HANDLER
#include "OBSWVersion.h" #ifdef RASPBERRY_PI
#include "rpiConfig.h"
#elif defined(XIPHOS_Q7S)
#include "q7sConfig.h"
#endif
#ifdef __cplusplus #ifdef __cplusplus
@ -197,19 +202,6 @@ debugging. */
#include "events/subsystemIdRanges.h" #include "events/subsystemIdRanges.h"
#include "returnvalues/classIds.h" #include "returnvalues/classIds.h"
namespace config {
#endif
/* Add mission configuration flags here */
static constexpr uint32_t OBSW_FILESYSTEM_HANDLER_QUEUE_SIZE = 50;
static constexpr uint32_t PLOC_UPDATER_QUEUE_SIZE = 50;
/* Global config values to check validity of received file path strings and filenames */
static constexpr uint32_t MAX_PATH_SIZE = 100;
static constexpr uint32_t MAX_FILENAME_SIZE = 50;
static constexpr uint8_t LIVE_TM = 0;
#ifdef __cplusplus
}
#endif #endif
#endif /* FSFWCONFIG_OBSWCONFIG_H_ */ #endif /* FSFWCONFIG_OBSWCONFIG_H_ */

View File

@ -1,7 +1,7 @@
/** /**
* @brief Auto-generated event translation file. Contains 169 translations. * @brief Auto-generated event translation file. Contains 169 translations.
* @details * @details
* Generated on: 2022-03-25 18:53:13 * Generated on: 2022-03-28 09:51:17
*/ */
#include "translateEvents.h" #include "translateEvents.h"

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 117 translations. * Contains 117 translations.
* Generated on: 2022-03-25 18:53:22 * Generated on: 2022-03-28 09:51:13
*/ */
#include "translateObjects.h" #include "translateObjects.h"

View File

@ -592,68 +592,3 @@ ReturnValue_t pst::pstTest(FixedTimeslotTaskIF *thisSequence) {
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
#if BOARD_TE0720 == 1
ReturnValue_t pst::pollingSequenceTE0720(FixedTimeslotTaskIF *thisSequence) {
uint32_t length = thisSequence->getPeriodMs();
#if OBSW_ADD_PLOC_MPSOC == 1
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
#endif
#if OBSW_TEST_RAD_SENSOR == 1
thisSequence->addSlot(objects::RAD_SENSOR, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.8, DeviceHandlerIF::GET_READ);
#endif
#if OBSW_TEST_SUS == 1
/* Write setup */
thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_1, length * 0.902, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.903, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.904, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_1, length * 0.905, DeviceHandlerIF::GET_READ);
/* Start conversion*/
thisSequence->addSlot(objects::SUS_1, length * 0.906, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_1, length * 0.907, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.908, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.909, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_1, length * 0.91, DeviceHandlerIF::GET_READ);
/* Read conversions */
thisSequence->addSlot(objects::SUS_1, length * 0.911, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_1, length * 0.912, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.913, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.914, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_1, length * 0.915, DeviceHandlerIF::GET_READ);
#endif
#if OBSW_ADD_PLOC_SUPERVISOR == 1
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.7, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
#endif
thisSequence->addSlot(objects::PLOC_UPDATER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::PLOC_MEMORY_DUMPER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Initialization of TE0720 PST failed" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
}
#endif /* BOARD_TE0720 == 1 */

View File

@ -54,14 +54,6 @@ ReturnValue_t pstI2c(FixedTimeslotTaskIF* thisSequence);
* @return * @return
*/ */
ReturnValue_t pstTest(FixedTimeslotTaskIF* thisSequence); ReturnValue_t pstTest(FixedTimeslotTaskIF* thisSequence);
#if BOARD_TE0720 == 1
/**
* @brief This polling sequence will be created when the software is compiled for the TE0720.
*/
ReturnValue_t pollingSequenceTE0720(FixedTimeslotTaskIF* thisSequence);
#endif
} // namespace pst } // namespace pst
#endif /* POLLINGSEQUENCEINIT_H_ */ #endif /* POLLINGSEQUENCEINIT_H_ */

View File

@ -153,7 +153,7 @@ class PdecHandler : public SystemObject,
static const uint32_t PDEC_SLEN_OFFSET = 0xA26; static const uint32_t PDEC_SLEN_OFFSET = 0xA26;
static const uint32_t PDEC_MON_OFFSET = 0xA27; static const uint32_t PDEC_MON_OFFSET = 0xA27;
#if BOARD_TE0720 == 1 #ifdef TE0720_1CFA
static const int CONFIG_MEMORY_MAP_SIZE = 0x400; static const int CONFIG_MEMORY_MAP_SIZE = 0x400;
static const int RAM_MAP_SIZE = 0x4000; static const int RAM_MAP_SIZE = 0x4000;
static const int REGISTER_MAP_SIZE = 0x10000; static const int REGISTER_MAP_SIZE = 0x10000;
@ -169,7 +169,7 @@ class PdecHandler : public SystemObject,
static const size_t MAX_TC_SEGMENT_SIZE = 1017; static const size_t MAX_TC_SEGMENT_SIZE = 1017;
static const uint8_t MAP_ID_MASK = 0x3F; static const uint8_t MAP_ID_MASK = 0x3F;
#if BOARD_TE0720 == 1 #ifdef TE0720_1CFA
static const uint32_t PHYSICAL_RAM_BASE_ADDRESS = 0x32000000; static const uint32_t PHYSICAL_RAM_BASE_ADDRESS = 0x32000000;
#else #else
static const uint32_t PHYSICAL_RAM_BASE_ADDRESS = 0x26000000; static const uint32_t PHYSICAL_RAM_BASE_ADDRESS = 0x26000000;

View File

@ -589,7 +589,7 @@
<cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689"> <cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689" moduleId="org.eclipse.cdt.core.settings" name="eive-q7s-debug"> <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689" moduleId="org.eclipse.cdt.core.settings" name="eive-q7s-debug">
<macros> <macros>
<stringMacro name="Q7S_SYSROOT_UNIX" type="VALUE_PATH_DIR" value="/home/rmueller/Xilinx/cortexa9hf-neon-xiphos-linux-gnueabi"/> <stringMacro name="Q7S_SYSROOT_UNIX" type="VALUE_PATH_DIR" value="${HOME}/Xilinx/cortexa9hf-neon-xiphos-linux-gnueabi"/>
<stringMacro name="Q7S_SYSROOT" type="VALUE_TEXT" value="C:\Xilinx\cortexa9hf-neon-xiphos-linux-gnueabi"/> <stringMacro name="Q7S_SYSROOT" type="VALUE_TEXT" value="C:\Xilinx\cortexa9hf-neon-xiphos-linux-gnueabi"/>
</macros> </macros>
<externalSettings/> <externalSettings/>

View File

@ -1,6 +1,5 @@
#include "GenericFactory.h" #include "GenericFactory.h"
#include <OBSWConfig.h>
#include <fsfw/events/EventManager.h> #include <fsfw/events/EventManager.h>
#include <fsfw/health/HealthTable.h> #include <fsfw/health/HealthTable.h>
#include <fsfw/internalerror/InternalErrorReporter.h> #include <fsfw/internalerror/InternalErrorReporter.h>
@ -18,10 +17,12 @@
#include <fsfw/tcdistribution/PUSDistributor.h> #include <fsfw/tcdistribution/PUSDistributor.h>
#include <fsfw/timemanager/TimeStamper.h> #include <fsfw/timemanager/TimeStamper.h>
#include <mission/utility/TmFunnel.h> #include <mission/utility/TmFunnel.h>
#include <tmtc/apid.h>
#include <tmtc/pusIds.h>
#include "OBSWConfig.h"
#include "eive/definitions.h"
#include "objects/systemObjectList.h" #include "objects/systemObjectList.h"
#include "tmtc/apid.h"
#include "tmtc/pusIds.h"
#if OBSW_ADD_TCPIP_BRIDGE == 1 #if OBSW_ADD_TCPIP_BRIDGE == 1
#if OBSW_USE_TMTC_TCP_BRIDGE == 0 #if OBSW_USE_TMTC_TCP_BRIDGE == 0
@ -39,6 +40,10 @@
#include <test/testtasks/TestTask.h> #include <test/testtasks/TestTask.h>
#endif #endif
#ifndef OBSW_TM_TO_PTME
#define OBSW_TM_TO_PTME 0
#endif
void ObjectFactory::produceGenericObjects() { void ObjectFactory::produceGenericObjects() {
// Framework objects // Framework objects
new EventManager(objects::EVENT_MANAGER); new EventManager(objects::EVENT_MANAGER);
@ -68,8 +73,12 @@ void ObjectFactory::produceGenericObjects() {
new PUSDistributor(apid::EIVE_OBSW, objects::PUS_PACKET_DISTRIBUTOR, new PUSDistributor(apid::EIVE_OBSW, objects::PUS_PACKET_DISTRIBUTOR,
objects::CCSDS_PACKET_DISTRIBUTOR); objects::CCSDS_PACKET_DISTRIBUTOR);
uint8_t vc = 0;
#if OBSW_TM_TO_PTME == 1
vc = config::LIVE_TM;
#endif
// Every TM packet goes through this funnel // Every TM packet goes through this funnel
new TmFunnel(objects::TM_FUNNEL, 50); new TmFunnel(objects::TM_FUNNEL, 50, vc);
// PUS service stack // PUS service stack
new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, apid::EIVE_OBSW, new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, apid::EIVE_OBSW,
@ -87,7 +96,7 @@ void ObjectFactory::produceGenericObjects() {
new Service20ParameterManagement(objects::PUS_SERVICE_20_PARAMETERS, apid::EIVE_OBSW, new Service20ParameterManagement(objects::PUS_SERVICE_20_PARAMETERS, apid::EIVE_OBSW,
pus::PUS_SERVICE_20); pus::PUS_SERVICE_20);
new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT, apid::EIVE_OBSW, new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT, apid::EIVE_OBSW,
pus::PUS_SERVICE_200); pus::PUS_SERVICE_200, 8, config::LONGEST_MODE_TIMEOUT_SECONDS);
#if OBSW_ADD_TCPIP_BRIDGE == 1 #if OBSW_ADD_TCPIP_BRIDGE == 1
#if OBSW_USE_TMTC_TCP_BRIDGE == 0 #if OBSW_USE_TMTC_TCP_BRIDGE == 0

View File

@ -403,9 +403,9 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(DeviceCommandId_t id,
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
if (debugDivider->checkAndIncrement()) { if (debugDivider->checkAndIncrement()) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "Max31865: Object ID: " << std::hex << this->getObjectId() sif::info << "Max31865: ObjID " << std::hex << this->getObjectId() << " | RTD " << std::dec
<< ": Measured resistance is " << rtdValue << " Ohms." << std::endl; << static_cast<int>(deviceIdx) << ": R[Ohm] " << rtdValue
sif::info << "Approximated temperature is " << approxTemp << " C" << std::endl; << " Ohms | Approx T[C]: " << approxTemp << std::endl;
#else #else
sif::printInfo("Max31685: Measured resistance is %f Ohms\n", rtdValue); sif::printInfo("Max31685: Measured resistance is %f Ohms\n", rtdValue);
sif::printInfo("Approximated temperature is %f C\n", approxTemp); sif::printInfo("Approximated temperature is %f C\n", approxTemp);
@ -529,3 +529,5 @@ void Max31865PT1000Handler::modeChanged() {
internalState = InternalState::NONE; internalState = InternalState::NONE;
} }
} }
void Max31865PT1000Handler::setDeviceIdx(uint8_t idx) { deviceIdx = idx; }

View File

@ -46,6 +46,8 @@ class Max31865PT1000Handler : public DeviceHandlerBase {
static constexpr uint8_t DEFAULT_CONFIG = 0b11000001; static constexpr uint8_t DEFAULT_CONFIG = 0b11000001;
void setInstantNormal(bool instantNormal); void setInstantNormal(bool instantNormal);
void setDeviceIdx(uint8_t idx);
/** /**
* Expected temperature range is -100 C and 100 C. * Expected temperature range is -100 C and 100 C.
* If there are temperatures beyond this range there must be a fault. * If there are temperatures beyond this range there must be a fault.
@ -105,6 +107,7 @@ class Max31865PT1000Handler : public DeviceHandlerBase {
bool resetFaultBit = false; bool resetFaultBit = false;
dur_millis_t startTime = 0; dur_millis_t startTime = 0;
uint8_t faultByte = 0; uint8_t faultByte = 0;
uint8_t deviceIdx = 0;
std::array<uint8_t, 3> commandBuffer{0}; std::array<uint8_t, 3> commandBuffer{0};
Max31865Definitions::Max31865Set sensorDataset; Max31865Definitions::Max31865Set sensorDataset;

View File

@ -419,7 +419,7 @@ ReturnValue_t PCDUHandler::initializeLocalDataPool(localpool::DataPool& localDat
new PoolEntry<uint8_t>({INIT_SWITCH_STATES[Switches::PDU2_CH1_PL_PCDU_BATT_0_14V8]})); new PoolEntry<uint8_t>({INIT_SWITCH_STATES[Switches::PDU2_CH1_PL_PCDU_BATT_0_14V8]}));
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_RW, localDataPoolMap.emplace(P60System::PDU2_OUT_EN_RW,
new PoolEntry<uint8_t>({INIT_SWITCH_STATES[Switches::PDU2_CH2_RW_5V]})); new PoolEntry<uint8_t>({INIT_SWITCH_STATES[Switches::PDU2_CH2_RW_5V]}));
#if BOARD_TE0720 == 1 #ifdef TE0720_1CFA
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_TCS_BOARD_HEATER_IN, new PoolEntry<uint8_t>({1})); localDataPoolMap.emplace(P60System::PDU2_OUT_EN_TCS_BOARD_HEATER_IN, new PoolEntry<uint8_t>({1}));
#else #else
localDataPoolMap.emplace( localDataPoolMap.emplace(

View File

@ -306,7 +306,7 @@ ReturnValue_t PDU2Handler::initializeLocalDataPool(localpool::DataPool &localDat
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_Q7S, new PoolEntry<uint8_t>({0})); localDataPoolMap.emplace(P60System::PDU2_OUT_EN_Q7S, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_PAYLOAD_PCDU_CH1, new PoolEntry<uint8_t>({0})); localDataPoolMap.emplace(P60System::PDU2_OUT_EN_PAYLOAD_PCDU_CH1, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_RW, new PoolEntry<uint8_t>({0})); localDataPoolMap.emplace(P60System::PDU2_OUT_EN_RW, new PoolEntry<uint8_t>({0}));
#if BOARD_TE0720 == 1 #ifdef TE0720_1CFA
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_TCS_BOARD_HEATER_IN, new PoolEntry<uint8_t>({1})); localDataPoolMap.emplace(P60System::PDU2_OUT_EN_TCS_BOARD_HEATER_IN, new PoolEntry<uint8_t>({1}));
#else #else
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_TCS_BOARD_HEATER_IN, new PoolEntry<uint8_t>({0})); localDataPoolMap.emplace(P60System::PDU2_OUT_EN_TCS_BOARD_HEATER_IN, new PoolEntry<uint8_t>({0}));

View File

@ -14,8 +14,7 @@ struct TcsBoardHelper {
class TcsBoardAssembly : public AssemblyBase, public ConfirmsFailuresIF { class TcsBoardAssembly : public AssemblyBase, public ConfirmsFailuresIF {
public: public:
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::TCS_BOARD_ASS; static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::TCS_BOARD_ASS;
static constexpr Event CHILDREN_LOST_MODE = static constexpr Event CHILDREN_LOST_MODE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
TcsBoardAssembly(object_id_t objectId, object_id_t parentId, PowerSwitchIF* pwrSwitcher, TcsBoardAssembly(object_id_t objectId, object_id_t parentId, PowerSwitchIF* pwrSwitcher,
power::Switch_t switcher, TcsBoardHelper helper); power::Switch_t switcher, TcsBoardHelper helper);

View File

@ -12,7 +12,7 @@
CCSDSHandler::CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t tcDestination, CCSDSHandler::CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t tcDestination,
PtmeConfig* ptmeConfig, GpioIF* gpioIF, gpioId_t enTxClock, PtmeConfig* ptmeConfig, GpioIF* gpioIF, gpioId_t enTxClock,
gpioId_t enTxData) gpioId_t enTxData, uint32_t transmitterTimeout)
: SystemObject(objectId), : SystemObject(objectId),
ptmeId(ptmeId), ptmeId(ptmeId),
tcDestination(tcDestination), tcDestination(tcDestination),
@ -21,7 +21,8 @@ CCSDSHandler::CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t
ptmeConfig(ptmeConfig), ptmeConfig(ptmeConfig),
gpioIF(gpioIF), gpioIF(gpioIF),
enTxClock(enTxClock), enTxClock(enTxClock),
enTxData(enTxData) { enTxData(enTxData),
TRANSMITTER_TIMEOUT(transmitterTimeout) {
commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE); commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE);
auto mqArgs = MqArgs(objectId, static_cast<void*>(this)); auto mqArgs = MqArgs(objectId, static_cast<void*>(this));
eventQueue = eventQueue =
@ -312,7 +313,7 @@ void CCSDSHandler::enableTransmit() {
return; return;
} }
transmitterCountdown.setTimeout(TRANSMITTER_TIMEOUT); transmitterCountdown.setTimeout(TRANSMITTER_TIMEOUT);
#if BOARD_TE0720 == 0 #ifdef TE0720_1CFA
gpioIF->pullHigh(enTxClock); gpioIF->pullHigh(enTxClock);
gpioIF->pullHigh(enTxData); gpioIF->pullHigh(enTxData);
#endif /* BOARD_TE0720 == 0 */ #endif /* BOARD_TE0720 == 0 */
@ -331,7 +332,7 @@ void CCSDSHandler::checkTxTimer() {
} }
void CCSDSHandler::disableTransmit() { void CCSDSHandler::disableTransmit() {
#if BOARD_TE0720 == 0 #ifdef TE0720_1CFA
gpioIF->pullLow(enTxClock); gpioIF->pullLow(enTxClock);
gpioIF->pullLow(enTxData); gpioIF->pullLow(enTxData);
#endif /* BOARD_TE0720 == 0 */ #endif /* BOARD_TE0720 == 0 */

View File

@ -51,7 +51,8 @@ class CCSDSHandler : public SystemObject,
* @param enTxData GPIO ID of RS485 tx data enable * @param enTxData GPIO ID of RS485 tx data enable
*/ */
CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t tcDestination, CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t tcDestination,
PtmeConfig* ptmeConfig, GpioIF* gpioIF, gpioId_t enTxClock, gpioId_t enTxData); PtmeConfig* ptmeConfig, GpioIF* gpioIF, gpioId_t enTxClock, gpioId_t enTxData,
uint32_t transmitterTimeout = 900000);
~CCSDSHandler(); ~CCSDSHandler();
@ -104,14 +105,6 @@ class CCSDSHandler : public SystemObject,
//! [EXPORT] : [COMMENT] Received action message with unknown action id //! [EXPORT] : [COMMENT] Received action message with unknown action id
static const ReturnValue_t COMMAND_NOT_IMPLEMENTED = MAKE_RETURN_CODE(0xA0); static const ReturnValue_t COMMAND_NOT_IMPLEMENTED = MAKE_RETURN_CODE(0xA0);
#if OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT == 1
// syrlinks must not be transmitting more than 15 minutes (according to datasheet)
static const uint32_t TRANSMITTER_TIMEOUT = 900000; // 900000 ms = 15 min
#else
// Set to high value when not sending via syrlinks
static const uint32_t TRANSMITTER_TIMEOUT = 86400000; // 1 day
#endif /* OBSW_SYRLINKS_DOWNLINK == 0 */
static const bool UP = true; static const bool UP = true;
static const bool DOWN = false; static const bool DOWN = false;
@ -140,6 +133,10 @@ class CCSDSHandler : public SystemObject,
gpioId_t enTxClock = gpio::NO_GPIO; gpioId_t enTxClock = gpio::NO_GPIO;
gpioId_t enTxData = gpio::NO_GPIO; gpioId_t enTxData = gpio::NO_GPIO;
// syrlinks must not be transmitting more than 15 minutes (according to datasheet)
// Value can be configured via CTOR argument to allow test setups
const uint32_t TRANSMITTER_TIMEOUT = 900000; // 900000 ms = 15 min
// Countdown to disable transmitter after 15 minutes // Countdown to disable transmitter after 15 minutes
Countdown transmitterCountdown; Countdown transmitterCountdown;

View File

@ -9,8 +9,8 @@
object_id_t TmFunnel::downlinkDestination = objects::NO_OBJECT; object_id_t TmFunnel::downlinkDestination = objects::NO_OBJECT;
object_id_t TmFunnel::storageDestination = objects::NO_OBJECT; object_id_t TmFunnel::storageDestination = objects::NO_OBJECT;
TmFunnel::TmFunnel(object_id_t objectId, uint32_t messageDepth) TmFunnel::TmFunnel(object_id_t objectId, uint32_t messageDepth, uint8_t reportReceptionVc)
: SystemObject(objectId), messageDepth(messageDepth) { : SystemObject(objectId), messageDepth(messageDepth), reportReceptionVc(reportReceptionVc) {
auto mqArgs = MqArgs(objectId, static_cast<void*>(this)); auto mqArgs = MqArgs(objectId, static_cast<void*>(this));
tmQueue = QueueFactory::instance()->createMessageQueue( tmQueue = QueueFactory::instance()->createMessageQueue(
messageDepth, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs); messageDepth, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
@ -97,12 +97,7 @@ ReturnValue_t TmFunnel::initialize() {
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
#if OBSW_TM_TO_PTME == 1 tmQueue->setDefaultDestination(tmTarget->getReportReceptionQueue(reportReceptionVc));
// Live TM will be sent via the virtual channel 0
tmQueue->setDefaultDestination(tmTarget->getReportReceptionQueue(config::LIVE_TM));
#else
tmQueue->setDefaultDestination(tmTarget->getReportReceptionQueue());
#endif /* OBSW_TM_TO_PTME == 1 */
// Storage destination is optional. // Storage destination is optional.
if (storageDestination == objects::NO_OBJECT) { if (storageDestination == objects::NO_OBJECT) {

View File

@ -23,7 +23,7 @@ class TmFunnel : public AcceptsTelemetryIF, public ExecutableObjectIF, public Sy
friend void(Factory::setStaticFrameworkObjectIds)(); friend void(Factory::setStaticFrameworkObjectIds)();
public: public:
TmFunnel(object_id_t objectId, uint32_t messageDepth = 20); TmFunnel(object_id_t objectId, uint32_t messageDepth = 20, uint8_t reportReceptionVc = 0);
virtual ~TmFunnel(); virtual ~TmFunnel();
virtual MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override; virtual MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override;
@ -35,12 +35,13 @@ class TmFunnel : public AcceptsTelemetryIF, public ExecutableObjectIF, public Sy
static object_id_t storageDestination; static object_id_t storageDestination;
private: private:
uint32_t messageDepth = 0;
uint8_t reportReceptionVc = 0;
uint16_t sourceSequenceCount = 0; uint16_t sourceSequenceCount = 0;
MessageQueueIF* tmQueue = nullptr; MessageQueueIF* tmQueue = nullptr;
MessageQueueIF* storageQueue = nullptr; MessageQueueIF* storageQueue = nullptr;
StorageManagerIF* tmStore = nullptr; StorageManagerIF* tmStore = nullptr;
uint32_t messageDepth = 0;
ReturnValue_t handlePacket(TmTcMessage* message); ReturnValue_t handlePacket(TmTcMessage* message);
}; };

0
scripts/egse-port.sh Normal file → Executable file
View File

View File

@ -1 +1,2 @@
add_subdirectory(testtasks) add_subdirectory(testtasks)
add_subdirectory(gpio)

7
test/gpio/CMakeLists.txt Normal file
View File

@ -0,0 +1,7 @@
target_sources(${OBSW_NAME} PUBLIC
DummyGpioIF.cpp
)
target_include_directories(${OBSW_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)

24
test/gpio/DummyGpioIF.cpp Normal file
View File

@ -0,0 +1,24 @@
#include "DummyGpioIF.h"
DummyGpioIF::DummyGpioIF() {
}
DummyGpioIF::~DummyGpioIF() {
}
ReturnValue_t DummyGpioIF::addGpios(GpioCookie* cookie) {
return RETURN_OK;
}
ReturnValue_t DummyGpioIF::pullHigh(gpioId_t gpioId) {
return RETURN_OK;
}
ReturnValue_t DummyGpioIF::pullLow(gpioId_t gpioId) {
return RETURN_OK;
}
ReturnValue_t DummyGpioIF::readGpio(gpioId_t gpioId, int* gpioState) {
*gpioState = 0;
return RETURN_OK;
}

16
test/gpio/DummyGpioIF.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef TEST_GPIO_DUMMYGPIOIF_H_
#define TEST_GPIO_DUMMYGPIOIF_H_
#include "fsfw_hal/common/gpio/GpioIF.h"
class DummyGpioIF : public GpioIF {
public:
DummyGpioIF();
virtual ~DummyGpioIF();
virtual ReturnValue_t addGpios(GpioCookie* cookie);
virtual ReturnValue_t pullHigh(gpioId_t gpioId);
virtual ReturnValue_t pullLow(gpioId_t gpioId);
virtual ReturnValue_t readGpio(gpioId_t gpioId, int* gpioState);
};
#endif /* TEST_GPIO_DUMMYGPIOIF_H_ */

30
test/gpio/GpioDummy.h Normal file
View File

@ -0,0 +1,30 @@
#ifndef TEST_GPIODUMMY_H_
#define TEST_GPIODUMMY_H_
#include "fsfw_hal/common/gpio/GpioIF.h"
#include "fsfw_hal/common/gpio/gpioDefinitions.h"
/**
* @brief Additional abstraction layer for handling GPIOs.
*
* @author J. Meier
*/
class Gpio {
public:
Gpio(gpioId_t gpioId, GpioIF* gpioIF) : gpioId(gpioId), gpioIF(gpioIF) {
if (gpioIF == nullptr) {
sif::error << "Gpio::Gpio: Invalid GpioIF" << std::endl;
}
}
ReturnValue_t pullHigh() {
return gpioIF->pullHigh(gpioId);
}
ReturnValue_t pullLow() {
return gpioIF->pullLow(gpioId);
}
private:
gpioId_t gpioId = gpio::NO_GPIO;
GpioIF* gpioIF = nullptr;
};
#endif /* TEST_GPIODUMMY_H_ */