v1.10.0 #220

Merged
meierj merged 592 commits from develop into main 2022-04-22 07:42:20 +02:00
218 changed files with 10878 additions and 6525 deletions

26
CHANGELOG.md Normal file
View File

@ -0,0 +1,26 @@
Change Log
=======
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
The [milestone](https://egit.irs.uni-stuttgart.de/eive/eive-obsw/milestones)
list yields a list of all related PRs for each release.
# [unreleased]
# [v1.11.0]
## Changed
- Update rootfs base of Linux, all related OBSW changes
- Use gpsd version 3.17 now. Includes API changes
- Add `/usr/local/bin` to PATH. All shell scripts are there now
- Rename GPS device to `/dev/gps0`
# [v1.10.0]
For all releases equal or prior to v1.10.0,
see [milestones](https://egit.irs.uni-stuttgart.de/eive/eive-obsw/milestones)

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_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)
set(FSFW_OSAL linux CACHE STRING "OS for the FSFW.")
endif()
@ -37,8 +40,12 @@ endif()
include(${CMAKE_SCRIPT_PATH}/PreProjectConfig.cmake)
pre_project_config()
# Check whether the user has already installed Catch2 first. This has to come before
# the project call. We could also exlcude doing this when the Q7S primary OBSW is built..
find_package(Catch2 3 CONFIG QUIET)
# Project Name
project(eive-obsw ASM C CXX)
project(eive-obsw)
################################################################################
# Pre-Sources preparation
@ -67,7 +74,7 @@ set(LIB_JSON_NAME nlohmann_json::nlohmann_json)
# Set path names
set(FSFW_PATH fsfw)
set(TEST_PATH test/testtasks)
set(TEST_PATH test)
set(UNITTEST_PATH unittest)
set(LINUX_PATH linux)
set(COMMON_PATH common)
@ -93,7 +100,8 @@ pre_source_hw_os_config()
if(TGT_BSP)
if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/raspberrypi"
OR TGT_BSP MATCHES "arm/beagleboneblack" OR TGT_BSP MATCHES "arm/egse"
OR TGT_BSP MATCHES "arm/beagleboneblack" OR TGT_BSP MATCHES "arm/egse"
OR TGT_BSP MATCHES "arm/te0720-1cfa"
)
set(FSFW_CONFIG_PATH "linux/fsfwconfig")
if(NOT BUILD_Q7S_SIMPLE_MODE)
@ -113,6 +121,8 @@ if(TGT_BSP)
# Used by configure file
set(EGSE ON)
set(FSFW_HAL_LINUX_ADD_LIBGPIOD OFF)
set(OBSW_ADD_STAR_TRACKER 1)
set(OBSW_DEBUG_STARTRACKER 1)
endif()
if(TGT_BSP MATCHES "arm/beagleboneblack")
@ -124,6 +134,10 @@ if(TGT_BSP)
# Used by configure file
set(XIPHOS_Q7S ON)
endif()
if(TGT_BSP MATCHES "arm/te0720-1cfa")
set(TE0720_1CFA ON)
endif()
else()
# Required by FSFW library
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
@ -150,9 +164,6 @@ set(FSFW_ADDITIONAL_INC_PATHS
${CMAKE_CURRENT_BINARY_DIR}
)
# Check whether the user has already installed Catch2 first
find_package(Catch2 3)
################################################################################
# Executable and Sources
################################################################################
@ -199,8 +210,10 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(COMPILER_FLAGS "/permissive-")
endif()
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
if(NOT Catch2_FOUND)
message(STATUS "Did not find a valid Catch2 installation. Using FetchContent to install it")
include(FetchContent)
FetchContent_Declare(
@ -215,7 +228,7 @@ if(NOT Catch2_FOUND)
set_target_properties(Catch2 PROPERTIES EXCLUDE_FROM_ALL "true")
set_target_properties(Catch2WithMain PROPERTIES EXCLUDE_FROM_ALL "true")
endif()
endif()
add_library(${LIB_EIVE_MISSION})

View File

@ -385,20 +385,7 @@ more recent disitributions anymore.
## <a id="arm-toolchain"></a> Installing toolchain without Vivado
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).
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
```
[from the EIVE cloud](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/tools).
## Installing CMake and MSYS2 on Windows

View File

@ -8,13 +8,13 @@ using gpioId_t = uint16_t;
namespace gpio {
enum Levels { LOW = 0, HIGH = 1 };
enum class Levels : uint8_t { LOW = 0, HIGH = 1 };
enum Direction { IN = 0, OUT = 1 };
enum class Direction : uint8_t { IN = 0, OUT = 1 };
enum GpioOperation { READ, WRITE };
enum class GpioOperation { READ, WRITE };
enum GpioTypes { NONE, GPIOD_REGULAR, CALLBACK };
enum class GpioTypes { NONE, GPIOD_REGULAR, CALLBACK };
static constexpr gpioId_t NO_GPIO = -1;
} // namespace gpio

View File

@ -16,5 +16,5 @@ RUN mkdir -p /usr/tools; \
curl https://buggy.irs.uni-stuttgart.de/eive/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.gz \
| tar -xz -C /usr/tools
ENV Q7S_SYSROOT="/usr/rootfs/cortexa9hf-neon-xiphos-linux-gnueabi"
ENV PATH=$PATH:"/usr/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin"
ENV ZYNQ_7020_SYSROOT="/usr/rootfs/cortexa9hf-neon-xiphos-linux-gnueabi"
ENV PATH=$PATH:"/usr/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin"

View File

@ -5,7 +5,7 @@ pipeline {
}
agent {
docker {
image 'eive-obsw-ci:d2'
image 'eive-obsw-ci:d3'
args '--sysctl fs.mqueue.msg_max=100'
}
}

View File

@ -3,7 +3,6 @@
#include <devConf.h>
#include <fsfw_hal/linux/uart/UartComIF.h>
#include <fsfw_hal/linux/uart/UartCookie.h>
#include <mission/devices/GPSHyperionHandler.h>
#include "OBSWConfig.h"
#include "busConf.h"

View File

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

View File

@ -1,57 +0,0 @@
#ifndef FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_
#define FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_
#include <OBSWConfig.h>
namespace pcduSwitches {
/* Switches are uint8_t datatype and go from 0 to 255 */
enum SwitcherList {
Q7S,
PAYLOAD_PCDU_CH1,
RW,
TCS_BOARD_8V_HEATER_IN,
SUS_REDUNDANT,
DEPLOYMENT_MECHANISM,
PAYLOAD_PCDU_CH6,
ACS_BOARD_SIDE_B,
PAYLOAD_CAMERA,
TCS_BOARD_3V3,
SYRLINKS,
STAR_TRACKER,
MGT,
SUS_NOMINAL,
SOLAR_CELL_EXP,
PLOC,
ACS_BOARD_SIDE_A,
NUMBER_OF_SWITCHES
};
static const uint8_t ON = 1;
static const uint8_t OFF = 0;
/* Output states after reboot of the PDUs */
static const uint8_t INIT_STATE_Q7S = ON;
static const uint8_t INIT_STATE_PAYLOAD_PCDU_CH1 = OFF;
static const uint8_t INIT_STATE_RW = OFF;
#if BOARD_TE0720 == 1
/* Because the TE0720 is not connected to the PCDU, this switch is always on */
static const uint8_t INIT_STATE_TCS_BOARD_8V_HEATER_IN = ON;
#else
static const uint8_t INIT_STATE_TCS_BOARD_8V_HEATER_IN = OFF;
#endif
static const uint8_t INIT_STATE_SUS_REDUNDANT = OFF;
static const uint8_t INIT_STATE_DEPLOYMENT_MECHANISM = OFF;
static const uint8_t INIT_STATE_PAYLOAD_PCDU_CH6 = OFF;
static const uint8_t INIT_STATE_ACS_BOARD_SIDE_B = OFF;
static const uint8_t INIT_STATE_PAYLOAD_CAMERA = OFF;
static const uint8_t INIT_STATE_TCS_BOARD_3V3 = OFF;
static const uint8_t INIT_STATE_SYRLINKS = OFF;
static const uint8_t INIT_STATE_STAR_TRACKER = OFF;
static const uint8_t INIT_STATE_MGT = OFF;
static const uint8_t INIT_STATE_SUS_NOMINAL = OFF;
static const uint8_t INIT_STATE_SOLAR_CELL_EXP = OFF;
static const uint8_t INIT_STATE_PLOC = OFF;
static const uint8_t INIT_STATE_ACS_BOARD_SIDE_A = OFF;
} // namespace pcduSwitches
#endif /* FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ */

View File

@ -1,6 +1,7 @@
target_sources(${OBSW_NAME} PUBLIC
InitMission.cpp
main.cpp
gpioInit.cpp
ObjectFactory.cpp
)

View File

@ -192,7 +192,7 @@ void initmission::createPstTasks(TaskFactory& factory,
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
#if OBSW_ADD_SPI_TEST_CODE == 0
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
"SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
"SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
result = pst::pstSpi(spiPst);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;

View File

@ -5,10 +5,13 @@
#include "devices/addresses.h"
#include "devices/gpioIds.h"
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
#include "fsfw/power/DummyPowerSwitcher.h"
#include "fsfw/tasks/TaskFactory.h"
#include "fsfw/tmtcpacket/pus/tm.h"
#include "fsfw/tmtcservices/CommandingServiceBase.h"
#include "fsfw/tmtcservices/PusServiceBase.h"
#include "gpioInit.h"
#include "linux/ObjectFactory.h"
#include "linux/boardtest/LibgpiodTest.h"
#include "linux/boardtest/SpiTestClass.h"
#include "linux/boardtest/UartTestClass.h"
@ -64,37 +67,55 @@ void ObjectFactory::produce(void* args) {
GpioCookie* gpioCookie = nullptr;
static_cast<void>(gpioCookie);
new SpiComIF(objects::SPI_COM_IF, gpioIF);
SpiComIF* spiComIF = new SpiComIF(objects::SPI_COM_IF, gpioIF);
static_cast<void>(spiComIF);
auto pwrSwitcher = new DummyPowerSwitcher(objects::PCDU_HANDLER, 18, 0);
static_cast<void>(pwrSwitcher);
std::string spiDev;
SpiCookie* spiCookie = nullptr;
static_cast<void>(spiCookie);
#if OBSW_ADD_ACS_BOARD == 1 && defined(RASPBERRY_PI)
createRpiAcsBoard(gpioIF, spiDev);
#endif
#if OBSW_ADD_ACS_BOARD == 1
if (gpioCookie == nullptr) {
gpioCookie = new GpioCookie();
}
#if OBSW_ADD_SUN_SENSORS == 1 || defined(OBSW_ADD_RTD_DEVICES)
#ifdef RASPBERRY_PI
rpi::gpio::initSpiCsDecoder(gpioIF);
#endif
#endif
#if OBSW_ADD_SUN_SENSORS == 1
createSunSensorComponents(gpioIF, spiComIF, pwrSwitcher, spi::DEV);
#endif
#if OBSW_ADD_RTD_DEVICES == 1
createRtdComponents(spi::DEV, gpioIF, pwrSwitcher);
#endif
#if OBSW_ADD_TEST_CODE == 1
createTestTasks();
#endif /* OBSW_ADD_TEST_CODE == 1 */
}
void ObjectFactory::createRpiAcsBoard(GpioIF* gpioIF, std::string spiDev) {
GpioCookie* gpioCookie = new GpioCookie();
// TODO: Missing pin for Gyro 2
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN, "MGM_0_LIS3",
gpio::Direction::OUT, 1);
gpio::Direction::OUT, gpio::Levels::HIGH);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN,
"MGM_1_RM3100", gpio::Direction::OUT, 1);
"MGM_1_RM3100", gpio::Direction::OUT, gpio::Levels::HIGH);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN, "MGM_2_LIS3",
gpio::Direction::OUT, 1);
gpio::Direction::OUT, gpio::Levels::HIGH);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN,
"MGM_3_RM3100", gpio::Direction::OUT, 1);
"MGM_3_RM3100", gpio::Direction::OUT, gpio::Levels::HIGH);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN,
"GYRO_0_ADIS", gpio::Direction::OUT, 1);
"GYRO_0_ADIS", gpio::Direction::OUT, gpio::Levels::HIGH);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN, "GYRO_1_L3G",
gpio::Direction::OUT, 1);
gpio::Direction::OUT, gpio::Levels::HIGH);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_2_ADIS_CS, gpio::GYRO_2_BCM_PIN,
"GYRO_2_ADIS", gpio::Direction::OUT, 1);
"GYRO_2_ADIS", gpio::Direction::OUT, gpio::Levels::HIGH);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_3_BCM_PIN, "GYRO_3_L3G",
gpio::Direction::OUT, 1);
gpio::Direction::OUT, gpio::Levels::HIGH);
gpioIF->addGpios(gpioCookie);
spiDev = "/dev/spidev0.1";
spiCookie =
SpiCookie* spiCookie =
new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev,
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
auto mgmLis3Handler =
@ -136,9 +157,9 @@ void ObjectFactory::produce(void* args) {
spiCookie =
new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
auto adisHandler =
new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
ADIS1650X::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
auto adisHandler = new GyroADIS1650XHandler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF,
spiCookie, ADIS1650X::Type::ADIS16505);
adisHandler->setStartUpImmediately();
spiCookie =
new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE,
@ -152,9 +173,9 @@ void ObjectFactory::produce(void* args) {
spiCookie =
new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev,
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
adisHandler =
new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
ADIS1650X::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
adisHandler = new GyroADIS1650XHandler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF,
spiCookie, ADIS1650X::Type::ADIS16505);
adisHandler->setStartUpImmediately();
spiCookie =
@ -166,12 +187,6 @@ void ObjectFactory::produce(void* args) {
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
gyroL3gHandler->setToGoToNormalMode(true);
#endif
#endif /* RPI_TEST_ACS_BOARD == 1 */
#if OBSW_ADD_TEST_CODE == 1
createTestTasks();
#endif /* OBSW_ADD_TEST_CODE == 1 */
}
void ObjectFactory::createTestTasks() {

View File

@ -1,10 +1,15 @@
#ifndef BSP_LINUX_OBJECTFACTORY_H_
#define BSP_LINUX_OBJECTFACTORY_H_
#include <string>
class GpioIF;
namespace ObjectFactory {
void setStatics();
void produce(void* args);
void createRpiAcsBoard(GpioIF* gpioIF, std::string spiDev);
void createTestTasks();
}; // namespace ObjectFactory

View File

@ -17,16 +17,4 @@
#define RPI_ADD_UART_TEST 0
/* Adapt these values accordingly */
namespace gpio {
static constexpr uint8_t MGM_0_BCM_PIN = 17;
static constexpr uint8_t MGM_1_BCM_PIN = 27;
static constexpr uint8_t MGM_2_BCM_PIN = 22;
static constexpr uint8_t MGM_3_BCM_PIN = 23;
static constexpr uint8_t GYRO_0_BCM_PIN = 5;
static constexpr uint8_t GYRO_1_BCM_PIN = 6;
static constexpr uint8_t GYRO_2_BCM_PIN = 13;
static constexpr uint8_t GYRO_3_BCM_PIN = 19;
}
#endif /* BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_ */

View File

@ -0,0 +1,37 @@
#ifndef BSP_LINUX_BOARD_DEFINITIONS_H_
#define BSP_LINUX_BOARD_DEFINITIONS_H_
#include <cstdint>
#include "OBSWConfig.h"
#ifdef RASPBERRY_PI
namespace spi {
static constexpr char DEV[] = "/dev/spidev0.1";
}
/* Adapt these values accordingly */
namespace gpio {
static constexpr uint8_t MGM_0_BCM_PIN = 17;
static constexpr uint8_t MGM_1_BCM_PIN = 27;
static constexpr uint8_t MGM_2_BCM_PIN = 22;
static constexpr uint8_t MGM_3_BCM_PIN = 23;
static constexpr uint8_t GYRO_0_BCM_PIN = 5;
static constexpr uint8_t GYRO_1_BCM_PIN = 6;
static constexpr uint8_t GYRO_2_BCM_PIN = 13;
static constexpr uint8_t GYRO_3_BCM_PIN = 19;
static constexpr uint8_t SPI_MUX_0_BCM = 17;
static constexpr uint8_t SPI_MUX_1_BCM = 27;
static constexpr uint8_t SPI_MUX_2_BCM = 22;
static constexpr uint8_t SPI_MUX_3_BCM = 23;
static constexpr uint8_t SPI_MUX_4_BCM = 5;
static constexpr uint8_t SPI_MUX_5_BCM = 6;
} // namespace gpio
#endif
#endif /* BSP_LINUX_BOARD_DEFINITIONS_H_ */

View File

@ -0,0 +1,56 @@
#include "gpioInit.h"
#include <devices/gpioIds.h>
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <fsfw_hal/common/gpio/GpioCookie.h>
#include <fsfw_hal/common/gpio/GpioIF.h>
#include "definitions.h"
#include "fsfw_hal/linux/rpi/GpioRPi.h"
#ifdef RASPBERRY_PI
struct MuxInfo {
MuxInfo(gpioId_t gpioId, int bcmNum, std::string consumer)
: gpioId(gpioId), bcmNum(bcmNum), consumer(consumer) {}
gpioId_t gpioId;
int bcmNum;
std::string consumer;
};
void rpi::gpio::initSpiCsDecoder(GpioIF* gpioComIF) {
using namespace ::gpio;
ReturnValue_t result;
if (gpioComIF == nullptr) {
sif::debug << "initSpiCsDecoder: Invalid gpioComIF" << std::endl;
return;
}
std::array<::MuxInfo, 6> muxInfo{
MuxInfo(gpioIds::SPI_MUX_BIT_0, SPI_MUX_0_BCM, "SPI_MUX_0"),
MuxInfo(gpioIds::SPI_MUX_BIT_1, SPI_MUX_1_BCM, "SPI_MUX_1"),
MuxInfo(gpioIds::SPI_MUX_BIT_2, SPI_MUX_2_BCM, "SPI_MUX_2"),
MuxInfo(gpioIds::SPI_MUX_BIT_3, SPI_MUX_3_BCM, "SPI_MUX_3"),
MuxInfo(gpioIds::SPI_MUX_BIT_4, SPI_MUX_4_BCM, "SPI_MUX_4"),
MuxInfo(gpioIds::SPI_MUX_BIT_5, SPI_MUX_5_BCM, "SPI_MUX_5"),
};
GpioCookie* spiMuxGpios = new GpioCookie;
for (const auto& info : muxInfo) {
result = createRpiGpioConfig(spiMuxGpios, info.gpioId, info.bcmNum, info.consumer,
Direction::OUT, Levels::LOW);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Creating Raspberry Pi SPI Mux GPIO failed with code " << result << std::endl;
return;
}
}
result = gpioComIF->addGpios(spiMuxGpios);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl;
return;
}
}
#endif

View File

@ -0,0 +1,20 @@
#pragma once
#include "OBSWConfig.h"
class GpioIF;
#ifdef RASPBERRY_PI
namespace rpi {
namespace gpio {
/**
* @brief This function initializes the GPIOs used to control the SN74LVC138APWR decoders on
* the TCS Board and the interface board.
*/
void initSpiCsDecoder(GpioIF* gpioComIF);
} // namespace gpio
} // namespace rpi
#endif

View File

@ -3,8 +3,8 @@
#include "InitMission.h"
#include "OBSWConfig.h"
#include "OBSWVersion.h"
#include "fsfw/FSFWVersion.h"
#include "fsfw/tasks/TaskFactory.h"
#include "fsfw/version.h"
#ifdef 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 << "-- Compiled for Linux board " << BOARD_NAME << " --" << std::endl;
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION << "."
<< SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << FSFW_REVISION
<< "--" << std::endl;
<< SW_REVISION << ", FSFW v" << fsfw::FSFW_VERSION << " --" << std::endl;
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
initmission::initMission();

View File

@ -22,4 +22,4 @@ add_subdirectory(comIF)
add_subdirectory(core)
add_subdirectory(memory)
add_subdirectory(callbacks)
add_subdirectory(devices)
add_subdirectory(xadc)

View File

@ -84,6 +84,7 @@ static constexpr char RS485_EN_TX_DATA[] = "tx_data_enable_ltc2872";
static constexpr char RS485_EN_RX_CLOCK[] = "rx_clock_enable_ltc2872";
static constexpr char RS485_EN_RX_DATA[] = "rx_data_enable_ltc2872";
static constexpr char PDEC_RESET[] = "pdec_reset";
static constexpr char SYRLINKS_FAULT[] = "syrlinks_fault";
static constexpr char PL_PCDU_ENABLE_VBAT0[] = "enable_plpcdu_vbat0";
static constexpr char PL_PCDU_ENABLE_VBAT1[] = "enable_plpcdu_vbat1";
@ -94,6 +95,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_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 q7s

View File

@ -2,6 +2,7 @@
#include <bsp_q7s/core/CoreController.h>
#include <bsp_q7s/memory/FileSystemHandler.h>
#include <bsp_q7s/xadc/Xadc.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <gps.h>
#include <libgpsmm.h>
@ -23,6 +24,7 @@ Q7STestTask::Q7STestTask(object_id_t objectId) : TestTask(objectId) {
doTestSdCard = false;
doTestScratchApi = false;
doTestGps = false;
doTestXadc = true;
}
ReturnValue_t Q7STestTask::performOneShotAction() {
@ -44,6 +46,9 @@ ReturnValue_t Q7STestTask::performPeriodicAction() {
if (doTestGps) {
testGpsDaemon();
}
if (doTestXadc) {
xadcTest();
}
return TestTask::performPeriodicAction();
}
@ -395,3 +400,53 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
}
}
}
void Q7STestTask::xadcTest() {
ReturnValue_t result = RETURN_OK;
float temperature = 0;
float vccPint = 0;
float vccPaux = 0;
float vccInt = 0;
float vccAux = 0;
float vccBram = 0;
float vccOddr = 0;
float vrefp = 0;
float vrefn = 0;
Xadc xadc;
result = xadc.getTemperature(temperature);
if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Q7STestTask::xadcTest: Chip Temperature: " << temperature << " °C" << std::endl;
}
result = xadc.getVccPint(vccPint);
if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Q7STestTask::xadcTest: VCC PS internal: " << vccPint << " mV" << std::endl;
}
result = xadc.getVccPaux(vccPaux);
if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Q7STestTask::xadcTest: VCC PS auxilliary: " << vccPaux << " mV" << std::endl;
}
result = xadc.getVccInt(vccInt);
if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Q7STestTask::xadcTest: VCC PL internal: " << vccInt << " mV" << std::endl;
}
result = xadc.getVccAux(vccAux);
if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Q7STestTask::xadcTest: VCC PL auxilliary: " << vccAux << " mV" << std::endl;
}
result = xadc.getVccBram(vccBram);
if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Q7STestTask::xadcTest: VCC BRAM: " << vccBram << " mV" << std::endl;
}
result = xadc.getVccOddr(vccOddr);
if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Q7STestTask::xadcTest: VCC PS I/O DDR : " << vccOddr << " mV" << std::endl;
}
result = xadc.getVrefp(vrefp);
if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Q7STestTask::xadcTest: Vrefp : " << vrefp << " mV" << std::endl;
}
result = xadc.getVrefn(vrefn);
if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Q7STestTask::xadcTest: Vrefn : " << vrefn << " mV" << std::endl;
}
}

View File

@ -15,6 +15,7 @@ class Q7STestTask : public TestTask {
bool doTestSdCard = false;
bool doTestScratchApi = false;
bool doTestGps = false;
bool doTestXadc = false;
CoreController* coreController = nullptr;
ReturnValue_t performOneShotAction() override;
@ -24,6 +25,7 @@ class Q7STestTask : public TestTask {
void testSdCard();
void fileTests();
void xadcTest();
void testScratchApi();
void testJsonLibDirect();

View File

@ -2,5 +2,5 @@ target_sources(${OBSW_NAME} PRIVATE
rwSpiCallback.cpp
gnssCallback.cpp
pcduSwitchCb.cpp
gpioCallbacks.cpp
q7sGpioCallbacks.cpp
)

View File

@ -1,487 +0,0 @@
#include "gpioCallbacks.h"
#include <devices/gpioIds.h>
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <fsfw_hal/common/gpio/GpioCookie.h>
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
#include "busConf.h"
namespace gpioCallbacks {
GpioIF* gpioComInterface;
void initSpiCsDecoder(GpioIF* gpioComIF) {
using namespace gpio;
ReturnValue_t result;
if (gpioComIF == nullptr) {
sif::debug << "initSpiCsDecoder: Invalid gpioComIF" << std::endl;
return;
}
gpioComInterface = gpioComIF;
GpioCookie* spiMuxGpios = new GpioCookie;
GpiodRegularByLineName* spiMuxBit = nullptr;
/** Setting mux bit 1 to low will disable IC21 on the interface board */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_0_PIN, "SPI Mux Bit 1",
Direction::OUT, Levels::HIGH);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_0, spiMuxBit);
/** Setting mux bit 2 to low disables IC1 on the TCS board */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_1_PIN, "SPI Mux Bit 2",
Direction::OUT, Levels::HIGH);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit);
/** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 3",
Direction::OUT, Levels::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit);
/** The following gpios can take arbitrary initial values */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 4",
Direction::OUT, Levels::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_4_PIN, "SPI Mux Bit 5",
Direction::OUT, Levels::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_5_PIN, "SPI Mux Bit 6",
Direction::OUT, Levels::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit);
GpiodRegularByLineName* enRwDecoder = new GpiodRegularByLineName(
q7s::gpioNames::EN_RW_CS, "EN_RW_CS", Direction::OUT, Levels::HIGH);
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
result = gpioComInterface->addGpios(spiMuxGpios);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl;
return;
}
}
void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Levels value,
void* args) {
using namespace gpio;
if (gpioComInterface == nullptr) {
sif::debug << "spiCsDecoderCallback: No gpioComIF specified. Call initSpiCsDecoder "
<< "to specify gpioComIF" << std::endl;
return;
}
/* Reading is not supported by the callback function */
if (gpioOp == gpio::GpioOperation::READ) {
return;
}
if (value == Levels::HIGH) {
switch (gpioId) {
case (gpioIds::RTD_IC_3): {
disableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_4): {
disableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_5): {
disableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_6): {
disableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_7): {
disableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_8): {
disableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_9): {
disableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_10): {
disableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_11): {
disableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_12): {
disableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_13): {
disableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_14): {
disableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_15): {
disableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_16): {
disableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_17): {
disableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_18): {
disableDecoderTcsIc2();
break;
}
case (gpioIds::CS_SUS_0): {
disableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_1): {
disableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_2): {
disableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_3): {
disableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_4): {
disableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_5): {
disableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_6): {
disableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_7): {
disableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_8): {
disableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_9): {
disableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_10): {
disableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_11): {
disableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_RW1): {
disableRwDecoder();
break;
}
case (gpioIds::CS_RW2): {
disableRwDecoder();
break;
}
case (gpioIds::CS_RW3): {
disableRwDecoder();
break;
}
case (gpioIds::CS_RW4): {
disableRwDecoder();
break;
}
default:
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
}
} else if (value == Levels::LOW) {
switch (gpioId) {
case (gpioIds::RTD_IC_3): {
selectY7();
enableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_4): {
selectY6();
enableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_5): {
selectY5();
enableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_6): {
selectY4();
enableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_7): {
selectY3();
enableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_8): {
selectY2();
enableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_9): {
selectY1();
enableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_10): {
selectY0();
enableDecoderTcsIc1();
break;
}
case (gpioIds::RTD_IC_11): {
selectY7();
enableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_12): {
selectY6();
enableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_13): {
selectY5();
enableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_14): {
selectY4();
enableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_15): {
selectY3();
enableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_16): {
selectY2();
enableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_17): {
selectY1();
enableDecoderTcsIc2();
break;
}
case (gpioIds::RTD_IC_18): {
selectY0();
enableDecoderTcsIc2();
break;
}
case (gpioIds::CS_SUS_0): {
selectY0();
enableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_1): {
selectY1();
enableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_2): {
selectY2();
enableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_3): {
selectY3();
enableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_4): {
selectY4();
enableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_5): {
selectY5();
enableDecoderInterfaceBoardIc1();
break;
}
case (gpioIds::CS_SUS_6): {
selectY0();
enableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_7): {
selectY1();
enableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_8): {
selectY2();
enableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_9): {
selectY3();
enableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_10): {
selectY4();
enableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_SUS_11): {
selectY5();
enableDecoderInterfaceBoardIc2();
break;
}
case (gpioIds::CS_RW1): {
selectY0();
enableRwDecoder();
break;
}
case (gpioIds::CS_RW2): {
selectY1();
enableRwDecoder();
break;
}
case (gpioIds::CS_RW3): {
selectY2();
enableRwDecoder();
break;
}
case (gpioIds::CS_RW4): {
selectY3();
enableRwDecoder();
break;
}
default:
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
}
} else {
sif::debug << "spiCsDecoderCallback: Invalid value. Must be 0 or 1" << std::endl;
}
}
void enableDecoderTcsIc1() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void enableDecoderTcsIc2() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
}
void enableDecoderInterfaceBoardIc1() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void enableDecoderInterfaceBoardIc2() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
}
void disableDecoderTcsIc1() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void disableDecoderTcsIc2() {
// DO NOT CHANGE THE ORDER HERE
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
}
void disableDecoderInterfaceBoardIc1() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void disableDecoderInterfaceBoardIc2() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void enableRwDecoder() { gpioComInterface->pullHigh(gpioIds::EN_RW_CS); }
void disableRwDecoder() { gpioComInterface->pullLow(gpioIds::EN_RW_CS); }
void selectY0() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
}
void selectY1() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
}
void selectY2() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
}
void selectY3() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
}
void selectY4() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
}
void selectY5() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
}
void selectY6() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
}
void selectY7() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
}
void disableAllDecoder() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_0);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::EN_RW_CS);
}
} // namespace gpioCallbacks

View File

@ -10,8 +10,8 @@ void pcdu::switchCallback(GOMSPACE::Pdu pdu, uint8_t channel, bool state, void*
return;
}
if (pdu == GOMSPACE::Pdu::PDU1) {
PDU1::SwitchChannels typedChannel = static_cast<PDU1::SwitchChannels>(channel);
if (typedChannel == PDU1::SwitchChannels::ACS_A_SIDE) {
PDU1::Channels typedChannel = static_cast<PDU1::Channels>(channel);
if (typedChannel == PDU1::Channels::ACS_A_SIDE) {
if (state) {
gpioComIF->pullHigh(gpioIds::GNSS_0_NRESET);
} else {
@ -20,8 +20,8 @@ void pcdu::switchCallback(GOMSPACE::Pdu pdu, uint8_t channel, bool state, void*
}
} else if (pdu == GOMSPACE::Pdu::PDU2) {
PDU2::SwitchChannels typedChannel = static_cast<PDU2::SwitchChannels>(channel);
if (typedChannel == PDU2::SwitchChannels::ACS_B_SIDE) {
PDU2::Channels typedChannel = static_cast<PDU2::Channels>(channel);
if (typedChannel == PDU2::Channels::ACS_B_SIDE) {
if (state) {
gpioComIF->pullHigh(gpioIds::GNSS_1_NRESET);
} else {

View File

@ -0,0 +1,54 @@
#include "q7sGpioCallbacks.h"
#include <devices/gpioIds.h>
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <fsfw_hal/common/gpio/GpioCookie.h>
#include <fsfw_hal/common/gpio/GpioIF.h>
#include "busConf.h"
void q7s::gpioCallbacks::initSpiCsDecoder(GpioIF* gpioComIF) {
using namespace gpio;
ReturnValue_t result;
if (gpioComIF == nullptr) {
sif::debug << "initSpiCsDecoder: Invalid gpioComIF" << std::endl;
return;
}
GpioCookie* spiMuxGpios = new GpioCookie;
GpiodRegularByLineName* spiMuxBit = nullptr;
/** Setting mux bit 1 to low will disable IC21 on the interface board */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_0_PIN, "SPI Mux Bit 1",
Direction::OUT, Levels::HIGH);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_0, spiMuxBit);
/** Setting mux bit 2 to low disables IC1 on the TCS board */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_1_PIN, "SPI Mux Bit 2",
Direction::OUT, Levels::HIGH);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit);
/** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 3",
Direction::OUT, Levels::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit);
/** The following gpios can take arbitrary initial values */
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 4",
Direction::OUT, Levels::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_4_PIN, "SPI Mux Bit 5",
Direction::OUT, Levels::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_5_PIN, "SPI Mux Bit 6",
Direction::OUT, Levels::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit);
GpiodRegularByLineName* enRwDecoder = new GpiodRegularByLineName(
q7s::gpioNames::EN_RW_CS, "EN_RW_CS", Direction::OUT, Levels::HIGH);
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
result = gpioComIF->addGpios(spiMuxGpios);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl;
return;
}
}

View File

@ -0,0 +1,15 @@
#pragma once
class GpioIF;
namespace q7s {
namespace gpioCallbacks {
/**
* @brief This function initializes the GPIOs used to control the SN74LVC138APWR decoders on
* the TCS Board and the interface board.
*/
void initSpiCsDecoder(GpioIF* gpioComIF);
} // namespace gpioCallbacks
} // namespace q7s

View File

@ -1,32 +1,35 @@
#include "CoreController.h"
#include <fsfw/events/EventManager.h>
#include <fsfw/ipc/QueueFactory.h>
#include "OBSWConfig.h"
#include "OBSWVersion.h"
#include "fsfw/FSFWVersion.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/timemanager/Stopwatch.h"
#include "watchdogConf.h"
#include "fsfw/version.h"
#include "watchdog/definitions.h"
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
#include "fsfw/osal/common/UdpTmTcBridge.h"
#else
#include "fsfw/osal/common/TcpTmTcServer.h"
#endif
#include <fcntl.h>
#include <unistd.h>
#include <algorithm>
#include <filesystem>
#include "bsp_q7s/memory/SdCardManager.h"
#include "bsp_q7s/memory/scratchApi.h"
#include "bsp_q7s/xadc/Xadc.h"
#include "linux/utility/utility.h"
xsc::Chip CoreController::CURRENT_CHIP = xsc::Chip::NO_CHIP;
xsc::Copy CoreController::CURRENT_COPY = xsc::Copy::NO_COPY;
CoreController::CoreController(object_id_t objectId)
: ExtendedControllerBase(objectId, objects::NO_OBJECT, 5), opDivider(5) {
: ExtendedControllerBase(objectId, objects::NO_OBJECT, 5), opDivider(5), hkSet(this) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
try {
result = initWatchdogFifo();
@ -50,6 +53,7 @@ CoreController::CoreController(object_id_t objectId)
} catch (const std::filesystem::filesystem_error &e) {
sif::error << "CoreController::CoreController: Failed with exception " << e.what() << std::endl;
}
eventQueue = QueueFactory::instance()->createMessageQueue(5, EventMessage::MAX_MESSAGE_SIZE);
}
ReturnValue_t CoreController::handleCommandMessage(CommandMessage *message) {
@ -57,21 +61,42 @@ ReturnValue_t CoreController::handleCommandMessage(CommandMessage *message) {
}
void CoreController::performControlOperation() {
EventMessage event;
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == RETURN_OK;
result = eventQueue->receiveMessage(&event)) {
switch (event.getEvent()) {
case (GpsHyperion::GPS_FIX_CHANGE): {
gpsFix = static_cast<GpsHyperion::FixMode>(event.getParameter2());
break;
}
}
}
performWatchdogControlOperation();
sdStateMachine();
performMountedSdCardOperations();
readHkData();
}
ReturnValue_t CoreController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(core::TEMPERATURE, new PoolEntry<float>({0}));
localDataPoolMap.emplace(core::PS_VOLTAGE, new PoolEntry<float>({0}));
localDataPoolMap.emplace(core::PL_VOLTAGE, new PoolEntry<float>({0}));
return HasReturnvaluesIF::RETURN_OK;
}
LocalPoolDataSetBase *CoreController::getDataSetHandle(sid_t sid) { return nullptr; }
LocalPoolDataSetBase *CoreController::getDataSetHandle(sid_t sid) {
if (sid.ownerSetId == core::HK_SET_ID) {
return &hkSet;
}
return nullptr;
}
ReturnValue_t CoreController::initialize() {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = ExtendedControllerBase::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "CoreController::initialize: Base init failed" << std::endl;
}
result = scratch::writeNumber(scratch::ALLOC_FAILURE_COUNT, 0);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "CoreController::initialize: Setting up alloc failure "
@ -82,7 +107,23 @@ ReturnValue_t CoreController::initialize() {
sdStateMachine();
triggerEvent(REBOOT_SW, CURRENT_CHIP, CURRENT_COPY);
return ExtendedControllerBase::initialize();
EventManagerIF *eventManager =
ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
if (eventManager == nullptr or eventQueue == nullptr) {
sif::warning << "CoreController::initialize: No valid event manager found or "
"queue invalid"
<< std::endl;
}
result = eventManager->registerListener(eventQueue->getId());
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "CoreController::initialize: Registering as event listener failed" << std::endl;
}
result = eventManager->subscribeToEvent(eventQueue->getId(),
event::getEventId(GpsHyperion::GPS_FIX_CHANGE));
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Subscribing for GPS GPS_FIX_CHANGE event failed" << std::endl;
}
return RETURN_OK;
}
ReturnValue_t CoreController::initializeAfterTaskCreation() {
@ -104,6 +145,7 @@ ReturnValue_t CoreController::initializeAfterTaskCreation() {
setenv("PATH", updatedEnvPath.c_str(), true);
updateProtInfo();
initPrint();
ExtendedControllerBase::initializeAfterTaskCreation();
return result;
}
@ -608,6 +650,7 @@ ReturnValue_t CoreController::incrementAllocationFailureCount() {
}
ReturnValue_t CoreController::initVersionFile() {
using namespace fsfw;
std::string unameFileName = "/tmp/uname_version.txt";
// TODO: No -v flag for now. If the kernel version is used, need to cut off first few letters
std::string unameCmd = "uname -mnrso > " + unameFileName;
@ -624,12 +667,11 @@ ReturnValue_t CoreController::initVersionFile() {
std::string fullObswVersionString = "OBSW: v" + std::to_string(SW_VERSION) + "." +
std::to_string(SW_SUBVERSION) + "." +
std::to_string(SW_REVISION);
std::string fullFsfwVersionString = "FSFW: v" + std::to_string(FSFW_VERSION) + "." +
std::to_string(FSFW_SUBVERSION) + "." +
std::to_string(FSFW_REVISION);
char versionString[16] = {};
fsfw::FSFW_VERSION.getVersion(versionString, sizeof(versionString));
std::string fullFsfwVersionString = "FSFW: v" + std::string(versionString);
std::string systemString = "System: " + unameLine;
std::string mountPrefix = SdCardManager::instance()->getCurrentMountPrefix();
std::string versionFilePath = mountPrefix + VERSION_FILE;
std::string versionFilePath = currMntPrefix + VERSION_FILE;
std::fstream versionFile;
if (not std::filesystem::exists(versionFilePath)) {
@ -1187,24 +1229,27 @@ void CoreController::performWatchdogControlOperation() {
}
void CoreController::performMountedSdCardOperations() {
currMntPrefix = sdcMan->getCurrentMountPrefix();
if (doPerformMountedSdCardOps) {
bool sdCardMounted = false;
sdCardMounted = sdcMan->isSdCardMounted(sdInfo.pref);
if (sdCardMounted) {
std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + "/" + CONF_FOLDER;
std::string path = currMntPrefix + "/" + CONF_FOLDER;
if (not std::filesystem::exists(path)) {
std::filesystem::create_directory(path);
}
initVersionFile();
initClockFromTimeFile();
performRebootFileHandling(false);
doPerformMountedSdCardOps = false;
}
}
timeFileHandler();
}
void CoreController::performRebootFileHandling(bool recreateFile) {
using namespace std;
std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + REBOOT_FILE;
std::string path = currMntPrefix + REBOOT_FILE;
if (not std::filesystem::exists(path) or recreateFile) {
#if OBSW_VERBOSE_LEVEL >= 1
sif::info << "CoreController::performRebootFileHandling: Recreating reboot file" << std::endl;
@ -1583,7 +1628,7 @@ bool CoreController::parseRebootFile(std::string path, RebootFile &rf) {
}
void CoreController::resetRebootCount(xsc::Chip tgtChip, xsc::Copy tgtCopy) {
std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + REBOOT_FILE;
std::string path = currMntPrefix + REBOOT_FILE;
// Disable the reboot file mechanism
parseRebootFile(path, rebootFile);
if (tgtChip == xsc::ALL_CHIP and tgtCopy == xsc::ALL_COPY) {
@ -1610,7 +1655,7 @@ void CoreController::resetRebootCount(xsc::Chip tgtChip, xsc::Copy tgtCopy) {
}
void CoreController::rewriteRebootFile(RebootFile file) {
std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + REBOOT_FILE;
std::string path = currMntPrefix + REBOOT_FILE;
std::ofstream rebootFile(path);
if (rebootFile.is_open()) {
// Initiate reboot file first. Reboot handling will be on on initialization
@ -1645,3 +1690,93 @@ void CoreController::setRebootMechanismLock(bool lock, xsc::Chip tgtChip, xsc::C
}
rewriteRebootFile(rebootFile);
}
ReturnValue_t CoreController::timeFileHandler() {
if (gpsFix == GpsHyperion::FixMode::FIX_2D or gpsFix == GpsHyperion::FixMode::FIX_3D) {
// It is assumed that the system time is set from the GPS time
timeval currentTime = {};
ReturnValue_t result = Clock::getClock_timeval(&currentTime);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
std::ofstream timeFile(currMntPrefix + TIME_FILE);
timeFile << "UNIX SECONDS: " << currentTime.tv_sec << std::endl;
}
return RETURN_OK;
}
ReturnValue_t CoreController::initClockFromTimeFile() {
using namespace GpsHyperion;
using namespace std;
std::string fileName = currMntPrefix + TIME_FILE;
if (std::filesystem::exists(fileName) and
((gpsFix == FixMode::UNKNOWN or gpsFix == FixMode::NOT_SEEN) or
not utility::timeSanityCheck())) {
ifstream timeFile(fileName);
string nextWord;
getline(timeFile, nextWord);
istringstream iss(nextWord);
iss >> nextWord;
if (iss.bad() or nextWord != "UNIX") {
return RETURN_FAILED;
}
iss >> nextWord;
if (iss.bad() or nextWord != "SECONDS:") {
return RETURN_FAILED;
}
iss >> nextWord;
timeval currentTime = {};
char *checkPtr;
currentTime.tv_sec = strtol(nextWord.c_str(), &checkPtr, 10);
if (iss.bad() or *checkPtr) {
return RETURN_FAILED;
}
#if OBSW_VERBOSE_LEVEL >= 1
time_t timeRaw = currentTime.tv_sec;
std::tm *time = std::gmtime(&timeRaw);
sif::info << "Setting system time from time files: " << std::put_time(time, "%c %Z")
<< std::endl;
#endif
return Clock::setClock(&currentTime);
}
return RETURN_OK;
}
void CoreController::readHkData() {
ReturnValue_t result = RETURN_OK;
result = hkSet.read(TIMEOUT_TYPE, MUTEX_TIMEOUT);
if (result != RETURN_OK) {
return;
}
Xadc xadc;
result = xadc.getTemperature(hkSet.temperature.value);
if (result != RETURN_OK) {
hkSet.temperature.setValid(false);
} else {
hkSet.temperature.setValid(true);
}
result = xadc.getVccPint(hkSet.psVoltage.value);
if (result != RETURN_OK) {
hkSet.psVoltage.setValid(false);
} else {
hkSet.psVoltage.setValid(true);
}
result = xadc.getVccInt(hkSet.plVoltage.value);
if (result != RETURN_OK) {
hkSet.plVoltage.setValid(false);
} else {
hkSet.plVoltage.setValid(true);
}
#if OBSW_PRINT_CORE_HK == 1
hkSet.printSet();
#endif /* OBSW_PRINT_CORE_HK == 1 */
result = hkSet.commit(TIMEOUT_TYPE, MUTEX_TIMEOUT);
if (result != RETURN_OK) {
return;
}
}
bool CoreController::isNumber(const std::string &s) {
return !s.empty() && std::find_if(s.begin(), s.end(),
[](unsigned char c) { return !std::isdigit(c); }) == s.end();
}

View File

@ -6,9 +6,11 @@
#include <cstddef>
#include "CoreDefinitions.h"
#include "bsp_q7s/memory/SdCardManager.h"
#include "events/subsystemIdRanges.h"
#include "fsfw/controller/ExtendedControllerBase.h"
#include "mission/devices/devicedefinitions/GPSDefinitions.h"
class Timer;
class SdCardManager;
@ -52,10 +54,12 @@ class CoreController : public ExtendedControllerBase {
static constexpr char CONF_FOLDER[] = "conf";
static constexpr char VERSION_FILE_NAME[] = "version.txt";
static constexpr char REBOOT_FILE_NAME[] = "reboot.txt";
static constexpr char TIME_FILE_NAME[] = "time.txt";
const std::string VERSION_FILE =
"/" + std::string(CONF_FOLDER) + "/" + std::string(VERSION_FILE_NAME);
const std::string REBOOT_FILE =
"/" + std::string(CONF_FOLDER) + "/" + std::string(REBOOT_FILE_NAME);
const std::string TIME_FILE = "/" + std::string(CONF_FOLDER) + "/" + std::string(TIME_FILE_NAME);
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
static constexpr ActionId_t SWITCH_REBOOT_FILE_HANDLING = 5;
@ -120,9 +124,12 @@ class CoreController : public ExtendedControllerBase {
bool sdInitFinished() const;
private:
static constexpr MutexIF::TimeoutType TIMEOUT_TYPE = MutexIF::TimeoutType::WAITING;
static constexpr uint32_t MUTEX_TIMEOUT = 20;
// Designated value for rechecking FIFO open
static constexpr int RETRY_FIFO_OPEN = -2;
int watchdogFifoFd = 0;
GpsHyperion::FixMode gpsFix = GpsHyperion::FixMode::UNKNOWN;
// States for SD state machine, which is used in non-blocking mode
enum class SdStates {
@ -148,6 +155,7 @@ class CoreController : public ExtendedControllerBase {
static constexpr bool BLOCKING_SD_INIT = false;
SdCardManager* sdcMan = nullptr;
MessageQueueIF* eventQueue = nullptr;
struct SdInfo {
sd::SdCard pref = sd::SdCard::NONE;
@ -170,6 +178,7 @@ class CoreController : public ExtendedControllerBase {
sd::SdState commandedState = sd::SdState::OFF;
} sdInfo;
RebootFile rebootFile = {};
std::string currMntPrefix;
bool doPerformMountedSdCardOps = true;
/**
@ -181,12 +190,17 @@ class CoreController : public ExtendedControllerBase {
std::array<bool, 4> protArray;
PeriodicOperationDivider opDivider;
core::HkSet hkSet;
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, uint32_t* msToReachTheMode);
void performMountedSdCardOperations();
ReturnValue_t initVersionFile();
ReturnValue_t initClockFromTimeFile();
ReturnValue_t timeFileHandler();
ReturnValue_t initBootCopy();
ReturnValue_t initWatchdogFifo();
ReturnValue_t initSdCardBlocking();
@ -220,6 +234,8 @@ class CoreController : public ExtendedControllerBase {
void setRebootMechanismLock(bool lock, xsc::Chip tgtChip, xsc::Copy tgtCopy);
bool parseRebootFile(std::string path, RebootFile& file);
void rewriteRebootFile(RebootFile file);
void readHkData();
bool isNumber(const std::string& s);
};
#endif /* BSP_Q7S_CORE_CORECONTROLLER_H_ */

View File

@ -0,0 +1,39 @@
#ifndef BSP_Q7S_CORE_COREDEFINITIONS_H_
#define BSP_Q7S_CORE_COREDEFINITIONS_H_
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
namespace core {
static const uint8_t HK_SET_ENTRIES = 3;
static const uint32_t HK_SET_ID = 5;
enum PoolIds { TEMPERATURE, PS_VOLTAGE, PL_VOLTAGE };
/**
* @brief Set storing OBC internal housekeeping data
*/
class HkSet : public StaticLocalDataSet<HK_SET_ENTRIES> {
public:
HkSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, HK_SET_ID) {}
HkSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, HK_SET_ID)) {}
// On-chip temperature
lp_var_t<float> temperature = lp_var_t<float>(sid.objectId, PoolIds::TEMPERATURE, this);
// Processing system VCC
lp_var_t<float> psVoltage = lp_var_t<float>(sid.objectId, PoolIds::PS_VOLTAGE, this);
// Programmable logic VCC
lp_var_t<float> plVoltage = lp_var_t<float>(sid.objectId, PoolIds::PL_VOLTAGE, this);
void printSet() {
sif::info << "HkSet::printSet: On-chip temperature: " << this->temperature << " °C"
<< std::endl;
sif::info << "HkSet::printSet: PS voltage: " << this->psVoltage << " mV" << std::endl;
sif::info << "HkSet::printSet: PL voltage: " << this->plVoltage << " mV" << std::endl;
}
};
} // namespace core
#endif /* BSP_Q7S_CORE_COREDEFINITIONS_H_ */

View File

@ -55,14 +55,12 @@ void initmission::initTasks() {
void (*missedDeadlineFunc)(void) = nullptr;
#endif
#if BOARD_TE0720 == 0
PeriodicTaskIF* coreController = factory->createPeriodicTask(
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
result = coreController->addComponent(objects::CORE_CONTROLLER);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
}
#endif
/* TMTC Distribution */
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
@ -116,15 +114,32 @@ void initmission::initTasks() {
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
#if OBSW_ADD_ACS_HANDLERS == 1
PeriodicTaskIF* acsCtrl = factory->createPeriodicTask(
"ACS_CTRL", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc);
result = acsCtrl->addComponent(objects::GPS_CONTROLLER);
PeriodicTaskIF* acsTask = factory->createPeriodicTask(
"ACS_CTRL", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc);
result = acsTask->addComponent(objects::GPS_CONTROLLER);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("ACS_CTRL", objects::GPS_CONTROLLER);
initmission::printAddObjectError("GPS_CTRL", objects::GPS_CONTROLLER);
}
#endif /* OBSW_ADD_ACS_HANDLERS */
#if BOARD_TE0720 == 0
PeriodicTaskIF* sysTask = factory->createPeriodicTask(
"SYS_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc);
result = sysTask->addComponent(objects::ACS_BOARD_ASS);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("ACS_BOARD_ASS", objects::ACS_BOARD_ASS);
}
#if OBSW_ADD_SUS_BOARD_ASS == 1
result = sysTask->addComponent(objects::SUS_BOARD_ASS);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("SUS_BOARD_ASS", objects::SUS_BOARD_ASS);
}
#endif
result = sysTask->addComponent(objects::TCS_BOARD_ASS);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("TCS_BOARD_ASS", objects::TCS_BOARD_ASS);
}
// FS task, task interval does not matter because it runs in permanent loop, priority low
// because it is a non-essential background task
PeriodicTaskIF* fsTask = factory->createPeriodicTask(
@ -143,7 +158,14 @@ void initmission::initTasks() {
}
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
#endif /* BOARD_TE0720 */
#if OBSW_ADD_PLOC_MPSOC == 1
PeriodicTaskIF* mpsocHelperTask = factory->createPeriodicTask(
"PLOC_MPSOC_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = mpsocHelperTask->addComponent(objects::PLOC_MPSOC_HELPER);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PLOC_MPSOC_HELPER", objects::PLOC_MPSOC_HELPER);
}
#endif /* OBSW_ADD_PLOC_MPSOC */
#if OBSW_TEST_CCSDS_BRIDGE == 1
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
@ -187,9 +209,7 @@ void initmission::initTasks() {
pdecHandlerTask->startTask();
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
#if BOARD_TE0720 == 0
coreController->startTask();
#endif
taskStarter(pstTasks, "PST task vector");
taskStarter(pusTasks, "PUS task vector");
@ -201,16 +221,15 @@ void initmission::initTasks() {
ptmeTestTask->startTask();
#endif
#if BOARD_TE0720 == 0
fsTask->startTask();
#if OBSW_ADD_STAR_TRACKER == 1
strHelperTask > startTask();
strHelperTask->startTask();
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
#endif
#if OBSW_ADD_ACS_HANDLERS == 1
acsCtrl->startTask();
acsTask->startTask();
#endif
sysTask->startTask();
sif::info << "Tasks started.." << std::endl;
}
@ -219,15 +238,16 @@ void initmission::createPstTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
#if BOARD_TE0720 == 0
/* Polling Sequence Table Default */
#if OBSW_ADD_SPI_TEST_CODE == 0
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
"PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
result = pst::pstSpi(spiPst);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::warning << "InitMission::initTasks: SPI PST is empty" << std::endl;
} else {
sif::error << "InitMission::initTasks: Creating SPI PST failed!" << std::endl;
}
} else {
taskVec.push_back(spiPst);
@ -238,43 +258,51 @@ void initmission::createPstTasks(TaskFactory& factory,
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
result = pst::pstUart(uartPst);
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(
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
result = pst::pstGpio(gpioPst);
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
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
"I2C_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
result = pst::pstI2c(i2cPst);
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
FixedTimeslotTaskIF* gomSpacePstTask = factory.createFixedTimeslotTask(
"GS_PST_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
result = pst::pstGompaceCan(gomSpacePstTask);
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);
#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,
@ -381,12 +409,6 @@ void initmission::createTestTasks(TaskFactory& factory,
}
#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);
#endif // OBSW_ADD_TEST_TASK == 1 && OBSW_ADD_TEST_CODE == 1

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,8 @@ class LinuxLibgpioIF;
class UartComIF;
class SpiComIF;
class I2cComIF;
class PowerSwitchIF;
class AcsBoardAssembly;
namespace ObjectFactory {
@ -13,21 +15,23 @@ void produce(void* args);
void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, UartComIF** uartComIF,
SpiComIF** spiComIF, I2cComIF** i2cComIF);
void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF);
void createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher);
void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
PowerSwitchIF* pwrSwitcher);
void createTmpComponents();
void createPcduComponents(LinuxLibgpioIF* gpioComIF);
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
void createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF);
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF);
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF,
PowerSwitchIF* pwrSwitcher);
void createHeaterComponents();
void createSolarArrayDeploymentComponents();
void createSyrlinksComponents();
void createRtdComponents(LinuxLibgpioIF* gpioComIF);
void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher);
void createPayloadComponents(LinuxLibgpioIF* gpioComIF);
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF);
void createCcsdsComponents(LinuxLibgpioIF* gpioComIF);
void createTestComponents(LinuxLibgpioIF* gpioComIF);
void testAcsBrdAss(AcsBoardAssembly* assAss);
}; // namespace ObjectFactory
#endif /* BSP_Q7S_OBJECTFACTORY_H_ */

View File

@ -6,21 +6,18 @@
#include "InitMission.h"
#include "OBSWConfig.h"
#include "OBSWVersion.h"
#include "fsfw/FSFWVersion.h"
#include "fsfw/tasks/TaskFactory.h"
#include "watchdogConf.h"
#include "fsfw/version.h"
#include "watchdog/definitions.h"
static int OBSW_ALREADY_RUNNING = -2;
int obsw::obsw() {
using namespace fsfw;
std::cout << "-- EIVE OBSW --" << std::endl;
#if BOARD_TE0720 == 0
std::cout << "-- Compiled for Linux (Xiphos Q7S) --" << std::endl;
#else
std::cout << "-- Compiled for Linux (TE0720) --" << std::endl;
#endif
std::cout << "-- OBSW v" << SW_VERSION << "." << SW_SUBVERSION << "." << SW_REVISION << ", FSFW v"
<< FSFW_VERSION << "." << FSFW_SUBVERSION << "." << FSFW_REVISION << "--" << std::endl;
<< FSFW_VERSION << "--" << std::endl;
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
#if Q7S_CHECK_FOR_ALREADY_RUNNING_IMG == 1

View File

@ -2,4 +2,5 @@ target_sources(${OBSW_NAME} PRIVATE
FileSystemHandler.cpp
SdCardManager.cpp
scratchApi.cpp
FilesystemHelper.cpp
)

View File

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

View File

@ -0,0 +1,40 @@
#include "FilesystemHelper.h"
#include <filesystem>
#include <fstream>
#include "bsp_q7s/memory/SdCardManager.h"
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
FilesystemHelper::FilesystemHelper() {}
FilesystemHelper::~FilesystemHelper() {}
ReturnValue_t FilesystemHelper::checkPath(std::string path) {
SdCardManager* sdcMan = SdCardManager::instance();
if (sdcMan == nullptr) {
sif::warning << "FilesystemHelper::checkPath: Invalid SD card manager" << std::endl;
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;
}
} 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;
}
ReturnValue_t FilesystemHelper::fileExists(std::string file) {
if (not std::filesystem::exists(file)) {
return FILE_NOT_EXISTS;
}
return RETURN_OK;
}

View File

@ -0,0 +1,49 @@
#ifndef BSP_Q7S_MEMORY_FILESYSTEMHELPER_H_
#define BSP_Q7S_MEMORY_FILESYSTEMHELPER_H_
#include <string>
#include "commonClassIds.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
/**
* @brief This class implements often used functions concerning the file system management.
*
* @author J. Meier
*/
class FilesystemHelper : public HasReturnvaluesIF {
public:
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);
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 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_ */

View File

@ -1,6 +1,5 @@
#include "SdCardManager.h"
#include "OBSWConfig.h"
#include <fsfw/ipc/MutexGuard.h>
#include <fsfw/timemanager/Countdown.h>
#include <unistd.h>
@ -10,6 +9,7 @@
#include <fstream>
#include <memory>
#include "OBSWConfig.h"
#include "common/config/commonObjects.h"
#include "fsfw/ipc/MutexFactory.h"
#include "fsfw/serviceinterface/ServiceInterface.h"

View File

@ -0,0 +1,3 @@
target_sources(${OBSW_NAME} PRIVATE
Xadc.cpp
)

144
bsp_q7s/xadc/Xadc.cpp Normal file
View File

@ -0,0 +1,144 @@
#include "Xadc.h"
#include <fcntl.h>
#include <unistd.h>
#include <sstream>
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
Xadc::Xadc() {}
Xadc::~Xadc() {}
ReturnValue_t Xadc::getTemperature(float& temperature) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
int raw = 0;
int offset = 0;
float scale = 0;
result = readValFromFile<int>(xadc::file::tempRaw.c_str(), raw);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = readValFromFile<int>(xadc::file::tempOffset.c_str(), offset);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = readValFromFile<float>(xadc::file::tempScale.c_str(), scale);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
temperature = (raw + offset) * scale / 1000;
return result;
}
ReturnValue_t Xadc::getVccPint(float& vccPint) {
ReturnValue_t result =
readVoltageFromSysfs(xadc::file::vccpintRaw, xadc::file::vccpintScale, vccPint);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t Xadc::getVccPaux(float& vccPaux) {
ReturnValue_t result =
readVoltageFromSysfs(xadc::file::vccpauxRaw, xadc::file::vccpauxScale, vccPaux);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t Xadc::getVccInt(float& vccInt) {
ReturnValue_t result =
readVoltageFromSysfs(xadc::file::vccintRaw, xadc::file::vccintScale, vccInt);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t Xadc::getVccAux(float& vccAux) {
ReturnValue_t result =
readVoltageFromSysfs(xadc::file::vccauxRaw, xadc::file::vccauxScale, vccAux);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t Xadc::getVccBram(float& vccBram) {
ReturnValue_t result =
readVoltageFromSysfs(xadc::file::vccbramRaw, xadc::file::vccbramScale, vccBram);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t Xadc::getVccOddr(float& vccOddr) {
ReturnValue_t result =
readVoltageFromSysfs(xadc::file::vccoddrRaw, xadc::file::vccoddrScale, vccOddr);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t Xadc::getVrefp(float& vrefp) {
ReturnValue_t result = readVoltageFromSysfs(xadc::file::vrefpRaw, xadc::file::vrefpScale, vrefp);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t Xadc::getVrefn(float& vrefn) {
ReturnValue_t result = readVoltageFromSysfs(xadc::file::vrefnRaw, xadc::file::vrefnScale, vrefn);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t Xadc::readVoltageFromSysfs(std::string rawFile, std::string scaleFile,
float& voltage) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
float raw = 0;
float scale = 0;
result = readValFromFile(rawFile.c_str(), raw);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = readValFromFile(scaleFile.c_str(), scale);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
voltage = calculateVoltage(raw, scale);
return result;
}
float Xadc::calculateVoltage(int raw, float scale) { return static_cast<float>(raw * scale); }
template <typename T>
ReturnValue_t Xadc::readValFromFile(const char* filename, T& val) {
FILE* fp;
fp = fopen(filename, "r");
if (fp == nullptr) {
sif::warning << "Xadc::readValFromFile: Failed to open file " << filename << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
char valstring[MAX_STR_LENGTH] = "";
char* returnVal = fgets(valstring, MAX_STR_LENGTH, fp);
if (returnVal == nullptr) {
sif::warning << "Xadc::readValFromFile: Failed to read string from file " << filename
<< std::endl;
fclose(fp);
return HasReturnvaluesIF::RETURN_FAILED;
}
std::istringstream valSstream(valstring);
valSstream >> val;
fclose(fp);
return HasReturnvaluesIF::RETURN_OK;
}

108
bsp_q7s/xadc/Xadc.h Normal file
View File

@ -0,0 +1,108 @@
#ifndef BSP_Q7S_XADC_XADC_H_
#define BSP_Q7S_XADC_XADC_H_
#include <string>
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
namespace xadc {
using namespace std;
static const string iioPath = "/sys/bus/iio/devices/iio:device1";
namespace file {
static const string tempOffset = iioPath + "/in_temp0_offset";
static const string tempRaw = iioPath + "/in_temp0_raw";
static const string tempScale = iioPath + "/in_temp0_scale";
static const string vccintRaw = iioPath + "/in_voltage0_vccint_raw";
static const string vccintScale = iioPath + "/in_voltage0_vccint_scale";
static const string vccauxRaw = iioPath + "/in_voltage1_vccaux_raw";
static const string vccauxScale = iioPath + "/in_voltage1_vccaux_scale";
static const string vccbramRaw = iioPath + "/in_voltage2_vccbram_raw";
static const string vccbramScale = iioPath + "/in_voltage2_vccbram_scale";
static const string vccpintRaw = iioPath + "/in_voltage3_vccpint_raw";
static const string vccpintScale = iioPath + "/in_voltage3_vccpint_scale";
static const string vccpauxRaw = iioPath + "/in_voltage4_vccpaux_raw";
static const string vccpauxScale = iioPath + "/in_voltage4_vccpaux_scale";
static const string vccoddrRaw = iioPath + "/in_voltage5_vccoddr_raw";
static const string vccoddrScale = iioPath + "/in_voltage5_vccoddr_scale";
static const string vrefpRaw = iioPath + "/in_voltage6_vrefp_raw";
static const string vrefpScale = iioPath + "/in_voltage6_vrefp_scale";
static const string vrefnRaw = iioPath + "/in_voltage7_vrefn_raw";
static const string vrefnScale = iioPath + "/in_voltage7_vrefn_scale";
} // namespace file
} // namespace xadc
/**
* @brief Class providing access to the data generated by the analog mixed signal module (XADC).
*
* @details Details about the XADC peripheral of the Zynq-7020 can be found in the UG480 "7-Series
* FPGAs and Zynq-7000 SoC XADC Dual 12-Bit 1 MSPS Analog-to-Digital Converter" user guide
* from Xilinx.
*
* @author J. Meier
*/
class Xadc {
public:
/**
* @brief Constructor
*/
Xadc();
virtual ~Xadc();
/**
* @brief Returns on-chip temperature degree celcius
*/
ReturnValue_t getTemperature(float& temperature);
/**
* @brief Returns PS internal logic supply voltage in millivolts
*/
ReturnValue_t getVccPint(float& vccPint);
/**
* @brief Returns PS auxiliary supply voltage in millivolts
*/
ReturnValue_t getVccPaux(float& vccPaux);
/**
* @brief Returns PL internal supply voltage in millivolts
*/
ReturnValue_t getVccInt(float& vccInt);
/**
* @brief Returns PL auxiliary supply voltage in millivolts
*/
ReturnValue_t getVccAux(float& vccAux);
/**
* @brief Returns PL block RAM supply voltage in millivolts
*/
ReturnValue_t getVccBram(float& vccBram);
/**
* @brief Returns the PS DDR I/O supply voltage
*/
ReturnValue_t getVccOddr(float& vcOddr);
/**
* @brief Returns XADC reference input voltage relative to GND in millivolts
*/
ReturnValue_t getVrefp(float& vrefp);
/**
* @brief Returns negative reference input voltage. Should normally be 0 V.
*/
ReturnValue_t getVrefn(float& vrefn);
private:
// Maximum length of the string representation of a value in a xadc sysfs file
static const uint8_t MAX_STR_LENGTH = 15;
ReturnValue_t readVoltageFromSysfs(std::string rawFile, std::string scaleFile, float& voltage);
float calculateVoltage(int raw, float scale);
template <typename T>
ReturnValue_t readValFromFile(const char* filename, T& val);
};
#endif /* BSP_Q7S_XADC_XADC_H_ */

View File

@ -0,0 +1,7 @@
target_sources(${OBSW_NAME} PUBLIC
InitMission.cpp
main.cpp
ObjectFactory.cpp
)
add_subdirectory(boardconfig)

View File

@ -0,0 +1,188 @@
#include "InitMission.h"
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h>
#include <fsfw/tasks/TaskFactory.h>
#include <mission/utility/InitMission.h>
#include <iostream>
#include "OBSWConfig.h"
#include "ObjectFactory.h"
#include "objects/systemObjectList.h"
#include "pollingsequence/pollingSequenceFactory.h"
ServiceInterfaceStream sif::debug("DEBUG");
ServiceInterfaceStream sif::info("INFO");
ServiceInterfaceStream sif::warning("WARNING");
ServiceInterfaceStream sif::error("ERROR");
ObjectManagerIF* objectManager = nullptr;
void initmission::initMission() {
sif::info << "Building global objects.." << std::endl;
/* Instantiate global object manager and also create all objects */
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
sif::info << "Initializing all objects.." << std::endl;
ObjectManager::instance()->initialize();
/* This function creates and starts all tasks */
initTasks();
}
void initmission::initTasks() {
TaskFactory* factory = TaskFactory::instance();
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
if (factory == nullptr) {
/* Should never happen ! */
return;
}
#if OBSW_PRINT_MISSED_DEADLINES == 1
void (*missedDeadlineFunc)(void) = TaskFactory::printMissedDeadline;
#else
void (*missedDeadlineFunc)(void) = nullptr;
#endif
/* TMTC Distribution */
PeriodicTaskIF* tmtcDistributor = factory->createPeriodicTask(
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = tmtcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Object add component failed" << std::endl;
}
result = tmtcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Object add component failed" << std::endl;
}
result = tmtcDistributor->addComponent(objects::TM_FUNNEL);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Object add component failed" << std::endl;
}
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
"TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component TMTC Bridge failed" << std::endl;
}
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component TMTC Polling failed" << std::endl;
}
/* PUS Services */
std::vector<PeriodicTaskIF*> pusTasks;
createPusTasks(*factory, missedDeadlineFunc, pusTasks);
std::vector<PeriodicTaskIF*> pstTasks;
FixedTimeslotTaskIF* pst = factory->createFixedTimeslotTask(
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
result = pst::pstUart(pst);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
}
pstTasks.push_back(pst);
PeriodicTaskIF* mpsocHelperTask = factory->createPeriodicTask(
"PLOC_MPSOC_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = mpsocHelperTask->addComponent(objects::PLOC_MPSOC_HELPER);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PLOC_MPSOC_HELPER", objects::PLOC_MPSOC_HELPER);
}
pstTasks.push_back(mpsocHelperTask);
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
for (const auto& task : taskVector) {
if (task != nullptr) {
task->startTask();
} else {
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
}
}
};
sif::info << "Starting tasks.." << std::endl;
tmtcDistributor->startTask();
tmtcBridgeTask->startTask();
tmtcPollingTask->startTask();
taskStarter(pstTasks, "PST Tasks");
taskStarter(pusTasks, "PUS Tasks");
sif::info << "Tasks started.." << std::endl;
}
void initmission::createPusTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Object add component failed" << std::endl;
}
taskVec.push_back(pusVerification);
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
}
result = pusEvents->addComponent(objects::EVENT_MANAGER);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
}
taskVec.push_back(pusEvents);
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
}
taskVec.push_back(pusHighPrio);
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
}
taskVec.push_back(pusMedPrio);
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
}
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("INT_ERR_RPRT", objects::INTERNAL_ERROR_REPORTER);
}
taskVec.push_back(pusLowPrio);
}

View File

@ -0,0 +1,21 @@
#ifndef BSP_LINUX_INITMISSION_H_
#define BSP_LINUX_INITMISSION_H_
#include <vector>
#include "fsfw/tasks/Typedef.h"
class PeriodicTaskIF;
class TaskFactory;
namespace initmission {
void initMission();
void initTasks();
void createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec);
void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec);
}; // namespace initmission
#endif /* BSP_LINUX_INITMISSION_H_ */

View File

@ -0,0 +1,151 @@
#include "ObjectFactory.h"
#include <devConf.h>
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw_hal/linux/i2c/I2cComIF.h"
#include "fsfw_hal/linux/uart/UartCookie.h"
#include "OBSWConfig.h"
#include "busConf.h"
#include "devConf.h"
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
#include "fsfw/tmtcpacket/pus/tm.h"
#include "fsfw/tmtcservices/CommandingServiceBase.h"
#include "fsfw/tmtcservices/PusServiceBase.h"
#include "fsfw_hal/linux/i2c/I2cCookie.h"
#include "linux/devices/ploc/PlocMPSoCHandler.h"
#include "linux/devices/ploc/PlocMPSoCHelper.h"
#include "mission/devices/Tmp1075Handler.h"
#include "mission/core/GenericFactory.h"
#include "mission/utility/TmFunnel.h"
#include "test/gpio/DummyGpioIF.h"
#include "objects/systemObjectList.h"
#include "devices/addresses.h"
#include "devices/gpioIds.h"
#include "tmtc/apid.h"
#include "tmtc/pusIds.h"
void Factory::setStaticFrameworkObjectIds() {
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
PusServiceBase::packetDestination = objects::TM_FUNNEL;
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
TmFunnel::downlinkDestination = objects::TMTC_BRIDGE;
TmFunnel::storageDestination = objects::NO_OBJECT;
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
}
void ObjectFactory::produce(void* args) {
Factory::setStaticFrameworkObjectIds();
ObjectFactory::produceGenericObjects();
#if OBSW_ADD_PLOC_MPSOC == 1
UartCookie* mpsocUartCookie = new UartCookie(objects::PLOC_MPSOC_HANDLER, te0720_1cfa::MPSOC_UART,
uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
mpsocUartCookie->setNoFixedSizeReply();
PlocMPSoCHelper* plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
new UartComIF(objects::UART_COM_IF);
auto dummyGpioIF = new DummyGpioIF();
PlocMPSoCHandler* plocMPSoCHandler = new PlocMPSoCHandler(
objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocUartCookie, plocMpsocHelper,
Gpio(gpioIds::ENABLE_MPSOC_UART, dummyGpioIF), objects::PLOC_SUPERVISOR_HANDLER);
plocMPSoCHandler->setStartUpImmediately();
#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

@ -0,0 +1,8 @@
#ifndef BSP_LINUX_OBJECTFACTORY_H_
#define BSP_LINUX_OBJECTFACTORY_H_
namespace ObjectFactory {
void produce(void* args);
}; // namespace ObjectFactory
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */

View File

@ -0,0 +1,7 @@
target_sources(${OBSW_NAME} PRIVATE
print.c
)
target_include_directories(${OBSW_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)

View File

@ -0,0 +1,11 @@
#ifndef BSP_EGSE_BOARDCONFIG_BUSCONF_H_
#define BSP_EGSE_BOARDCONFIG_BUSCONF_H_
namespace te0720_1cfa {
static constexpr char MPSOC_UART[] = "/dev/ttyPS1";
namespace baudrate {
}
}
#endif /* BSP_EGSE_BOARDCONFIG_BUSCONF_H_ */

View File

@ -0,0 +1,38 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2019 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef __ETL_PROFILE_H__
#define __ETL_PROFILE_H__
#define ETL_CHECK_PUSH_POP
#define ETL_CPP11_SUPPORTED 1
#define ETL_NO_NULLPTR_SUPPORT 0
#endif

View File

@ -0,0 +1,15 @@
#ifndef LINUX_GCOV_H_
#define LINUX_GCOV_H_
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#ifdef GCOV
extern "C" void __gcov_flush();
#else
void __gcov_flush() {
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
"coverage information is desired.\n"
<< std::flush;
}
#endif
#endif /* LINUX_GCOV_H_ */

View File

@ -0,0 +1,10 @@
#include <bsp_te0720_1cfa/boardconfig/print.h>
#include <stdio.h>
void printChar(const char* character, bool errStream) {
if (errStream) {
putc(*character, stderr);
return;
}
putc(*character, stdout);
}

View File

@ -0,0 +1,8 @@
#ifndef HOSTED_BOARDCONFIG_PRINT_H_
#define HOSTED_BOARDCONFIG_PRINT_H_
#include <stdbool.h>
void printChar(const char* character, bool errStream);
#endif /* HOSTED_BOARDCONFIG_PRINT_H_ */

29
bsp_te0720_1cfa/main.cpp Normal file
View File

@ -0,0 +1,29 @@
#include <iostream>
#include "InitMission.h"
#include "OBSWConfig.h"
#include "OBSWVersion.h"
#include "fsfw/version.h"
#include "fsfw/tasks/TaskFactory.h"
/**
* @brief This is the main program entry point for the obsw running on the trenz electronic
* te0720-1cfa.
* @return
*/
int main(void) {
using namespace fsfw;
std::cout << "-- EIVE OBSW --" << std::endl;
std::cout << "-- Compiled for Trenz TE0720-1CFA"
<< " --" << std::endl;
std::cout << "-- OBSW v" << SW_VERSION << "." << SW_SUBVERSION << "." << SW_REVISION << ", FSFW v"
<< FSFW_VERSION << "--" << std::endl;
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
initmission::initMission();
for (;;) {
/* Suspend main thread by sleeping it. */
TaskFactory::delayTask(5000);
}
}

View File

@ -59,6 +59,8 @@ if(TGT_BSP)
set(BSP_PATH "bsp_q7s")
elseif(TGT_BSP MATCHES "arm/egse")
set(BSP_PATH "bsp_egse")
elseif(TGT_BSP MATCHES "arm/te0720-1cfa")
set(BSP_PATH "bsp_te0720_1cfa")
else()
message(WARNING "CMake not configured for this target!")
message(FATAL_ERROR "Target: ${TGT_BSP}!")

View File

@ -12,9 +12,9 @@ endif()
# Disable compiler checks for cross-compiling.
if(FSFW_OSAL MATCHES linux AND TGT_BSP)
if(TGT_BSP MATCHES "arm/q7s")
if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/te0720-1cfa")
set(CMAKE_TOOLCHAIN_FILE
"${CMAKE_SCRIPT_PATH}/Q7SCrossCompileConfig.cmake"
"${CMAKE_SCRIPT_PATH}/Zynq7020CrossCompileConfig.cmake"
PARENT_SCOPE
)
elseif(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/egse")

View File

@ -1,16 +1,16 @@
if(DEFINED ENV{Q7S_SYSROOT})
set(ENV{Q7S_ROOTFS} $ENV{Q7S_SYSROOT})
if(DEFINED ENV{ZYNQ_7020_SYSROOT})
set(ENV{ZYNQ_7020_ROOTFS} $ENV{ZYNQ_7020_SYSROOT})
endif()
# CROSS_COMPILE also needs to be set accordingly or passed to the CMake command
if(NOT DEFINED ENV{Q7S_ROOTFS})
if(NOT DEFINED ENV{ZYNQ_7020_ROOTFS})
# Sysroot has not been cached yet and was not set in environment either
if(NOT DEFINED SYSROOT_PATH)
message(FATAL_ERROR
"Define the Q7S_ROOTFS variable to point to the Q7S rootfs."
"Define the ZYNQ_7020_ROOTFS variable to point to the Zynq-7020 rootfs."
)
endif()
else()
set(SYSROOT_PATH "$ENV{Q7S_ROOTFS}" CACHE PATH "Q7S root filesystem path")
set(SYSROOT_PATH "$ENV{ZYNQ_7020_ROOTFS}" CACHE PATH "Zynq-7020 root filesystem path")
endif()
if(NOT DEFINED ENV{CROSS_COMPILE})
@ -87,18 +87,21 @@ set(C_FLAGS
-mfloat-abi=hard
${COMMON_FLAGS}
-lgpiod
-lxiphos
)
if (TGT_BSP MATCHES "arm/q7s")
set(C_FLAGS ${C_FLAGS} -lxiphos)
endif()
string (REPLACE ";" " " C_FLAGS "${C_FLAGS}")
set(CMAKE_C_FLAGS
${C_FLAGS}
CACHE STRING "C flags for Q7S"
CACHE STRING "C flags for Zynq-7020"
)
set(CMAKE_CXX_FLAGS
"${CMAKE_C_FLAGS}"
CACHE STRING "CPP flags for Q7S"
CACHE STRING "CPP flags for Zynq-7020"
)
# search for programs in the build host directories

View File

@ -2,6 +2,6 @@
export PATH=$PATH:"$HOME/EIVE/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin"
export CROSS_COMPILE="arm-linux-gnueabihf"
export Q7S_SYSROOT="$HOME/Xilinx/cortexa9hf-neon-xiphos-linux-gnueabi"
export ZYNQ_7020_SYSROOT="$HOME/Xilinx/cortexa9hf-neon-xiphos-linux-gnueabi"
export CONSOLE_PREFIX="[Q7S ENV]"
/bin/bash

View File

@ -0,0 +1,49 @@
#!/bin/sh
# Run with: source win-q7s-env.sh [OPTIONS]
function help () {
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"
SYSROOT="/c/Users/${USER}/eive-software/cortexa9hf-neon-xiphos-linux-gnueabi"
for i in "$@"; do
case $i in
-t=*|--toolchain=*)
TOOLCHAIN_PATH="${i#*=}"
shift
;;
-s=*|--sysroot=*)
SYSROOT="${i#*=}"
shift
;;
-h|--help)
help
shift
;;
-*|--*)
echo "Unknown option $i"
help
return
;;
*)
;;
esac
done
if [ -d "$TOOLCHAIN_PATH" ]; then
export PATH=$PATH:"/c/Xilinx/Vitis/2019.2/gnu/aarch32/nt/gcc-arm-linux-gnueabi/bin"
export CROSS_COMPILE="arm-linux-gnueabihf"
echo "Set toolchain path to /c/Xilinx/Vitis/2019.2/gnu/aarch32/nt/gcc-arm-linux-gnueabi/bin"
else
echo "Toolchain path $TOOLCHAIN_PATH does not exist"
return
fi
if [ -d "$SYSROOT" ]; then
export ZYNQ_7020_SYSROOT=$SYSROOT
echo "Set sysroot path to $SYSROOT"
else
echo "Sysroot path $SYSROOT does not exist"
return
fi

View File

@ -12,6 +12,7 @@ import os
import sys
import argparse
import shutil
import stat
def main():
@ -102,7 +103,7 @@ def main():
build_path = source_location + os.path.sep + build_folder
remove_old_dir = False
if remove_old_dir:
shutil.rmtree(build_path)
rm_build_dir(build_path)
os.chdir(source_location)
os.mkdir(build_folder)
print(f"Navigating into build directory: {build_path}")
@ -117,6 +118,14 @@ def main():
print(f"\" {cmake_command} \"")
os.system(cmake_command)
print("-- CMake configuration done. --")
def rm_build_dir(path: str):
# On windows the permissions of the build directory may have been set to read-only. If this
# is the case the permissions are changed before trying to delete the directory.
if not os.access(path, os.W_OK):
os.chmod(path, stat.S_IWUSR)
shutil.rmtree(path)
def determine_source_location() -> str:

View File

@ -0,0 +1,34 @@
#!/bin/sh
counter=0
cfg_script_name="cmake-build-cfg.py"
while [ ${counter} -lt 5 ]
do
cd ..
if [ -f ${cfg_script_name} ];then
break
fi
counter=$((counter=counter + 1))
done
if [ "${counter}" -ge 5 ];then
echo "${cfg_script_name} not found in upper directories!"
exit 1
fi
os_fsfw="linux"
tgt_bsp="arm/te0720-1cfa"
build_generator="make"
build_dir="build-Debug-te0720-1cfa"
if [ "${OS}" = "Windows_NT" ]; then
python="py"
# Could be other OS but this works for now.
else
python="python3"
fi
echo "Running command (without the leading +):"
set -x # Print command
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
-l"${build_dir}"
# set +x

View File

@ -5,7 +5,7 @@ function help () {
}
TOOLCHAIN_PATH="/c/Xilinx/Vitis/2019.2/gnu/aarch32/nt/gcc-arm-linux-gnueabi/bin"
SYSROOT="/c/Users/${USER}/eive-software/cortexa9hf-neon-xiphos-linux-gnueabi"
SYSROOT="/c/Users/${USER}/eive-software/sysroots-petalinux-2019-2/cortexa9t2hf-neon-xilinx-linux-gnueabi"
for i in "$@"; do
case $i in
@ -41,7 +41,7 @@ else
fi
if [ -d "$SYSROOT" ]; then
export Q7S_SYSROOT=$SYSROOT
export ZYNQ_7020_SYSROOT=$SYSROOT
echo "Set sysroot path to $SYSROOT"
else
echo "Sysroot path $SYSROOT does not exist"

View File

@ -13,7 +13,8 @@ enum commonClassIds: uint8_t {
IMTQ_HANDLER, //IMTQ
RW_HANDLER, //RWHA
STR_HANDLER, //STRH
PLOC_MPSOC_HANDLER, //PLMP
DWLPWRON_CMD, //DWLPWRON
MPSOC_TM, //MPTM
PLOC_SUPERVISOR_HANDLER, //PLSV
SUS_HANDLER, //SUSS
CCSDS_IP_CORE_BRIDGE, //IPCI
@ -27,7 +28,10 @@ enum commonClassIds: uint8_t {
RATE_SETTER, //RS
ARCSEC_JSON_BASE, //JSONBASE
NVM_PARAM_BASE, //NVMB
FILE_SYSTEM_HELPER, //FSHLP
PLOC_MPSOC_HELPER, // PLMPHLP
SA_DEPL_HANDLER, //SADPL
MPSOC_RETURN_VALUES_IF, //MPSOCRTVIF
COMMON_CLASS_ID_END // [EXPORT] : [END]
};

View File

@ -42,6 +42,7 @@ enum commonObjects: uint32_t {
IMTQ_HANDLER = 0x44140014,
PLOC_MPSOC_HANDLER = 0x44330015,
PLOC_SUPERVISOR_HANDLER = 0x44330016,
PLOC_SUPERVISOR_HELPER = 0x44330017,
/**
* Not yet specified which pt1000 will measure which device/location in the satellite.
@ -89,8 +90,14 @@ enum commonObjects: uint32_t {
PLOC_UPDATER = 0x44330000,
PLOC_MEMORY_DUMPER = 0x44330001,
STR_HELPER = 0x44330002,
AXI_PTME_CONFIG = 44330003,
PTME_CONFIG = 44330004,
PLOC_MPSOC_HELPER = 0x44330003,
AXI_PTME_CONFIG = 44330004,
PTME_CONFIG = 44330005,
// 0x73 ('s') for assemblies and system/subsystem components
ACS_BOARD_ASS = 0x73000001,
SUS_BOARD_ASS = 0x73000002,
TCS_BOARD_ASS = 0x73000003
};
}

View File

@ -6,20 +6,30 @@
namespace SUBSYSTEM_ID {
enum: uint8_t {
COMMON_SUBSYSTEM_ID_START = FW_SUBSYSTEM_ID_RANGE,
PCDU_HANDLER = 108,
HEATER_HANDLER = 109,
SA_DEPL_HANDLER = 110,
PLOC_MPSOC_HANDLER = 111,
IMTQ_HANDLER = 112,
RW_HANDLER = 113,
STR_HANDLER = 114,
PLOC_SUPERVISOR_HANDLER = 115,
FILE_SYSTEM = 116,
PLOC_UPDATER = 117,
PLOC_MEMORY_DUMPER = 118,
PDEC_HANDLER = 119,
STR_HELPER = 120,
PL_PCDU_HANDLER = 121,
ACS_SUBSYSTEM = 112,
PCDU_HANDLER = 113,
HEATER_HANDLER = 114,
SA_DEPL_HANDLER = 115,
PLOC_MPSOC_HANDLER = 116,
IMTQ_HANDLER = 117,
RW_HANDLER = 118,
STR_HANDLER = 119,
PLOC_SUPERVISOR_HANDLER = 120,
FILE_SYSTEM = 121,
PLOC_UPDATER = 122,
PLOC_MEMORY_DUMPER = 123,
PDEC_HANDLER = 124,
STR_HELPER = 125,
PLOC_MPSOC_HELPER = 126,
PL_PCDU_HANDLER = 127,
ACS_BOARD_ASS = 128,
SUS_BOARD_ASS = 129,
TCS_BOARD_ASS = 130,
GPS_HANDLER = 131,
P60_DOCK_HANDLER = 132,
PDU1_HANDLER = 133,
PDU2_HANDLER = 134,
ACU_HANDLER = 135,
COMMON_SUBSYSTEM_ID_END
};
}

View File

@ -3,6 +3,7 @@
#include <cstdint>
#include <fsfw_hal/linux/spi/spiDefinitions.h>
#include <fsfw_hal/linux/uart/UartCookie.h>
/**
* SPI configuration will be contained here to let the device handlers remain independent
@ -28,6 +29,7 @@ static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3;
* the decoder and buffer circuits. Thus frequency is here defined to 1 MHz.
*/
static const uint32_t SUS_MAX1227_SPI_FREQ = 976'000;
static constexpr spi::SpiModes SUS_MAX_1227_MODE = spi::SpiModes::MODE_3;
static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 976'000;
static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_3;
@ -48,11 +50,11 @@ static constexpr spi::SpiModes RTD_MODE = spi::SpiModes::MODE_3;
namespace uart {
static constexpr size_t HYPERION_GPS_REPLY_MAX_BUFFER = 1024;
static constexpr uint32_t SYRLINKS_BAUD = 38400;
static constexpr uint32_t GNSS_BAUD = 9600;
static constexpr uint32_t PLOC_MPSOC_BAUD = 921600;
static constexpr uint32_t PLOC_SUPERVISOR_BAUD = 115200;
static constexpr uint32_t STAR_TRACKER_BAUD = 921600;
static constexpr UartBaudRate SYRLINKS_BAUD = UartBaudRate::RATE_38400;
static constexpr UartBaudRate GNSS_BAUD = UartBaudRate::RATE_9600;
static constexpr UartBaudRate PLOC_MPSOC_BAUD = UartBaudRate::RATE_115200;
static constexpr UartBaudRate PLOC_SUPERVISOR_BAUD = UartBaudRate::RATE_115200;
static constexpr UartBaudRate STAR_TRACKER_BAUD = UartBaudRate::RATE_921600;
}

View File

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

View File

@ -1,60 +1,6 @@
#ifndef FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_
#define FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_
#include "OBSWConfig.h"
#include <cstdint>
namespace pcduSwitches {
/* Switches are uint8_t datatype and go from 0 to 255 */
enum SwitcherList: uint8_t {
Q7S,
PAYLOAD_PCDU_CH1,
RW,
TCS_BOARD_8V_HEATER_IN,
SUS_REDUNDANT,
DEPLOYMENT_MECHANISM,
PAYLOAD_PCDU_CH6,
ACS_BOARD_SIDE_B,
PAYLOAD_CAMERA,
TCS_BOARD_3V3,
SYRLINKS,
STAR_TRACKER,
MGT,
SUS_NOMINAL,
SOLAR_CELL_EXP,
PLOC,
ACS_BOARD_SIDE_A,
NUMBER_OF_SWITCHES
};
static const uint8_t ON = 1;
static const uint8_t OFF = 0;
/* Output states after reboot of the PDUs */
static const uint8_t INIT_STATE_Q7S = ON;
static const uint8_t INIT_STATE_PAYLOAD_PCDU_CH1 = OFF;
static const uint8_t INIT_STATE_RW = OFF;
#if BOARD_TE0720 == 1
/* Because the TE0720 is not connected to the PCDU, this switch is always on */
static const uint8_t INIT_STATE_TCS_BOARD_8V_HEATER_IN = ON;
#else
static const uint8_t INIT_STATE_TCS_BOARD_8V_HEATER_IN = OFF;
#endif
static const uint8_t INIT_STATE_SUS_REDUNDANT = OFF;
static const uint8_t INIT_STATE_DEPLOYMENT_MECHANISM = OFF;
static const uint8_t INIT_STATE_PAYLOAD_PCDU_CH6 = OFF;
static const uint8_t INIT_STATE_ACS_BOARD_SIDE_B = OFF;
static const uint8_t INIT_STATE_PAYLOAD_CAMERA = OFF;
static const uint8_t INIT_STATE_TCS_BOARD_3V3 = OFF;
static const uint8_t INIT_STATE_SYRLINKS = OFF;
static const uint8_t INIT_STATE_STAR_TRACKER = OFF;
static const uint8_t INIT_STATE_MGT = OFF;
static const uint8_t INIT_STATE_SUS_NOMINAL = OFF;
static const uint8_t INIT_STATE_SOLAR_CELL_EXP = OFF;
static const uint8_t INIT_STATE_PLOC = OFF;
static const uint8_t INIT_STATE_ACS_BOARD_SIDE_A = OFF;
}
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
#endif /* FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ */

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 47d158156b9efa0edbca9b3a1694f4132b0b30e5
Subproject commit 613dbe9592c30d9acf4cdb95d81d9f216f07374b

View File

@ -1 +1,2 @@
.~lock*
/venv

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/fsfwgen.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/gen.py" />
<option name="PARAMETERS" value="events" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/fsfwgen.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/gen.py" />
<option name="PARAMETERS" value="objects" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />

View File

@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/fsfwgen.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/gen.py" />
<option name="PARAMETERS" value="returnvalues" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />

View File

@ -77,65 +77,110 @@
8901;0x22c5;CLOCK_SET_FAILURE;LOW;;fsfw/src/fsfw/pus/Service9TimeManagement.h
9700;0x25e4;TEST;INFO;;fsfw/src/fsfw/pus/Service17Test.h
10600;0x2968;CHANGE_OF_SETUP_PARAMETER;LOW;;fsfw/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h
10900;0x2a94;GPIO_PULL_HIGH_FAILED;LOW;;mission/devices/HeaterHandler.h
10901;0x2a95;GPIO_PULL_LOW_FAILED;LOW;;mission/devices/HeaterHandler.h
10902;0x2a96;SWITCH_ALREADY_ON;LOW;;mission/devices/HeaterHandler.h
10903;0x2a97;SWITCH_ALREADY_OFF;LOW;;mission/devices/HeaterHandler.h
10904;0x2a98;MAIN_SWITCH_TIMEOUT;LOW;;mission/devices/HeaterHandler.h
11000;0x2af8;MAIN_SWITCH_ON_TIMEOUT;LOW;;mission/devices/SolarArrayDeploymentHandler.h
11001;0x2af9;MAIN_SWITCH_OFF_TIMEOUT;LOW;;mission/devices/SolarArrayDeploymentHandler.h
11002;0x2afa;DEPLOYMENT_FAILED;HIGH;;mission/devices/SolarArrayDeploymentHandler.h
11003;0x2afb;DEPL_SA1_GPIO_SWTICH_ON_FAILED;HIGH;;mission/devices/SolarArrayDeploymentHandler.h
11004;0x2afc;DEPL_SA2_GPIO_SWTICH_ON_FAILED;HIGH;;mission/devices/SolarArrayDeploymentHandler.h
11101;0x2b5d;MEMORY_READ_RPT_CRC_FAILURE;LOW;;mission/devices/PlocMPSoCHandler.h
11102;0x2b5e;ACK_FAILURE;LOW;;mission/devices/PlocMPSoCHandler.h
11103;0x2b5f;EXE_FAILURE;LOW;;mission/devices/PlocMPSoCHandler.h
11104;0x2b60;CRC_FAILURE_EVENT;LOW;;mission/devices/PlocMPSoCHandler.h
11201;0x2bc1;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11202;0x2bc2;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11203;0x2bc3;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11204;0x2bc4;SELF_TEST_PWM_FAILURE;LOW;Get self test result returns PWM failure which concerns the coil actuation. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11205;0x2bc5;SELF_TEST_TC_FAILURE;LOW;Get self test result returns TC failure (system failure) P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11206;0x2bc6;SELF_TEST_MTM_RANGE_FAILURE;LOW;Get self test result returns failure that MTM values were outside of the expected range. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11207;0x2bc7;SELF_TEST_COIL_CURRENT_FAILURE;LOW;Get self test result returns failure indicating that the coil current was outside of the expected range P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11208;0x2bc8;INVALID_ERROR_BYTE;LOW;Received invalid error byte. This indicates an error of the communication link between IMTQ and OBC.;mission/devices/IMTQHandler.h
11301;0x2c25;ERROR_STATE;HIGH;Reaction wheel signals an error state;mission/devices/RwHandler.h
11401;0x2c89;BOOTING_FIRMWARE_FAILED;LOW;Failed to boot firmware;linux/devices/startracker/StarTrackerHandler.h
11402;0x2c8a;BOOTING_BOOTLOADER_FAILED;LOW;Failed to boot star tracker into bootloader mode;linux/devices/startracker/StarTrackerHandler.h
11501;0x2ced;SUPV_MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC supervisor crc failure in telemetry packet;bsp_q7s/devices/PlocSupervisorHandler.h
11502;0x2cee;SUPV_ACK_FAILURE;LOW;PLOC supervisor received acknowledgment failure report;bsp_q7s/devices/PlocSupervisorHandler.h
11503;0x2cef;SUPV_EXE_FAILURE;LOW;PLOC received execution failure report;bsp_q7s/devices/PlocSupervisorHandler.h
11504;0x2cf0;SUPV_CRC_FAILURE_EVENT;LOW;PLOC supervisor reply has invalid crc;bsp_q7s/devices/PlocSupervisorHandler.h
11600;0x2d50;ALLOC_FAILURE;MEDIUM;;bsp_q7s/core/CoreController.h
11601;0x2d51;REBOOT_SW;MEDIUM; Software reboot occured. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy;bsp_q7s/core/CoreController.h
11603;0x2d53;REBOOT_HW;MEDIUM;;bsp_q7s/core/CoreController.h
11700;0x2db4;UPDATE_FILE_NOT_EXISTS;LOW;;bsp_q7s/devices/PlocUpdater.h
11701;0x2db5;ACTION_COMMANDING_FAILED;LOW;Failed to send command to supervisor handler P1: Return value of CommandActionHelper::commandAction P2: Action ID of command to send;bsp_q7s/devices/PlocUpdater.h
11702;0x2db6;UPDATE_AVAILABLE_FAILED;LOW;Supervisor handler replied action message indicating a command execution failure of the update available command;bsp_q7s/devices/PlocUpdater.h
11703;0x2db7;UPDATE_TRANSFER_FAILED;LOW;Supervisor handler failed to transfer an update space packet. P1: Parameter holds the number of update packets already sent (inclusive the failed packet);bsp_q7s/devices/PlocUpdater.h
11704;0x2db8;UPDATE_VERIFY_FAILED;LOW;Supervisor failed to execute the update verify command.;bsp_q7s/devices/PlocUpdater.h
11705;0x2db9;UPDATE_FINISHED;INFO;MPSoC update successful completed;bsp_q7s/devices/PlocUpdater.h
11800;0x2e18;SEND_MRAM_DUMP_FAILED;LOW;Failed to send mram dump command to supervisor handler P1: Return value of commandAction function P2: Start address of MRAM to dump with this command;bsp_q7s/devices/PlocMemoryDumper.h
11801;0x2e19;MRAM_DUMP_FAILED;LOW;Received completion failure report form PLOC supervisor handler P1: MRAM start address of failing dump command;bsp_q7s/devices/PlocMemoryDumper.h
11802;0x2e1a;MRAM_DUMP_FINISHED;LOW;MRAM dump finished successfully;bsp_q7s/devices/PlocMemoryDumper.h
11901;0x2e7d;INVALID_TC_FRAME;HIGH;;linux/obc/PdecHandler.h
11902;0x2e7e;INVALID_FAR;HIGH;Read invalid FAR from PDEC after startup;linux/obc/PdecHandler.h
11903;0x2e7f;CARRIER_LOCK;INFO;Carrier lock detected;linux/obc/PdecHandler.h
11904;0x2e80;BIT_LOCK_PDEC;INFO;Bit lock detected (data valid);linux/obc/PdecHandler.h
12000;0x2ee0;IMAGE_UPLOAD_FAILED;LOW;Image upload failed;linux/devices/startracker/StrHelper.h
12001;0x2ee1;IMAGE_DOWNLOAD_FAILED;LOW;Image download failed;linux/devices/startracker/StrHelper.h
12002;0x2ee2;IMAGE_UPLOAD_SUCCESSFUL;LOW;Uploading image to star tracker was successfulop;linux/devices/startracker/StrHelper.h
12003;0x2ee3;IMAGE_DOWNLOAD_SUCCESSFUL;LOW;Image download was successful;linux/devices/startracker/StrHelper.h
12004;0x2ee4;FLASH_WRITE_SUCCESSFUL;LOW;Finished flash write procedure successfully;linux/devices/startracker/StrHelper.h
12005;0x2ee5;FLASH_READ_SUCCESSFUL;LOW;Finished flash read procedure successfully;linux/devices/startracker/StrHelper.h
12006;0x2ee6;FLASH_READ_FAILED;LOW;Flash read procedure failed;linux/devices/startracker/StrHelper.h
12007;0x2ee7;FIRMWARE_UPDATE_SUCCESSFUL;LOW;Firmware update was successful;linux/devices/startracker/StrHelper.h
12008;0x2ee8;FIRMWARE_UPDATE_FAILED;LOW;Firmware update failed;linux/devices/startracker/StrHelper.h
12009;0x2ee9;STR_HELPER_READING_REPLY_FAILED;LOW;Failed to read communication interface reply data P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed;linux/devices/startracker/StrHelper.h
12010;0x2eea;STR_HELPER_COM_ERROR;LOW;Unexpected stop of decoding sequence P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed;linux/devices/startracker/StrHelper.h
12011;0x2eeb;STR_HELPER_NO_REPLY;LOW;Star tracker did not send replies (maybe device is powered off) P1: Position of upload or download packet for which no reply was sent;linux/devices/startracker/StrHelper.h
12012;0x2eec;STR_HELPER_DEC_ERROR;LOW;Error during decoding of received reply occurred P1: Return value of decoding function P2: Position of upload/download packet, or address of flash write/read request;linux/devices/startracker/StrHelper.h
12013;0x2eed;POSITION_MISMATCH;LOW;Position mismatch P1: The expected position and thus the position for which the image upload/download failed;linux/devices/startracker/StrHelper.h
12014;0x2eee;STR_HELPER_FILE_NOT_EXISTS;LOW;Specified file does not exist P1: Internal state of str helper;linux/devices/startracker/StrHelper.h
12015;0x2eef;STR_HELPER_SENDING_PACKET_FAILED;LOW;;linux/devices/startracker/StrHelper.h
12016;0x2ef0;STR_HELPER_REQUESTING_MSG_FAILED;LOW;;linux/devices/startracker/StrHelper.h
11300;0x2c24;SWITCH_CMD_SENT;INFO;Indicates that a FSFW object requested setting a switch P1: 1 if on was requested, 0 for off | P2: Switch Index;mission/devices/devicedefinitions/powerDefinitions.h
11301;0x2c25;SWITCH_HAS_CHANGED;INFO;Indicated that a swithc state has changed P1: New switch state, 1 for on, 0 for off | P2: Switch Index;mission/devices/devicedefinitions/powerDefinitions.h
11302;0x2c26;SWITCHING_Q7S_DENIED;MEDIUM;;mission/devices/devicedefinitions/powerDefinitions.h
11400;0x2c88;GPIO_PULL_HIGH_FAILED;LOW;;mission/devices/HeaterHandler.h
11401;0x2c89;GPIO_PULL_LOW_FAILED;LOW;;mission/devices/HeaterHandler.h
11402;0x2c8a;SWITCH_ALREADY_ON;LOW;;mission/devices/HeaterHandler.h
11403;0x2c8b;SWITCH_ALREADY_OFF;LOW;;mission/devices/HeaterHandler.h
11404;0x2c8c;MAIN_SWITCH_TIMEOUT;LOW;;mission/devices/HeaterHandler.h
11500;0x2cec;MAIN_SWITCH_ON_TIMEOUT;LOW;;mission/devices/SolarArrayDeploymentHandler.h
11501;0x2ced;MAIN_SWITCH_OFF_TIMEOUT;LOW;;mission/devices/SolarArrayDeploymentHandler.h
11502;0x2cee;DEPLOYMENT_FAILED;HIGH;;mission/devices/SolarArrayDeploymentHandler.h
11503;0x2cef;DEPL_SA1_GPIO_SWTICH_ON_FAILED;HIGH;;mission/devices/SolarArrayDeploymentHandler.h
11504;0x2cf0;DEPL_SA2_GPIO_SWTICH_ON_FAILED;HIGH;;mission/devices/SolarArrayDeploymentHandler.h
11601;0x2d51;MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC crc failure in telemetry packet;linux/devices/ploc/PlocMPSoCHandler.h
11602;0x2d52;ACK_FAILURE;LOW;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;linux/devices/ploc/PlocMPSoCHandler.h
11603;0x2d53;EXE_FAILURE;LOW;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;linux/devices/ploc/PlocMPSoCHandler.h
11604;0x2d54;MPSOC_HANDLER_CRC_FAILURE;LOW;PLOC reply has invalid crc;linux/devices/ploc/PlocMPSoCHandler.h
11605;0x2d55;MPSOC_HANDLER_SEQ_CNT_MISMATCH;LOW;Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count;linux/devices/ploc/PlocMPSoCHandler.h
11606;0x2d56;MPSOC_SHUTDOWN_FAILED;HIGH;Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor.;linux/devices/ploc/PlocMPSoCHandler.h
11701;0x2db5;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11702;0x2db6;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11703;0x2db7;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11704;0x2db8;SELF_TEST_PWM_FAILURE;LOW;Get self test result returns PWM failure which concerns the coil actuation. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11705;0x2db9;SELF_TEST_TC_FAILURE;LOW;Get self test result returns TC failure (system failure) P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11706;0x2dba;SELF_TEST_MTM_RANGE_FAILURE;LOW;Get self test result returns failure that MTM values were outside of the expected range. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11707;0x2dbb;SELF_TEST_COIL_CURRENT_FAILURE;LOW;Get self test result returns failure indicating that the coil current was outside of the expected range P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11708;0x2dbc;INVALID_ERROR_BYTE;LOW;Received invalid error byte. This indicates an error of the communication link between IMTQ and OBC.;mission/devices/IMTQHandler.h
11801;0x2e19;ERROR_STATE;HIGH;Reaction wheel signals an error state;mission/devices/RwHandler.h
11901;0x2e7d;BOOTING_FIRMWARE_FAILED;LOW;Failed to boot firmware;linux/devices/startracker/StarTrackerHandler.h
11902;0x2e7e;BOOTING_BOOTLOADER_FAILED;LOW;Failed to boot star tracker into bootloader mode;linux/devices/startracker/StarTrackerHandler.h
12001;0x2ee1;SUPV_MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC supervisor crc failure in telemetry packet;linux/devices/ploc/PlocSupervisorHandler.h
12002;0x2ee2;SUPV_ACK_FAILURE;LOW;PLOC supervisor received acknowledgment failure report;linux/devices/ploc/PlocSupervisorHandler.h
12003;0x2ee3;SUPV_EXE_FAILURE;LOW;PLOC received execution failure report;linux/devices/ploc/PlocSupervisorHandler.h
12004;0x2ee4;SUPV_CRC_FAILURE_EVENT;LOW;PLOC supervisor reply has invalid crc;linux/devices/ploc/PlocSupervisorHandler.h
12100;0x2f44;SANITIZATION_FAILED;LOW;;bsp_q7s/memory/SdCardManager.h
12101;0x2f45;MOUNTED_SD_CARD;INFO;;bsp_q7s/memory/SdCardManager.h
12200;0x2fa8;UPDATE_FILE_NOT_EXISTS;LOW;;linux/devices/ploc/PlocUpdater.h
12201;0x2fa9;ACTION_COMMANDING_FAILED;LOW;Failed to send command to supervisor handler P1: Return value of CommandActionHelper::commandAction P2: Action ID of command to send;linux/devices/ploc/PlocUpdater.h
12202;0x2faa;UPDATE_AVAILABLE_FAILED;LOW;Supervisor handler replied action message indicating a command execution failure of the update available command;linux/devices/ploc/PlocUpdater.h
12203;0x2fab;UPDATE_TRANSFER_FAILED;LOW;Supervisor handler failed to transfer an update space packet. P1: Parameter holds the number of update packets already sent (inclusive the failed packet);linux/devices/ploc/PlocUpdater.h
12204;0x2fac;UPDATE_VERIFY_FAILED;LOW;Supervisor failed to execute the update verify command.;linux/devices/ploc/PlocUpdater.h
12205;0x2fad;UPDATE_FINISHED;INFO;MPSoC update successful completed;linux/devices/ploc/PlocUpdater.h
12300;0x300c;SEND_MRAM_DUMP_FAILED;LOW;Failed to send mram dump command to supervisor handler P1: Return value of commandAction function P2: Start address of MRAM to dump with this command;linux/devices/ploc/PlocMemoryDumper.h
12301;0x300d;MRAM_DUMP_FAILED;LOW;Received completion failure report form PLOC supervisor handler P1: MRAM start address of failing dump command;linux/devices/ploc/PlocMemoryDumper.h
12302;0x300e;MRAM_DUMP_FINISHED;LOW;MRAM dump finished successfully;linux/devices/ploc/PlocMemoryDumper.h
12401;0x3071;INVALID_TC_FRAME;HIGH;;linux/obc/PdecHandler.h
12402;0x3072;INVALID_FAR;HIGH;Read invalid FAR from PDEC after startup;linux/obc/PdecHandler.h
12403;0x3073;CARRIER_LOCK;INFO;Carrier lock detected;linux/obc/PdecHandler.h
12404;0x3074;BIT_LOCK_PDEC;INFO;Bit lock detected (data valid);linux/obc/PdecHandler.h
12500;0x30d4;IMAGE_UPLOAD_FAILED;LOW;Image upload failed;linux/devices/startracker/StrHelper.h
12501;0x30d5;IMAGE_DOWNLOAD_FAILED;LOW;Image download failed;linux/devices/startracker/StrHelper.h
12502;0x30d6;IMAGE_UPLOAD_SUCCESSFUL;LOW;Uploading image to star tracker was successfulop;linux/devices/startracker/StrHelper.h
12503;0x30d7;IMAGE_DOWNLOAD_SUCCESSFUL;LOW;Image download was successful;linux/devices/startracker/StrHelper.h
12504;0x30d8;FLASH_WRITE_SUCCESSFUL;LOW;Finished flash write procedure successfully;linux/devices/startracker/StrHelper.h
12505;0x30d9;FLASH_READ_SUCCESSFUL;LOW;Finished flash read procedure successfully;linux/devices/startracker/StrHelper.h
12506;0x30da;FLASH_READ_FAILED;LOW;Flash read procedure failed;linux/devices/startracker/StrHelper.h
12507;0x30db;FIRMWARE_UPDATE_SUCCESSFUL;LOW;Firmware update was successful;linux/devices/startracker/StrHelper.h
12508;0x30dc;FIRMWARE_UPDATE_FAILED;LOW;Firmware update failed;linux/devices/startracker/StrHelper.h
12509;0x30dd;STR_HELPER_READING_REPLY_FAILED;LOW;Failed to read communication interface reply data P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed;linux/devices/startracker/StrHelper.h
12510;0x30de;STR_HELPER_COM_ERROR;LOW;Unexpected stop of decoding sequence P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed;linux/devices/startracker/StrHelper.h
12511;0x30df;STR_HELPER_NO_REPLY;LOW;Star tracker did not send replies (maybe device is powered off) P1: Position of upload or download packet for which no reply was sent;linux/devices/startracker/StrHelper.h
12512;0x30e0;STR_HELPER_DEC_ERROR;LOW;Error during decoding of received reply occurred P1: Return value of decoding function P2: Position of upload/download packet, or address of flash write/read request;linux/devices/startracker/StrHelper.h
12513;0x30e1;POSITION_MISMATCH;LOW;Position mismatch P1: The expected position and thus the position for which the image upload/download failed;linux/devices/startracker/StrHelper.h
12514;0x30e2;STR_HELPER_FILE_NOT_EXISTS;LOW;Specified file does not exist P1: Internal state of str helper;linux/devices/startracker/StrHelper.h
12515;0x30e3;STR_HELPER_SENDING_PACKET_FAILED;LOW;;linux/devices/startracker/StrHelper.h
12516;0x30e4;STR_HELPER_REQUESTING_MSG_FAILED;LOW;;linux/devices/startracker/StrHelper.h
12600;0x3138;MPSOC_FLASH_WRITE_FAILED;LOW;Flash write fails;linux/devices/ploc/PlocMPSoCHelper.h
12601;0x3139;MPSOC_FLASH_WRITE_SUCCESSFUL;LOW;Flash write successful;linux/devices/ploc/PlocMPSoCHelper.h
12602;0x313a;SENDING_COMMAND_FAILED;LOW;;linux/devices/ploc/PlocMPSoCHelper.h
12603;0x313b;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
12604;0x313c;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
12605;0x313d;MISSING_ACK;LOW;Did not receive acknowledgement report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h
12606;0x313e;MISSING_EXE;LOW;Did not receive execution report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h
12607;0x313f;ACK_FAILURE_REPORT;LOW;Received acknowledgement failure report P1: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h
12608;0x3140;EXE_FAILURE_REPORT;LOW;Received execution failure report P1: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h
12609;0x3141;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
12610;0x3142;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
12611;0x3143;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
12700;0x319c;TRANSITION_BACK_TO_OFF;MEDIUM;Could not transition properly and went back to ALL OFF;mission/devices/PayloadPcduHandler.h
12701;0x319d;NEG_V_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
12702;0x319e;U_DRO_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
12703;0x319f;I_DRO_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
12704;0x31a0;U_X8_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
12705;0x31a1;I_X8_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
12706;0x31a2;U_TX_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
12707;0x31a3;I_TX_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
12708;0x31a4;U_MPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
12709;0x31a5;I_MPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
12710;0x31a6;U_HPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
12711;0x31a7;I_HPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
12800;0x3200;TRANSITION_OTHER_SIDE_FAILED;HIGH;;mission/system/AcsBoardAssembly.h
12801;0x3201;NOT_ENOUGH_DEVICES_DUAL_MODE;HIGH;;mission/system/AcsBoardAssembly.h
12802;0x3202;POWER_STATE_MACHINE_TIMEOUT;MEDIUM;;mission/system/AcsBoardAssembly.h
12803;0x3203;SIDE_SWITCH_TRANSITION_NOT_ALLOWED;LOW;Not implemented, would increase already high complexity. Operator should instead command the assembly off first and then command the assembly on into the desired mode/submode combination;mission/system/AcsBoardAssembly.h
12900;0x3264;TRANSITION_OTHER_SIDE_FAILED;HIGH;;mission/system/SusAssembly.h
12901;0x3265;NOT_ENOUGH_DEVICES_DUAL_MODE;HIGH;;mission/system/SusAssembly.h
12902;0x3266;POWER_STATE_MACHINE_TIMEOUT;MEDIUM;;mission/system/SusAssembly.h
12903;0x3267;SIDE_SWITCH_TRANSITION_NOT_ALLOWED;LOW;Not implemented, would increase already high complexity. Operator should instead command the assembly off first and then command the assembly on into the desired mode/submode combination;mission/system/SusAssembly.h
13000;0x32c8;CHILDREN_LOST_MODE;MEDIUM;;mission/system/TcsBoardAssembly.h
13100;0x332c;GPS_FIX_CHANGE;INFO;Fix has changed. P1: Old fix. P2: New fix 0: Not seen, 1: No Fix, 2: 2D-Fix, 3: 3D-Fix;mission/devices/devicedefinitions/GPSDefinitions.h
13200;0x3390;P60_BOOT_COUNT;INFO;P60 boot count is broadcasted once at SW startup. P1: Boot count;mission/devices/P60DockHandler.h
13201;0x3391;BATT_MODE;INFO;Battery mode is broadcasted at startup. P1: Mode;mission/devices/P60DockHandler.h
13202;0x3392;BATT_MODE_CHANGED;MEDIUM;Battery mode has changed. P1: Old mode. P2: New mode;mission/devices/P60DockHandler.h
13600;0x3520;ALLOC_FAILURE;MEDIUM;;bsp_q7s/core/CoreController.h
13601;0x3521;REBOOT_SW;MEDIUM; Software reboot occured. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy;bsp_q7s/core/CoreController.h
13602;0x3522;REBOOT_MECHANISM_TRIGGERED;MEDIUM;The reboot mechanism was triggered. P1: First 16 bits: Last Chip, Last 16 bits: Last Copy, P2: Each byte is the respective reboot count for the slots;bsp_q7s/core/CoreController.h
13603;0x3523;REBOOT_HW;MEDIUM;;bsp_q7s/core/CoreController.h

1 2200 0x0898 STORE_SEND_WRITE_FAILED LOW fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
77 8901 0x22c5 CLOCK_SET_FAILURE LOW fsfw/src/fsfw/pus/Service9TimeManagement.h
78 9700 0x25e4 TEST INFO fsfw/src/fsfw/pus/Service17Test.h
79 10600 0x2968 CHANGE_OF_SETUP_PARAMETER LOW fsfw/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h
80 10900 11300 0x2a94 0x2c24 GPIO_PULL_HIGH_FAILED SWITCH_CMD_SENT LOW INFO Indicates that a FSFW object requested setting a switch P1: 1 if on was requested, 0 for off | P2: Switch Index mission/devices/HeaterHandler.h mission/devices/devicedefinitions/powerDefinitions.h
81 10901 11301 0x2a95 0x2c25 GPIO_PULL_LOW_FAILED SWITCH_HAS_CHANGED LOW INFO Indicated that a swithc state has changed P1: New switch state, 1 for on, 0 for off | P2: Switch Index mission/devices/HeaterHandler.h mission/devices/devicedefinitions/powerDefinitions.h
82 10902 11302 0x2a96 0x2c26 SWITCH_ALREADY_ON SWITCHING_Q7S_DENIED LOW MEDIUM mission/devices/HeaterHandler.h mission/devices/devicedefinitions/powerDefinitions.h
83 10903 11400 0x2a97 0x2c88 SWITCH_ALREADY_OFF GPIO_PULL_HIGH_FAILED LOW mission/devices/HeaterHandler.h
84 10904 11401 0x2a98 0x2c89 MAIN_SWITCH_TIMEOUT GPIO_PULL_LOW_FAILED LOW mission/devices/HeaterHandler.h
85 11000 11402 0x2af8 0x2c8a MAIN_SWITCH_ON_TIMEOUT SWITCH_ALREADY_ON LOW mission/devices/SolarArrayDeploymentHandler.h mission/devices/HeaterHandler.h
86 11001 11403 0x2af9 0x2c8b MAIN_SWITCH_OFF_TIMEOUT SWITCH_ALREADY_OFF LOW mission/devices/SolarArrayDeploymentHandler.h mission/devices/HeaterHandler.h
87 11002 11404 0x2afa 0x2c8c DEPLOYMENT_FAILED MAIN_SWITCH_TIMEOUT HIGH LOW mission/devices/SolarArrayDeploymentHandler.h mission/devices/HeaterHandler.h
88 11003 11500 0x2afb 0x2cec DEPL_SA1_GPIO_SWTICH_ON_FAILED MAIN_SWITCH_ON_TIMEOUT HIGH LOW mission/devices/SolarArrayDeploymentHandler.h
89 11004 11501 0x2afc 0x2ced DEPL_SA2_GPIO_SWTICH_ON_FAILED MAIN_SWITCH_OFF_TIMEOUT HIGH LOW mission/devices/SolarArrayDeploymentHandler.h
90 11101 11502 0x2b5d 0x2cee MEMORY_READ_RPT_CRC_FAILURE DEPLOYMENT_FAILED LOW HIGH mission/devices/PlocMPSoCHandler.h mission/devices/SolarArrayDeploymentHandler.h
91 11102 11503 0x2b5e 0x2cef ACK_FAILURE DEPL_SA1_GPIO_SWTICH_ON_FAILED LOW HIGH mission/devices/PlocMPSoCHandler.h mission/devices/SolarArrayDeploymentHandler.h
92 11103 11504 0x2b5f 0x2cf0 EXE_FAILURE DEPL_SA2_GPIO_SWTICH_ON_FAILED LOW HIGH mission/devices/PlocMPSoCHandler.h mission/devices/SolarArrayDeploymentHandler.h
93 11104 11601 0x2b60 0x2d51 CRC_FAILURE_EVENT MEMORY_READ_RPT_CRC_FAILURE LOW PLOC crc failure in telemetry packet mission/devices/PlocMPSoCHandler.h linux/devices/ploc/PlocMPSoCHandler.h
94 11201 11602 0x2bc1 0x2d52 SELF_TEST_I2C_FAILURE ACK_FAILURE LOW Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA 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 mission/devices/IMTQHandler.h linux/devices/ploc/PlocMPSoCHandler.h
95 11202 11603 0x2bc2 0x2d53 SELF_TEST_SPI_FAILURE EXE_FAILURE LOW Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA 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 mission/devices/IMTQHandler.h linux/devices/ploc/PlocMPSoCHandler.h
96 11203 11604 0x2bc3 0x2d54 SELF_TEST_ADC_FAILURE MPSOC_HANDLER_CRC_FAILURE LOW Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA PLOC reply has invalid crc mission/devices/IMTQHandler.h linux/devices/ploc/PlocMPSoCHandler.h
97 11204 11605 0x2bc4 0x2d55 SELF_TEST_PWM_FAILURE MPSOC_HANDLER_SEQ_CNT_MISMATCH LOW Get self test result returns PWM failure which concerns the coil actuation. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count mission/devices/IMTQHandler.h linux/devices/ploc/PlocMPSoCHandler.h
98 11205 11606 0x2bc5 0x2d56 SELF_TEST_TC_FAILURE MPSOC_SHUTDOWN_FAILED LOW HIGH Get self test result returns TC failure (system failure) P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor. mission/devices/IMTQHandler.h linux/devices/ploc/PlocMPSoCHandler.h
99 11206 11701 0x2bc6 0x2db5 SELF_TEST_MTM_RANGE_FAILURE SELF_TEST_I2C_FAILURE LOW Get self test result returns failure that MTM values were outside of the expected range. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA mission/devices/IMTQHandler.h
100 11207 11702 0x2bc7 0x2db6 SELF_TEST_COIL_CURRENT_FAILURE SELF_TEST_SPI_FAILURE LOW Get self test result returns failure indicating that the coil current was outside of the expected range P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA mission/devices/IMTQHandler.h
101 11208 11703 0x2bc8 0x2db7 INVALID_ERROR_BYTE SELF_TEST_ADC_FAILURE LOW Received invalid error byte. This indicates an error of the communication link between IMTQ and OBC. Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA mission/devices/IMTQHandler.h
102 11301 11704 0x2c25 0x2db8 ERROR_STATE SELF_TEST_PWM_FAILURE HIGH LOW Reaction wheel signals an error state Get self test result returns PWM failure which concerns the coil actuation. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA mission/devices/RwHandler.h mission/devices/IMTQHandler.h
103 11401 11705 0x2c89 0x2db9 BOOTING_FIRMWARE_FAILED SELF_TEST_TC_FAILURE LOW Failed to boot firmware Get self test result returns TC failure (system failure) P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA linux/devices/startracker/StarTrackerHandler.h mission/devices/IMTQHandler.h
104 11402 11706 0x2c8a 0x2dba BOOTING_BOOTLOADER_FAILED SELF_TEST_MTM_RANGE_FAILURE LOW Failed to boot star tracker into bootloader mode Get self test result returns failure that MTM values were outside of the expected range. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA linux/devices/startracker/StarTrackerHandler.h mission/devices/IMTQHandler.h
105 11501 11707 0x2ced 0x2dbb SUPV_MEMORY_READ_RPT_CRC_FAILURE SELF_TEST_COIL_CURRENT_FAILURE LOW PLOC supervisor crc failure in telemetry packet Get self test result returns failure indicating that the coil current was outside of the expected range P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA bsp_q7s/devices/PlocSupervisorHandler.h mission/devices/IMTQHandler.h
106 11502 11708 0x2cee 0x2dbc SUPV_ACK_FAILURE INVALID_ERROR_BYTE LOW PLOC supervisor received acknowledgment failure report Received invalid error byte. This indicates an error of the communication link between IMTQ and OBC. bsp_q7s/devices/PlocSupervisorHandler.h mission/devices/IMTQHandler.h
107 11503 11801 0x2cef 0x2e19 SUPV_EXE_FAILURE ERROR_STATE LOW HIGH PLOC received execution failure report Reaction wheel signals an error state bsp_q7s/devices/PlocSupervisorHandler.h mission/devices/RwHandler.h
108 11504 11901 0x2cf0 0x2e7d SUPV_CRC_FAILURE_EVENT BOOTING_FIRMWARE_FAILED LOW PLOC supervisor reply has invalid crc Failed to boot firmware bsp_q7s/devices/PlocSupervisorHandler.h linux/devices/startracker/StarTrackerHandler.h
109 11600 11902 0x2d50 0x2e7e ALLOC_FAILURE BOOTING_BOOTLOADER_FAILED MEDIUM LOW Failed to boot star tracker into bootloader mode bsp_q7s/core/CoreController.h linux/devices/startracker/StarTrackerHandler.h
110 11601 12001 0x2d51 0x2ee1 REBOOT_SW SUPV_MEMORY_READ_RPT_CRC_FAILURE MEDIUM LOW Software reboot occured. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy PLOC supervisor crc failure in telemetry packet bsp_q7s/core/CoreController.h linux/devices/ploc/PlocSupervisorHandler.h
111 11603 12002 0x2d53 0x2ee2 REBOOT_HW SUPV_ACK_FAILURE MEDIUM LOW PLOC supervisor received acknowledgment failure report bsp_q7s/core/CoreController.h linux/devices/ploc/PlocSupervisorHandler.h
112 11700 12003 0x2db4 0x2ee3 UPDATE_FILE_NOT_EXISTS SUPV_EXE_FAILURE LOW PLOC received execution failure report bsp_q7s/devices/PlocUpdater.h linux/devices/ploc/PlocSupervisorHandler.h
113 11701 12004 0x2db5 0x2ee4 ACTION_COMMANDING_FAILED SUPV_CRC_FAILURE_EVENT LOW Failed to send command to supervisor handler P1: Return value of CommandActionHelper::commandAction P2: Action ID of command to send PLOC supervisor reply has invalid crc bsp_q7s/devices/PlocUpdater.h linux/devices/ploc/PlocSupervisorHandler.h
114 11702 12100 0x2db6 0x2f44 UPDATE_AVAILABLE_FAILED SANITIZATION_FAILED LOW Supervisor handler replied action message indicating a command execution failure of the update available command bsp_q7s/devices/PlocUpdater.h bsp_q7s/memory/SdCardManager.h
115 11703 12101 0x2db7 0x2f45 UPDATE_TRANSFER_FAILED MOUNTED_SD_CARD LOW INFO Supervisor handler failed to transfer an update space packet. P1: Parameter holds the number of update packets already sent (inclusive the failed packet) bsp_q7s/devices/PlocUpdater.h bsp_q7s/memory/SdCardManager.h
116 11704 12200 0x2db8 0x2fa8 UPDATE_VERIFY_FAILED UPDATE_FILE_NOT_EXISTS LOW Supervisor failed to execute the update verify command. bsp_q7s/devices/PlocUpdater.h linux/devices/ploc/PlocUpdater.h
117 11705 12201 0x2db9 0x2fa9 UPDATE_FINISHED ACTION_COMMANDING_FAILED INFO LOW MPSoC update successful completed Failed to send command to supervisor handler P1: Return value of CommandActionHelper::commandAction P2: Action ID of command to send bsp_q7s/devices/PlocUpdater.h linux/devices/ploc/PlocUpdater.h
118 11800 12202 0x2e18 0x2faa SEND_MRAM_DUMP_FAILED UPDATE_AVAILABLE_FAILED LOW Failed to send mram dump command to supervisor handler P1: Return value of commandAction function P2: Start address of MRAM to dump with this command Supervisor handler replied action message indicating a command execution failure of the update available command bsp_q7s/devices/PlocMemoryDumper.h linux/devices/ploc/PlocUpdater.h
119 11801 12203 0x2e19 0x2fab MRAM_DUMP_FAILED UPDATE_TRANSFER_FAILED LOW Received completion failure report form PLOC supervisor handler P1: MRAM start address of failing dump command Supervisor handler failed to transfer an update space packet. P1: Parameter holds the number of update packets already sent (inclusive the failed packet) bsp_q7s/devices/PlocMemoryDumper.h linux/devices/ploc/PlocUpdater.h
120 11802 12204 0x2e1a 0x2fac MRAM_DUMP_FINISHED UPDATE_VERIFY_FAILED LOW MRAM dump finished successfully Supervisor failed to execute the update verify command. bsp_q7s/devices/PlocMemoryDumper.h linux/devices/ploc/PlocUpdater.h
121 11901 12205 0x2e7d 0x2fad INVALID_TC_FRAME UPDATE_FINISHED HIGH INFO MPSoC update successful completed linux/obc/PdecHandler.h linux/devices/ploc/PlocUpdater.h
122 11902 12300 0x2e7e 0x300c INVALID_FAR SEND_MRAM_DUMP_FAILED HIGH LOW Read invalid FAR from PDEC after startup Failed to send mram dump command to supervisor handler P1: Return value of commandAction function P2: Start address of MRAM to dump with this command linux/obc/PdecHandler.h linux/devices/ploc/PlocMemoryDumper.h
123 11903 12301 0x2e7f 0x300d CARRIER_LOCK MRAM_DUMP_FAILED INFO LOW Carrier lock detected Received completion failure report form PLOC supervisor handler P1: MRAM start address of failing dump command linux/obc/PdecHandler.h linux/devices/ploc/PlocMemoryDumper.h
124 11904 12302 0x2e80 0x300e BIT_LOCK_PDEC MRAM_DUMP_FINISHED INFO LOW Bit lock detected (data valid) MRAM dump finished successfully linux/obc/PdecHandler.h linux/devices/ploc/PlocMemoryDumper.h
125 12000 12401 0x2ee0 0x3071 IMAGE_UPLOAD_FAILED INVALID_TC_FRAME LOW HIGH Image upload failed linux/devices/startracker/StrHelper.h linux/obc/PdecHandler.h
126 12001 12402 0x2ee1 0x3072 IMAGE_DOWNLOAD_FAILED INVALID_FAR LOW HIGH Image download failed Read invalid FAR from PDEC after startup linux/devices/startracker/StrHelper.h linux/obc/PdecHandler.h
127 12002 12403 0x2ee2 0x3073 IMAGE_UPLOAD_SUCCESSFUL CARRIER_LOCK LOW INFO Uploading image to star tracker was successfulop Carrier lock detected linux/devices/startracker/StrHelper.h linux/obc/PdecHandler.h
128 12003 12404 0x2ee3 0x3074 IMAGE_DOWNLOAD_SUCCESSFUL BIT_LOCK_PDEC LOW INFO Image download was successful Bit lock detected (data valid) linux/devices/startracker/StrHelper.h linux/obc/PdecHandler.h
129 12004 12500 0x2ee4 0x30d4 FLASH_WRITE_SUCCESSFUL IMAGE_UPLOAD_FAILED LOW Finished flash write procedure successfully Image upload failed linux/devices/startracker/StrHelper.h
130 12005 12501 0x2ee5 0x30d5 FLASH_READ_SUCCESSFUL IMAGE_DOWNLOAD_FAILED LOW Finished flash read procedure successfully Image download failed linux/devices/startracker/StrHelper.h
131 12006 12502 0x2ee6 0x30d6 FLASH_READ_FAILED IMAGE_UPLOAD_SUCCESSFUL LOW Flash read procedure failed Uploading image to star tracker was successfulop linux/devices/startracker/StrHelper.h
132 12007 12503 0x2ee7 0x30d7 FIRMWARE_UPDATE_SUCCESSFUL IMAGE_DOWNLOAD_SUCCESSFUL LOW Firmware update was successful Image download was successful linux/devices/startracker/StrHelper.h
133 12008 12504 0x2ee8 0x30d8 FIRMWARE_UPDATE_FAILED FLASH_WRITE_SUCCESSFUL LOW Firmware update failed Finished flash write procedure successfully linux/devices/startracker/StrHelper.h
134 12009 12505 0x2ee9 0x30d9 STR_HELPER_READING_REPLY_FAILED FLASH_READ_SUCCESSFUL LOW Failed to read communication interface reply data P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed Finished flash read procedure successfully linux/devices/startracker/StrHelper.h
135 12010 12506 0x2eea 0x30da STR_HELPER_COM_ERROR FLASH_READ_FAILED LOW Unexpected stop of decoding sequence P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed Flash read procedure failed linux/devices/startracker/StrHelper.h
136 12011 12507 0x2eeb 0x30db STR_HELPER_NO_REPLY FIRMWARE_UPDATE_SUCCESSFUL LOW Star tracker did not send replies (maybe device is powered off) P1: Position of upload or download packet for which no reply was sent Firmware update was successful linux/devices/startracker/StrHelper.h
137 12012 12508 0x2eec 0x30dc STR_HELPER_DEC_ERROR FIRMWARE_UPDATE_FAILED LOW Error during decoding of received reply occurred P1: Return value of decoding function P2: Position of upload/download packet, or address of flash write/read request Firmware update failed linux/devices/startracker/StrHelper.h
138 12013 12509 0x2eed 0x30dd POSITION_MISMATCH STR_HELPER_READING_REPLY_FAILED LOW Position mismatch P1: The expected position and thus the position for which the image upload/download failed Failed to read communication interface reply data P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed linux/devices/startracker/StrHelper.h
139 12014 12510 0x2eee 0x30de STR_HELPER_FILE_NOT_EXISTS STR_HELPER_COM_ERROR LOW Specified file does not exist P1: Internal state of str helper Unexpected stop of decoding sequence P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed linux/devices/startracker/StrHelper.h
140 12015 12511 0x2eef 0x30df STR_HELPER_SENDING_PACKET_FAILED STR_HELPER_NO_REPLY LOW Star tracker did not send replies (maybe device is powered off) P1: Position of upload or download packet for which no reply was sent linux/devices/startracker/StrHelper.h
141 12016 12512 0x2ef0 0x30e0 STR_HELPER_REQUESTING_MSG_FAILED STR_HELPER_DEC_ERROR LOW Error during decoding of received reply occurred P1: Return value of decoding function P2: Position of upload/download packet, or address of flash write/read request linux/devices/startracker/StrHelper.h
142 12513 0x30e1 POSITION_MISMATCH LOW Position mismatch P1: The expected position and thus the position for which the image upload/download failed linux/devices/startracker/StrHelper.h
143 12514 0x30e2 STR_HELPER_FILE_NOT_EXISTS LOW Specified file does not exist P1: Internal state of str helper linux/devices/startracker/StrHelper.h
144 12515 0x30e3 STR_HELPER_SENDING_PACKET_FAILED LOW linux/devices/startracker/StrHelper.h
145 12516 0x30e4 STR_HELPER_REQUESTING_MSG_FAILED LOW linux/devices/startracker/StrHelper.h
146 12600 0x3138 MPSOC_FLASH_WRITE_FAILED LOW Flash write fails linux/devices/ploc/PlocMPSoCHelper.h
147 12601 0x3139 MPSOC_FLASH_WRITE_SUCCESSFUL LOW Flash write successful linux/devices/ploc/PlocMPSoCHelper.h
148 12602 0x313a SENDING_COMMAND_FAILED LOW linux/devices/ploc/PlocMPSoCHelper.h
149 12603 0x313b 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
150 12604 0x313c 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
151 12605 0x313d MISSING_ACK LOW Did not receive acknowledgement report P1: Number of bytes missing P2: Internal state of MPSoC helper linux/devices/ploc/PlocMPSoCHelper.h
152 12606 0x313e MISSING_EXE LOW Did not receive execution report P1: Number of bytes missing P2: Internal state of MPSoC helper linux/devices/ploc/PlocMPSoCHelper.h
153 12607 0x313f ACK_FAILURE_REPORT LOW Received acknowledgement failure report P1: Internal state of MPSoC linux/devices/ploc/PlocMPSoCHelper.h
154 12608 0x3140 EXE_FAILURE_REPORT LOW Received execution failure report P1: Internal state of MPSoC linux/devices/ploc/PlocMPSoCHelper.h
155 12609 0x3141 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
156 12610 0x3142 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
157 12611 0x3143 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
158 12700 0x319c TRANSITION_BACK_TO_OFF MEDIUM Could not transition properly and went back to ALL OFF mission/devices/PayloadPcduHandler.h
159 12701 0x319d NEG_V_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/devices/PayloadPcduHandler.h
160 12702 0x319e U_DRO_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/devices/PayloadPcduHandler.h
161 12703 0x319f I_DRO_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/devices/PayloadPcduHandler.h
162 12704 0x31a0 U_X8_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/devices/PayloadPcduHandler.h
163 12705 0x31a1 I_X8_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/devices/PayloadPcduHandler.h
164 12706 0x31a2 U_TX_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/devices/PayloadPcduHandler.h
165 12707 0x31a3 I_TX_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/devices/PayloadPcduHandler.h
166 12708 0x31a4 U_MPA_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/devices/PayloadPcduHandler.h
167 12709 0x31a5 I_MPA_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/devices/PayloadPcduHandler.h
168 12710 0x31a6 U_HPA_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/devices/PayloadPcduHandler.h
169 12711 0x31a7 I_HPA_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/devices/PayloadPcduHandler.h
170 12800 0x3200 TRANSITION_OTHER_SIDE_FAILED HIGH mission/system/AcsBoardAssembly.h
171 12801 0x3201 NOT_ENOUGH_DEVICES_DUAL_MODE HIGH mission/system/AcsBoardAssembly.h
172 12802 0x3202 POWER_STATE_MACHINE_TIMEOUT MEDIUM mission/system/AcsBoardAssembly.h
173 12803 0x3203 SIDE_SWITCH_TRANSITION_NOT_ALLOWED LOW Not implemented, would increase already high complexity. Operator should instead command the assembly off first and then command the assembly on into the desired mode/submode combination mission/system/AcsBoardAssembly.h
174 12900 0x3264 TRANSITION_OTHER_SIDE_FAILED HIGH mission/system/SusAssembly.h
175 12901 0x3265 NOT_ENOUGH_DEVICES_DUAL_MODE HIGH mission/system/SusAssembly.h
176 12902 0x3266 POWER_STATE_MACHINE_TIMEOUT MEDIUM mission/system/SusAssembly.h
177 12903 0x3267 SIDE_SWITCH_TRANSITION_NOT_ALLOWED LOW Not implemented, would increase already high complexity. Operator should instead command the assembly off first and then command the assembly on into the desired mode/submode combination mission/system/SusAssembly.h
178 13000 0x32c8 CHILDREN_LOST_MODE MEDIUM mission/system/TcsBoardAssembly.h
179 13100 0x332c GPS_FIX_CHANGE INFO Fix has changed. P1: Old fix. P2: New fix 0: Not seen, 1: No Fix, 2: 2D-Fix, 3: 3D-Fix mission/devices/devicedefinitions/GPSDefinitions.h
180 13200 0x3390 P60_BOOT_COUNT INFO P60 boot count is broadcasted once at SW startup. P1: Boot count mission/devices/P60DockHandler.h
181 13201 0x3391 BATT_MODE INFO Battery mode is broadcasted at startup. P1: Mode mission/devices/P60DockHandler.h
182 13202 0x3392 BATT_MODE_CHANGED MEDIUM Battery mode has changed. P1: Old mode. P2: New mode mission/devices/P60DockHandler.h
183 13600 0x3520 ALLOC_FAILURE MEDIUM bsp_q7s/core/CoreController.h
184 13601 0x3521 REBOOT_SW MEDIUM Software reboot occured. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy bsp_q7s/core/CoreController.h
185 13602 0x3522 REBOOT_MECHANISM_TRIGGERED MEDIUM The reboot mechanism was triggered. P1: First 16 bits: Last Chip, Last 16 bits: Last Copy, P2: Each byte is the respective reboot count for the slots bsp_q7s/core/CoreController.h
186 13603 0x3523 REBOOT_HW MEDIUM bsp_q7s/core/CoreController.h

View File

@ -40,8 +40,10 @@
0x44330000;PLOC_UPDATER
0x44330001;PLOC_MEMORY_DUMPER
0x44330002;STR_HELPER
0x44330003;PLOC_MPSOC_HELPER
0x44330015;PLOC_MPSOC_HANDLER
0x44330016;PLOC_SUPERVISOR_HANDLER
0x44330017;PLOC_SUPERVISOR_HELPER
0x444100A2;SOLAR_ARRAY_DEPL_HANDLER
0x444100A4;HEATER_HANDLER
0x44420004;TMP1075_HANDLER_1
@ -107,6 +109,9 @@
0x5400CAFE;DUMMY_INTERFACE
0x54123456;LIBGPIOD_TEST
0x54694269;TEST_TASK
0x73000001;ACS_BOARD_ASS
0x73000002;SUS_BOARD_ASS
0x73000003;TCS_BOARD_ASS
0x73000100;TM_FUNNEL
0x73500000;CCSDS_IP_CORE_BRIDGE
0xFFFFFFFF;NO_OBJECT

1 0x00005060 P60DOCK_TEST_TASK
40 0x44330000 PLOC_UPDATER
41 0x44330001 PLOC_MEMORY_DUMPER
42 0x44330002 STR_HELPER
43 0x44330003 PLOC_MPSOC_HELPER
44 0x44330015 PLOC_MPSOC_HANDLER
45 0x44330016 PLOC_SUPERVISOR_HANDLER
46 0x44330017 PLOC_SUPERVISOR_HELPER
47 0x444100A2 SOLAR_ARRAY_DEPL_HANDLER
48 0x444100A4 HEATER_HANDLER
49 0x44420004 TMP1075_HANDLER_1
109 0x5400CAFE DUMMY_INTERFACE
110 0x54123456 LIBGPIOD_TEST
111 0x54694269 TEST_TASK
112 0x73000001 ACS_BOARD_ASS
113 0x73000002 SUS_BOARD_ASS
114 0x73000003 TCS_BOARD_ASS
115 0x73000100 TM_FUNNEL
116 0x73500000 CCSDS_IP_CORE_BRIDGE
117 0xFFFFFFFF NO_OBJECT

File diff suppressed because it is too large Load Diff

View File

@ -82,7 +82,10 @@ def parse_events(
handle_csv_export(
file_name=CSV_FILENAME, event_list=event_list, file_separator=FILE_SEPARATOR
)
copy_file(filename=CSV_FILENAME, destination=CSV_COPY_DEST, delete_existing_file=True)
LOGGER.info(f"Copying CSV file to {CSV_COPY_DEST}")
copy_file(
filename=CSV_FILENAME, destination=CSV_COPY_DEST, delete_existing_file=True
)
if generate_cpp:
handle_cpp_export(
@ -93,7 +96,7 @@ def parse_events(
header_file_name=CPP_H_FILENAME,
)
if COPY_CPP_FILE:
LOGGER.info(f"EventParser: Copying file to {CPP_COPY_DESTINATION}")
LOGGER.info(f"EventParser: Copying CPP translation file to {CPP_COPY_DESTINATION}")
copy_file(CPP_FILENAME, CPP_COPY_DESTINATION)
copy_file(CPP_H_FILENAME, CPP_COPY_DESTINATION)

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 141 translations.
* @brief Auto-generated event translation file. Contains 186 translations.
* @details
* Generated on: 2022-03-04 15:13:02
* Generated on: 2022-04-08 14:13:35
*/
#include "translateEvents.h"
@ -84,6 +84,9 @@ const char *CLOCK_SET_STRING = "CLOCK_SET";
const char *CLOCK_SET_FAILURE_STRING = "CLOCK_SET_FAILURE";
const char *TEST_STRING = "TEST";
const char *CHANGE_OF_SETUP_PARAMETER_STRING = "CHANGE_OF_SETUP_PARAMETER";
const char *SWITCH_CMD_SENT_STRING = "SWITCH_CMD_SENT";
const char *SWITCH_HAS_CHANGED_STRING = "SWITCH_HAS_CHANGED";
const char *SWITCHING_Q7S_DENIED_STRING = "SWITCHING_Q7S_DENIED";
const char *GPIO_PULL_HIGH_FAILED_STRING = "GPIO_PULL_HIGH_FAILED";
const char *GPIO_PULL_LOW_FAILED_STRING = "GPIO_PULL_LOW_FAILED";
const char *SWITCH_ALREADY_ON_STRING = "SWITCH_ALREADY_ON";
@ -97,7 +100,9 @@ const char *DEPL_SA2_GPIO_SWTICH_ON_FAILED_STRING = "DEPL_SA2_GPIO_SWTICH_ON_FAI
const char *MEMORY_READ_RPT_CRC_FAILURE_STRING = "MEMORY_READ_RPT_CRC_FAILURE";
const char *ACK_FAILURE_STRING = "ACK_FAILURE";
const char *EXE_FAILURE_STRING = "EXE_FAILURE";
const char *CRC_FAILURE_EVENT_STRING = "CRC_FAILURE_EVENT";
const char *MPSOC_HANDLER_CRC_FAILURE_STRING = "MPSOC_HANDLER_CRC_FAILURE";
const char *MPSOC_HANDLER_SEQ_CNT_MISMATCH_STRING = "MPSOC_HANDLER_SEQ_CNT_MISMATCH";
const char *MPSOC_SHUTDOWN_FAILED_STRING = "MPSOC_SHUTDOWN_FAILED";
const char *SELF_TEST_I2C_FAILURE_STRING = "SELF_TEST_I2C_FAILURE";
const char *SELF_TEST_SPI_FAILURE_STRING = "SELF_TEST_SPI_FAILURE";
const char *SELF_TEST_ADC_FAILURE_STRING = "SELF_TEST_ADC_FAILURE";
@ -113,9 +118,8 @@ const char *SUPV_MEMORY_READ_RPT_CRC_FAILURE_STRING = "SUPV_MEMORY_READ_RPT_CRC_
const char *SUPV_ACK_FAILURE_STRING = "SUPV_ACK_FAILURE";
const char *SUPV_EXE_FAILURE_STRING = "SUPV_EXE_FAILURE";
const char *SUPV_CRC_FAILURE_EVENT_STRING = "SUPV_CRC_FAILURE_EVENT";
const char *ALLOC_FAILURE_STRING = "ALLOC_FAILURE";
const char *REBOOT_SW_STRING = "REBOOT_SW";
const char *REBOOT_HW_STRING = "REBOOT_HW";
const char *SANITIZATION_FAILED_STRING = "SANITIZATION_FAILED";
const char *MOUNTED_SD_CARD_STRING = "MOUNTED_SD_CARD";
const char *UPDATE_FILE_NOT_EXISTS_STRING = "UPDATE_FILE_NOT_EXISTS";
const char *ACTION_COMMANDING_FAILED_STRING = "ACTION_COMMANDING_FAILED";
const char *UPDATE_AVAILABLE_FAILED_STRING = "UPDATE_AVAILABLE_FAILED";
@ -146,6 +150,43 @@ const char *POSITION_MISMATCH_STRING = "POSITION_MISMATCH";
const char *STR_HELPER_FILE_NOT_EXISTS_STRING = "STR_HELPER_FILE_NOT_EXISTS";
const char *STR_HELPER_SENDING_PACKET_FAILED_STRING = "STR_HELPER_SENDING_PACKET_FAILED";
const char *STR_HELPER_REQUESTING_MSG_FAILED_STRING = "STR_HELPER_REQUESTING_MSG_FAILED";
const char *MPSOC_FLASH_WRITE_FAILED_STRING = "MPSOC_FLASH_WRITE_FAILED";
const char *MPSOC_FLASH_WRITE_SUCCESSFUL_STRING = "MPSOC_FLASH_WRITE_SUCCESSFUL";
const char *SENDING_COMMAND_FAILED_STRING = "SENDING_COMMAND_FAILED";
const char *MPSOC_HELPER_REQUESTING_REPLY_FAILED_STRING = "MPSOC_HELPER_REQUESTING_REPLY_FAILED";
const char *MPSOC_HELPER_READING_REPLY_FAILED_STRING = "MPSOC_HELPER_READING_REPLY_FAILED";
const char *MISSING_ACK_STRING = "MISSING_ACK";
const char *MISSING_EXE_STRING = "MISSING_EXE";
const char *ACK_FAILURE_REPORT_STRING = "ACK_FAILURE_REPORT";
const char *EXE_FAILURE_REPORT_STRING = "EXE_FAILURE_REPORT";
const char *ACK_INVALID_APID_STRING = "ACK_INVALID_APID";
const char *EXE_INVALID_APID_STRING = "EXE_INVALID_APID";
const char *MPSOC_HELPER_SEQ_CNT_MISMATCH_STRING = "MPSOC_HELPER_SEQ_CNT_MISMATCH";
const char *TRANSITION_BACK_TO_OFF_STRING = "TRANSITION_BACK_TO_OFF";
const char *NEG_V_OUT_OF_BOUNDS_STRING = "NEG_V_OUT_OF_BOUNDS";
const char *U_DRO_OUT_OF_BOUNDS_STRING = "U_DRO_OUT_OF_BOUNDS";
const char *I_DRO_OUT_OF_BOUNDS_STRING = "I_DRO_OUT_OF_BOUNDS";
const char *U_X8_OUT_OF_BOUNDS_STRING = "U_X8_OUT_OF_BOUNDS";
const char *I_X8_OUT_OF_BOUNDS_STRING = "I_X8_OUT_OF_BOUNDS";
const char *U_TX_OUT_OF_BOUNDS_STRING = "U_TX_OUT_OF_BOUNDS";
const char *I_TX_OUT_OF_BOUNDS_STRING = "I_TX_OUT_OF_BOUNDS";
const char *U_MPA_OUT_OF_BOUNDS_STRING = "U_MPA_OUT_OF_BOUNDS";
const char *I_MPA_OUT_OF_BOUNDS_STRING = "I_MPA_OUT_OF_BOUNDS";
const char *U_HPA_OUT_OF_BOUNDS_STRING = "U_HPA_OUT_OF_BOUNDS";
const char *I_HPA_OUT_OF_BOUNDS_STRING = "I_HPA_OUT_OF_BOUNDS";
const char *TRANSITION_OTHER_SIDE_FAILED_STRING = "TRANSITION_OTHER_SIDE_FAILED";
const char *NOT_ENOUGH_DEVICES_DUAL_MODE_STRING = "NOT_ENOUGH_DEVICES_DUAL_MODE";
const char *POWER_STATE_MACHINE_TIMEOUT_STRING = "POWER_STATE_MACHINE_TIMEOUT";
const char *SIDE_SWITCH_TRANSITION_NOT_ALLOWED_STRING = "SIDE_SWITCH_TRANSITION_NOT_ALLOWED";
const char *CHILDREN_LOST_MODE_STRING = "CHILDREN_LOST_MODE";
const char *GPS_FIX_CHANGE_STRING = "GPS_FIX_CHANGE";
const char *P60_BOOT_COUNT_STRING = "P60_BOOT_COUNT";
const char *BATT_MODE_STRING = "BATT_MODE";
const char *BATT_MODE_CHANGED_STRING = "BATT_MODE_CHANGED";
const char *ALLOC_FAILURE_STRING = "ALLOC_FAILURE";
const char *REBOOT_SW_STRING = "REBOOT_SW";
const char *REBOOT_MECHANISM_TRIGGERED_STRING = "REBOOT_MECHANISM_TRIGGERED";
const char *REBOOT_HW_STRING = "REBOOT_HW";
const char *translateEvents(Event event) {
switch ((event & 0xFFFF)) {
@ -307,130 +348,212 @@ const char *translateEvents(Event event) {
return TEST_STRING;
case (10600):
return CHANGE_OF_SETUP_PARAMETER_STRING;
case (10900):
return GPIO_PULL_HIGH_FAILED_STRING;
case (10901):
return GPIO_PULL_LOW_FAILED_STRING;
case (10902):
return SWITCH_ALREADY_ON_STRING;
case (10903):
return SWITCH_ALREADY_OFF_STRING;
case (10904):
return MAIN_SWITCH_TIMEOUT_STRING;
case (11000):
return MAIN_SWITCH_ON_TIMEOUT_STRING;
case (11001):
return MAIN_SWITCH_OFF_TIMEOUT_STRING;
case (11002):
return DEPLOYMENT_FAILED_STRING;
case (11003):
return DEPL_SA1_GPIO_SWTICH_ON_FAILED_STRING;
case (11004):
return DEPL_SA2_GPIO_SWTICH_ON_FAILED_STRING;
case (11101):
return MEMORY_READ_RPT_CRC_FAILURE_STRING;
case (11102):
return ACK_FAILURE_STRING;
case (11103):
return EXE_FAILURE_STRING;
case (11104):
return CRC_FAILURE_EVENT_STRING;
case (11201):
return SELF_TEST_I2C_FAILURE_STRING;
case (11202):
return SELF_TEST_SPI_FAILURE_STRING;
case (11203):
return SELF_TEST_ADC_FAILURE_STRING;
case (11204):
return SELF_TEST_PWM_FAILURE_STRING;
case (11205):
return SELF_TEST_TC_FAILURE_STRING;
case (11206):
return SELF_TEST_MTM_RANGE_FAILURE_STRING;
case (11207):
return SELF_TEST_COIL_CURRENT_FAILURE_STRING;
case (11208):
return INVALID_ERROR_BYTE_STRING;
case (11300):
return SWITCH_CMD_SENT_STRING;
case (11301):
return ERROR_STATE_STRING;
return SWITCH_HAS_CHANGED_STRING;
case (11302):
return SWITCHING_Q7S_DENIED_STRING;
case (11400):
return GPIO_PULL_HIGH_FAILED_STRING;
case (11401):
return BOOTING_FIRMWARE_FAILED_STRING;
return GPIO_PULL_LOW_FAILED_STRING;
case (11402):
return BOOTING_BOOTLOADER_FAILED_STRING;
return SWITCH_ALREADY_ON_STRING;
case (11403):
return SWITCH_ALREADY_OFF_STRING;
case (11404):
return MAIN_SWITCH_TIMEOUT_STRING;
case (11500):
return MAIN_SWITCH_ON_TIMEOUT_STRING;
case (11501):
return SUPV_MEMORY_READ_RPT_CRC_FAILURE_STRING;
return MAIN_SWITCH_OFF_TIMEOUT_STRING;
case (11502):
return SUPV_ACK_FAILURE_STRING;
return DEPLOYMENT_FAILED_STRING;
case (11503):
return SUPV_EXE_FAILURE_STRING;
return DEPL_SA1_GPIO_SWTICH_ON_FAILED_STRING;
case (11504):
return SUPV_CRC_FAILURE_EVENT_STRING;
case (11600):
return ALLOC_FAILURE_STRING;
return DEPL_SA2_GPIO_SWTICH_ON_FAILED_STRING;
case (11601):
return REBOOT_SW_STRING;
return MEMORY_READ_RPT_CRC_FAILURE_STRING;
case (11602):
return ACK_FAILURE_STRING;
case (11603):
return REBOOT_HW_STRING;
case (11700):
return UPDATE_FILE_NOT_EXISTS_STRING;
return EXE_FAILURE_STRING;
case (11604):
return MPSOC_HANDLER_CRC_FAILURE_STRING;
case (11605):
return MPSOC_HANDLER_SEQ_CNT_MISMATCH_STRING;
case (11606):
return MPSOC_SHUTDOWN_FAILED_STRING;
case (11701):
return ACTION_COMMANDING_FAILED_STRING;
return SELF_TEST_I2C_FAILURE_STRING;
case (11702):
return UPDATE_AVAILABLE_FAILED_STRING;
return SELF_TEST_SPI_FAILURE_STRING;
case (11703):
return UPDATE_TRANSFER_FAILED_STRING;
return SELF_TEST_ADC_FAILURE_STRING;
case (11704):
return UPDATE_VERIFY_FAILED_STRING;
return SELF_TEST_PWM_FAILURE_STRING;
case (11705):
return UPDATE_FINISHED_STRING;
case (11800):
return SEND_MRAM_DUMP_FAILED_STRING;
return SELF_TEST_TC_FAILURE_STRING;
case (11706):
return SELF_TEST_MTM_RANGE_FAILURE_STRING;
case (11707):
return SELF_TEST_COIL_CURRENT_FAILURE_STRING;
case (11708):
return INVALID_ERROR_BYTE_STRING;
case (11801):
return MRAM_DUMP_FAILED_STRING;
case (11802):
return MRAM_DUMP_FINISHED_STRING;
return ERROR_STATE_STRING;
case (11901):
return INVALID_TC_FRAME_STRING;
return BOOTING_FIRMWARE_FAILED_STRING;
case (11902):
return INVALID_FAR_STRING;
case (11903):
return CARRIER_LOCK_STRING;
case (11904):
return BIT_LOCK_PDEC_STRING;
case (12000):
return IMAGE_UPLOAD_FAILED_STRING;
return BOOTING_BOOTLOADER_FAILED_STRING;
case (12001):
return IMAGE_DOWNLOAD_FAILED_STRING;
return SUPV_MEMORY_READ_RPT_CRC_FAILURE_STRING;
case (12002):
return IMAGE_UPLOAD_SUCCESSFUL_STRING;
return SUPV_ACK_FAILURE_STRING;
case (12003):
return IMAGE_DOWNLOAD_SUCCESSFUL_STRING;
return SUPV_EXE_FAILURE_STRING;
case (12004):
return SUPV_CRC_FAILURE_EVENT_STRING;
case (12100):
return SANITIZATION_FAILED_STRING;
case (12101):
return MOUNTED_SD_CARD_STRING;
case (12200):
return UPDATE_FILE_NOT_EXISTS_STRING;
case (12201):
return ACTION_COMMANDING_FAILED_STRING;
case (12202):
return UPDATE_AVAILABLE_FAILED_STRING;
case (12203):
return UPDATE_TRANSFER_FAILED_STRING;
case (12204):
return UPDATE_VERIFY_FAILED_STRING;
case (12205):
return UPDATE_FINISHED_STRING;
case (12300):
return SEND_MRAM_DUMP_FAILED_STRING;
case (12301):
return MRAM_DUMP_FAILED_STRING;
case (12302):
return MRAM_DUMP_FINISHED_STRING;
case (12401):
return INVALID_TC_FRAME_STRING;
case (12402):
return INVALID_FAR_STRING;
case (12403):
return CARRIER_LOCK_STRING;
case (12404):
return BIT_LOCK_PDEC_STRING;
case (12500):
return IMAGE_UPLOAD_FAILED_STRING;
case (12501):
return IMAGE_DOWNLOAD_FAILED_STRING;
case (12502):
return IMAGE_UPLOAD_SUCCESSFUL_STRING;
case (12503):
return IMAGE_DOWNLOAD_SUCCESSFUL_STRING;
case (12504):
return FLASH_WRITE_SUCCESSFUL_STRING;
case (12005):
case (12505):
return FLASH_READ_SUCCESSFUL_STRING;
case (12006):
case (12506):
return FLASH_READ_FAILED_STRING;
case (12007):
case (12507):
return FIRMWARE_UPDATE_SUCCESSFUL_STRING;
case (12008):
case (12508):
return FIRMWARE_UPDATE_FAILED_STRING;
case (12009):
case (12509):
return STR_HELPER_READING_REPLY_FAILED_STRING;
case (12010):
case (12510):
return STR_HELPER_COM_ERROR_STRING;
case (12011):
case (12511):
return STR_HELPER_NO_REPLY_STRING;
case (12012):
case (12512):
return STR_HELPER_DEC_ERROR_STRING;
case (12013):
case (12513):
return POSITION_MISMATCH_STRING;
case (12014):
case (12514):
return STR_HELPER_FILE_NOT_EXISTS_STRING;
case (12015):
case (12515):
return STR_HELPER_SENDING_PACKET_FAILED_STRING;
case (12016):
case (12516):
return STR_HELPER_REQUESTING_MSG_FAILED_STRING;
case (12600):
return MPSOC_FLASH_WRITE_FAILED_STRING;
case (12601):
return MPSOC_FLASH_WRITE_SUCCESSFUL_STRING;
case (12602):
return SENDING_COMMAND_FAILED_STRING;
case (12603):
return MPSOC_HELPER_REQUESTING_REPLY_FAILED_STRING;
case (12604):
return MPSOC_HELPER_READING_REPLY_FAILED_STRING;
case (12605):
return MISSING_ACK_STRING;
case (12606):
return MISSING_EXE_STRING;
case (12607):
return ACK_FAILURE_REPORT_STRING;
case (12608):
return EXE_FAILURE_REPORT_STRING;
case (12609):
return ACK_INVALID_APID_STRING;
case (12610):
return EXE_INVALID_APID_STRING;
case (12611):
return MPSOC_HELPER_SEQ_CNT_MISMATCH_STRING;
case (12700):
return TRANSITION_BACK_TO_OFF_STRING;
case (12701):
return NEG_V_OUT_OF_BOUNDS_STRING;
case (12702):
return U_DRO_OUT_OF_BOUNDS_STRING;
case (12703):
return I_DRO_OUT_OF_BOUNDS_STRING;
case (12704):
return U_X8_OUT_OF_BOUNDS_STRING;
case (12705):
return I_X8_OUT_OF_BOUNDS_STRING;
case (12706):
return U_TX_OUT_OF_BOUNDS_STRING;
case (12707):
return I_TX_OUT_OF_BOUNDS_STRING;
case (12708):
return U_MPA_OUT_OF_BOUNDS_STRING;
case (12709):
return I_MPA_OUT_OF_BOUNDS_STRING;
case (12710):
return U_HPA_OUT_OF_BOUNDS_STRING;
case (12711):
return I_HPA_OUT_OF_BOUNDS_STRING;
case (12800):
return TRANSITION_OTHER_SIDE_FAILED_STRING;
case (12801):
return NOT_ENOUGH_DEVICES_DUAL_MODE_STRING;
case (12802):
return POWER_STATE_MACHINE_TIMEOUT_STRING;
case (12803):
return SIDE_SWITCH_TRANSITION_NOT_ALLOWED_STRING;
case (13000):
return CHILDREN_LOST_MODE_STRING;
case (13100):
return GPS_FIX_CHANGE_STRING;
case (13200):
return P60_BOOT_COUNT_STRING;
case (13201):
return BATT_MODE_STRING;
case (13202):
return BATT_MODE_CHANGED_STRING;
case (13600):
return ALLOC_FAILURE_STRING;
case (13601):
return REBOOT_SW_STRING;
case (13602):
return REBOOT_MECHANISM_TRIGGERED_STRING;
case (13603):
return REBOOT_HW_STRING;
default:
return "UNKNOWN_EVENT";
}

@ -1 +1 @@
Subproject commit c5ef1783a3b082c0e88561bd91bc3ee0f459fafc
Subproject commit 5ad9fb94af3312d29863527106396395f7b808a5

View File

@ -31,7 +31,11 @@ def main():
LOGGER.info("Generating returnvalue data")
time.sleep(0.05)
parse_returnvalues()
pass
elif args.type == "all":
LOGGER.info("Generating all data")
parse_objects()
parse_events()
parse_returnvalues()
if __name__ == "__main__":

View File

@ -118,5 +118,5 @@ def handle_file_export(list_items):
copy_file(
filename=CSV_OBJECT_FILENAME,
destination=CSV_COPY_DEST,
delete_existing_file=True
delete_existing_file=True,
)

View File

@ -1,8 +1,8 @@
/**
* @brief Auto-generated object translation file.
* @details
* Contains 112 translations.
* Generated on: 2022-03-04 15:13:13
* Contains 117 translations.
* Generated on: 2022-04-08 14:13:35
*/
#include "translateObjects.h"
@ -48,8 +48,10 @@ const char *RAD_SENSOR_STRING = "RAD_SENSOR";
const char *PLOC_UPDATER_STRING = "PLOC_UPDATER";
const char *PLOC_MEMORY_DUMPER_STRING = "PLOC_MEMORY_DUMPER";
const char *STR_HELPER_STRING = "STR_HELPER";
const char *PLOC_MPSOC_HELPER_STRING = "PLOC_MPSOC_HELPER";
const char *PLOC_MPSOC_HANDLER_STRING = "PLOC_MPSOC_HANDLER";
const char *PLOC_SUPERVISOR_HANDLER_STRING = "PLOC_SUPERVISOR_HANDLER";
const char *PLOC_SUPERVISOR_HELPER_STRING = "PLOC_SUPERVISOR_HELPER";
const char *SOLAR_ARRAY_DEPL_HANDLER_STRING = "SOLAR_ARRAY_DEPL_HANDLER";
const char *HEATER_HANDLER_STRING = "HEATER_HANDLER";
const char *TMP1075_HANDLER_1_STRING = "TMP1075_HANDLER_1";
@ -115,6 +117,9 @@ const char *DUMMY_HANDLER_STRING = "DUMMY_HANDLER";
const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE";
const char *LIBGPIOD_TEST_STRING = "LIBGPIOD_TEST";
const char *TEST_TASK_STRING = "TEST_TASK";
const char *ACS_BOARD_ASS_STRING = "ACS_BOARD_ASS";
const char *SUS_BOARD_ASS_STRING = "SUS_BOARD_ASS";
const char *TCS_BOARD_ASS_STRING = "TCS_BOARD_ASS";
const char *TM_FUNNEL_STRING = "TM_FUNNEL";
const char *CCSDS_IP_CORE_BRIDGE_STRING = "CCSDS_IP_CORE_BRIDGE";
const char *NO_OBJECT_STRING = "NO_OBJECT";
@ -205,10 +210,14 @@ const char *translateObject(object_id_t object) {
return PLOC_MEMORY_DUMPER_STRING;
case 0x44330002:
return STR_HELPER_STRING;
case 0x44330003:
return PLOC_MPSOC_HELPER_STRING;
case 0x44330015:
return PLOC_MPSOC_HANDLER_STRING;
case 0x44330016:
return PLOC_SUPERVISOR_HANDLER_STRING;
case 0x44330017:
return PLOC_SUPERVISOR_HELPER_STRING;
case 0x444100A2:
return SOLAR_ARRAY_DEPL_HANDLER_STRING;
case 0x444100A4:
@ -339,6 +348,12 @@ const char *translateObject(object_id_t object) {
return LIBGPIOD_TEST_STRING;
case 0x54694269:
return TEST_TASK_STRING;
case 0x73000001:
return ACS_BOARD_ASS_STRING;
case 0x73000002:
return SUS_BOARD_ASS_STRING;
case 0x73000003:
return TCS_BOARD_ASS_STRING;
case 0x73000100:
return TM_FUNNEL_STRING;
case 0x73500000:

View File

@ -1,14 +1,7 @@
#! /usr/bin/python3
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
:file: returnvalues_parser.py
:brief: Part of the MOD export tools for the SOURCE project by KSat.
TODO: Integrate into Parser Structure instead of calling this file (no cpp file generated yet)
:details:
Return Value exporter.
To use MySQLdb, run pip install mysqlclient or install in IDE. On Windows, Build Tools
installation might be necessary.
:data: 21.11.2019
"""Part of the MIB export tools for the EIVE project by.
Returnvalue exporter.
"""
from fsfwgen.core import get_console_logger
from fsfwgen.utility.file_management import copy_file
@ -87,7 +80,7 @@ def parse_returnvalues():
copy_file(
filename=CSV_RETVAL_FILENAME,
destination=CSV_COPY_DEST,
delete_existing_file=True
delete_existing_file=True,
)
if EXPORT_TO_SQL:
LOGGER.info("ReturnvalueParser: Exporting to SQL")

View File

@ -1,6 +1,11 @@
add_subdirectory(csp)
add_subdirectory(utility)
add_subdirectory(callbacks)
add_subdirectory(boardtest)
add_subdirectory(devices)
add_subdirectory(fsfwconfig)
add_subdirectory(obc)
add_subdirectory(obc)
target_sources(${OBSW_NAME} PUBLIC
ObjectFactory.cpp
)

286
linux/ObjectFactory.cpp Normal file
View File

@ -0,0 +1,286 @@
#include "ObjectFactory.h"
#include <fsfw/power/PowerSwitchIF.h>
#include <fsfw_hal/common/gpio/GpioCookie.h>
#include <fsfw_hal/common/gpio/GpioIF.h>
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
#include <fsfw_hal/linux/spi/SpiComIF.h>
#include <fsfw_hal/linux/spi/SpiCookie.h>
#include <linux/callbacks/gpioCallbacks.h>
#include <mission/devices/Max31865PT1000Handler.h>
#include <mission/devices/SusHandler.h>
#include <mission/system/RtdFdir.h>
#include <mission/system/SusAssembly.h>
#include <mission/system/SusFdir.h>
#include <mission/system/TcsBoardAssembly.h>
#include "OBSWConfig.h"
#include "devConf.h"
#include "devices/addresses.h"
#include "devices/gpioIds.h"
void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF,
PowerSwitchIF* pwrSwitcher, std::string spiDev) {
using namespace gpio;
GpioCookie* gpioCookieSus = new GpioCookie();
GpioCallback* susgpio = nullptr;
susgpio = new GpioCallback("Chip select SUS 0", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_0, susgpio);
susgpio = new GpioCallback("Chip select SUS 1", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_1, susgpio);
susgpio = new GpioCallback("Chip select SUS 2", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_2, susgpio);
susgpio = new GpioCallback("Chip select SUS 3", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_3, susgpio);
susgpio = new GpioCallback("Chip select SUS 4", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_4, susgpio);
susgpio = new GpioCallback("Chip select SUS 5", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_5, susgpio);
susgpio = new GpioCallback("Chip select SUS 6", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_6, susgpio);
susgpio = new GpioCallback("Chip select SUS 7", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_7, susgpio);
susgpio = new GpioCallback("Chip select SUS 8", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_8, susgpio);
susgpio = new GpioCallback("Chip select SUS 9", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_9, susgpio);
susgpio = new GpioCallback("Chip select SUS 10", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_10, susgpio);
susgpio = new GpioCallback("Chip select SUS 11", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_11, susgpio);
gpioComIF->addGpios(gpioCookieSus);
#if OBSW_ADD_SUN_SENSORS == 1
SusFdir* fdir = nullptr;
std::array<SusHandler*, 12> susHandlers = {};
SpiCookie* spiCookie =
new SpiCookie(addresses::SUS_0, gpioIds::CS_SUS_0, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[0] = new SusHandler(objects::SUS_0, 0, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_0);
susHandlers[0]->setParent(objects::SUS_BOARD_ASS);
susHandlers[0]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_1, gpioIds::CS_SUS_1, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[1] = new SusHandler(objects::SUS_1, 1, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_1);
susHandlers[1]->setParent(objects::SUS_BOARD_ASS);
susHandlers[1]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_2, gpioIds::CS_SUS_2, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[2] = new SusHandler(objects::SUS_2, 2, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_2);
susHandlers[2]->setParent(objects::SUS_BOARD_ASS);
susHandlers[2]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_3, gpioIds::CS_SUS_3, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[3] = new SusHandler(objects::SUS_3, 3, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_3);
susHandlers[3]->setParent(objects::SUS_BOARD_ASS);
susHandlers[3]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_4, gpioIds::CS_SUS_4, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[4] = new SusHandler(objects::SUS_4, 4, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_4);
susHandlers[4]->setParent(objects::SUS_BOARD_ASS);
susHandlers[4]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_5, gpioIds::CS_SUS_5, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[5] = new SusHandler(objects::SUS_5, 5, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_5);
susHandlers[5]->setParent(objects::SUS_BOARD_ASS);
susHandlers[5]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[6] = new SusHandler(objects::SUS_6, 6, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_6);
susHandlers[6]->setParent(objects::SUS_BOARD_ASS);
susHandlers[6]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_7, gpioIds::CS_SUS_7, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[7] = new SusHandler(objects::SUS_7, 7, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_7);
susHandlers[7]->setParent(objects::SUS_BOARD_ASS);
susHandlers[7]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_8, gpioIds::CS_SUS_8, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[8] = new SusHandler(objects::SUS_8, 8, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_8);
susHandlers[8]->setParent(objects::SUS_BOARD_ASS);
susHandlers[8]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_9, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[9] = new SusHandler(objects::SUS_9, 9, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_9);
susHandlers[9]->setParent(objects::SUS_BOARD_ASS);
susHandlers[9]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_10, gpioIds::CS_SUS_10, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[10] = new SusHandler(objects::SUS_10, 10, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_10);
susHandlers[10]->setParent(objects::SUS_BOARD_ASS);
susHandlers[10]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_11, gpioIds::CS_SUS_11, spiDev, SUS::MAX_CMD_SIZE,
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
susHandlers[11] = new SusHandler(objects::SUS_11, 11, objects::SPI_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_11);
susHandlers[11]->setParent(objects::SUS_BOARD_ASS);
susHandlers[11]->setCustomFdir(fdir);
for (auto& sus : susHandlers) {
if (sus != nullptr) {
#if OBSW_TEST_SUS == 1
sus->setStartUpImmediately();
sus->setToGoToNormalMode(true);
#endif
#if OBSW_DEBUG_SUS == 1
sus->enablePeriodicPrintout(true, 3);
#endif
}
}
std::array<object_id_t, 12> susIds = {objects::SUS_0, objects::SUS_1, objects::SUS_2,
objects::SUS_3, objects::SUS_4, objects::SUS_5,
objects::SUS_6, objects::SUS_7, objects::SUS_8,
objects::SUS_9, objects::SUS_10, objects::SUS_11};
SusAssHelper susAssHelper = SusAssHelper(susIds);
auto susAss =
new SusAssembly(objects::SUS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher, susAssHelper);
static_cast<void>(susAss);
#endif /* OBSW_ADD_SUN_SENSORS == 1 */
}
void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
PowerSwitchIF* pwrSwitcher) {
using namespace gpio;
GpioCookie* rtdGpioCookie = new GpioCookie;
GpioCallback* gpioRtdIc0 = new GpioCallback("Chip select RTD IC0", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_3, gpioRtdIc0);
GpioCallback* gpioRtdIc1 = new GpioCallback("Chip select RTD IC1", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_4, gpioRtdIc1);
GpioCallback* gpioRtdIc2 = new GpioCallback("Chip select RTD IC2", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_5, gpioRtdIc2);
GpioCallback* gpioRtdIc3 = new GpioCallback("Chip select RTD IC3", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_6, gpioRtdIc3);
GpioCallback* gpioRtdIc4 = new GpioCallback("Chip select RTD IC4", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_7, gpioRtdIc4);
GpioCallback* gpioRtdIc5 = new GpioCallback("Chip select RTD IC5", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_8, gpioRtdIc5);
GpioCallback* gpioRtdIc6 = new GpioCallback("Chip select RTD IC6", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_9, gpioRtdIc6);
GpioCallback* gpioRtdIc7 = new GpioCallback("Chip select RTD IC7", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_10, gpioRtdIc7);
GpioCallback* gpioRtdIc8 = new GpioCallback("Chip select RTD IC8", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_11, gpioRtdIc8);
GpioCallback* gpioRtdIc9 = new GpioCallback("Chip select RTD IC9", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_12, gpioRtdIc9);
GpioCallback* gpioRtdIc10 = new GpioCallback("Chip select RTD IC10", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_13, gpioRtdIc10);
GpioCallback* gpioRtdIc11 = new GpioCallback("Chip select RTD IC11", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_14, gpioRtdIc11);
GpioCallback* gpioRtdIc12 = new GpioCallback("Chip select RTD IC12", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_15, gpioRtdIc12);
GpioCallback* gpioRtdIc13 = new GpioCallback("Chip select RTD IC13", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_16, gpioRtdIc13);
GpioCallback* gpioRtdIc14 = new GpioCallback("Chip select RTD IC14", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_17, gpioRtdIc14);
GpioCallback* gpioRtdIc15 = new GpioCallback("Chip select RTD IC15", Direction::OUT, Levels::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_18, gpioRtdIc15);
gpioComIF->addGpios(rtdGpioCookie);
#if OBSW_ADD_RTD_DEVICES == 1
static constexpr uint8_t NUMBER_RTDS = 16;
std::array<std::pair<address_t, gpioId_t>, NUMBER_RTDS> cookieArgs = {{
{addresses::RTD_IC_3, gpioIds::RTD_IC_3},
{addresses::RTD_IC_4, gpioIds::RTD_IC_4},
{addresses::RTD_IC_5, gpioIds::RTD_IC_5},
{addresses::RTD_IC_6, gpioIds::RTD_IC_6},
{addresses::RTD_IC_7, gpioIds::RTD_IC_7},
{addresses::RTD_IC_8, gpioIds::RTD_IC_8},
{addresses::RTD_IC_9, gpioIds::RTD_IC_9},
{addresses::RTD_IC_10, gpioIds::RTD_IC_10},
{addresses::RTD_IC_11, gpioIds::RTD_IC_11},
{addresses::RTD_IC_12, gpioIds::RTD_IC_12},
{addresses::RTD_IC_13, gpioIds::RTD_IC_13},
{addresses::RTD_IC_14, gpioIds::RTD_IC_14},
{addresses::RTD_IC_15, gpioIds::RTD_IC_15},
{addresses::RTD_IC_16, gpioIds::RTD_IC_16},
{addresses::RTD_IC_17, gpioIds::RTD_IC_17},
{addresses::RTD_IC_18, gpioIds::RTD_IC_18},
}};
std::array<object_id_t, NUMBER_RTDS> rtdIds = {
objects::RTD_IC_3, objects::RTD_IC_4, objects::RTD_IC_5, objects::RTD_IC_6,
objects::RTD_IC_7, objects::RTD_IC_8, objects::RTD_IC_9, objects::RTD_IC_10,
objects::RTD_IC_11, objects::RTD_IC_12, objects::RTD_IC_13, objects::RTD_IC_14,
objects::RTD_IC_15, objects::RTD_IC_16, objects::RTD_IC_17, objects::RTD_IC_18};
std::array<SpiCookie*, NUMBER_RTDS> rtdCookies = {};
std::array<Max31865PT1000Handler*, NUMBER_RTDS> rtds = {};
RtdFdir* rtdFdir = nullptr;
for (uint8_t idx = 0; idx < NUMBER_RTDS; idx++) {
rtdCookies[idx] =
new SpiCookie(cookieArgs[idx].first, cookieArgs[idx].second, spiDev,
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
rtds[idx] = new Max31865PT1000Handler(rtdIds[idx], objects::SPI_COM_IF, rtdCookies[idx]);
rtds[idx]->setParent(objects::TCS_BOARD_ASS);
rtdFdir = new RtdFdir(rtdIds[idx]);
rtds[idx]->setCustomFdir(rtdFdir);
rtds[idx]->setDeviceIdx(idx + 3);
}
#if OBSW_TEST_RTD == 1
for (auto& rtd : rtds) {
if (rtd != nullptr) {
rtd->setStartUpImmediately();
rtd->setInstantNormal(true);
}
}
#endif // OBSW_TEST_RTD == 1
TcsBoardHelper helper(rtdIds);
TcsBoardAssembly* tcsBoardAss =
new TcsBoardAssembly(objects::TCS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher,
pcdu::Switches::PDU1_CH0_TCS_BOARD_3V3, helper);
static_cast<void>(tcsBoardAss);
#endif // OBSW_ADD_RTD_DEVICES == 1
}

15
linux/ObjectFactory.h Normal file
View File

@ -0,0 +1,15 @@
#pragma once
#include <string>
class GpioIF;
class SpiComIF;
class PowerSwitchIF;
namespace ObjectFactory {
void createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF, PowerSwitchIF* pwrSwitcher,
std::string spiDev);
void createRtdComponents(std::string spiDev, GpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher);
} // namespace ObjectFactory

View File

@ -339,6 +339,8 @@ void SpiTestClass::performMax1227Test() {
std::string deviceName = "";
#elif defined(EGSE)
std::string deviceName = "";
#elif defined(TE0720_1CFA)
std::string deviceName = "";
#endif
int fd = 0;
UnixFileGuard fileHelper(deviceName, &fd, O_RDWR, "SpiComIF::initializeInterface");
@ -406,7 +408,7 @@ void SpiTestClass::max1227RadSensorTest(int fd) {
transfer(fd, gpioIds::CS_RAD_SENSOR);
usleep(65);
spiTransferStruct[0].len = 24;
std::memcpy(sendBuffer.data(), sendBuffer.data() + 1, 24);
std::memmove(sendBuffer.data(), sendBuffer.data() + 1, 24);
transfer(fd, gpioIds::CS_RAD_SENSOR);
int16_t tempRaw = ((recvBuffer[22] & 0x0f) << 8) | recvBuffer[23];
float temp = max1227::getTemperature(tempRaw);

View File

@ -3,9 +3,14 @@
#include "OBSWConfig.h"
#if defined(XIPHOS_Q7S)
#ifdef XIPHOS_Q7S
#include "busConf.h"
#endif
#ifdef RASPBERRY_PI
#include <bsp_linux_board/definitions.h>
#endif
#include <fsfw_hal/common/gpio/GpioIF.h>
#include <fsfw_hal/linux/spi/SpiCookie.h>
#include <test/testtasks/TestTask.h>

View File

@ -0,0 +1,3 @@
target_sources(${OBSW_NAME} PRIVATE
gpioCallbacks.cpp
)

View File

@ -0,0 +1,431 @@
#include "gpioCallbacks.h"
#include "devices/gpioIds.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw_hal/common/gpio/GpioCookie.h"
#include "fsfw_hal/common/gpio/GpioIF.h"
void gpioCallbacks::spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp,
gpio::Levels value, void* args) {
GpioIF* gpioIF = reinterpret_cast<GpioIF*>(args);
if (gpioIF == nullptr) {
sif::debug << "spiCsDecoderCallback: No gpioComIF specified. Call initSpiCsDecoder "
<< "to specify gpioComIF" << std::endl;
return;
}
/* Reading is not supported by the callback function */
if (gpioOp == gpio::GpioOperation::READ) {
return;
}
if (value == gpio::Levels::HIGH) {
switch (gpioId) {
case (gpioIds::RTD_IC_3): {
disableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_4): {
disableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_5): {
disableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_6): {
disableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_7): {
disableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_8): {
disableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_9): {
disableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_10): {
disableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_11): {
disableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_12): {
disableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_13): {
disableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_14): {
disableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_15): {
disableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_16): {
disableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_17): {
disableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_18): {
disableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_0): {
disableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_1): {
disableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_2): {
disableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_3): {
disableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_4): {
disableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_5): {
disableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_6): {
disableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_7): {
disableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_8): {
disableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_9): {
disableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_10): {
disableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_11): {
disableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_RW1): {
disableRwDecoder(gpioIF);
break;
}
case (gpioIds::CS_RW2): {
disableRwDecoder(gpioIF);
break;
}
case (gpioIds::CS_RW3): {
disableRwDecoder(gpioIF);
break;
}
case (gpioIds::CS_RW4): {
disableRwDecoder(gpioIF);
break;
}
default:
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
}
} else if (value == gpio::Levels::LOW) {
switch (gpioId) {
case (gpioIds::RTD_IC_3): {
selectY7(gpioIF);
enableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_4): {
selectY6(gpioIF);
enableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_5): {
selectY5(gpioIF);
enableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_6): {
selectY4(gpioIF);
enableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_7): {
selectY3(gpioIF);
enableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_8): {
selectY2(gpioIF);
enableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_9): {
selectY1(gpioIF);
enableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_10): {
selectY0(gpioIF);
enableDecoderTcsIc1(gpioIF);
break;
}
case (gpioIds::RTD_IC_11): {
selectY7(gpioIF);
enableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_12): {
selectY6(gpioIF);
enableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_13): {
selectY5(gpioIF);
enableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_14): {
selectY4(gpioIF);
enableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_15): {
selectY3(gpioIF);
enableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_16): {
selectY2(gpioIF);
enableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_17): {
selectY1(gpioIF);
enableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::RTD_IC_18): {
selectY0(gpioIF);
enableDecoderTcsIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_0): {
selectY0(gpioIF);
enableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_1): {
selectY1(gpioIF);
enableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_2): {
selectY2(gpioIF);
enableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_3): {
selectY3(gpioIF);
enableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_4): {
selectY4(gpioIF);
enableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_5): {
selectY5(gpioIF);
enableDecoderInterfaceBoardIc1(gpioIF);
break;
}
case (gpioIds::CS_SUS_6): {
selectY0(gpioIF);
enableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_7): {
selectY1(gpioIF);
enableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_8): {
selectY2(gpioIF);
enableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_9): {
selectY3(gpioIF);
enableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_10): {
selectY4(gpioIF);
enableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_SUS_11): {
selectY5(gpioIF);
enableDecoderInterfaceBoardIc2(gpioIF);
break;
}
case (gpioIds::CS_RW1): {
selectY0(gpioIF);
enableRwDecoder(gpioIF);
break;
}
case (gpioIds::CS_RW2): {
selectY1(gpioIF);
enableRwDecoder(gpioIF);
break;
}
case (gpioIds::CS_RW3): {
selectY2(gpioIF);
enableRwDecoder(gpioIF);
break;
}
case (gpioIds::CS_RW4): {
selectY3(gpioIF);
enableRwDecoder(gpioIF);
break;
}
default:
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
}
} else {
sif::debug << "spiCsDecoderCallback: Invalid value. Must be 0 or 1" << std::endl;
}
}
void gpioCallbacks::enableDecoderTcsIc1(GpioIF* gpioIF) {
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_0);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void gpioCallbacks::enableDecoderTcsIc2(GpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_2);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_0);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_1);
}
void gpioCallbacks::enableDecoderInterfaceBoardIc1(GpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void gpioCallbacks::enableDecoderInterfaceBoardIc2(GpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_2);
}
void gpioCallbacks::disableDecoderTcsIc1(GpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void gpioCallbacks::disableDecoderTcsIc2(GpioIF* gpioIF) {
// DO NOT CHANGE THE ORDER HERE
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_2);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_1);
}
void gpioCallbacks::disableDecoderInterfaceBoardIc1(GpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void gpioCallbacks::disableDecoderInterfaceBoardIc2(GpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_0);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_2);
}
void gpioCallbacks::enableRwDecoder(GpioIF* gpioIF) { gpioIF->pullHigh(gpioIds::EN_RW_CS); }
void gpioCallbacks::disableRwDecoder(GpioIF* gpioIF) { gpioIF->pullLow(gpioIds::EN_RW_CS); }
void gpioCallbacks::selectY0(GpioIF* gpioIF) {
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_5);
}
void gpioCallbacks::selectY1(GpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_5);
}
void gpioCallbacks::selectY2(GpioIF* gpioIF) {
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_5);
}
void gpioCallbacks::selectY3(GpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_5);
}
void gpioCallbacks::selectY4(GpioIF* gpioIF) {
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_5);
}
void gpioCallbacks::selectY5(GpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_5);
}
void gpioCallbacks::selectY6(GpioIF* gpioIF) {
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_5);
}
void gpioCallbacks::selectY7(GpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioIF->pullHigh(gpioIds::SPI_MUX_BIT_5);
}
void gpioCallbacks::disableAllDecoder(GpioIF* gpioIF) {
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_2);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_0);
gpioIF->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioIF->pullLow(gpioIds::EN_RW_CS);
}

View File

@ -1,16 +1,10 @@
#ifndef LINUX_GPIO_GPIOCALLBACKS_H_
#define LINUX_GPIO_GPIOCALLBACKS_H_
#pragma once
#include <fsfw_hal/common/gpio/GpioIF.h>
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
namespace gpioCallbacks {
class GpioIF;
/**
* @brief This function initializes the GPIOs used to control the SN74LVC138APWR decoders on
* the TCS Board and the interface board.
*/
void initSpiCsDecoder(GpioIF* gpioComIF);
namespace gpioCallbacks {
/**
* @brief This function implements the decoding to multiply gpios by using the decoder
@ -23,51 +17,50 @@ void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Lev
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
* on the TCS board which is named to IC1 in the schematic.
*/
void enableDecoderTcsIc1();
void enableDecoderTcsIc1(GpioIF* gpioIF);
/**
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
* on the TCS board which is named to IC2 in the schematic.
*/
void enableDecoderTcsIc2();
void enableDecoderTcsIc2(GpioIF* gpioIF);
/**
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
* on the inteface board board which is named to IC21 in the schematic.
*/
void enableDecoderInterfaceBoardIc1();
void enableDecoderInterfaceBoardIc1(GpioIF* gpioIF);
/**
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
* on the inteface board board which is named to IC22 in the schematic.
*/
void enableDecoderInterfaceBoardIc2();
void enableDecoderInterfaceBoardIc2(GpioIF* gpioIF);
void disableDecoderTcsIc1();
void disableDecoderTcsIc2();
void disableDecoderInterfaceBoardIc1();
void disableDecoderInterfaceBoardIc2();
void disableDecoderTcsIc1(GpioIF* gpioIF);
void disableDecoderTcsIc2(GpioIF* gpioIF);
void disableDecoderInterfaceBoardIc1(GpioIF* gpioIF);
void disableDecoderInterfaceBoardIc2(GpioIF* gpioIF);
/**
* @brief Enables the reaction wheel chip select decoder (IC3).
*/
void enableRwDecoder();
void disableRwDecoder();
void enableRwDecoder(GpioIF* gpioIF);
void disableRwDecoder(GpioIF* gpioIF);
/**
* @brief This function disables all decoder.
*/
void disableAllDecoder();
void disableAllDecoder(GpioIF* gpioIF);
/** The following functions enable the appropriate channel of the currently enabled decoder */
void selectY0();
void selectY1();
void selectY2();
void selectY3();
void selectY4();
void selectY5();
void selectY6();
void selectY7();
} // namespace gpioCallbacks
void selectY0(GpioIF* gpioIF);
void selectY1(GpioIF* gpioIF);
void selectY2(GpioIF* gpioIF);
void selectY3(GpioIF* gpioIF);
void selectY4(GpioIF* gpioIF);
void selectY5(GpioIF* gpioIF);
void selectY6(GpioIF* gpioIF);
void selectY7(GpioIF* gpioIF);
#endif /* LINUX_GPIO_GPIOCALLBACKS_H_ */
} // namespace gpioCallbacks

View File

@ -141,11 +141,12 @@ ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, const u
int cmdLen, uint16_t querySize) {
uint32_t timeout_ms = 1000;
uint16_t bytesRead = 0;
int32_t expectedSize = (int32_t)querySize;
int32_t expectedSize = static_cast<int32_t>(querySize);
vectorBufferIter iter = cspDeviceMap.find(cspAddress);
if (iter == cspDeviceMap.end()) {
sif::error << "CSP device with address " << cspAddress << " no found in"
<< " device map" << std::endl;
return RETURN_FAILED;
}
uint8_t* replyBuffer = iter->second.data();

View File

@ -4,4 +4,5 @@ if(EIVE_BUILD_GPSD_GPS_HANDLER)
)
endif()
add_subdirectory(ploc)
add_subdirectory(startracker)

View File

@ -3,19 +3,24 @@
#include "OBSWConfig.h"
#include "fsfw/datapool/PoolReadGuard.h"
#include "fsfw/timemanager/Clock.h"
#include "linux/utility/utility.h"
#include "mission/utility/compileTime.h"
#if FSFW_DEV_HYPERION_GPS_CREATE_NMEA_CSV == 1
#include <filesystem>
#include <fstream>
#endif
#include <cmath>
#include <ctime>
GPSHyperionLinuxController::GPSHyperionLinuxController(object_id_t objectId, object_id_t parentId,
bool debugHyperionGps)
: ExtendedControllerBase(objectId, objects::NO_OBJECT),
gpsSet(this),
myGpsmm(GPSD_SHARED_MEMORY, nullptr),
debugHyperionGps(debugHyperionGps) {}
debugHyperionGps(debugHyperionGps) {
timeUpdateCd.resetTimer();
}
GPSHyperionLinuxController::~GPSHyperionLinuxController() {}
@ -29,6 +34,16 @@ LocalPoolDataSetBase *GPSHyperionLinuxController::getDataSetHandle(sid_t sid) {
ReturnValue_t GPSHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t *msToReachTheMode) {
if (not modeCommanded) {
if (mode == MODE_ON or mode == MODE_OFF) {
// 5h time to reach fix
*msToReachTheMode = MAX_SECONDS_TO_REACH_FIX;
maxTimeToReachFix.resetTimer();
modeCommanded = true;
} else if (mode == MODE_NORMAL) {
return HasModesIF::INVALID_MODE;
}
}
return HasReturnvaluesIF::RETURN_OK;
}
@ -66,9 +81,7 @@ ReturnValue_t GPSHyperionLinuxController::initializeLocalDataPool(
localDataPoolMap.emplace(GpsHyperion::SATS_IN_USE, new PoolEntry<uint8_t>());
localDataPoolMap.emplace(GpsHyperion::SATS_IN_VIEW, new PoolEntry<uint8_t>());
localDataPoolMap.emplace(GpsHyperion::FIX_MODE, new PoolEntry<uint8_t>());
#if OBSW_ENABLE_PERIODIC_HK == 1
poolManager.subscribeForPeriodicPacket(gpsSet.getSid(), true, 2.0, false);
#endif
poolManager.subscribeForPeriodicPacket(gpsSet.getSid(), false, 30.0, false);
return HasReturnvaluesIF::RETURN_OK;
}
@ -104,17 +117,35 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
gps = myGpsmm.read();
if (gps == nullptr) {
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Reading GPS data failed" << std::endl;
return;
}
PoolReadGuard pg(&gpsSet);
if (pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_VERBOSE_LEVEL >= 1
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Reading dataset failed" << std::endl;
#endif
return;
}
bool validFix = false;
static_cast<void>(validFix);
// 0: Not seen, 1: No fix, 2: 2D-Fix, 3: 3D-Fix
gpsSet.fixMode.value = gps->fix.mode;
int newFixMode = gps->fix.mode;
if (newFixMode == 2 or newFixMode == 3) {
validFix = true;
}
if (gpsSet.fixMode.value != newFixMode) {
triggerEvent(GpsHyperion::GPS_FIX_CHANGE, gpsSet.fixMode.value, newFixMode);
}
gpsSet.fixMode.value = newFixMode;
if (gps->fix.mode == 0 or gps->fix.mode == 1) {
if (modeCommanded and maxTimeToReachFix.hasTimedOut()) {
// We are supposed to be on and functioning, but not fix was found
if (mode == MODE_ON or mode == MODE_NORMAL) {
mode = MODE_OFF;
}
modeCommanded = false;
}
gpsSet.setValidity(false, true);
} else if (gps->satellites_used > 0) {
gpsSet.setValidity(true, true);
@ -153,6 +184,34 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
timeval time = {};
time.tv_sec = gpsSet.unixSeconds.value;
time.tv_usec = gps->fix.time.tv_nsec / 1000;
std::time_t t = std::time(nullptr);
if (time.tv_sec == t) {
timeIsConstantCounter++;
} else {
timeIsConstantCounter = 0;
}
if (timeInit and validFix) {
if (not utility::timeSanityCheck()) {
#if OBSW_VERBOSE_LEVEL >= 1
time_t timeRaw = time.tv_sec;
std::tm *timeTm = std::gmtime(&timeRaw);
sif::info << "Setting invalid system time from GPS data directly: "
<< std::put_time(timeTm, "%c %Z") << std::endl;
#endif
// For some reason, the clock needs to be somewhat correct for NTP to work. Really dumb..
Clock::setClock(&time);
}
timeInit = false;
}
// If the received time does not change anymore for whatever reason, do not set it here
// to avoid stale times. Also, don't do it too often often to avoid jumping times
if (timeIsConstantCounter < 20 and timeUpdateCd.hasTimedOut()) {
// Update the system time here for now. NTP seems to be unable to do so for whatever reason.
// Further tests have shown that the time seems to be set by NTPD after some time..
// Clock::setClock(&time);
timeUpdateCd.resetTimer();
}
Clock::TimeOfDay_t timeOfDay = {};
Clock::convertTimevalToTimeOfDay(&time, &timeOfDay);
gpsSet.year = timeOfDay.year;
@ -173,6 +232,9 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
std::cout << "Longitude: " << gps->fix.longitude << std::endl;
std::cout << "Altitude(MSL): " << gps->fix.altMSL << std::endl;
std::cout << "Speed(m/s): " << gps->fix.speed << std::endl;
std::time_t t = std::time(nullptr);
std::tm tm = *std::gmtime(&t);
std::cout << "C Time: " << std::put_time(&tm, "%c") << std::endl;
}
}
#endif

View File

@ -1,6 +1,7 @@
#ifndef MISSION_DEVICES_GPSHYPERIONHANDLER_H_
#define MISSION_DEVICES_GPSHYPERIONHANDLER_H_
#include "commonSubsystemIds.h"
#include "fsfw/FSFW.h"
#include "fsfw/controller/ExtendedControllerBase.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
@ -21,6 +22,8 @@
*/
class GPSHyperionLinuxController : public ExtendedControllerBase {
public:
static constexpr uint32_t MAX_SECONDS_TO_REACH_FIX = 60 * 60 * 5;
GPSHyperionLinuxController(object_id_t objectId, object_id_t parentId,
bool debugHyperionGps = false);
virtual ~GPSHyperionLinuxController();
@ -46,8 +49,13 @@ class GPSHyperionLinuxController : public ExtendedControllerBase {
private:
GpsPrimaryDataset gpsSet;
Countdown maxTimeToReachFix = Countdown(MAX_SECONDS_TO_REACH_FIX * 1000);
bool modeCommanded = true;
bool timeInit = true;
gpsmm myGpsmm;
bool debugHyperionGps = false;
uint32_t timeIsConstantCounter = 0;
Countdown timeUpdateCd = Countdown(60);
void readGpsDataFromGpsd();
};

View File

@ -0,0 +1,32 @@
#ifndef MPSOC_RETURN_VALUES_IF_H_
#define MPSOC_RETURN_VALUES_IF_H_
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
class MPSoCReturnValuesIF {
public:
static const uint8_t INTERFACE_ID = CLASS_ID::MPSOC_RETURN_VALUES_IF;
//! [EXPORT] : [COMMENT] Space Packet received from PLOC has invalid CRC
static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA0);
//! [EXPORT] : [COMMENT] Received ACK failure reply from PLOC
static const ReturnValue_t RECEIVED_ACK_FAILURE = MAKE_RETURN_CODE(0xA1);
//! [EXPORT] : [COMMENT] Received execution failure reply from PLOC
static const ReturnValue_t RECEIVED_EXE_FAILURE = MAKE_RETURN_CODE(0xA2);
//! [EXPORT] : [COMMENT] Received space packet with invalid APID from PLOC
static const ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(0xA3);
//! [EXPORT] : [COMMENT] Received command with invalid length
static const ReturnValue_t INVALID_LENGTH = MAKE_RETURN_CODE(0xA4);
//! [EXPORT] : [COMMENT] Filename of file in OBC filesystem is too long
static const ReturnValue_t FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xA5);
//! [EXPORT] : [COMMENT] MPSoC helper is currently executing a command
static const ReturnValue_t MPSOC_HELPER_EXECUTING = MAKE_RETURN_CODE(0xA6);
//! [EXPORT] : [COMMENT] Filename of MPSoC file is to long (max. 256 bytes)
static const ReturnValue_t MPSOC_FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xA7);
//! [EXPORT] : [COMMENT] Command has invalid parameter
static const ReturnValue_t INVALID_PARAMETER = MAKE_RETURN_CODE(0xA8);
//! [EXPORT] : [COMMENT] Received command has file string with invalid length
static const ReturnValue_t NAME_TOO_LONG = MAKE_RETURN_CODE(0xA9);
};
#endif /* MPSOC_RETURN_VALUES_IF_H_ */

View File

@ -0,0 +1,668 @@
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_
#define MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_
#include "MPSoCReturnValuesIF.h"
#include "OBSWConfig.h"
#include "eive/definitions.h"
#include "fsfw/globalfunctions/CRC.h"
#include "fsfw/serialize/SerializeAdapter.h"
#include "fsfw/tmtcpacket/SpacePacket.h"
namespace mpsoc {
static const DeviceCommandId_t NONE = 0;
static const DeviceCommandId_t TC_MEM_WRITE = 1;
static const DeviceCommandId_t TC_MEM_READ = 2;
static const DeviceCommandId_t ACK_REPORT = 3;
static const DeviceCommandId_t EXE_REPORT = 5;
static const DeviceCommandId_t TM_MEMORY_READ_REPORT = 6;
static const DeviceCommandId_t TC_FLASHFOPEN = 7;
static const DeviceCommandId_t TC_FLASHFCLOSE = 8;
static const DeviceCommandId_t TC_FLASHWRITE = 9;
static const DeviceCommandId_t TC_FLASHDELETE = 10;
static const DeviceCommandId_t TC_REPLAY_START = 11;
static const DeviceCommandId_t TC_REPLAY_STOP = 12;
static const DeviceCommandId_t TC_REPLAY_WRITE_SEQUENCE = 13;
static const DeviceCommandId_t TC_DOWNLINK_PWR_ON = 14;
static const DeviceCommandId_t TC_DOWNLINK_PWR_OFF = 15;
static const DeviceCommandId_t TC_MODE_REPLAY = 16;
static const DeviceCommandId_t TC_CAM_CMD_SEND = 17;
static const DeviceCommandId_t TC_MODE_IDLE = 18;
static const DeviceCommandId_t TM_CAM_CMD_RPT = 19;
// Will reset the sequence count of the OBSW
static const DeviceCommandId_t OBSW_RESET_SEQ_COUNT = 50;
static const uint16_t SIZE_ACK_REPORT = 14;
static const uint16_t SIZE_EXE_REPORT = 14;
static const uint16_t SIZE_TM_MEM_READ_REPORT = 18;
static const uint16_t SIZE_TM_CAM_CMD_RPT = 18;
/**
* SpacePacket apids of PLOC telecommands and telemetry.
*/
namespace apid {
static const uint16_t TC_REPLAY_START = 0x110;
static const uint16_t TC_REPLAY_STOP = 0x111;
static const uint16_t TC_REPLAY_WRITE_SEQUENCE = 0x112;
static const uint16_t TC_DOWNLINK_PWR_ON = 0x113;
static const uint16_t TC_MEM_WRITE = 0x114;
static const uint16_t TC_MEM_READ = 0x115;
static const uint16_t TC_FLASHWRITE = 0x117;
static const uint16_t TC_FLASHFOPEN = 0x119;
static const uint16_t TC_FLASHFCLOSE = 0x11A;
static const uint16_t TC_FLASHDELETE = 0x11C;
static const uint16_t TC_MODE_REPLAY = 0x11F;
static const uint16_t TC_MODE_IDLE = 0x11E;
static const uint16_t TC_DOWNLINK_PWR_OFF = 0x124;
static const uint16_t TC_CAM_CMD_SEND = 0x12C;
static const uint16_t TM_MEMORY_READ_REPORT = 0x404;
static const uint16_t ACK_SUCCESS = 0x400;
static const uint16_t ACK_FAILURE = 0x401;
static const uint16_t EXE_SUCCESS = 0x402;
static const uint16_t EXE_FAILURE = 0x403;
static const uint16_t TM_CAM_CMD_RPT = 0x407;
} // namespace apid
/** Offset from first byte in space packet to first byte of data field */
static const uint8_t DATA_FIELD_OFFSET = 6;
static const size_t MEM_READ_RPT_LEN_OFFSET = 10;
static const char NULL_TERMINATOR = '\0';
static const uint8_t MIN_SPACE_PACKET_LENGTH = 7;
static const uint8_t SPACE_PACKET_HEADER_SIZE = 6;
/**
* The size of payload data which will be forwarded to the requesting object. e.g. PUS Service
* 8.
*/
static const uint8_t SIZE_MEM_READ_RPT_FIX = 6;
static const size_t MAX_FILENAME_SIZE = 256;
/**
* PLOC space packet length for fixed size packets. This is the size of the whole packet data
* field. For the length field in the space packet this size will be substracted by one.
*/
static const uint16_t LENGTH_TC_MEM_WRITE = 12;
static const uint16_t LENGTH_TC_MEM_READ = 8;
static const size_t MAX_REPLY_SIZE = SpacePacket::PACKET_MAX_SIZE * 3;
static const size_t MAX_COMMAND_SIZE = SpacePacket::PACKET_MAX_SIZE;
static const size_t MAX_DATA_SIZE = 1016;
/**
* The replay write sequence command has a maximum delay for the execution report which amounts to
* 30 seconds. (80 cycles * 0.5 seconds = 40 seconds).
*/
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.
*/
class TcBase : public SpacePacket, public MPSoCReturnValuesIF {
public:
// 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 Function to initialize the space packet
*
* @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::RETURN_OK) {
return result;
}
result = addCrc();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return result;
}
protected:
/**
* @brief Must be overwritten by the child class to define the command specific parameters
*
* @param commandData Pointer to received command data
* @param commandDataLen Length of received command data
*/
virtual ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
return HasReturnvaluesIF::RETURN_OK;
}
/**
* @brief Calculates and adds the CRC
*/
ReturnValue_t addCrc() {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
size_t serializedSize = 0;
uint32_t full_size = getFullSize();
uint16_t crc = CRC::crc16ccitt(getWholeData(), full_size - CRC_SIZE);
result = SerializeAdapter::serialize<uint16_t>(
&crc, this->localData.byteStream + full_size - CRC_SIZE, &serializedSize, sizeof(crc),
SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::debug << "TcBase::addCrc: Failed to serialize crc field" << std::endl;
}
return result;
}
};
/**
* @brief Class for handling tm replies of the PLOC MPSoC.
*/
class TmPacket : public SpacePacket, public MPSoCReturnValuesIF {
public:
/**
* @brief Constructor creates idle packet and sets length field to maximum allowed size.
*/
TmPacket() : SpacePacket(PACKET_MAX_SIZE) {}
ReturnValue_t checkCrc() {
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() - CRC_SIZE);
if (recalculatedCrc != receivedCrc) {
return CRC_FAILURE;
}
return HasReturnvaluesIF::RETURN_OK;
}
};
/**
* @brief This class helps to build the memory read command for the PLOC.
*/
class TcMemRead : public TcBase {
public:
/**
* @brief Constructor
*/
TcMemRead(uint16_t sequenceCount) : TcBase(apid::TC_MEM_READ, sequenceCount) {
this->setPacketDataLength(PACKET_LENGTH);
}
uint16_t getMemLen() const { return memLen; }
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, 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;
}
};
/**
* @brief This class helps to generate the space packet to write data to a memory address within
* the PLOC.
*/
class TcMemWrite : public TcBase {
public:
/**
* @brief Constructor
*/
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;
}
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;
}
};
/**
* @brief Class to help creation of flash fopen command.
*/
class FlashFopen : public TcBase {
public:
FlashFopen(uint16_t sequenceCount) : TcBase(apid::TC_FLASHFOPEN, sequenceCount) {}
static const char APPEND = 'a';
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;
}
private:
char accessMode = APPEND;
};
/**
* @brief Class to help creation of flash fclose command.
*/
class FlashFclose : public TcBase {
public:
FlashFclose(uint16_t sequenceCount) : TcBase(apid::TC_FLASHFCLOSE, sequenceCount) {}
ReturnValue_t createPacket(std::string filename) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
size_t nameSize = filename.size();
std::memcpy(this->getPacketData(), filename.c_str(), nameSize);
*(this->getPacketData() + nameSize) = NULL_TERMINATOR;
this->setPacketDataLength(nameSize + sizeof(NULL_TERMINATOR) + CRC_SIZE - 1);
result = addCrc();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return result;
}
};
/**
* @brief Class to build flash write space packet.
*/
class TcFlashWrite : public TcBase {
public:
TcFlashWrite(uint16_t sequenceCount) : TcBase(apid::TC_FLASHWRITE, sequenceCount) {}
ReturnValue_t createPacket(const uint8_t* writeData, uint32_t writeLen_) {
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;
}
private:
uint32_t writeLen = 0;
};
/**
* @brief Class to help creation of flash delete command.
*/
class TcFlashDelete : public TcBase {
public:
TcFlashDelete(uint16_t sequenceCount) : TcBase(apid::TC_FLASHDELETE, sequenceCount) {}
ReturnValue_t createPacket(std::string filename) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
size_t nameSize = filename.size();
std::memcpy(this->getPacketData(), filename.c_str(), nameSize);
*(this->getPacketData() + nameSize) = NULL_TERMINATOR;
this->setPacketDataLength(nameSize + sizeof(NULL_TERMINATOR) + CRC_SIZE - 1);
result = addCrc();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return result;
}
};
/**
* @brief Class to build replay stop space packet.
*/
class TcReplayStop : public TcBase {
public:
TcReplayStop(uint16_t sequenceCount) : TcBase(apid::TC_REPLAY_STOP, sequenceCount) {}
ReturnValue_t createPacket() {
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;
}
};
/**
* @brief This class helps to build the replay start command.
*/
class TcReplayStart : public TcBase {
public:
/**
* @brief Constructor
*/
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);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
std::memcpy(this->localData.fields.buffer, commandData, commandDataLen);
this->setPacketDataLength(commandDataLen + CRC_SIZE - 1);
return result;
}
private:
static const size_t COMMAND_DATA_LENGTH = 1;
static const uint8_t REPEATING = 0;
static const uint8_t ONCE = 1;
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;
}
ReturnValue_t checkData(uint8_t replay) {
if (replay != REPEATING && replay != ONCE) {
sif::warning << "TcReplayStart::checkData: Invalid replay value" << std::endl;
return INVALID_PARAMETER;
}
return HasReturnvaluesIF::RETURN_OK;
}
};
/**
* @brief This class helps to build downlink power on command.
*/
class TcDownlinkPwrOn : public TcBase {
public:
/**
* @brief Constructor
*/
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);
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;
}
private:
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;
}
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.
*/
class TcDownlinkPwrOff : public TcBase {
public:
TcDownlinkPwrOff(uint16_t sequenceCount) : TcBase(apid::TC_DOWNLINK_PWR_OFF, sequenceCount) {}
ReturnValue_t createPacket() {
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;
}
};
/**
* @brief This class helps to build the replay start command.
*/
class TcReplayWriteSeq : public TcBase {
public:
/**
* @brief Constructor
*/
TcReplayWriteSeq(uint16_t sequenceCount)
: TcBase(apid::TC_REPLAY_WRITE_SEQUENCE, 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);
*(this->localData.fields.buffer + commandDataLen) = NULL_TERMINATOR;
this->setPacketDataLength(commandDataLen + sizeof(NULL_TERMINATOR) + CRC_SIZE - 1);
return result;
}
private:
static const size_t USE_DECODING_LENGTH = 1;
ReturnValue_t lengthCheck(size_t commandDataLen) {
if (commandDataLen > USE_DECODING_LENGTH + MAX_FILENAME_SIZE) {
sif::warning << "TcReplayWriteSeq: Command has invalid length " << commandDataLen
<< std::endl;
return INVALID_LENGTH;
}
return HasReturnvaluesIF::RETURN_OK;
}
};
class FlashWritePusCmd : public MPSoCReturnValuesIF {
public:
FlashWritePusCmd(){};
ReturnValue_t extractFields(const uint8_t* commandData, size_t commandDataLen) {
if (commandDataLen > (config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE + MAX_FILENAME_SIZE)) {
return INVALID_LENGTH;
}
obcFile = std::string(reinterpret_cast<const char*>(commandData));
if (obcFile.size() > (config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE)) {
return FILENAME_TOO_LONG;
}
mpsocFile = std::string(
reinterpret_cast<const char*>(commandData + obcFile.size() + SIZE_NULL_TERMINATOR));
if (mpsocFile.size() > MAX_FILENAME_SIZE) {
return MPSOC_FILENAME_TOO_LONG;
}
return HasReturnvaluesIF::RETURN_OK;
}
std::string getObcFile() { return obcFile; }
std::string getMPSoCFile() { return mpsocFile; }
private:
static const size_t SIZE_NULL_TERMINATOR = 1;
std::string obcFile = "";
std::string mpsocFile = "";
};
/**
* @brief Class to build replay stop space packet.
*/
class TcModeReplay : public TcBase {
public:
TcModeReplay(uint16_t sequenceCount) : TcBase(apid::TC_MODE_REPLAY, sequenceCount) {}
ReturnValue_t createPacket() {
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;
}
};
/**
* @brief Class to build mode idle command
*/
class TcModeIdle : public TcBase {
public:
TcModeIdle(uint16_t sequenceCount) : TcBase(apid::TC_MODE_IDLE, sequenceCount) {}
ReturnValue_t createPacket() {
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;
}
};
class TcCamcmdSend : public TcBase {
public:
TcCamcmdSend(uint16_t sequenceCount) : TcBase(apid::TC_CAM_CMD_SEND, sequenceCount) {}
protected:
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
if (commandDataLen > MAX_DATA_LENGTH) {
return INVALID_LENGTH;
}
std::memcpy(this->getPacketData(), commandData, commandDataLen);
*(this->getPacketData() + commandDataLen) = CARRIAGE_RETURN;
uint16_t trueLength = commandDataLen + sizeof(CARRIAGE_RETURN) + CRC_SIZE;
this->setPacketDataLength(trueLength - 1);
return HasReturnvaluesIF::RETURN_OK;
}
private:
static const uint8_t MAX_DATA_LENGTH = 10;
static const uint8_t CARRIAGE_RETURN = 0xD;
};
} // namespace mpsoc
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ */

View File

@ -8,7 +8,7 @@
#include <fsfw/timemanager/Clock.h>
#include <fsfw/tmtcpacket/SpacePacket.h>
namespace PLOC_SPV {
namespace supv {
/** Command IDs */
static const DeviceCommandId_t NONE = 0;
@ -1541,6 +1541,6 @@ class LatchupStatusReport : public StaticLocalDataSet<LATCHUP_RPT_SET_ENTRIES> {
lp_var_t<uint32_t> isSet =
lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_IS_SET, this);
};
} // namespace PLOC_SPV
} // namespace supv
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCSVPDEFINITIONS_H_ */

Some files were not shown because too many files have changed in this diff Show More