Merge pull request 'v1.7.0' (#91) from develop into main
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

Reviewed-on: #91
This commit is contained in:
Robin Müller 2021-09-02 09:29:48 +02:00
commit 08bc44ce8b
69 changed files with 2079 additions and 683 deletions

View File

@ -153,8 +153,6 @@ if(ADD_JSON_LIB)
add_subdirectory(${LIB_JSON_PATH})
endif()
if(NOT EIVE_BUILD_WATCHDOG)
if(ADD_LINUX_FILES)
add_subdirectory(${LINUX_PATH})
@ -190,9 +188,14 @@ if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG))
${LIB_FSFW_NAME}
${LIB_OS_NAME}
${LIB_LWGPS_NAME}
)
if(TGT_BSP MATCHES "arm/q7s")
target_link_libraries(${TARGET_NAME} PRIVATE
${LIB_ARCSEC}
)
endif()
endif()
if(NOT EIVE_BUILD_WATCHDOG)
if(ADD_CSP_LIB)
@ -214,8 +217,6 @@ if(ADD_JSON_LIB)
)
endif()
target_link_libraries(${TARGET_NAME} PRIVATE
${LIB_CXX_FS}
)
@ -228,6 +229,11 @@ target_include_directories(${TARGET_NAME} PRIVATE
${ARCSEC_LIB_PATH}
)
if(TGT_BSP MATCHES "arm/q7s")
target_include_directories(${TARGET_NAME} PRIVATE
${ARCSEC_LIB_PATH}
)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(WARNING_FLAGS

202
LICENSE Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

13
NOTICE Normal file
View File

@ -0,0 +1,13 @@
Copyright 2021 Institute of Space Systems (IRS), University of Stuttgart
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -924,6 +924,19 @@ Reading data from CAN:
candump can0
````
## Dump content of file in hex
````
cat file.bin | hexdump -C
````
All content will be printed with
````
cat file.bin | hexdump -v
````
To print only the first X bytes of a file
````
cat file.bin | hexdump -v -n X
````
## Preparation of a fresh rootfs and SD card
This section summarizes important changes between a fresh rootfs and the current

View File

@ -134,12 +134,14 @@ void initmission::initTasks() {
objects::INTERNAL_ERROR_REPORTER);
}
bool startTestPst = true;
#if OBSW_ADD_TEST_PST == 1
FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("ACS_PST", 50,
PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc);
result = pst::pstTest(pstTestTask);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "initmission::initTasks: ACS PST initialization failed!" << std::endl;
sif::info << "initmission::initTasks: ACS PST empty or invalid" << std::endl;
startTestPst = false;
}
#endif /* RPI_TEST_ACS_BOARD == 1 */
@ -186,7 +188,9 @@ void initmission::initTasks() {
#endif /* OBSW_ADD_TEST_CODE == 1 */
#if OBSW_ADD_TEST_PST == 1
if(startTestPst) {
pstTestTask->startTask();
}
#endif /* RPI_TEST_ACS_BOARD == 1 */
sif::info << "Tasks started.." << std::endl;
}

View File

@ -1,6 +1,4 @@
#include <fsfw_hal/linux/uart/UartComIF.h>
#include <fsfw_hal/linux/uart/UartCookie.h>
#include <mission/devices/GPSHyperionHandler.h>
#include <devConf.h>
#include "ObjectFactory.h"
#include "objects/systemObjectList.h"
@ -9,14 +7,13 @@
#include "OBSWConfig.h"
#include "tmtc/apid.h"
#include "tmtc/pusIds.h"
#include "spiConf.h"
#include "linux/boardtest/LibgpiodTest.h"
#include "linux/boardtest/SpiTestClass.h"
#include "linux/boardtest/UartTestClass.h"
#include "mission/core/GenericFactory.h"
#include "mission/utility/TmFunnel.h"
#include <mission/devices/GPSHyperionHandler.h>
#include "mission/devices/MGMHandlerLIS3MDL.h"
#include "mission/devices/MGMHandlerRM3100.h"
#include "mission/devices/GyroADIS16507Handler.h"
@ -28,8 +25,13 @@
#include "fsfw/tasks/TaskFactory.h"
/* UDP server includes */
#if OBSW_USE_TMTC_TCP_BRIDGE == 1
#include <fsfw/src/fsfw/osal/common/TcpTmTcBridge.h>
#include <fsfw/src/fsfw/osal/common/TcpTmTcServer.h>
#else
#include "fsfw/osal/common/UdpTmTcBridge.h"
#include "fsfw/osal/common/UdpTcPollingTask.h"
#endif
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
@ -37,6 +39,8 @@
#include "fsfw_hal/common/gpio/GpioCookie.h"
#include "fsfw_hal/linux/spi/SpiCookie.h"
#include "fsfw_hal/linux/spi/SpiComIF.h"
#include <fsfw_hal/linux/uart/UartComIF.h>
#include <fsfw_hal/linux/uart/UartCookie.h>
void Factory::setStaticFrameworkObjectIds() {
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
@ -59,12 +63,27 @@ void ObjectFactory::produce(void* args){
Factory::setStaticFrameworkObjectIds();
ObjectFactory::produceGenericObjects();
#if OBSW_USE_TMTC_TCP_BRIDGE == 1
new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
#else
new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
#endif
GpioIF* gpioIF = new LinuxLibgpioIF(objects::GPIO_IF);
GpioCookie* gpioCookie = nullptr;
static_cast<void>(gpioCookie);
new SpiComIF(objects::SPI_COM_IF, gpioIF);
std::string spiDev;
SpiCookie* spiCookie = nullptr;
static_cast<void>(spiCookie);
#if OBSW_ADD_TEST_CODE == 1
new TestTask(objects::TEST_TASK);
#if RPI_ADD_SPI_TEST == 1
new SpiTestClass(objects::SPI_TEST, gpioIF);
#endif
@ -89,12 +108,6 @@ void ObjectFactory::produce(void* args){
new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookieLoopback);
#endif /* RPI_LOOPBACK_TEST_GPIO == 1 */
new SpiComIF(objects::SPI_COM_IF, gpioIF);
std::string spiDev;
SpiCookie* spiCookie = nullptr;
static_cast<void>(spiCookie);
#if RPI_TEST_ACS_BOARD == 1
if(gpioCookie == nullptr) {
gpioCookie = new GpioCookie();
@ -158,8 +171,9 @@ void ObjectFactory::produce(void* args){
uartCookie->setToFlushInput(true);
uartCookie->setReadCycles(6);
GPSHyperionHandler* gpsHandler = new GPSHyperionHandler(objects::GPS0_HANDLER,
objects::UART_COM_IF, uartCookie);
objects::UART_COM_IF, uartCookie, false);
gpsHandler->setStartUpImmediately();
#endif
#endif /* OBSW_ADD_TEST_CODE == 1 */
}

View File

@ -15,10 +15,7 @@
#define RPI_TEST_ACS_BOARD 0
#endif
#define RPI_ADD_UART_TEST 1
#if RPI_ADD_UART_TEST == 1
#define RPI_TEST_GPS_DEVICE 0
#endif
#define RPI_ADD_UART_TEST 0
/* Adapt these values accordingly */
namespace gpio {

View File

@ -1,4 +1,5 @@
#include "InitMission.h"
#include "OBSWConfig.h"
#include "OBSWVersion.h"
#include "fsfw/FSFWVersion.h"

View File

@ -0,0 +1,56 @@
#ifndef BSP_Q7S_BOARDCONFIG_BUSCONF_H_
#define BSP_Q7S_BOARDCONFIG_BUSCONF_H_
namespace q7s {
static constexpr char SPI_DEFAULT_DEV[] = "/dev/spidev2.0";
static constexpr char SPI_RW_DEV[] = "/dev/spidev3.0";
static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c-1";
static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ttyUL3";
static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ttyUL4";
static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ttyUL8";
static constexpr char GPIO_ACS_BOARD_DEFAULT_CHIP[] = "gpiochip5";
static constexpr char GPIO_MGM2_LIS3_CHIP[] = "gpiochip6";
// TODO: Determine new pins, additional ADIS gyro device
static constexpr uint32_t GPIO_GYRO_0_ADIS_CS = 1;
static constexpr uint32_t GPIO_GYRO_1_L3G_CS = 7;
static constexpr uint32_t GPIO_GYRO_2_ADIS_CS = 3;
static constexpr uint32_t GPIO_GYRO_3_L3G_CS = 3;
static constexpr uint32_t GPIO_MGM_0_LIS3_CS = 5;
static constexpr uint32_t GPIO_MGM_1_RM3100_CS = 16;
static constexpr uint32_t GPIO_MGM_2_LIS3_CS = 0;
static constexpr uint32_t GPIO_MGM_3_RM3100_CS = 10;
static constexpr char GPIO_RW_DEFAULT_CHIP[] = "gpiochip5";
static constexpr uint32_t GPIO_RW_0_CS = 7;
static constexpr uint32_t GPIO_RW_1_CS = 3;
static constexpr uint32_t GPIO_RW_2_CS = 11;
static constexpr uint32_t GPIO_RW_3_CS = 6;
static constexpr char GPIO_RW_SPI_MUX_CHIP[] = "gpiochip11";
static constexpr uint32_t GPIO_RW_SPI_MUX_CS = 57;
static constexpr char GPIO_HEATER_CHIP[] = "gpiochip7";
static constexpr uint32_t GPIO_HEATER_0_PIN = 6;
static constexpr uint32_t GPIO_HEATER_1_PIN = 12;
static constexpr uint32_t GPIO_HEATER_2_PIN = 7;
static constexpr uint32_t GPIO_HEATER_3_PIN = 5;
static constexpr uint32_t GPIO_HEATER_4_PIN = 3;
static constexpr uint32_t GPIO_HEATER_5_PIN = 0;
static constexpr uint32_t GPIO_HEATER_6_PIN = 1;
static constexpr uint32_t GPIO_HEATER_7_PIN = 11;
static constexpr char GPIO_SOLAR_ARR_DEPL_CHIP[] = "gpiochip7";
static constexpr uint32_t GPIO_SOL_DEPL_SA_0_PIN = 4;
static constexpr uint32_t GPIO_SOL_DEPL_SA_1_PIN = 2;
static constexpr char GPIO_RAD_SENSOR_CHIP[] = "gpiochip5";
static constexpr uint32_t GPIO_RAD_SENSOR_CS = 19;
}
#endif /* BSP_Q7S_BOARDCONFIG_BUSCONF_H_ */

View File

@ -1,3 +1,4 @@
#include <bsp_q7s/core/CoreController.h>
#include <bsp_q7s/memory/FileSystemHandler.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include "Q7STestTask.h"
@ -24,6 +25,7 @@ ReturnValue_t Q7STestTask::performOneShotAction() {
//testScratchApi();
//testJsonLibDirect();
//testDummyParams();
//testProtHandler();
//FsOpCodes opCode = FsOpCodes::ATTEMPT_DIR_REMOVAL_NON_EMPTY;
//testFileSystemHandlerDirect(opCode);
return TestTask::performOneShotAction();
@ -131,6 +133,87 @@ void Q7STestTask::testDummyParams() {
sif::info << "Test value 2 (\"blirb\" expected): " << test2 << std::endl;
}
ReturnValue_t Q7STestTask::initialize() {
coreController = ObjectManager::instance()->get<CoreController>(objects::CORE_CONTROLLER);
if(coreController == nullptr) {
sif::warning << "Q7STestTask::initialize: Could not retrieve CORE_CONTROLLER object" <<
std::endl;
}
return TestTask::initialize();
}
void Q7STestTask::testProtHandler() {
bool opPerformed = false;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
// If any chips are unlocked, lock them here
result = coreController->setBootCopyProtection(
CoreController::Chip::ALL_CHIP, CoreController::Copy::ALL_COPY, true,
opPerformed, true);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
}
// unlock own copy
result = coreController->setBootCopyProtection(
CoreController::Chip::SELF_CHIP, CoreController::Copy::SELF_COPY, false,
opPerformed, true);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
}
if(not opPerformed) {
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
}
int retval = std::system("print-chip-prot-status.sh");
if(retval != 0) {
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
}
// lock own copy
result = coreController->setBootCopyProtection(
CoreController::Chip::SELF_CHIP, CoreController::Copy::SELF_COPY, true,
opPerformed, true);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
}
if(not opPerformed) {
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
}
retval = std::system("print-chip-prot-status.sh");
if(retval != 0) {
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
}
// unlock specific copy
result = coreController->setBootCopyProtection(
CoreController::Chip::CHIP_1, CoreController::Copy::COPY_1, false,
opPerformed, true);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
}
if(not opPerformed) {
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
}
retval = std::system("print-chip-prot-status.sh");
if(retval != 0) {
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
}
// lock specific copy
result = coreController->setBootCopyProtection(
CoreController::Chip::CHIP_1, CoreController::Copy::COPY_1, true,
opPerformed, true);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
}
if(not opPerformed) {
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
}
retval = std::system("print-chip-prot-status.sh");
if(retval != 0) {
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
}
}
void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
auto fsHandler = ObjectManager::instance()->
get<FileSystemHandler>(objects::FILE_SYSTEM_HANDLER);

View File

@ -6,7 +6,10 @@
class Q7STestTask: public TestTask {
public:
Q7STestTask(object_id_t objectId);
ReturnValue_t initialize() override;
private:
CoreController* coreController = nullptr;
ReturnValue_t performOneShotAction() override;
void testSdCard();
@ -15,6 +18,7 @@ private:
void testScratchApi();
void testJsonLibDirect();
void testDummyParams();
void testProtHandler();
enum FsOpCodes {
CREATE_EMPTY_FILE_IN_TMP,

View File

@ -21,12 +21,11 @@
#include <filesystem>
CoreController::Chip CoreController::currentChip = Chip::NO_CHIP;
CoreController::Copy CoreController::currentCopy = Copy::NO_COPY;
CoreController::Chip CoreController::CURRENT_CHIP = Chip::NO_CHIP;
CoreController::Copy CoreController::CURRENT_COPY = 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) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
try {
result = initWatchdogFifo();
@ -86,6 +85,28 @@ ReturnValue_t CoreController::initialize() {
return ExtendedControllerBase::initialize();
}
ReturnValue_t CoreController::initializeAfterTaskCreation() {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
if(BLOCKING_SD_INIT) {
ReturnValue_t result = initSdCardBlocking();
if(result != HasReturnvaluesIF::RETURN_OK and result != SdCardManager::ALREADY_MOUNTED) {
sif::warning << "CoreController::CoreController: SD card init failed" << std::endl;
}
}
sdStateMachine();
result = initVersionFile();
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "CoreController::initialize: Version initialization failed" << std::endl;
}
// Add script folder to path
char* currentEnvPath = getenv("PATH");
std::string updatedEnvPath = std::string(currentEnvPath) + ":/home/root/scripts";
setenv("PATH", updatedEnvPath.c_str(), true);
updateProtInfo();
initPrint();
return result;
}
ReturnValue_t CoreController::checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t *msToReachTheMode) {
return HasReturnvaluesIF::RETURN_OK;
@ -197,6 +218,10 @@ ReturnValue_t CoreController::sdStateMachine() {
result = sdcMan->getSdCardActiveStatus(sdInfo.currentState);
determinePreferredSdCard();
updateSdInfoOther();
if(sdInfo.pref != sd::SdCard::SLOT_0 and sdInfo.pref != sd::SdCard::SLOT_1) {
sif::warning << "Preferred SD card invalid. Setting to card 0.." << std::endl;
sdInfo.pref = sd::SdCard::SLOT_0;
}
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Getting SD card activity status failed" << std::endl;
}
@ -535,23 +560,6 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
}
}
ReturnValue_t CoreController::initializeAfterTaskCreation() {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
if(BLOCKING_SD_INIT) {
ReturnValue_t result = initSdCardBlocking();
if(result != HasReturnvaluesIF::RETURN_OK and result != SdCardManager::ALREADY_MOUNTED) {
sif::warning << "CoreController::CoreController: SD card init failed" << std::endl;
}
}
sdStateMachine();
result = initVersionFile();
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "CoreController::initialize: Version initialization failed" << std::endl;
}
initPrint();
return result;
}
ReturnValue_t CoreController::sdColdRedundantBlockingInit() {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
@ -610,7 +618,7 @@ ReturnValue_t CoreController::initVersionFile() {
std::to_string(FSFW_SUBVERSION) + "." + std::to_string(FSFW_REVISION);
std::string systemString = "System: " + unameLine;
std::string mountPrefix = SdCardManager::instance()->getCurrentMountPrefix();
std::string versionFilePath = mountPrefix + "/conf/version.txt";
std::string versionFilePath = mountPrefix + VERSION_FILE;
std::fstream versionFile;
if(not std::filesystem::exists(versionFilePath)) {
@ -727,32 +735,31 @@ ReturnValue_t CoreController::actionListDirectoryIntoFile(ActionId_t actionId,
}
ReturnValue_t CoreController::initBootCopy() {
std::string fileName = "/tmp/curr_copy.txt";
if(not std::filesystem::exists(fileName)) {
if(not std::filesystem::exists(CURR_COPY_FILE)) {
// Thils file is created by the systemd service eive-early-config so this should
// not happen normally
std::string cmd = "xsc_boot_copy > " + fileName;
std::string cmd = "xsc_boot_copy > " + std::string(CURR_COPY_FILE);
int result = std::system(cmd.c_str());
if(result != 0) {
utility::handleSystemError(result, "CoreController::initBootCopy");
}
}
std::ifstream file(fileName);
std::ifstream file(CURR_COPY_FILE);
std::string line;
std::getline(file, line);
std::istringstream iss(line);
int value = 0;
iss >> value;
currentChip = static_cast<Chip>(value);
CURRENT_CHIP = static_cast<Chip>(value);
iss >> value;
currentCopy = static_cast<Copy>(value);
CURRENT_COPY = static_cast<Copy>(value);
return HasReturnvaluesIF::RETURN_OK;
}
void CoreController::getCurrentBootCopy(Chip &chip, Copy &copy) {
// Not really thread-safe but it does not need to be
chip = currentChip;
copy = currentCopy;
chip = CURRENT_CHIP;
copy = CURRENT_COPY;
}
ReturnValue_t CoreController::initWatchdogFifo() {
@ -791,6 +798,7 @@ ReturnValue_t CoreController::actionPerformReboot(const uint8_t *data, size_t si
return HasActionsIF::INVALID_PARAMETERS;
}
bool rebootSameBootCopy = data[0];
bool protOpPerformed;
if(rebootSameBootCopy) {
#if OBSW_VERBOSE_LEVEL >= 1
sif::info << "CoreController::actionPerformReboot: Rebooting on current image" << std::endl;
@ -798,6 +806,12 @@ ReturnValue_t CoreController::actionPerformReboot(const uint8_t *data, size_t si
// Attempt graceful shutdown by unmounting and switching off SD cards
SdCardManager::instance()->switchOffSdCard(sd::SdCard::SLOT_0);
SdCardManager::instance()->switchOffSdCard(sd::SdCard::SLOT_1);
// If any boot copies are unprotected
ReturnValue_t retval = setBootCopyProtection(Chip::SELF_CHIP, Copy::SELF_COPY,
true, protOpPerformed, false);
if(retval == HasReturnvaluesIF::RETURN_OK and protOpPerformed) {
sif::info << "Running slot was writeprotected before reboot" << std::endl;
}
int result = std::system("xsc_boot_copy -r");
if(result != 0) {
utility::handleSystemError(result, "CoreController::executeAction");
@ -812,6 +826,16 @@ ReturnValue_t CoreController::actionPerformReboot(const uint8_t *data, size_t si
sif::info << "CoreController::actionPerformReboot: Rebooting on " <<
static_cast<int>(data[1]) << " " << static_cast<int>(data[2]) << std::endl;
#endif
// Check that the target chip and copy is writeprotected first
generateChipStateFile();
// If any boot copies are unprotected, protect them here
ReturnValue_t retval = setBootCopyProtection(static_cast<Chip>(data[1]),
static_cast<Copy>(data[2]), true, protOpPerformed, false);
if(retval == HasReturnvaluesIF::RETURN_OK and protOpPerformed) {
sif::info << "Target slot was writeprotected before reboot" << std::endl;
}
// The second byte in data is the target chip, the third byte is the target copy
std::string cmdString = "xsc_boot_copy " + std::to_string(data[1]) + " " +
std::to_string(data[2]);
@ -833,7 +857,8 @@ void CoreController::determinePreferredSdCard() {
if(result == scratch::KEY_NOT_FOUND) {
sif::warning << "CoreController::sdCardInit: "
"Preferred SD card not set. Setting to 0" << std::endl;
sdcMan->setPreferredSdCard(sdInfo.pref);
sdcMan->setPreferredSdCard(sd::SdCard::SLOT_0);
sdInfo.pref = sd::SdCard::SLOT_0;
}
else {
sif::warning << "CoreController::sdCardInit: Could not get preferred SD card"
@ -852,19 +877,266 @@ void CoreController::updateSdInfoOther() {
sdInfo.other = sd::SdCard::SLOT_1;
}
else {
else if(sdInfo.pref == sd::SdCard::SLOT_1) {
sdInfo.prefChar = "1";
sdInfo.otherChar = "0";
sdInfo.otherState = sdInfo.currentState.first;
sdInfo.prefState = sdInfo.currentState.second;
sdInfo.other = sd::SdCard::SLOT_0;
}
else {
sif::warning << "CoreController::updateSdInfoOther: Invalid SD card passed" << std::endl;
}
}
bool CoreController::sdInitFinished() const {
return sdInfo.initFinished;
}
ReturnValue_t CoreController::generateChipStateFile() {
int result = std::system(CHIP_PROT_SCRIPT);
if(result != 0) {
utility::handleSystemError(result, "CoreController::generateChipStateFile");
return HasReturnvaluesIF::RETURN_FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t CoreController::setBootCopyProtection(Chip targetChip, Copy targetCopy,
bool protect, bool& protOperationPerformed, bool updateProtFile) {
bool allChips = false;
bool allCopies = false;
bool selfChip = false;
bool selfCopy = false;
protOperationPerformed = false;
switch(targetChip) {
case(Chip::ALL_CHIP): {
allChips = true;
break;
}
case(Chip::NO_CHIP): {
return HasReturnvaluesIF::RETURN_OK;
}
case(Chip::SELF_CHIP): {
selfChip = true;
targetChip = CURRENT_CHIP;
break;
}
default: {
break;
}
}
switch(targetCopy) {
case(Copy::ALL_COPY): {
allCopies = true;
break;
}
case(Copy::NO_COPY): {
return HasReturnvaluesIF::RETURN_OK;
}
case(Copy::SELF_COPY): {
selfCopy = true;
targetCopy = CURRENT_COPY;
break;
}
default: {
break;
}
}
for(uint8_t arrIdx = 0; arrIdx < protArray.size(); arrIdx++) {
int result = handleBootCopyProtAtIndex(targetChip, targetCopy, protect,
protOperationPerformed, selfChip, selfCopy, allChips, allCopies, arrIdx);
if(result != 0) {
break;
}
}
if(protOperationPerformed and updateProtFile) {
updateProtInfo();
}
return HasReturnvaluesIF::RETURN_OK;
}
int CoreController::handleBootCopyProtAtIndex(Chip targetChip, Copy targetCopy, bool protect,
bool &protOperationPerformed, bool selfChip, bool selfCopy, bool allChips,
bool allCopies, uint8_t arrIdx) {
bool currentProt = protArray[arrIdx];
std::ostringstream oss;
bool performOp = false;
if(protect == currentProt) {
return 0;
}
if(protOperationPerformed) {
if((selfChip and selfCopy) or (not allCopies and not allChips)) {
// No need to continue, only one operation was requested
return 1;
}
}
Chip currentChip;
Copy currentCopy;
oss << "writeprotect ";
if(arrIdx == 0 or arrIdx == 1) {
oss << "0 ";
currentChip = Chip::CHIP_0;
}
else {
oss << "1 ";
currentChip = Chip::CHIP_1;
}
if(arrIdx == 0 or arrIdx == 2) {
oss << "0 ";
currentCopy = Copy::COPY_0;
}
else {
oss << "1 ";
currentCopy = Copy::COPY_1;
}
if(protect) {
oss << "1";
}
else {
oss << "0";
}
int result = 0;
if(allChips and allCopies) {
performOp = true;
}
else if(allChips) {
if((selfCopy and CURRENT_COPY == targetCopy) or
(currentCopy == targetCopy)) {
performOp = true;
}
}
else if(allCopies) {
if((selfChip and CURRENT_COPY == targetCopy) or
(currentChip == targetChip)) {
performOp = true;
}
}
else if(selfChip and (currentChip == targetChip)) {
if(selfCopy) {
if(currentCopy == targetCopy) {
performOp = true;
}
}
else {
performOp = true;
}
}
else if(selfCopy and (currentCopy == targetCopy)) {
if(selfChip) {
if(currentChip == targetChip) {
performOp = true;
}
}
else {
performOp = true;
}
}
else if((targetChip == currentChip) and (targetCopy == currentCopy)) {
performOp = true;
}
if(result != 0) {
utility::handleSystemError(result, "CoreController::checkAndSetBootCopyProtection");
}
if(performOp) {
// TODO: Lock operation take a long time. Use command executor? That would require a
// new state machine..
protOperationPerformed = true;
sif::info << "Executing command: " << oss.str() << std::endl;
result = std::system(oss.str().c_str());
}
return 0;
}
ReturnValue_t CoreController::updateProtInfo(bool regenerateChipStateFile) {
using namespace std;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
if(regenerateChipStateFile) {
result = generateChipStateFile();
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "CoreController::updateProtInfo: Generating chip state file failed" <<
std::endl;
return result;
}
}
if(not filesystem::exists(CHIP_STATE_FILE)) {
return HasReturnvaluesIF::RETURN_FAILED;
}
ifstream chipStateFile(CHIP_STATE_FILE);
if(not chipStateFile.good()) {
return HasReturnvaluesIF::RETURN_FAILED;
}
string nextLine;
uint8_t lineCounter = 0;
string word;
while(getline(chipStateFile, nextLine)) {
ReturnValue_t result = handleProtInfoUpdateLine(nextLine);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "CoreController::updateProtInfo: Protection info update failed!" <<
std::endl;
return result;
}
++lineCounter;
if(lineCounter > 4) {
sif::warning << "CoreController::checkAndProtectBootCopy: "
"Line counter larger than 4" << std::endl;
}
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t CoreController::handleProtInfoUpdateLine(std::string nextLine) {
using namespace std;
string word;
uint8_t wordIdx = 0;
uint8_t arrayIdx = 0;
istringstream iss(nextLine);
Chip currentChip;
Copy currentCopy;
while(iss >> word) {
if(wordIdx == 1) {
currentChip = static_cast<Chip>(stoi(word));
}
if(wordIdx == 3) {
currentCopy = static_cast<Copy>(stoi(word));
}
if(wordIdx == 3) {
if(currentChip == Chip::CHIP_0) {
if(currentCopy == Copy::COPY_0) {
arrayIdx = 0;
}
else if(currentCopy == Copy::COPY_1) {
arrayIdx = 1;
}
}
else if(currentChip == Chip::CHIP_1) {
if(currentCopy == Copy::COPY_0) {
arrayIdx = 2;
}
else if(currentCopy == Copy::COPY_1) {
arrayIdx = 3;
}
}
}
if(wordIdx == 5) {
if(word == "unlocked.") {
protArray[arrayIdx] = false;
}
else {
protArray[arrayIdx] = true;
}
}
wordIdx++;
}
return HasReturnvaluesIF::RETURN_OK;
}
void CoreController::performWatchdogControlOperation() {
// Only perform each fifth iteration
if(watchdogFifoFd != 0 and opDivider.checkAndIncrement()) {

View File

@ -16,17 +16,28 @@ public:
enum Chip: uint8_t {
CHIP_0,
CHIP_1,
NO_CHIP
NO_CHIP,
SELF_CHIP,
ALL_CHIP
};
enum Copy: uint8_t {
COPY_0,
COPY_1,
NO_COPY
NO_COPY,
SELF_COPY,
ALL_COPY
};
static constexpr char CHIP_PROT_SCRIPT[] = "/home/root/scripts/get-chip-prot-status.sh";
static constexpr char CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt";
static constexpr char CURR_COPY_FILE[] = "/tmp/curr_copy.txt";
static constexpr char VERSION_FILE[] = "/conf/sd_status";
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
static constexpr ActionId_t REBOOT_OBC = 32;
static constexpr ActionId_t MOUNT_OTHER_COPY = 33;
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CORE;
@ -46,19 +57,39 @@ public:
ReturnValue_t handleCommandMessage(CommandMessage *message) override;
void performControlOperation() override;
/**
* Generate a file containing the chip lock/unlock states inside /tmp/chip_prot_status.txt
* @return
*/
static ReturnValue_t generateChipStateFile();
static ReturnValue_t incrementAllocationFailureCount();
static void getCurrentBootCopy(Chip& chip, Copy& copy);
ReturnValue_t updateProtInfo(bool regenerateChipStateFile = true);
/**
* Checks whether the target chip and copy are write protected and protect set them to a target
* state where applicable.
* @param targetChip
* @param targetCopy
* @param protect Target state
* @param protOperationPerformed [out] Can be used to determine whether any operation
* was performed
* @param updateProtFile Specify whether the protection info file is updated
* @return
*/
ReturnValue_t setBootCopyProtection(Chip targetChip, Copy targetCopy,
bool protect, bool& protOperationPerformed, bool updateProtFile = true);
bool sdInitFinished() const;
private:
static Chip currentChip;
static Copy currentCopy;
static Chip CURRENT_CHIP;
static Copy CURRENT_COPY;
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);
// Designated value for rechecking FIFO open
static constexpr int RETRY_FIFO_OPEN = -2;
int watchdogFifoFd = 0;
// States for SD state machine, which is used in non-blocking mode
enum class SdStates {
@ -85,9 +116,6 @@ private:
SdCardManager* sdcMan = nullptr;
ReturnValue_t initSdCardBlocking();
ReturnValue_t sdStateMachine();
struct SdInfo {
sd::SdCard pref = sd::SdCard::NONE;
sd::SdState prefState = sd::SdState::OFF;
@ -108,9 +136,30 @@ private:
sd::SdCard commandedCard = sd::SdCard::NONE;
sd::SdState commandedState = sd::SdState::OFF;
};
SdInfo sdInfo;
/**
* Index 0: Chip 0 Copy 0
* Index 1: Chip 0 Copy 1
* Index 2: Chip 1 Copy 0
* Index 3: Chip 1 Copy 1
*/
std::array<bool, 4> protArray;
PeriodicOperationDivider opDivider;
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);
ReturnValue_t initVersionFile();
ReturnValue_t initBootCopy();
ReturnValue_t initWatchdogFifo();
ReturnValue_t initSdCardBlocking();
void initPrint();
ReturnValue_t sdStateMachine();
void updateSdInfoOther();
ReturnValue_t sdCardSetup(sd::SdCard sdCard, sd::SdState targetState, std::string sdChar,
bool printOutput = true);
@ -120,24 +169,16 @@ private:
void executeNextExternalSdCommand();
void checkExternalSdCommandStatus();
ReturnValue_t initVersionFile();
ReturnValue_t initBootCopy();
ReturnValue_t initWatchdogFifo();
ReturnValue_t actionListDirectoryIntoFile(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t *data, size_t size);
ReturnValue_t actionPerformReboot(const uint8_t *data, size_t size);
void initPrint();
// Designated value for rechecking FIFO open
static constexpr int RETRY_FIFO_OPEN = -2;
int watchdogFifoFd = 0;
PeriodicOperationDivider opDivider;
void performWatchdogControlOperation();
ReturnValue_t handleProtInfoUpdateLine(std::string nextLine);
int handleBootCopyProtAtIndex(Chip targetChip, Copy targetCopy, bool protect,
bool &protOperationPerformed, bool selfChip, bool selfCopy, bool allChips,
bool allCopies, uint8_t arrIdx);
};
#endif /* BSP_Q7S_CORE_CORECONTROLLER_H_ */

View File

@ -57,13 +57,14 @@ 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(
@ -95,14 +96,7 @@ void initmission::initTasks() {
initmission::printAddObjectError("UDP_POLLING", objects::TMTC_POLLING_TASK);
}
PeriodicTaskIF* plocUpdaterTask = factory->createPeriodicTask(
"PLOC_UPDATER_TASK", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.5, missedDeadlineFunc);
result = plocUpdaterTask->addComponent(objects::PLOC_UPDATER);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PLOC_UPDATER_TASK", objects::PLOC_UPDATER);
}
# if BOARD_TE0720 == 0
// 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(
@ -111,8 +105,9 @@ void initmission::initTasks() {
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER);
}
#endif /* BOARD_TE0720 */
#if TEST_CCSDS_BRIDGE == 1
#if OBSW_TEST_CCSDS_BRIDGE == 1
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE);
@ -125,8 +120,11 @@ void initmission::initTasks() {
createPusTasks(*factory, missedDeadlineFunc, pusTasks);
std::vector<PeriodicTaskIF*> pstTasks;
createPstTasks(*factory, missedDeadlineFunc, pstTasks);
#if OBSW_ADD_TEST_TASK == 1
std::vector<PeriodicTaskIF*> testTasks;
createTestTasks(*factory, missedDeadlineFunc, testTasks);
#endif
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
for(const auto& task: taskVector) {
@ -143,19 +141,23 @@ void initmission::initTasks() {
tmTcDistributor->startTask();
tmtcBridgeTask->startTask();
tmtcPollingTask->startTask();
#if BOARD_TE0720 == 0
coreController->startTask();
plocUpdaterTask->startTask();
#endif
taskStarter(pstTasks, "PST task vector");
taskStarter(pusTasks, "PUS task vector");
#if OBSW_ADD_TEST_CODE == 1
#if OBSW_ADD_TEST_TASK == 1
taskStarter(testTasks, "Test task vector");
#endif
#if TEST_CCSDS_BRIDGE == 1
#if OBSW_TEST_CCSDS_BRIDGE == 1
ptmeTestTask->startTask();
#endif
#if BOARD_TE0720 == 0
fsTask->startTask();
#endif
sif::info << "Tasks started.." << std::endl;
}
@ -203,9 +205,9 @@ void initmission::createPstTasks(TaskFactory& factory,
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl;
}
taskVec.push_back(i2cPst);
taskVec.push_back(gomSpacePstTask);
#else /* BOARD_TE7020 == 0 */
FixedTimeslotTaskIF * pollingSequenceTaskTE0720 = factory->createFixedTimeslotTask(
FixedTimeslotTaskIF * pollingSequenceTaskTE0720 = factory.createFixedTimeslotTask(
"PST_TASK_TE0720", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 3.0,
missedDeadlineFunc);
result = pst::pollingSequenceTE0720(pollingSequenceTaskTE0720);
@ -301,11 +303,11 @@ void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFuncti
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
}
#endif
#if BOARD_TE0720 == 1 && TEST_LIBGPIOD == 1
#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 && TEST_LIBGPIOD == 1 */
#endif /* BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1 */
taskVec.push_back(testTask);
}

View File

@ -1,12 +1,12 @@
#include "ObjectFactory.h"
#include "OBSWConfig.h"
#include "devConf.h"
#include "busConf.h"
#include "tmtc/apid.h"
#include "devices/addresses.h"
#include "devices/gpioIds.h"
#include "tmtc/pusIds.h"
#include "devices/powerSwitcherList.h"
#include "spiConf.h"
#include "bsp_q7s/gpio/gpioCallbacks.h"
#include "bsp_q7s/core/CoreController.h"
#include "bsp_q7s/spiCallbacks/rwSpiCallback.h"
@ -14,6 +14,7 @@
#include "bsp_q7s/memory/FileSystemHandler.h"
#include "bsp_q7s/devices/PlocSupervisorHandler.h"
#include "bsp_q7s/devices/PlocUpdater.h"
#include "bsp_q7s/devices/PlocMemoryDumper.h"
#include "linux/devices/HeaterHandler.h"
#include "linux/devices/SolarArrayDeploymentHandler.h"
@ -21,6 +22,7 @@
#include "linux/devices/SusHandler.h"
#include "linux/csp/CspCookie.h"
#include "linux/csp/CspComIF.h"
#include "linux/obc/CCSDSIPCoreBridge.h"
#include "mission/core/GenericFactory.h"
#include "mission/devices/PDU1Handler.h"
@ -44,9 +46,9 @@
#include "mission/devices/devicedefinitions/RadSensorDefinitions.h"
#include "mission/devices/devicedefinitions/Max31865Definitions.h"
#include "mission/devices/devicedefinitions/RwDefinitions.h"
#include <mission/devices/devicedefinitions/StarTrackerDefinitions.h>
#include "mission/devices/devicedefinitions/StarTrackerDefinitions.h"
#include "mission/devices/GPSHyperionHandler.h"
#include "mission/utility/TmFunnel.h"
#include "linux/obc/CCSDSIPCoreBridge.h"
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw_hal/linux/uart/UartCookie.h"
@ -75,7 +77,7 @@
#include "linux/boardtest/SpiTestClass.h"
#if TEST_LIBGPIOD == 1
#if OBSW_TEST_LIBGPIOD == 1
#include "linux/boardtest/LibgpiodTest.h"
#endif
@ -103,17 +105,19 @@ void Factory::setStaticFrameworkObjectIds() {
void ObjectFactory::produce(void* args){
ObjectFactory::setStatics();
ObjectFactory::produceGenericObjects();
new CoreController(objects::CORE_CONTROLLER);
LinuxLibgpioIF* gpioComIF = nullptr;
createCommunicationInterfaces(&gpioComIF);
UartComIF* uartComIF = nullptr;
SpiComIF* spiComIF = nullptr;
createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiComIF);
createTmpComponents();
#if BOARD_TE0720 == 0
new CoreController(objects::CORE_CONTROLLER);
createPcduComponents();
createRadSensorComponent(gpioComIF);
createSunSensorComponents(gpioComIF);
createSunSensorComponents(gpioComIF, spiComIF);
#if OBSW_ADD_ACS_BOARD == 1
createAcsBoardComponents(gpioComIF);
createAcsBoardComponents(gpioComIF, uartComIF);
#endif /* OBSW_ADD_ACS_BOARD == 1 */
createHeaterComponents();
createSolarArrayDeploymentComponents();
@ -125,17 +129,38 @@ void ObjectFactory::produce(void* args){
createRtdComponents();
#endif /* Q7S_ADD_RTD_DEVICES == 1 */
I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE,
std::string("/dev/i2c-0"));
I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ,
IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV);
new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie);
#if ADD_PLOC_MPSOC == 1
UartCookie* mpsocUartCookie = new UartCookie(objects::RW1, std::string("/dev/ttyUL3"),
UartModes::NON_CANONICAL, 115200, PLOC_MPSOC::MAX_REPLY_SIZE);
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocUartCookie);
#endif /* ADD_PLOC_MPSOC */
createReactionWheelComponents(gpioComIF);
#if OBSW_ADD_PLOC_MPSOC == 1
UartCookie* plocMpsocCookie = new UartCookie(objects::PLOC_MPSOC_HANDLER,
q7s::UART_PLOC_MPSOC_DEV, UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD,
PLOC_MPSOC::MAX_REPLY_SIZE);
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, plocMpsocCookie);
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
#if OBSW_ADD_PLOC_SUPERVISOR == 1
UartCookie* plocSupervisorCookie = new UartCookie(objects::PLOC_SUPERVISOR_HANDLER,
q7s::UART_PLOC_SUPERVSIOR_DEV, UartModes::NON_CANONICAL, uart::PLOC_SUPERVISOR_BAUD,
PLOC_SPV::MAX_PACKET_SIZE * 20);
plocSupervisorCookie->setNoFixedSizeReply();
PlocSupervisorHandler* plocSupervisor = new PlocSupervisorHandler(
objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, plocSupervisorCookie);
plocSupervisor->setStartUpImmediately();
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
new FileSystemHandler(objects::FILE_SYSTEM_HANDLER);
#if OBSW_ADD_STAR_TRACKER == 1
UartCookie* starTrackerCookie = new UartCookie(objects::START_TRACKER,
q7s::UART_STAR_TRACKER_DEV, UartModes::NON_CANONICAL, uart::STAR_TRACKER_BAUD,
StarTracker::MAX_FRAME_SIZE* 2 + 2);
starTrackerCookie->setNoFixedSizeReply();
new StarTrackerHandler(objects::START_TRACKER, objects::UART_COM_IF, starTrackerCookie);
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
#endif /* TE7020 != 0 */
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
@ -148,41 +173,15 @@ void ObjectFactory::produce(void* args){
auto tcpServer = new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
sif::info << "Created TCP server for TMTC commanding with listener port " <<
tcpServer->getTcpPort() << std::endl;
#endif
#endif /* OBSW_USE_TMTC_TCP_BRIDGE == 0 */
/* Test Task */
#if OBSW_ADD_TEST_CODE == 1
createTestComponents();
#endif /* OBSW_ADD_TEST_CODE == 1 */
new FileSystemHandler(objects::FILE_SYSTEM_HANDLER);
#if ADD_PLOC_MPSOC == 1
UartCookie* plocMpsocCookie = new UartCookie(objects::RW1, std::string("/dev/ttyUL3"),
UartModes::NON_CANONICAL, 115200, PLOC_MPSOC::MAX_REPLY_SIZE);
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, plocMpsocCookie);
#endif
#if OBSW_ADD_STAR_TRACKER == 1
UartCookie* starTrackerCookie = new UartCookie(objects::START_TRACKER, std::string("/dev/ttyUL3"),
UartModes::NON_CANONICAL, 115200, StarTracker::MAX_FRAME_SIZE* 2 + 2);
starTrackerCookie->setNoFixedSizeReply();
new StarTrackerHandler(objects::START_TRACKER, objects::UART_COM_IF, starTrackerCookie);
#endif
#if ADD_PLOC_SUPERVISOR == 1
/* Configuration for MIO0 on TE0720-03-1CFA */
UartCookie* plocSupervisorCookie = new UartCookie(objects::PLOC_SUPERVISOR_HANDLER,
std::string("/dev/ttyUL3"), 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 PlocUpdater(objects::PLOC_UPDATER);
new PlocMemoryDumper(objects::PLOC_MEMORY_DUMPER);
}
void ObjectFactory::createTmpComponents() {
@ -193,9 +192,9 @@ void ObjectFactory::createTmpComponents() {
TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0"));
#else
I2cCookie* i2cCookieTmp1075tcs1 = new I2cCookie(addresses::TMP1075_TCS_1,
TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-1"));
TMP1075::MAX_REPLY_LENGTH, q7s::I2C_DEFAULT_DEV);
I2cCookie* i2cCookieTmp1075tcs2 = new I2cCookie(addresses::TMP1075_TCS_2,
TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-1"));
TMP1075::MAX_REPLY_LENGTH, q7s::I2C_DEFAULT_DEV);
#endif
/* Temperature sensors */
@ -209,9 +208,10 @@ void ObjectFactory::createTmpComponents() {
(void) tmp1075Handler_2;
}
void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF **gpioComIF) {
if(gpioComIF == nullptr) {
sif::error << "ObjectFactory::createCommunicationInterfaces: Invalid GPIO ComIF"
void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF **gpioComIF,
UartComIF** uartComIF, SpiComIF** spiComIF) {
if(gpioComIF == nullptr or uartComIF == nullptr or spiComIF == nullptr) {
sif::error << "ObjectFactory::createCommunicationInterfaces: Invalid passed ComIF pointer"
<< std::endl;
}
*gpioComIF = new LinuxLibgpioIF(objects::GPIO_IF);
@ -219,12 +219,15 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF **gpioComIF) {
/* Communication interfaces */
new CspComIF(objects::CSP_COM_IF);
new I2cComIF(objects::I2C_COM_IF);
new UartComIF(objects::UART_COM_IF);
*uartComIF = new UartComIF(objects::UART_COM_IF);
#if Q7S_ADD_SPI_TEST == 0
new SpiComIF(objects::SPI_COM_IF, *gpioComIF);
*spiComIF = new SpiComIF(objects::SPI_COM_IF, *gpioComIF);
#endif /* Q7S_ADD_SPI_TEST == 0 */
#if BOARD_TE0720 == 0
/* Adding gpios for chip select decoding to the gpioComIf */
gpioCallbacks::initSpiCsDecoder(*gpioComIF);
#endif
}
void ObjectFactory::createPcduComponents() {
@ -251,113 +254,110 @@ void ObjectFactory::createPcduComponents() {
* Setting PCDU devices to mode normal immediately after start up because PCDU is always
* running.
*/
/** For now this needs to be commented out because there is no PCDU connected to the OBC */
// p60dockhandler->setModeNormal();
// pdu1handler->setModeNormal();
// pdu2handler->setModeNormal();
// acuhandler->setModeNormal();
(void) p60dockhandler;
(void) pdu1handler;
(void) pdu2handler;
(void) acuhandler;
p60dockhandler->setModeNormal();
pdu1handler->setModeNormal();
pdu2handler->setModeNormal();
acuhandler->setModeNormal();
}
void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
GpioCookie* gpioCookieRadSensor = new GpioCookie;
GpiodRegular* chipSelectRadSensor = new GpiodRegular(std::string("gpiochip5"), 19,
std::string("Chip Select Radiation Sensor"), gpio::OUT, 1);
GpiodRegular* chipSelectRadSensor = new GpiodRegular(q7s::GPIO_RAD_SENSOR_CHIP,
q7s::GPIO_RAD_SENSOR_CS, "Chip Select Radiation Sensor", gpio::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/spidev2.0"), RAD_SENSOR::READ_SIZE, spi::DEFAULT_MAX_1227_MODE,
std::string(q7s::SPI_DEFAULT_DEV), RAD_SENSOR::READ_SIZE, spi::DEFAULT_MAX_1227_MODE,
spi::DEFAULT_MAX_1227_SPEED);
new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor);
}
void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF) {
void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF,
SpiComIF* spiComIF) {
GpioCookie* gpioCookieSus = new GpioCookie();
GpioCallback* susgpio = nullptr;
GpioCallback* susgpio = new GpioCallback(std::string("Chip select SUS 1"), gpio::OUT, 1,
susgpio = new GpioCallback("Chip select SUS 1", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_1, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 2"), gpio::OUT, 1,
susgpio = new GpioCallback("Chip select SUS 2", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_2, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 3"), gpio::OUT, 1,
susgpio = new GpioCallback("Chip select SUS 3", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_3, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 4"), gpio::OUT, 1,
susgpio = new GpioCallback("Chip select SUS 4", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_4, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 5"), gpio::OUT, 1,
susgpio = new GpioCallback("Chip select SUS 5", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_5, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 6"), gpio::OUT, 1,
susgpio = new GpioCallback("Chip select SUS 6", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_6, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 7"), gpio::OUT, 1,
susgpio = new GpioCallback("Chip select SUS 7", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_7, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 8"), gpio::OUT, 1,
susgpio = new GpioCallback("Chip select SUS 8", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_8, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 9"), gpio::OUT, 1,
susgpio = new GpioCallback("Chip select SUS 9", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_9, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 10"), gpio::OUT, 1,
susgpio = new GpioCallback("Chip select SUS 10", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_10, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 11"), gpio::OUT, 1,
susgpio = new GpioCallback("Chip select SUS 11", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_11, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 12"), gpio::OUT, 1,
susgpio = new GpioCallback("Chip select SUS 12", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_12, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 13"), gpio::OUT, 1,
susgpio = new GpioCallback("Chip select SUS 13", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_13, susgpio);
gpioComIF->addGpios(gpioCookieSus);
SpiCookie* spiCookieSus1 = new SpiCookie(addresses::SUS_1, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus2 = new SpiCookie(addresses::SUS_2, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus3 = new SpiCookie(addresses::SUS_3, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus4 = new SpiCookie(addresses::SUS_4, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus5 = new SpiCookie(addresses::SUS_5, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus6 = new SpiCookie(addresses::SUS_6, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus7 = new SpiCookie(addresses::SUS_7, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus8 = new SpiCookie(addresses::SUS_8, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus9 = new SpiCookie(addresses::SUS_9, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus10 = new SpiCookie(addresses::SUS_10, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus11 = new SpiCookie(addresses::SUS_11, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus12 = new SpiCookie(addresses::SUS_12, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus13 = new SpiCookie(addresses::SUS_13, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus1, gpioComIF,
@ -388,38 +388,39 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF) {
gpioIds::CS_SUS_13);
}
void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF) {
void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComIF* uartComIF) {
GpioCookie* gpioCookieAcsBoard = new GpioCookie();
GpiodRegular* gpio = nullptr;
gpio = new GpiodRegular(std::string("gpiochip5"), 1, std::string("CS_GYRO_0_ADIS"),
gpio::OUT, gpio::HIGH);
// TODO: Determine new Gyro GPIO pins
gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_GYRO_0_ADIS_CS,
"CS_GYRO_0_ADIS", gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio);
gpio = new GpiodRegular(std::string("gpiochip5"), 7, std::string("CS_GYRO_1_L3G"),
gpio::OUT, gpio::HIGH);
gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_GYRO_1_L3G_CS,
"CS_GYRO_1_L3G", gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_1_L3G_CS, gpio);
gpio = new GpiodRegular(std::string("gpiochip5"), 3, std::string("CS_GYRO_2_L3G"),
gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_L3G_CS, gpio);
gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_GYRO_2_ADIS_CS,
"CS_GYRO_2_ADIS", gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio);
gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_GYRO_3_L3G_CS,
"CS_GYRO_3_L3G", gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_3_L3G_CS, gpio);
gpio = new GpiodRegular(std::string("gpiochip5"), 5, std::string("CS_MGM_0_LIS3_A"),
gpio::OUT, gpio::HIGH);
gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_MGM_0_LIS3_CS,
"CS_MGM_0_LIS3_A", gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_0_LIS3_CS, gpio);
gpio = new GpiodRegular(std::string("gpiochip5"), 16, std::string("CS_MGM_1_RM3100_A"),
gpio::OUT, gpio::HIGH);
gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_MGM_1_RM3100_CS,
"CS_MGM_1_RM3100_A", gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpio);
gpio = new GpiodRegular(std::string("gpiochip6"), 0, std::string("CS_MGM_2_LIS3_B"),
gpio::OUT, gpio::HIGH);
gpio = new GpiodRegular(q7s::GPIO_MGM2_LIS3_CHIP, q7s::GPIO_MGM_2_LIS3_CS,
"CS_MGM_2_LIS3_B", gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpio);
gpio = new GpiodRegular(std::string("gpiochip5"), 10, std::string("CS_MGM_3_RM3100_B"),
gpio::OUT, gpio::HIGH);
gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_MGM_3_RM3100_CS,
"CS_MGM_3_RM3100_B", gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio);
gpioComIF->addGpios(gpioCookieAcsBoard);
std::string spiDev = "/dev/spidev2.0";
std::string spiDev = q7s::SPI_DEFAULT_DEV;
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 = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER,
@ -460,6 +461,14 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF) {
// gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_2_L3G_HANDLER, objects::SPI_COM_IF,
// spiCookie);
// gyroL3gHandler->setStartUpImmediately();
// TODO: Add GPS device handlers
// auto uartCookieGps0 = new UartCookie(objects::GPS0_HANDLER, deviceFile, uartMode, baudrate,
// maxReplyLen);
// auto uartCookieGps1 = new UartCookie(objects::GPS0_HANDLER, deviceFile, uartMode, baudrate,
// maxReplyLen);
// new GPSHyperionHandler(objects::GPS0_HANDLER, uartComIF);
// new GPSHyperionHandler(objects::GPS1_HANDLER, uartComIF);
}
void ObjectFactory::createHeaterComponents() {
@ -467,38 +476,38 @@ void ObjectFactory::createHeaterComponents() {
GpioCookie* heaterGpiosCookie = new GpioCookie;
/* Pin H2-11 on stack connector */
GpiodRegular* gpioConfigHeater0 = new GpiodRegular(std::string("gpiochip7"), 6,
std::string("Heater0"), gpio::OUT, 0);
GpiodRegular* gpioConfigHeater0 = new GpiodRegular(q7s::GPIO_HEATER_CHIP,
q7s::GPIO_HEATER_0_PIN, "Heater0", gpio::OUT, 0);
heaterGpiosCookie->addGpio(gpioIds::HEATER_0, gpioConfigHeater0);
/* Pin H2-12 on stack connector */
GpiodRegular* gpioConfigHeater1 = new GpiodRegular(std::string("gpiochip7"), 12,
std::string("Heater1"), gpio::OUT, 0);
GpiodRegular* gpioConfigHeater1 = new GpiodRegular(q7s::GPIO_HEATER_CHIP,
q7s::GPIO_HEATER_1_PIN, "Heater1", gpio::OUT, 0);
heaterGpiosCookie->addGpio(gpioIds::HEATER_1, gpioConfigHeater1);
/* Pin H2-13 on stack connector */
GpiodRegular* gpioConfigHeater2 = new GpiodRegular(std::string("gpiochip7"), 7,
std::string("Heater2"), gpio::OUT, 0);
GpiodRegular* gpioConfigHeater2 = new GpiodRegular(q7s::GPIO_HEATER_CHIP,
q7s::GPIO_HEATER_2_PIN, "Heater2", gpio::OUT, 0);
heaterGpiosCookie->addGpio(gpioIds::HEATER_2, gpioConfigHeater2);
GpiodRegular* gpioConfigHeater3 = new GpiodRegular(std::string("gpiochip7"), 5,
std::string("Heater3"), gpio::OUT, 0);
GpiodRegular* gpioConfigHeater3 = new GpiodRegular(q7s::GPIO_HEATER_CHIP,
q7s::GPIO_HEATER_3_PIN, "Heater3", gpio::OUT, 0);
heaterGpiosCookie->addGpio(gpioIds::HEATER_3, gpioConfigHeater3);
GpiodRegular* gpioConfigHeater4 = new GpiodRegular(std::string("gpiochip7"), 3,
std::string("Heater4"), gpio::OUT, 0);
GpiodRegular* gpioConfigHeater4 = new GpiodRegular(q7s::GPIO_HEATER_CHIP,
q7s::GPIO_HEATER_4_PIN, "Heater4", gpio::OUT, 0);
heaterGpiosCookie->addGpio(gpioIds::HEATER_4, gpioConfigHeater4);
GpiodRegular* gpioConfigHeater5 = new GpiodRegular(std::string("gpiochip7"), 0,
std::string("Heater5"), gpio::OUT, 0);
GpiodRegular* gpioConfigHeater5 = new GpiodRegular(q7s::GPIO_HEATER_CHIP,
q7s::GPIO_HEATER_5_PIN, "Heater5", gpio::OUT, 0);
heaterGpiosCookie->addGpio(gpioIds::HEATER_5, gpioConfigHeater5);
GpiodRegular* gpioConfigHeater6 = new GpiodRegular(std::string("gpiochip7"), 1,
std::string("Heater6"), gpio::OUT, 0);
GpiodRegular* gpioConfigHeater6 = new GpiodRegular(q7s::GPIO_HEATER_CHIP,
q7s::GPIO_HEATER_6_PIN, "Heater6", gpio::OUT, 0);
heaterGpiosCookie->addGpio(gpioIds::HEATER_6, gpioConfigHeater6);
GpiodRegular* gpioConfigHeater7 = new GpiodRegular(std::string("gpiochip7"), 11,
std::string("Heater7"), gpio::OUT, 0);
GpiodRegular* gpioConfigHeater7 = new GpiodRegular(q7s::GPIO_HEATER_CHIP,
q7s::GPIO_HEATER_7_PIN, "Heater7", gpio::OUT, 0);
heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpioConfigHeater7);
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie,
@ -508,11 +517,11 @@ void ObjectFactory::createHeaterComponents() {
void ObjectFactory::createSolarArrayDeploymentComponents() {
GpioCookie* solarArrayDeplCookie = new GpioCookie;
GpiodRegular* gpioConfigDeplSA0 = new GpiodRegular(std::string("gpiochip7"), 4,
std::string("DeplSA1"), gpio::OUT, 0);
GpiodRegular* gpioConfigDeplSA0 = new GpiodRegular(q7s::GPIO_SOLAR_ARR_DEPL_CHIP,
q7s::GPIO_SOL_DEPL_SA_0_PIN, "DeplSA0", gpio::OUT, 0);
solarArrayDeplCookie->addGpio(gpioIds::DEPLSA1, gpioConfigDeplSA0);
GpiodRegular* gpioConfigDeplSA1 = new GpiodRegular(std::string("gpiochip7"), 2,
std::string("DeplSA2"), gpio::OUT, 0);
GpiodRegular* gpioConfigDeplSA1 = new GpiodRegular(q7s::GPIO_SOLAR_ARR_DEPL_CHIP,
q7s::GPIO_SOL_DEPL_SA_1_PIN, "DeplSA1", gpio::OUT, 0);
solarArrayDeplCookie->addGpio(gpioIds::DEPLSA2, gpioConfigDeplSA1);
//TODO: Find out burn time. For now set to 1000 ms.
@ -523,7 +532,7 @@ void ObjectFactory::createSolarArrayDeploymentComponents() {
void ObjectFactory::createSyrlinksComponents() {
UartCookie* syrlinksUartCookie = new UartCookie(objects::SYRLINKS_HK_HANDLER,
std::string("/dev/ttyUL0"), UartModes::NON_CANONICAL, 38400, SYRLINKS::MAX_REPLY_SIZE);
std::string("/dev/ttyUL5"), UartModes::NON_CANONICAL, 38400, SYRLINKS::MAX_REPLY_SIZE);
syrlinksUartCookie->setParityEven();
new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie);
@ -532,105 +541,105 @@ void ObjectFactory::createSyrlinksComponents() {
void ObjectFactory::createRtdComponents(LinuxLibgpioIF *gpioComIF) {
GpioCookie* rtdGpioCookie = new GpioCookie;
GpioCallback* gpioRtdIc3 = new GpioCallback(std::string("Chip select RTD IC3"), gpio::OUT, 1,
GpioCallback* gpioRtdIc3 = new GpioCallback("Chip select RTD IC3", gpio::OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC3, gpioRtdIc3);
GpioCallback* gpioRtdIc4 = new GpioCallback(std::string("Chip select RTD IC4"), gpio::OUT, 1,
GpioCallback* gpioRtdIc4 = new GpioCallback("Chip select RTD IC4", gpio::OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC4, gpioRtdIc4);
GpioCallback* gpioRtdIc5 = new GpioCallback(std::string("Chip select RTD IC5"), gpio::OUT, 1,
GpioCallback* gpioRtdIc5 = new GpioCallback("Chip select RTD IC5", gpio::OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC5, gpioRtdIc5);
GpioCallback* gpioRtdIc6 = new GpioCallback(std::string("Chip select RTD IC6"), gpio::OUT, 1,
GpioCallback* gpioRtdIc6 = new GpioCallback("Chip select RTD IC6", gpio::OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC6, gpioRtdIc6);
GpioCallback* gpioRtdIc7 = new GpioCallback(std::string("Chip select RTD IC7"), gpio::OUT, 1,
GpioCallback* gpioRtdIc7 = new GpioCallback("Chip select RTD IC7", gpio::OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC7, gpioRtdIc7);
GpioCallback* gpioRtdIc8 = new GpioCallback(std::string("Chip select RTD IC8"), gpio::OUT, 1,
GpioCallback* gpioRtdIc8 = new GpioCallback("Chip select RTD IC8", gpio::OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC8, gpioRtdIc8);
GpioCallback* gpioRtdIc9 = new GpioCallback(std::string("Chip select RTD IC9"), gpio::OUT, 1,
GpioCallback* gpioRtdIc9 = new GpioCallback("Chip select RTD IC9", gpio::OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC9, gpioRtdIc9);
GpioCallback* gpioRtdIc10 = new GpioCallback(std::string("Chip select RTD IC10"), gpio::OUT, 1,
GpioCallback* gpioRtdIc10 = new GpioCallback("Chip select RTD IC10", gpio::OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC10, gpioRtdIc10);
GpioCallback* gpioRtdIc11 = new GpioCallback(std::string("Chip select RTD IC11"), gpio::OUT, 1,
GpioCallback* gpioRtdIc11 = new GpioCallback("Chip select RTD IC11", gpio::OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC11, gpioRtdIc11);
GpioCallback* gpioRtdIc12 = new GpioCallback(std::string("Chip select RTD IC12"), gpio::OUT, 1,
GpioCallback* gpioRtdIc12 = new GpioCallback("Chip select RTD IC12", gpio::OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC12, gpioRtdIc12);
GpioCallback* gpioRtdIc13 = new GpioCallback(std::string("Chip select RTD IC13"), gpio::OUT, 1,
GpioCallback* gpioRtdIc13 = new GpioCallback("Chip select RTD IC13", gpio::OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC13, gpioRtdIc13);
GpioCallback* gpioRtdIc14 = new GpioCallback(std::string("Chip select RTD IC14"), gpio::OUT, 1,
GpioCallback* gpioRtdIc14 = new GpioCallback("Chip select RTD IC14", gpio::OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC14, gpioRtdIc14);
GpioCallback* gpioRtdIc15 = new GpioCallback(std::string("Chip select RTD IC15"), gpio::OUT, 1,
GpioCallback* gpioRtdIc15 = new GpioCallback("Chip select RTD IC15", gpio::OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC15, gpioRtdIc15);
GpioCallback* gpioRtdIc16 = new GpioCallback(std::string("Chip select RTD IC16"), gpio::OUT, 1,
GpioCallback* gpioRtdIc16 = new GpioCallback("Chip select RTD IC16", gpio::OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC16, gpioRtdIc16);
GpioCallback* gpioRtdIc17 = new GpioCallback(std::string("Chip select RTD IC17"), gpio::OUT, 1,
GpioCallback* gpioRtdIc17 = new GpioCallback("Chip select RTD IC17", gpio::OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC17, gpioRtdIc17);
GpioCallback* gpioRtdIc18 = new GpioCallback(std::string("Chip select RTD IC18"), gpio::OUT, 1,
GpioCallback* gpioRtdIc18 = new GpioCallback("Chip select RTD IC18", gpio::OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC18, gpioRtdIc18);
gpioComIF->addGpios(rtdGpioCookie);
SpiCookie* spiRtdIc3 = new SpiCookie(addresses::RTD_IC3, gpioIds::RTD_IC3,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_3, 2000000);
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc4 = new SpiCookie(addresses::RTD_IC4, gpioIds::RTD_IC4,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc5 = new SpiCookie(addresses::RTD_IC5, gpioIds::RTD_IC5,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc6 = new SpiCookie(addresses::RTD_IC6, gpioIds::RTD_IC6,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc7 = new SpiCookie(addresses::RTD_IC7, gpioIds::RTD_IC7,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc8 = new SpiCookie(addresses::RTD_IC8, gpioIds::RTD_IC8,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc9 = new SpiCookie(addresses::RTD_IC9, gpioIds::RTD_IC9,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc10 = new SpiCookie(addresses::RTD_IC10, gpioIds::RTD_IC10,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc11 = new SpiCookie(addresses::RTD_IC11, gpioIds::RTD_IC11,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc12 = new SpiCookie(addresses::RTD_IC12, gpioIds::RTD_IC12,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc13 = new SpiCookie(addresses::RTD_IC13, gpioIds::RTD_IC13,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc14 = new SpiCookie(addresses::RTD_IC14, gpioIds::RTD_IC14,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc15 = new SpiCookie(addresses::RTD_IC15, gpioIds::RTD_IC15,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 3900000);
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc16 = new SpiCookie(addresses::RTD_IC16, gpioIds::RTD_IC16,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
std::string(q7s::SPI_DEFAULT_DEV), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc17 = new SpiCookie(addresses::RTD_IC17, gpioIds::RTD_IC17,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc18 = new SpiCookie(addresses::RTD_IC18, gpioIds::RTD_IC18,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, spi::RTD_SPEED);
Max31865PT1000Handler* rtdIc3 = new Max31865PT1000Handler(objects::RTD_IC3,
objects::SPI_COM_IF, spiRtdIc3, 0); // 0 is switchId
@ -685,30 +694,30 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF *gpioComIF) {
void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
GpioCookie* gpioCookieRw = new GpioCookie;
GpioCallback* csRw1 = new GpioCallback(std::string("Chip select reaction wheel 1"), gpio::OUT,
1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
GpioCallback* csRw1 = new GpioCallback("Chip select reaction wheel 1", gpio::OUT,
gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW1, csRw1);
GpioCallback* csRw2 = new GpioCallback(std::string("Chip select reaction wheel 2"), gpio::OUT,
1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
GpioCallback* csRw2 = new GpioCallback("Chip select reaction wheel 2", gpio::OUT,
gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW2, csRw2);
GpioCallback* csRw3 = new GpioCallback(std::string("Chip select reaction wheel 3"), gpio::OUT,
1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
GpioCallback* csRw3 = new GpioCallback("Chip select reaction wheel 3", gpio::OUT,
gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW3, csRw3);
GpioCallback* csRw4 = new GpioCallback(std::string("Chip select reaction wheel 4"), gpio::OUT,
1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
GpioCallback* csRw4 = new GpioCallback("Chip select reaction wheel 4", gpio::OUT,
gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW4, csRw4);
GpiodRegular* enRw1 = new GpiodRegular(std::string("gpiochip5"), 7,
std::string("Enable reaction wheel 1"), gpio::OUT, 0);
GpiodRegular* enRw1 = new GpiodRegular(q7s::GPIO_RW_DEFAULT_CHIP, q7s::GPIO_RW_0_CS,
"Enable reaction wheel 1", gpio::OUT, 0);
gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1);
GpiodRegular* enRw2 = new GpiodRegular(std::string("gpiochip5"), 3,
std::string("Enable reaction wheel 2"), gpio::OUT, 0);
GpiodRegular* enRw2 = new GpiodRegular(q7s::GPIO_RW_DEFAULT_CHIP, q7s::GPIO_RW_1_CS,
"Enable reaction wheel 2", gpio::OUT, 0);
gpioCookieRw->addGpio(gpioIds::EN_RW2, enRw2);
GpiodRegular* enRw3 = new GpiodRegular(std::string("gpiochip5"), 11,
std::string("Enable reaction wheel 3"), gpio::OUT, 0);
GpiodRegular* enRw3 = new GpiodRegular(q7s::GPIO_RW_DEFAULT_CHIP, q7s::GPIO_RW_2_CS,
"Enable reaction wheel 3", gpio::OUT, 0);
gpioCookieRw->addGpio(gpioIds::EN_RW3, enRw3);
GpiodRegular* enRw4 = new GpiodRegular(std::string("gpiochip5"), 6,
std::string("Enable reaction wheel 4"), gpio::OUT, 0);
GpiodRegular* enRw4 = new GpiodRegular(q7s::GPIO_RW_DEFAULT_CHIP, q7s::GPIO_RW_3_CS,
"Enable reaction wheel 4", gpio::OUT, 0);
gpioCookieRw->addGpio(gpioIds::EN_RW4, enRw4);
/**
@ -716,22 +725,22 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
* the PS SPI peripheral from the SPI interface and route out the SPI lines of the AXI SPI core.
* Per default the PS SPI is selected (EMIO = 0).
*/
GpiodRegular* spiMux = new GpiodRegular(std::string("gpiochip11"), 54,
std::string("EMIO 0 SPI Mux"), gpio::OUT, 0);
GpiodRegular* spiMux = new GpiodRegular(q7s::GPIO_RW_SPI_MUX_CHIP, q7s::GPIO_RW_SPI_MUX_CS,
"EMIO 0 SPI Mux", gpio::OUT, 0);
gpioCookieRw->addGpio(gpioIds::SPI_MUX, spiMux);
gpioComIF->addGpios(gpioCookieRw);
auto rw1SpiCookie = new SpiCookie(addresses::RW1, gpioIds::CS_RW1, "/dev/spidev3.0",
auto rw1SpiCookie = new SpiCookie(addresses::RW1, gpioIds::CS_RW1, q7s::SPI_RW_DEV,
RwDefinitions::MAX_REPLY_SIZE, spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback,
nullptr);
auto rw2SpiCookie = new SpiCookie(addresses::RW2, gpioIds::CS_RW2, "/dev/spidev3.0",
auto rw2SpiCookie = new SpiCookie(addresses::RW2, gpioIds::CS_RW2, q7s::SPI_RW_DEV,
RwDefinitions::MAX_REPLY_SIZE, spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback,
nullptr);
auto rw3SpiCookie = new SpiCookie(addresses::RW3, gpioIds::CS_RW3, "/dev/spidev3.0",
auto rw3SpiCookie = new SpiCookie(addresses::RW3, gpioIds::CS_RW3, q7s::SPI_RW_DEV,
RwDefinitions::MAX_REPLY_SIZE, spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback,
nullptr);
auto rw4SpiCookie = new SpiCookie(addresses::RW4, gpioIds::CS_RW4, "/dev/spidev3.0",
auto rw4SpiCookie = new SpiCookie(addresses::RW4, gpioIds::CS_RW4, q7s::SPI_RW_DEV,
RwDefinitions::MAX_REPLY_SIZE, spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback,
nullptr);
@ -753,9 +762,12 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
}
void ObjectFactory::createTestComponents() {
new Q7STestTask(objects::TEST_TASK);
#if BOARD_TE0720 == 1 && TEST_LIBGPIOD == 1
#if BOARD_TE0720 == 0
new Q7STestTask(objects::TEST_TASK);
#endif
#if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1
/* Configure MIO0 as input */
GpiodRegular gpioConfigMio0(std::string("gpiochip0"), 0,
std::string("MIO0"), gpio::IN, 0);
@ -764,7 +776,7 @@ void ObjectFactory::createTestComponents() {
new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie);
#endif
#if BOARD_TE0720 == 1 && TEST_SUS_HANDLER == 1
#if BOARD_TE0720 == 1 && OBSW_TEST_SUS_HANDLER == 1
GpioCookie* gpioCookieSus = new GpioCookie;
GpiodRegular* chipSelectSus = new GpiodRegular(std::string("gpiochip1"), 9,
std::string("Chip Select Sus Sensor"), gpio::OUT, 1);
@ -778,7 +790,7 @@ void ObjectFactory::createTestComponents() {
gpioIds::CS_SUS_1);
#endif
#if BOARD_TE0720 == 1 && TEST_CCSDS_BRIDGE == 1
#if BOARD_TE0720 == 1 && OBSW_TEST_CCSDS_BRIDGE == 1
GpioCookie* gpioCookieCcsdsIp = new GpioCookie;
GpiodRegular* papbBusyN = new GpiodRegular(std::string("gpiochip0"), 0, std::string("PAPBBusy_N"));
gpioCookieCcsdsIp->addGpio(gpioIds::PAPB_BUSY_N, papbBusyN);
@ -792,7 +804,7 @@ void ObjectFactory::createTestComponents() {
gpioIds::PAPB_BUSY_N, gpioIds::PAPB_EMPTY);
#endif
#if BOARD_TE0720 == 1 && TEST_RADIATION_SENSOR_HANDLER == 1
#if BOARD_TE0720 == 1 && OBSW_TEST_RADIATION_SENSOR_HANDLER == 1
GpioCookie* gpioCookieRadSensor = new GpioCookie;
GpiodRegular* chipSelectRadSensor = new GpiodRegular(std::string("gpiochip1"), 0,
std::string("Chip select radiation sensor"), gpio::OUT, 1);
@ -808,7 +820,7 @@ void ObjectFactory::createTestComponents() {
radSensor->setStartUpImmediately();
#endif
#if BOARD_TE0720 == 1 && ADD_PLOC_MPSOC == 1
#if BOARD_TE0720 == 1 && OBSW_ADD_PLOC_MPSOC == 1
UartCookie* plocUartCookie = new UartCookie(std::string("/dev/ttyPS1"), 115200,
PLOC_MPSOC::MAX_REPLY_SIZE);
/* Testing PlocMPSoCHandler on TE0720-03-1CFA */
@ -817,7 +829,7 @@ void ObjectFactory::createTestComponents() {
mpsocPlocHandler->setStartUpImmediately();
#endif
#if BOARD_TE0720 == 1 && TE0720_HEATER_TEST == 1
#if BOARD_TE0720 == 1 && OBSW_TEST_TE7020_HEATER == 1
/* Configuration for MIO0 on TE0720-03-1CFA */
GpiodRegular* heaterGpio = new GpiodRegular(std::string("gpiochip0"), 0, std::string("MIO0"), gpio::IN, 0);
GpioCookie* gpioCookie = new GpioCookie;
@ -826,15 +838,15 @@ void ObjectFactory::createTestComponents() {
pcduSwitches::TCS_BOARD_8V_HEATER_IN);
#endif
#if BOARD_TE0720 == 1 && ADD_PLOC_SUPERVISOR == 1
#if BOARD_TE0720 == 1 && OBSW_ADD_PLOC_SUPERVISOR == 1
/* Configuration for MIO0 on TE0720-03-1CFA */
UartCookie* plocSupervisorCookie = new UartCookie(objects::PLOC_SUPERVISOR_HANDLER,
std::string("/dev/ttyPS1"), UartModes::NON_CANONICAL, 115200,
PLOC_SPV::MAX_REPLY_SIZE);
PLOC_SPV::MAX_PACKET_SIZE * 20);
plocSupervisorCookie->setNoFixedSizeReply();
PlocSupervisorHandler* plocSupervisor = new PlocSupervisorHandler(
objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, plocSupervisorCookie);
plocSupervisor->setStartUpImmediately();
#endif
#if Q7S_ADD_SPI_TEST == 1

View File

@ -2,18 +2,21 @@
#define BSP_Q7S_OBJECTFACTORY_H_
class LinuxLibgpioIF;
class UartComIF;
class SpiComIF;
namespace ObjectFactory {
void setStatics();
void produce(void* args);
void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF);
void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, UartComIF** uartComIF,
SpiComIF** spiComIF);
void createTmpComponents();
void createPcduComponents();
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
void createSunSensorComponents(LinuxLibgpioIF* gpioComIF);
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF);
void createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF);
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF);
void createHeaterComponents();
void createSolarArrayDeploymentComponents();
void createSyrlinksComponents();

View File

@ -1,4 +1,5 @@
target_sources(${TARGET_NAME} PRIVATE
PlocSupervisorHandler.cpp
PlocUpdater.cpp
PlocMemoryDumper.cpp
)

View File

@ -0,0 +1,206 @@
#include <fsfw/src/fsfw/serialize/SerializeAdapter.h>
#include "fsfw/ipc/QueueFactory.h"
#include "PlocMemoryDumper.h"
#include <fstream>
#include <filesystem>
#include <string>
PlocMemoryDumper::PlocMemoryDumper(object_id_t objectId) :
SystemObject(objectId), commandActionHelper(this), actionHelper(this, nullptr) {
commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE);
}
PlocMemoryDumper::~PlocMemoryDumper() {
}
ReturnValue_t PlocMemoryDumper::initialize() {
ReturnValue_t result = SystemObject::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = commandActionHelper.initialize();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = actionHelper.initialize(commandQueue);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t PlocMemoryDumper::performOperation(uint8_t operationCode) {
readCommandQueue();
doStateMachine();
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t PlocMemoryDumper::executeAction(ActionId_t actionId,
MessageQueueId_t commandedBy, const uint8_t* data, size_t size) {
if (state != State::IDLE) {
return IS_BUSY;
}
switch (actionId) {
case DUMP_MRAM: {
size_t deserializeSize = sizeof(mram.startAddress) + sizeof(mram.endAddress);
SerializeAdapter::deSerialize(&mram.startAddress, &data, &deserializeSize,
SerializeIF::Endianness::BIG);
SerializeAdapter::deSerialize(&mram.endAddress, &data, &deserializeSize,
SerializeIF::Endianness::BIG);
if (mram.endAddress > MAX_MRAM_ADDRESS) {
return MRAM_ADDRESS_TOO_HIGH;
}
if (mram.endAddress <= mram.startAddress) {
return MRAM_INVALID_ADDRESS_COMBINATION;
}
state = State::COMMAND_FIRST_MRAM_DUMP;
break;
}
default: {
sif::warning << "PlocMemoryDumper::executeAction: Received command with invalid action id"
<< std::endl;
return INVALID_ACTION_ID;
}
}
return EXECUTION_FINISHED;
}
MessageQueueId_t PlocMemoryDumper::getCommandQueue() const {
return commandQueue->getId();
}
MessageQueueIF* PlocMemoryDumper::getCommandQueuePtr() {
return commandQueue;
}
void PlocMemoryDumper::readCommandQueue() {
CommandMessage message;
ReturnValue_t result;
for (result = commandQueue->receiveMessage(&message); result == HasReturnvaluesIF::RETURN_OK;
result = commandQueue->receiveMessage(&message)) {
if (result != RETURN_OK) {
continue;
}
result = actionHelper.handleActionMessage(&message);
if (result == HasReturnvaluesIF::RETURN_OK) {
continue;
}
result = commandActionHelper.handleReply(&message);
if (result == HasReturnvaluesIF::RETURN_OK) {
continue;
}
sif::debug << "PlocMemoryDumper::readCommandQueue: Received message with invalid format"
<< std::endl;
}
}
void PlocMemoryDumper::doStateMachine() {
switch (state) {
case State::IDLE:
break;
case State::COMMAND_FIRST_MRAM_DUMP:
commandNextMramDump(PLOC_SPV::FIRST_MRAM_DUMP);
break;
case State::COMMAND_CONSECUTIVE_MRAM_DUMP:
commandNextMramDump(PLOC_SPV::CONSECUTIVE_MRAM_DUMP);
break;
case State::EXECUTING_MRAM_DUMP:
break;
default:
sif::debug << "PlocMemoryDumper::doStateMachine: Invalid state" << std::endl;
break;
}
}
void PlocMemoryDumper::stepSuccessfulReceived(ActionId_t actionId,
uint8_t step) {
}
void PlocMemoryDumper::stepFailedReceived(ActionId_t actionId, uint8_t step,
ReturnValue_t returnCode) {
}
void PlocMemoryDumper::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {
}
void PlocMemoryDumper::completionSuccessfulReceived(ActionId_t actionId) {
switch (pendingCommand) {
case (PLOC_SPV::FIRST_MRAM_DUMP):
case (PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
if (mram.endAddress == mram.startAddress) {
triggerEvent(MRAM_DUMP_FINISHED);
state = State::IDLE;
}
else {
state = State::COMMAND_CONSECUTIVE_MRAM_DUMP;
}
break;
default:
sif::debug << "PlocMemoryDumper::completionSuccessfulReceived: Invalid pending command"
<< std::endl;
state = State::IDLE;
break;
}
}
void PlocMemoryDumper::completionFailedReceived(ActionId_t actionId,
ReturnValue_t returnCode) {
switch(pendingCommand) {
case(PLOC_SPV::FIRST_MRAM_DUMP):
case(PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
triggerEvent(MRAM_DUMP_FAILED, mram.lastStartAddress);
break;
default:
sif::debug << "PlocMemoryDumper::completionFailedReceived: Invalid pending command "
<< std::endl;
break;
}
state = State::IDLE;
}
void PlocMemoryDumper::commandNextMramDump(ActionId_t dumpCommand) {
ReturnValue_t result = RETURN_OK;
uint32_t tempStartAddress = 0;
uint32_t tempEndAddress = 0;
if (mram.endAddress - mram.startAddress > MAX_MRAM_DUMP_SIZE) {
tempStartAddress = mram.startAddress;
tempEndAddress = mram.startAddress + MAX_MRAM_DUMP_SIZE;
mram.startAddress += MAX_MRAM_DUMP_SIZE;
mram.lastStartAddress = tempStartAddress;
}
else {
tempStartAddress = mram.startAddress;
tempEndAddress = mram.endAddress;
mram.startAddress = mram.endAddress;
}
MemoryParams params(tempStartAddress, tempEndAddress);
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
dumpCommand, &params);
if (result != RETURN_OK) {
sif::warning << "PlocMemoryDumper::commandNextMramDump: Failed to send mram dump command "
<< "with start address " << tempStartAddress << " and end address "
<< tempEndAddress << std::endl;
triggerEvent(SEND_MRAM_DUMP_FAILED, result, tempStartAddress);
state = State::IDLE;
pendingCommand = NONE;
return;
}
state = State::EXECUTING_MRAM_DUMP;
pendingCommand = dumpCommand;
return;
}

View File

@ -0,0 +1,115 @@
#ifndef MISSION_DEVICES_PLOCMEMORYDUMPER_H_
#define MISSION_DEVICES_PLOCMEMORYDUMPER_H_
#include <bsp_q7s/devices/devicedefinitions/PlocMemDumpDefinitions.h>
#include <bsp_q7s/devices/devicedefinitions/PlocSupervisorDefinitions.h>
#include "OBSWConfig.h"
#include "fsfw/action/CommandActionHelper.h"
#include "fsfw/action/ActionHelper.h"
#include "fsfw/action/HasActionsIF.h"
#include "fsfw/action/CommandsActionsIF.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "bsp_q7s/memory/SdCardManager.h"
#include "linux/fsfwconfig/objects/systemObjectList.h"
#include "fsfw/tmtcpacket/SpacePacket.h"
/**
* @brief Because the buffer of the linux tty driver is limited to 2 x 65535 bytes, this class is
* created to perform large dumps of PLOC memories.
*
* @details Currently the PLOC supervisor only implements the functionality to dump the MRAM.
*
* @author J. Meier
*/
class PlocMemoryDumper : public SystemObject,
public HasActionsIF,
public ExecutableObjectIF,
public HasReturnvaluesIF,
public CommandsActionsIF {
public:
static const ActionId_t NONE = 0;
static const ActionId_t DUMP_MRAM = 1;
PlocMemoryDumper(object_id_t objectId);
virtual ~PlocMemoryDumper();
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size);
MessageQueueId_t getCommandQueue() const;
ReturnValue_t initialize() override;
MessageQueueIF* getCommandQueuePtr() override;
void stepSuccessfulReceived(ActionId_t actionId, uint8_t step) override;
void stepFailedReceived(ActionId_t actionId, uint8_t step, ReturnValue_t returnCode) override;
void dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) override;
void completionSuccessfulReceived(ActionId_t actionId) override;
void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) override;
private:
static const uint32_t QUEUE_SIZE = 10;
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_MEMORY_DUMPER;
//! [EXPORT] : [COMMENT] The capacity of the MRAM amounts to 512 kB. Thus the maximum address must not be higher than 0x7d000.
static const ReturnValue_t MRAM_ADDRESS_TOO_HIGH = MAKE_RETURN_CODE(0xA0);
//! [EXPORT] : [COMMENT] The specified end address is lower than the start address
static const ReturnValue_t MRAM_INVALID_ADDRESS_COMBINATION = MAKE_RETURN_CODE(0xA1);
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_MEMORY_DUMPER;
//! [EXPORT] : [COMMENT] 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
static const Event SEND_MRAM_DUMP_FAILED = MAKE_EVENT(0, severity::LOW);
//! [EXPORT] : [COMMENT] Received completion failure report form PLOC supervisor handler
//! P1: MRAM start address of failing dump command
static const Event MRAM_DUMP_FAILED = MAKE_EVENT(1, severity::LOW);
//! [EXPORT] : [COMMENT] MRAM dump finished successfully
static const Event MRAM_DUMP_FINISHED = MAKE_EVENT(2, severity::LOW);
// Maximum size of mram dump which can be retrieved with one command
static const uint32_t MAX_MRAM_DUMP_SIZE = 100000;
static const uint32_t MAX_MRAM_ADDRESS = 0x7d000;
MessageQueueIF* commandQueue = nullptr;
CommandActionHelper commandActionHelper;
ActionHelper actionHelper;
enum class State: uint8_t {
IDLE,
COMMAND_FIRST_MRAM_DUMP,
COMMAND_CONSECUTIVE_MRAM_DUMP,
EXECUTING_MRAM_DUMP
};
State state = State::IDLE;
ActionId_t pendingCommand = NONE;
typedef struct MemoryInfo {
// Stores the start address of the next memory range to dump
uint32_t startAddress;
uint32_t endAddress;
// Stores the start address of the last sent dump command
uint32_t lastStartAddress;
} MemoryInfo_t;
MemoryInfo_t mram = {0, 0, 0};
void readCommandQueue();
void doStateMachine();
/**
* @brief Sends the next mram dump command to the PLOC supervisor handler.
*/
void commandNextMramDump(ActionId_t dumpCommand);
};
#endif /* MISSION_DEVICES_PLOCMEMORYDUMPER_H_ */

View File

@ -34,7 +34,9 @@ ReturnValue_t PlocSupervisorHandler::initialize() {
return INVALID_UART_COM_IF;
}
#if BOARD_TE0720 == 0
sdcMan = SdCardManager::instance();
#endif /* BOARD_TE0720 == 0 */
return result;
}
@ -49,7 +51,7 @@ void PlocSupervisorHandler::doStartUp(){
}
void PlocSupervisorHandler::doShutDown(){
setMode(_MODE_POWER_DOWN);
}
ReturnValue_t PlocSupervisorHandler::buildNormalDeviceCommand(
@ -197,10 +199,10 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(
result = prepareWipeMramCmd(commandData);
break;
}
case(PLOC_SPV::DUMP_MRAM): {
case(PLOC_SPV::FIRST_MRAM_DUMP):
case(PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
result = prepareDumpMramCmd(commandData);
break;
}
case(PLOC_SPV::PRINT_CPU_STATS): {
preparePrintCpuStatsCmd(commandData);
result = RETURN_OK;
@ -317,7 +319,8 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
this->insertInCommandMap(PLOC_SPV::FACTORY_RESET_CLEAR_MIRROR);
this->insertInCommandMap(PLOC_SPV::FACTORY_RESET_CLEAR_CIRCULAR);
this->insertInCommandMap(PLOC_SPV::CAN_LOOPBACK_TEST);
this->insertInCommandAndReplyMap(PLOC_SPV::DUMP_MRAM, 3);
this->insertInCommandAndReplyMap(PLOC_SPV::FIRST_MRAM_DUMP, 3);
this->insertInCommandAndReplyMap(PLOC_SPV::CONSECUTIVE_MRAM_DUMP, 3);
this->insertInReplyMap(PLOC_SPV::ACK_REPORT, 3, nullptr, PLOC_SPV::SIZE_ACK_REPORT);
this->insertInReplyMap(PLOC_SPV::EXE_REPORT, 3, nullptr, PLOC_SPV::SIZE_EXE_REPORT);
this->insertInReplyMap(PLOC_SPV::HK_REPORT, 3, &hkset, PLOC_SPV::SIZE_HK_REPORT);
@ -330,8 +333,12 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t *start,
size_t remainingSize, DeviceCommandId_t *foundId, size_t *foundLen) {
if (nextReplyId == PLOC_SPV::DUMP_MRAM) {
*foundId = PLOC_SPV::DUMP_MRAM;
if (nextReplyId == PLOC_SPV::FIRST_MRAM_DUMP) {
*foundId = PLOC_SPV::FIRST_MRAM_DUMP;
return parseMramPackets(start, remainingSize, foundLen);
}
else if (nextReplyId == PLOC_SPV::CONSECUTIVE_MRAM_DUMP) {
*foundId = PLOC_SPV::CONSECUTIVE_MRAM_DUMP;
return parseMramPackets(start, remainingSize, foundLen);
}
@ -400,10 +407,10 @@ ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
result = handleLatchupStatusReport(packet);
break;
}
case (PLOC_SPV::DUMP_MRAM): {
result = handleMramDumpPacket();
case (PLOC_SPV::FIRST_MRAM_DUMP):
case (PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
result = handleMramDumpPacket(id);
break;
}
case (PLOC_SPV::EXE_REPORT): {
result = handleExecutionReport(packet);
break;
@ -465,6 +472,7 @@ ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_MON, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_YEAR, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_MSEC, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_IS_SET, new PoolEntry<uint32_t>( { 0 }));
return HasReturnvaluesIF::RETURN_OK;
}
@ -508,13 +516,23 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
}
break;
}
case PLOC_SPV::DUMP_MRAM: {
case PLOC_SPV::FIRST_MRAM_DUMP: {
enabledReplies = 2; // expected replies will be increased in handleMramDumpPacket
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
PLOC_SPV::DUMP_MRAM);
PLOC_SPV::FIRST_MRAM_DUMP);
if (result != RETURN_OK) {
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
<< PLOC_SPV::LATCHUP_REPORT << " not in replyMap" << std::endl;
<< PLOC_SPV::FIRST_MRAM_DUMP << " not in replyMap" << std::endl;
}
break;
}
case PLOC_SPV::CONSECUTIVE_MRAM_DUMP: {
enabledReplies = 2; // expected replies will be increased in handleMramDumpPacket
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
PLOC_SPV::CONSECUTIVE_MRAM_DUMP);
if (result != RETURN_OK) {
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
<< PLOC_SPV::CONSECUTIVE_MRAM_DUMP << " not in replyMap" << std::endl;
}
break;
}
@ -555,6 +573,7 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
case PLOC_SPV::FACTORY_RESET_CLEAR_MIRROR:
case PLOC_SPV::FACTORY_RESET_CLEAR_CIRCULAR:
case PLOC_SPV::REQUEST_LOGGING_DATA:
case PLOC_SPV::DISABLE_PERIOIC_HK_TRANSMISSION:
enabledReplies = 2;
break;
default:
@ -736,7 +755,7 @@ ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
nextReplyId = PLOC_SPV::EXE_REPORT;
#if OBSW_VERBOSE_LEVEL >= 1 && PLOC_SUPERVISOR_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_PLOC_SUPERVISOR == 1
sif::info << "PlocSupervisorHandler::handleHkReport: temp_ps: " << hkset.tempPs << std::endl;
sif::info << "PlocSupervisorHandler::handleHkReport: temp_pl: " << hkset.tempPl << std::endl;
sif::info << "PlocSupervisorHandler::handleHkReport: temp_sup: " << hkset.tempSup << std::endl;
@ -793,7 +812,7 @@ ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data)
nextReplyId = PLOC_SPV::EXE_REPORT;
#if OBSW_VERBOSE_LEVEL >= 1 && PLOC_SUPERVISOR_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_PLOC_SUPERVISOR == 1
sif::info << "PlocSupervisorHandler::handleBootStatusReport: Boot signal: "
<< static_cast<unsigned int>(bootStatusReport.bootSignal.value) << std::endl;
sif::info << "PlocSupervisorHandler::handleBootStatusReport: Reset counter: "
@ -865,10 +884,13 @@ ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* da
latchupStatusReport.timeMsec = *(data + offset) << 24 | *(data + offset + 1) << 16 |
*(data + offset + 2) << 8 | *(data + offset + 3);
offset += 4;
latchupStatusReport.isSet = *(data + offset) << 24 | *(data + offset + 1) << 16 |
*(data + offset + 2) << 8 | *(data + offset + 3);
offset += 4;
nextReplyId = PLOC_SPV::EXE_REPORT;
#if OBSW_VERBOSE_LEVEL >= 1 && PLOC_SUPERVISOR_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_PLOC_SUPERVISOR == 1
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: Latchup ID: "
<< static_cast<unsigned int>(latchupStatusReport.id.value) << std::endl;
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: CNT0: "
@ -899,6 +921,8 @@ ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* da
<< latchupStatusReport.timeYear << std::endl;
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: Msec: "
<< latchupStatusReport.timeMsec << std::endl;
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: isSet: 0x"
<< std::hex << latchupStatusReport.timeMsec << std::dec << std::endl;
#endif
return result;
@ -915,8 +939,11 @@ void PlocSupervisorHandler::setNextReplyId() {
case PLOC_SPV::GET_LATCHUP_STATUS_REPORT:
nextReplyId = PLOC_SPV::LATCHUP_REPORT;
break;
case PLOC_SPV::DUMP_MRAM:
nextReplyId = PLOC_SPV::DUMP_MRAM;
case PLOC_SPV::FIRST_MRAM_DUMP:
nextReplyId = PLOC_SPV::FIRST_MRAM_DUMP;
break;
case PLOC_SPV::CONSECUTIVE_MRAM_DUMP:
nextReplyId = PLOC_SPV::CONSECUTIVE_MRAM_DUMP;
break;
default:
/* If no telemetry is expected the next reply is always the execution report */
@ -933,7 +960,8 @@ size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId){
return replyLen;
}
if (nextReplyId == PLOC_SPV::DUMP_MRAM) {
if (nextReplyId == PLOC_SPV::FIRST_MRAM_DUMP
|| nextReplyId == PLOC_SPV::CONSECUTIVE_MRAM_DUMP) {
/**
* Try to read 20 MRAM packets. If reply is larger, the packets will be read with the
* next doSendRead call. The command will be as long active as the packet with the sequence
@ -1338,7 +1366,7 @@ ReturnValue_t PlocSupervisorHandler::parseMramPackets(const uint8_t *packet, siz
return result;
}
ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket() {
ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket(DeviceCommandId_t id) {
ReturnValue_t result = RETURN_FAILED;
@ -1350,24 +1378,24 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket() {
sif::warning << "PlocSupervisorHandler::handleMramDumpPacket: CRC failure" << std::endl;
return result;
}
handleMramDumpFile();
handleMramDumpFile(id);
if (downlinkMramDump == true) {
handleDeviceTM(spacePacketBuffer + PLOC_SPV::SPACE_PACKET_HEADER_LENGTH, packetLen - 1,
PLOC_SPV::DUMP_MRAM);
id);
}
packetInBuffer = false;
receivedMramDumpPackets++;
if (expectedMramDumpPackets == receivedMramDumpPackets) {
nextReplyId = PLOC_SPV::EXE_REPORT;
}
increaseExpectedMramReplies();
increaseExpectedMramReplies(id);
return RETURN_OK;
}
return result;
}
void PlocSupervisorHandler::increaseExpectedMramReplies() {
DeviceReplyMap::iterator mramDumpIter = deviceReplyMap.find(PLOC_SPV::DUMP_MRAM);
void PlocSupervisorHandler::increaseExpectedMramReplies(DeviceCommandId_t id) {
DeviceReplyMap::iterator mramDumpIter = deviceReplyMap.find(id);
DeviceReplyMap::iterator exeReportIter = deviceReplyMap.find(PLOC_SPV::EXE_REPORT);
if (mramDumpIter == deviceReplyMap.end()) {
sif::debug << "PlocSupervisorHandler::increaseExpectedMramReplies: Dump MRAM reply not "
@ -1398,7 +1426,8 @@ void PlocSupervisorHandler::increaseExpectedMramReplies() {
return;
}
uint8_t sequenceFlags = spacePacketBuffer[2] >> 6;
if (sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::LAST_PKT)) {
if (sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::LAST_PKT)
&& (sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) {
// Command expects at least one MRAM packet more and the execution report
info->expectedReplies = 2;
// Wait maximum of 2 cycles for next MRAM packet
@ -1422,16 +1451,19 @@ ReturnValue_t PlocSupervisorHandler::checkMramPacketApid() {
return APERIODIC_REPLY;
}
ReturnValue_t PlocSupervisorHandler::handleMramDumpFile() {
ReturnValue_t PlocSupervisorHandler::handleMramDumpFile(DeviceCommandId_t id) {
ReturnValue_t result = RETURN_OK;
uint16_t packetLen = readSpacePacketLength(spacePacketBuffer);
uint8_t sequenceFlags = readSequenceFlags(spacePacketBuffer);
if (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT)) {
if (id == PLOC_SPV::FIRST_MRAM_DUMP) {
if (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT)
|| (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) {
result = createMramDumpFile();
if (result != RETURN_OK) {
return result;
}
}
}
if (not std::filesystem::exists(activeMramFile)) {
sif::warning << "PlocSupervisorHandler::handleMramDumpFile: MRAM file does not exist"
<< std::endl;
@ -1462,7 +1494,12 @@ ReturnValue_t PlocSupervisorHandler::createMramDumpFile() {
}
std::string filename = "mram-dump--" + timeStamp + ".bin";
#if BOARD_TE0720 == 0
std::string currentMountPrefix = sdcMan->getCurrentMountPrefix();
#else
std::string currentMountPrefix("/mnt/sd0");
#endif /* BOARD_TE0720 == 0 */
// Check if path to PLOC directory exists
if (not std::filesystem::exists(std::string(currentMountPrefix + "/" + plocFilePath))) {

View File

@ -125,7 +125,9 @@ private:
/** This buffer is used to concatenate space packets received in two different read steps */
uint8_t spacePacketBuffer[PLOC_SPV::MAX_PACKET_SIZE];
#if BOARD_TE0720 == 0
SdCardManager* sdcMan = nullptr;
#endif /* BOARD_TE0720 == 0 */
/** Path to PLOC specific files on SD card */
std::string plocFilePath = "ploc";
@ -293,14 +295,14 @@ private:
/**
* @brief This function generates the Service 8 packets for the MRAM dump data.
*/
ReturnValue_t handleMramDumpPacket();
ReturnValue_t handleMramDumpPacket(DeviceCommandId_t id);
/**
* @brief With this function the number of expected replies following an MRAM dump command
* will be increased. This is necessary to release the command in case not all replies
* have been received.
*/
void increaseExpectedMramReplies();
void increaseExpectedMramReplies(DeviceCommandId_t id);
/**
* @brief Function checks if the packet written to the space packet buffer is really a
@ -312,7 +314,7 @@ private:
* @brief Writes the data of the MRAM dump to a file. The file will be created when receiving
* the first packet.
*/
ReturnValue_t handleMramDumpFile();
ReturnValue_t handleMramDumpFile(DeviceCommandId_t id);
/**
* @brief Extracts the length field of a spacePacket referenced by the spacePacket pointer.

View File

@ -14,8 +14,9 @@ PlocUpdater::~PlocUpdater() {
}
ReturnValue_t PlocUpdater::initialize() {
#if BOARD_TE0720 == 0
sdcMan = SdCardManager::instance();
#endif
ReturnValue_t result = SystemObject::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
@ -51,21 +52,37 @@ ReturnValue_t PlocUpdater::executeAction(ActionId_t actionId,
}
switch (actionId) {
case UPDATE_NVM0_A:
updatePartition = Partition::A;
updateMemory = Memory::NVM0;
case UPDATE_A_UBOOT:
image = Image::A;
partition = Partition::UBOOT;
break;
case UPDATE_NVM0_B:
updatePartition = Partition::B;
updateMemory = Memory::NVM0;
case UPDATE_A_BITSTREAM:
image = Image::A;
partition = Partition::BITSTREAM;
break;
case UPDATE_NVM1_A:
updatePartition = Partition::A;
updateMemory = Memory::NVM1;
case UPDATE_A_LINUX:
image = Image::A;
partition = Partition::LINUX_OS;
break;
case UPDATE_NVM1_B:
updatePartition = Partition::B;
updateMemory = Memory::NVM1;
case UPDATE_A_APP_SW:
image = Image::A;
partition = Partition::APP_SW;
break;
case UPDATE_B_UBOOT:
image = Image::B;
partition = Partition::UBOOT;
break;
case UPDATE_B_BITSTREAM:
image = Image::B;
partition = Partition::BITSTREAM;
break;
case UPDATE_B_LINUX:
image = Image::B;
partition = Partition::LINUX_OS;
break;
case UPDATE_B_APP_SW:
image = Image::B;
partition = Partition::APP_SW;
break;
default:
return INVALID_ACTION_ID;
@ -148,6 +165,7 @@ ReturnValue_t PlocUpdater::getImageLocation(const uint8_t* data, size_t size) {
return result;
}
#if BOARD_TE0720 == 0
// Check if file is stored on SD card and if associated SD card is mounted
if (std::string(reinterpret_cast<const char*>(data), SD_PREFIX_LENGTH) == std::string(SdCardManager::SD_0_MOUNT_POINT)) {
if (!isSdCardMounted(sd::SLOT_0)) {
@ -164,6 +182,7 @@ ReturnValue_t PlocUpdater::getImageLocation(const uint8_t* data, size_t size) {
else {
//update image not stored on SD card
}
#endif /* BOARD_TE0720 == 0 */
updateFile = std::string(reinterpret_cast<const char*>(data), size);
@ -174,6 +193,7 @@ ReturnValue_t PlocUpdater::getImageLocation(const uint8_t* data, size_t size) {
return RETURN_OK;
}
#if BOARD_TE0720 == 0
bool PlocUpdater::isSdCardMounted(sd::SdCard sdCard) {
SdCardManager::SdStatePair active;
ReturnValue_t result = sdcMan->getSdCardActiveStatus(active);
@ -202,6 +222,7 @@ bool PlocUpdater::isSdCardMounted(sd::SdCard sdCard) {
}
return false;
}
#endif /* #if BOARD_TE0720 == 0 */
void PlocUpdater::stepSuccessfulReceived(ActionId_t actionId,
uint8_t step) {
@ -287,10 +308,10 @@ void PlocUpdater::commandUpdateAvailable() {
remainingPackets = numOfUpdatePackets;
packetsSent = 0;
uint32_t imageCrc = makeCrc();
calcImageCrc();
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_AVAILABLE, static_cast<uint8_t>(updateMemory),
static_cast<uint8_t>(updatePartition), imageSize, imageCrc, numOfUpdatePackets);
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_AVAILABLE, static_cast<uint8_t>(image),
static_cast<uint8_t>(partition), imageSize, imageCrc, numOfUpdatePackets);
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
PLOC_SPV::UPDATE_AVAILABLE, packet.getWholeData(), packet.getFullSize());
@ -333,7 +354,7 @@ void PlocUpdater::commandUpdatePacket() {
file.close();
// sequence count of first packet is 1
packet.setPacketSequenceCount((packetsSent + 1) & PLOC_SPV::SEQUENCE_COUNT_MASK);
if (numOfUpdatePackets > 0) {
if (numOfUpdatePackets > 1) {
adjustSequenceFlags(packet);
}
packet.makeCrc();
@ -360,8 +381,8 @@ void PlocUpdater::commandUpdatePacket() {
void PlocUpdater::commandUpdateVerify() {
ReturnValue_t result = RETURN_OK;
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_VERIFY, static_cast<uint8_t>(updateMemory),
static_cast<uint8_t>(updatePartition), imageSize, imageCrc, numOfUpdatePackets);
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_VERIFY, static_cast<uint8_t>(image),
static_cast<uint8_t>(partition), imageSize, imageCrc, numOfUpdatePackets);
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
PLOC_SPV::UPDATE_VERIFY, packet.getWholeData(), packet.getFullSize());
@ -378,9 +399,27 @@ void PlocUpdater::commandUpdateVerify() {
return;
}
ReturnValue_t PlocUpdater::makeCrc() {
//TODO: Waiting on input from TAS about the CRC to use
return 0;
void PlocUpdater::calcImageCrc() {
std::ifstream file(updateFile, std::ifstream::binary);
file.seekg(0, file.end);
uint32_t count;
uint32_t bit;
uint32_t remainder = INITIAL_REMAINDER_32;
char input;
for (count = 0; count < imageSize; count++) {
file.seekg(count, file.beg);
file.read(&input, 1);
remainder ^= (input << 16);
for (bit = 8; bit > 0; --bit) {
if (remainder & TOPBIT_32) {
remainder = (remainder << 1) ^ POLYNOMIAL_32;
} else {
remainder = (remainder << 1);
}
}
}
file.close();
imageCrc = (remainder ^ FINAL_XOR_VALUE_32);
}
void PlocUpdater::adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet) {

View File

@ -33,10 +33,14 @@ class PlocUpdater : public SystemObject,
public CommandsActionsIF {
public:
static const ActionId_t UPDATE_NVM0_A = 0;
static const ActionId_t UPDATE_NVM0_B = 1;
static const ActionId_t UPDATE_NVM1_A = 2;
static const ActionId_t UPDATE_NVM1_B = 3;
static const ActionId_t UPDATE_A_UBOOT = 0;
static const ActionId_t UPDATE_A_BITSTREAM = 1;
static const ActionId_t UPDATE_A_LINUX = 2;
static const ActionId_t UPDATE_A_APP_SW = 3;
static const ActionId_t UPDATE_B_UBOOT = 4;
static const ActionId_t UPDATE_B_BITSTREAM = 5;
static const ActionId_t UPDATE_B_LINUX = 6;
static const ActionId_t UPDATE_B_APP_SW = 7;
PlocUpdater(object_id_t objectId);
virtual ~PlocUpdater();
@ -92,10 +96,16 @@ private:
// Maximum size of update payload data per space packet (max size of space packet is 1024 bytes)
static const size_t MAX_SP_DATA = 1016;
static const uint32_t TOPBIT_32 = (1 << 31);
static const uint32_t POLYNOMIAL_32 = 0x04C11DB7;
static const uint32_t INITIAL_REMAINDER_32 = 0xFFFFFFFF;
static const uint32_t FINAL_XOR_VALUE_32 = 0xFFFFFFFF;
MessageQueueIF* commandQueue = nullptr;
#if BOARD_TE0720 == 0
SdCardManager* sdcMan = nullptr;
#endif
CommandActionHelper commandActionHelper;
ActionHelper actionHelper;
@ -112,19 +122,23 @@ private:
ActionId_t pendingCommand = PLOC_SPV::NONE;
enum class Memory: uint8_t {
NVM0,
NVM1
};
Memory updateMemory = Memory::NVM0;
enum class Partition: uint8_t {
enum class Image: uint8_t {
NONE,
A,
B
};
Partition updatePartition = Partition::A;
Image image = Image::NONE;
enum class Partition: uint8_t {
NONE,
UBOOT,
BITSTREAM,
LINUX_OS,
APP_SW
};
Partition partition = Partition::NONE;
uint32_t packetsSent = 0;
uint32_t remainingPackets = 0;
@ -160,12 +174,14 @@ private:
*/
void commandUpdateVerify();
#if BOARD_TE0720 == 0
/**
* @brief Checks whether the SD card to read from is mounted or not.
*/
bool isSdCardMounted(sd::SdCard sdCard);
#endif
ReturnValue_t makeCrc();
void calcImageCrc();
void adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet);
};

View File

@ -0,0 +1,33 @@
#ifndef BSP_Q7S_DEVICES_DEVICEDEFINITIONS_PLOCMEMDUMPDEFINITIONS_H_
#define BSP_Q7S_DEVICES_DEVICEDEFINITIONS_PLOCMEMDUMPDEFINITIONS_H_
#include <fsfw/src/fsfw/serialize/SerialLinkedListAdapter.h>
class MemoryParams: public SerialLinkedListAdapter<SerializeIF> {
public:
/**
* @brief Constructor
* @param startAddress Start of address range to dump
* @param endAddress End of address range to dump
*/
MemoryParams(uint32_t startAddress, uint32_t endAddress) :
startAddress(startAddress), endAddress(endAddress) {
setLinks();
}
private:
void setLinks() {
setStart(&startAddress);
startAddress.setNext(&endAddress);
}
SerializeElement<uint32_t> startAddress;
SerializeElement<uint32_t> endAddress;
};
#endif /* BSP_Q7S_DEVICES_DEVICEDEFINITIONS_PLOCMEMDUMPDEFINITIONS_H_ */

View File

@ -42,7 +42,7 @@ static const DeviceCommandId_t ENABLE_NVMS = 26;
static const DeviceCommandId_t SELECT_NVM = 27;
static const DeviceCommandId_t RUN_AUTO_EM_TESTS = 28;
static const DeviceCommandId_t WIPE_MRAM = 29;
static const DeviceCommandId_t DUMP_MRAM = 30;
static const DeviceCommandId_t FIRST_MRAM_DUMP = 30;
static const DeviceCommandId_t SET_DBG_VERBOSITY = 31;
static const DeviceCommandId_t CAN_LOOPBACK_TEST = 32;
static const DeviceCommandId_t PRINT_CPU_STATS = 33;
@ -55,6 +55,7 @@ static const DeviceCommandId_t UPDATE_IMAGE_DATA = 39;
static const DeviceCommandId_t FACTORY_RESET_CLEAR_MIRROR = 40;
static const DeviceCommandId_t FACTORY_RESET_CLEAR_CIRCULAR = 41;
static const DeviceCommandId_t UPDATE_VERIFY = 42;
static const DeviceCommandId_t CONSECUTIVE_MRAM_DUMP = 43;
/** Reply IDs */
static const DeviceCommandId_t ACK_REPORT = 50;
@ -67,7 +68,7 @@ static const uint16_t SIZE_ACK_REPORT = 14;
static const uint16_t SIZE_EXE_REPORT = 14;
static const uint16_t SIZE_HK_REPORT = 48;
static const uint16_t SIZE_BOOT_STATUS_REPORT = 22;
static const uint16_t SIZE_LATCHUP_STATUS_REPORT = 51;
static const uint16_t SIZE_LATCHUP_STATUS_REPORT = 55;
/**
* SpacePacket apids of telemetry packets
@ -196,11 +197,12 @@ enum PoolIds
LATCHUP_RPT_TIME_YEAR,
LATCHUP_RPT_TIME_MSEC,
LATCHUP_RPT_TIME_USEC,
LATCHUP_RPT_TIME_IS_SET,
};
static const uint8_t HK_SET_ENTRIES = 13;
static const uint8_t BOOT_REPORT_SET_ENTRIES = 8;
static const uint8_t LATCHUP_RPT_SET_ENTRIES = 15;
static const uint8_t LATCHUP_RPT_SET_ENTRIES = 16;
static const uint32_t HK_SET_ID = HK_REPORT;
static const uint32_t BOOT_REPORT_SET_ID = BOOT_STATUS_REPORT;
@ -1445,15 +1447,16 @@ public:
*
* @param apid Packet can be used to generate the update available and the update verify
* packet. Thus the APID must be specified here.
* @param memory The memory to apply the update (NVM0 - 0, NVM1 - 1)
* @param partition The partition to update (A - 0, B - 1)
* @param image The image to update on a NVM (A - 0, B - 1)
* @param partition The partition to update. uboot - 1, bitstream - 2, linux - 3,
* application - 4
* @param imageSize The size of the update image
* param numPackets The number of space packets required to transfer all data.
*/
UpdateInfo(uint16_t apid, uint8_t memory, uint8_t partition, uint32_t imageSize,
UpdateInfo(uint16_t apid, uint8_t image, uint8_t partition, uint32_t imageSize,
uint32_t imageCrc, uint32_t numPackets) :
SupvTcSpacePacket(PAYLOAD_LENGTH, apid), memory(memory), partition(partition), imageSize(
imageSize), numPackets(numPackets) {
SupvTcSpacePacket(PAYLOAD_LENGTH, apid), image(image), partition(partition), imageSize(
imageSize), imageCrc(imageCrc), numPackets(numPackets) {
initPacket();
makeCrc();
}
@ -1462,7 +1465,7 @@ private:
static const uint16_t PAYLOAD_LENGTH = 14; // length without CRC field
uint8_t memory = 0;
uint8_t image = 0;
uint8_t partition = 0;
uint32_t imageSize = 0;
uint32_t imageCrc = 0;
@ -1471,8 +1474,8 @@ private:
void initPacket() {
size_t serializedSize = 0;
uint8_t* data_field_ptr = this->localData.fields.buffer;
SerializeAdapter::serialize<uint8_t>(&memory, &data_field_ptr, &serializedSize,
sizeof(memory), SerializeIF::Endianness::BIG);
SerializeAdapter::serialize<uint8_t>(&image, &data_field_ptr, &serializedSize,
sizeof(image), SerializeIF::Endianness::BIG);
serializedSize = 0;
SerializeAdapter::serialize<uint8_t>(&partition, &data_field_ptr, &serializedSize,
sizeof(partition), SerializeIF::Endianness::BIG);
@ -1599,6 +1602,7 @@ public:
lp_var_t<uint32_t> timeMon = lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_MON, this);
lp_var_t<uint32_t> timeYear = lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_YEAR, this);
lp_var_t<uint32_t> timeMsec = lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_MSEC, this);
lp_var_t<uint32_t> isSet = lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_IS_SET, this);
};
}

View File

@ -42,7 +42,7 @@ void initSpiCsDecoder(GpioIF* gpioComIF) {
GpiodRegular* spiMuxBit5 = new GpiodRegular(std::string("gpiochip7"), 17,
std::string("SPI Mux Bit 5"), gpio::OUT, 0);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit5);
GpiodRegular* spiMuxBit6 = new GpiodRegular(std::string("gpiochip7"), 18,
GpiodRegular* spiMuxBit6 = new GpiodRegular(std::string("gpiochip7"), 9,
std::string("SPI Mux Bit 6"), gpio::OUT, 0);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit6);
GpiodRegular* enRwDecoder = new GpiodRegular(std::string("gpiochip5"), 17,

View File

@ -24,7 +24,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
int fileDescriptor = 0;
std::string device = cookie->getSpiDevice();
UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "rwSpiCallback::spiCallback: ");
UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "rwSpiCallback::spiCallback");
if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) {
sif::error << "rwSpiCallback::spiCallback: Failed to open device file" << std::endl;
return SpiComIF::OPENING_FILE_FAILED;

View File

@ -11,17 +11,6 @@ if(LINK_LWIP)
endif()
endif()
if(LINK_HAL)
message(STATUS "Linking against ${LIB_HAL_NAME} HAL library")
if(LIB_HAL_NAME)
target_link_libraries(${TARGET_NAME} PUBLIC
${LIB_HAL_NAME}
)
else()
message(WARNING "HAL library name not set!")
endif()
endif()
if(LINKER_SCRIPT)
target_link_options(${TARGET_NAME} PRIVATE
-T${LINKER_SCRIPT}
@ -52,11 +41,14 @@ target_compile_options(${TARGET_NAME} PRIVATE
$<$<COMPILE_LANGUAGE:ASM>:${ASM_FLAGS}>
)
set(STRIPPED_TARGET_NAME ${TARGET_NAME}-stripped)
add_custom_command(
TARGET ${TARGET_NAME}
POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -O binary ${TARGET_NAME} ${TARGET_NAME}.bin
COMMENT "Generating binary file ${CMAKE_PROJECT_NAME}.bin.."
COMMAND ${CMAKE_STRIP} --strip-all ${TARGET_NAME} -o ${STRIPPED_TARGET_NAME}
BYPRODUCTS ${STRIPPED_TARGET_NAME}
COMMENT "Generating stripped executable ${STRIPPED_TARGET_NAME}.."
)
endfunction()

View File

@ -42,6 +42,7 @@ find_program (CMAKE_CXX_COMPILER ${CROSS_COMPILE_CXX} REQUIRED)
# Useful utilities, not strictly necessary
find_program(CMAKE_SIZE ${CROSS_COMPILE_SIZE})
find_program(CMAKE_OBJCOPY ${CROSS_COMPILE_OBJCOPY})
find_program(CMAKE_STRIP ${CROSS_COMPILE_STRIP})
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSROOT "${SYSROOT_PATH}")

View File

@ -0,0 +1,35 @@
#!/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/q7s"
build_dir="build-Release-Q7S"
build_generator=""
if [ "${OS}" = "Windows_NT" ]; then
build_generator="MinGW Makefiles"
python="py"
# Could be other OS but this works for now.
else
build_generator="Unix Makefiles"
python="python3"
fi
echo "Running command (without the leading +):"
set -x # Print command
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "size" -t "${tgt_bsp}" \
-l"${build_dir}"
# set +x

View File

@ -21,6 +21,7 @@ enum commonClassIds: uint8_t {
CCSDS_IP_CORE_BRIDGE, //IPCI
PLOC_UPDATER, //PLUD
GOM_SPACE_HANDLER, //GOMS
PLOC_MEMORY_DUMPER, //PLMEMDUMP
COMMON_CLASS_ID_END // [EXPORT] : [END]
};

View File

@ -75,14 +75,15 @@ enum commonObjects: uint32_t {
GPS0_HANDLER = 0x44130045,
GPS1_HANDLER = 0x44130146,
RW1 = 0x44120001,
RW2 = 0x44120002,
RW3 = 0x44120003,
RW4 = 0x44120004,
RW1 = 0x44120047,
RW2 = 0x44120148,
RW3 = 0x44120249,
RW4 = 0x44120350,
START_TRACKER = 0x44130001,
PLOC_UPDATER = 0x44330000
PLOC_UPDATER = 0x44330000,
PLOC_MEMORY_DUMPER = 0x44330001
};
}

View File

@ -18,6 +18,7 @@ enum: uint8_t {
PLOC_SUPERVISOR_HANDLER = 115,
FILE_SYSTEM = 116,
PLOC_UPDATER = 117,
PLOC_MEMORY_DUMPER = 118,
COMMON_SUBSYSTEM_ID_END
};
}

View File

@ -1,5 +1,5 @@
#ifndef COMMON_CONFIG_SPICONF_H_
#define COMMON_CONFIG_SPICONF_H_
#ifndef COMMON_CONFIG_DEVCONF_H_
#define COMMON_CONFIG_DEVCONF_H_
#include <cstdint>
#include <fsfw_hal/linux/spi/spiDefinitions.h>
@ -29,6 +29,16 @@ static constexpr spi::SpiModes DEFAULT_ADIS16507_MODE = spi::SpiModes::MODE_3;
static constexpr uint32_t RW_SPEED = 300000;
static constexpr spi::SpiModes RW_MODE = spi::SpiModes::MODE_0;
static constexpr uint32_t RTD_SPEED = 2000000;
}
#endif /* COMMON_CONFIG_SPICONF_H_ */
namespace uart {
static constexpr uint32_t PLOC_MPSOC_BAUD = 115200;
static constexpr uint32_t PLOC_SUPERVISOR_BAUD = 115200;
static constexpr uint32_t STAR_TRACKER_BAUD = 115200;
}
#endif /* COMMON_CONFIG_DEVCONF_H_ */

2
fsfw

@ -1 +1 @@
Subproject commit 1ac372cb89fabc868aa9cc6ef024f822c744eaed
Subproject commit 882da68a2f0c1301d433d517c449c9c31f3cb35e

View File

@ -90,13 +90,17 @@
11207;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;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h
11208;INVALID_ERROR_BYTE;LOW;Received invalid error byte. This indicates an error of the communication link between IMTQ and OBC.;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h
11301;ERROR_STATE;HIGH;Reaction wheel signals an error state;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/RwHandler.h
11501;SUPV_MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC supervisor crc failure in telemetry packet;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocSupervisorHandler.h
11502;SUPV_ACK_FAILURE;LOW;PLOC supervisor received acknowledgment failure report;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocSupervisorHandler.h
11503;SUPV_EXE_FAILURE;LOW;PLOC received execution failure report;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocSupervisorHandler.h
11504;SUPV_CRC_FAILURE_EVENT;LOW;PLOC supervisor reply has invalid crc;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocSupervisorHandler.h
11700;UPDATE_FILE_NOT_EXISTS;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocUpdater.h
11701;ACTION_COMMANDING_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocUpdater.h
11702;UPDATE_AVAILABLE_FAILED;LOW;Supervisor handler replied action message indicating a command execution failure of the update available command;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocUpdater.h
11703;UPDATE_TRANSFER_FAILED;LOW;Supervisor handler failed to transfer an update space packet. P1: Parameter holds the number of update packets already sent.;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocUpdater.h
11704;UPDATE_VERIFY_FAILED;LOW;Supervisor failed to execute the update verify command.;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocUpdater.h
11705;UPDATE_FINISHED;INFO;MPSoC update successful completed;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocUpdater.h
11501;SUPV_MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC supervisor crc failure in telemetry packet;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h
11502;SUPV_ACK_FAILURE;LOW;PLOC supervisor received acknowledgment failure report;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h
11503;SUPV_EXE_FAILURE;LOW;PLOC received execution failure report;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h
11504;SUPV_CRC_FAILURE_EVENT;LOW;PLOC supervisor reply has invalid crc;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h
11600;SANITIZATION_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/memory/SdCardManager.h
11700;UPDATE_FILE_NOT_EXISTS;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
11701;ACTION_COMMANDING_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
11702;UPDATE_AVAILABLE_FAILED;LOW;Supervisor handler replied action message indicating a command execution failure of the update available command;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
11703;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);C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
11704;UPDATE_VERIFY_FAILED;LOW;Supervisor failed to execute the update verify command.;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
11705;UPDATE_FINISHED;INFO;MPSoC update successful completed;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
11800;SEND_MRAM_DUMP_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocMemoryDumper.h
11801;MRAM_DUMP_FAILED;LOW;Received completion failure report form PLOC supervisor handler P1: MRAM start address of failing dump command;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocMemoryDumper.h
11802;MRAM_DUMP_FINISHED;LOW;MRAM dump finished successfully;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocMemoryDumper.h

1 2200 STORE_SEND_WRITE_FAILED LOW C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
90 11207 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 C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h
91 11208 INVALID_ERROR_BYTE LOW Received invalid error byte. This indicates an error of the communication link between IMTQ and OBC. C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h
92 11301 ERROR_STATE HIGH Reaction wheel signals an error state C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/RwHandler.h
93 11501 SUPV_MEMORY_READ_RPT_CRC_FAILURE LOW PLOC supervisor crc failure in telemetry packet C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocSupervisorHandler.h C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h
94 11502 SUPV_ACK_FAILURE LOW PLOC supervisor received acknowledgment failure report C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocSupervisorHandler.h C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h
95 11503 SUPV_EXE_FAILURE LOW PLOC received execution failure report C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocSupervisorHandler.h C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h
96 11504 SUPV_CRC_FAILURE_EVENT LOW PLOC supervisor reply has invalid crc C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocSupervisorHandler.h C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h
97 11700 11600 UPDATE_FILE_NOT_EXISTS SANITIZATION_FAILED LOW C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocUpdater.h C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/memory/SdCardManager.h
98 11701 11700 ACTION_COMMANDING_FAILED UPDATE_FILE_NOT_EXISTS LOW C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocUpdater.h C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
99 11702 11701 UPDATE_AVAILABLE_FAILED ACTION_COMMANDING_FAILED LOW Supervisor handler replied action message indicating a command execution failure of the update available command C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocUpdater.h C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
100 11703 11702 UPDATE_TRANSFER_FAILED UPDATE_AVAILABLE_FAILED LOW Supervisor handler failed to transfer an update space packet. P1: Parameter holds the number of update packets already sent. Supervisor handler replied action message indicating a command execution failure of the update available command C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocUpdater.h C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
101 11704 11703 UPDATE_VERIFY_FAILED UPDATE_TRANSFER_FAILED LOW Supervisor failed to execute the update verify command. Supervisor handler failed to transfer an update space packet. P1: Parameter holds the number of update packets already sent (inclusive the failed packet) C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocUpdater.h C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
102 11705 11704 UPDATE_FINISHED UPDATE_VERIFY_FAILED INFO LOW MPSoC update successful completed Supervisor failed to execute the update verify command. C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocUpdater.h C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
103 11705 UPDATE_FINISHED INFO MPSoC update successful completed C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
104 11800 SEND_MRAM_DUMP_FAILED LOW C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocMemoryDumper.h
105 11801 MRAM_DUMP_FAILED LOW Received completion failure report form PLOC supervisor handler P1: MRAM start address of failing dump command C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocMemoryDumper.h
106 11802 MRAM_DUMP_FINISHED LOW MRAM dump finished successfully C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocMemoryDumper.h

View File

@ -2,10 +2,6 @@
0x43000003;CORE_CONTROLLER
0x43100002;ACS_CONTROLLER
0x43400001;THERMAL_CONTROLLER
0x44120001;RW1
0x44120002;RW2
0x44120003;RW3
0x44120004;RW4
0x44120006;MGM_0_LIS3_HANDLER
0x44120010;GYRO_0_ADIS_HANDLER
0x44120032;SUS_1
@ -21,12 +17,16 @@
0x44120042;SUS_11
0x44120043;SUS_12
0x44120044;SUS_13
0x44120047;RW1
0x44120107;MGM_1_RM3100_HANDLER
0x44120111;GYRO_1_L3G_HANDLER
0x44120148;RW2
0x44120208;MGM_2_LIS3_HANDLER
0x44120212;GYRO_2_ADIS_HANDLER
0x44120249;RW3
0x44120309;MGM_3_RM3100_HANDLER
0x44120313;GYRO_3_L3G_HANDLER
0x44120350;RW4
0x44130001;START_TRACKER
0x44130045;GPS0_HANDLER
0x44130146;GPS1_HANDLER
@ -38,6 +38,7 @@
0x44250003;ACU_HANDLER
0x443200A5;RAD_SENSOR
0x44330000;PLOC_UPDATER
0x44330001;PLOC_MEMORY_DUMPER
0x44330015;PLOC_MPSOC_HANDLER
0x44330016;PLOC_SUPERVISOR_HANDLER
0x444100A2;SOLAR_ARRAY_DEPL_HANDLER

1 0x00005060 P60DOCK_TEST_TASK
2 0x43000003 CORE_CONTROLLER
3 0x43100002 ACS_CONTROLLER
4 0x43400001 THERMAL_CONTROLLER
0x44120001 RW1
0x44120002 RW2
0x44120003 RW3
0x44120004 RW4
5 0x44120006 MGM_0_LIS3_HANDLER
6 0x44120010 GYRO_0_ADIS_HANDLER
7 0x44120032 SUS_1
17 0x44120042 SUS_11
18 0x44120043 SUS_12
19 0x44120044 SUS_13
20 0x44120047 RW1
21 0x44120107 MGM_1_RM3100_HANDLER
22 0x44120111 GYRO_1_L3G_HANDLER
23 0x44120148 RW2
24 0x44120208 MGM_2_LIS3_HANDLER
25 0x44120212 GYRO_2_ADIS_HANDLER
26 0x44120249 RW3
27 0x44120309 MGM_3_RM3100_HANDLER
28 0x44120313 GYRO_3_L3G_HANDLER
29 0x44120350 RW4
30 0x44130001 START_TRACKER
31 0x44130045 GPS0_HANDLER
32 0x44130146 GPS1_HANDLER
38 0x44250003 ACU_HANDLER
39 0x443200A5 RAD_SENSOR
40 0x44330000 PLOC_UPDATER
41 0x44330001 PLOC_MEMORY_DUMPER
42 0x44330015 PLOC_MPSOC_HANDLER
43 0x44330016 PLOC_SUPERVISOR_HANDLER
44 0x444100A2 SOLAR_ARRAY_DEPL_HANDLER

View File

@ -51,7 +51,7 @@ SUBSYSTEM_DEFINITION_DESTINATIONS = [
]
HEADER_DEFINITION_DESTINATIONS = [
f"{OBSW_ROOT_DIR}/mission/", f"{OBSW_ROOT_DIR}/fsfw/", f"{FSFW_CONFIG_ROOT}",
f"{OBSW_ROOT_DIR}/test/"
f"{OBSW_ROOT_DIR}/test/", f"{OBSW_ROOT_DIR}/bsp_q7s"
]

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 102 translations.
* @brief Auto-generated event translation file. Contains 106 translations.
* @details
* Generated on: 2021-08-07 18:11:16
* Generated on: 2021-08-31 10:50:10
*/
#include "translateEvents.h"
@ -101,12 +101,16 @@ 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 *SANITIZATION_FAILED_STRING = "SANITIZATION_FAILED";
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";
const char *UPDATE_TRANSFER_FAILED_STRING = "UPDATE_TRANSFER_FAILED";
const char *UPDATE_VERIFY_FAILED_STRING = "UPDATE_VERIFY_FAILED";
const char *UPDATE_FINISHED_STRING = "UPDATE_FINISHED";
const char *SEND_MRAM_DUMP_FAILED_STRING = "SEND_MRAM_DUMP_FAILED";
const char *MRAM_DUMP_FAILED_STRING = "MRAM_DUMP_FAILED";
const char *MRAM_DUMP_FINISHED_STRING = "MRAM_DUMP_FINISHED";
const char * translateEvents(Event event) {
switch( (event & 0xffff) ) {
@ -302,6 +306,8 @@ const char * translateEvents(Event event) {
return SUPV_EXE_FAILURE_STRING;
case(11504):
return SUPV_CRC_FAILURE_EVENT_STRING;
case(11600):
return SANITIZATION_FAILED_STRING;
case(11700):
return UPDATE_FILE_NOT_EXISTS_STRING;
case(11701):
@ -314,6 +320,12 @@ const char * translateEvents(Event event) {
return UPDATE_VERIFY_FAILED_STRING;
case(11705):
return UPDATE_FINISHED_STRING;
case(11800):
return SEND_MRAM_DUMP_FAILED_STRING;
case(11801):
return MRAM_DUMP_FAILED_STRING;
case(11802):
return MRAM_DUMP_FINISHED_STRING;
default:
return "UNKNOWN_EVENT";
}

View File

@ -1,8 +1,8 @@
/**
* @brief Auto-generated object translation file.
* @details
* Contains 104 translations.
* Generated on: 2021-08-07 18:08:35
* Contains 105 translations.
* Generated on: 2021-08-31 10:31:24
*/
#include "translateObjects.h"
@ -10,10 +10,6 @@ const char *P60DOCK_TEST_TASK_STRING = "P60DOCK_TEST_TASK";
const char *CORE_CONTROLLER_STRING = "CORE_CONTROLLER";
const char *ACS_CONTROLLER_STRING = "ACS_CONTROLLER";
const char *THERMAL_CONTROLLER_STRING = "THERMAL_CONTROLLER";
const char *RW1_STRING = "RW1";
const char *RW2_STRING = "RW2";
const char *RW3_STRING = "RW3";
const char *RW4_STRING = "RW4";
const char *MGM_0_LIS3_HANDLER_STRING = "MGM_0_LIS3_HANDLER";
const char *GYRO_0_ADIS_HANDLER_STRING = "GYRO_0_ADIS_HANDLER";
const char *SUS_1_STRING = "SUS_1";
@ -29,12 +25,16 @@ const char *SUS_10_STRING = "SUS_10";
const char *SUS_11_STRING = "SUS_11";
const char *SUS_12_STRING = "SUS_12";
const char *SUS_13_STRING = "SUS_13";
const char *RW1_STRING = "RW1";
const char *MGM_1_RM3100_HANDLER_STRING = "MGM_1_RM3100_HANDLER";
const char *GYRO_1_L3G_HANDLER_STRING = "GYRO_1_L3G_HANDLER";
const char *RW2_STRING = "RW2";
const char *MGM_2_LIS3_HANDLER_STRING = "MGM_2_LIS3_HANDLER";
const char *GYRO_2_ADIS_HANDLER_STRING = "GYRO_2_ADIS_HANDLER";
const char *RW3_STRING = "RW3";
const char *MGM_3_RM3100_HANDLER_STRING = "MGM_3_RM3100_HANDLER";
const char *GYRO_3_L3G_HANDLER_STRING = "GYRO_3_L3G_HANDLER";
const char *RW4_STRING = "RW4";
const char *START_TRACKER_STRING = "START_TRACKER";
const char *GPS0_HANDLER_STRING = "GPS0_HANDLER";
const char *GPS1_HANDLER_STRING = "GPS1_HANDLER";
@ -46,6 +46,7 @@ const char *PDU2_HANDLER_STRING = "PDU2_HANDLER";
const char *ACU_HANDLER_STRING = "ACU_HANDLER";
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 *PLOC_MPSOC_HANDLER_STRING = "PLOC_MPSOC_HANDLER";
const char *PLOC_SUPERVISOR_HANDLER_STRING = "PLOC_SUPERVISOR_HANDLER";
const char *SOLAR_ARRAY_DEPL_HANDLER_STRING = "SOLAR_ARRAY_DEPL_HANDLER";
@ -121,14 +122,6 @@ const char* translateObject(object_id_t object) {
return ACS_CONTROLLER_STRING;
case 0x43400001:
return THERMAL_CONTROLLER_STRING;
case 0x44120001:
return RW1_STRING;
case 0x44120002:
return RW2_STRING;
case 0x44120003:
return RW3_STRING;
case 0x44120004:
return RW4_STRING;
case 0x44120006:
return MGM_0_LIS3_HANDLER_STRING;
case 0x44120010:
@ -159,18 +152,26 @@ const char* translateObject(object_id_t object) {
return SUS_12_STRING;
case 0x44120044:
return SUS_13_STRING;
case 0x44120047:
return RW1_STRING;
case 0x44120107:
return MGM_1_RM3100_HANDLER_STRING;
case 0x44120111:
return GYRO_1_L3G_HANDLER_STRING;
case 0x44120148:
return RW2_STRING;
case 0x44120208:
return MGM_2_LIS3_HANDLER_STRING;
case 0x44120212:
return GYRO_2_ADIS_HANDLER_STRING;
case 0x44120249:
return RW3_STRING;
case 0x44120309:
return MGM_3_RM3100_HANDLER_STRING;
case 0x44120313:
return GYRO_3_L3G_HANDLER_STRING;
case 0x44120350:
return RW4_STRING;
case 0x44130001:
return START_TRACKER_STRING;
case 0x44130045:
@ -193,6 +194,8 @@ const char* translateObject(object_id_t object) {
return RAD_SENSOR_STRING;
case 0x44330000:
return PLOC_UPDATER_STRING;
case 0x44330001:
return PLOC_MEMORY_DUMPER_STRING;
case 0x44330015:
return PLOC_MPSOC_HANDLER_STRING;
case 0x44330016:

View File

@ -85,7 +85,7 @@ void SpiTestClass::performRm3100Test(uint8_t mgmId) {
UnixFileGuard fileHelper(deviceName, &fileDescriptor, O_RDWR,
"SpiComIF::initializeInterface: ");
"SpiComIF::initializeInterface");
if(fileHelper.getOpenResult()) {
sif::error << "SpiTestClass::performRm3100Test: File descriptor could not be opened!"
<< std::endl;
@ -184,7 +184,7 @@ void SpiTestClass::performLis3MdlTest(uint8_t lis3Id) {
int fileDescriptor = 0;
UnixFileGuard fileHelper(deviceName, &fileDescriptor, O_RDWR,
"SpiComIF::initializeInterface: ");
"SpiComIF::initializeInterface");
if(fileHelper.getOpenResult()) {
sif::error << "SpiTestClass::performLis3Mdl3100Test: File descriptor could not be opened!"
<< std::endl;
@ -223,7 +223,7 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) {
currentGpioId = gpioIds::GYRO_1_L3G_CS;
}
else {
currentGpioId = gpioIds::GYRO_2_L3G_CS;
currentGpioId = gpioIds::GYRO_3_L3G_CS;
}
uint32_t spiSpeed = 3'900'000;
spi::SpiModes spiMode = spi::SpiModes::MODE_3;
@ -235,7 +235,7 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) {
int fileDescriptor = 0;
UnixFileGuard fileHelper(deviceName, &fileDescriptor, O_RDWR,
"SpiComIF::initializeInterface: ");
"SpiComIF::initializeInterface");
if(fileHelper.getOpenResult()) {
sif::error << "SpiTestClass::performLis3Mdl3100Test: File descriptor could not be opened!"
<< std::endl;
@ -352,7 +352,7 @@ void SpiTestClass::acsInit() {
gpio = new GpiodRegular(q7sGpioName5, gyro2L3gd20ChipSelect, "GYRO_2_L3G",
gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::GYRO_2_L3G_CS, gpio);
gpioCookie->addGpio(gpioIds::GYRO_3_L3G_CS, gpio);
gpio = new GpiodRegular(q7sGpioName6, mgm2Lis3mdlChipSelect, "MGM_2_LIS3",
gpio::Direction::OUT, gpio::HIGH);

View File

@ -173,7 +173,7 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id,
dataset.ain3 = (*(packet + 8) << 8 | *(packet + 9));
dataset.ain4 = (*(packet + 10) << 8 | *(packet + 11));
dataset.ain5 = (*(packet + 12) << 8 | *(packet + 13));
#if OBSW_VERBOSE_LEVEL >= 1 && DEBUG_SUS
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SUS
sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", Temperature: "
<< dataset.temperatureCelcius << " °C" << std::endl;
sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", AIN0: "

View File

@ -72,6 +72,6 @@ static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048;
}
#define FSFW_HAL_LINUX_SPI_WIRETAPPING 1
#define FSFW_HAL_LINUX_SPI_WIRETAPPING 0
#endif /* CONFIG_FSFWCONFIG_H_ */

View File

@ -6,9 +6,9 @@
#ifndef FSFWCONFIG_OBSWCONFIG_H_
#define FSFWCONFIG_OBSWCONFIG_H_
#cmakedefine RASPBERRY_Pi
#cmakedefine XIPHOS_Q7S
#cmakedefine BEAGLEBONEBLACK
/* #undef RASPBERRY_PI */
#define XIPHOS_Q7S
/* #undef BEAGLEBONEBLACK */
#ifdef RASPBERRY_PI
#include "rpiConfig.h"
@ -22,53 +22,63 @@
debugging. */
#define OBSW_VERBOSE_LEVEL 1
//! Timers can mess up the code when debugging
//! TODO: Enable for mission code, disable for debug code
#define OBSW_ENABLE_TIMERS 0
//! Board defines
#define BOARD_TE0720 0
#define OBSW_PRINT_MISSED_DEADLINES 1
#define OBSW_ADD_TEST_CODE 1
#define OBSW_ADD_TEST_PST 1
/*******************************************************************/
/** All of the following flags should be enabled for mission code */
/*******************************************************************/
//! Timers can mess up the code when debugging
//! All of this should be enabled for mission code!
#define OBSW_ENABLE_TIMERS 1
#define OBSW_ADD_GPS 0
#define OBSW_ADD_STAR_TRACKER 0
#define OBSW_ADD_PLOC_SUPERVISOR 0
#define OBSW_ADD_PLOC_MPSOC 0
#define TEST_LIBGPIOD 0
#define TEST_RADIATION_SENSOR_HANDLER 0
#define TEST_SUS_HANDLER 0
#define TEST_PLOC_HANDLER 0
#define TEST_CCSDS_BRIDGE 0
#define PERFORM_PTME_TEST 0
#define ADD_PLOC_SUPERVISOR 1
#define ADD_PLOC_MPSOC 0
/*******************************************************************/
/** All of the following flags should be disabled for mission code */
/*******************************************************************/
#define BOARD_TE0720 0
#define TE0720_HEATER_TEST 0
//! /* Can be used to switch device to NORMAL mode immediately */
#define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1
#define OBSW_PRINT_MISSED_DEADLINES 1
#define OBSW_ADD_TEST_CODE 0
#define OBSW_ADD_TEST_PST 0
#define OBSW_ADD_TEST_TASK 0
#define OBSW_TEST_LIBGPIOD 0
#define OBSW_TEST_RADIATION_SENSOR_HANDLER 0
#define OBSW_TEST_SUS_HANDLER 0
#define OBSW_TEST_PLOC_HANDLER 0
#define OBSW_TEST_CCSDS_BRIDGE 0
#define OBSW_TEST_CCSDS_PTME 0
#define OBSW_TEST_TE7020_HEATER 0
#define P60DOCK_DEBUG 0
#define PDU1_DEBUG 0
#define PDU2_DEBUG 0
#define ACU_DEBUG 0
#define SYRLINKS_DEBUG 0
#define IMQT_DEBUG 0
#define ADIS16507_DEBUG 1
#define L3GD20_GYRO_DEBUG 0
#define DEBUG_RAD_SENSOR 0
#define DEBUG_SUS 1
#define DEBUG_RTD 1
#define IMTQ_DEBUG 1
#define RW_DEBUG 0
#define START_TRACKER_DEBUG 0
#define PLOC_MPSOC_DEBUG 0
#define PLOC_SUPERVISOR_DEBUG 1
#define OBSW_DEBUG_P60DOCK 0
#define OBSW_DEBUG_PDU1 0
#define OBSW_DEBUG_PDU2 0
#define OBSW_DEBUG_ACU 0
#define OBSW_DEBUG_SYRLINKS 0
#define OBSW_DEBUG_IMQT 0
#define OBSW_DEBUG_ADIS16507 0
#define OBSW_DEBUG_L3GD20_GYRO 0
#define OBSW_DEBUG_RAD_SENSOR 0
#define OBSW_DEBUG_SUS 0
#define OBSW_DEBUG_RTD 0
#define OBSW_DEBUG_RW 0
#define OBSW_DEBUG_STARTRACKER 0
#define OBSW_DEBUG_PLOC_MPSOC 0
#define OBSW_DEBUG_PLOC_SUPERVISOR 0
/*******************************************************************/
/** Hardcoded */
/*******************************************************************/
// Leave at one as the BSP is linux. Used by the ADIS16507 device handler
#define OBSW_ADIS16507_LINUX_COM_IF 1
#include "OBSWVersion.h"
/* Can be used to switch device to NORMAL mode immediately */
#define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1
#ifdef __cplusplus
#include "objects/systemObjectList.h"

View File

@ -20,7 +20,8 @@ namespace gpioIds {
MGM_1_RM3100_CS,
GYRO_0_ADIS_CS,
GYRO_1_L3G_CS,
GYRO_2_L3G_CS,
GYRO_2_ADIS_CS,
GYRO_3_L3G_CS,
MGM_2_LIS3_CS,
MGM_3_RM3100_CS,

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 102 translations.
* @brief Auto-generated event translation file. Contains 106 translations.
* @details
* Generated on: 2021-08-07 18:11:16
* Generated on: 2021-08-31 10:50:10
*/
#include "translateEvents.h"
@ -101,12 +101,16 @@ 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 *SANITIZATION_FAILED_STRING = "SANITIZATION_FAILED";
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";
const char *UPDATE_TRANSFER_FAILED_STRING = "UPDATE_TRANSFER_FAILED";
const char *UPDATE_VERIFY_FAILED_STRING = "UPDATE_VERIFY_FAILED";
const char *UPDATE_FINISHED_STRING = "UPDATE_FINISHED";
const char *SEND_MRAM_DUMP_FAILED_STRING = "SEND_MRAM_DUMP_FAILED";
const char *MRAM_DUMP_FAILED_STRING = "MRAM_DUMP_FAILED";
const char *MRAM_DUMP_FINISHED_STRING = "MRAM_DUMP_FINISHED";
const char * translateEvents(Event event) {
switch( (event & 0xffff) ) {
@ -302,6 +306,8 @@ const char * translateEvents(Event event) {
return SUPV_EXE_FAILURE_STRING;
case(11504):
return SUPV_CRC_FAILURE_EVENT_STRING;
case(11600):
return SANITIZATION_FAILED_STRING;
case(11700):
return UPDATE_FILE_NOT_EXISTS_STRING;
case(11701):
@ -314,6 +320,12 @@ const char * translateEvents(Event event) {
return UPDATE_VERIFY_FAILED_STRING;
case(11705):
return UPDATE_FINISHED_STRING;
case(11800):
return SEND_MRAM_DUMP_FAILED_STRING;
case(11801):
return MRAM_DUMP_FAILED_STRING;
case(11802):
return MRAM_DUMP_FINISHED_STRING;
default:
return "UNKNOWN_EVENT";
}

View File

@ -1,15 +0,0 @@
CXXSRC += $(wildcard $(CURRENTPATH)/cdatapool/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/ipc/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/objects/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/pollingsequence/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/events/*.cpp)
INCLUDES += $(CURRENTPATH)
INCLUDES += $(CURRENTPATH)/objects
INCLUDES += $(CURRENTPATH)/ipc
INCLUDES += $(CURRENTPATH)/pollingsequence
INCLUDES += $(CURRENTPATH)/returnvalues
INCLUDES += $(CURRENTPATH)/tmtc
INCLUDES += $(CURRENTPATH)/events
INCLUDES += $(CURRENTPATH)/devices
INCLUDES += $(CURRENTPATH)/cdatapool

View File

@ -1,8 +1,8 @@
/**
* @brief Auto-generated object translation file.
* @details
* Contains 104 translations.
* Generated on: 2021-08-07 18:08:35
* Contains 105 translations.
* Generated on: 2021-08-31 10:31:24
*/
#include "translateObjects.h"
@ -10,10 +10,6 @@ const char *P60DOCK_TEST_TASK_STRING = "P60DOCK_TEST_TASK";
const char *CORE_CONTROLLER_STRING = "CORE_CONTROLLER";
const char *ACS_CONTROLLER_STRING = "ACS_CONTROLLER";
const char *THERMAL_CONTROLLER_STRING = "THERMAL_CONTROLLER";
const char *RW1_STRING = "RW1";
const char *RW2_STRING = "RW2";
const char *RW3_STRING = "RW3";
const char *RW4_STRING = "RW4";
const char *MGM_0_LIS3_HANDLER_STRING = "MGM_0_LIS3_HANDLER";
const char *GYRO_0_ADIS_HANDLER_STRING = "GYRO_0_ADIS_HANDLER";
const char *SUS_1_STRING = "SUS_1";
@ -29,12 +25,16 @@ const char *SUS_10_STRING = "SUS_10";
const char *SUS_11_STRING = "SUS_11";
const char *SUS_12_STRING = "SUS_12";
const char *SUS_13_STRING = "SUS_13";
const char *RW1_STRING = "RW1";
const char *MGM_1_RM3100_HANDLER_STRING = "MGM_1_RM3100_HANDLER";
const char *GYRO_1_L3G_HANDLER_STRING = "GYRO_1_L3G_HANDLER";
const char *RW2_STRING = "RW2";
const char *MGM_2_LIS3_HANDLER_STRING = "MGM_2_LIS3_HANDLER";
const char *GYRO_2_ADIS_HANDLER_STRING = "GYRO_2_ADIS_HANDLER";
const char *RW3_STRING = "RW3";
const char *MGM_3_RM3100_HANDLER_STRING = "MGM_3_RM3100_HANDLER";
const char *GYRO_3_L3G_HANDLER_STRING = "GYRO_3_L3G_HANDLER";
const char *RW4_STRING = "RW4";
const char *START_TRACKER_STRING = "START_TRACKER";
const char *GPS0_HANDLER_STRING = "GPS0_HANDLER";
const char *GPS1_HANDLER_STRING = "GPS1_HANDLER";
@ -46,6 +46,7 @@ const char *PDU2_HANDLER_STRING = "PDU2_HANDLER";
const char *ACU_HANDLER_STRING = "ACU_HANDLER";
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 *PLOC_MPSOC_HANDLER_STRING = "PLOC_MPSOC_HANDLER";
const char *PLOC_SUPERVISOR_HANDLER_STRING = "PLOC_SUPERVISOR_HANDLER";
const char *SOLAR_ARRAY_DEPL_HANDLER_STRING = "SOLAR_ARRAY_DEPL_HANDLER";
@ -121,14 +122,6 @@ const char* translateObject(object_id_t object) {
return ACS_CONTROLLER_STRING;
case 0x43400001:
return THERMAL_CONTROLLER_STRING;
case 0x44120001:
return RW1_STRING;
case 0x44120002:
return RW2_STRING;
case 0x44120003:
return RW3_STRING;
case 0x44120004:
return RW4_STRING;
case 0x44120006:
return MGM_0_LIS3_HANDLER_STRING;
case 0x44120010:
@ -159,18 +152,26 @@ const char* translateObject(object_id_t object) {
return SUS_12_STRING;
case 0x44120044:
return SUS_13_STRING;
case 0x44120047:
return RW1_STRING;
case 0x44120107:
return MGM_1_RM3100_HANDLER_STRING;
case 0x44120111:
return GYRO_1_L3G_HANDLER_STRING;
case 0x44120148:
return RW2_STRING;
case 0x44120208:
return MGM_2_LIS3_HANDLER_STRING;
case 0x44120212:
return GYRO_2_ADIS_HANDLER_STRING;
case 0x44120249:
return RW3_STRING;
case 0x44120309:
return MGM_3_RM3100_HANDLER_STRING;
case 0x44120313:
return GYRO_3_L3G_HANDLER_STRING;
case 0x44120350:
return RW4_STRING;
case 0x44130001:
return START_TRACKER_STRING;
case 0x44130045:
@ -193,6 +194,8 @@ const char* translateObject(object_id_t object) {
return RAD_SENSOR_STRING;
case 0x44330000:
return PLOC_UPDATER_STRING;
case 0x44330001:
return PLOC_MEMORY_DUMPER_STRING;
case 0x44330015:
return PLOC_MPSOC_HANDLER_STRING;
case 0x44330016:

View File

@ -423,6 +423,77 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::RW4, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::RW4, length * 0.8, DeviceHandlerIF::GET_READ);
#if OBSW_ADD_ACS_BOARD == 1
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ);
#endif
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
sif::error << "SPI PST initialization failed" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
@ -449,7 +520,7 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) {
// Length of a communication cycle
uint32_t length = thisSequence->getPeriodMs();
#if ADD_PLOC_MPSOC == 1
#if OBSW_ADD_PLOC_MPSOC == 1
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.2,
@ -462,7 +533,10 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) {
DeviceHandlerIF::GET_READ);
#endif
#if ADD_PLOC_SUPERVISOR == 1
thisSequence->addSlot(objects::PLOC_UPDATER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::PLOC_MEMORY_DUMPER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
#if OBSW_ADD_PLOC_SUPERVISOR == 1
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.2,
@ -606,7 +680,9 @@ ReturnValue_t pst::pstGompaceCan(FixedTimeslotTaskIF *thisSequence){
ReturnValue_t pst::pstTest(FixedTimeslotTaskIF* thisSequence) {
/* Length of a communication cycle */
uint32_t length = thisSequence->getPeriodMs();
bool notEmpty = false;
#if OBSW_ADD_ACS_BOARD == 1
notEmpty = true;
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2,
@ -653,15 +729,15 @@ ReturnValue_t pst::pstTest(FixedTimeslotTaskIF* thisSequence) {
DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0,
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.2,
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.4,
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.6,
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.8,
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ);
@ -678,6 +754,7 @@ ReturnValue_t pst::pstTest(FixedTimeslotTaskIF* thisSequence) {
#endif
#if RPI_TEST_ADIS16507 == 1
notEmpty = true;
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
@ -687,6 +764,7 @@ ReturnValue_t pst::pstTest(FixedTimeslotTaskIF* thisSequence) {
#endif
#if RPI_TEST_GPS_HANDLER == 1
notEmpty = true;
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
@ -696,6 +774,9 @@ ReturnValue_t pst::pstTest(FixedTimeslotTaskIF* thisSequence) {
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.5, DeviceHandlerIF::GET_READ);
#endif
static_cast<void>(length);
if(not notEmpty) {
return HasReturnvaluesIF::RETURN_FAILED;
}
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Test PST initialization failed" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
@ -703,7 +784,7 @@ ReturnValue_t pst::pstTest(FixedTimeslotTaskIF* thisSequence) {
return HasReturnvaluesIF::RETURN_OK;
}
#if BOARD_TE7020 == 1
#if BOARD_TE0720 == 1
ReturnValue_t pst::pollingSequenceTE0720(FixedTimeslotTaskIF *thisSequence) {
uint32_t length = thisSequence->getPeriodMs();
@ -715,7 +796,7 @@ ReturnValue_t pst::pollingSequenceTE0720(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
#endif
#if TEST_RADIATION_SENSOR_HANDLER == 1
#if OBSW_TEST_RADIATION_SENSOR_HANDLER == 1
thisSequence->addSlot(objects::RAD_SENSOR, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.4, DeviceHandlerIF::GET_WRITE);
@ -723,7 +804,7 @@ ReturnValue_t pst::pollingSequenceTE0720(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.8, DeviceHandlerIF::GET_READ);
#endif
#if TEST_SUS_HANDLER == 1
#if OBSW_TEST_SUS_HANDLER == 1
/* Write setup */
thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_1, length * 0.902, SusHandler::FIRST_WRITE);
@ -746,7 +827,7 @@ ReturnValue_t pst::pollingSequenceTE0720(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::SUS_1, length * 0.915, DeviceHandlerIF::GET_READ);
#endif
#if ADD_PLOC_SUPERVISOR == 1
#if OBSW_ADD_PLOC_SUPERVISOR == 1
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
@ -754,10 +835,14 @@ ReturnValue_t pst::pollingSequenceTE0720(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
#endif
thisSequence->addSlot(objects::PLOC_UPDATER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::PLOC_MEMORY_DUMPER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Initialization of TE0720 PST failed" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
}
#endif /* BOARD_TE7020 == 1 */
#endif /* BOARD_TE0720 == 1 */

View File

@ -55,7 +55,7 @@ ReturnValue_t pstI2c(FixedTimeslotTaskIF* thisSequence);
*/
ReturnValue_t pstTest(FixedTimeslotTaskIF* thisSequence);
#if TE0720 == 1
#if BOARD_TE0720 == 1
/**
* @brief This polling sequence will be created when the software is compiled for the TE0720.
*/

View File

@ -39,7 +39,7 @@ ReturnValue_t CCSDSIPCoreBridge::initialize() {
ReturnValue_t CCSDSIPCoreBridge::handleTm() {
#if PERFORM_PTME_TEST == 1
#if OBSW_TEST_CCSDS_PTME == 1
return sendTestFrame();
#else
return TmTcBridge::handleTm();

View File

@ -21,7 +21,7 @@ void ACUHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pack
parseHkTableReply(packet);
handleDeviceTM(&acuHkTableDataset, id, true);
#if OBSW_ENHANCED_PRINTOUT == 1 && ACU_DEBUG == 1
#if OBSW_ENHANCED_PRINTOUT == 1 && OBSW_DEBUG_ACU == 1
acuHkTableDataset.read();
float temperatureC_1 = acuHkTableDataset.temperature1.value * 0.1;
float temperatureC_2 = acuHkTableDataset.temperature2.value * 0.1;

View File

@ -7,8 +7,9 @@
#include "lwgps/lwgps.h"
GPSHyperionHandler::GPSHyperionHandler(object_id_t objectId, object_id_t deviceCommunication,
CookieIF *comCookie):
DeviceHandlerBase(objectId, deviceCommunication, comCookie), gpsSet(this) {
CookieIF *comCookie, bool debugHyperionGps):
DeviceHandlerBase(objectId, deviceCommunication, comCookie), gpsSet(this),
debugHyperionGps(debugHyperionGps) {
lwgps_init(&gpsData);
}
@ -32,7 +33,7 @@ void GPSHyperionHandler::doStartUp() {
void GPSHyperionHandler::doShutDown() {
internalState = InternalStates::NONE;
commandExecuted = false;
setMode(MODE_OFF);
setMode(_MODE_POWER_DOWN);
}
ReturnValue_t GPSHyperionHandler::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
@ -100,13 +101,13 @@ ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len,
gpsSet.hours = gpsData.hours;
gpsSet.minutes = gpsData.minutes;
gpsSet.seconds = gpsData.seconds;
#if FSFW_HAL_DEBUG_HYPERION_GPS == 1
if(debugHyperionGps) {
sif::info << "GPS Data" << std::endl;
printf("Valid status: %d\n", gpsData.is_valid);
printf("Latitude: %f degrees\n", gpsData.latitude);
printf("Longitude: %f degrees\n", gpsData.longitude);
printf("Altitude: %f meters\n", gpsData.altitude);
#endif
}
}
*foundLen = len;
}
@ -137,12 +138,13 @@ ReturnValue_t GPSHyperionHandler::initializeLocalDataPool(
localDataPoolMap.emplace(GpsHyperion::UNIX_SECONDS, new PoolEntry<uint32_t>());
localDataPoolMap.emplace(GpsHyperion::SATS_IN_USE, new PoolEntry<uint8_t>());
localDataPoolMap.emplace(GpsHyperion::FIX_MODE, new PoolEntry<uint8_t>());
poolManager.subscribeForPeriodicPacket(gpsSet.getSid(), true, 2.0, false);
return HasReturnvaluesIF::RETURN_OK;
}
void GPSHyperionHandler::fillCommandAndReplyMap() {
// Reply length does not matter, packets should always arrive periodically
insertInReplyMap(GpsHyperion::GPS_REPLY, 4, nullptr, 0, true);
insertInReplyMap(GpsHyperion::GPS_REPLY, 4, &gpsSet, 0, true);
}
void GPSHyperionHandler::modeChanged() {

View File

@ -1,13 +1,11 @@
#ifndef MISSION_DEVICES_GPSHYPERIONHANDLER_H_
#define MISSION_DEVICES_GPSHYPERIONHANDLER_H_
#include "fsfw/FSFW.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
#include "devicedefinitions/GPSDefinitions.h"
#include "lwgps/lwgps.h"
#ifndef FSFW_HAL_DEBUG_HYPERION_GPS
#define FSFW_HAL_DEBUG_HYPERION_GPS 0
#endif
/**
* @brief Device handler for the Hyperion HT-GPS200 device
@ -18,10 +16,11 @@
class GPSHyperionHandler: public DeviceHandlerBase {
public:
GPSHyperionHandler(object_id_t objectId, object_id_t deviceCommunication,
CookieIF* comCookie);
CookieIF* comCookie, bool debugHyperionGps = false);
virtual ~GPSHyperionHandler();
protected:
enum class InternalStates {
NONE,
WAIT_FIRST_MESSAGE,
@ -54,6 +53,7 @@ protected:
private:
lwgps_t gpsData = {};
GpsPrimaryDataset gpsSet;
bool debugHyperionGps = false;
};
#endif /* MISSION_DEVICES_GPSHYPERIONHANDLER_H_ */

View File

@ -16,7 +16,7 @@ GyroADIS16507Handler::GyroADIS16507Handler(object_id_t objectId,
object_id_t deviceCommunication, CookieIF * comCookie):
DeviceHandlerBase(objectId, deviceCommunication, comCookie), primaryDataset(this),
configDataset(this), breakCountdown() {
#if ADIS16507_DEBUG == 1
#if OBSW_DEBUG_ADIS16507 == 1
debugDivider = new PeriodicOperationDivider(5);
#endif
@ -57,6 +57,7 @@ void GyroADIS16507Handler::doStartUp() {
void GyroADIS16507Handler::doShutDown() {
commandExecuted = false;
setMode(_MODE_POWER_DOWN);
}
ReturnValue_t GyroADIS16507Handler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
@ -283,7 +284,7 @@ ReturnValue_t GyroADIS16507Handler::handleSensorData(const uint8_t *packet) {
primaryDataset.setValidity(true, true);
}
#if ADIS16507_DEBUG == 1
#if OBSW_DEBUG_ADIS16507 == 1
if(debugDivider->checkAndIncrement()) {
sif::info << "GyroADIS16507Handler: Angular velocities in deg / s" << std::endl;
sif::info << "X: " << primaryDataset.angVelocX.value << std::endl;
@ -392,7 +393,7 @@ ReturnValue_t GyroADIS16507Handler::spiSendCallback(SpiComIF *comIf, SpiCookie *
// Prepare transfer
int fileDescriptor = 0;
std::string device = cookie->getSpiDevice();
UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "SpiComIF::sendMessage: ");
UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "SpiComIF::sendMessage");
if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) {
return SpiComIF::OPENING_FILE_FAILED;
}

View File

@ -69,7 +69,7 @@ private:
const uint8_t *sendData, size_t sendLen, void* args);
#endif
#if ADIS16507_DEBUG == 1
#if OBSW_DEBUG_ADIS16507 == 1
PeriodicOperationDivider* debugDivider;
#endif
Countdown breakCountdown;

View File

@ -27,7 +27,7 @@ void IMTQHandler::doStartUp() {
}
void IMTQHandler::doShutDown() {
setMode(_MODE_POWER_DOWN);
}
ReturnValue_t IMTQHandler::buildNormalDeviceCommand(DeviceCommandId_t * id) {
@ -683,7 +683,7 @@ void IMTQHandler::fillEngHkDataset(const uint8_t* packet) {
offset += 2;
engHkDataset.mcuTemperature = (*(packet + offset + 1) << 8 | *(packet + offset));
#if OBSW_VERBOSE_LEVEL >= 1 && IMTQ_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_IMTQ == 1
sif::info << "IMTQ digital voltage: " << engHkDataset.digitalVoltageMv << " mV" << std::endl;
sif::info << "IMTQ analog voltage: " << engHkDataset.analogVoltageMv << " mV" << std::endl;
sif::info << "IMTQ digital current: " << engHkDataset.digitalCurrentmA << " mA" << std::endl;
@ -757,7 +757,7 @@ void IMTQHandler::fillCalibratedMtmDataset(const uint8_t* packet) {
offset += 4;
calMtmMeasurementSet.coilActuationStatus = (*(packet + offset + 3) << 24)
| (*(packet + offset + 2) << 16) | (*(packet + offset + 1) << 8) | (*(packet + offset));
#if OBSW_VERBOSE_LEVEL >= 1 && IMTQ_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_IMTQ == 1
sif::info << "IMTQ calibrated MTM measurement X: " << calMtmMeasurementSet.mtmXnT << " nT"
<< std::endl;
sif::info << "IMTQ calibrated MTM measurement Y: " << calMtmMeasurementSet.mtmYnT << " nT"
@ -783,7 +783,7 @@ void IMTQHandler::fillRawMtmDataset(const uint8_t* packet) {
offset += 4;
rawMtmMeasurementSet.coilActuationStatus = (*(packet + offset + 3) << 24)
| (*(packet + offset + 2) << 16) | (*(packet + offset + 1) << 8) | (*(packet + offset));
#if OBSW_VERBOSE_LEVEL >= 1 && IMTQ_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_IMTQ == 1
sif::info << "IMTQ raw MTM measurement X: " << rawMtmMeasurementSet.mtmXnT << " nT"
<< std::endl;
sif::info << "IMTQ raw MTM measurement Y: " << rawMtmMeasurementSet.mtmYnT << " nT"
@ -946,7 +946,7 @@ void IMTQHandler::handlePositiveXSelfTestReply(const uint8_t* packet) {
posXselfTestDataset.finaCoilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
offset += 4;
#if OBSW_VERBOSE_LEVEL >= 1 && IMTQ_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_IMTQ == 1
sif::info << "IMTQ self test (INIT) err: "
<< static_cast<unsigned int>(posXselfTestDataset.initErr.value) << std::endl;
sif::info << "IMTQ self test (INIT) raw magnetic field X: " << posXselfTestDataset.initRawMagX
@ -1147,7 +1147,7 @@ void IMTQHandler::handleNegativeXSelfTestReply(const uint8_t* packet) {
negXselfTestDataset.finaCoilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
offset += 4;
#if OBSW_VERBOSE_LEVEL >= 1 && IMTQ_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_IMTQ == 1
sif::info << "IMTQ self test (INIT) err: "
<< static_cast<unsigned int>(negXselfTestDataset.initErr.value) << std::endl;
sif::info << "IMTQ self test (INIT) raw magnetic field X: " << negXselfTestDataset.initRawMagX
@ -1348,7 +1348,7 @@ void IMTQHandler::handlePositiveYSelfTestReply(const uint8_t* packet) {
posYselfTestDataset.finaCoilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
offset += 4;
#if OBSW_VERBOSE_LEVEL >= 1 && IMTQ_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_IMTQ == 1
sif::info << "IMTQ self test (INIT) err: "
<< static_cast<unsigned int>(posYselfTestDataset.initErr.value) << std::endl;
sif::info << "IMTQ self test (INIT) raw magnetic field X: " << posYselfTestDataset.initRawMagX
@ -1549,7 +1549,7 @@ void IMTQHandler::handleNegativeYSelfTestReply(const uint8_t* packet) {
negYselfTestDataset.finaCoilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
offset += 4;
#if OBSW_VERBOSE_LEVEL >= 1 && IMTQ_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_IMTQ == 1
sif::info << "IMTQ self test (INIT) err: "
<< static_cast<unsigned int>(negYselfTestDataset.initErr.value) << std::endl;
sif::info << "IMTQ self test (INIT) raw magnetic field X: " << negYselfTestDataset.initRawMagX
@ -1750,7 +1750,7 @@ void IMTQHandler::handlePositiveZSelfTestReply(const uint8_t* packet) {
posZselfTestDataset.finaCoilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
offset += 4;
#if OBSW_VERBOSE_LEVEL >= 1 && IMTQ_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_IMTQ == 1
sif::info << "IMTQ self test (INIT) err: "
<< static_cast<unsigned int>(posZselfTestDataset.initErr.value) << std::endl;
sif::info << "IMTQ self test (INIT) raw magnetic field X: " << posZselfTestDataset.initRawMagX
@ -1951,7 +1951,7 @@ void IMTQHandler::handleNegativeZSelfTestReply(const uint8_t* packet) {
negZselfTestDataset.finaCoilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
offset += 4;
#if OBSW_VERBOSE_LEVEL >= 1 && IMTQ_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_IMTQ == 1
sif::info << "IMTQ self test (INIT) err: "
<< static_cast<unsigned int>(negZselfTestDataset.initErr.value) << std::endl;
sif::info << "IMTQ self test (INIT) raw magnetic field X: " << negZselfTestDataset.initRawMagX

View File

@ -78,7 +78,7 @@ void Max31865PT1000Handler::doStartUp() {
void Max31865PT1000Handler::doShutDown() {
commandExecuted = false;
setMode(MODE_OFF);
setMode(_MODE_POWER_DOWN);
}
ReturnValue_t Max31865PT1000Handler::buildNormalDeviceCommand(
@ -325,7 +325,7 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(
case(Max31865Definitions::REQUEST_LOW_THRESHOLD): {
uint16_t readLowThreshold = packet[0] << 8 | packet[1];
if(readLowThreshold != LOW_THRESHOLD) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 && DEBUG_RTD == 1
#if FSFW_CPP_OSTREAM_ENABLED == 1 && OBSW_DEBUG_RTD == 1
sif::error
<< "Max31865PT1000Handler::interpretDeviceReply: Missmatch between written "
<< "and readback value of low threshold register"
@ -338,7 +338,7 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(
case(Max31865Definitions::REQUEST_HIGH_THRESHOLD): {
uint16_t readHighThreshold = packet[0] << 8 | packet[1];
if(readHighThreshold != HIGH_THRESHOLD) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 && DEBUG_RTD == 1
#if FSFW_CPP_OSTREAM_ENABLED == 1 && OBSW_DEBUG_RTD == 1
sif::error
<< "Max31865PT1000Handler::interpretDeviceReply: Missmatch between written "
<< "and readback value of high threshold register"

View File

@ -25,8 +25,17 @@ void P60DockHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *
*/
handleDeviceTM(&p60dockHkTableDataset, id, true);
#if OBSW_VERBOSE_LEVEL >= 1 && P60DOCK_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_P60DOCK == 1
p60dockHkTableDataset.read();
sif::info << "P60 Dock: ACU VCC switch: " << static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStateAcuVcc.value) << std::endl;
sif::info << "P60 Dock: PDU1 VCC switch: " << static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStatePdu1Vcc.value) << std::endl;
sif::info << "P60 Dock: PDU2 VCC switch: " << static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStatePdu2Vcc.value) << std::endl;
sif::info << "P60 Dock: ACU VBAT switch: " << static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStateAcuVbat.value) << std::endl;
sif::info << "P60 Dock: PDU1 VBAT switch: " << static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStatePdu1Vbat.value) << std::endl;
sif::info << "P60 Dock: PDU2 VBAT switch: " << static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStatePdu2Vbat.value) << std::endl;
sif::info << "P60 Dock: Stack VBAT switch: " << static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStateStackVbat.value) << std::endl;
sif::info << "P60 Dock: Stack 3V3 switch: " << static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStateStack3V3.value) << std::endl;
sif::info << "P60 Dock: Stack 5V switch: " << static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStateStack5V.value) << std::endl;
float temperatureC = p60dockHkTableDataset.temperature1.value * 0.1;
sif::info << "P60 Dock: Temperature 1: " << temperatureC << " °C" << std::endl;

View File

@ -22,17 +22,67 @@ void PDU1Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac
parseHkTableReply(packet);
handleDeviceTM(&pdu1HkTableDataset, id, true);
#if OBSW_VERBOSE_LEVEL >= 1 && PDU1_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_PDU1 == 1
pdu1HkTableDataset.read();
sif::info << "PDU1 TCS Board voltage: " << pdu1HkTableDataset.voltageOutTCSBoard3V3
<< std::endl;
sif::info << "PDU1 Syrlinks voltage: " << pdu1HkTableDataset.voltageOutSyrlinks << std::endl;
sif::info << "PDU1 star tracker voltage: " << pdu1HkTableDataset.voltageOutStarTracker
<< std::endl;
sif::info << "PDU1 MGT voltage: " << pdu1HkTableDataset.voltageOutMGT << std::endl;
sif::info << "PDU1 SUS nominal voltage: " << pdu1HkTableDataset.voltageOutSUSNominal
<< std::endl;
sif::info << "PDU1 solar cell experiment voltage: " << pdu1HkTableDataset.voltageOutSolarCellExp
<< std::endl;
sif::info << "PDU1 PLOC voltage: " << pdu1HkTableDataset.voltageOutPLOC << std::endl;
sif::info << "PDU1 ACS Side A voltage: " << pdu1HkTableDataset.voltageOutACSBoardSideA
<< std::endl;
sif::info << "PDU1 channel 8 voltage: " << pdu1HkTableDataset.voltageOutACSBoardSideA
<< std::endl;
sif::info << "PDU1 TCS Board current: " << pdu1HkTableDataset.currentOutTCSBoard3V3
<< std::endl;
sif::info << "PDU1 Syrlinks current: " << pdu1HkTableDataset.currentOutSyrlinks << std::endl;
sif::info << "PDU1 star tracker current: " << pdu1HkTableDataset.currentOutStarTracker
<< std::endl;
sif::info << "PDU1 MGT current: " << pdu1HkTableDataset.currentOutMGT << std::endl;
sif::info << "PDU1 SUS nominal current: " << pdu1HkTableDataset.currentOutSUSNominal
<< std::endl;
sif::info << "PDU1 solar cell experiment current: " << pdu1HkTableDataset.currentOutSolarCellExp
<< std::endl;
sif::info << "PDU1 PLOC current: " << pdu1HkTableDataset.currentOutPLOC << std::endl;
sif::info << "PDU1 ACS Side A current: " << pdu1HkTableDataset.currentOutACSBoardSideA
<< std::endl;
sif::info << "PDU1 channel 8 current: " << pdu1HkTableDataset.currentOutChannel8
<< std::endl;
sif::info << "PDU1 TCS Board switch: "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledTCSBoard3V3.value) << std::endl;
sif::info << "PDU1 Syrlinks switch: "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledSyrlinks.value) << std::endl;
sif::info << "PDU1 star tracker switch: "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledStarTracker.value) << std::endl;
sif::info << "PDU1 MGT switch: "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledMGT.value) << std::endl;
sif::info << "PDU1 SUS nominal switch: "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledSUSNominal.value) << std::endl;
sif::info << "PDU1 solar cell experiment switch: "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledSolarCellExp.value) << std::endl;
sif::info << "PDU1 PLOC switch: "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledPLOC.value) << std::endl;
sif::info << "PDU1 ACS Side A switch: "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledAcsBoardSideA.value) << std::endl;
sif::info << "PDU1 channel 8 switch: "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledChannel8.value) << std::endl;
sif::info << "PDU1 battery mode: " << static_cast<unsigned int>(pdu1HkTableDataset.battMode.value) << std::endl;
sif::info << "PDU1 VCC: " << pdu1HkTableDataset.vcc << " mV" << std::endl;
float vbat = pdu1HkTableDataset.vbat.value * 0.1;
sif::info << "PDU1 VBAT: " << vbat << std::endl;
float vbat = pdu1HkTableDataset.vbat.value * 0.001;
sif::info << "PDU1 VBAT: " << vbat << "V" << std::endl;
float temperatureC = pdu1HkTableDataset.temperature.value * 0.1;
sif::info << "PDU1 Temperature: " << temperatureC << " °C" << std::endl;
sif::info << "PDU1 csp1 watchdog pings before reboot: "
<< unsigned(pdu1HkTableDataset.csp1WatchdogPingsLeft.value) << std::endl;
<< static_cast<unsigned int>(pdu1HkTableDataset.csp1WatchdogPingsLeft.value) << std::endl;
sif::info << "PDU1 csp2 watchdog pings before reboot: "
<< unsigned(pdu1HkTableDataset.csp2WatchdogPingsLeft.value) << std::endl;
<< static_cast<unsigned int>(pdu1HkTableDataset.csp2WatchdogPingsLeft.value) << std::endl;
pdu1HkTableDataset.commit();
#endif
}

View File

@ -26,7 +26,7 @@ void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac
*/
handleDeviceTM(&pdu2HkTableDataset, id, true);
#if OBSW_VERBOSE_LEVEL >= 1 && PDU2_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_PDU2 == 1
pdu2HkTableDataset.read();
sif::info << "PDU2 Q7S current voltage: " << pdu2HkTableDataset.voltageOutQ7S << " mV" << std::endl;
sif::info << "PDU2 VCC: " << pdu2HkTableDataset.vcc << " mV" << std::endl;

View File

@ -22,7 +22,7 @@ void PlocMPSoCHandler::doStartUp(){
}
void PlocMPSoCHandler::doShutDown(){
setMode(_MODE_POWER_DOWN);
}
ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(

View File

@ -147,7 +147,7 @@ ReturnValue_t RadiationSensorHandler::interpretDeviceReply(DeviceCommandId_t id,
offset += 2;
dataset.ain7 = (*(packet + offset) << 8 | *(packet + offset + 1));
#if OBSW_VERBOSE_LEVEL >= 1 && DEBUG_RAD_SENSOR
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_RAD_SENSOR
sif::info << "Radiation sensor temperature: " << dataset.temperatureCelcius << " °C"
<< std::endl;
sif::info << "Radiation sensor ADC value channel 0: " << dataset.ain0

View File

@ -38,6 +38,7 @@ void RwHandler::doShutDown() {
if(gpioComIF->pullLow(enableGpio) != RETURN_OK) {
sif::debug << "RwHandler::doStartUp: Failed to pull enable gpio to low";
}
setMode(_MODE_POWER_DOWN);
}
ReturnValue_t RwHandler::buildNormalDeviceCommand(DeviceCommandId_t * id) {
@ -346,7 +347,7 @@ void RwHandler::handleResetStatusReply(const uint8_t* packet) {
lastResetStatusSet.lastResetStatus = resetStatus;
}
lastResetStatusSet.currentResetStatus = resetStatus;
#if OBSW_VERBOSE_LEVEL >= 1 && RW_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_RW == 1
sif::info << "RwHandler::handleResetStatusReply: Last reset status: "
<< static_cast<unsigned int>(lastResetStatusSet.lastResetStatus.value) << std::endl;
sif::info << "RwHandler::handleResetStatusReply: Current reset status: "
@ -377,7 +378,7 @@ void RwHandler::handleGetRwStatusReply(const uint8_t* packet) {
<< std::endl;
}
#if OBSW_VERBOSE_LEVEL >= 1 && RW_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_RW == 1
sif::info << "RwHandler::handleGetRwStatusReply: Current speed is: " << statusSet.currSpeed
<< " * 0.1 RPM" << std::endl;
sif::info << "RwHandler::handleGetRwStatusReply: Reference speed is: "
@ -394,7 +395,7 @@ void RwHandler::handleTemperatureReply(const uint8_t* packet) {
uint8_t offset = 2;
temperatureSet.temperatureCelcius = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16
| *(packet + offset + 1) << 8 | *(packet + offset);
#if OBSW_VERBOSE_LEVEL >= 1 && RW_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_RW == 1
sif::info << "RwHandler::handleTemperatureReply: Temperature: "
<< temperatureSet.temperatureCelcius << " °C" << std::endl;
#endif
@ -471,7 +472,7 @@ void RwHandler::handleGetTelemetryReply(const uint8_t* packet) {
offset += 4;
tmDataset.spiTotalNumOfErrors = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16
| *(packet + offset + 1) << 8 | *(packet + offset);
#if OBSW_VERBOSE_LEVEL >= 1 && RW_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_RW == 1
sif::info << "RwHandler::handleTemperatureReply: Last reset status: "
<< static_cast<unsigned int>(tmDataset.lastResetStatus.value) << std::endl;
sif::info << "RwHandler::handleTemperatureReply: MCU temperature: " << tmDataset.mcuTemperature

View File

@ -28,10 +28,10 @@ void StarTrackerHandler::doStartUp() {
#else
setMode(_MODE_TO_ON);
#endif
}
void StarTrackerHandler::doShutDown() {
setMode(_MODE_POWER_DOWN);
}
ReturnValue_t StarTrackerHandler::buildNormalDeviceCommand(DeviceCommandId_t * id) {
@ -207,7 +207,7 @@ void StarTrackerHandler::handleTemperatureTm() {
temperatureSet.cmosTemperature = *(decodedFrame + offset) << 24
| *(decodedFrame + offset + 1) << 16 | *(decodedFrame + offset + 2) << 8
| *(decodedFrame + offset + 3);
#if OBSW_VERBOSE_LEVEL >= 1 && START_TRACKER_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1
sif::info << "StarTrackerHandler::handleTemperatureTm: MCU Temperature: "
<< temperatureSet.mcuTemperature << " °C" << std::endl;
sif::info << "StarTrackerHandler::handleTemperatureTm: CMOS Temperature: "

View File

@ -23,7 +23,7 @@ void SyrlinksHkHandler::doStartUp(){
}
void SyrlinksHkHandler::doShutDown(){
setMode(_MODE_POWER_DOWN);
}
ReturnValue_t SyrlinksHkHandler::buildNormalDeviceCommand(
@ -384,7 +384,7 @@ void SyrlinksHkHandler::parseRxStatusRegistersReply(const uint8_t* packet) {
offset += 6;
rxDataset.rxDataRate = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
#if OBSW_VERBOSE_LEVEL >= 1 && SYRLINKS_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SYRLINKS == 1
sif::info << "Syrlinks RX Status: 0x" << std::hex << (unsigned int)rxDataset.rxStatus.value << std::endl;
sif::info << "Syrlinks RX Sensitivity: " << std::dec << rxDataset.rxSensitivity << std::endl;
sif::info << "Syrlinks RX Frequency Shift: " << rxDataset.rxFrequencyShift << std::endl;
@ -400,7 +400,7 @@ void SyrlinksHkHandler::parseTxStatusReply(const uint8_t* packet) {
PoolReadGuard readHelper(&txDataset);
uint16_t offset = SYRLINKS::MESSAGE_HEADER_SIZE;
txDataset.txStatus = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
#if OBSW_VERBOSE_LEVEL >= 1 && SYRLINKS_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SYRLINKS == 1
sif::info << "Syrlinks TX Status: 0x" << std::hex << (unsigned int) txDataset.txStatus.value
<< std::endl;
#endif
@ -410,7 +410,7 @@ void SyrlinksHkHandler::parseTxWaveformReply(const uint8_t* packet) {
PoolReadGuard readHelper(&txDataset);
uint16_t offset = SYRLINKS::MESSAGE_HEADER_SIZE;
txDataset.txWaveform = convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
#if OBSW_VERBOSE_LEVEL >= 1 && SYRLINKS_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SYRLINKS == 1
sif::info << "Syrlinks TX Waveform: 0x" << std::hex << (unsigned int) txDataset.txWaveform.value
<< std::endl;
#endif
@ -420,7 +420,7 @@ void SyrlinksHkHandler::parseAgcLowByte(const uint8_t* packet) {
PoolReadGuard readHelper(&txDataset);
uint16_t offset = SYRLINKS::MESSAGE_HEADER_SIZE;
txDataset.txAgcValue = agcValueHighByte << 8 | convertHexStringToUint8(reinterpret_cast<const char*>(packet + offset));
#if OBSW_VERBOSE_LEVEL >= 1 && SYRLINKS_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SYRLINKS == 1
sif::info << "Syrlinks TX AGC Value: " << txDataset.txAgcValue << std::endl;
#endif
}

View File

@ -22,7 +22,7 @@ void Tmp1075Handler::doStartUp(){
}
void Tmp1075Handler::doShutDown(){
setMode(_MODE_POWER_DOWN);
}
ReturnValue_t Tmp1075Handler::buildNormalDeviceCommand(

@ -1 +1 @@
Subproject commit c468400aaf8470a31e393f53c858d2bf2c361273
Subproject commit 657c06e4a6e4c460e897c4a5b4eaefe7c6d1085e

2
tmtc

@ -1 +1 @@
Subproject commit cc6dbd8ef9d5bd028835f37a24a5617224569862
Subproject commit 9b176aebfaba51f4d045881a125d42b123f4eeb3