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) {
sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl; if (result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl;
}
} }
taskVec.push_back(gomSpacePstTask); 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);
#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,40 +1,40 @@
#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();
if (sdcMan == nullptr) { if (sdcMan == nullptr) {
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)) ==
std::string(SdCardManager::SD_0_MOUNT_POINT)) {
if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
sif::warning << "FilesystemHelper::checkPath: SD card 0 not mounted" << std::endl;
return SD_NOT_MOUNTED;
} }
if (path.substr(0, sizeof(SdCardManager::SD_0_MOUNT_POINT)) } else if (path.substr(0, sizeof(SdCardManager::SD_1_MOUNT_POINT)) ==
== std::string(SdCardManager::SD_0_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 0 not mounted" << std::endl; sif::warning << "FilesystemHelper::checkPath: SD card 1 not mounted" << std::endl;
return SD_NOT_MOUNTED; return SD_NOT_MOUNTED;
}
} else if (path.substr(0, sizeof(SdCardManager::SD_1_MOUNT_POINT))
== std::string(SdCardManager::SD_1_MOUNT_POINT)) {
if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
sif::warning << "FilesystemHelper::checkPath: SD card 1 not mounted" << std::endl;
return SD_NOT_MOUNTED;
}
} }
return RETURN_OK; }
return RETURN_OK;
} }
ReturnValue_t FilesystemHelper::fileExists(std::string file) { ReturnValue_t FilesystemHelper::fileExists(std::string file) {
if (not std::filesystem::exists(file)) { if (not std::filesystem::exists(file)) {
return FILE_NOT_EXISTS; return FILE_NOT_EXISTS;
} }
return RETURN_OK; return RETURN_OK;
} }

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.
@ -11,39 +12,38 @@
* @author J. Meier * @author J. Meier
*/ */
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
static const ReturnValue_t SD_NOT_MOUNTED = MAKE_RETURN_CODE(0xA0);
//! [EXPORT] : [COMMENT] Specified file does not exist on filesystem
static const ReturnValue_t FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xA1);
//! [EXPORT] : [COMMENT] SD card specified with path string not mounted FilesystemHelper();
static const ReturnValue_t SD_NOT_MOUNTED = MAKE_RETURN_CODE(0xA0); virtual ~FilesystemHelper();
//! [EXPORT] : [COMMENT] Specified file does not exist on filesystem
static const ReturnValue_t FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xA1);
FilesystemHelper(); /**
virtual ~FilesystemHelper(); * @brief In case the path points to a directory on the sd card the function checks if the
* appropriate SD card is mounted.
*
* @param path Path to check
*
* @return RETURN_OK if path points to SD card and the appropriate SD card is mounted or if
* path does not point to SD card.
* Return error code if path points to SD card and the corresponding SD card is not
* mounted.
*/
static ReturnValue_t checkPath(std::string path);
/** /**
* @brief In case the path points to a directory on the sd card the function checks if the * @brief Checks if the file exists on the filesystem.
* appropriate SD card is mounted. *
* * param file File to check
* @param path Path to check *
* * @return RETURN_OK if fiel exists, otherwise return error code.
* @return RETURN_OK if path points to SD card and the appropriate SD card is mounted or if */
* path does not point to SD card. static ReturnValue_t fileExists(std::string file);
* Return error code if path points to SD card and the corresponding SD card is not
* mounted.
*/
static ReturnValue_t checkPath(std::string path);
/**
* @brief Checks if the file exists on the filesystem.
*
* param file File to check
*
* @return RETURN_OK if fiel exists, otherwise return error code.
*/
static ReturnValue_t fileExists(std::string file);
}; };
#endif /* BSP_Q7S_MEMORY_FILESYSTEMHELPER_H_ */ #endif /* BSP_Q7S_MEMORY_FILESYSTEMHELPER_H_ */

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,16 +144,16 @@
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 failedP1: Return value returned by the communication interface requestReceiveMessage functionP2: 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 failedP1: Return value returned by the communication interface readingReceivedMessage functionP2: 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 reportP1: Number of bytes missingP2: 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
12106;0x2f4a;MISSING_EXE;LOW;Did not receive execution reportP1: Number of bytes missingP2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h 12106;0x2f4a;MISSING_EXE;LOW;Did not receive execution report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h
12107;0x2f4b;ACK_FAILURE_REPORT;LOW;Received acknowledgement failure reportP1: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h 12107;0x2f4b;ACK_FAILURE_REPORT;LOW;Received acknowledgement failure report P1: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h
12108;0x2f4c;EXE_FAILURE_REPORT;LOW;Received execution failure reportP1: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h 12108;0x2f4c;EXE_FAILURE_REPORT;LOW;Received execution failure report P1: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h
12109;0x2f4d;ACK_INVALID_APID;LOW;Expected acknowledgement report but received space packet with other apidP1: Apid of received space packetP2: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h 12109;0x2f4d;ACK_INVALID_APID;LOW;Expected acknowledgement report but received space packet with other apid P1: Apid of received space packet P2: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h
12110;0x2f4e;EXE_INVALID_APID;LOW;Expected execution report but received space packet with other apidP1: Apid of received space packetP2: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h 12110;0x2f4e;EXE_INVALID_APID;LOW;Expected execution report but received space packet with other apid P1: Apid of received space packet P2: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h
12111;0x2f4f;MPSOC_HELPER_SEQ_CNT_MISMATCH;LOW;Received sequence count does not match expected sequence countP1: Expected sequence countP2: Received sequence count;linux/devices/ploc/PlocMPSoCHelper.h 12111;0x2f4f;MPSOC_HELPER_SEQ_CNT_MISMATCH;LOW;Received sequence count does not match expected sequence count P1: Expected sequence count P2: Received sequence count;linux/devices/ploc/PlocMPSoCHelper.h
12200;0x2fa8;TRANSITION_OTHER_SIDE_FAILED;HIGH;;mission/system/AcsBoardAssembly.h 12200;0x2fa8;TRANSITION_OTHER_SIDE_FAILED;HIGH;;mission/system/AcsBoardAssembly.h
12201;0x2fa9;NOT_ENOUGH_DEVICES_DUAL_MODE;HIGH;;mission/system/AcsBoardAssembly.h 12201;0x2fa9;NOT_ENOUGH_DEVICES_DUAL_MODE;HIGH;;mission/system/AcsBoardAssembly.h
12202;0x2faa;POWER_STATE_MACHINE_TIMEOUT;MEDIUM;;mission/system/AcsBoardAssembly.h 12202;0x2faa;POWER_STATE_MACHINE_TIMEOUT;MEDIUM;;mission/system/AcsBoardAssembly.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
151 12106 0x2f4a MISSING_EXE LOW Did not receive execution report P1: Number of bytes missing P2: Internal state of MPSoC helper linux/devices/ploc/PlocMPSoCHelper.h
152 12107 0x2f4b ACK_FAILURE_REPORT LOW Received acknowledgement failure report P1: Internal state of MPSoC linux/devices/ploc/PlocMPSoCHelper.h
153 12108 0x2f4c EXE_FAILURE_REPORT LOW Received execution failure report P1: Internal state of MPSoC linux/devices/ploc/PlocMPSoCHelper.h
154 12109 0x2f4d ACK_INVALID_APID LOW Expected acknowledgement report but received space packet with other apid P1: Apid of received space packet P2: Internal state of MPSoC linux/devices/ploc/PlocMPSoCHelper.h
155 12110 0x2f4e EXE_INVALID_APID LOW Expected execution report but received space packet with other apid P1: Apid of received space packet P2: Internal state of MPSoC linux/devices/ploc/PlocMPSoCHelper.h
156 12111 0x2f4f MPSOC_HELPER_SEQ_CNT_MISMATCH LOW Received sequence count does not match expected sequence count P1: Expected sequence count P2: Received sequence count linux/devices/ploc/PlocMPSoCHelper.h
157 12200 0x2fa8 TRANSITION_OTHER_SIDE_FAILED HIGH mission/system/AcsBoardAssembly.h
158 12201 0x2fa9 NOT_ENOUGH_DEVICES_DUAL_MODE HIGH mission/system/AcsBoardAssembly.h
159 12202 0x2faa POWER_STATE_MACHINE_TIMEOUT MEDIUM mission/system/AcsBoardAssembly.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

@ -4,27 +4,27 @@
#include "fsfw/returnvalues/HasReturnvaluesIF.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h"
class MPSoCReturnValuesIF { class MPSoCReturnValuesIF {
public: public:
static const uint8_t INTERFACE_ID = CLASS_ID::MPSOC_RETURN_VALUES_IF; static const uint8_t INTERFACE_ID = CLASS_ID::MPSOC_RETURN_VALUES_IF;
//! [EXPORT] : [COMMENT] Space Packet received from PLOC has invalid CRC //! [EXPORT] : [COMMENT] Space Packet received from PLOC has invalid CRC
static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA0); static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA0);
//! [EXPORT] : [COMMENT] Received ACK failure reply from PLOC //! [EXPORT] : [COMMENT] Received ACK failure reply from PLOC
static const ReturnValue_t RECEIVED_ACK_FAILURE = MAKE_RETURN_CODE(0xA1); static const ReturnValue_t RECEIVED_ACK_FAILURE = MAKE_RETURN_CODE(0xA1);
//! [EXPORT] : [COMMENT] Received execution failure reply from PLOC //! [EXPORT] : [COMMENT] Received execution failure reply from PLOC
static const ReturnValue_t RECEIVED_EXE_FAILURE = MAKE_RETURN_CODE(0xA2); static const ReturnValue_t RECEIVED_EXE_FAILURE = MAKE_RETURN_CODE(0xA2);
//! [EXPORT] : [COMMENT] Received space packet with invalid APID from PLOC //! [EXPORT] : [COMMENT] Received space packet with invalid APID from PLOC
static const ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(0xA3); static const ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(0xA3);
//! [EXPORT] : [COMMENT] Received command with invalid length //! [EXPORT] : [COMMENT] Received command with invalid length
static const ReturnValue_t INVALID_LENGTH = MAKE_RETURN_CODE(0xA4); static const ReturnValue_t INVALID_LENGTH = MAKE_RETURN_CODE(0xA4);
//! [EXPORT] : [COMMENT] Filename of file in OBC filesystem is too long //! [EXPORT] : [COMMENT] Filename of file in OBC filesystem is too long
static const ReturnValue_t FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xA5); static const ReturnValue_t FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xA5);
//! [EXPORT] : [COMMENT] MPSoC helper is currently executing a command //! [EXPORT] : [COMMENT] MPSoC helper is currently executing a command
static const ReturnValue_t MPSOC_HELPER_EXECUTING = MAKE_RETURN_CODE(0xA6); static const ReturnValue_t MPSOC_HELPER_EXECUTING = MAKE_RETURN_CODE(0xA6);
//! [EXPORT] : [COMMENT] Filename of MPSoC file is to long (max. 256 bytes) //! [EXPORT] : [COMMENT] Filename of MPSoC file is to long (max. 256 bytes)
static const ReturnValue_t MPSOC_FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xA7); static const ReturnValue_t MPSOC_FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xA7);
//! [EXPORT] : [COMMENT] Command has invalid parameter //! [EXPORT] : [COMMENT] Command has invalid parameter
static const ReturnValue_t INVALID_PARAMETER = MAKE_RETURN_CODE(0xA8); static const ReturnValue_t INVALID_PARAMETER = MAKE_RETURN_CODE(0xA8);
}; };
#endif /* MPSOC_RETURN_VALUES_IF_H_ */ #endif /* MPSOC_RETURN_VALUES_IF_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 {
@ -37,28 +38,29 @@ static const uint16_t SIZE_TM_MEM_READ_REPORT = 18;
* SpacePacket apids of PLOC telecommands and telemetry. * SpacePacket apids of PLOC telecommands and telemetry.
*/ */
namespace apid { namespace apid {
static const uint16_t TC_REPLAY_START = 0x110; static const uint16_t TC_REPLAY_START = 0x110;
static const uint16_t TC_REPLAY_STOP = 0x111; static const uint16_t TC_REPLAY_STOP = 0x111;
static const uint16_t TC_REPLAY_WRITE_SEQUENCE = 0x112; static const uint16_t TC_REPLAY_WRITE_SEQUENCE = 0x112;
static const uint16_t TC_DOWNLINK_PWR_ON = 0x113; static const uint16_t TC_DOWNLINK_PWR_ON = 0x113;
static const uint16_t TC_MEM_WRITE = 0x114; static const uint16_t TC_MEM_WRITE = 0x114;
static const uint16_t TC_MEM_READ = 0x115; static const uint16_t TC_MEM_READ = 0x115;
static const uint16_t TC_FLASHWRITE = 0x117; static const uint16_t TC_FLASHWRITE = 0x117;
static const uint16_t TC_FLASHFOPEN = 0x119; static const uint16_t TC_FLASHFOPEN = 0x119;
static const uint16_t TC_FLASHFCLOSE = 0x11A; static const uint16_t TC_FLASHFCLOSE = 0x11A;
static const uint16_t TC_FLASHDELETE = 0x11C; static const uint16_t TC_FLASHDELETE = 0x11C;
static const uint16_t TC_MODE_REPLAY = 0x11F; static const uint16_t TC_MODE_REPLAY = 0x11F;
static const uint16_t TC_DOWNLINK_PWR_OFF = 0x124; static const uint16_t TC_DOWNLINK_PWR_OFF = 0x124;
static const uint16_t TM_MEMORY_READ_REPORT = 0x404; static const uint16_t TM_MEMORY_READ_REPORT = 0x404;
static const uint16_t ACK_SUCCESS = 0x400; static const uint16_t ACK_SUCCESS = 0x400;
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,504 +83,488 @@ 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.
static const uint16_t INIT_LENGTH = 1;
// Initial length field of space packet. Will always be updated when packet is created. /**
static const uint16_t INIT_LENGTH = 1; * @brief Constructor
*
* @param sequenceCount Sequence count of space packet which will be incremented with each
* sent and received packets.
*/
TcBase(uint16_t apid, uint16_t sequenceCount)
: SpacePacket(INIT_LENGTH, true, apid, sequenceCount) {}
/** /**
* @brief Constructor * @brief Function to initialize the space packet
* *
* @param sequenceCount Sequence count of space packet which will be incremented with each * @param commandData Pointer to command specific data
* sent and received packets. * @param commandDataLen Length of command data
*/ *
TcBase(uint16_t apid, uint16_t sequenceCount) : * @return RETURN_OK if packet creation was successful, otherwise error return value
SpacePacket(INIT_LENGTH, true, apid, sequenceCount) { */
virtual ReturnValue_t createPacket(const uint8_t* commandData, size_t commandDataLen) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
result = initPacket(commandData, commandDataLen);
if (result != HasReturnvaluesIF::HasReturnvaluesIF::RETURN_OK) {
return result;
} }
result = addCrc();
/** if (result != HasReturnvaluesIF::HasReturnvaluesIF::RETURN_OK) {
* @brief Function to initialize the space packet return result;
*
* @param commandData Pointer to command specific data
* @param commandDataLen Length of command data
*
* @return RETURN_OK if packet creation was successful, otherwise error return value
*/
virtual ReturnValue_t createPacket(const uint8_t* commandData, size_t commandDataLen) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
result = initPacket(commandData, commandDataLen);
if (result != HasReturnvaluesIF::HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = addCrc();
if (result != HasReturnvaluesIF::HasReturnvaluesIF::RETURN_OK) {
return result;
}
return result;
} }
return result;
}
protected: protected:
/** /**
* @brief Must be overwritten by the child class to define the command specific parameters * @brief Must be overwritten by the child class to define the command specific parameters
* *
* @param commandData Pointer to received command data * @param commandData Pointer to received command data
* @param commandDataLen Length of received command data * @param commandDataLen Length of received command data
*/ */
virtual ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) { virtual ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
/** /**
* @brief Calculates and adds the CRC * @brief Calculates and adds the CRC
*/ */
ReturnValue_t addCrc() { ReturnValue_t addCrc() {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
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;
}
return result;
} }
return result;
}
}; };
/** /**
* @brief Class for handling tm replies of the PLOC MPSoC. * @brief Class for handling tm replies of the PLOC MPSoC.
*/ */
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.
*/
TmPacket() : SpacePacket(PACKET_MAX_SIZE) {}
/** ReturnValue_t checkCrc() {
* @brief Constructor creates idle packet and sets length field to maximum allowed size. uint8_t* crcPtr = this->getPacketData() + this->getPacketDataLength() - 1;
*/ uint16_t receivedCrc = *(crcPtr) << 8 | *(crcPtr + 1);
TmPacket() : SpacePacket(PACKET_MAX_SIZE) { uint16_t recalculatedCrc =
} CRC::crc16ccitt(this->localData.byteStream, this->getFullSize() - CRC_SIZE);
if (recalculatedCrc != receivedCrc) {
ReturnValue_t checkCrc() { return CRC_FAILURE;
uint8_t* crcPtr = this->getPacketData() + this->getPacketDataLength() - 1;
uint16_t receivedCrc = *(crcPtr) << 8 | *(crcPtr + 1);
uint16_t recalculatedCrc = CRC::crc16ccitt(this->localData.byteStream, this->getFullSize());
if (recalculatedCrc != receivedCrc) {
return CRC_FAILURE;
}
return HasReturnvaluesIF::RETURN_OK;
} }
return HasReturnvaluesIF::RETURN_OK;
}
}; };
/** /**
* @brief This class helps to build the memory read command for the PLOC. * @brief This class helps to build the memory read command for the PLOC.
*/ */
class TcMemRead: public TcBase { class TcMemRead : public TcBase {
public: public:
/**
* @brief Constructor
*/
TcMemRead(uint16_t sequenceCount) : TcBase(apid::TC_MEM_READ, sequenceCount) {
this->setPacketDataLength(PACKET_LENGTH);
}
/** uint16_t getMemLen() const { return memLen; }
* @brief Constructor
*/ protected:
TcMemRead(uint16_t sequenceCount) : ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
TcBase(apid::TC_MEM_READ, sequenceCount) { ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
this->setPacketDataLength(PACKET_LENGTH); result = lengthCheck(commandDataLen);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
} }
std::memcpy(this->localData.fields.buffer, commandData, MEM_ADDRESS_SIZE);
uint16_t getMemLen() const { std::memcpy(this->localData.fields.buffer + MEM_ADDRESS_SIZE, commandData + MEM_ADDRESS_SIZE,
return memLen; MEM_LEN_SIZE);
size_t size = sizeof(memLen);
const uint8_t* memLenPtr = commandData + MEM_ADDRESS_SIZE;
result =
SerializeAdapter::deSerialize(&memLen, &memLenPtr, &size, SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
} }
return result;
}
protected: private:
static const size_t COMMAND_LENGTH = 6;
static const size_t MEM_ADDRESS_SIZE = 4;
static const size_t MEM_LEN_SIZE = 2;
static const uint16_t PACKET_LENGTH = 7;
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) { uint16_t memLen = 0;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
result = lengthCheck(commandDataLen); ReturnValue_t lengthCheck(size_t commandDataLen) {
if (result != HasReturnvaluesIF::RETURN_OK) { if (commandDataLen != COMMAND_LENGTH) {
return result; return INVALID_LENGTH;
}
std::memcpy(this->localData.fields.buffer, commandData, MEM_ADDRESS_SIZE);
std::memcpy(this->localData.fields.buffer + MEM_ADDRESS_SIZE,
commandData + MEM_ADDRESS_SIZE, MEM_LEN_SIZE);
size_t size = sizeof(memLen);
const uint8_t* memLenPtr = commandData + MEM_ADDRESS_SIZE;
result = SerializeAdapter::deSerialize(&memLen, &memLenPtr, &size,
SerializeIF::Endianness::BIG);
if(result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return result;
}
private:
static const size_t COMMAND_LENGTH = 6;
static const size_t MEM_ADDRESS_SIZE = 4;
static const size_t MEM_LEN_SIZE = 2;
static const uint16_t PACKET_LENGTH = 7;
uint16_t memLen = 0;
ReturnValue_t lengthCheck(size_t commandDataLen) {
if (commandDataLen != COMMAND_LENGTH){
return INVALID_LENGTH;
}
return HasReturnvaluesIF::RETURN_OK;
} }
return HasReturnvaluesIF::RETURN_OK;
}
}; };
/** /**
* @brief This class helps to generate the space packet to write data to a memory address within * @brief This class helps to generate the space packet to write data to a memory address within
* the PLOC. * the PLOC.
*/ */
class TcMemWrite: public TcBase { class TcMemWrite : public TcBase {
public: 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:
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
result = lengthCheck(commandDataLen);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
} }
std::memcpy(this->localData.fields.buffer, commandData, commandDataLen);
uint16_t memLen =
*(commandData + MEM_ADDRESS_SIZE) << 8 | *(commandData + MEM_ADDRESS_SIZE + 1);
this->setPacketDataLength(memLen * 4 + FIX_LENGTH - 1);
return result;
}
protected: private:
// Min length consists of 4 byte address, 2 byte mem length field, 4 byte data (1 word)
static const size_t MIN_COMMAND_DATA_LENGTH = 10;
static const size_t MEM_ADDRESS_SIZE = 4;
static const size_t FIX_LENGTH = 8;
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t lengthCheck(size_t commandDataLen) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; if (commandDataLen < MIN_COMMAND_DATA_LENGTH) {
result = lengthCheck(commandDataLen); sif::warning << "TcMemWrite: Command has invalid length " << commandDataLen << std::endl;
if (result != HasReturnvaluesIF::RETURN_OK) { return INVALID_LENGTH;
return result;
}
std::memcpy(this->localData.fields.buffer, commandData, commandDataLen);
uint16_t memLen = *(commandData + MEM_ADDRESS_SIZE) << 8
| *(commandData + MEM_ADDRESS_SIZE + 1);
this->setPacketDataLength(memLen * 4 + FIX_LENGTH - 1);
return result;
}
private:
// Min length consists of 4 byte address, 2 byte mem length field, 4 byte data (1 word)
static const size_t MIN_COMMAND_DATA_LENGTH = 10;
static const size_t MEM_ADDRESS_SIZE = 4;
static const size_t FIX_LENGTH = 8;
ReturnValue_t lengthCheck(size_t commandDataLen) {
if (commandDataLen < MIN_COMMAND_DATA_LENGTH) {
sif::warning << "TcMemWrite: Command has invalid length " << commandDataLen << std::endl;
return INVALID_LENGTH;
}
return HasReturnvaluesIF::RETURN_OK;
} }
return HasReturnvaluesIF::RETURN_OK;
}
}; };
/** /**
* @brief Class to help creation of flash fopen command. * @brief Class to help creation of flash fopen command.
*/ */
class FlashFopen : public TcBase { class FlashFopen : public TcBase {
public: public:
FlashFopen(uint16_t sequenceCount) : TcBase(apid::TC_FLASHFOPEN, sequenceCount) {}
FlashFopen(uint16_t sequenceCount) : static const char APPEND = 'a';
TcBase(apid::TC_FLASHFOPEN, sequenceCount) { static const char WRITE = 'w';
static const char READ = 'r';
ReturnValue_t createPacket(std::string filename, char accessMode_) {
accessMode = accessMode_;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
size_t nameSize = filename.size();
std::memcpy(this->getPacketData(), filename.c_str(), nameSize);
*(this->getPacketData() + nameSize) = NULL_TERMINATOR;
std::memcpy(this->getPacketData() + nameSize + sizeof(NULL_TERMINATOR), &accessMode,
sizeof(accessMode));
this->setPacketDataLength(nameSize + sizeof(NULL_TERMINATOR) + sizeof(accessMode) + CRC_SIZE -
1);
result = addCrc();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
} }
return result;
}
static const char APPEND = 'a'; private:
static const char WRITE = 'w'; char accessMode = APPEND;
static const char READ = 'r';
ReturnValue_t createPacket(std::string filename, char accessMode) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
size_t nameSize = filename.size();
std::memcpy(this->getPacketData(), filename.c_str(),
nameSize);
std::memcpy(this->getPacketData() + nameSize + 1, &accessMode,
sizeof(accessMode));
this->setPacketDataLength(nameSize + CRC_SIZE - 1);
result = addCrc();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return result;
}
}; };
/** /**
* @brief Class to help creation of flash fclose command. * @brief Class to help creation of flash fclose command.
*/ */
class FlashFclose: public TcBase { class FlashFclose : public TcBase {
public: public:
FlashFclose(uint16_t sequenceCount) : TcBase(apid::TC_FLASHFCLOSE, sequenceCount) {}
FlashFclose(uint16_t sequenceCount) : ReturnValue_t createPacket(std::string filename) {
TcBase(apid::TC_FLASHFCLOSE, sequenceCount) { ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
} size_t nameSize = filename.size();
std::memcpy(this->getPacketData(), filename.c_str(), nameSize);
ReturnValue_t createPacket(std::string filename) { *(this->getPacketData() + nameSize) = NULL_TERMINATOR;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; this->setPacketDataLength(nameSize + sizeof(NULL_TERMINATOR) + CRC_SIZE - 1);
size_t nameSize = filename.size(); result = addCrc();
std::memcpy(this->getPacketData(), filename.c_str(), nameSize); if (result != HasReturnvaluesIF::RETURN_OK) {
this->setPacketDataLength(nameSize + CRC_SIZE - 1); return result;
result = addCrc(); }
if (result != HasReturnvaluesIF::RETURN_OK) { return result;
return result; }
}
return result;
}
}; };
/** /**
* @brief Class to build flash write space packet. * @brief Class to build flash write space packet.
*/ */
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_;
if (writeLen > MAX_DATA_SIZE) {
sif::debug << "FlashWrite::createPacket: Command data too big" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
} }
size_t serializedSize = 0;
result =
SerializeAdapter::serialize<uint32_t>(&writeLen, this->getPacketData(), &serializedSize,
sizeof(writeLen), SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
std::memcpy(this->getPacketData() + sizeof(writeLen), writeData, writeLen);
this->setPacketDataLength(static_cast<uint16_t>(writeLen + CRC_SIZE - 1));
result = addCrc();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t createPacket(uint8_t* writeData, uint32_t writeLen) { private:
if (writeLen > MAX_DATA_SIZE) { uint32_t writeLen = 0;
sif::debug << "FlashWrite::createPacket: Command data too big" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
std::memcpy(this->getPacketData(), &writeLen, sizeof(writeLen));
std::memcpy(this->getPacketData() + sizeof(writeLen), writeData, writeLen);
this->setPacketDataLength(static_cast<uint16_t>(writeLen + CRC_SIZE - 1));
ReturnValue_t result = addCrc();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
}
}; };
/** /**
* @brief Class to help creation of flash delete command. * @brief Class to help creation of flash delete command.
*/ */
class TcFlashDelete: public TcBase { class TcFlashDelete : public TcBase {
public: public:
TcFlashDelete(uint16_t sequenceCount) : TcBase(apid::TC_FLASHDELETE, sequenceCount) {}
TcFlashDelete(uint16_t sequenceCount) : ReturnValue_t createPacket(std::string filename) {
TcBase(apid::TC_FLASHDELETE , sequenceCount) { ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
} size_t nameSize = filename.size();
std::memcpy(this->getPacketData(), filename.c_str(), nameSize);
ReturnValue_t createPacket(std::string filename) { *(this->getPacketData() + nameSize) = NULL_TERMINATOR;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; this->setPacketDataLength(nameSize + sizeof(NULL_TERMINATOR) + CRC_SIZE - 1);
size_t nameSize = filename.size(); result = addCrc();
std::memcpy(this->getPacketData(), filename.c_str(), nameSize); if (result != HasReturnvaluesIF::RETURN_OK) {
this->setPacketDataLength(nameSize + CRC_SIZE - 1); return result;
result = addCrc(); }
if (result != HasReturnvaluesIF::RETURN_OK) { return result;
return result; }
}
return result;
}
}; };
/** /**
* @brief Class to build replay stop space packet. * @brief Class to build replay stop space packet.
*/ */
class TcReplayStop : public TcBase { class TcReplayStop : public TcBase {
public: public:
TcReplayStop(uint16_t sequenceCount) : TcBase(apid::TC_REPLAY_STOP, sequenceCount) {}
TcReplayStop(uint16_t sequenceCount) : ReturnValue_t createPacket() {
TcBase(apid::TC_REPLAY_STOP, sequenceCount) { ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
} result = addCrc();
if (result != HasReturnvaluesIF::RETURN_OK) {
ReturnValue_t createPacket() { return result;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
result = addCrc();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
this->setPacketDataLength(static_cast<uint16_t>(CRC_SIZE - 1));
return HasReturnvaluesIF::RETURN_OK;
} }
this->setPacketDataLength(static_cast<uint16_t>(CRC_SIZE - 1));
return HasReturnvaluesIF::RETURN_OK;
}
}; };
/** /**
* @brief This class helps to build the replay start command. * @brief This class helps to build the replay start command.
*/ */
class TcReplayStart: public TcBase { class TcReplayStart : public TcBase {
public: 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:
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
result = lengthCheck(commandDataLen);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
} }
result = checkData(*commandData);
protected: if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
result = lengthCheck(commandDataLen);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = checkData(*commandData);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
std::memcpy(this->localData.fields.buffer, commandData, commandDataLen);
this->setPacketDataLength(commandDataLen + CRC_SIZE - 1);
return result;
} }
std::memcpy(this->localData.fields.buffer, commandData, commandDataLen);
this->setPacketDataLength(commandDataLen + CRC_SIZE - 1);
return result;
}
private: private:
static const size_t COMMAND_DATA_LENGTH = 1;
static const uint8_t REPEATING = 0;
static const uint8_t ONCE = 1;
static const size_t COMMAND_DATA_LENGTH = 1; ReturnValue_t lengthCheck(size_t commandDataLen) {
static const uint8_t REPEATING = 0; if (commandDataLen != COMMAND_DATA_LENGTH) {
static const uint8_t ONCE = 1; sif::warning << "TcReplayStart: Command has invalid length " << commandDataLen << std::endl;
return INVALID_LENGTH;
ReturnValue_t lengthCheck(size_t commandDataLen) {
if (commandDataLen != COMMAND_DATA_LENGTH) {
sif::warning << "TcReplayStart: Command has invalid length " << commandDataLen << std::endl;
return INVALID_LENGTH;
}
return HasReturnvaluesIF::RETURN_OK;
} }
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t checkData(uint8_t replay) { ReturnValue_t checkData(uint8_t replay) {
if (replay != REPEATING && replay != ONCE) { if (replay != REPEATING && replay != ONCE) {
sif::warning << "TcReplayStart::checkData: Invalid replay value" << std::endl; sif::warning << "TcReplayStart::checkData: Invalid replay value" << std::endl;
return INVALID_PARAMETER; return INVALID_PARAMETER;
}
return HasReturnvaluesIF::RETURN_OK;
} }
return HasReturnvaluesIF::RETURN_OK;
}
}; };
/** /**
* @brief This class helps to build downlink power on command. * @brief This class helps to build downlink power on command.
*/ */
class TcDownlinkPwrOn: public TcBase { class TcDownlinkPwrOn : public TcBase {
public: 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:
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
result = lengthCheck(commandDataLen);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
} }
result = modeCheck(*commandData);
protected: if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
result = lengthCheck(commandDataLen);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = modeCheck(*commandData);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = laneRateCheck(*(commandData + 1));
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
std::memcpy(this->localData.fields.buffer, commandData, commandDataLen);
std::memcpy(this->localData.fields.buffer + commandDataLen, &MAX_AMPLITUDE,
sizeof(MAX_AMPLITUDE));
this->setPacketDataLength(commandDataLen + sizeof(MAX_AMPLITUDE) + CRC_SIZE - 1);
return result;
} }
result = laneRateCheck(*(commandData + 1));
private: if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
static const uint8_t INTERFACE_ID = CLASS_ID::DWLPWRON_CMD;
//! [EXPORT] : [COMMENT] Received command has invalid JESD mode (valid modes are 0 - 5)
static const ReturnValue_t INVALID_MODE = MAKE_RETURN_CODE(0xE0);
//! [EXPORT] : [COMMENT] Received command has invalid lane rate (valid lane rate are 0 - 9)
static const ReturnValue_t INVALID_LANE_RATE = MAKE_RETURN_CODE(0xE1);
static const size_t COMMAND_DATA_LENGTH = 2;
static const uint8_t MAX_MODE = 5;
static const uint8_t MAX_LANE_RATE = 9;
static const uint16_t MAX_AMPLITUDE = 0;
ReturnValue_t lengthCheck(size_t commandDataLen) {
if (commandDataLen != COMMAND_DATA_LENGTH) {
sif::warning << "TcDownlinkPwrOn: Command has invalid length " << commandDataLen << std::endl;
return INVALID_LENGTH;
}
return HasReturnvaluesIF::RETURN_OK;
} }
std::memcpy(this->localData.fields.buffer, commandData, commandDataLen);
std::memcpy(this->localData.fields.buffer + commandDataLen, &MAX_AMPLITUDE,
sizeof(MAX_AMPLITUDE));
this->setPacketDataLength(commandDataLen + sizeof(MAX_AMPLITUDE) + CRC_SIZE - 1);
return result;
}
ReturnValue_t modeCheck(uint8_t mode) { private:
if (mode > MAX_MODE) { static const uint8_t INTERFACE_ID = CLASS_ID::DWLPWRON_CMD;
sif::warning << "TcDwonlinkPwrOn::modeCheck: Invalid JESD mode" << std::endl;
return INVALID_MODE;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t laneRateCheck(uint8_t laneRate) { //! [EXPORT] : [COMMENT] Received command has invalid JESD mode (valid modes are 0 - 5)
if (laneRate > MAX_LANE_RATE) { static const ReturnValue_t INVALID_MODE = MAKE_RETURN_CODE(0xE0);
sif::warning << "TcReplayStart::laneRateCheck: Invalid lane rate" << std::endl; //! [EXPORT] : [COMMENT] Received command has invalid lane rate (valid lane rate are 0 - 9)
return INVALID_LANE_RATE; static const ReturnValue_t INVALID_LANE_RATE = MAKE_RETURN_CODE(0xE1);
}
return HasReturnvaluesIF::RETURN_OK; static const size_t COMMAND_DATA_LENGTH = 2;
static const uint8_t MAX_MODE = 5;
static const uint8_t MAX_LANE_RATE = 9;
static const uint16_t MAX_AMPLITUDE = 0;
ReturnValue_t lengthCheck(size_t commandDataLen) {
if (commandDataLen != COMMAND_DATA_LENGTH) {
sif::warning << "TcDownlinkPwrOn: Command has invalid length " << commandDataLen << std::endl;
return INVALID_LENGTH;
} }
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t modeCheck(uint8_t mode) {
if (mode > MAX_MODE) {
sif::warning << "TcDwonlinkPwrOn::modeCheck: Invalid JESD mode" << std::endl;
return INVALID_MODE;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t laneRateCheck(uint8_t laneRate) {
if (laneRate > MAX_LANE_RATE) {
sif::warning << "TcReplayStart::laneRateCheck: Invalid lane rate" << std::endl;
return INVALID_LANE_RATE;
}
return HasReturnvaluesIF::RETURN_OK;
}
}; };
/** /**
* @brief Class to build replay stop space packet. * @brief Class to build replay stop space packet.
*/ */
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) : ReturnValue_t createPacket() {
TcBase(apid::TC_DOWNLINK_PWR_OFF, sequenceCount) { ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
} result = addCrc();
if (result != HasReturnvaluesIF::RETURN_OK) {
ReturnValue_t createPacket() { return result;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
result = addCrc();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
this->setPacketDataLength(static_cast<uint16_t>(CRC_SIZE - 1));
return HasReturnvaluesIF::RETURN_OK;
} }
this->setPacketDataLength(static_cast<uint16_t>(CRC_SIZE - 1));
return HasReturnvaluesIF::RETURN_OK;
}
}; };
/** /**
* @brief This class helps to build the replay start command. * @brief This class helps to build the replay start command.
*/ */
class TcReplayWriteSeq: public TcBase { class TcReplayWriteSeq : public TcBase {
public: 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); if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != HasReturnvaluesIF::RETURN_OK) { return result;
return result;
}
std::memcpy(this->localData.fields.buffer, commandData, commandDataLen);
this->setPacketDataLength(commandDataLen + CRC_SIZE - 1);
return result;
} }
std::memcpy(this->localData.fields.buffer, commandData, commandDataLen);
*(this->localData.fields.buffer + commandDataLen) = NULL_TERMINATOR;
this->setPacketDataLength(commandDataLen + sizeof(NULL_TERMINATOR) + CRC_SIZE - 1);
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) {
if (commandDataLen > USE_DECODING_LENGTH + MAX_FILENAME_SIZE) {
ReturnValue_t lengthCheck(size_t commandDataLen) { sif::warning << "TcReplayWriteSeq: Command has invalid length " << commandDataLen
if (commandDataLen > USE_DECODING_LENGTH + MAX_FILENAME_SIZE) { << 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;
}
}; };
class FlashWritePusCmd : public MPSoCReturnValuesIF { class FlashWritePusCmd : public MPSoCReturnValuesIF {
@ -587,30 +573,25 @@ class FlashWritePusCmd : public MPSoCReturnValuesIF {
ReturnValue_t extractFields(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t extractFields(const uint8_t* commandData, size_t commandDataLen) {
if (commandDataLen > (config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE + MAX_FILENAME_SIZE)) { if (commandDataLen > (config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE + MAX_FILENAME_SIZE)) {
return INVALID_LENGTH; return INVALID_LENGTH;
} }
obcFile = std::string(reinterpret_cast<const char*>(commandData)); obcFile = std::string(reinterpret_cast<const char*>(commandData));
if (obcFile.size() > (config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE)) { if (obcFile.size() > (config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE)) {
return FILENAME_TOO_LONG; return FILENAME_TOO_LONG;
} }
mpsocFile = std::string( mpsocFile = std::string(
reinterpret_cast<const char*>(commandData + obcFile.size() + SIZE_NULL_TERMINATOR)); reinterpret_cast<const char*>(commandData + obcFile.size() + SIZE_NULL_TERMINATOR));
if (mpsocFile.size() > MAX_FILENAME_SIZE) { if (mpsocFile.size() > MAX_FILENAME_SIZE) {
return MPSOC_FILENAME_TOO_LONG; return MPSOC_FILENAME_TOO_LONG;
} }
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 = "";
@ -620,25 +601,20 @@ class FlashWritePusCmd : public MPSoCReturnValuesIF {
* @brief Class to build replay stop space packet. * @brief Class to build replay stop space packet.
*/ */
class TcModeReplay : public TcBase { class TcModeReplay : public TcBase {
public: public:
TcModeReplay(uint16_t sequenceCount) : TcBase(apid::TC_MODE_REPLAY, sequenceCount) {}
TcModeReplay(uint16_t sequenceCount) : ReturnValue_t createPacket() {
TcBase(apid::TC_MODE_REPLAY, sequenceCount) { ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
} result = addCrc();
if (result != HasReturnvaluesIF::RETURN_OK) {
ReturnValue_t createPacket() { return result;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
result = addCrc();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
this->setPacketDataLength(static_cast<uint16_t>(CRC_SIZE - 1));
return HasReturnvaluesIF::RETURN_OK;
} }
this->setPacketDataLength(static_cast<uint16_t>(CRC_SIZE - 1));
return HasReturnvaluesIF::RETURN_OK;
}
}; };
} } // 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);
@ -507,10 +513,10 @@ ReturnValue_t PlocMPSoCHandler::handleExecutionReport(const uint8_t* data) {
case (mpsoc::apid::EXE_FAILURE): { case (mpsoc::apid::EXE_FAILURE): {
// TODO: Interpretation of status field in execution report // TODO: Interpretation of status field in execution report
sif::warning << "PlocMPSoCHandler::handleExecutionReport: Received execution failure report" sif::warning << "PlocMPSoCHandler::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) {
uint16_t status = getStatus(data); uint16_t status = getStatus(data);
triggerEvent(EXE_FAILURE, commandId, status); triggerEvent(EXE_FAILURE, commandId, status);
} else { } else {
sif::debug << "PlocMPSoCHandler::handleExecutionReport: Unknown command id" << std::endl; sif::debug << "PlocMPSoCHandler::handleExecutionReport: Unknown command id" << std::endl;
@ -536,7 +542,7 @@ ReturnValue_t PlocMPSoCHandler::handleMemoryReadReport(const uint8_t* data) {
result = verifyPacket(data, tmMemReadReport.rememberRequestedSize); result = verifyPacket(data, tmMemReadReport.rememberRequestedSize);
if (result == MPSoCReturnValuesIF::CRC_FAILURE) { if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
sif::warning << "PlocMPSoCHandler::handleMemoryReadReport: Memory read report has invalid crc" sif::warning << "PlocMPSoCHandler::handleMemoryReadReport: Memory read report has invalid crc"
<< std::endl; << std::endl;
} }
uint16_t memLen = uint16_t memLen =
*(data + mpsoc::MEM_READ_RPT_LEN_OFFSET) << 8 | *(data + mpsoc::MEM_READ_RPT_LEN_OFFSET + 1); *(data + mpsoc::MEM_READ_RPT_LEN_OFFSET) << 8 | *(data + mpsoc::MEM_READ_RPT_LEN_OFFSET + 1);
@ -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; break;
} else { }
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;
} }
@ -753,5 +762,5 @@ void PlocMPSoCHandler::printStatus(const uint8_t* data) {
} }
uint16_t PlocMPSoCHandler::getStatus(const uint8_t* data) { uint16_t PlocMPSoCHandler::getStatus(const uint8_t* data) {
return *(data + STATUS_OFFSET) << 8 | *(data + STATUS_OFFSET + 1); return *(data + STATUS_OFFSET) << 8 | *(data + STATUS_OFFSET + 1);
} }

View File

@ -2,216 +2,216 @@
#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,
PlocMPSoCHelper* plocMPSoCHelper, Gpio uartIsolatorSwitch);
virtual ~PlocMPSoCHandler();
virtual ReturnValue_t initialize() override;
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) override;
void performOperationHook() override;
PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF * comCookie, protected:
PlocMPSoCHelper* plocMPSoCHelper); void doStartUp() override;
virtual ~PlocMPSoCHandler(); void doShutDown() override;
virtual ReturnValue_t initialize() override; ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
const uint8_t* data, size_t size) override; void fillCommandAndReplyMap() override;
void performOperationHook() override; ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
size_t commandDataLen) override;
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
size_t* foundLen) override;
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
void setNormalDatapoolEntriesInvalid() override;
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
ReturnValue_t enableReplyInReplyMap(DeviceCommandMap::iterator command,
uint8_t expectedReplies = 1, bool useAlternateId = false,
DeviceCommandId_t alternateReplyID = 0) override;
size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
protected: private:
void doStartUp() override; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_MPSOC_HANDLER;
void doShutDown() override;
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override;
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t * id) override;
void fillCommandAndReplyMap() override;
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t * commandData,size_t commandDataLen) override;
ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize,
DeviceCommandId_t *foundId, size_t *foundLen) override;
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id,
const uint8_t *packet) override;
void setNormalDatapoolEntriesInvalid() override;
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
ReturnValue_t enableReplyInReplyMap(DeviceCommandMap::iterator command,
uint8_t expectedReplies = 1, bool useAlternateId = false,
DeviceCommandId_t alternateReplyID = 0) override;
size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
private: //! [EXPORT] : [COMMENT] PLOC crc failure in telemetry packet
static const Event MEMORY_READ_RPT_CRC_FAILURE = MAKE_EVENT(1, severity::LOW);
//! [EXPORT] : [COMMENT] PLOC receive acknowledgment failure report
//! P1: Command Id which leads the acknowledgment failure report
//! P2: The status field inserted by the MPSoC into the data field
static const Event ACK_FAILURE = MAKE_EVENT(2, severity::LOW);
//! [EXPORT] : [COMMENT] PLOC receive execution failure report
//! P1: Command Id which leads the execution failure report
//! P2: The status field inserted by the MPSoC into the data field
static const Event EXE_FAILURE = MAKE_EVENT(3, severity::LOW);
//! [EXPORT] : [COMMENT] PLOC reply has invalid crc
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 P1: Expected sequence count P2: Received sequence count
static const Event MPSOC_HANDLER_SEQ_CNT_MISMATCH = MAKE_EVENT(5, severity::LOW);
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_MPSOC_HANDLER; //! [EXPORT] : [COMMENT] Received command has file string with invalid length
static const ReturnValue_t NAME_TOO_LONG = MAKE_RETURN_CODE(0xD0);
//! [EXPORT] : [COMMENT] PLOC crc failure in telemetry packet static const uint16_t APID_MASK = 0x7FF;
static const Event MEMORY_READ_RPT_CRC_FAILURE = MAKE_EVENT(1, severity::LOW); static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
//! [EXPORT] : [COMMENT] PLOC receive acknowledgment failure report static const uint8_t STATUS_OFFSET = 10;
//! P1: Command Id which leads the acknowledgment failure report
//! P2: The status field inserted by the MPSoC into the data field
static const Event ACK_FAILURE = MAKE_EVENT(2, severity::LOW);
//! [EXPORT] : [COMMENT] PLOC receive execution failure report
//! P1: Command Id which leads the execution failure report
//! P2: The status field inserted by the MPSoC into the data field
static const Event EXE_FAILURE = MAKE_EVENT(3, severity::LOW);
//! [EXPORT] : [COMMENT] PLOC reply has invalid crc
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
//! P1: Expected sequence count
//! P2: Received sequence count
static const Event MPSOC_HANDLER_SEQ_CNT_MISMATCH = MAKE_EVENT(5, severity::LOW);
//! [EXPORT] : [COMMENT] Received command has file string with invalid length MessageQueueIF* eventQueue = nullptr;
static const ReturnValue_t NAME_TOO_LONG = MAKE_RETURN_CODE(0xD0);
static const uint16_t APID_MASK = 0x7FF; SourceSequenceCounter sequenceCount;
static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
static const uint8_t STATUS_OFFSET = 10;
MessageQueueIF* eventQueue = nullptr; uint8_t commandBuffer[mpsoc::MAX_COMMAND_SIZE];
SourceSequenceCounter sequenceCount; /**
* This variable is used to store the id of the next reply to receive. This is necessary
* because the PLOC sends as reply to each command at least one acknowledgment and execution
* report.
*/
DeviceCommandId_t nextReplyId = mpsoc::NONE;
uint8_t commandBuffer[mpsoc::MAX_COMMAND_SIZE]; UartComIF* uartComIf = nullptr;
/** PlocMPSoCHelper* plocMPSoCHelper = nullptr;
* This variable is used to store the id of the next reply to receive. This is necessary Gpio uartIsolatorSwitch;
* because the PLOC sends as reply to each command at least one acknowledgment and execution
* report.
*/
DeviceCommandId_t nextReplyId = mpsoc::NONE;
UartComIF* uartComIf = nullptr; // Used to block incoming commands when MPSoC helper class is currently executing a command
bool plocMPSoCHelperExecuting = false;
PlocMPSoCHelper* plocMPSoCHelper = nullptr; class TmMemReadReport {
public:
static const uint8_t FIX_SIZE = 14;
size_t rememberRequestedSize = 0;
};
// Used to block incoming commands when MPSoC helper class is currently executing a command TmMemReadReport tmMemReadReport;
bool plocMPSoCHelperExecuting = false;
class TmMemReadReport { /**
public: * @brief Handles events received from the PLOC MPSoC helper
static const uint8_t FIX_SIZE = 14; */
size_t rememberRequestedSize = 0; void handleEvent(EventMessage* eventMessage);
};
TmMemReadReport tmMemReadReport; ReturnValue_t prepareTcMemWrite(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t prepareTcMemRead(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t prepareTcFlashDelete(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t prepareTcReplayStart(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t prepareTcReplayStop();
ReturnValue_t prepareTcDownlinkPwrOn(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t prepareTcDownlinkPwrOff();
ReturnValue_t prepareTcReplayWriteSequence(const uint8_t* commandData, size_t commandDataLen);
/** /**
* @brief Handles events received from the PLOC MPSoC helper * @brief Copies space packet into command buffer
*/ */
void handleEvent(EventMessage* eventMessage); void copyToCommandBuffer(mpsoc::TcBase* tc);
ReturnValue_t prepareTcMemWrite(const uint8_t * commandData, size_t commandDataLen); /**
ReturnValue_t prepareTcMemRead(const uint8_t * commandData, size_t commandDataLen); * @brief This function checks the crc of the received PLOC reply.
ReturnValue_t prepareTcFlashDelete(const uint8_t * commandData, size_t commandDataLen); *
ReturnValue_t prepareTcReplayStart(const uint8_t * commandData, size_t commandDataLen); * @param start Pointer to the first byte of the reply.
ReturnValue_t prepareTcReplayStop(); * @param foundLen Pointer to the length of the whole packet.
ReturnValue_t prepareTcDownlinkPwrOn(const uint8_t * commandData, size_t commandDataLen); *
ReturnValue_t prepareTcDownlinkPwrOff(); * @return RETURN_OK if CRC is ok, otherwise CRC_FAILURE.
ReturnValue_t prepareTcReplayWriteSequence(const uint8_t * commandData, size_t commandDataLen); */
ReturnValue_t verifyPacket(const uint8_t* start, size_t foundLen);
/** /**
* @brief Copies space packet into command buffer * @brief This function handles the acknowledgment report.
*/ *
void copyToCommandBuffer(mpsoc::TcBase* tc); * @param data Pointer to the data holding the acknowledgment report.
*
* @return RETURN_OK if successful, otherwise an error code.
*/
ReturnValue_t handleAckReport(const uint8_t* data);
/** /**
* @brief This function checks the crc of the received PLOC reply. * @brief This function handles the data of a execution report.
* *
* @param start Pointer to the first byte of the reply. * @param data Pointer to the received data packet.
* @param foundLen Pointer to the length of the whole packet. *
* * @return RETURN_OK if successful, otherwise an error code.
* @return RETURN_OK if CRC is ok, otherwise CRC_FAILURE. */
*/ ReturnValue_t handleExecutionReport(const uint8_t* data);
ReturnValue_t verifyPacket(const uint8_t* start, size_t foundLen);
/** /**
* @brief This function handles the acknowledgment report. * @brief This function handles the memory read report.
* *
* @param data Pointer to the data holding the acknowledgment report. * @param data Pointer to the data buffer holding the memory read report.
* *
* @return RETURN_OK if successful, otherwise an error code. * @return RETURN_OK if successful, otherwise an error code.
*/ */
ReturnValue_t handleAckReport(const uint8_t* data); ReturnValue_t handleMemoryReadReport(const uint8_t* data);
/** /**
* @brief This function handles the data of a execution report. * @brief Depending on the current active command, this function sets the reply id of the
* * next reply after a successful acknowledgment report has been received. This is
* @param data Pointer to the received data packet. * required by the function getNextReplyLength() to identify the length of the next
* * reply to read.
* @return RETURN_OK if successful, otherwise an error code. */
*/ void setNextReplyId();
ReturnValue_t handleExecutionReport(const uint8_t* data);
/** /**
* @brief This function handles the memory read report. * @brief This function handles action message replies in case the telemetry has been
* * requested by another object.
* @param data Pointer to the data buffer holding the memory read report. *
* * @param data Pointer to the telemetry data.
* @return RETURN_OK if successful, otherwise an error code. * @param dataSize Size of telemetry in bytes.
*/ * @param replyId Id of the reply. This will be added to the ActionMessage.
ReturnValue_t handleMemoryReadReport(const uint8_t* data); */
void handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId);
/** /**
* @brief Depending on the current active command, this function sets the reply id of the * @brief In case an acknowledgment failure reply has been received this function disables
* next reply after a successful acknowledgment report has been received. This is * all previously enabled commands and resets the exepected replies variable of an
* required by the function getNextReplyLength() to identify the length of the next * active command.
* reply to read. */
*/ void disableAllReplies();
void setNextReplyId();
/** /**
* @brief This function handles action message replies in case the telemetry has been * @brief This function sends a failure report if the active action was commanded by an other
* requested by another object. * object.
* *
* @param data Pointer to the telemetry data. * @param replyId The id of the reply which signals a failure.
* @param dataSize Size of telemetry in bytes. * @param status A status byte which gives information about the failure type.
* @param replyId Id of the reply. This will be added to the ActionMessage. */
*/ void sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status);
void handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId);
/** /**
* @brief In case an acknowledgment failure reply has been received this function disables * @brief This function disables the execution report reply. Within this function also the
* all previously enabled commands and resets the exepected replies variable of an * the variable expectedReplies of an active command will be set to 0.
* active command. */
*/ void disableExeReportReply();
void disableAllReplies();
/** void printStatus(const uint8_t* data);
* @brief This function sends a failure report if the active action was commanded by an other
* object.
*
* @param replyId The id of the reply which signals a failure.
* @param status A status byte which gives information about the failure type.
*/
void sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status);
/** ReturnValue_t prepareTcModeReplay();
* @brief This function disables the execution report reply. Within this function also the
* the variable expectedReplies of an active command will be set to 0.
*/
void disableExeReportReply();
void printStatus(const uint8_t* data); uint16_t getStatus(const uint8_t* data);
ReturnValue_t prepareTcModeReplay();
uint16_t getStatus(const uint8_t* data);
}; };
#endif /* BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ */ #endif /* BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ */

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;
} }
@ -80,7 +81,7 @@ ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string obcFile, std::string
#ifdef TE0720_1CFA #ifdef TE0720_1CFA
if (not std::filesystem::exists(obcFile)) { if (not std::filesystem::exists(obcFile)) {
sif::warning << "PlocMPSoCHelper::startFlashWrite: File " << obcFile << "does not exist" sif::warning << "PlocMPSoCHelper::startFlashWrite: File " << obcFile << "does not exist"
<< std::endl; << std::endl;
return RETURN_FAILED; return RETURN_FAILED;
} }
#endif #endif
@ -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; }
@ -99,7 +110,7 @@ ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
result = flashfopen(); result = flashfopen();
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
} }
uint8_t tempData[mpsoc::MAX_DATA_SIZE]; uint8_t tempData[mpsoc::MAX_DATA_SIZE];
std::ifstream file(flashWrite.obcFile, std::ifstream::binary); std::ifstream file(flashWrite.obcFile, std::ifstream::binary);
@ -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,26 +129,25 @@ ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
} else { } else {
dataLength = remainingSize; dataLength = remainingSize;
} }
file.read(reinterpret_cast<char*>(tempData), dataLength); if (file.is_open()) {
file.seekg(bytesRead, file.beg);
file.read(reinterpret_cast<char*>(tempData), dataLength);
bytesRead += dataLength;
remainingSize -= dataLength;
} else {
return FILE_CLOSED_ACCIDENTALLY;
}
(*sequenceCount)++; (*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;
} }
} }
result = flashfclose(); result = flashfclose();
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
} }
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;
} }
@ -157,23 +168,40 @@ ReturnValue_t PlocMPSoCHelper::flashfopen() {
} }
ReturnValue_t PlocMPSoCHelper::flashfclose() { ReturnValue_t PlocMPSoCHelper::flashfclose() {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
(*sequenceCount)++; (*sequenceCount)++;
mpsoc::FlashFclose flashFclose(*sequenceCount); mpsoc::FlashFclose flashFclose(*sequenceCount);
result = flashFclose.createPacket(flashWrite.mpsocFile); result = flashFclose.createPacket(flashWrite.mpsocFile);
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"
@ -19,134 +20,134 @@
* MPSoC and OBC. * MPSoC and OBC.
* @author J. Meier * @author J. Meier
*/ */
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
static const Event MPSOC_FLASH_WRITE_FAILED = MAKE_EVENT(0, severity::LOW);
//! [EXPORT] : [COMMENT] Flash write successful
static const Event MPSOC_FLASH_WRITE_SUCCESSFUL = MAKE_EVENT(1, severity::LOW);
//! [EXPORT] : [COMMENT] Communication interface returned failure when trying to send the command
//! ot the PLOC
//! P1: Return value returned by the communication interface sendMessage function
//! P2: Internal state of MPSoC helper
static const Event SENDING_COMMAND_FAILED = MAKE_EVENT(2, severity::LOW);
//! [EXPORT] : [COMMENT] Request receive message of communication interface failed
//! P1: Return value returned by the communication interface requestReceiveMessage function
//! P2: Internal state of MPSoC helper
static const Event MPSOC_HELPER_REQUESTING_REPLY_FAILED = MAKE_EVENT(3, severity::LOW);
//! [EXPORT] : [COMMENT] Reading receive message of communication interface failed
//! P1: Return value returned by the communication interface readingReceivedMessage function
//! P2: Internal state of MPSoC helper
static const Event MPSOC_HELPER_READING_REPLY_FAILED = MAKE_EVENT(4, severity::LOW);
//! [EXPORT] : [COMMENT] Did not receive acknowledgement report
//! P1: Number of bytes missing
//! P2: Internal state of MPSoC helper
static const Event MISSING_ACK = MAKE_EVENT(5, severity::LOW);
//! [EXPORT] : [COMMENT] Did not receive execution report
//! P1: Number of bytes missing
//! P2: Internal state of MPSoC helper
static const Event MISSING_EXE = MAKE_EVENT(6, severity::LOW);
//! [EXPORT] : [COMMENT] Received acknowledgement failure report
//! P1: Internal state of MPSoC
static const Event ACK_FAILURE_REPORT = MAKE_EVENT(7, severity::LOW);
//! [EXPORT] : [COMMENT] Received execution failure report
//! P1: Internal state of MPSoC
static const Event EXE_FAILURE_REPORT = MAKE_EVENT(8, severity::LOW);
//! [EXPORT] : [COMMENT] Expected acknowledgement report but received space packet with other apid
//! P1: Apid of received space packet
//! P2: Internal state of MPSoC
static const Event ACK_INVALID_APID = MAKE_EVENT(9, severity::LOW);
//! [EXPORT] : [COMMENT] Expected execution report but received space packet with other apid
//! P1: Apid of received space packet
//! P2: Internal state of MPSoC
static const Event EXE_INVALID_APID = MAKE_EVENT(10, severity::LOW);
//! [EXPORT] : [COMMENT] Received sequence count does not match expected sequence count
//! P1: Expected sequence count
//! P2: Received sequence count
static const Event MPSOC_HELPER_SEQ_CNT_MISMATCH = MAKE_EVENT(11, severity::LOW);
//! [EXPORT] : [COMMENT] Flash write fails PlocMPSoCHelper(object_id_t objectId);
static const Event MPSOC_FLASH_WRITE_FAILED = MAKE_EVENT(0, severity::LOW); virtual ~PlocMPSoCHelper();
//! [EXPORT] : [COMMENT] Flash write successful
static const Event MPSOC_FLASH_WRITE_SUCCESSFUL = MAKE_EVENT(1, severity::LOW);
//! [EXPORT] : [COMMENT] Communication interface returned failure when trying to send the command ot the PLOC
//!P1: Return value returned by the communication interface sendMessage function
//!P2: Internal state of MPSoC helper
static const Event SENDING_COMMAND_FAILED = MAKE_EVENT(2, severity::LOW);
//! [EXPORT] : [COMMENT] Request receive message of communication interface failed
//!P1: Return value returned by the communication interface requestReceiveMessage function
//!P2: Internal state of MPSoC helper
static const Event MPSOC_HELPER_REQUESTING_REPLY_FAILED = MAKE_EVENT(3, severity::LOW);
//! [EXPORT] : [COMMENT] Reading receive message of communication interface failed
//!P1: Return value returned by the communication interface readingReceivedMessage function
//!P2: Internal state of MPSoC helper
static const Event MPSOC_HELPER_READING_REPLY_FAILED = MAKE_EVENT(4, severity::LOW);
//! [EXPORT] : [COMMENT] Did not receive acknowledgement report
//!P1: Number of bytes missing
//!P2: Internal state of MPSoC helper
static const Event MISSING_ACK = MAKE_EVENT(5, severity::LOW);
//! [EXPORT] : [COMMENT] Did not receive execution report
//!P1: Number of bytes missing
//!P2: Internal state of MPSoC helper
static const Event MISSING_EXE = MAKE_EVENT(6, severity::LOW);
//! [EXPORT] : [COMMENT] Received acknowledgement failure report
//!P1: Internal state of MPSoC
static const Event ACK_FAILURE_REPORT = MAKE_EVENT(7, severity::LOW);
//! [EXPORT] : [COMMENT] Received execution failure report
//!P1: Internal state of MPSoC
static const Event EXE_FAILURE_REPORT = MAKE_EVENT(8, severity::LOW);
//! [EXPORT] : [COMMENT] Expected acknowledgement report but received space packet with other apid
//!P1: Apid of received space packet
//!P2: Internal state of MPSoC
static const Event ACK_INVALID_APID = MAKE_EVENT(9, severity::LOW);
//! [EXPORT] : [COMMENT] Expected execution report but received space packet with other apid
//!P1: Apid of received space packet
//!P2: Internal state of MPSoC
static const Event EXE_INVALID_APID = MAKE_EVENT(10, severity::LOW);
//! [EXPORT] : [COMMENT] Received sequence count does not match expected sequence count
//!P1: Expected sequence count
//!P2: Received sequence count
static const Event MPSOC_HELPER_SEQ_CNT_MISMATCH = MAKE_EVENT(11, severity::LOW);
PlocMPSoCHelper(object_id_t objectId); ReturnValue_t initialize() override;
virtual ~PlocMPSoCHelper(); ReturnValue_t performOperation(uint8_t operationCode = 0) override;
ReturnValue_t initialize() override; ReturnValue_t setComIF(DeviceCommunicationIF* communicationInterface_);
ReturnValue_t performOperation(uint8_t operationCode = 0) override; void setComCookie(CookieIF* comCookie_);
ReturnValue_t setComIF(DeviceCommunicationIF* communicationInterface_); /**
void setComCookie(CookieIF* comCookie_); * @brief Starts flash write sequence
*
* @param obcFile File where to read from the data
* @param mpsocFile The file of the MPSoC where should be written to
*
* @return RETURN_OK if successful, otherwise error return value
*/
ReturnValue_t startFlashWrite(std::string obcFile, std::string mpsocFile);
/** /**
* @brief Starts flash write sequence * @brief Can be used to interrupt a running data transfer.
* */
* @param obcFile File where to read from the data void stopProcess();
* @param mpsocFile The file of the MPSoC where should be written to
*
* @return RETURN_OK if successful, otherwise error return value
*/
ReturnValue_t startFlashWrite(std::string obcFile, std::string mpsocFile);
/** /**
* @brief Can be used to interrupt a running data transfer. * @brief Sets the sequence count object responsible for the sequence count handling
*/ */
void stopProcess(); void setSequenceCount(SourceSequenceCounter* sequenceCount_);
/** private:
* @brief Sets the sequence count object responsible for the sequence count handling static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_MPSOC_HELPER;
*/
void setSequenceCount(SourceSequenceCounter* sequenceCount_);
private: //! [EXPORT] : [COMMENT] File accidentally close
static const ReturnValue_t FILE_CLOSED_ACCIDENTALLY = MAKE_RETURN_CODE(0xA0);
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_MPSOC_HELPER; // Maximum number of times the communication interface retries polling data from the reply
// buffer
static const int RETRIES = 10000;
// Maximum number of times the communication interface retries polling data from the reply struct FlashWrite {
// buffer std::string obcFile;
static const int RETRIES = 3; std::string mpsocFile;
};
struct FlashWrite { struct FlashWrite flashWrite;
std::string obcFile;
std::string mpsocFile;
};
struct FlashWrite flashWrite; enum class InternalState { IDLE, FLASH_WRITE, FLASH_READ };
enum class InternalState { InternalState internalState = InternalState::IDLE;
IDLE,
FLASH_WRITE,
FLASH_READ
};
InternalState internalState = InternalState::IDLE; BinarySemaphore semaphore;
BinarySemaphore semaphore;
#ifdef XIPHOS_Q7S #ifdef XIPHOS_Q7S
SdCardManager* sdcMan = nullptr; SdCardManager* sdcMan = nullptr;
#endif #endif
uint8_t commandBuffer[mpsoc::MAX_COMMAND_SIZE]; uint8_t commandBuffer[mpsoc::MAX_COMMAND_SIZE];
bool terminate = false; bool terminate = false;
/** /**
* Communication interface of MPSoC responsible for low level access. Must be set by the * Communication interface of MPSoC responsible for low level access. Must be set by the
* MPSoC Handler. * MPSoC Handler.
*/ */
UartComIF* uartComIF = nullptr; UartComIF* uartComIF = nullptr;
// Communication cookie. Must be set by the MPSoC Handler // Communication cookie. Must be set by the MPSoC Handler
CookieIF* comCookie = nullptr; CookieIF* comCookie = nullptr;
// Sequence count, must be set by Ploc MPSoC Handler // Sequence count, must be set by Ploc MPSoC Handler
SourceSequenceCounter* sequenceCount; SourceSequenceCounter* sequenceCount;
ReturnValue_t performFlashWrite(); ReturnValue_t resetHelper();
ReturnValue_t flashfopen(); ReturnValue_t performFlashWrite();
ReturnValue_t flashfclose(); ReturnValue_t flashfopen();
ReturnValue_t sendCommand(mpsoc::TcBase* tc); ReturnValue_t flashfclose();
ReturnValue_t receive(uint8_t* data, size_t* readBytes, size_t requestBytes); ReturnValue_t handlePacketTransmission(mpsoc::TcBase& tc);
ReturnValue_t handleAck(); ReturnValue_t sendCommand(mpsoc::TcBase& tc);
ReturnValue_t handleExe(); ReturnValue_t receive(uint8_t* data, size_t* readBytes, size_t requestBytes);
void handleAckApidFailure(uint16_t apid); ReturnValue_t handleAck();
void handleExeApidFailure(uint16_t apid); ReturnValue_t handleExe();
ReturnValue_t handleTmReception(mpsoc::TmPacket* tmPacket, size_t remainingBytes); void handleAckApidFailure(uint16_t apid);
void handleExeApidFailure(uint16_t apid);
ReturnValue_t handleTmReception(mpsoc::TmPacket* tmPacket, size_t remainingBytes);
}; };
#endif /* BSP_Q7S_DEVICES_PLOCMPSOCHELPER_H_ */ #endif /* BSP_Q7S_DEVICES_PLOCMPSOCHELPER_H_ */

File diff suppressed because it is too large Load Diff

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
@ -19,322 +22,328 @@
* Arbeitsdaten/08_Used%20Components/PLOC&fileid=940960 * Arbeitsdaten/08_Used%20Components/PLOC&fileid=940960
* @author J. Meier * @author J. Meier
*/ */
class PlocSupervisorHandler: public DeviceHandlerBase { class PlocSupervisorHandler : public DeviceHandlerBase {
public: public:
PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie,
Gpio uartIsolatorSwitch);
virtual ~PlocSupervisorHandler();
PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF * comCookie); virtual ReturnValue_t initialize() override;
virtual ~PlocSupervisorHandler();
virtual ReturnValue_t initialize() override; protected:
void doStartUp() override;
void doShutDown() override;
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
void fillCommandAndReplyMap() override;
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
size_t commandDataLen) override;
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
size_t* foundLen) override;
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
void setNormalDatapoolEntriesInvalid() override;
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
ReturnValue_t enableReplyInReplyMap(DeviceCommandMap::iterator command,
uint8_t expectedReplies = 1, bool useAlternateId = false,
DeviceCommandId_t alternateReplyID = 0) override;
size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
protected: private:
void doStartUp() override; static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_SUPERVISOR_HANDLER;
void doShutDown() override;
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override;
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t * id) override;
void fillCommandAndReplyMap() override;
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t * commandData,size_t commandDataLen) override;
ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize,
DeviceCommandId_t *foundId, size_t *foundLen) override;
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id,
const uint8_t *packet) override;
void setNormalDatapoolEntriesInvalid() override;
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
ReturnValue_t enableReplyInReplyMap(DeviceCommandMap::iterator command,
uint8_t expectedReplies = 1, bool useAlternateId = false,
DeviceCommandId_t alternateReplyID = 0) override;
size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
private: //! [EXPORT] : [COMMENT] Space Packet received from PLOC supervisor has invalid CRC
static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA0);
//! [EXPORT] : [COMMENT] Received ACK failure reply from PLOC supervisor
static const ReturnValue_t RECEIVED_ACK_FAILURE = MAKE_RETURN_CODE(0xA1);
//! [EXPORT] : [COMMENT] Received execution failure reply from PLOC supervisor
static const ReturnValue_t RECEIVED_EXE_FAILURE = MAKE_RETURN_CODE(0xA2);
//! [EXPORT] : [COMMENT] Received space packet with invalid APID from PLOC supervisor
static const ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(0xA3);
//! [EXPORT] : [COMMENT] Failed to read current system time
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
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.
static const ReturnValue_t INVALID_WATCHDOG_TIMEOUT = MAKE_RETURN_CODE(0xA6);
//! [EXPORT] : [COMMENT] Received latchup config command with invalid latchup ID
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.
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.
static const ReturnValue_t INVALID_TEST_PARAM = MAKE_RETURN_CODE(0xA9);
//! [EXPORT] : [COMMENT] Returned when scanning for MRAM dump packets failed.
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)
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.
static const ReturnValue_t NO_MRAM_PACKET = MAKE_RETURN_CODE(0xAC);
//! [EXPORT] : [COMMENT] Path to PLOC directory on SD card does not exist
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.
static const ReturnValue_t MRAM_FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xAE);
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_SUPERVISOR_HANDLER; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_SUPERVISOR_HANDLER;
//! [EXPORT] : [COMMENT] Space Packet received from PLOC supervisor has invalid CRC //! [EXPORT] : [COMMENT] PLOC supervisor crc failure in telemetry packet
static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA0); static const Event SUPV_MEMORY_READ_RPT_CRC_FAILURE = MAKE_EVENT(1, severity::LOW);
//! [EXPORT] : [COMMENT] Received ACK failure reply from PLOC supervisor //! [EXPORT] : [COMMENT] PLOC supervisor received acknowledgment failure report
static const ReturnValue_t RECEIVED_ACK_FAILURE = MAKE_RETURN_CODE(0xA1); static const Event SUPV_ACK_FAILURE = MAKE_EVENT(2, severity::LOW);
//! [EXPORT] : [COMMENT] Received execution failure reply from PLOC supervisor //! [EXPORT] : [COMMENT] PLOC received execution failure report
static const ReturnValue_t RECEIVED_EXE_FAILURE = MAKE_RETURN_CODE(0xA2); static const Event SUPV_EXE_FAILURE = MAKE_EVENT(3, severity::LOW);
//! [EXPORT] : [COMMENT] Received space packet with invalid APID from PLOC supervisor //! [EXPORT] : [COMMENT] PLOC supervisor reply has invalid crc
static const ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(0xA3); static const Event SUPV_CRC_FAILURE_EVENT = MAKE_EVENT(4, severity::LOW);
//! [EXPORT] : [COMMENT] Failed to read current system time
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
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.
static const ReturnValue_t INVALID_WATCHDOG_TIMEOUT = MAKE_RETURN_CODE(0xA6);
//! [EXPORT] : [COMMENT] Received latchup config command with invalid latchup ID
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.
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.
static const ReturnValue_t INVALID_TEST_PARAM = MAKE_RETURN_CODE(0xA9);
//! [EXPORT] : [COMMENT] Returned when scanning for MRAM dump packets failed.
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)
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.
static const ReturnValue_t NO_MRAM_PACKET = MAKE_RETURN_CODE(0xAC);
//! [EXPORT] : [COMMENT] Path to PLOC directory on SD card does not exist
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.
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 uint16_t APID_MASK = 0x7FF;
static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
//! [EXPORT] : [COMMENT] PLOC supervisor crc failure in telemetry packet uint8_t commandBuffer[PLOC_SPV::MAX_COMMAND_SIZE];
static const Event SUPV_MEMORY_READ_RPT_CRC_FAILURE = MAKE_EVENT(1, severity::LOW);
//! [EXPORT] : [COMMENT] PLOC supervisor received acknowledgment failure report
static const Event SUPV_ACK_FAILURE = MAKE_EVENT(2, severity::LOW);
//! [EXPORT] : [COMMENT] PLOC received execution failure report
static const Event SUPV_EXE_FAILURE = MAKE_EVENT(3, severity::LOW);
//! [EXPORT] : [COMMENT] PLOC supervisor reply has invalid crc
static const Event SUPV_CRC_FAILURE_EVENT = MAKE_EVENT(4, severity::LOW);
static const uint16_t APID_MASK = 0x7FF; /**
static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF; * This variable is used to store the id of the next reply to receive. This is necessary
* because the PLOC sends as reply to each command at least one acknowledgment and execution
* report.
*/
DeviceCommandId_t nextReplyId = PLOC_SPV::NONE;
uint8_t commandBuffer[PLOC_SPV::MAX_COMMAND_SIZE]; UartComIF* uartComIf = nullptr;
LinuxLibgpioIF* gpioComIF = nullptr;
Gpio uartIsolatorSwitch;
/** PLOC_SPV::HkSet hkset;
* This variable is used to store the id of the next reply to receive. This is necessary PLOC_SPV::BootStatusReport bootStatusReport;
* because the PLOC sends as reply to each command at least one acknowledgment and execution PLOC_SPV::LatchupStatusReport latchupStatusReport;
* report.
*/
DeviceCommandId_t nextReplyId = PLOC_SPV::NONE;
UartComIF* uartComIf = nullptr; /** Number of expected replies following the MRAM dump command */
uint32_t expectedMramDumpPackets = 0;
uint32_t receivedMramDumpPackets = 0;
/** Set to true as soon as a complete space packet is present in the spacePacketBuffer */
bool packetInBuffer = false;
/** Points to the next free position in the space packet buffer */
uint16_t bufferTop = 0;
PLOC_SPV::HkSet hkset; /** This buffer is used to concatenate space packets received in two different read steps */
PLOC_SPV::BootStatusReport bootStatusReport; uint8_t spacePacketBuffer[PLOC_SPV::MAX_PACKET_SIZE];
PLOC_SPV::LatchupStatusReport latchupStatusReport;
/** Number of expected replies following the MRAM dump command */ #ifdef TE0720_1CFA
uint32_t expectedMramDumpPackets = 0; SdCardManager* sdcMan = nullptr;
uint32_t receivedMramDumpPackets = 0;
/** Set to true as soon as a complete space packet is present in the spacePacketBuffer */
bool packetInBuffer = false;
/** Points to the next free position in the space packet buffer */
uint16_t bufferTop = 0;
/** This buffer is used to concatenate space packets received in two different read steps */
uint8_t spacePacketBuffer[PLOC_SPV::MAX_PACKET_SIZE];
#if BOARD_TE0720 == 0
SdCardManager* sdcMan = nullptr;
#endif /* BOARD_TE0720 == 0 */ #endif /* BOARD_TE0720 == 0 */
/** Path to PLOC specific files on SD card */ /** Path to PLOC specific files on SD card */
std::string plocFilePath = "ploc"; std::string plocFilePath = "ploc";
std::string activeMramFile; std::string activeMramFile;
/** Setting this variable to true will enable direct downlink of MRAM packets */ /** Setting this variable to true will enable direct downlink of MRAM packets */
bool downlinkMramDump = false; bool downlinkMramDump = false;
/** /**
* @brief This function checks the crc of the received PLOC reply. * @brief This function checks the crc of the received PLOC reply.
* *
* @param start Pointer to the first byte of the reply. * @param start Pointer to the first byte of the reply.
* @param foundLen Pointer to the length of the whole packet. * @param foundLen Pointer to the length of the whole packet.
* *
* @return RETURN_OK if CRC is ok, otherwise CRC_FAILURE. * @return RETURN_OK if CRC is ok, otherwise CRC_FAILURE.
*/ */
ReturnValue_t verifyPacket(const uint8_t* start, size_t foundLen); ReturnValue_t verifyPacket(const uint8_t* start, size_t foundLen);
/** /**
* @brief This function handles the acknowledgment report. * @brief This function handles the acknowledgment report.
* *
* @param data Pointer to the data holding the acknowledgment report. * @param data Pointer to the data holding the acknowledgment report.
* *
* @return RETURN_OK if successful, otherwise an error code. * @return RETURN_OK if successful, otherwise an error code.
*/ */
ReturnValue_t handleAckReport(const uint8_t* data); ReturnValue_t handleAckReport(const uint8_t* data);
/** /**
* @brief This function handles the data of a execution report. * @brief This function handles the data of a execution report.
* *
* @param data Pointer to the received data packet. * @param data Pointer to the received data packet.
* *
* @return RETURN_OK if successful, otherwise an error code. * @return RETURN_OK if successful, otherwise an error code.
*/ */
ReturnValue_t handleExecutionReport(const uint8_t* data); ReturnValue_t handleExecutionReport(const uint8_t* data);
/** /**
* @brief This function handles the housekeeping report. This means verifying the CRC of the * @brief This function handles the housekeeping report. This means verifying the CRC of the
* reply and filling the appropriate dataset. * reply and filling the appropriate dataset.
* *
* @param data Pointer to the data buffer holding the housekeeping read report. * @param data Pointer to the data buffer holding the housekeeping read report.
* *
* @return RETURN_OK if successful, otherwise an error code. * @return RETURN_OK if successful, otherwise an error code.
*/ */
ReturnValue_t handleHkReport(const uint8_t* data); ReturnValue_t handleHkReport(const uint8_t* data);
/** /**
* @brief This function calls the function to check the CRC of the received boot status report * @brief This function calls the function to check the CRC of the received boot status report
* and fills the associated dataset with the boot status information. * and fills the associated dataset with the boot status information.
*/ */
ReturnValue_t handleBootStatusReport(const uint8_t* data); ReturnValue_t handleBootStatusReport(const uint8_t* data);
ReturnValue_t handleLatchupStatusReport(const uint8_t* data); ReturnValue_t handleLatchupStatusReport(const uint8_t* data);
/** /**
* @brief Depending on the current active command, this function sets the reply id of the * @brief Depending on the current active command, this function sets the reply id of the
* next reply after a successful acknowledgment report has been received. This is * next reply after a successful acknowledgment report has been received. This is
* required by the function getNextReplyLength() to identify the length of the next * required by the function getNextReplyLength() to identify the length of the next
* reply to read. * reply to read.
*/ */
void setNextReplyId(); void setNextReplyId();
/** /**
* @brief This function handles action message replies in case the telemetry has been * @brief This function handles action message replies in case the telemetry has been
* requested by another object. * requested by another object.
* *
* @param data Pointer to the telemetry data. * @param data Pointer to the telemetry data.
* @param dataSize Size of telemetry in bytes. * @param dataSize Size of telemetry in bytes.
* @param replyId Id of the reply. This will be added to the ActionMessage. * @param replyId Id of the reply. This will be added to the ActionMessage.
*/ */
void handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId); void handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId);
/** /**
* @brief This function prepares a space packet which does not transport any data in the * @brief This function prepares a space packet which does not transport any data in the
* packet data field apart from the crc. * packet data field apart from the crc.
*/ */
void prepareEmptyCmd(uint16_t apid); void prepareEmptyCmd(uint16_t apid);
/** /**
* @brief This function initializes the space packet to select the boot image of the MPSoC. * @brief This function initializes the space packet to select the boot image of the MPSoC.
*/ */
void prepareSelBootImageCmd(const uint8_t * commandData); void prepareSelBootImageCmd(const uint8_t* commandData);
void prepareDisableHk(); void prepareDisableHk();
/** /**
* @brief This function fills the commandBuffer with the data to update the time of the * @brief This function fills the commandBuffer with the data to update the time of the
* PLOC supervisor. * PLOC supervisor.
*/ */
ReturnValue_t prepareSetTimeRefCmd(); ReturnValue_t prepareSetTimeRefCmd();
/** /**
* @brief This function fills the commandBuffer with the data to change the boot timeout * @brief This function fills the commandBuffer with the data to change the boot timeout
* value in the PLOC supervisor. * value in the PLOC supervisor.
*/ */
void prepareSetBootTimeoutCmd(const uint8_t * commandData); void prepareSetBootTimeoutCmd(const uint8_t* commandData);
void prepareRestartTriesCmd(const uint8_t * commandData); void prepareRestartTriesCmd(const uint8_t* commandData);
/** /**
* @brief This function fills the command buffer with the packet to enable or disable the * @brief This function fills the command buffer with the packet to enable or disable the
* watchdogs on the PLOC. * watchdogs on the PLOC.
*/ */
void prepareWatchdogsEnableCmd(const uint8_t * commandData); void prepareWatchdogsEnableCmd(const uint8_t* commandData);
/** /**
* @brief This function fills the command buffer with the packet to set the watchdog timer * @brief This function fills the command buffer with the packet to set the watchdog timer
* of one of the three watchdogs (PS, PL, INT). * of one of the three watchdogs (PS, PL, INT).
*/ */
ReturnValue_t prepareWatchdogsConfigTimeoutCmd(const uint8_t * commandData); ReturnValue_t prepareWatchdogsConfigTimeoutCmd(const uint8_t* commandData);
ReturnValue_t prepareLatchupConfigCmd(const uint8_t* commandData, ReturnValue_t prepareLatchupConfigCmd(const uint8_t* commandData,
DeviceCommandId_t deviceCommand); DeviceCommandId_t deviceCommand);
ReturnValue_t prepareAutoCalibrateAlertCmd(const uint8_t* commandData); ReturnValue_t prepareAutoCalibrateAlertCmd(const uint8_t* commandData);
ReturnValue_t prepareSetAlertLimitCmd(const uint8_t* commandData); ReturnValue_t prepareSetAlertLimitCmd(const uint8_t* commandData);
ReturnValue_t prepareSetAlertIrqFilterCmd(const uint8_t* commandData); ReturnValue_t prepareSetAlertIrqFilterCmd(const uint8_t* commandData);
ReturnValue_t prepareSetAdcSweetPeriodCmd(const uint8_t* commandData); ReturnValue_t prepareSetAdcSweetPeriodCmd(const uint8_t* commandData);
void prepareSetAdcEnabledChannelsCmd(const uint8_t* commandData); void prepareSetAdcEnabledChannelsCmd(const uint8_t* commandData);
void prepareSetAdcWindowAndStrideCmd(const uint8_t* commandData); void prepareSetAdcWindowAndStrideCmd(const uint8_t* commandData);
void prepareSetAdcThresholdCmd(const uint8_t* commandData); void prepareSetAdcThresholdCmd(const uint8_t* commandData);
void prepareEnableNvmsCmd(const uint8_t* commandData); void prepareEnableNvmsCmd(const uint8_t* commandData);
void prepareSelectNvmCmd(const uint8_t* commandData); void prepareSelectNvmCmd(const uint8_t* commandData);
ReturnValue_t prepareRunAutoEmTest(const uint8_t* commandData); ReturnValue_t prepareRunAutoEmTest(const uint8_t* commandData);
ReturnValue_t prepareWipeMramCmd(const uint8_t* commandData); ReturnValue_t prepareWipeMramCmd(const uint8_t* commandData);
ReturnValue_t prepareDumpMramCmd(const uint8_t* commandData); ReturnValue_t prepareDumpMramCmd(const uint8_t* commandData);
void preparePrintCpuStatsCmd(const uint8_t* commandData); void preparePrintCpuStatsCmd(const uint8_t* commandData);
void prepareSetDbgVerbosityCmd(const uint8_t* commandData); void prepareSetDbgVerbosityCmd(const uint8_t* commandData);
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.
*/
void packetToOutBuffer(uint8_t* packetData, size_t fullSize);
/** /**
* @brief Copies the content of a space packet to the command buffer. * @brief In case an acknowledgment failure reply has been received this function disables
*/ * all previously enabled commands and resets the exepected replies variable of an
void packetToOutBuffer(uint8_t* packetData, size_t fullSize); * active command.
*/
void disableAllReplies();
/** /**
* @brief In case an acknowledgment failure reply has been received this function disables * @brief This function sends a failure report if the active action was commanded by an other
* all previously enabled commands and resets the exepected replies variable of an * object.
* active command. *
*/ * @param replyId The id of the reply which signals a failure.
void disableAllReplies(); * @param status A status byte which gives information about the failure type.
*/
void sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status);
/** /**
* @brief This function sends a failure report if the active action was commanded by an other * @brief This function disables the execution report reply. Within this function also the
* object. * the variable expectedReplies of an active command will be set to 0.
* */
* @param replyId The id of the reply which signals a failure. void disableExeReportReply();
* @param status A status byte which gives information about the failure type.
*/
void sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status);
/** /**
* @brief This function disables the execution report reply. Within this function also the * @brief Function is called in scanForReply and fills the spacePacketBuffer with the read
* the variable expectedReplies of an active command will be set to 0. * data until a full packet has been received.
*/ */
void disableExeReportReply(); ReturnValue_t parseMramPackets(const uint8_t* packet, size_t remainingSize, size_t* foundlen);
/** /**
* @brief Function is called in scanForReply and fills the spacePacketBuffer with the read * @brief This function generates the Service 8 packets for the MRAM dump data.
* data until a full packet has been received. */
*/ ReturnValue_t handleMramDumpPacket(DeviceCommandId_t id);
ReturnValue_t parseMramPackets(const uint8_t *packet, size_t remainingSize, size_t* foundlen);
/** /**
* @brief This function generates the Service 8 packets for the MRAM dump data. * @brief With this function the number of expected replies following an MRAM dump command
*/ * will be increased. This is necessary to release the command in case not all replies
ReturnValue_t handleMramDumpPacket(DeviceCommandId_t id); * have been received.
*/
void increaseExpectedMramReplies(DeviceCommandId_t id);
/** /**
* @brief With this function the number of expected replies following an MRAM dump command * @brief Function checks if the packet written to the space packet buffer is really a
* will be increased. This is necessary to release the command in case not all replies * MRAM dump packet.
* have been received. */
*/ ReturnValue_t checkMramPacketApid();
void increaseExpectedMramReplies(DeviceCommandId_t id);
/** /**
* @brief Function checks if the packet written to the space packet buffer is really a * @brief Writes the data of the MRAM dump to a file. The file will be created when receiving
* MRAM dump packet. * the first packet.
*/ */
ReturnValue_t checkMramPacketApid(); ReturnValue_t handleMramDumpFile(DeviceCommandId_t id);
/** /**
* @brief Writes the data of the MRAM dump to a file. The file will be created when receiving * @brief Extracts the length field of a spacePacket referenced by the spacePacket pointer.
* the first packet. *
*/ * @param spacePacket Pointer to the buffer holding the space packet.
ReturnValue_t handleMramDumpFile(DeviceCommandId_t id); *
* @return The value stored in the length field of the data field.
*/
uint16_t readSpacePacketLength(uint8_t* spacePacket);
/** /**
* @brief Extracts the length field of a spacePacket referenced by the spacePacket pointer. * @brief Extracts the sequence flags from a space packet referenced by the spacePacket
* * pointer.
* @param spacePacket Pointer to the buffer holding the space packet. *
* * @param spacePacket Pointer to the buffer holding the space packet.
* @return The value stored in the length field of the data field. *
*/ * @return uint8_t where the two least significant bits hold the sequence flags.
uint16_t readSpacePacketLength(uint8_t* spacePacket); */
uint8_t readSequenceFlags(uint8_t* spacePacket);
/** ReturnValue_t createMramDumpFile();
* @brief Extracts the sequence flags from a space packet referenced by the spacePacket ReturnValue_t getTimeStampString(std::string& timeStamp);
* pointer.
*
* @param spacePacket Pointer to the buffer holding the space packet.
*
* @return uint8_t where the two least significant bits hold the sequence flags.
*/
uint8_t readSequenceFlags(uint8_t* spacePacket);
ReturnValue_t createMramDumpFile();
ReturnValue_t getTimeStampString(std::string& timeStamp);
}; };
#endif /* MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_ */ #endif /* MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_ */

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
@ -103,7 +112,7 @@ void ObjectFactory::produceGenericObjects() {
sif::info << "Created TCP server for TMTC commanding with listener port " sif::info << "Created TCP server for TMTC commanding with listener port "
<< tcpServer->getTcpPort() << std::endl; << tcpServer->getTcpPort() << std::endl;
#if TCP_SERVER_WIRETAPPING == 1 #if TCP_SERVER_WIRETAPPING == 1
tcpServer->enableWiretapping(true); tcpServer->enableWiretapping(true);
#endif /* TCP_SERVER_WIRETAPPING == 1 */ #endif /* TCP_SERVER_WIRETAPPING == 1 */
#endif /* OBSW_USE_TMTC_TCP_BRIDGE == 0 */ #endif /* OBSW_USE_TMTC_TCP_BRIDGE == 0 */
tmtcBridge->setMaxNumberOfPacketsStored(70); tmtcBridge->setMaxNumberOfPacketsStored(70);

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_ */