PCDU switch callback #128
8
.clang-format
Normal file
8
.clang-format
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
BasedOnStyle: Google
|
||||||
|
IndentWidth: 2
|
||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
ColumnLimit: 100
|
||||||
|
ReflowComments: true
|
||||||
|
---
|
@ -66,6 +66,7 @@ set(LIB_ARCSEC wire)
|
|||||||
set(THIRD_PARTY_FOLDER thirdparty)
|
set(THIRD_PARTY_FOLDER thirdparty)
|
||||||
set(LIB_CXX_FS -lstdc++fs)
|
set(LIB_CXX_FS -lstdc++fs)
|
||||||
set(LIB_CATCH2 Catch2)
|
set(LIB_CATCH2 Catch2)
|
||||||
|
set(LIB_GPS gps)
|
||||||
set(LIB_JSON_NAME nlohmann_json::nlohmann_json)
|
set(LIB_JSON_NAME nlohmann_json::nlohmann_json)
|
||||||
|
|
||||||
# Set path names
|
# Set path names
|
||||||
@ -221,6 +222,7 @@ if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG))
|
|||||||
if(TGT_BSP MATCHES "arm/q7s")
|
if(TGT_BSP MATCHES "arm/q7s")
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
target_link_libraries(${TARGET_NAME} PRIVATE
|
||||||
${LIB_ARCSEC}
|
${LIB_ARCSEC}
|
||||||
|
${LIB_GPS}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
3
Justfile
3
Justfile
@ -5,5 +5,8 @@ default: q7s-debug-make
|
|||||||
q7s-debug-make:
|
q7s-debug-make:
|
||||||
{{python_script}} -o linux -g make -b debug -t "arm/q7s" -l build-Debug-Q7S
|
{{python_script}} -o linux -g make -b debug -t "arm/q7s" -l build-Debug-Q7S
|
||||||
|
|
||||||
|
q7s-release-make:
|
||||||
|
{{python_script}} -o linux -g make -b release -t "arm/q7s" -l build-Release-Q7S
|
||||||
|
|
||||||
q7s-debug-ninja:
|
q7s-debug-ninja:
|
||||||
{{python_script}} -o linux -g ninja -b debug -t "arm/q7s" -l build-Debug-Q7S
|
{{python_script}} -o linux -g ninja -b debug -t "arm/q7s" -l build-Debug-Q7S
|
||||||
|
65
README.md
65
README.md
@ -11,14 +11,15 @@
|
|||||||
4. [Useful and Common Host Commands](#host-commands)
|
4. [Useful and Common Host Commands](#host-commands)
|
||||||
5. [Setting up Prerequisites](#set-up-prereq)
|
5. [Setting up Prerequisites](#set-up-prereq)
|
||||||
6. [Remote Debugging](#remote-debugging)
|
6. [Remote Debugging](#remote-debugging)
|
||||||
7. [TMTC testing](#tmtc-testing)
|
6. [Remote Reset](#remote-reset)
|
||||||
8. [Direct Debugging](#direct-debugging)
|
8. [TMTC testing](#tmtc-testing)
|
||||||
9. [Transfering Files to the Q7S](#file-transfer)
|
9. [Direct Debugging](#direct-debugging)
|
||||||
10. [Q7S OBC](#q7s)
|
10. [Transfering Files to the Q7S](#file-transfer)
|
||||||
11. [Static Code Analysis](#static-code-analysis)
|
11. [Q7S OBC](#q7s)
|
||||||
12. [Eclipse](#eclipse)
|
12. [Static Code Analysis](#static-code-analysis)
|
||||||
13. [Running the OBSW on a Raspberry Pi](#rpi)
|
13. [Eclipse](#eclipse)
|
||||||
14. [FSFW](#fsfw)
|
14. [Running the OBSW on a Raspberry Pi](#rpi)
|
||||||
|
15. [FSFW](#fsfw)
|
||||||
|
|
||||||
# <a id="general"></a> General information
|
# <a id="general"></a> General information
|
||||||
|
|
||||||
@ -535,10 +536,10 @@ ssh root@192.168.133.10
|
|||||||
```
|
```
|
||||||
|
|
||||||
If this has not been done yet, you can access the serial
|
If this has not been done yet, you can access the serial
|
||||||
console of the Q7S like this to set it
|
console of the Q7S like this
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
picocom -b 115200 /dev/ttyUSB0
|
picocom -b 115200 /dev/q7sSerial
|
||||||
```
|
```
|
||||||
|
|
||||||
The flatsat has the aliases and shell scripts `q7s_ssh` and `q7s_serial` for this task as well.
|
The flatsat has the aliases and shell scripts `q7s_ssh` and `q7s_serial` for this task as well.
|
||||||
@ -575,6 +576,29 @@ alias or shell script to do this quickly.
|
|||||||
Note: When now setting up a debug session in the Xilinx SDK or Eclipse, the host must be set
|
Note: When now setting up a debug session in the Xilinx SDK or Eclipse, the host must be set
|
||||||
to localhost instead of the IP address of the Q7S.
|
to localhost instead of the IP address of the Q7S.
|
||||||
|
|
||||||
|
# <a id="remote-reset"></a> Remote Reset
|
||||||
|
1. Launch xilinx hardware server on flatsat with alias
|
||||||
|
````
|
||||||
|
launch-hwserver-xilinx
|
||||||
|
````
|
||||||
|
2. On host PC start xsc
|
||||||
|
3. In xsct console type the follwing command to connect to the hardware server (replace </flatsat-pc-ip-address/> with the IP address of the flatsat PC. Can be found out with ifconfig)
|
||||||
|
````
|
||||||
|
connect -url tcp:</flatsat-pc-ip-address/>:3121
|
||||||
|
````
|
||||||
|
4. The following command will list all available devices
|
||||||
|
````
|
||||||
|
targets
|
||||||
|
````
|
||||||
|
5. Connect to the APU of the Q7S
|
||||||
|
````
|
||||||
|
target </APU-number/>
|
||||||
|
````
|
||||||
|
6. Perform reset
|
||||||
|
````
|
||||||
|
rst
|
||||||
|
````
|
||||||
|
|
||||||
# <a id="tmtc-testing"></a> TMTC testing
|
# <a id="tmtc-testing"></a> TMTC testing
|
||||||
|
|
||||||
The OBSW supports sending PUS TM packets via TCP or the PDEC IP Core which transmits the data as
|
The OBSW supports sending PUS TM packets via TCP or the PDEC IP Core which transmits the data as
|
||||||
@ -1021,26 +1045,7 @@ cat file.bin | hexdump -v -n X
|
|||||||
|
|
||||||
## Preparation of a fresh rootfs and SD card
|
## Preparation of a fresh rootfs and SD card
|
||||||
|
|
||||||
This section summarizes important changes between a fresh rootfs and the current
|
See [q7s-package repository README](https://egit.irs.uni-stuttgart.de/eive/q7s-package)
|
||||||
EIVE implementation
|
|
||||||
|
|
||||||
### rootfs
|
|
||||||
|
|
||||||
- Mount point `/mnt/sd0` created for SD card 0. Created with `mkdir`
|
|
||||||
- Mount point `/mnt/sd1` created for SD card 1. Created with `mkdir`
|
|
||||||
- Folder `scripts` in `/home/root` folder.
|
|
||||||
- `scripts` folder currently contains a few shell helper scripts
|
|
||||||
- Folder `profile.d` in `/etc` folder which contains the `path-set.sh` script
|
|
||||||
which is sourced at software startup
|
|
||||||
- Library `libwire.so` in `/usr/lib` folder
|
|
||||||
|
|
||||||
### SD Cards
|
|
||||||
|
|
||||||
- Folder `bin` for binaries, for example the OBSW
|
|
||||||
- Folder `misc` for miscellaneous files. Contains `ls` for directory listings
|
|
||||||
- Folder `tc` for telecommands
|
|
||||||
- Folder `tm` for telemetry
|
|
||||||
- Folder `xdi` for XDI components (e.g. for firmware or device tree updates)
|
|
||||||
|
|
||||||
# <a id="static-code-analysis"></a> Running cppcheck on the Software
|
# <a id="static-code-analysis"></a> Running cppcheck on the Software
|
||||||
|
|
||||||
|
11
apply-clang-format.sh
Executable file
11
apply-clang-format.sh
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [[ ! -f README.md ]]; then
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
|
|
||||||
|
find ./mission -iname *.h o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i
|
||||||
|
find ./linux -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i
|
||||||
|
find ./bsp_q7s -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i
|
||||||
|
find ./bsp_linux_board -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i
|
||||||
|
find ./bsp_hosted -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i
|
||||||
|
find ./test -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i
|
@ -1,20 +1,19 @@
|
|||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
#include "ObjectFactory.h"
|
|
||||||
|
|
||||||
#include <OBSWConfig.h>
|
#include <OBSWConfig.h>
|
||||||
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
|
||||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||||
#include <fsfw/tasks/PeriodicTaskIF.h>
|
#include <fsfw/tasks/PeriodicTaskIF.h>
|
||||||
#include <fsfw/tasks/TaskFactory.h>
|
#include <fsfw/tasks/TaskFactory.h>
|
||||||
|
|
||||||
#include <mission/utility/InitMission.h>
|
#include <mission/utility/InitMission.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "ObjectFactory.h"
|
||||||
|
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
ServiceInterfaceStream sif::debug("DEBUG");
|
ServiceInterfaceStream sif::debug("DEBUG");
|
||||||
ServiceInterfaceStream sif::info("INFO");
|
ServiceInterfaceStream sif::info("INFO");
|
||||||
@ -55,8 +54,7 @@ void initmission::initTasks() {
|
|||||||
/* TMTC Distribution */
|
/* TMTC Distribution */
|
||||||
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
||||||
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
ReturnValue_t result = tmTcDistributor->addComponent(
|
ReturnValue_t result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
objects::CCSDS_PACKET_DISTRIBUTOR);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,6 @@
|
|||||||
namespace initmission {
|
namespace initmission {
|
||||||
void initMission();
|
void initMission();
|
||||||
void initTasks();
|
void initTasks();
|
||||||
};
|
}; // namespace initmission
|
||||||
|
|
||||||
#endif /* BSP_LINUX_INITMISSION_H_ */
|
#endif /* BSP_LINUX_INITMISSION_H_ */
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#include "ObjectFactory.h"
|
#include "ObjectFactory.h"
|
||||||
#include "OBSWConfig.h"
|
|
||||||
|
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
||||||
|
#include <fsfw/tmtcservices/PusServiceBase.h>
|
||||||
|
#include <mission/core/GenericFactory.h>
|
||||||
|
#include <mission/utility/TmFunnel.h>
|
||||||
#include <objects/systemObjectList.h>
|
#include <objects/systemObjectList.h>
|
||||||
#include <tmtc/apid.h>
|
#include <tmtc/apid.h>
|
||||||
#include <tmtc/pusIds.h>
|
#include <tmtc/pusIds.h>
|
||||||
|
|
||||||
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
#include "OBSWConfig.h"
|
||||||
#include <fsfw/tmtcservices/PusServiceBase.h>
|
|
||||||
|
|
||||||
#include <mission/core/GenericFactory.h>
|
|
||||||
#include <mission/utility/TmFunnel.h>
|
|
||||||
|
|
||||||
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
|
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
|
||||||
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
||||||
@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include <fsfw/tmtcpacket/pus/tm.h>
|
#include <fsfw/tmtcpacket/pus/tm.h>
|
||||||
|
|
||||||
|
|
||||||
#if OBSW_ADD_TEST_CODE == 1
|
#if OBSW_ADD_TEST_CODE == 1
|
||||||
#include <test/testtasks/TestTask.h>
|
#include <test/testtasks/TestTask.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
||||||
#define BSP_LINUX_OBJECTFACTORY_H_
|
#define BSP_LINUX_OBJECTFACTORY_H_
|
||||||
|
|
||||||
|
|
||||||
namespace ObjectFactory {
|
namespace ObjectFactory {
|
||||||
void setStatics();
|
void setStatics();
|
||||||
void produce(void* args);
|
void produce(void* args);
|
||||||
};
|
}; // namespace ObjectFactory
|
||||||
|
|
||||||
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
||||||
|
@ -7,7 +7,8 @@ extern "C" void __gcov_flush();
|
|||||||
#else
|
#else
|
||||||
void __gcov_flush() {
|
void __gcov_flush() {
|
||||||
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
||||||
"coverage information is desired.\n" << std::flush;
|
"coverage information is desired.\n"
|
||||||
|
<< std::flush;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -9,7 +9,3 @@ void printChar(const char* character, bool errStream) {
|
|||||||
}
|
}
|
||||||
putc(*character, stdout);
|
putc(*character, stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,26 +1,25 @@
|
|||||||
#include "ArduinoComIF.h"
|
#include "ArduinoComIF.h"
|
||||||
#include "ArduinoCookie.h"
|
|
||||||
|
|
||||||
#include <fsfw/globalfunctions/DleEncoder.h>
|
|
||||||
#include <fsfw/globalfunctions/CRC.h>
|
#include <fsfw/globalfunctions/CRC.h>
|
||||||
|
#include <fsfw/globalfunctions/DleEncoder.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
|
|
||||||
|
#include "ArduinoCookie.h"
|
||||||
|
|
||||||
// This only works on Linux
|
// This only works on Linux
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
#include <termios.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <termios.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#elif WIN32
|
#elif WIN32
|
||||||
#include <windows.h>
|
|
||||||
#include <strsafe.h>
|
#include <strsafe.h>
|
||||||
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
ArduinoComIF::ArduinoComIF(object_id_t setObjectId, bool promptComIF,
|
ArduinoComIF::ArduinoComIF(object_id_t setObjectId, bool promptComIF, const char *serialDevice)
|
||||||
const char *serialDevice):
|
: rxBuffer(MAX_PACKET_SIZE * MAX_NUMBER_OF_SPI_DEVICES * 10, true), SystemObject(setObjectId) {
|
||||||
rxBuffer(MAX_PACKET_SIZE * MAX_NUMBER_OF_SPI_DEVICES*10, true),
|
|
||||||
SystemObject(setObjectId) {
|
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
initialized = false;
|
initialized = false;
|
||||||
serialPort = ::open("/dev/ttyUSB0", O_RDWR);
|
serialPort = ::open("/dev/ttyUSB0", O_RDWR);
|
||||||
@ -66,7 +65,6 @@ ArduinoComIF::ArduinoComIF(object_id_t setObjectId, bool promptComIF,
|
|||||||
sif::info << "Please enter the COM port (c to cancel): " << std::flush;
|
sif::info << "Please enter the COM port (c to cancel): " << std::flush;
|
||||||
std::string comPort;
|
std::string comPort;
|
||||||
while (hCom == INVALID_HANDLE_VALUE) {
|
while (hCom == INVALID_HANDLE_VALUE) {
|
||||||
|
|
||||||
std::getline(std::cin, comPort);
|
std::getline(std::cin, comPort);
|
||||||
if (comPort[0] == 'c') {
|
if (comPort[0] == 'c') {
|
||||||
break;
|
break;
|
||||||
@ -80,37 +78,29 @@ ArduinoComIF::ArduinoComIF(object_id_t setObjectId, bool promptComIF,
|
|||||||
0, // Non Overlapped I/O
|
0, // Non Overlapped I/O
|
||||||
NULL); // Null for Comm Devices
|
NULL); // Null for Comm Devices
|
||||||
|
|
||||||
if (hCom == INVALID_HANDLE_VALUE)
|
if (hCom == INVALID_HANDLE_VALUE) {
|
||||||
{
|
|
||||||
if (GetLastError() == 2) {
|
if (GetLastError() == 2) {
|
||||||
sif::error << "COM Port does not found!" << std::endl;
|
sif::error << "COM Port does not found!" << std::endl;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
TCHAR err[128];
|
TCHAR err[128];
|
||||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL,
|
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),
|
||||||
GetLastError(),
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), err, sizeof(err), NULL);
|
||||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
|
||||||
err, sizeof(err), NULL);
|
|
||||||
// Handle the error.
|
// Handle the error.
|
||||||
sif::info << "CreateFileA Error code: " << GetLastError()
|
sif::info << "CreateFileA Error code: " << GetLastError() << std::endl;
|
||||||
<< std::endl;
|
|
||||||
sif::error << err << std::flush;
|
sif::error << err << std::flush;
|
||||||
}
|
}
|
||||||
sif::info << "Please enter a valid COM port: " << std::flush;
|
sif::info << "Please enter a valid COM port: " << std::flush;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
serialParams.DCBlength = sizeof(serialParams);
|
serialParams.DCBlength = sizeof(serialParams);
|
||||||
if (baudRate == 9600) {
|
if (baudRate == 9600) {
|
||||||
serialParams.BaudRate = CBR_9600;
|
serialParams.BaudRate = CBR_9600;
|
||||||
}
|
}
|
||||||
if (baudRate == 115200) {
|
if (baudRate == 115200) {
|
||||||
serialParams.BaudRate = CBR_115200;
|
serialParams.BaudRate = CBR_115200;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
serialParams.BaudRate = baudRate;
|
serialParams.BaudRate = baudRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,29 +133,22 @@ ReturnValue_t ArduinoComIF::initializeInterface(CookieIF * cookie) {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::sendMessage(CookieIF *cookie, const uint8_t *data,
|
ReturnValue_t ArduinoComIF::sendMessage(CookieIF *cookie, const uint8_t *data, size_t len) {
|
||||||
size_t len) {
|
|
||||||
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie *>(cookie);
|
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie *>(cookie);
|
||||||
if (arduinoCookie == nullptr) {
|
if (arduinoCookie == nullptr) {
|
||||||
return INVALID_COOKIE_TYPE;
|
return INVALID_COOKIE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sendMessage(arduinoCookie->command, arduinoCookie->address, data,
|
return sendMessage(arduinoCookie->command, arduinoCookie->address, data, len);
|
||||||
len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::getSendSuccess(CookieIF *cookie) {
|
ReturnValue_t ArduinoComIF::getSendSuccess(CookieIF *cookie) { return RETURN_OK; }
|
||||||
|
|
||||||
|
ReturnValue_t ArduinoComIF::requestReceiveMessage(CookieIF *cookie, size_t requestLen) {
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::requestReceiveMessage(CookieIF *cookie,
|
ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) {
|
||||||
size_t requestLen) {
|
|
||||||
return RETURN_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie,
|
|
||||||
uint8_t **buffer, size_t *size) {
|
|
||||||
|
|
||||||
handleSerialPortRx();
|
handleSerialPortRx();
|
||||||
|
|
||||||
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie *>(cookie);
|
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie *>(cookie);
|
||||||
@ -178,8 +161,8 @@ ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie,
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::sendMessage(uint8_t command,
|
ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const uint8_t *data,
|
||||||
uint8_t address, const uint8_t *data, size_t dataLen) {
|
size_t dataLen) {
|
||||||
if (dataLen > UINT16_MAX) {
|
if (dataLen > UINT16_MAX) {
|
||||||
return TOO_MUCH_DATA;
|
return TOO_MUCH_DATA;
|
||||||
}
|
}
|
||||||
@ -193,16 +176,15 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command,
|
|||||||
size_t remainingLen = sizeof(sendBuffer) - 1;
|
size_t remainingLen = sizeof(sendBuffer) - 1;
|
||||||
size_t encodedLen = 0;
|
size_t encodedLen = 0;
|
||||||
|
|
||||||
ReturnValue_t result = DleEncoder::encode(&command, 1, currentPosition,
|
ReturnValue_t result =
|
||||||
remainingLen, &encodedLen, false);
|
DleEncoder::encode(&command, 1, currentPosition, remainingLen, &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
currentPosition += encodedLen;
|
currentPosition += encodedLen;
|
||||||
remainingLen -= encodedLen; // DleEncoder will never return encodedLen > remainingLen
|
remainingLen -= encodedLen; // DleEncoder will never return encodedLen > remainingLen
|
||||||
|
|
||||||
result = DleEncoder::encode(&address, 1, currentPosition, remainingLen,
|
result = DleEncoder::encode(&address, 1, currentPosition, remainingLen, &encodedLen, false);
|
||||||
&encodedLen, false);
|
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -215,8 +197,8 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command,
|
|||||||
temporaryBuffer[0] = dataLen >> 8; // we checked dataLen above
|
temporaryBuffer[0] = dataLen >> 8; // we checked dataLen above
|
||||||
temporaryBuffer[1] = dataLen;
|
temporaryBuffer[1] = dataLen;
|
||||||
|
|
||||||
result = DleEncoder::encode(temporaryBuffer, 2, currentPosition,
|
result =
|
||||||
remainingLen, &encodedLen, false);
|
DleEncoder::encode(temporaryBuffer, 2, currentPosition, remainingLen, &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -224,8 +206,7 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command,
|
|||||||
remainingLen -= encodedLen; // DleEncoder will never return encodedLen > remainingLen
|
remainingLen -= encodedLen; // DleEncoder will never return encodedLen > remainingLen
|
||||||
|
|
||||||
// encoding the actual data
|
// encoding the actual data
|
||||||
result = DleEncoder::encode(data, dataLen, currentPosition, remainingLen,
|
result = DleEncoder::encode(data, dataLen, currentPosition, remainingLen, &encodedLen, false);
|
||||||
&encodedLen, false);
|
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -241,8 +222,8 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command,
|
|||||||
temporaryBuffer[0] = crc >> 8;
|
temporaryBuffer[0] = crc >> 8;
|
||||||
temporaryBuffer[1] = crc;
|
temporaryBuffer[1] = crc;
|
||||||
|
|
||||||
result = DleEncoder::encode(temporaryBuffer, 2, currentPosition,
|
result =
|
||||||
remainingLen, &encodedLen, false);
|
DleEncoder::encode(temporaryBuffer, 2, currentPosition, remainingLen, &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -279,8 +260,7 @@ void ArduinoComIF::handleSerialPortRx() {
|
|||||||
|
|
||||||
uint8_t dataFromSerial[availableSpace];
|
uint8_t dataFromSerial[availableSpace];
|
||||||
|
|
||||||
ssize_t bytesRead = read(serialPort, dataFromSerial,
|
ssize_t bytesRead = read(serialPort, dataFromSerial, sizeof(dataFromSerial));
|
||||||
sizeof(dataFromSerial));
|
|
||||||
|
|
||||||
if (bytesRead < 0) {
|
if (bytesRead < 0) {
|
||||||
return;
|
return;
|
||||||
@ -292,13 +272,12 @@ void ArduinoComIF::handleSerialPortRx() {
|
|||||||
|
|
||||||
uint32_t dataLenReceivedSoFar = 0;
|
uint32_t dataLenReceivedSoFar = 0;
|
||||||
|
|
||||||
rxBuffer.readData(dataReceivedSoFar, sizeof(dataReceivedSoFar), true,
|
rxBuffer.readData(dataReceivedSoFar, sizeof(dataReceivedSoFar), true, &dataLenReceivedSoFar);
|
||||||
&dataLenReceivedSoFar);
|
|
||||||
|
|
||||||
// look for STX
|
// look for STX
|
||||||
size_t firstSTXinRawData = 0;
|
size_t firstSTXinRawData = 0;
|
||||||
while ((firstSTXinRawData < dataLenReceivedSoFar)
|
while ((firstSTXinRawData < dataLenReceivedSoFar) &&
|
||||||
&& (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX_CHAR)) {
|
(dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX_CHAR)) {
|
||||||
firstSTXinRawData++;
|
firstSTXinRawData++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,10 +292,9 @@ void ArduinoComIF::handleSerialPortRx() {
|
|||||||
|
|
||||||
size_t readSize = 0;
|
size_t readSize = 0;
|
||||||
|
|
||||||
ReturnValue_t result = DleEncoder::decode(
|
ReturnValue_t result = DleEncoder::decode(dataReceivedSoFar + firstSTXinRawData,
|
||||||
dataReceivedSoFar + firstSTXinRawData,
|
dataLenReceivedSoFar - firstSTXinRawData, &readSize,
|
||||||
dataLenReceivedSoFar - firstSTXinRawData, &readSize, packet,
|
packet, sizeof(packet), &packetLen);
|
||||||
sizeof(packet), &packetLen);
|
|
||||||
|
|
||||||
size_t toDelete = firstSTXinRawData;
|
size_t toDelete = firstSTXinRawData;
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
@ -333,9 +311,7 @@ void ArduinoComIF::handleSerialPortRx() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArduinoComIF::setBaudrate(uint32_t baudRate) {
|
void ArduinoComIF::setBaudrate(uint32_t baudRate) { this->baudRate = baudRate; }
|
||||||
this->baudRate = baudRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ArduinoComIF::handlePacket(uint8_t *packet, size_t packetLen) {
|
void ArduinoComIF::handlePacket(uint8_t *packet, size_t packetLen) {
|
||||||
uint16_t crc = CRC::crc16ccitt(packet, packetLen);
|
uint16_t crc = CRC::crc16ccitt(packet, packetLen);
|
||||||
@ -368,8 +344,7 @@ void ArduinoComIF::handlePacket(uint8_t *packet, size_t packetLen) {
|
|||||||
}
|
}
|
||||||
std::memcpy(cookie.replyBuffer.data(), packet + 4, packetLen - 6);
|
std::memcpy(cookie.replyBuffer.data(), packet + 4, packetLen - 6);
|
||||||
cookie.receivedDataLen = packetLen - 6;
|
cookie.receivedDataLen = packetLen - 6;
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
#include <fsfw/container/FixedMap.h>
|
#include <fsfw/container/FixedMap.h>
|
||||||
#include <fsfw/container/SimpleRingBuffer.h>
|
#include <fsfw/container/SimpleRingBuffer.h>
|
||||||
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
|
||||||
#include <fsfw/objectmanager/SystemObject.h>
|
#include <fsfw/objectmanager/SystemObject.h>
|
||||||
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <map>
|
#include <map>
|
||||||
@ -17,8 +17,7 @@
|
|||||||
// Forward declaration, so users don't peek
|
// Forward declaration, so users don't peek
|
||||||
class ArduinoCookie;
|
class ArduinoCookie;
|
||||||
|
|
||||||
class ArduinoComIF: public SystemObject,
|
class ArduinoComIF : public SystemObject, public DeviceCommunicationIF {
|
||||||
public DeviceCommunicationIF {
|
|
||||||
public:
|
public:
|
||||||
static const uint8_t MAX_NUMBER_OF_SPI_DEVICES = 8;
|
static const uint8_t MAX_NUMBER_OF_SPI_DEVICES = 8;
|
||||||
static const uint8_t MAX_PACKET_SIZE = 64;
|
static const uint8_t MAX_PACKET_SIZE = 64;
|
||||||
@ -34,13 +33,12 @@ public:
|
|||||||
|
|
||||||
/** DeviceCommunicationIF overrides */
|
/** DeviceCommunicationIF overrides */
|
||||||
virtual ReturnValue_t initializeInterface(CookieIF *cookie) override;
|
virtual ReturnValue_t initializeInterface(CookieIF *cookie) override;
|
||||||
virtual ReturnValue_t sendMessage(CookieIF *cookie,
|
virtual ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t *sendData,
|
||||||
const uint8_t * sendData, size_t sendLen) override;
|
size_t sendLen) override;
|
||||||
virtual ReturnValue_t getSendSuccess(CookieIF *cookie) override;
|
virtual ReturnValue_t getSendSuccess(CookieIF *cookie) override;
|
||||||
virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie,
|
virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie, size_t requestLen) override;
|
||||||
size_t requestLen) override;
|
virtual ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer,
|
||||||
virtual ReturnValue_t readReceivedMessage(CookieIF *cookie,
|
size_t *size) override;
|
||||||
uint8_t **buffer, size_t *size) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
@ -59,8 +57,7 @@ private:
|
|||||||
|
|
||||||
SimpleRingBuffer rxBuffer;
|
SimpleRingBuffer rxBuffer;
|
||||||
|
|
||||||
ReturnValue_t sendMessage(uint8_t command, uint8_t address,
|
ReturnValue_t sendMessage(uint8_t command, uint8_t address, const uint8_t *data, size_t dataLen);
|
||||||
const uint8_t *data, size_t dataLen);
|
|
||||||
void handleSerialPortRx();
|
void handleSerialPortRx();
|
||||||
|
|
||||||
void handlePacket(uint8_t *packet, size_t packetLen);
|
void handlePacket(uint8_t *packet, size_t packetLen);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <bsp_hosted/comIF/ArduinoCookie.h>
|
#include <bsp_hosted/comIF/ArduinoCookie.h>
|
||||||
|
|
||||||
ArduinoCookie::ArduinoCookie(Protocol_t protocol, uint8_t address,
|
ArduinoCookie::ArduinoCookie(Protocol_t protocol, uint8_t address, const size_t maxReplySize)
|
||||||
const size_t maxReplySize) :
|
: protocol(protocol),
|
||||||
protocol(protocol), command(protocol), address(address),
|
command(protocol),
|
||||||
maxReplySize(maxReplySize), replyBuffer(maxReplySize) {
|
address(address),
|
||||||
}
|
maxReplySize(maxReplySize),
|
||||||
|
replyBuffer(maxReplySize) {}
|
||||||
|
@ -2,18 +2,14 @@
|
|||||||
#define MISSION_ARDUINO_ARDUINOCOOKIE_H_
|
#define MISSION_ARDUINO_ARDUINOCOOKIE_H_
|
||||||
|
|
||||||
#include <fsfw/devicehandlers/CookieIF.h>
|
#include <fsfw/devicehandlers/CookieIF.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class ArduinoCookie : public CookieIF {
|
class ArduinoCookie : public CookieIF {
|
||||||
public:
|
public:
|
||||||
enum Protocol_t: uint8_t {
|
enum Protocol_t : uint8_t { INVALID, SPI, I2C };
|
||||||
INVALID,
|
|
||||||
SPI,
|
|
||||||
I2C
|
|
||||||
};
|
|
||||||
|
|
||||||
ArduinoCookie(Protocol_t protocol, uint8_t address,
|
ArduinoCookie(Protocol_t protocol, uint8_t address, const size_t maxReplySize);
|
||||||
const size_t maxReplySize);
|
|
||||||
|
|
||||||
Protocol_t protocol;
|
Protocol_t protocol;
|
||||||
uint8_t command;
|
uint8_t command;
|
||||||
@ -21,7 +17,6 @@ public:
|
|||||||
std::vector<uint8_t> replyBuffer;
|
std::vector<uint8_t> replyBuffer;
|
||||||
size_t receivedDataLen = 0;
|
size_t receivedDataLen = 0;
|
||||||
size_t maxReplySize;
|
size_t maxReplySize;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_ARDUINO_ARDUINOCOOKIE_H_ */
|
#endif /* MISSION_ARDUINO_ARDUINOCOOKIE_H_ */
|
||||||
|
@ -51,7 +51,4 @@ namespace gpioIds {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFWCONFIG_DEVICES_GPIOIDS_H_ */
|
#endif /* FSFWCONFIG_DEVICES_GPIOIDS_H_ */
|
||||||
|
@ -52,7 +52,6 @@ namespace pcduSwitches {
|
|||||||
static const uint8_t INIT_STATE_SOLAR_CELL_EXP = OFF;
|
static const uint8_t INIT_STATE_SOLAR_CELL_EXP = OFF;
|
||||||
static const uint8_t INIT_STATE_PLOC = OFF;
|
static const uint8_t INIT_STATE_PLOC = OFF;
|
||||||
static const uint8_t INIT_STATE_ACS_BOARD_SIDE_A = OFF;
|
static const uint8_t INIT_STATE_ACS_BOARD_SIDE_A = OFF;
|
||||||
}
|
} // namespace pcduSwitches
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ */
|
#endif /* FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ */
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
|
#define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
|
||||||
|
|
||||||
#include <common/config/commonSubsystemIds.h>
|
#include <common/config/commonSubsystemIds.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -9,9 +10,7 @@
|
|||||||
* Numbers 0-80 are reserved for FSFW Subsystem IDs (framework/events/)
|
* Numbers 0-80 are reserved for FSFW Subsystem IDs (framework/events/)
|
||||||
*/
|
*/
|
||||||
namespace SUBSYSTEM_ID {
|
namespace SUBSYSTEM_ID {
|
||||||
enum: uint8_t {
|
enum : uint8_t { SUBSYSTEM_ID_START = COMMON_SUBSYSTEM_ID_END };
|
||||||
SUBSYSTEM_ID_START = COMMON_SUBSYSTEM_ID_END
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ */
|
#endif /* CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ */
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "MissionMessageTypes.h"
|
#include "MissionMessageTypes.h"
|
||||||
|
|
||||||
#include <fsfw/ipc/CommandMessage.h>
|
#include <fsfw/ipc/CommandMessage.h>
|
||||||
|
|
||||||
void messagetypes::clearMissionMessage(CommandMessage* message) {
|
void messagetypes::clearMissionMessage(CommandMessage* message) {
|
||||||
@ -7,5 +8,3 @@ void messagetypes::clearMissionMessage(CommandMessage* message) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,6 +17,6 @@ enum MESSAGE_TYPE {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void clearMissionMessage(CommandMessage* message);
|
void clearMissionMessage(CommandMessage* message);
|
||||||
}
|
} // namespace messagetypes
|
||||||
|
|
||||||
#endif /* CONFIG_IPC_MISSIONMESSAGETYPES_H_ */
|
#endif /* CONFIG_IPC_MISSIONMESSAGETYPES_H_ */
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#ifndef HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
#ifndef HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
||||||
#define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
#define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
#include <commonObjects.h>
|
#include <commonObjects.h>
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
// The objects will be instantiated in the ID order
|
// The objects will be instantiated in the ID order
|
||||||
namespace objects {
|
namespace objects {
|
||||||
enum sourceObjects : uint32_t {
|
enum sourceObjects : uint32_t {
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#ifndef CONFIG_RETURNVALUES_CLASSIDS_H_
|
#ifndef CONFIG_RETURNVALUES_CLASSIDS_H_
|
||||||
#define CONFIG_RETURNVALUES_CLASSIDS_H_
|
#define CONFIG_RETURNVALUES_CLASSIDS_H_
|
||||||
|
|
||||||
#include "commonClassIds.h"
|
|
||||||
#include <fsfw/returnvalues/FwClassIds.h>
|
#include <fsfw/returnvalues/FwClassIds.h>
|
||||||
|
|
||||||
|
#include "commonClassIds.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Source IDs starts at 73 for now
|
* Source IDs starts at 73 for now
|
||||||
* Framework IDs for ReturnValues run from 0 to 56
|
* Framework IDs for ReturnValues run from 0 to 56
|
||||||
@ -15,5 +16,4 @@ enum {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* CONFIG_RETURNVALUES_CLASSIDS_H_ */
|
#endif /* CONFIG_RETURNVALUES_CLASSIDS_H_ */
|
||||||
|
@ -15,5 +15,4 @@ namespace apid {
|
|||||||
static const uint16_t EIVE_OBSW = 0x65;
|
static const uint16_t EIVE_OBSW = 0x65;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFWCONFIG_TMTC_APID_H_ */
|
#endif /* FSFWCONFIG_TMTC_APID_H_ */
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
#include "OBSWVersion.h"
|
#include "OBSWVersion.h"
|
||||||
|
|
||||||
#include "fsfw/FSFWVersion.h"
|
#include "fsfw/FSFWVersion.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
static const char* COMPILE_PRINTOUT = "Windows";
|
static const char* COMPILE_PRINTOUT = "Windows";
|
||||||
#elif LINUX
|
#elif LINUX
|
||||||
@ -17,13 +16,12 @@ static const char* COMPILE_PRINTOUT = "unknown OS";
|
|||||||
* Linux and Windows.
|
* Linux and Windows.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int main(void)
|
int main(void) {
|
||||||
{
|
|
||||||
std::cout << "-- EIVE OBSW --" << std::endl;
|
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||||
std::cout << "-- Compiled for " << COMPILE_PRINTOUT << " --" << std::endl;
|
std::cout << "-- Compiled for " << COMPILE_PRINTOUT << " --" << std::endl;
|
||||||
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION <<
|
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION << "."
|
||||||
"." << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << "." <<
|
<< SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << "."
|
||||||
FSFW_REVISION << "--" << std::endl;
|
<< FSFW_REVISION << "--" << std::endl;
|
||||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||||
|
|
||||||
initmission::initMission();
|
initmission::initMission();
|
||||||
@ -33,5 +31,3 @@ int main(void)
|
|||||||
TaskFactory::delayTask(5000);
|
TaskFactory::delayTask(5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
#include "ObjectFactory.h"
|
|
||||||
|
|
||||||
#include "objects/systemObjectList.h"
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include "OBSWConfig.h"
|
|
||||||
#include "pollingsequence/pollingSequenceFactory.h"
|
|
||||||
|
|
||||||
#include <mission/utility/InitMission.h>
|
|
||||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
|
||||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||||
#include <fsfw/tasks/PeriodicTaskIF.h>
|
#include <fsfw/tasks/PeriodicTaskIF.h>
|
||||||
#include <fsfw/tasks/TaskFactory.h>
|
#include <fsfw/tasks/TaskFactory.h>
|
||||||
|
#include <mission/utility/InitMission.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "ObjectFactory.h"
|
||||||
|
#include "objects/systemObjectList.h"
|
||||||
|
#include "pollingsequence/pollingSequenceFactory.h"
|
||||||
|
|
||||||
ServiceInterfaceStream sif::debug("DEBUG");
|
ServiceInterfaceStream sif::debug("DEBUG");
|
||||||
ServiceInterfaceStream sif::info("INFO");
|
ServiceInterfaceStream sif::info("INFO");
|
||||||
ServiceInterfaceStream sif::warning("WARNING");
|
ServiceInterfaceStream sif::warning("WARNING");
|
||||||
@ -47,7 +47,6 @@ void initmission::initTasks() {
|
|||||||
void (*missedDeadlineFunc)(void) = nullptr;
|
void (*missedDeadlineFunc)(void) = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* TMTC Distribution */
|
/* TMTC Distribution */
|
||||||
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
||||||
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
@ -93,8 +92,7 @@ void initmission::initTasks() {
|
|||||||
for (const auto& task : taskVector) {
|
for (const auto& task : taskVector) {
|
||||||
if (task != nullptr) {
|
if (task != nullptr) {
|
||||||
task->startTask();
|
task->startTask();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,7 +118,8 @@ void initmission::initTasks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initmission::createPusTasks(TaskFactory& factory,
|
void initmission::createPusTasks(TaskFactory& factory,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*>& taskVec) {
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
||||||
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
@ -182,19 +181,18 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
}
|
}
|
||||||
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("INT_ERR_RPRT",
|
initmission::printAddObjectError("INT_ERR_RPRT", objects::INTERNAL_ERROR_REPORTER);
|
||||||
objects::INTERNAL_ERROR_REPORTER);
|
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusLowPrio);
|
taskVec.push_back(pusLowPrio);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initmission::createPstTasks(TaskFactory& factory,
|
void initmission::createPstTasks(TaskFactory& factory,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*> &taskVec) {
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
#if OBSW_ADD_SPI_TEST_CODE == 0
|
#if OBSW_ADD_SPI_TEST_CODE == 0
|
||||||
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
||||||
"SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0,
|
"SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
|
||||||
missedDeadlineFunc);
|
|
||||||
result = pst::pstSpi(spiPst);
|
result = pst::pstSpi(spiPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
@ -235,13 +233,12 @@ void initmission::createTestTasks(TaskFactory& factory,
|
|||||||
bool startTestPst = true;
|
bool startTestPst = true;
|
||||||
static_cast<void>(startTestPst);
|
static_cast<void>(startTestPst);
|
||||||
#if OBSW_ADD_TEST_PST == 1
|
#if OBSW_ADD_TEST_PST == 1
|
||||||
FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("TEST_PST", 50,
|
FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask(
|
||||||
PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc);
|
"TEST_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc);
|
||||||
result = pst::pstTest(pstTestTask);
|
result = pst::pstTest(pstTestTask);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "initmission::initTasks: ACS PST empty or invalid" << std::endl;
|
sif::info << "initmission::initTasks: ACS PST empty or invalid" << std::endl;
|
||||||
startTestPst = false;
|
startTestPst = false;
|
||||||
}
|
}
|
||||||
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#ifndef BSP_LINUX_INITMISSION_H_
|
#ifndef BSP_LINUX_INITMISSION_H_
|
||||||
#define BSP_LINUX_INITMISSION_H_
|
#define BSP_LINUX_INITMISSION_H_
|
||||||
|
|
||||||
#include "fsfw/tasks/Typedef.h"
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "fsfw/tasks/Typedef.h"
|
||||||
|
|
||||||
class PeriodicTaskIF;
|
class PeriodicTaskIF;
|
||||||
class TaskFactory;
|
class TaskFactory;
|
||||||
|
|
||||||
@ -11,14 +12,12 @@ namespace initmission {
|
|||||||
void initMission();
|
void initMission();
|
||||||
void initTasks();
|
void initTasks();
|
||||||
|
|
||||||
void createPstTasks(TaskFactory& factory,
|
void createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
|
||||||
std::vector<PeriodicTaskIF*>& taskVec);
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
void createTestTasks(TaskFactory& factory,
|
void createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
|
||||||
std::vector<PeriodicTaskIF*>& taskVec);
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
std::vector<PeriodicTaskIF*>& taskVec);
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
};
|
}; // namespace initmission
|
||||||
|
|
||||||
#endif /* BSP_LINUX_INITMISSION_H_ */
|
#endif /* BSP_LINUX_INITMISSION_H_ */
|
||||||
|
@ -1,47 +1,47 @@
|
|||||||
#include <devConf.h>
|
|
||||||
#include "ObjectFactory.h"
|
#include "ObjectFactory.h"
|
||||||
|
|
||||||
#include "objects/systemObjectList.h"
|
#include <devConf.h>
|
||||||
|
#include <mission/devices/GPSHyperionHandler.h>
|
||||||
|
|
||||||
|
#include "OBSWConfig.h"
|
||||||
#include "devices/addresses.h"
|
#include "devices/addresses.h"
|
||||||
#include "devices/gpioIds.h"
|
#include "devices/gpioIds.h"
|
||||||
#include "OBSWConfig.h"
|
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
||||||
#include "tmtc/apid.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
#include "tmtc/pusIds.h"
|
#include "fsfw/tmtcpacket/pus/tm.h"
|
||||||
|
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
||||||
|
#include "fsfw/tmtcservices/PusServiceBase.h"
|
||||||
#include "linux/boardtest/LibgpiodTest.h"
|
#include "linux/boardtest/LibgpiodTest.h"
|
||||||
#include "linux/boardtest/SpiTestClass.h"
|
#include "linux/boardtest/SpiTestClass.h"
|
||||||
#include "linux/boardtest/UartTestClass.h"
|
#include "linux/boardtest/UartTestClass.h"
|
||||||
|
|
||||||
#include "mission/core/GenericFactory.h"
|
#include "mission/core/GenericFactory.h"
|
||||||
|
#include "mission/devices/GyroADIS1650XHandler.h"
|
||||||
#include "mission/utility/TmFunnel.h"
|
#include "mission/utility/TmFunnel.h"
|
||||||
#include <mission/devices/GPSHyperionHandler.h>
|
#include "objects/systemObjectList.h"
|
||||||
#include "mission/devices/GyroADIS16507Handler.h"
|
#include "tmtc/apid.h"
|
||||||
|
#include "tmtc/pusIds.h"
|
||||||
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
|
||||||
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
|
||||||
#include "fsfw/tmtcservices/PusServiceBase.h"
|
|
||||||
#include "fsfw/tmtcpacket/pus/tm.h"
|
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
|
||||||
|
|
||||||
/* UDP server includes */
|
/* UDP server includes */
|
||||||
#if OBSW_USE_TMTC_TCP_BRIDGE == 1
|
#if OBSW_USE_TMTC_TCP_BRIDGE == 1
|
||||||
#include <fsfw/src/fsfw/osal/common/TcpTmTcBridge.h>
|
#include <fsfw/src/fsfw/osal/common/TcpTmTcBridge.h>
|
||||||
#include <fsfw/src/fsfw/osal/common/TcpTmTcServer.h>
|
#include <fsfw/src/fsfw/osal/common/TcpTmTcServer.h>
|
||||||
#else
|
#else
|
||||||
#include "fsfw/osal/common/UdpTmTcBridge.h"
|
|
||||||
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
||||||
|
#include "fsfw/osal/common/UdpTmTcBridge.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h"
|
|
||||||
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
|
|
||||||
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
|
|
||||||
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
|
||||||
#include "fsfw_hal/linux/rpi/GpioRPi.h"
|
|
||||||
#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/UartComIF.h>
|
||||||
#include <fsfw_hal/linux/uart/UartCookie.h>
|
#include <fsfw_hal/linux/uart/UartCookie.h>
|
||||||
|
|
||||||
|
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
||||||
|
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
|
||||||
|
#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h"
|
||||||
|
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
|
||||||
|
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
||||||
|
#include "fsfw_hal/linux/rpi/GpioRPi.h"
|
||||||
|
#include "fsfw_hal/linux/spi/SpiComIF.h"
|
||||||
|
#include "fsfw_hal/linux/spi/SpiCookie.h"
|
||||||
|
|
||||||
void Factory::setStaticFrameworkObjectIds() {
|
void Factory::setStaticFrameworkObjectIds() {
|
||||||
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
PusServiceBase::packetDestination = objects::TM_FUNNEL;
|
PusServiceBase::packetDestination = objects::TM_FUNNEL;
|
||||||
@ -57,8 +57,6 @@ void Factory::setStaticFrameworkObjectIds() {
|
|||||||
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ObjectFactory::produce(void* args) {
|
void ObjectFactory::produce(void* args) {
|
||||||
Factory::setStaticFrameworkObjectIds();
|
Factory::setStaticFrameworkObjectIds();
|
||||||
ObjectFactory::produceGenericObjects();
|
ObjectFactory::produceGenericObjects();
|
||||||
@ -88,85 +86,93 @@ void ObjectFactory::produce(void* args){
|
|||||||
gpioCookie = new GpioCookie();
|
gpioCookie = new GpioCookie();
|
||||||
}
|
}
|
||||||
// TODO: Missing pin for Gyro 2
|
// TODO: Missing pin for Gyro 2
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN, "MGM_0_LIS3",
|
||||||
"MGM_0_LIS3", gpio::Direction::OUT, 1);
|
gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN,
|
||||||
"MGM_1_RM3100", gpio::Direction::OUT, 1);
|
"MGM_1_RM3100", gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN, "MGM_2_LIS3",
|
||||||
"MGM_2_LIS3", gpio::Direction::OUT, 1);
|
gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN,
|
||||||
"MGM_3_RM3100", gpio::Direction::OUT, 1);
|
"MGM_3_RM3100", gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN,
|
||||||
"GYRO_0_ADIS", gpio::Direction::OUT, 1);
|
"GYRO_0_ADIS", gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN, "GYRO_1_L3G",
|
||||||
"GYRO_1_L3G", gpio::Direction::OUT, 1);
|
gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_2_ADIS_CS, gpio::GYRO_2_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_2_ADIS_CS, gpio::GYRO_2_BCM_PIN,
|
||||||
"GYRO_2_ADIS", gpio::Direction::OUT, 1);
|
"GYRO_2_ADIS", gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_3_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_3_BCM_PIN, "GYRO_3_L3G",
|
||||||
"GYRO_3_L3G", gpio::Direction::OUT, 1);
|
gpio::Direction::OUT, 1);
|
||||||
gpioIF->addGpios(gpioCookie);
|
gpioIF->addGpios(gpioCookie);
|
||||||
|
|
||||||
spiDev = "/dev/spidev0.1";
|
spiDev = "/dev/spidev0.1";
|
||||||
spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev,
|
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);
|
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
||||||
auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER,
|
auto mgmLis3Handler =
|
||||||
objects::SPI_COM_IF, spiCookie, 0);
|
new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
||||||
mgmLis3Handler->setStartUpImmediately();
|
mgmLis3Handler->setStartUpImmediately();
|
||||||
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
||||||
mgmLis3Handler->setToGoToNormalMode(true);
|
mgmLis3Handler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
|
||||||
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
||||||
auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER,
|
auto mgmRm3100Handler =
|
||||||
objects::SPI_COM_IF, spiCookie, 0);
|
new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
||||||
mgmRm3100Handler->setStartUpImmediately();
|
mgmRm3100Handler->setStartUpImmediately();
|
||||||
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
|
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
|
||||||
mgmRm3100Handler->setToGoToNormalMode(true);
|
mgmRm3100Handler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev,
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev,
|
||||||
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
||||||
mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER,
|
mgmLis3Handler =
|
||||||
objects::SPI_COM_IF, spiCookie, 0);
|
new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
||||||
mgmLis3Handler->setStartUpImmediately();
|
mgmLis3Handler->setStartUpImmediately();
|
||||||
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
||||||
mgmLis3Handler->setToGoToNormalMode(true);
|
mgmLis3Handler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev,
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev,
|
||||||
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
||||||
mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER,
|
mgmRm3100Handler =
|
||||||
objects::SPI_COM_IF, spiCookie, 0);
|
new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
||||||
mgmRm3100Handler->setStartUpImmediately();
|
mgmRm3100Handler->setStartUpImmediately();
|
||||||
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
|
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
|
||||||
mgmRm3100Handler->setToGoToNormalMode(true);
|
mgmRm3100Handler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
||||||
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
auto adisHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF,
|
auto adisHandler =
|
||||||
spiCookie);
|
new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
|
||||||
adisHandler->setStartUpImmediately();
|
adisHandler->setStartUpImmediately();
|
||||||
spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev,
|
spiCookie =
|
||||||
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE,
|
||||||
auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF,
|
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
spiCookie, 0);
|
auto gyroL3gHandler =
|
||||||
|
new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
||||||
gyroL3gHandler->setStartUpImmediately();
|
gyroL3gHandler->setStartUpImmediately();
|
||||||
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
|
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
|
||||||
gyroL3gHandler->setToGoToNormalMode(true);
|
gyroL3gHandler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev,
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev,
|
||||||
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
adisHandler = new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF,
|
adisHandler =
|
||||||
spiCookie);
|
new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
|
||||||
adisHandler->setStartUpImmediately();
|
adisHandler->setStartUpImmediately();
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev,
|
spiCookie =
|
||||||
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE,
|
||||||
gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF,
|
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
spiCookie, 0);
|
gyroL3gHandler =
|
||||||
|
new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
||||||
gyroL3gHandler->setStartUpImmediately();
|
gyroL3gHandler->setStartUpImmediately();
|
||||||
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
|
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
|
||||||
gyroL3gHandler->setToGoToNormalMode(true);
|
gyroL3gHandler->setToGoToNormalMode(true);
|
||||||
@ -180,7 +186,6 @@ void ObjectFactory::produce(void* args){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createTestTasks() {
|
void ObjectFactory::createTestTasks() {
|
||||||
|
|
||||||
new TestTask(objects::TEST_TASK);
|
new TestTask(objects::TEST_TASK);
|
||||||
|
|
||||||
#if RPI_ADD_SPI_TEST == 1
|
#if RPI_ADD_SPI_TEST == 1
|
||||||
@ -217,20 +222,20 @@ void ObjectFactory::createTestTasks() {
|
|||||||
|
|
||||||
spiDev = "/dev/spidev0.1";
|
spiDev = "/dev/spidev0.1";
|
||||||
spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
||||||
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, spi::DEFAULT_ADIS16507_SPEED,
|
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE,
|
||||||
nullptr, nullptr);
|
spi::DEFAULT_ADIS16507_SPEED, nullptr, nullptr);
|
||||||
auto adisGyroHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
|
auto adisGyroHandler =
|
||||||
|
new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
|
||||||
adisGyroHandler->setStartUpImmediately();
|
adisGyroHandler->setStartUpImmediately();
|
||||||
#endif /* RPI_TEST_ADIS16507 == 1 */
|
#endif /* RPI_TEST_ADIS16507 == 1 */
|
||||||
|
|
||||||
#if RPI_TEST_GPS_HANDLER == 1
|
#if RPI_TEST_GPS_HANDLER == 1
|
||||||
UartCookie* uartCookie = new UartCookie(objects::GPS0_HANDLER, "/dev/serial0",
|
UartCookie* uartCookie =
|
||||||
UartModes::CANONICAL, 9600, 1024);
|
new UartCookie(objects::GPS0_HANDLER, "/dev/serial0", UartModes::CANONICAL, 9600, 1024);
|
||||||
uartCookie->setToFlushInput(true);
|
uartCookie->setToFlushInput(true);
|
||||||
uartCookie->setReadCycles(6);
|
uartCookie->setReadCycles(6);
|
||||||
GPSHyperionHandler* gpsHandler = new GPSHyperionHandler(objects::GPS0_HANDLER,
|
GPSHyperionHandler* gpsHandler =
|
||||||
objects::UART_COM_IF, uartCookie, false);
|
new GPSHyperionHandler(objects::GPS0_HANDLER, objects::UART_COM_IF, uartCookie, false);
|
||||||
gpsHandler->setStartUpImmediately();
|
gpsHandler->setStartUpImmediately();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
||||||
#define BSP_LINUX_OBJECTFACTORY_H_
|
#define BSP_LINUX_OBJECTFACTORY_H_
|
||||||
|
|
||||||
|
|
||||||
namespace ObjectFactory {
|
namespace ObjectFactory {
|
||||||
void setStatics();
|
void setStatics();
|
||||||
void produce(void* args);
|
void produce(void* args);
|
||||||
|
|
||||||
void createTestTasks();
|
void createTestTasks();
|
||||||
};
|
}; // namespace ObjectFactory
|
||||||
|
|
||||||
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
||||||
|
@ -7,7 +7,8 @@ extern "C" void __gcov_flush();
|
|||||||
#else
|
#else
|
||||||
void __gcov_flush() {
|
void __gcov_flush() {
|
||||||
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
||||||
"coverage information is desired.\n" << std::flush;
|
"coverage information is desired.\n"
|
||||||
|
<< std::flush;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -8,7 +8,3 @@ void printChar(const char* character, bool errStream) {
|
|||||||
}
|
}
|
||||||
putc(*character, stdout);
|
putc(*character, stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
#include "OBSWVersion.h"
|
#include "OBSWVersion.h"
|
||||||
|
|
||||||
#include "fsfw/FSFWVersion.h"
|
#include "fsfw/FSFWVersion.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#ifdef RASPBERRY_PI
|
#ifdef RASPBERRY_PI
|
||||||
static const char* const BOARD_NAME = "Raspberry Pi";
|
static const char* const BOARD_NAME = "Raspberry Pi";
|
||||||
#elif defined(BEAGLEBONEBLACK)
|
#elif defined(BEAGLEBONEBLACK)
|
||||||
@ -19,13 +18,12 @@ static const char* const BOARD_NAME = "Unknown Board";
|
|||||||
* @brief This is the main program and entry point for the Raspberry Pi.
|
* @brief This is the main program and entry point for the Raspberry Pi.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int main(void)
|
int main(void) {
|
||||||
{
|
|
||||||
std::cout << "-- EIVE OBSW --" << std::endl;
|
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||||
std::cout << "-- Compiled for Linux board " << BOARD_NAME << " --" << std::endl;
|
std::cout << "-- Compiled for Linux board " << BOARD_NAME << " --" << std::endl;
|
||||||
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION <<
|
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION << "."
|
||||||
"." << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION <<
|
<< SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << FSFW_REVISION
|
||||||
FSFW_REVISION << "--" << std::endl;
|
<< "--" << std::endl;
|
||||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||||
|
|
||||||
initmission::initMission();
|
initmission::initMission();
|
||||||
@ -35,5 +33,3 @@ int main(void)
|
|||||||
TaskFactory::delayTask(5000);
|
TaskFactory::delayTask(5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,13 +8,11 @@ static constexpr char SPI_RW_DEV[] = "/dev/spidev3.0";
|
|||||||
|
|
||||||
static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c-1";
|
static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c-1";
|
||||||
|
|
||||||
static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ttyUL3";
|
static constexpr char UART_GNSS_DEV[] = "/dev/ttyUL0";
|
||||||
static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ttyUL4";
|
static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ttyUL2";
|
||||||
static constexpr char UART_SYRLINKS_DEV[] = "/dev/ttyUL5";
|
static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ttyUL3";
|
||||||
static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ttyUL8";
|
static constexpr char UART_SYRLINKS_DEV[] = "/dev/ttyUL4";
|
||||||
|
static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ttyUL7";
|
||||||
static constexpr char UART_GNSS_0_DEV[] = "/dev/ttyUL0";
|
|
||||||
static constexpr char UART_GNSS_1_DEV[] = "/dev/ttyUL2";
|
|
||||||
|
|
||||||
static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio0";
|
static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio0";
|
||||||
static constexpr char UIO_PDEC_CONFIG_MEMORY[] = "/dev/uio2";
|
static constexpr char UIO_PDEC_CONFIG_MEMORY[] = "/dev/uio2";
|
||||||
@ -31,8 +29,10 @@ namespace gpioNames {
|
|||||||
static constexpr char MGM_3_CS[] = "mgm_3_rm3100_chip_select";
|
static constexpr char MGM_3_CS[] = "mgm_3_rm3100_chip_select";
|
||||||
static constexpr char RESET_GNSS_0[] = "reset_gnss_0";
|
static constexpr char RESET_GNSS_0[] = "reset_gnss_0";
|
||||||
static constexpr char RESET_GNSS_1[] = "reset_gnss_1";
|
static constexpr char RESET_GNSS_1[] = "reset_gnss_1";
|
||||||
static constexpr char GYRO_0_ENABLE[] = "gyro_0_enable";
|
static constexpr char GNSS_0_ENABLE[] = "enable_gnss_0";
|
||||||
static constexpr char GYRO_2_ENABLE[] = "gyro_2_enable";
|
static constexpr char GNSS_1_ENABLE[] = "enable_gnss_1";
|
||||||
|
static constexpr char GYRO_0_ENABLE[] = "enable_gyro_0";
|
||||||
|
static constexpr char GYRO_2_ENABLE[] = "enable_gyro_2";
|
||||||
static constexpr char HEATER_0[] = "heater0";
|
static constexpr char HEATER_0[] = "heater0";
|
||||||
static constexpr char HEATER_1[] = "heater1";
|
static constexpr char HEATER_1[] = "heater1";
|
||||||
static constexpr char HEATER_2[] = "heater2";
|
static constexpr char HEATER_2[] = "heater2";
|
||||||
@ -54,7 +54,7 @@ namespace gpioNames {
|
|||||||
static constexpr char EN_RW_2[] = "enable_rw_2";
|
static constexpr char EN_RW_2[] = "enable_rw_2";
|
||||||
static constexpr char EN_RW_3[] = "enable_rw_3";
|
static constexpr char EN_RW_3[] = "enable_rw_3";
|
||||||
static constexpr char EN_RW_4[] = "enable_rw_4";
|
static constexpr char EN_RW_4[] = "enable_rw_4";
|
||||||
static constexpr char SPI_MUX_SELECT[] = "spi_mux_select";
|
static constexpr char GNSS_MUX_SELECT[] = "gnss_mux_select";
|
||||||
static constexpr char RAD_SENSOR_CHIP_SELECT[] = "rad_sensor_chip_select";
|
static constexpr char RAD_SENSOR_CHIP_SELECT[] = "rad_sensor_chip_select";
|
||||||
static constexpr char PAPB_BUSY_SIGNAL_VC0[] = "papb_busy_signal_vc0";
|
static constexpr char PAPB_BUSY_SIGNAL_VC0[] = "papb_busy_signal_vc0";
|
||||||
static constexpr char PAPB_EMPTY_SIGNAL_VC0[] = "papb_empty_signal_vc0";
|
static constexpr char PAPB_EMPTY_SIGNAL_VC0[] = "papb_empty_signal_vc0";
|
||||||
@ -70,7 +70,7 @@ namespace gpioNames {
|
|||||||
static constexpr char RS485_EN_RX_DATA[] = "rx_data_enable_ltc2872";
|
static constexpr char RS485_EN_RX_DATA[] = "rx_data_enable_ltc2872";
|
||||||
static constexpr char PDEC_RESET[] = "pdec_reset";
|
static constexpr char PDEC_RESET[] = "pdec_reset";
|
||||||
static constexpr char BIT_RATE_SEL[] = "bit_rate_sel";
|
static constexpr char BIT_RATE_SEL[] = "bit_rate_sel";
|
||||||
}
|
} // namespace gpioNames
|
||||||
}
|
} // namespace q7s
|
||||||
|
|
||||||
#endif /* BSP_Q7S_BOARDCONFIG_BUSCONF_H_ */
|
#endif /* BSP_Q7S_BOARDCONFIG_BUSCONF_H_ */
|
||||||
|
@ -7,7 +7,8 @@ extern "C" void __gcov_flush();
|
|||||||
#else
|
#else
|
||||||
void __gcov_flush() {
|
void __gcov_flush() {
|
||||||
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
||||||
"coverage information is desired.\n" << std::flush;
|
"coverage information is desired.\n"
|
||||||
|
<< std::flush;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -8,7 +8,3 @@ void printChar(const char* character, bool errStream) {
|
|||||||
}
|
}
|
||||||
putc(*character, stdout);
|
putc(*character, stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
#include "FileSystemTest.h"
|
#include "FileSystemTest.h"
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "fsfw/timemanager/Stopwatch.h"
|
#include "fsfw/timemanager/Stopwatch.h"
|
||||||
|
|
||||||
#include <iostream>
|
enum SdCard { SDC0, SDC1 };
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
enum SdCard {
|
|
||||||
SDC0,
|
|
||||||
SDC1
|
|
||||||
};
|
|
||||||
|
|
||||||
FileSystemTest::FileSystemTest() {
|
FileSystemTest::FileSystemTest() {
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -22,5 +20,4 @@ FileSystemTest::FileSystemTest() {
|
|||||||
// stopwatch.stop(true);
|
// stopwatch.stop(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystemTest::~FileSystemTest() {
|
FileSystemTest::~FileSystemTest() {}
|
||||||
}
|
|
||||||
|
@ -5,9 +5,8 @@ class FileSystemTest {
|
|||||||
public:
|
public:
|
||||||
FileSystemTest();
|
FileSystemTest();
|
||||||
virtual ~FileSystemTest();
|
virtual ~FileSystemTest();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* BSP_Q7S_BOARDTEST_FILESYSTEMTEST_H_ */
|
#endif /* BSP_Q7S_BOARDTEST_FILESYSTEMTEST_H_ */
|
||||||
|
@ -1,28 +1,37 @@
|
|||||||
|
#include "Q7STestTask.h"
|
||||||
|
|
||||||
#include <bsp_q7s/core/CoreController.h>
|
#include <bsp_q7s/core/CoreController.h>
|
||||||
#include <bsp_q7s/memory/FileSystemHandler.h>
|
#include <bsp_q7s/memory/FileSystemHandler.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include "Q7STestTask.h"
|
#include <gps.h>
|
||||||
|
#include <libgpsmm.h>
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <ctime>
|
||||||
|
#include <fstream>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <iostream>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
#include "bsp_q7s/memory/SdCardManager.h"
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
#include "bsp_q7s/memory/scratchApi.h"
|
#include "bsp_q7s/memory/scratchApi.h"
|
||||||
|
|
||||||
#include "fsfw/timemanager/Stopwatch.h"
|
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
#include "fsfw/timemanager/Stopwatch.h"
|
||||||
#include "test/DummyParameter.h"
|
#include "test/DummyParameter.h"
|
||||||
|
|
||||||
#include <nlohmann/json.hpp>
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
Q7STestTask::Q7STestTask(object_id_t objectId) : TestTask(objectId) {
|
Q7STestTask::Q7STestTask(object_id_t objectId) : TestTask(objectId) {
|
||||||
|
doTestSdCard = false;
|
||||||
|
doTestScratchApi = false;
|
||||||
|
doTestGps = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Q7STestTask::performOneShotAction() {
|
ReturnValue_t Q7STestTask::performOneShotAction() {
|
||||||
//testSdCard();
|
if (doTestSdCard) {
|
||||||
//testScratchApi();
|
testSdCard();
|
||||||
|
}
|
||||||
|
if (doTestScratchApi) {
|
||||||
|
testScratchApi();
|
||||||
|
}
|
||||||
// testJsonLibDirect();
|
// testJsonLibDirect();
|
||||||
// testDummyParams();
|
// testDummyParams();
|
||||||
// testProtHandler();
|
// testProtHandler();
|
||||||
@ -31,6 +40,13 @@ ReturnValue_t Q7STestTask::performOneShotAction() {
|
|||||||
return TestTask::performOneShotAction();
|
return TestTask::performOneShotAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t Q7STestTask::performPeriodicAction() {
|
||||||
|
if (doTestGps) {
|
||||||
|
testGpsDaemon();
|
||||||
|
}
|
||||||
|
return TestTask::performPeriodicAction();
|
||||||
|
}
|
||||||
|
|
||||||
void Q7STestTask::testSdCard() {
|
void Q7STestTask::testSdCard() {
|
||||||
using namespace std;
|
using namespace std;
|
||||||
Stopwatch stopwatch;
|
Stopwatch stopwatch;
|
||||||
@ -47,8 +63,7 @@ void Q7STestTask::testSdCard() {
|
|||||||
while (iss >> word) {
|
while (iss >> word) {
|
||||||
if (word == "on") {
|
if (word == "on") {
|
||||||
sif::info << "SD card " << static_cast<int>(idx) << " is on" << endl;
|
sif::info << "SD card " << static_cast<int>(idx) << " is on" << endl;
|
||||||
}
|
} else if (word == "off") {
|
||||||
else if(word == "off") {
|
|
||||||
sif::info << "SD card " << static_cast<int>(idx) << " is off" << endl;
|
sif::info << "SD card " << static_cast<int>(idx) << " is off" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,7 +133,6 @@ void Q7STestTask::testDummyParams() {
|
|||||||
|
|
||||||
ReturnValue_t result = param.readJsonFile();
|
ReturnValue_t result = param.readJsonFile();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
param.setValue(DummyParameter::DUMMY_KEY_PARAM_1, 3);
|
param.setValue(DummyParameter::DUMMY_KEY_PARAM_1, 3);
|
||||||
@ -127,8 +141,18 @@ void Q7STestTask::testDummyParams() {
|
|||||||
param.writeJsonFile();
|
param.writeJsonFile();
|
||||||
param.print();
|
param.print();
|
||||||
|
|
||||||
int test = param.getValue<int>(DummyParameter::DUMMY_KEY_PARAM_1);
|
int test = 0;
|
||||||
std::string test2 = param.getValue<std::string>(DummyParameter::DUMMY_KEY_PARAM_2);
|
result = param.getValue<int>(DummyParameter::DUMMY_KEY_PARAM_1, &test);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
|
||||||
|
<< " does not exist" << std::endl;
|
||||||
|
}
|
||||||
|
std::string test2;
|
||||||
|
result = param.getValue<std::string>(DummyParameter::DUMMY_KEY_PARAM_2, &test2);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
|
||||||
|
<< " does not exist" << std::endl;
|
||||||
|
}
|
||||||
sif::info << "Test value (3 expected): " << test << std::endl;
|
sif::info << "Test value (3 expected): " << test << std::endl;
|
||||||
sif::info << "Test value 2 (\"blirb\" expected): " << test2 << std::endl;
|
sif::info << "Test value 2 (\"blirb\" expected): " << test2 << std::endl;
|
||||||
}
|
}
|
||||||
@ -136,8 +160,8 @@ void Q7STestTask::testDummyParams() {
|
|||||||
ReturnValue_t Q7STestTask::initialize() {
|
ReturnValue_t Q7STestTask::initialize() {
|
||||||
coreController = ObjectManager::instance()->get<CoreController>(objects::CORE_CONTROLLER);
|
coreController = ObjectManager::instance()->get<CoreController>(objects::CORE_CONTROLLER);
|
||||||
if (coreController == nullptr) {
|
if (coreController == nullptr) {
|
||||||
sif::warning << "Q7STestTask::initialize: Could not retrieve CORE_CONTROLLER object" <<
|
sif::warning << "Q7STestTask::initialize: Could not retrieve CORE_CONTROLLER object"
|
||||||
std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
return TestTask::initialize();
|
return TestTask::initialize();
|
||||||
}
|
}
|
||||||
@ -147,16 +171,14 @@ void Q7STestTask::testProtHandler() {
|
|||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
// If any chips are unlocked, lock them here
|
// If any chips are unlocked, lock them here
|
||||||
result = coreController->setBootCopyProtection(
|
result = coreController->setBootCopyProtection(
|
||||||
CoreController::Chip::ALL_CHIP, CoreController::Copy::ALL_COPY, true,
|
CoreController::Chip::ALL_CHIP, CoreController::Copy::ALL_COPY, true, opPerformed, true);
|
||||||
opPerformed, true);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// unlock own copy
|
// unlock own copy
|
||||||
result = coreController->setBootCopyProtection(
|
result = coreController->setBootCopyProtection(
|
||||||
CoreController::Chip::SELF_CHIP, CoreController::Copy::SELF_COPY, false,
|
CoreController::Chip::SELF_CHIP, CoreController::Copy::SELF_COPY, false, opPerformed, true);
|
||||||
opPerformed, true);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
@ -170,8 +192,7 @@ void Q7STestTask::testProtHandler() {
|
|||||||
|
|
||||||
// lock own copy
|
// lock own copy
|
||||||
result = coreController->setBootCopyProtection(
|
result = coreController->setBootCopyProtection(
|
||||||
CoreController::Chip::SELF_CHIP, CoreController::Copy::SELF_COPY, true,
|
CoreController::Chip::SELF_CHIP, CoreController::Copy::SELF_COPY, true, opPerformed, true);
|
||||||
opPerformed, true);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
@ -185,8 +206,7 @@ void Q7STestTask::testProtHandler() {
|
|||||||
|
|
||||||
// unlock specific copy
|
// unlock specific copy
|
||||||
result = coreController->setBootCopyProtection(
|
result = coreController->setBootCopyProtection(
|
||||||
CoreController::Chip::CHIP_1, CoreController::Copy::COPY_1, false,
|
CoreController::Chip::CHIP_1, CoreController::Copy::COPY_1, false, opPerformed, true);
|
||||||
opPerformed, true);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
@ -200,8 +220,7 @@ void Q7STestTask::testProtHandler() {
|
|||||||
|
|
||||||
// lock specific copy
|
// lock specific copy
|
||||||
result = coreController->setBootCopyProtection(
|
result = coreController->setBootCopyProtection(
|
||||||
CoreController::Chip::CHIP_1, CoreController::Copy::COPY_1, true,
|
CoreController::Chip::CHIP_1, CoreController::Copy::COPY_1, true, opPerformed, true);
|
||||||
opPerformed, true);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
@ -214,9 +233,28 @@ void Q7STestTask::testProtHandler() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Q7STestTask::testGpsDaemon() {
|
||||||
|
gpsmm gpsmm(GPSD_SHARED_MEMORY, 0);
|
||||||
|
gps_data_t* gps;
|
||||||
|
gps = gpsmm.read();
|
||||||
|
if (gps == nullptr) {
|
||||||
|
sif::warning << "Q7STestTask: Reading GPS data failed" << std::endl;
|
||||||
|
}
|
||||||
|
sif::info << "-- Q7STestTask: GPS shared memory read test --" << std::endl;
|
||||||
|
time_t timeRaw = gps->fix.time.tv_sec;
|
||||||
|
std::tm* time = gmtime(&timeRaw);
|
||||||
|
sif::info << "Time: " << std::put_time(time, "%c %Z") << std::endl;
|
||||||
|
sif::info << "Visible satellites: " << gps->satellites_visible << std::endl;
|
||||||
|
sif::info << "Satellites used: " << gps->satellites_used << std::endl;
|
||||||
|
sif::info << "Fix (0:Not Seen|1:No Fix|2:2D|3:3D): " << gps->fix.mode << std::endl;
|
||||||
|
sif::info << "Latitude: " << gps->fix.latitude << std::endl;
|
||||||
|
sif::info << "Longitude: " << gps->fix.longitude << std::endl;
|
||||||
|
sif::info << "Altitude(MSL): " << gps->fix.altMSL << std::endl;
|
||||||
|
sif::info << "Speed(m/s): " << gps->fix.speed << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
||||||
auto fsHandler = ObjectManager::instance()->
|
auto fsHandler = ObjectManager::instance()->get<FileSystemHandler>(objects::FILE_SYSTEM_HANDLER);
|
||||||
get<FileSystemHandler>(objects::FILE_SYSTEM_HANDLER);
|
|
||||||
if (fsHandler == nullptr) {
|
if (fsHandler == nullptr) {
|
||||||
sif::warning << "Q7STestTask::testFileSystemHandlerDirect: No FS handler running.."
|
sif::warning << "Q7STestTask::testFileSystemHandlerDirect: No FS handler running.."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -245,7 +283,6 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
switch (opCode) {
|
switch (opCode) {
|
||||||
case (FsOpCodes::CREATE_EMPTY_FILE_IN_TMP): {
|
case (FsOpCodes::CREATE_EMPTY_FILE_IN_TMP): {
|
||||||
// No mount prefix, cause file is created in tmp
|
// No mount prefix, cause file is created in tmp
|
||||||
@ -267,8 +304,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
result = fsHandler->removeFile("/tmp", "test.txt", &cfg);
|
result = fsHandler->removeFile("/tmp", "test.txt", &cfg);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "File removed successfully" << std::endl;
|
sif::info << "File removed successfully" << std::endl;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::warning << "File removal failed!" << std::endl;
|
sif::warning << "File removal failed!" << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -281,8 +317,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
ReturnValue_t result = fsHandler->createDirectory("/tmp/", "test", false, &cfg);
|
ReturnValue_t result = fsHandler->createDirectory("/tmp/", "test", false, &cfg);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "Directory created successfully" << std::endl;
|
sif::info << "Directory created successfully" << std::endl;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::warning << "Directory creation failed!" << std::endl;
|
sif::warning << "Directory creation failed!" << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -292,16 +327,14 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
cfg.useMountPrefix = false;
|
cfg.useMountPrefix = false;
|
||||||
if (not std::filesystem::exists("/tmp/test")) {
|
if (not std::filesystem::exists("/tmp/test")) {
|
||||||
result = fsHandler->createDirectory("/tmp", "test", false, &cfg);
|
result = fsHandler->createDirectory("/tmp", "test", false, &cfg);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Delete any leftover files to regular dir removal works
|
// Delete any leftover files to regular dir removal works
|
||||||
std::remove("/tmp/test/*");
|
std::remove("/tmp/test/*");
|
||||||
}
|
}
|
||||||
result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "Directory removed successfully" << std::endl;
|
sif::info << "Directory removed successfully" << std::endl;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::warning << "Directory removal failed!" << std::endl;
|
sif::warning << "Directory removal failed!" << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -314,8 +347,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
result = fsHandler->removeDirectory("/tmp/", "test", true, &cfg);
|
result = fsHandler->removeDirectory("/tmp/", "test", true, &cfg);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "Directory removed recursively successfully" << std::endl;
|
sif::info << "Directory removed recursively successfully" << std::endl;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::warning << "Recursive directory removal failed!" << std::endl;
|
sif::warning << "Recursive directory removal failed!" << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -328,8 +360,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "Directory removal attempt failed as expected" << std::endl;
|
sif::info << "Directory removal attempt failed as expected" << std::endl;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::warning << "Directory removal worked when it should not have!" << std::endl;
|
sif::warning << "Directory removal worked when it should not have!" << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -359,8 +390,8 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
std::string content = "Hello World\n";
|
std::string content = "Hello World\n";
|
||||||
// Do not delete file, user can check existence in shell
|
// Do not delete file, user can check existence in shell
|
||||||
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
|
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
|
||||||
fsHandler->appendToFile("/tmp/", "test.txt", reinterpret_cast<const uint8_t*>(
|
fsHandler->appendToFile("/tmp/", "test.txt", reinterpret_cast<const uint8_t*>(content.data()),
|
||||||
content.data()), content.size(), 0, &cfg);
|
content.size(), 0, &cfg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,24 @@
|
|||||||
|
|
||||||
#include "test/testtasks/TestTask.h"
|
#include "test/testtasks/TestTask.h"
|
||||||
|
|
||||||
|
class CoreController;
|
||||||
|
|
||||||
class Q7STestTask : public TestTask {
|
class Q7STestTask : public TestTask {
|
||||||
public:
|
public:
|
||||||
Q7STestTask(object_id_t objectId);
|
Q7STestTask(object_id_t objectId);
|
||||||
|
|
||||||
ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool doTestSdCard = false;
|
||||||
|
bool doTestScratchApi = false;
|
||||||
|
bool doTestGps = false;
|
||||||
|
|
||||||
CoreController* coreController = nullptr;
|
CoreController* coreController = nullptr;
|
||||||
ReturnValue_t performOneShotAction() override;
|
ReturnValue_t performOneShotAction() override;
|
||||||
|
ReturnValue_t performPeriodicAction() override;
|
||||||
|
|
||||||
|
void testGpsDaemon();
|
||||||
|
|
||||||
void testSdCard();
|
void testSdCard();
|
||||||
void fileTests();
|
void fileTests();
|
||||||
@ -33,5 +43,4 @@ private:
|
|||||||
void testFileSystemHandlerDirect(FsOpCodes opCode);
|
void testFileSystemHandlerDirect(FsOpCodes opCode);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* BSP_Q7S_BOARDTEST_Q7STESTTASK_H_ */
|
#endif /* BSP_Q7S_BOARDTEST_Q7STESTTASK_H_ */
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "gnssCallback.h"
|
#include "gnssCallback.h"
|
||||||
#include "devices/gpioIds.h"
|
|
||||||
|
|
||||||
|
#include "devices/gpioIds.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
|
||||||
ReturnValue_t gps::triggerGpioResetPin(void* args) {
|
ReturnValue_t gps::triggerGpioResetPin(void* args) {
|
||||||
@ -15,8 +15,7 @@ ReturnValue_t gps::triggerGpioResetPin(void *args) {
|
|||||||
if (resetArgs->gnss1) {
|
if (resetArgs->gnss1) {
|
||||||
gpioId = gpioIds::GNSS_1_NRESET;
|
gpioId = gpioIds::GNSS_1_NRESET;
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
gpioId = gpioIds::GNSS_0_NRESET;
|
gpioId = gpioIds::GNSS_0_NRESET;
|
||||||
}
|
}
|
||||||
resetArgs->gpioComIF->pullLow(gpioId);
|
resetArgs->gpioComIF->pullLow(gpioId);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
|
#ifndef BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
|
||||||
#define BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
|
#define BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
|
||||||
|
|
||||||
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
||||||
|
|
||||||
struct ResetArgs {
|
struct ResetArgs {
|
||||||
bool gnss1 = false;
|
bool gnss1 = false;
|
||||||
|
@ -1,22 +1,20 @@
|
|||||||
#include "rwSpiCallback.h"
|
#include "rwSpiCallback.h"
|
||||||
#include "devices/gpioIds.h"
|
|
||||||
#include "mission/devices/RwHandler.h"
|
|
||||||
|
|
||||||
#include "fsfw_hal/linux/spi/SpiCookie.h"
|
#include "devices/gpioIds.h"
|
||||||
#include "fsfw_hal/linux/UnixFileGuard.h"
|
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
#include "fsfw_hal/linux/UnixFileGuard.h"
|
||||||
|
#include "fsfw_hal/linux/spi/SpiCookie.h"
|
||||||
|
#include "mission/devices/RwHandler.h"
|
||||||
|
|
||||||
namespace rwSpiCallback {
|
namespace rwSpiCallback {
|
||||||
|
|
||||||
ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sendData,
|
ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sendData,
|
||||||
size_t sendLen, void* args) {
|
size_t sendLen, void* args) {
|
||||||
|
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
|
||||||
RwHandler* handler = reinterpret_cast<RwHandler*>(args);
|
RwHandler* handler = reinterpret_cast<RwHandler*>(args);
|
||||||
if (handler == nullptr) {
|
if (handler == nullptr) {
|
||||||
sif::error << "rwSpiCallback::spiCallback: Pointer to handler is invalid"
|
sif::error << "rwSpiCallback::spiCallback: Pointer to handler is invalid" << std::endl;
|
||||||
<< std::endl;
|
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,11 +49,6 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Disconnect PS SPI peripheral and select AXI SPI core */
|
|
||||||
if(gpioIF->pullHigh(gpioIds::SPI_MUX) != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
sif::error << "rwSpiCallback::spiCallback: Failed to pull spi mux gpio high" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Sending frame start sign */
|
/** Sending frame start sign */
|
||||||
writeBuffer[0] = 0x7E;
|
writeBuffer[0] = 0x7E;
|
||||||
writeSize = 1;
|
writeSize = 1;
|
||||||
@ -158,7 +151,6 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
|
|||||||
|
|
||||||
size_t decodedFrameLen = 0;
|
size_t decodedFrameLen = 0;
|
||||||
while (decodedFrameLen < replyBufferSize) {
|
while (decodedFrameLen < replyBufferSize) {
|
||||||
|
|
||||||
/** First byte already read in */
|
/** First byte already read in */
|
||||||
if (decodedFrameLen != 0) {
|
if (decodedFrameLen != 0) {
|
||||||
byteRead = 0;
|
byteRead = 0;
|
||||||
@ -172,8 +164,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
|
|||||||
if (byteRead == FLAG_BYTE) {
|
if (byteRead == FLAG_BYTE) {
|
||||||
/** Reached end of frame */
|
/** Reached end of frame */
|
||||||
break;
|
break;
|
||||||
}
|
} else if (byteRead == 0x7D) {
|
||||||
else if (byteRead == 0x7D) {
|
|
||||||
if (read(fileDescriptor, &byteRead, 1) != 1) {
|
if (read(fileDescriptor, &byteRead, 1) != 1) {
|
||||||
sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl;
|
sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl;
|
||||||
result = RwHandler::SPI_READ_FAILURE;
|
result = RwHandler::SPI_READ_FAILURE;
|
||||||
@ -183,20 +174,17 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
|
|||||||
*(rxBuf + decodedFrameLen) = 0x7E;
|
*(rxBuf + decodedFrameLen) = 0x7E;
|
||||||
decodedFrameLen++;
|
decodedFrameLen++;
|
||||||
continue;
|
continue;
|
||||||
}
|
} else if (byteRead == 0x5D) {
|
||||||
else if (byteRead == 0x5D) {
|
|
||||||
*(rxBuf + decodedFrameLen) = 0x7D;
|
*(rxBuf + decodedFrameLen) = 0x7D;
|
||||||
decodedFrameLen++;
|
decodedFrameLen++;
|
||||||
continue;
|
continue;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::error << "rwSpiCallback::spiCallback: Invalid substitute" << std::endl;
|
sif::error << "rwSpiCallback::spiCallback: Invalid substitute" << std::endl;
|
||||||
closeSpi(gpioId, gpioIF, mutex);
|
closeSpi(gpioId, gpioIF, mutex);
|
||||||
result = RwHandler::INVALID_SUBSTITUTE;
|
result = RwHandler::INVALID_SUBSTITUTE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
*(rxBuf + decodedFrameLen) = byteRead;
|
*(rxBuf + decodedFrameLen) = byteRead;
|
||||||
decodedFrameLen++;
|
decodedFrameLen++;
|
||||||
continue;
|
continue;
|
||||||
@ -237,12 +225,8 @@ void closeSpi (gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mutex->unlockMutex() != HasReturnvaluesIF::RETURN_OK) {
|
if (mutex->unlockMutex() != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "rwSpiCallback::closeSpi: Failed to unlock mutex" << std::endl;;
|
sif::error << "rwSpiCallback::closeSpi: Failed to unlock mutex" << std::endl;
|
||||||
}
|
;
|
||||||
|
|
||||||
/** Route SPI interface again to PS SPI peripheral */
|
|
||||||
if(gpioIF->pullLow(gpioIds::SPI_MUX) != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
sif::error << "rwSpiCallback::spiCallback: Failed to pull spi mux gpio low" << std::endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} // namespace rwSpiCallback
|
||||||
|
@ -2,9 +2,8 @@
|
|||||||
#define BSP_Q7S_RW_SPI_CALLBACK_H_
|
#define BSP_Q7S_RW_SPI_CALLBACK_H_
|
||||||
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
#include "fsfw_hal/linux/spi/SpiComIF.h"
|
|
||||||
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
||||||
|
#include "fsfw_hal/linux/spi/SpiComIF.h"
|
||||||
|
|
||||||
namespace rwSpiCallback {
|
namespace rwSpiCallback {
|
||||||
|
|
||||||
@ -43,5 +42,5 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
|
|||||||
*/
|
*/
|
||||||
void closeSpi(gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex);
|
void closeSpi(gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex);
|
||||||
|
|
||||||
}
|
} // namespace rwSpiCallback
|
||||||
#endif /* BSP_Q7S_RW_SPI_CALLBACK_H_ */
|
#endif /* BSP_Q7S_RW_SPI_CALLBACK_H_ */
|
||||||
|
@ -1,36 +1,35 @@
|
|||||||
#include "CoreController.h"
|
#include "CoreController.h"
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
#include "OBSWVersion.h"
|
#include "OBSWVersion.h"
|
||||||
#include "watchdogConf.h"
|
|
||||||
|
|
||||||
#include "fsfw/FSFWVersion.h"
|
#include "fsfw/FSFWVersion.h"
|
||||||
#include "fsfw/timemanager/Stopwatch.h"
|
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
#include "fsfw/timemanager/Stopwatch.h"
|
||||||
|
#include "watchdogConf.h"
|
||||||
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
|
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
|
||||||
#include "fsfw/osal/common/UdpTmTcBridge.h"
|
#include "fsfw/osal/common/UdpTmTcBridge.h"
|
||||||
#else
|
#else
|
||||||
#include "fsfw/osal/common/TcpTmTcServer.h"
|
#include "fsfw/osal/common/TcpTmTcServer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "bsp_q7s/memory/scratchApi.h"
|
|
||||||
#include "bsp_q7s/memory/SdCardManager.h"
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
|
#include "bsp_q7s/memory/scratchApi.h"
|
||||||
|
|
||||||
CoreController::Chip CoreController::CURRENT_CHIP = Chip::NO_CHIP;
|
CoreController::Chip CoreController::CURRENT_CHIP = Chip::NO_CHIP;
|
||||||
CoreController::Copy CoreController::CURRENT_COPY = Copy::NO_COPY;
|
CoreController::Copy CoreController::CURRENT_COPY = Copy::NO_COPY;
|
||||||
|
|
||||||
CoreController::CoreController(object_id_t objectId):
|
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;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
try {
|
try {
|
||||||
result = initWatchdogFifo();
|
result = initWatchdogFifo();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "CoreController::CoreController: Watchdog FIFO init failed" <<
|
sif::warning << "CoreController::CoreController: Watchdog FIFO init failed" << std::endl;
|
||||||
std::endl;
|
|
||||||
}
|
}
|
||||||
sdcMan = SdCardManager::instance();
|
sdcMan = SdCardManager::instance();
|
||||||
if (sdcMan == nullptr) {
|
if (sdcMan == nullptr) {
|
||||||
@ -46,10 +45,8 @@ CoreController::CoreController(object_id_t objectId):
|
|||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "CoreController::CoreController: Boot copy init" << std::endl;
|
sif::warning << "CoreController::CoreController: Boot copy init" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
} catch (const std::filesystem::filesystem_error &e) {
|
||||||
catch(const std::filesystem::filesystem_error& e) {
|
sif::error << "CoreController::CoreController: Failed with exception " << e.what() << std::endl;
|
||||||
sif::error << "CoreController::CoreController: Failed with exception " <<
|
|
||||||
e.what() << std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,9 +64,7 @@ ReturnValue_t CoreController::initializeLocalDataPool(localpool::DataPool &local
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalPoolDataSetBase* CoreController::getDataSetHandle(sid_t sid) {
|
LocalPoolDataSetBase *CoreController::getDataSetHandle(sid_t sid) { return nullptr; }
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t CoreController::initialize() {
|
ReturnValue_t CoreController::initialize() {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
@ -77,7 +72,8 @@ ReturnValue_t CoreController::initialize() {
|
|||||||
result = scratch::writeNumber(scratch::ALLOC_FAILURE_COUNT, 0);
|
result = scratch::writeNumber(scratch::ALLOC_FAILURE_COUNT, 0);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "CoreController::initialize: Setting up alloc failure "
|
sif::warning << "CoreController::initialize: Setting up alloc failure "
|
||||||
"count failed" << std::endl;
|
"count failed"
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
sdStateMachine();
|
sdStateMachine();
|
||||||
@ -115,8 +111,7 @@ ReturnValue_t CoreController::initSdCardBlocking() {
|
|||||||
// Create update status file
|
// Create update status file
|
||||||
ReturnValue_t result = sdcMan->updateSdCardStateFile();
|
ReturnValue_t result = sdcMan->updateSdCardStateFile();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "CoreController::initialize: Updating SD card state file failed"
|
sif::warning << "CoreController::initialize: Updating SD card state file failed" << std::endl;
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
#if Q7S_SD_CARD_CONFIG == Q7S_SD_NONE
|
#if Q7S_SD_CARD_CONFIG == Q7S_SD_NONE
|
||||||
sif::info << "No SD card initialization will be performed" << std::endl;
|
sif::info << "No SD card initialization will be performed" << std::endl;
|
||||||
@ -131,8 +126,8 @@ ReturnValue_t CoreController::initSdCardBlocking() {
|
|||||||
#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT
|
#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT
|
||||||
determinePreferredSdCard();
|
determinePreferredSdCard();
|
||||||
updateSdInfoOther();
|
updateSdInfoOther();
|
||||||
sif::info << "Cold redundant SD card configuration, preferred SD card: " <<
|
sif::info << "Cold redundant SD card configuration, preferred SD card: "
|
||||||
static_cast<int>(sdInfo.pref) << std::endl;
|
<< static_cast<int>(sdInfo.pref) << std::endl;
|
||||||
result = sdColdRedundantBlockingInit();
|
result = sdColdRedundantBlockingInit();
|
||||||
// Update status file
|
// Update status file
|
||||||
sdcMan->updateSdCardStateFile();
|
sdcMan->updateSdCardStateFile();
|
||||||
@ -147,7 +142,6 @@ ReturnValue_t CoreController::initSdCardBlocking() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* Q7S_SD_CARD_CONFIG != Q7S_SD_NONE */
|
#endif /* Q7S_SD_CARD_CONFIG != Q7S_SD_NONE */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::sdStateMachine() {
|
ReturnValue_t CoreController::sdStateMachine() {
|
||||||
@ -165,8 +159,7 @@ ReturnValue_t CoreController::sdStateMachine() {
|
|||||||
sdInfo.state = SdStates::IDLE;
|
sdInfo.state = SdStates::IDLE;
|
||||||
sdInfo.initFinished = true;
|
sdInfo.initFinished = true;
|
||||||
return result;
|
return result;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Still update SD state file
|
// Still update SD state file
|
||||||
#if Q7S_SD_CARD_CONFIG == Q7S_SD_NONE
|
#if Q7S_SD_CARD_CONFIG == Q7S_SD_NONE
|
||||||
sdInfo.state = SdStates::UPDATE_INFO;
|
sdInfo.state = SdStates::UPDATE_INFO;
|
||||||
@ -180,18 +173,17 @@ ReturnValue_t CoreController::sdStateMachine() {
|
|||||||
|
|
||||||
// This lambda checks the non-blocking operation and assigns the new state on success.
|
// This lambda checks the non-blocking operation and assigns the new state on success.
|
||||||
// It returns true for an operation success and false otherwise
|
// It returns true for an operation success and false otherwise
|
||||||
auto nonBlockingOpChecking = [&](SdStates newStateOnSuccess,
|
auto nonBlockingOpChecking = [&](SdStates newStateOnSuccess, uint16_t maxCycleCount,
|
||||||
uint16_t maxCycleCount, std::string opPrintout) {
|
std::string opPrintout) {
|
||||||
SdCardManager::OpStatus status = sdcMan->checkCurrentOp(operation);
|
SdCardManager::OpStatus status = sdcMan->checkCurrentOp(operation);
|
||||||
if (status == SdCardManager::OpStatus::SUCCESS) {
|
if (status == SdCardManager::OpStatus::SUCCESS) {
|
||||||
sdInfo.state = newStateOnSuccess;
|
sdInfo.state = newStateOnSuccess;
|
||||||
sdInfo.commandExecuted = false;
|
sdInfo.commandExecuted = false;
|
||||||
sdInfo.cycleCount = 0;
|
sdInfo.cycleCount = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (sdInfo.cycleCount > 4) {
|
||||||
else if(sdInfo.cycleCount > 4) {
|
sif::warning << "CoreController::sdInitStateMachine: " << opPrintout << " takes too long"
|
||||||
sif::warning << "CoreController::sdInitStateMachine: " << opPrintout <<
|
<< std::endl;
|
||||||
" takes too long" << std::endl;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -206,8 +198,7 @@ ReturnValue_t CoreController::sdStateMachine() {
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
sdInfo.commandExecuted = true;
|
sdInfo.commandExecuted = true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
nonBlockingOpChecking(SdStates::SET_STATE_SELF, 4, "Updating SDC file");
|
nonBlockingOpChecking(SdStates::SET_STATE_SELF, 4, "Updating SDC file");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -225,32 +216,28 @@ ReturnValue_t CoreController::sdStateMachine() {
|
|||||||
sif::warning << "Getting SD card activity status failed" << std::endl;
|
sif::warning << "Getting SD card activity status failed" << std::endl;
|
||||||
}
|
}
|
||||||
#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT
|
#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT
|
||||||
sif::info << "Cold redundant SD card configuration, preferred SD card: " <<
|
sif::info << "Cold redundant SD card configuration, preferred SD card: "
|
||||||
static_cast<int>(sdInfo.pref) << std::endl;
|
<< static_cast<int>(sdInfo.pref) << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (sdInfo.prefState == sd::SdState::MOUNTED) {
|
if (sdInfo.prefState == sd::SdState::MOUNTED) {
|
||||||
#if OBSW_VERBOSE_LEVEL >= 1
|
#if OBSW_VERBOSE_LEVEL >= 1
|
||||||
std::string mountString;
|
std::string mountString;
|
||||||
if (sdInfo.pref == sd::SdCard::SLOT_0) {
|
if (sdInfo.pref == sd::SdCard::SLOT_0) {
|
||||||
mountString = SdCardManager::SD_0_MOUNT_POINT;
|
mountString = SdCardManager::SD_0_MOUNT_POINT;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mountString = SdCardManager::SD_1_MOUNT_POINT;
|
mountString = SdCardManager::SD_1_MOUNT_POINT;
|
||||||
}
|
}
|
||||||
sif::info << "SD card " << sdInfo.prefChar << " already on and mounted at " <<
|
sif::info << "SD card " << sdInfo.prefChar << " already on and mounted at " << mountString
|
||||||
mountString << std::endl;
|
<< std::endl;
|
||||||
#endif
|
#endif
|
||||||
sdInfo.state = SdStates::DETERMINE_OTHER;
|
sdInfo.state = SdStates::DETERMINE_OTHER;
|
||||||
}
|
} else if (sdInfo.prefState == sd::SdState::OFF) {
|
||||||
else if(sdInfo.prefState == sd::SdState::OFF) {
|
|
||||||
sdCardSetup(sdInfo.pref, sd::SdState::ON, sdInfo.prefChar, false);
|
sdCardSetup(sdInfo.pref, sd::SdState::ON, sdInfo.prefChar, false);
|
||||||
sdInfo.commandExecuted = true;
|
sdInfo.commandExecuted = true;
|
||||||
}
|
} else if (sdInfo.prefState == sd::SdState::ON) {
|
||||||
else if(sdInfo.prefState == sd::SdState::ON) {
|
|
||||||
sdInfo.state = SdStates::MOUNT_SELF;
|
sdInfo.state = SdStates::MOUNT_SELF;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (nonBlockingOpChecking(SdStates::MOUNT_SELF, 10, "Setting SDC state")) {
|
if (nonBlockingOpChecking(SdStates::MOUNT_SELF, 10, "Setting SDC state")) {
|
||||||
sdInfo.prefState = sd::SdState::ON;
|
sdInfo.prefState = sd::SdState::ON;
|
||||||
currentStateSetter(sdInfo.pref, sd::SdState::ON);
|
currentStateSetter(sdInfo.pref, sd::SdState::ON);
|
||||||
@ -262,8 +249,7 @@ ReturnValue_t CoreController::sdStateMachine() {
|
|||||||
if (not sdInfo.commandExecuted) {
|
if (not sdInfo.commandExecuted) {
|
||||||
result = sdCardSetup(sdInfo.pref, sd::SdState::MOUNTED, sdInfo.prefChar);
|
result = sdCardSetup(sdInfo.pref, sd::SdState::MOUNTED, sdInfo.prefChar);
|
||||||
sdInfo.commandExecuted = true;
|
sdInfo.commandExecuted = true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (nonBlockingOpChecking(SdStates::DETERMINE_OTHER, 5, "Mounting SD card")) {
|
if (nonBlockingOpChecking(SdStates::DETERMINE_OTHER, 5, "Mounting SD card")) {
|
||||||
sdInfo.prefState = sd::SdState::MOUNTED;
|
sdInfo.prefState = sd::SdState::MOUNTED;
|
||||||
currentStateSetter(sdInfo.pref, sd::SdState::MOUNTED);
|
currentStateSetter(sdInfo.pref, sd::SdState::MOUNTED);
|
||||||
@ -278,22 +264,18 @@ ReturnValue_t CoreController::sdStateMachine() {
|
|||||||
#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT
|
#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT
|
||||||
if (sdInfo.otherState == sd::SdState::ON) {
|
if (sdInfo.otherState == sd::SdState::ON) {
|
||||||
sdInfo.state = SdStates::SET_STATE_OTHER;
|
sdInfo.state = SdStates::SET_STATE_OTHER;
|
||||||
}
|
} else if (sdInfo.otherState == sd::SdState::MOUNTED) {
|
||||||
else if(sdInfo.otherState == sd::SdState::MOUNTED) {
|
|
||||||
sdInfo.state = SdStates::MOUNT_UNMOUNT_OTHER;
|
sdInfo.state = SdStates::MOUNT_UNMOUNT_OTHER;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Is already off, update info, but with a small delay
|
// Is already off, update info, but with a small delay
|
||||||
sdInfo.state = SdStates::SKIP_CYCLE_BEFORE_INFO_UPDATE;
|
sdInfo.state = SdStates::SKIP_CYCLE_BEFORE_INFO_UPDATE;
|
||||||
}
|
}
|
||||||
#elif Q7S_SD_CARD_CONFIG == Q7S_SD_HOT_REDUNDANT
|
#elif Q7S_SD_CARD_CONFIG == Q7S_SD_HOT_REDUNDANT
|
||||||
if (sdInfo.otherState == sd::SdState::OFF) {
|
if (sdInfo.otherState == sd::SdState::OFF) {
|
||||||
sdInfo.state = SdStates::SET_STATE_OTHER;
|
sdInfo.state = SdStates::SET_STATE_OTHER;
|
||||||
}
|
} else if (sdInfo.otherState == sd::SdState::ON) {
|
||||||
else if(sdInfo.otherState == sd::SdState::ON) {
|
|
||||||
sdInfo.state = SdStates::MOUNT_UNMOUNT_OTHER;
|
sdInfo.state = SdStates::MOUNT_UNMOUNT_OTHER;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Is already on and mounted, update info
|
// Is already on and mounted, update info
|
||||||
sdInfo.state = SdStates::SKIP_CYCLE_BEFORE_INFO_UPDATE;
|
sdInfo.state = SdStates::SKIP_CYCLE_BEFORE_INFO_UPDATE;
|
||||||
}
|
}
|
||||||
@ -306,8 +288,7 @@ ReturnValue_t CoreController::sdStateMachine() {
|
|||||||
if (not sdInfo.commandExecuted) {
|
if (not sdInfo.commandExecuted) {
|
||||||
result = sdCardSetup(sdInfo.other, sd::SdState::OFF, sdInfo.otherChar, false);
|
result = sdCardSetup(sdInfo.other, sd::SdState::OFF, sdInfo.otherChar, false);
|
||||||
sdInfo.commandExecuted = true;
|
sdInfo.commandExecuted = true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (nonBlockingOpChecking(SdStates::SKIP_CYCLE_BEFORE_INFO_UPDATE, 10,
|
if (nonBlockingOpChecking(SdStates::SKIP_CYCLE_BEFORE_INFO_UPDATE, 10,
|
||||||
"Switching off other SD card")) {
|
"Switching off other SD card")) {
|
||||||
sdInfo.otherState = sd::SdState::OFF;
|
sdInfo.otherState = sd::SdState::OFF;
|
||||||
@ -318,10 +299,8 @@ ReturnValue_t CoreController::sdStateMachine() {
|
|||||||
if (not sdInfo.commandExecuted) {
|
if (not sdInfo.commandExecuted) {
|
||||||
result = sdCardSetup(sdInfo.other, sd::SdState::ON, sdInfo.otherChar, false);
|
result = sdCardSetup(sdInfo.other, sd::SdState::ON, sdInfo.otherChar, false);
|
||||||
sdInfo.commandExecuted = true;
|
sdInfo.commandExecuted = true;
|
||||||
}
|
} else {
|
||||||
else {
|
if (nonBlockingOpChecking(SdStates::MOUNT_UNMOUNT_OTHER, 10, "Switching on other SD card")) {
|
||||||
if(nonBlockingOpChecking(SdStates::MOUNT_UNMOUNT_OTHER, 10,
|
|
||||||
"Switching on other SD card")) {
|
|
||||||
sdInfo.otherState = sd::SdState::ON;
|
sdInfo.otherState = sd::SdState::ON;
|
||||||
currentStateSetter(sdInfo.other, sd::SdState::ON);
|
currentStateSetter(sdInfo.other, sd::SdState::ON);
|
||||||
}
|
}
|
||||||
@ -335,8 +314,7 @@ ReturnValue_t CoreController::sdStateMachine() {
|
|||||||
if (not sdInfo.commandExecuted) {
|
if (not sdInfo.commandExecuted) {
|
||||||
result = sdCardSetup(sdInfo.other, sd::SdState::ON, sdInfo.otherChar);
|
result = sdCardSetup(sdInfo.other, sd::SdState::ON, sdInfo.otherChar);
|
||||||
sdInfo.commandExecuted = true;
|
sdInfo.commandExecuted = true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (nonBlockingOpChecking(SdStates::SET_STATE_OTHER, 10, "Unmounting other SD card")) {
|
if (nonBlockingOpChecking(SdStates::SET_STATE_OTHER, 10, "Unmounting other SD card")) {
|
||||||
sdInfo.otherState = sd::SdState::ON;
|
sdInfo.otherState = sd::SdState::ON;
|
||||||
currentStateSetter(sdInfo.other, sd::SdState::ON);
|
currentStateSetter(sdInfo.other, sd::SdState::ON);
|
||||||
@ -346,8 +324,7 @@ ReturnValue_t CoreController::sdStateMachine() {
|
|||||||
if (not sdInfo.commandExecuted) {
|
if (not sdInfo.commandExecuted) {
|
||||||
result = sdCardSetup(sdInfo.other, sd::SdState::MOUNTED, sdInfo.otherChar);
|
result = sdCardSetup(sdInfo.other, sd::SdState::MOUNTED, sdInfo.otherChar);
|
||||||
sdInfo.commandExecuted = true;
|
sdInfo.commandExecuted = true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (nonBlockingOpChecking(SdStates::UPDATE_INFO, 4, "Mounting other SD card")) {
|
if (nonBlockingOpChecking(SdStates::UPDATE_INFO, 4, "Mounting other SD card")) {
|
||||||
sdInfo.otherState = sd::SdState::MOUNTED;
|
sdInfo.otherState = sd::SdState::MOUNTED;
|
||||||
currentStateSetter(sdInfo.other, sd::SdState::MOUNTED);
|
currentStateSetter(sdInfo.other, sd::SdState::MOUNTED);
|
||||||
@ -358,8 +335,7 @@ ReturnValue_t CoreController::sdStateMachine() {
|
|||||||
|
|
||||||
if (sdInfo.state == SdStates::SKIP_CYCLE_BEFORE_INFO_UPDATE) {
|
if (sdInfo.state == SdStates::SKIP_CYCLE_BEFORE_INFO_UPDATE) {
|
||||||
sdInfo.state = SdStates::UPDATE_INFO;
|
sdInfo.state = SdStates::UPDATE_INFO;
|
||||||
}
|
} else if (sdInfo.state == SdStates::UPDATE_INFO) {
|
||||||
else if(sdInfo.state == SdStates::UPDATE_INFO) {
|
|
||||||
// It is assumed that all tasks are running by the point this section is reached.
|
// It is assumed that all tasks are running by the point this section is reached.
|
||||||
// Therefore, perform this operation in blocking mode because it does not take long
|
// Therefore, perform this operation in blocking mode because it does not take long
|
||||||
// and the ready state of the SD card is available sooner
|
// and the ready state of the SD card is available sooner
|
||||||
@ -367,8 +343,7 @@ ReturnValue_t CoreController::sdStateMachine() {
|
|||||||
// Update status file
|
// Update status file
|
||||||
result = sdcMan->updateSdCardStateFile();
|
result = sdcMan->updateSdCardStateFile();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "CoreController::initialize: Updating SD card state file failed"
|
sif::warning << "CoreController::initialize: Updating SD card state file failed" << std::endl;
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
sdInfo.commandExecuted = false;
|
sdInfo.commandExecuted = false;
|
||||||
sdInfo.state = SdStates::IDLE;
|
sdInfo.state = SdStates::IDLE;
|
||||||
@ -385,8 +360,7 @@ ReturnValue_t CoreController::sdStateMachine() {
|
|||||||
if (sdInfo.state == SdStates::SET_STATE_FROM_COMMAND) {
|
if (sdInfo.state == SdStates::SET_STATE_FROM_COMMAND) {
|
||||||
if (not sdInfo.commandExecuted) {
|
if (not sdInfo.commandExecuted) {
|
||||||
executeNextExternalSdCommand();
|
executeNextExternalSdCommand();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
checkExternalSdCommandStatus();
|
checkExternalSdCommandStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -401,44 +375,36 @@ void CoreController::executeNextExternalSdCommand() {
|
|||||||
if (sdInfo.commandedCard == sd::SdCard::SLOT_0) {
|
if (sdInfo.commandedCard == sd::SdCard::SLOT_0) {
|
||||||
sdChar = "0";
|
sdChar = "0";
|
||||||
currentStateOfCard = sdInfo.currentState.first;
|
currentStateOfCard = sdInfo.currentState.first;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sdChar = "1";
|
sdChar = "1";
|
||||||
currentStateOfCard = sdInfo.currentState.second;
|
currentStateOfCard = sdInfo.currentState.second;
|
||||||
}
|
}
|
||||||
if (currentStateOfCard == sd::SdState::OFF) {
|
if (currentStateOfCard == sd::SdState::OFF) {
|
||||||
if (sdInfo.commandedState == sd::SdState::ON) {
|
if (sdInfo.commandedState == sd::SdState::ON) {
|
||||||
sdInfo.currentlyCommandedState = sdInfo.commandedState;
|
sdInfo.currentlyCommandedState = sdInfo.commandedState;
|
||||||
}
|
} else if (sdInfo.commandedState == sd::SdState::MOUNTED) {
|
||||||
else if(sdInfo.commandedState == sd::SdState::MOUNTED) {
|
|
||||||
sdInfo.currentlyCommandedState = sd::SdState::ON;
|
sdInfo.currentlyCommandedState = sd::SdState::ON;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// SD card is already on target state
|
// SD card is already on target state
|
||||||
sdInfo.commandFinished = true;
|
sdInfo.commandFinished = true;
|
||||||
sdInfo.state = SdStates::IDLE;
|
sdInfo.state = SdStates::IDLE;
|
||||||
}
|
}
|
||||||
}
|
} else if (currentStateOfCard == sd::SdState::ON) {
|
||||||
else if(currentStateOfCard == sd::SdState::ON) {
|
|
||||||
if (sdInfo.commandedState == sd::SdState::OFF or
|
if (sdInfo.commandedState == sd::SdState::OFF or
|
||||||
sdInfo.commandedState == sd::SdState::MOUNTED) {
|
sdInfo.commandedState == sd::SdState::MOUNTED) {
|
||||||
sdInfo.currentlyCommandedState = sdInfo.commandedState;
|
sdInfo.currentlyCommandedState = sdInfo.commandedState;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Already on target state
|
// Already on target state
|
||||||
sdInfo.commandFinished = true;
|
sdInfo.commandFinished = true;
|
||||||
sdInfo.state = SdStates::IDLE;
|
sdInfo.state = SdStates::IDLE;
|
||||||
}
|
}
|
||||||
}
|
} else if (currentStateOfCard == sd::SdState::MOUNTED) {
|
||||||
else if(currentStateOfCard == sd::SdState::MOUNTED) {
|
|
||||||
if (sdInfo.commandedState == sd::SdState::ON) {
|
if (sdInfo.commandedState == sd::SdState::ON) {
|
||||||
sdInfo.currentlyCommandedState = sdInfo.commandedState;
|
sdInfo.currentlyCommandedState = sdInfo.commandedState;
|
||||||
}
|
} else if (sdInfo.commandedState == sd::SdState::OFF) {
|
||||||
else if(sdInfo.commandedState == sd::SdState::OFF) {
|
|
||||||
// This causes an unmount in sdCardSetup
|
// This causes an unmount in sdCardSetup
|
||||||
sdInfo.currentlyCommandedState = sd::SdState::ON;
|
sdInfo.currentlyCommandedState = sd::SdState::ON;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sdInfo.commandFinished = true;
|
sdInfo.commandFinished = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -453,25 +419,23 @@ void CoreController::checkExternalSdCommandStatus() {
|
|||||||
if (sdInfo.currentlyCommandedState == sdInfo.commandedState) {
|
if (sdInfo.currentlyCommandedState == sdInfo.commandedState) {
|
||||||
sdInfo.state = SdStates::SKIP_CYCLE_BEFORE_INFO_UPDATE;
|
sdInfo.state = SdStates::SKIP_CYCLE_BEFORE_INFO_UPDATE;
|
||||||
sdInfo.commandFinished = true;
|
sdInfo.commandFinished = true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// stay on same state machine state because the target state was not reached yet.
|
// stay on same state machine state because the target state was not reached yet.
|
||||||
sdInfo.cycleCount = 0;
|
sdInfo.cycleCount = 0;
|
||||||
}
|
}
|
||||||
currentStateSetter(sdInfo.commandedCard, sdInfo.currentlyCommandedState);
|
currentStateSetter(sdInfo.commandedCard, sdInfo.currentlyCommandedState);
|
||||||
sdInfo.commandExecuted = false;
|
sdInfo.commandExecuted = false;
|
||||||
}
|
} else if (sdInfo.cycleCount > 4) {
|
||||||
else if(sdInfo.cycleCount > 4) {
|
|
||||||
sif::warning << "CoreController::sdStateMachine: Commanding SD state "
|
sif::warning << "CoreController::sdStateMachine: Commanding SD state "
|
||||||
"takes too long" << std::endl;
|
"takes too long"
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreController::currentStateSetter(sd::SdCard sdCard, sd::SdState newState) {
|
void CoreController::currentStateSetter(sd::SdCard sdCard, sd::SdState newState) {
|
||||||
if (sdCard == sd::SdCard::SLOT_0) {
|
if (sdCard == sd::SdCard::SLOT_0) {
|
||||||
sdInfo.currentState.first = newState;
|
sdInfo.currentState.first = newState;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sdInfo.currentState.second = newState;
|
sdInfo.currentState.second = newState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -482,46 +446,41 @@ ReturnValue_t CoreController::sdCardSetup(sd::SdCard sdCard, sd::SdState targetS
|
|||||||
sdcMan->setPrintCommandOutput(printOutput);
|
sdcMan->setPrintCommandOutput(printOutput);
|
||||||
if (sdCard == sd::SdCard::SLOT_0) {
|
if (sdCard == sd::SdCard::SLOT_0) {
|
||||||
mountString = SdCardManager::SD_0_MOUNT_POINT;
|
mountString = SdCardManager::SD_0_MOUNT_POINT;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mountString = SdCardManager::SD_1_MOUNT_POINT;
|
mountString = SdCardManager::SD_1_MOUNT_POINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
sd::SdState state = sd::SdState::OFF;
|
sd::SdState state = sd::SdState::OFF;
|
||||||
if (sdCard == sd::SdCard::SLOT_0) {
|
if (sdCard == sd::SdCard::SLOT_0) {
|
||||||
state = sdInfo.currentState.first;
|
state = sdInfo.currentState.first;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
state = sdInfo.currentState.second;
|
state = sdInfo.currentState.second;
|
||||||
}
|
}
|
||||||
if (state == sd::SdState::MOUNTED) {
|
if (state == sd::SdState::MOUNTED) {
|
||||||
if (targetState == sd::SdState::OFF) {
|
if (targetState == sd::SdState::OFF) {
|
||||||
sif::info << "Switching off SD card " << sdChar << std::endl;
|
sif::info << "Switching off SD card " << sdChar << std::endl;
|
||||||
return sdcMan->switchOffSdCard(sdCard, true, &sdInfo.currentState);
|
return sdcMan->switchOffSdCard(sdCard, true, &sdInfo.currentState);
|
||||||
}
|
} else if (targetState == sd::SdState::ON) {
|
||||||
else if(targetState == sd::SdState::ON) {
|
|
||||||
sif::info << "Unmounting SD card " << sdChar << std::endl;
|
sif::info << "Unmounting SD card " << sdChar << std::endl;
|
||||||
return sdcMan->unmountSdCard(sdCard);
|
return sdcMan->unmountSdCard(sdCard);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (std::filesystem::exists(mountString)) {
|
if (std::filesystem::exists(mountString)) {
|
||||||
sif::info << "SD card " << sdChar << " already on and mounted at " <<
|
sif::info << "SD card " << sdChar << " already on and mounted at " << mountString
|
||||||
mountString << std::endl;
|
<< std::endl;
|
||||||
return SdCardManager::ALREADY_MOUNTED;
|
return SdCardManager::ALREADY_MOUNTED;
|
||||||
}
|
}
|
||||||
sif::error << "SD card mounted but expected mount point " <<
|
sif::error << "SD card mounted but expected mount point " << mountString << " not found!"
|
||||||
mountString << " not found!" << std::endl;
|
<< std::endl;
|
||||||
return SdCardManager::MOUNT_ERROR;
|
return SdCardManager::MOUNT_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == sd::SdState::OFF) {
|
if (state == sd::SdState::OFF) {
|
||||||
if (targetState == sd::SdState::MOUNTED) {
|
if (targetState == sd::SdState::MOUNTED) {
|
||||||
sif::info << "Switching on and mounting SD card " << sdChar << " at " <<
|
sif::info << "Switching on and mounting SD card " << sdChar << " at " << mountString
|
||||||
mountString << std::endl;
|
<< std::endl;
|
||||||
return sdcMan->switchOnSdCard(sdCard, true, &sdInfo.currentState);
|
return sdcMan->switchOnSdCard(sdCard, true, &sdInfo.currentState);
|
||||||
}
|
} else if (targetState == sd::SdState::ON) {
|
||||||
else if(targetState == sd::SdState::ON) {
|
|
||||||
sif::info << "Switching on SD card " << sdChar << std::endl;
|
sif::info << "Switching on SD card " << sdChar << std::endl;
|
||||||
return sdcMan->switchOnSdCard(sdCard, false, &sdInfo.currentState);
|
return sdcMan->switchOnSdCard(sdCard, false, &sdInfo.currentState);
|
||||||
}
|
}
|
||||||
@ -531,19 +490,16 @@ ReturnValue_t CoreController::sdCardSetup(sd::SdCard sdCard, sd::SdState targetS
|
|||||||
if (targetState == sd::SdState::MOUNTED) {
|
if (targetState == sd::SdState::MOUNTED) {
|
||||||
sif::info << "Mounting SD card " << sdChar << " at " << mountString << std::endl;
|
sif::info << "Mounting SD card " << sdChar << " at " << mountString << std::endl;
|
||||||
return sdcMan->mountSdCard(sdCard);
|
return sdcMan->mountSdCard(sdCard);
|
||||||
}
|
} else if (targetState == sd::SdState::OFF) {
|
||||||
else if(targetState == sd::SdState::OFF) {
|
|
||||||
sif::info << "Switching off SD card " << sdChar << std::endl;
|
sif::info << "Switching off SD card " << sdChar << std::endl;
|
||||||
return sdcMan->switchOffSdCard(sdCard, false, &sdInfo.currentState);
|
return sdcMan->switchOffSdCard(sdCard, false, &sdInfo.currentState);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::warning << "CoreController::sdCardSetup: Invalid state for this call" << std::endl;
|
sif::warning << "CoreController::sdCardSetup: Invalid state for this call" << std::endl;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
const uint8_t *data, size_t size) {
|
const uint8_t *data, size_t size) {
|
||||||
switch (actionId) {
|
switch (actionId) {
|
||||||
@ -564,8 +520,8 @@ ReturnValue_t CoreController::sdColdRedundantBlockingInit() {
|
|||||||
|
|
||||||
result = sdCardSetup(sdInfo.pref, sd::SdState::MOUNTED, sdInfo.prefChar);
|
result = sdCardSetup(sdInfo.pref, sd::SdState::MOUNTED, sdInfo.prefChar);
|
||||||
if (result != SdCardManager::ALREADY_MOUNTED and result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != SdCardManager::ALREADY_MOUNTED and result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Setting up preferred card " << sdInfo.otherChar <<
|
sif::warning << "Setting up preferred card " << sdInfo.otherChar
|
||||||
" in cold redundant mode failed" << std::endl;
|
<< " in cold redundant mode failed" << std::endl;
|
||||||
// Try other SD card and mark set up operation as failed
|
// Try other SD card and mark set up operation as failed
|
||||||
sdCardSetup(sdInfo.pref, sd::SdState::MOUNTED, sdInfo.prefChar);
|
sdCardSetup(sdInfo.pref, sd::SdState::MOUNTED, sdInfo.prefChar);
|
||||||
result = HasReturnvaluesIF::RETURN_FAILED;
|
result = HasReturnvaluesIF::RETURN_FAILED;
|
||||||
@ -575,11 +531,11 @@ ReturnValue_t CoreController::sdColdRedundantBlockingInit() {
|
|||||||
sif::info << "Switching off secondary SD card " << sdInfo.otherChar << std::endl;
|
sif::info << "Switching off secondary SD card " << sdInfo.otherChar << std::endl;
|
||||||
// Switch off other SD card in cold redundant mode if setting up preferred one worked
|
// Switch off other SD card in cold redundant mode if setting up preferred one worked
|
||||||
// without issues
|
// without issues
|
||||||
ReturnValue_t result2 = sdcMan->switchOffSdCard(sdInfo.other,
|
ReturnValue_t result2 =
|
||||||
sdInfo.otherState, &sdInfo.currentState);
|
sdcMan->switchOffSdCard(sdInfo.other, sdInfo.otherState, &sdInfo.currentState);
|
||||||
if (result2 != HasReturnvaluesIF::RETURN_OK and result2 != SdCardManager::ALREADY_OFF) {
|
if (result2 != HasReturnvaluesIF::RETURN_OK and result2 != SdCardManager::ALREADY_OFF) {
|
||||||
sif::warning << "Switching off secondary SD card " << sdInfo.otherChar <<
|
sif::warning << "Switching off secondary SD card " << sdInfo.otherChar
|
||||||
" in cold redundant mode failed" << std::endl;
|
<< " in cold redundant mode failed" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -596,7 +552,6 @@ ReturnValue_t CoreController::incrementAllocationFailureCount() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::initVersionFile() {
|
ReturnValue_t CoreController::initVersionFile() {
|
||||||
|
|
||||||
std::string unameFileName = "/tmp/uname_version.txt";
|
std::string unameFileName = "/tmp/uname_version.txt";
|
||||||
// TODO: No -v flag for now. If the kernel version is used, need to cut off first few letters
|
// TODO: No -v flag for now. If the kernel version is used, need to cut off first few letters
|
||||||
std::string unameCmd = "uname -mnrso > " + unameFileName;
|
std::string unameCmd = "uname -mnrso > " + unameFileName;
|
||||||
@ -607,14 +562,15 @@ ReturnValue_t CoreController::initVersionFile() {
|
|||||||
std::ifstream unameFile(unameFileName);
|
std::ifstream unameFile(unameFileName);
|
||||||
std::string unameLine;
|
std::string unameLine;
|
||||||
if (not std::getline(unameFile, unameLine)) {
|
if (not std::getline(unameFile, unameLine)) {
|
||||||
sif::warning << "CoreController::versionFileInit: Retrieving uname line failed"
|
sif::warning << "CoreController::versionFileInit: Retrieving uname line failed" << std::endl;
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string fullObswVersionString = "OBSW: v" + std::to_string(SW_VERSION) + "." +
|
std::string fullObswVersionString = "OBSW: v" + std::to_string(SW_VERSION) + "." +
|
||||||
std::to_string(SW_SUBVERSION) + "." + std::to_string(SW_REVISION);
|
std::to_string(SW_SUBVERSION) + "." +
|
||||||
|
std::to_string(SW_REVISION);
|
||||||
std::string fullFsfwVersionString = "FSFW: v" + std::to_string(FSFW_VERSION) + "." +
|
std::string fullFsfwVersionString = "FSFW: v" + std::to_string(FSFW_VERSION) + "." +
|
||||||
std::to_string(FSFW_SUBVERSION) + "." + std::to_string(FSFW_REVISION);
|
std::to_string(FSFW_SUBVERSION) + "." +
|
||||||
|
std::to_string(FSFW_REVISION);
|
||||||
std::string systemString = "System: " + unameLine;
|
std::string systemString = "System: " + unameLine;
|
||||||
std::string mountPrefix = SdCardManager::instance()->getCurrentMountPrefix();
|
std::string mountPrefix = SdCardManager::instance()->getCurrentMountPrefix();
|
||||||
std::string versionFilePath = mountPrefix + VERSION_FILE;
|
std::string versionFilePath = mountPrefix + VERSION_FILE;
|
||||||
@ -638,28 +594,25 @@ ReturnValue_t CoreController::initVersionFile() {
|
|||||||
if (idx == 0) {
|
if (idx == 0) {
|
||||||
if (currentVersionString != fullObswVersionString) {
|
if (currentVersionString != fullObswVersionString) {
|
||||||
sif::info << "OBSW version changed" << std::endl;
|
sif::info << "OBSW version changed" << std::endl;
|
||||||
sif::info << "From " << currentVersionString << " to " <<
|
sif::info << "From " << currentVersionString << " to " << fullObswVersionString
|
||||||
fullObswVersionString << std::endl;
|
<< std::endl;
|
||||||
createNewFile = true;
|
createNewFile = true;
|
||||||
}
|
}
|
||||||
}
|
} else if (idx == 1) {
|
||||||
else if(idx == 1) {
|
|
||||||
if (currentVersionString != fullFsfwVersionString) {
|
if (currentVersionString != fullFsfwVersionString) {
|
||||||
sif::info << "FSFW version changed" << std::endl;
|
sif::info << "FSFW version changed" << std::endl;
|
||||||
sif::info << "From " << currentVersionString << " to " <<
|
sif::info << "From " << currentVersionString << " to " << fullFsfwVersionString
|
||||||
fullFsfwVersionString << std::endl;
|
<< std::endl;
|
||||||
createNewFile = true;
|
createNewFile = true;
|
||||||
}
|
}
|
||||||
}
|
} else if (idx == 2) {
|
||||||
else if(idx == 2) {
|
|
||||||
if (currentVersionString != systemString) {
|
if (currentVersionString != systemString) {
|
||||||
sif::info << "System version changed" << std::endl;
|
sif::info << "System version changed" << std::endl;
|
||||||
sif::info << "Old: " << currentVersionString << std::endl;
|
sif::info << "Old: " << currentVersionString << std::endl;
|
||||||
sif::info << "New: " << systemString << std::endl;
|
sif::info << "New: " << systemString << std::endl;
|
||||||
createNewFile = true;
|
createNewFile = true;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::warning << "Invalid version file! Rewriting it.." << std::endl;
|
sif::warning << "Invalid version file! Rewriting it.." << std::endl;
|
||||||
createNewFile = true;
|
createNewFile = true;
|
||||||
}
|
}
|
||||||
@ -680,7 +633,8 @@ ReturnValue_t CoreController::initVersionFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::actionListDirectoryIntoFile(ActionId_t actionId,
|
ReturnValue_t CoreController::actionListDirectoryIntoFile(ActionId_t actionId,
|
||||||
MessageQueueId_t commandedBy, const uint8_t *data, size_t size) {
|
MessageQueueId_t commandedBy,
|
||||||
|
const uint8_t *data, size_t size) {
|
||||||
// TODO: Packet definition for clean deserialization
|
// TODO: Packet definition for clean deserialization
|
||||||
// 2 bytes for a and R flag, at least 5 bytes for minimum valid path /tmp with
|
// 2 bytes for a and R flag, at least 5 bytes for minimum valid path /tmp with
|
||||||
// null termination, at least 7 bytes for minimum target file name /tmp/a with
|
// null termination, at least 7 bytes for minimum target file name /tmp/a with
|
||||||
@ -764,8 +718,8 @@ void CoreController::getCurrentBootCopy(Chip &chip, Copy ©) {
|
|||||||
ReturnValue_t CoreController::initWatchdogFifo() {
|
ReturnValue_t CoreController::initWatchdogFifo() {
|
||||||
if (not std::filesystem::exists(watchdog::FIFO_NAME)) {
|
if (not std::filesystem::exists(watchdog::FIFO_NAME)) {
|
||||||
// Still return RETURN_OK for now
|
// Still return RETURN_OK for now
|
||||||
sif::info << "Watchdog FIFO " << watchdog::FIFO_NAME << " does not exist, can't initiate" <<
|
sif::info << "Watchdog FIFO " << watchdog::FIFO_NAME << " does not exist, can't initiate"
|
||||||
" watchdog" << std::endl;
|
<< " watchdog" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
// Open FIFO write only and non-blocking to prevent SW from killing itself.
|
// Open FIFO write only and non-blocking to prevent SW from killing itself.
|
||||||
@ -774,10 +728,9 @@ ReturnValue_t CoreController::initWatchdogFifo() {
|
|||||||
if (errno == ENXIO) {
|
if (errno == ENXIO) {
|
||||||
watchdogFifoFd = RETRY_FIFO_OPEN;
|
watchdogFifoFd = RETRY_FIFO_OPEN;
|
||||||
sif::info << "eive-watchdog not running. FIFO can not be opened" << std::endl;
|
sif::info << "eive-watchdog not running. FIFO can not be opened" << std::endl;
|
||||||
}
|
} else {
|
||||||
else {
|
sif::error << "Opening pipe " << watchdog::FIFO_NAME << " write-only failed with " << errno
|
||||||
sif::error << "Opening pipe " << watchdog::FIFO_NAME << " write-only failed with " <<
|
<< ": " << strerror(errno) << std::endl;
|
||||||
errno << ": " << strerror(errno) << std::endl;
|
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -806,8 +759,8 @@ ReturnValue_t CoreController::actionPerformReboot(const uint8_t *data, size_t si
|
|||||||
SdCardManager::instance()->switchOffSdCard(sd::SdCard::SLOT_0);
|
SdCardManager::instance()->switchOffSdCard(sd::SdCard::SLOT_0);
|
||||||
SdCardManager::instance()->switchOffSdCard(sd::SdCard::SLOT_1);
|
SdCardManager::instance()->switchOffSdCard(sd::SdCard::SLOT_1);
|
||||||
// If any boot copies are unprotected
|
// If any boot copies are unprotected
|
||||||
ReturnValue_t retval = setBootCopyProtection(Chip::SELF_CHIP, Copy::SELF_COPY,
|
ReturnValue_t retval =
|
||||||
true, protOpPerformed, false);
|
setBootCopyProtection(Chip::SELF_CHIP, Copy::SELF_COPY, true, protOpPerformed, false);
|
||||||
if (retval == HasReturnvaluesIF::RETURN_OK and protOpPerformed) {
|
if (retval == HasReturnvaluesIF::RETURN_OK and protOpPerformed) {
|
||||||
sif::info << "Running slot was writeprotected before reboot" << std::endl;
|
sif::info << "Running slot was writeprotected before reboot" << std::endl;
|
||||||
}
|
}
|
||||||
@ -822,22 +775,22 @@ ReturnValue_t CoreController::actionPerformReboot(const uint8_t *data, size_t si
|
|||||||
return HasActionsIF::INVALID_PARAMETERS;
|
return HasActionsIF::INVALID_PARAMETERS;
|
||||||
}
|
}
|
||||||
#if OBSW_VERBOSE_LEVEL >= 1
|
#if OBSW_VERBOSE_LEVEL >= 1
|
||||||
sif::info << "CoreController::actionPerformReboot: Rebooting on " <<
|
sif::info << "CoreController::actionPerformReboot: Rebooting on " << static_cast<int>(data[1])
|
||||||
static_cast<int>(data[1]) << " " << static_cast<int>(data[2]) << std::endl;
|
<< " " << static_cast<int>(data[2]) << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Check that the target chip and copy is writeprotected first
|
// Check that the target chip and copy is writeprotected first
|
||||||
generateChipStateFile();
|
generateChipStateFile();
|
||||||
// If any boot copies are unprotected, protect them here
|
// If any boot copies are unprotected, protect them here
|
||||||
ReturnValue_t retval = setBootCopyProtection(static_cast<Chip>(data[1]),
|
ReturnValue_t retval = setBootCopyProtection(
|
||||||
static_cast<Copy>(data[2]), true, protOpPerformed, false);
|
static_cast<Chip>(data[1]), static_cast<Copy>(data[2]), true, protOpPerformed, false);
|
||||||
if (retval == HasReturnvaluesIF::RETURN_OK and protOpPerformed) {
|
if (retval == HasReturnvaluesIF::RETURN_OK and protOpPerformed) {
|
||||||
sif::info << "Target slot was writeprotected before reboot" << std::endl;
|
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
|
// 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::string cmdString =
|
||||||
std::to_string(data[2]);
|
"xsc_boot_copy " + std::to_string(data[1]) + " " + std::to_string(data[2]);
|
||||||
int result = std::system(cmdString.c_str());
|
int result = std::system(cmdString.c_str());
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
utility::handleSystemError(result, "CoreController::executeAction");
|
utility::handleSystemError(result, "CoreController::executeAction");
|
||||||
@ -846,8 +799,7 @@ ReturnValue_t CoreController::actionPerformReboot(const uint8_t *data, size_t si
|
|||||||
return HasActionsIF::EXECUTION_FINISHED;
|
return HasActionsIF::EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreController::~CoreController() {
|
CoreController::~CoreController() {}
|
||||||
}
|
|
||||||
|
|
||||||
void CoreController::determinePreferredSdCard() {
|
void CoreController::determinePreferredSdCard() {
|
||||||
if (sdInfo.pref == sd::SdCard::NONE) {
|
if (sdInfo.pref == sd::SdCard::NONE) {
|
||||||
@ -855,13 +807,14 @@ void CoreController::determinePreferredSdCard() {
|
|||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
if (result == scratch::KEY_NOT_FOUND) {
|
if (result == scratch::KEY_NOT_FOUND) {
|
||||||
sif::warning << "CoreController::sdCardInit: "
|
sif::warning << "CoreController::sdCardInit: "
|
||||||
"Preferred SD card not set. Setting to 0" << std::endl;
|
"Preferred SD card not set. Setting to 0"
|
||||||
|
<< std::endl;
|
||||||
sdcMan->setPreferredSdCard(sd::SdCard::SLOT_0);
|
sdcMan->setPreferredSdCard(sd::SdCard::SLOT_0);
|
||||||
sdInfo.pref = sd::SdCard::SLOT_0;
|
sdInfo.pref = sd::SdCard::SLOT_0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::warning << "CoreController::sdCardInit: Could not get preferred SD card"
|
sif::warning << "CoreController::sdCardInit: Could not get preferred SD card"
|
||||||
"information from the scratch buffer" << std::endl;
|
"information from the scratch buffer"
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -875,22 +828,18 @@ void CoreController::updateSdInfoOther() {
|
|||||||
sdInfo.prefState = sdInfo.currentState.first;
|
sdInfo.prefState = sdInfo.currentState.first;
|
||||||
sdInfo.other = sd::SdCard::SLOT_1;
|
sdInfo.other = sd::SdCard::SLOT_1;
|
||||||
|
|
||||||
}
|
} else if (sdInfo.pref == sd::SdCard::SLOT_1) {
|
||||||
else if(sdInfo.pref == sd::SdCard::SLOT_1) {
|
|
||||||
sdInfo.prefChar = "1";
|
sdInfo.prefChar = "1";
|
||||||
sdInfo.otherChar = "0";
|
sdInfo.otherChar = "0";
|
||||||
sdInfo.otherState = sdInfo.currentState.first;
|
sdInfo.otherState = sdInfo.currentState.first;
|
||||||
sdInfo.prefState = sdInfo.currentState.second;
|
sdInfo.prefState = sdInfo.currentState.second;
|
||||||
sdInfo.other = sd::SdCard::SLOT_0;
|
sdInfo.other = sd::SdCard::SLOT_0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::warning << "CoreController::updateSdInfoOther: Invalid SD card passed" << std::endl;
|
sif::warning << "CoreController::updateSdInfoOther: Invalid SD card passed" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CoreController::sdInitFinished() const {
|
bool CoreController::sdInitFinished() const { return sdInfo.initFinished; }
|
||||||
return sdInfo.initFinished;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t CoreController::generateChipStateFile() {
|
ReturnValue_t CoreController::generateChipStateFile() {
|
||||||
int result = std::system(CHIP_PROT_SCRIPT);
|
int result = std::system(CHIP_PROT_SCRIPT);
|
||||||
@ -901,8 +850,9 @@ ReturnValue_t CoreController::generateChipStateFile() {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::setBootCopyProtection(Chip targetChip, Copy targetCopy,
|
ReturnValue_t CoreController::setBootCopyProtection(Chip targetChip, Copy targetCopy, bool protect,
|
||||||
bool protect, bool& protOperationPerformed, bool updateProtFile) {
|
bool &protOperationPerformed,
|
||||||
|
bool updateProtFile) {
|
||||||
bool allChips = false;
|
bool allChips = false;
|
||||||
bool allCopies = false;
|
bool allCopies = false;
|
||||||
bool selfChip = false;
|
bool selfChip = false;
|
||||||
@ -945,8 +895,8 @@ ReturnValue_t CoreController::setBootCopyProtection(Chip targetChip, Copy target
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t arrIdx = 0; arrIdx < protArray.size(); arrIdx++) {
|
for (uint8_t arrIdx = 0; arrIdx < protArray.size(); arrIdx++) {
|
||||||
int result = handleBootCopyProtAtIndex(targetChip, targetCopy, protect,
|
int result = handleBootCopyProtAtIndex(targetChip, targetCopy, protect, protOperationPerformed,
|
||||||
protOperationPerformed, selfChip, selfCopy, allChips, allCopies, arrIdx);
|
selfChip, selfCopy, allChips, allCopies, arrIdx);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -958,8 +908,9 @@ ReturnValue_t CoreController::setBootCopyProtection(Chip targetChip, Copy target
|
|||||||
}
|
}
|
||||||
|
|
||||||
int CoreController::handleBootCopyProtAtIndex(Chip targetChip, Copy targetCopy, bool protect,
|
int CoreController::handleBootCopyProtAtIndex(Chip targetChip, Copy targetCopy, bool protect,
|
||||||
bool &protOperationPerformed, bool selfChip, bool selfCopy, bool allChips,
|
bool &protOperationPerformed, bool selfChip,
|
||||||
bool allCopies, uint8_t arrIdx) {
|
bool selfCopy, bool allChips, bool allCopies,
|
||||||
|
uint8_t arrIdx) {
|
||||||
bool currentProt = protArray[arrIdx];
|
bool currentProt = protArray[arrIdx];
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
bool performOp = false;
|
bool performOp = false;
|
||||||
@ -978,64 +929,52 @@ int CoreController::handleBootCopyProtAtIndex(Chip targetChip, Copy targetCopy,
|
|||||||
if (arrIdx == 0 or arrIdx == 1) {
|
if (arrIdx == 0 or arrIdx == 1) {
|
||||||
oss << "0 ";
|
oss << "0 ";
|
||||||
currentChip = Chip::CHIP_0;
|
currentChip = Chip::CHIP_0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
oss << "1 ";
|
oss << "1 ";
|
||||||
currentChip = Chip::CHIP_1;
|
currentChip = Chip::CHIP_1;
|
||||||
}
|
}
|
||||||
if (arrIdx == 0 or arrIdx == 2) {
|
if (arrIdx == 0 or arrIdx == 2) {
|
||||||
oss << "0 ";
|
oss << "0 ";
|
||||||
currentCopy = Copy::COPY_0;
|
currentCopy = Copy::COPY_0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
oss << "1 ";
|
oss << "1 ";
|
||||||
currentCopy = Copy::COPY_1;
|
currentCopy = Copy::COPY_1;
|
||||||
}
|
}
|
||||||
if (protect) {
|
if (protect) {
|
||||||
oss << "1";
|
oss << "1";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
oss << "0";
|
oss << "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if (allChips and allCopies) {
|
if (allChips and allCopies) {
|
||||||
performOp = true;
|
performOp = true;
|
||||||
}
|
} else if (allChips) {
|
||||||
else if(allChips) {
|
if ((selfCopy and CURRENT_COPY == targetCopy) or (currentCopy == targetCopy)) {
|
||||||
if((selfCopy and CURRENT_COPY == targetCopy) or
|
|
||||||
(currentCopy == targetCopy)) {
|
|
||||||
performOp = true;
|
performOp = true;
|
||||||
}
|
}
|
||||||
}
|
} else if (allCopies) {
|
||||||
else if(allCopies) {
|
if ((selfChip and CURRENT_COPY == targetCopy) or (currentChip == targetChip)) {
|
||||||
if((selfChip and CURRENT_COPY == targetCopy) or
|
|
||||||
(currentChip == targetChip)) {
|
|
||||||
performOp = true;
|
performOp = true;
|
||||||
}
|
}
|
||||||
}
|
} else if (selfChip and (currentChip == targetChip)) {
|
||||||
else if(selfChip and (currentChip == targetChip)) {
|
|
||||||
if (selfCopy) {
|
if (selfCopy) {
|
||||||
if (currentCopy == targetCopy) {
|
if (currentCopy == targetCopy) {
|
||||||
performOp = true;
|
performOp = true;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
performOp = true;
|
performOp = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else if (selfCopy and (currentCopy == targetCopy)) {
|
||||||
else if(selfCopy and (currentCopy == targetCopy)) {
|
|
||||||
if (selfChip) {
|
if (selfChip) {
|
||||||
if (currentChip == targetChip) {
|
if (currentChip == targetChip) {
|
||||||
performOp = true;
|
performOp = true;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
performOp = true;
|
performOp = true;
|
||||||
}
|
}
|
||||||
}
|
} else if ((targetChip == currentChip) and (targetCopy == currentCopy)) {
|
||||||
else if((targetChip == currentChip) and (targetCopy == currentCopy)) {
|
|
||||||
performOp = true;
|
performOp = true;
|
||||||
}
|
}
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
@ -1057,8 +996,8 @@ ReturnValue_t CoreController::updateProtInfo(bool regenerateChipStateFile) {
|
|||||||
if (regenerateChipStateFile) {
|
if (regenerateChipStateFile) {
|
||||||
result = generateChipStateFile();
|
result = generateChipStateFile();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "CoreController::updateProtInfo: Generating chip state file failed" <<
|
sif::warning << "CoreController::updateProtInfo: Generating chip state file failed"
|
||||||
std::endl;
|
<< std::endl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1075,14 +1014,14 @@ ReturnValue_t CoreController::updateProtInfo(bool regenerateChipStateFile) {
|
|||||||
while (getline(chipStateFile, nextLine)) {
|
while (getline(chipStateFile, nextLine)) {
|
||||||
ReturnValue_t result = handleProtInfoUpdateLine(nextLine);
|
ReturnValue_t result = handleProtInfoUpdateLine(nextLine);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "CoreController::updateProtInfo: Protection info update failed!" <<
|
sif::warning << "CoreController::updateProtInfo: Protection info update failed!" << std::endl;
|
||||||
std::endl;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
++lineCounter;
|
++lineCounter;
|
||||||
if (lineCounter > 4) {
|
if (lineCounter > 4) {
|
||||||
sif::warning << "CoreController::checkAndProtectBootCopy: "
|
sif::warning << "CoreController::checkAndProtectBootCopy: "
|
||||||
"Line counter larger than 4" << std::endl;
|
"Line counter larger than 4"
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
@ -1108,8 +1047,7 @@ ReturnValue_t CoreController::handleProtInfoUpdateLine(std::string nextLine) {
|
|||||||
if (currentChip == Chip::CHIP_0) {
|
if (currentChip == Chip::CHIP_0) {
|
||||||
if (currentCopy == Copy::COPY_0) {
|
if (currentCopy == Copy::COPY_0) {
|
||||||
arrayIdx = 0;
|
arrayIdx = 0;
|
||||||
}
|
} else if (currentCopy == Copy::COPY_1) {
|
||||||
else if(currentCopy == Copy::COPY_1) {
|
|
||||||
arrayIdx = 1;
|
arrayIdx = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1117,8 +1055,7 @@ ReturnValue_t CoreController::handleProtInfoUpdateLine(std::string nextLine) {
|
|||||||
else if (currentChip == Chip::CHIP_1) {
|
else if (currentChip == Chip::CHIP_1) {
|
||||||
if (currentCopy == Copy::COPY_0) {
|
if (currentCopy == Copy::COPY_0) {
|
||||||
arrayIdx = 2;
|
arrayIdx = 2;
|
||||||
}
|
} else if (currentCopy == Copy::COPY_1) {
|
||||||
else if(currentCopy == Copy::COPY_1) {
|
|
||||||
arrayIdx = 3;
|
arrayIdx = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1126,8 +1063,7 @@ ReturnValue_t CoreController::handleProtInfoUpdateLine(std::string nextLine) {
|
|||||||
if (wordIdx == 5) {
|
if (wordIdx == 5) {
|
||||||
if (word == "unlocked.") {
|
if (word == "unlocked.") {
|
||||||
protArray[arrayIdx] = false;
|
protArray[arrayIdx] = false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
protArray[arrayIdx] = true;
|
protArray[arrayIdx] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1147,25 +1083,21 @@ void CoreController::performWatchdogControlOperation() {
|
|||||||
watchdogFifoFd = RETRY_FIFO_OPEN;
|
watchdogFifoFd = RETRY_FIFO_OPEN;
|
||||||
// No printout for now, would be spam
|
// No printout for now, would be spam
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
else {
|
sif::error << "Opening pipe " << watchdog::FIFO_NAME << " write-only failed with "
|
||||||
sif::error << "Opening pipe " << watchdog::FIFO_NAME <<
|
<< errno << ": " << strerror(errno) << std::endl;
|
||||||
" write-only failed with " << errno << ": " <<
|
|
||||||
strerror(errno) << std::endl;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sif::info << "Opened " << watchdog::FIFO_NAME << " successfully" << std::endl;
|
sif::info << "Opened " << watchdog::FIFO_NAME << " successfully" << std::endl;
|
||||||
}
|
} else if (watchdogFifoFd > 0) {
|
||||||
else if(watchdogFifoFd > 0) {
|
|
||||||
// Write to OBSW watchdog FIFO here
|
// Write to OBSW watchdog FIFO here
|
||||||
const char writeChar = 'a';
|
const char writeChar = 'a';
|
||||||
ssize_t writtenBytes = write(watchdogFifoFd, &writeChar, 1);
|
ssize_t writtenBytes = write(watchdogFifoFd, &writeChar, 1);
|
||||||
if (writtenBytes < 0) {
|
if (writtenBytes < 0) {
|
||||||
sif::error << "Errors writing to watchdog FIFO, code " << errno << ": " <<
|
sif::error << "Errors writing to watchdog FIFO, code " << errno << ": " << strerror(errno)
|
||||||
strerror(errno) << std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,32 +2,19 @@
|
|||||||
#define BSP_Q7S_CORE_CORECONTROLLER_H_
|
#define BSP_Q7S_CORE_CORECONTROLLER_H_
|
||||||
|
|
||||||
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
||||||
#include "fsfw/controller/ExtendedControllerBase.h"
|
|
||||||
#include "bsp_q7s/memory/SdCardManager.h"
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
|
|
||||||
#include "events/subsystemIdRanges.h"
|
#include "events/subsystemIdRanges.h"
|
||||||
|
#include "fsfw/controller/ExtendedControllerBase.h"
|
||||||
|
|
||||||
class Timer;
|
class Timer;
|
||||||
class SdCardManager;
|
class SdCardManager;
|
||||||
|
|
||||||
class CoreController : public ExtendedControllerBase {
|
class CoreController : public ExtendedControllerBase {
|
||||||
public:
|
public:
|
||||||
enum Chip: uint8_t {
|
enum Chip : uint8_t { CHIP_0, CHIP_1, NO_CHIP, SELF_CHIP, ALL_CHIP };
|
||||||
CHIP_0,
|
|
||||||
CHIP_1,
|
|
||||||
NO_CHIP,
|
|
||||||
SELF_CHIP,
|
|
||||||
ALL_CHIP
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Copy: uint8_t {
|
enum Copy : uint8_t { COPY_0, COPY_1, NO_COPY, SELF_COPY, ALL_COPY };
|
||||||
COPY_0,
|
|
||||||
COPY_1,
|
|
||||||
NO_COPY,
|
|
||||||
SELF_COPY,
|
|
||||||
ALL_COPY
|
|
||||||
};
|
|
||||||
|
|
||||||
static constexpr char CHIP_PROT_SCRIPT[] = "/home/root/scripts/get-chip-prot-status.sh";
|
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 CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt";
|
||||||
@ -38,12 +25,10 @@ public:
|
|||||||
static constexpr ActionId_t REBOOT_OBC = 32;
|
static constexpr ActionId_t REBOOT_OBC = 32;
|
||||||
static constexpr ActionId_t MOUNT_OTHER_COPY = 33;
|
static constexpr ActionId_t MOUNT_OTHER_COPY = 33;
|
||||||
|
|
||||||
|
|
||||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CORE;
|
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CORE;
|
||||||
|
|
||||||
static constexpr Event ALLOC_FAILURE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
static constexpr Event ALLOC_FAILURE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
||||||
|
|
||||||
|
|
||||||
CoreController(object_id_t objectId);
|
CoreController(object_id_t objectId);
|
||||||
virtual ~CoreController();
|
virtual ~CoreController();
|
||||||
|
|
||||||
@ -51,8 +36,8 @@ public:
|
|||||||
|
|
||||||
ReturnValue_t initializeAfterTaskCreation() override;
|
ReturnValue_t initializeAfterTaskCreation() override;
|
||||||
|
|
||||||
ReturnValue_t executeAction(ActionId_t actionId,
|
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
MessageQueueId_t commandedBy, const uint8_t *data, size_t size) override;
|
const uint8_t* data, size_t size) override;
|
||||||
|
|
||||||
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
||||||
void performControlOperation() override;
|
void performControlOperation() override;
|
||||||
@ -78,8 +63,8 @@ public:
|
|||||||
* @param updateProtFile Specify whether the protection info file is updated
|
* @param updateProtFile Specify whether the protection info file is updated
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ReturnValue_t setBootCopyProtection(Chip targetChip, Copy targetCopy,
|
ReturnValue_t setBootCopyProtection(Chip targetChip, Copy targetCopy, bool protect,
|
||||||
bool protect, bool& protOperationPerformed, bool updateProtFile = true);
|
bool& protOperationPerformed, bool updateProtFile = true);
|
||||||
|
|
||||||
bool sdInitFinished() const;
|
bool sdInitFinished() const;
|
||||||
|
|
||||||
@ -150,8 +135,7 @@ private:
|
|||||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) override;
|
LocalDataPoolManager& poolManager) override;
|
||||||
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||||
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, uint32_t* msToReachTheMode);
|
||||||
uint32_t *msToReachTheMode);
|
|
||||||
|
|
||||||
ReturnValue_t initVersionFile();
|
ReturnValue_t initVersionFile();
|
||||||
ReturnValue_t initBootCopy();
|
ReturnValue_t initBootCopy();
|
||||||
@ -177,8 +161,8 @@ private:
|
|||||||
|
|
||||||
ReturnValue_t handleProtInfoUpdateLine(std::string nextLine);
|
ReturnValue_t handleProtInfoUpdateLine(std::string nextLine);
|
||||||
int handleBootCopyProtAtIndex(Chip targetChip, Copy targetCopy, bool protect,
|
int handleBootCopyProtAtIndex(Chip targetChip, Copy targetCopy, bool protect,
|
||||||
bool &protOperationPerformed, bool selfChip, bool selfCopy, bool allChips,
|
bool& protOperationPerformed, bool selfChip, bool selfCopy,
|
||||||
bool allCopies, uint8_t arrIdx);
|
bool allChips, bool allCopies, uint8_t arrIdx);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* BSP_Q7S_CORE_CORECONTROLLER_H_ */
|
#endif /* BSP_Q7S_CORE_CORECONTROLLER_H_ */
|
||||||
|
@ -1,22 +1,21 @@
|
|||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
#include "ObjectFactory.h"
|
|
||||||
#include "OBSWConfig.h"
|
|
||||||
#include "pollingsequence/pollingSequenceFactory.h"
|
|
||||||
|
|
||||||
#include "mission/utility/InitMission.h"
|
|
||||||
|
|
||||||
#include "fsfw/platform.h"
|
|
||||||
#include "fsfw/objectmanager/ObjectManagerIF.h"
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
|
||||||
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
|
||||||
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
|
||||||
#include "fsfw/tasks/PeriodicTaskIF.h"
|
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "ObjectFactory.h"
|
||||||
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
|
#include "fsfw/objectmanager/ObjectManagerIF.h"
|
||||||
|
#include "fsfw/platform.h"
|
||||||
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
||||||
|
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
||||||
|
#include "fsfw/tasks/PeriodicTaskIF.h"
|
||||||
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
#include "mission/utility/InitMission.h"
|
||||||
|
#include "pollingsequence/pollingSequenceFactory.h"
|
||||||
|
|
||||||
/* This is configured for linux without CR */
|
/* This is configured for linux without CR */
|
||||||
#ifdef PLATFORM_UNIX
|
#ifdef PLATFORM_UNIX
|
||||||
ServiceInterfaceStream sif::debug("DEBUG");
|
ServiceInterfaceStream sif::debug("DEBUG");
|
||||||
@ -33,7 +32,6 @@ ServiceInterfaceStream sif::error("ERROR", true, false, true);
|
|||||||
ObjectManagerIF* objectManager = nullptr;
|
ObjectManagerIF* objectManager = nullptr;
|
||||||
|
|
||||||
void initmission::initMission() {
|
void initmission::initMission() {
|
||||||
|
|
||||||
sif::info << "Building global objects.." << std::endl;
|
sif::info << "Building global objects.." << std::endl;
|
||||||
/* Instantiate global object manager and also create all objects */
|
/* Instantiate global object manager and also create all objects */
|
||||||
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
||||||
@ -117,6 +115,13 @@ void initmission::initTasks() {
|
|||||||
}
|
}
|
||||||
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
||||||
|
|
||||||
|
PeriodicTaskIF* acsCtrl = factory->createPeriodicTask(
|
||||||
|
"ACS_CTRL", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
||||||
|
result = acsCtrl->addComponent(objects::GPS_CONTROLLER);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("ACS_CTRL", objects::GPS_CONTROLLER);
|
||||||
|
}
|
||||||
|
|
||||||
#if BOARD_TE0720 == 0
|
#if BOARD_TE0720 == 0
|
||||||
// FS task, task interval does not matter because it runs in permanent loop, priority low
|
// FS task, task interval does not matter because it runs in permanent loop, priority low
|
||||||
// because it is a non-essential background task
|
// because it is a non-essential background task
|
||||||
@ -126,6 +131,16 @@ void initmission::initTasks() {
|
|||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER);
|
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if OBSW_ADD_STAR_TRACKER == 1
|
||||||
|
PeriodicTaskIF* strImgLoaderTask = factory->createPeriodicTask(
|
||||||
|
"FILE_SYSTEM_TASK", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
|
result = strImgLoaderTask->addComponent(objects::STR_HELPER);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::STR_HELPER);
|
||||||
|
}
|
||||||
|
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
||||||
|
|
||||||
#endif /* BOARD_TE0720 */
|
#endif /* BOARD_TE0720 */
|
||||||
|
|
||||||
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
||||||
@ -151,8 +166,7 @@ void initmission::initTasks() {
|
|||||||
for (const auto& task : taskVector) {
|
for (const auto& task : taskVector) {
|
||||||
if (task != nullptr) {
|
if (task != nullptr) {
|
||||||
task->startTask();
|
task->startTask();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,47 +201,51 @@ void initmission::initTasks() {
|
|||||||
|
|
||||||
#if BOARD_TE0720 == 0
|
#if BOARD_TE0720 == 0
|
||||||
fsTask->startTask();
|
fsTask->startTask();
|
||||||
|
#if OBSW_ADD_STAR_TRACKER == 1
|
||||||
|
strImgLoaderTask->startTask();
|
||||||
|
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
acsCtrl->startTask();
|
||||||
|
|
||||||
sif::info << "Tasks started.." << std::endl;
|
sif::info << "Tasks started.." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initmission::createPstTasks(TaskFactory& factory,
|
void initmission::createPstTasks(TaskFactory& factory,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*> &taskVec) {
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
#if BOARD_TE0720 == 0
|
#if BOARD_TE0720 == 0
|
||||||
/* Polling Sequence Table Default */
|
/* Polling Sequence Table Default */
|
||||||
#if OBSW_ADD_SPI_TEST_CODE == 0
|
#if OBSW_ADD_SPI_TEST_CODE == 0
|
||||||
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
||||||
"PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0,
|
"PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
|
||||||
missedDeadlineFunc);
|
|
||||||
result = pst::pstSpi(spiPst);
|
result = pst::pstSpi(spiPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
if (result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
if (result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
taskVec.push_back(spiPst);
|
taskVec.push_back(spiPst);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FixedTimeslotTaskIF* uartPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* uartPst = factory.createFixedTimeslotTask(
|
||||||
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
|
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
||||||
result = pst::pstUart(uartPst);
|
result = pst::pstUart(uartPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
}
|
}
|
||||||
taskVec.push_back(uartPst);
|
taskVec.push_back(uartPst);
|
||||||
FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask(
|
||||||
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
|
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
||||||
result = pst::pstGpio(gpioPst);
|
result = pst::pstGpio(gpioPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
}
|
}
|
||||||
taskVec.push_back(gpioPst);
|
taskVec.push_back(gpioPst);
|
||||||
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
|
||||||
"I2C_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
|
"I2C_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
||||||
result = pst::pstI2c(i2cPst);
|
result = pst::pstI2c(i2cPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
@ -242,8 +260,7 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
taskVec.push_back(gomSpacePstTask);
|
taskVec.push_back(gomSpacePstTask);
|
||||||
#else /* BOARD_TE7020 == 0 */
|
#else /* BOARD_TE7020 == 0 */
|
||||||
FixedTimeslotTaskIF* pollingSequenceTaskTE0720 = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* pollingSequenceTaskTE0720 = factory.createFixedTimeslotTask(
|
||||||
"PST_TASK_TE0720", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 3.0,
|
"PST_TASK_TE0720", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 3.0, missedDeadlineFunc);
|
||||||
missedDeadlineFunc);
|
|
||||||
result = pst::pollingSequenceTE0720(pollingSequenceTaskTE0720);
|
result = pst::pollingSequenceTE0720(pollingSequenceTaskTE0720);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating TE0720 PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating TE0720 PST failed!" << std::endl;
|
||||||
@ -253,7 +270,8 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initmission::createPusTasks(TaskFactory& factory,
|
void initmission::createPusTasks(TaskFactory& factory,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*> &taskVec) {
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
/* PUS Services */
|
/* PUS Services */
|
||||||
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
||||||
@ -321,9 +339,11 @@ void initmission::createPusTasks(TaskFactory &factory,
|
|||||||
taskVec.push_back(pusLowPrio);
|
taskVec.push_back(pusLowPrio);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
void initmission::createTestTasks(TaskFactory& factory,
|
||||||
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
std::vector<PeriodicTaskIF*>& taskVec) {
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
#if OBSW_ADD_TEST_TASK == 1 || OBSW_ADD_SPI_TEST_CODE == 1 || (BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1)
|
#if OBSW_ADD_TEST_TASK == 1 || OBSW_ADD_SPI_TEST_CODE == 1 || \
|
||||||
|
(BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1)
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
#endif
|
#endif
|
||||||
PeriodicTaskIF* testTask = factory.createPeriodicTask(
|
PeriodicTaskIF* testTask = factory.createPeriodicTask(
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#ifndef BSP_Q7S_INITMISSION_H_
|
#ifndef BSP_Q7S_INITMISSION_H_
|
||||||
#define BSP_Q7S_INITMISSION_H_
|
#define BSP_Q7S_INITMISSION_H_
|
||||||
|
|
||||||
#include "fsfw/tasks/Typedef.h"
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "fsfw/tasks/Typedef.h"
|
||||||
|
|
||||||
class PeriodicTaskIF;
|
class PeriodicTaskIF;
|
||||||
class TaskFactory;
|
class TaskFactory;
|
||||||
|
|
||||||
@ -17,6 +18,6 @@ void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadl
|
|||||||
std::vector<PeriodicTaskIF*>& taskVec);
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
void createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
void createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
std::vector<PeriodicTaskIF*>& taskVec);
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
};
|
}; // namespace initmission
|
||||||
|
|
||||||
#endif /* BSP_Q7S_INITMISSION_H_ */
|
#endif /* BSP_Q7S_INITMISSION_H_ */
|
||||||
|
@ -1,85 +1,82 @@
|
|||||||
#include <sstream>
|
|
||||||
#include "ObjectFactory.h"
|
#include "ObjectFactory.h"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
#include "devConf.h"
|
|
||||||
#include "ccsdsConfig.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 "bsp_q7s/gpio/gpioCallbacks.h"
|
|
||||||
#include "bsp_q7s/core/CoreController.h"
|
|
||||||
#include "bsp_q7s/boardtest/Q7STestTask.h"
|
#include "bsp_q7s/boardtest/Q7STestTask.h"
|
||||||
#include "bsp_q7s/memory/FileSystemHandler.h"
|
#include "bsp_q7s/callbacks/gnssCallback.h"
|
||||||
|
#include "bsp_q7s/callbacks/rwSpiCallback.h"
|
||||||
|
#include "bsp_q7s/core/CoreController.h"
|
||||||
|
#include "bsp_q7s/devices/PlocMemoryDumper.h"
|
||||||
#include "bsp_q7s/devices/PlocSupervisorHandler.h"
|
#include "bsp_q7s/devices/PlocSupervisorHandler.h"
|
||||||
#include "bsp_q7s/devices/PlocUpdater.h"
|
#include "bsp_q7s/devices/PlocUpdater.h"
|
||||||
#include "bsp_q7s/devices/PlocMemoryDumper.h"
|
#include "bsp_q7s/devices/startracker/StarTrackerDefinitions.h"
|
||||||
#include "bsp_q7s/callbacks/rwSpiCallback.h"
|
#include "bsp_q7s/devices/startracker/StarTrackerHandler.h"
|
||||||
#include "bsp_q7s/callbacks/gnssCallback.h"
|
#include "bsp_q7s/devices/startracker/StrHelper.h"
|
||||||
|
#include "bsp_q7s/gpio/gpioCallbacks.h"
|
||||||
#include "linux/devices/StarTrackerHandler.h"
|
#include "bsp_q7s/memory/FileSystemHandler.h"
|
||||||
#include "linux/devices/SolarArrayDeploymentHandler.h"
|
#include "busConf.h"
|
||||||
#include "linux/devices/devicedefinitions/SusDefinitions.h"
|
#include "ccsdsConfig.h"
|
||||||
#include "linux/devices/SusHandler.h"
|
#include "devConf.h"
|
||||||
#include "linux/csp/CspCookie.h"
|
#include "devices/addresses.h"
|
||||||
|
#include "devices/gpioIds.h"
|
||||||
|
#include "devices/powerSwitcherList.h"
|
||||||
|
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
||||||
|
#include "fsfw/tmtcpacket/pus/tm.h"
|
||||||
|
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
||||||
|
#include "fsfw/tmtcservices/PusServiceBase.h"
|
||||||
|
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
||||||
|
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
|
||||||
|
#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h"
|
||||||
|
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
|
||||||
|
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
||||||
|
#include "fsfw_hal/linux/i2c/I2cComIF.h"
|
||||||
|
#include "fsfw_hal/linux/i2c/I2cCookie.h"
|
||||||
|
#include "fsfw_hal/linux/spi/SpiComIF.h"
|
||||||
|
#include "fsfw_hal/linux/spi/SpiCookie.h"
|
||||||
|
#include "fsfw_hal/linux/uart/UartComIF.h"
|
||||||
|
#include "fsfw_hal/linux/uart/UartCookie.h"
|
||||||
|
#include "linux/boardtest/SpiTestClass.h"
|
||||||
#include "linux/csp/CspComIF.h"
|
#include "linux/csp/CspComIF.h"
|
||||||
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
#include "linux/csp/CspCookie.h"
|
||||||
|
#include "linux/devices/SolarArrayDeploymentHandler.h"
|
||||||
#include "mission/devices/HeaterHandler.h"
|
#include "linux/devices/SusHandler.h"
|
||||||
|
#include "linux/devices/devicedefinitions/SusDefinitions.h"
|
||||||
#include "mission/core/GenericFactory.h"
|
#include "mission/core/GenericFactory.h"
|
||||||
|
#include "mission/devices/ACUHandler.h"
|
||||||
|
#include "mission/devices/GPSHyperionHandler.h"
|
||||||
|
#include "mission/devices/GyroADIS1650XHandler.h"
|
||||||
|
#include "mission/devices/HeaterHandler.h"
|
||||||
|
#include "mission/devices/IMTQHandler.h"
|
||||||
|
#include "mission/devices/Max31865PT1000Handler.h"
|
||||||
|
#include "mission/devices/P60DockHandler.h"
|
||||||
|
#include "mission/devices/PCDUHandler.h"
|
||||||
#include "mission/devices/PDU1Handler.h"
|
#include "mission/devices/PDU1Handler.h"
|
||||||
#include "mission/devices/PDU2Handler.h"
|
#include "mission/devices/PDU2Handler.h"
|
||||||
#include "mission/devices/ACUHandler.h"
|
|
||||||
#include "mission/devices/PCDUHandler.h"
|
|
||||||
#include "mission/devices/P60DockHandler.h"
|
|
||||||
#include "mission/devices/Tmp1075Handler.h"
|
|
||||||
#include "mission/devices/Max31865PT1000Handler.h"
|
|
||||||
#include "mission/devices/GyroADIS1650XHandler.h"
|
|
||||||
#include "mission/devices/IMTQHandler.h"
|
|
||||||
#include "mission/devices/SyrlinksHkHandler.h"
|
|
||||||
#include "mission/devices/PlocMPSoCHandler.h"
|
#include "mission/devices/PlocMPSoCHandler.h"
|
||||||
#include "mission/devices/RadiationSensorHandler.h"
|
#include "mission/devices/RadiationSensorHandler.h"
|
||||||
#include "mission/devices/RwHandler.h"
|
#include "mission/devices/RwHandler.h"
|
||||||
|
#include "mission/devices/SyrlinksHkHandler.h"
|
||||||
|
#include "mission/devices/Tmp1075Handler.h"
|
||||||
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
|
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
|
||||||
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
|
#include "mission/devices/devicedefinitions/Max31865Definitions.h"
|
||||||
#include "mission/devices/devicedefinitions/PlocMPSoCDefinitions.h"
|
#include "mission/devices/devicedefinitions/PlocMPSoCDefinitions.h"
|
||||||
#include "mission/devices/devicedefinitions/RadSensorDefinitions.h"
|
#include "mission/devices/devicedefinitions/RadSensorDefinitions.h"
|
||||||
#include "mission/devices/devicedefinitions/Max31865Definitions.h"
|
|
||||||
#include "mission/devices/devicedefinitions/RwDefinitions.h"
|
#include "mission/devices/devicedefinitions/RwDefinitions.h"
|
||||||
|
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
|
||||||
#include "mission/devices/GPSHyperionHandler.h"
|
|
||||||
#include "mission/tmtc/CCSDSHandler.h"
|
#include "mission/tmtc/CCSDSHandler.h"
|
||||||
#include "mission/tmtc/VirtualChannel.h"
|
#include "mission/tmtc/VirtualChannel.h"
|
||||||
#include "mission/utility/TmFunnel.h"
|
#include "mission/utility/TmFunnel.h"
|
||||||
|
#include "tmtc/apid.h"
|
||||||
#include "fsfw_hal/linux/uart/UartComIF.h"
|
#include "tmtc/pusIds.h"
|
||||||
#include "fsfw_hal/linux/uart/UartCookie.h"
|
|
||||||
#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h"
|
|
||||||
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
|
|
||||||
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
|
|
||||||
#include "fsfw_hal/linux/i2c/I2cCookie.h"
|
|
||||||
#include "fsfw_hal/linux/i2c/I2cComIF.h"
|
|
||||||
#include "fsfw_hal/linux/spi/SpiCookie.h"
|
|
||||||
#include "fsfw_hal/linux/spi/SpiComIF.h"
|
|
||||||
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
|
||||||
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
|
||||||
|
|
||||||
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
|
||||||
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
|
||||||
#include "fsfw/tmtcservices/PusServiceBase.h"
|
|
||||||
#include "fsfw/tmtcpacket/pus/tm.h"
|
|
||||||
|
|
||||||
#include "linux/boardtest/SpiTestClass.h"
|
|
||||||
|
|
||||||
#if OBSW_TEST_LIBGPIOD == 1
|
#if OBSW_TEST_LIBGPIOD == 1
|
||||||
#include "linux/boardtest/LibgpiodTest.h"
|
#include "linux/boardtest/LibgpiodTest.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <linux/obc/Ptme.h>
|
|
||||||
#include <linux/obc/PdecHandler.h>
|
|
||||||
#include <linux/obc/PapbVcInterface.h>
|
#include <linux/obc/PapbVcInterface.h>
|
||||||
|
#include <linux/obc/PdecHandler.h>
|
||||||
|
#include <linux/obc/Ptme.h>
|
||||||
#include <linux/obc/PtmeConfig.h>
|
#include <linux/obc/PtmeConfig.h>
|
||||||
#include <linux/obc/PtmeRateSetter.h>
|
#include <linux/obc/PtmeRateSetter.h>
|
||||||
#include <linux/obc/TxRateSetterIF.h>
|
#include <linux/obc/TxRateSetterIF.h>
|
||||||
@ -87,9 +84,7 @@
|
|||||||
ResetArgs resetArgsGnss0;
|
ResetArgs resetArgsGnss0;
|
||||||
ResetArgs resetArgsGnss1;
|
ResetArgs resetArgsGnss1;
|
||||||
|
|
||||||
void ObjectFactory::setStatics() {
|
void ObjectFactory::setStatics() { Factory::setStaticFrameworkObjectIds(); }
|
||||||
Factory::setStaticFrameworkObjectIds();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Factory::setStaticFrameworkObjectIds() {
|
void Factory::setStaticFrameworkObjectIds() {
|
||||||
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
@ -144,22 +139,22 @@ void ObjectFactory::produce(void* args) {
|
|||||||
createRtdComponents(gpioComIF);
|
createRtdComponents(gpioComIF);
|
||||||
#endif /* OBSW_ADD_RTD_DEVICES == 1 */
|
#endif /* OBSW_ADD_RTD_DEVICES == 1 */
|
||||||
|
|
||||||
I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE,
|
I2cCookie* imtqI2cCookie =
|
||||||
q7s::I2C_DEFAULT_DEV);
|
new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV);
|
||||||
new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie);
|
new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie);
|
||||||
createReactionWheelComponents(gpioComIF);
|
createReactionWheelComponents(gpioComIF);
|
||||||
|
|
||||||
#if OBSW_ADD_PLOC_MPSOC == 1
|
#if OBSW_ADD_PLOC_MPSOC == 1
|
||||||
UartCookie* plocMpsocCookie = new UartCookie(objects::PLOC_MPSOC_HANDLER,
|
UartCookie* plocMpsocCookie =
|
||||||
q7s::UART_PLOC_MPSOC_DEV, UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD,
|
new UartCookie(objects::PLOC_MPSOC_HANDLER, q7s::UART_PLOC_MPSOC_DEV,
|
||||||
PLOC_MPSOC::MAX_REPLY_SIZE);
|
UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD, PLOC_MPSOC::MAX_REPLY_SIZE);
|
||||||
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, plocMpsocCookie);
|
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, plocMpsocCookie);
|
||||||
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
|
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
|
||||||
|
|
||||||
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
||||||
UartCookie* plocSupervisorCookie = new UartCookie(objects::PLOC_SUPERVISOR_HANDLER,
|
UartCookie* plocSupervisorCookie = new UartCookie(
|
||||||
q7s::UART_PLOC_SUPERVSIOR_DEV, UartModes::NON_CANONICAL, uart::PLOC_SUPERVISOR_BAUD,
|
objects::PLOC_SUPERVISOR_HANDLER, q7s::UART_PLOC_SUPERVSIOR_DEV, UartModes::NON_CANONICAL,
|
||||||
PLOC_SPV::MAX_PACKET_SIZE * 20);
|
uart::PLOC_SUPERVISOR_BAUD, PLOC_SPV::MAX_PACKET_SIZE * 20);
|
||||||
plocSupervisorCookie->setNoFixedSizeReply();
|
plocSupervisorCookie->setNoFixedSizeReply();
|
||||||
PlocSupervisorHandler* plocSupervisor = new PlocSupervisorHandler(
|
PlocSupervisorHandler* plocSupervisor = new PlocSupervisorHandler(
|
||||||
objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, plocSupervisorCookie);
|
objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, plocSupervisorCookie);
|
||||||
@ -169,11 +164,15 @@ void ObjectFactory::produce(void* args) {
|
|||||||
new FileSystemHandler(objects::FILE_SYSTEM_HANDLER);
|
new FileSystemHandler(objects::FILE_SYSTEM_HANDLER);
|
||||||
|
|
||||||
#if OBSW_ADD_STAR_TRACKER == 1
|
#if OBSW_ADD_STAR_TRACKER == 1
|
||||||
UartCookie* starTrackerCookie = new UartCookie(objects::START_TRACKER,
|
UartCookie* starTrackerCookie =
|
||||||
q7s::UART_STAR_TRACKER_DEV, UartModes::NON_CANONICAL, uart::STAR_TRACKER_BAUD,
|
new UartCookie(objects::STAR_TRACKER, q7s::UART_STAR_TRACKER_DEV, UartModes::NON_CANONICAL,
|
||||||
StarTracker::MAX_FRAME_SIZE* 2 + 2);
|
uart::STAR_TRACKER_BAUD, StarTracker::MAX_FRAME_SIZE * 2 + 2);
|
||||||
starTrackerCookie->setNoFixedSizeReply();
|
starTrackerCookie->setNoFixedSizeReply();
|
||||||
new StarTrackerHandler(objects::START_TRACKER, objects::UART_COM_IF, starTrackerCookie);
|
StrHelper* strHelper = new StrHelper(objects::STR_HELPER);
|
||||||
|
StarTrackerHandler* starTrackerHandler = new StarTrackerHandler(
|
||||||
|
objects::STAR_TRACKER, objects::UART_COM_IF, starTrackerCookie, strHelper);
|
||||||
|
starTrackerHandler->setStartUpImmediately();
|
||||||
|
|
||||||
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
||||||
|
|
||||||
#endif /* TE7020 == 0 */
|
#endif /* TE7020 == 0 */
|
||||||
@ -193,23 +192,23 @@ void ObjectFactory::produce(void* args) {
|
|||||||
|
|
||||||
void ObjectFactory::createTmpComponents() {
|
void ObjectFactory::createTmpComponents() {
|
||||||
#if BOARD_TE0720 == 1
|
#if BOARD_TE0720 == 1
|
||||||
I2cCookie* i2cCookieTmp1075tcs1 = new I2cCookie(addresses::TMP1075_TCS_1,
|
I2cCookie* i2cCookieTmp1075tcs1 =
|
||||||
TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0"));
|
new I2cCookie(addresses::TMP1075_TCS_1, TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0"));
|
||||||
I2cCookie* i2cCookieTmp1075tcs2 = new I2cCookie(addresses::TMP1075_TCS_2,
|
I2cCookie* i2cCookieTmp1075tcs2 =
|
||||||
TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0"));
|
new I2cCookie(addresses::TMP1075_TCS_2, TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0"));
|
||||||
#else
|
#else
|
||||||
I2cCookie* i2cCookieTmp1075tcs1 = new I2cCookie(addresses::TMP1075_TCS_1,
|
I2cCookie* i2cCookieTmp1075tcs1 =
|
||||||
TMP1075::MAX_REPLY_LENGTH, q7s::I2C_DEFAULT_DEV);
|
new I2cCookie(addresses::TMP1075_TCS_1, TMP1075::MAX_REPLY_LENGTH, q7s::I2C_DEFAULT_DEV);
|
||||||
I2cCookie* i2cCookieTmp1075tcs2 = new I2cCookie(addresses::TMP1075_TCS_2,
|
I2cCookie* i2cCookieTmp1075tcs2 =
|
||||||
TMP1075::MAX_REPLY_LENGTH, q7s::I2C_DEFAULT_DEV);
|
new I2cCookie(addresses::TMP1075_TCS_2, TMP1075::MAX_REPLY_LENGTH, q7s::I2C_DEFAULT_DEV);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Temperature sensors */
|
/* Temperature sensors */
|
||||||
Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler(objects::TMP1075_HANDLER_1,
|
Tmp1075Handler* tmp1075Handler_1 =
|
||||||
objects::I2C_COM_IF, i2cCookieTmp1075tcs1);
|
new Tmp1075Handler(objects::TMP1075_HANDLER_1, objects::I2C_COM_IF, i2cCookieTmp1075tcs1);
|
||||||
(void)tmp1075Handler_1;
|
(void)tmp1075Handler_1;
|
||||||
Tmp1075Handler* tmp1075Handler_2 = new Tmp1075Handler(objects::TMP1075_HANDLER_2,
|
Tmp1075Handler* tmp1075Handler_2 =
|
||||||
objects::I2C_COM_IF, i2cCookieTmp1075tcs2);
|
new Tmp1075Handler(objects::TMP1075_HANDLER_2, objects::I2C_COM_IF, i2cCookieTmp1075tcs2);
|
||||||
(void)tmp1075Handler_2;
|
(void)tmp1075Handler_2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,14 +240,13 @@ void ObjectFactory::createPcduComponents() {
|
|||||||
CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU2);
|
CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU2);
|
||||||
CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_LENGTH, addresses::ACU);
|
CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_LENGTH, addresses::ACU);
|
||||||
/* Device Handler */
|
/* Device Handler */
|
||||||
P60DockHandler* p60dockhandler = new P60DockHandler(objects::P60DOCK_HANDLER,
|
P60DockHandler* p60dockhandler =
|
||||||
objects::CSP_COM_IF, p60DockCspCookie);
|
new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, p60DockCspCookie);
|
||||||
PDU1Handler* pdu1handler = new PDU1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF,
|
PDU1Handler* pdu1handler =
|
||||||
pdu1CspCookie);
|
new PDU1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF, pdu1CspCookie);
|
||||||
PDU2Handler* pdu2handler = new PDU2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF,
|
PDU2Handler* pdu2handler =
|
||||||
pdu2CspCookie);
|
new PDU2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie);
|
||||||
ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF,
|
ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie);
|
||||||
acuCspCookie);
|
|
||||||
new PCDUHandler(objects::PCDU_HANDLER, 50);
|
new PCDUHandler(objects::PCDU_HANDLER, 50);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -270,9 +268,9 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
|
|||||||
gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, gpio);
|
gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, gpio);
|
||||||
gpioComIF->addGpios(gpioCookieRadSensor);
|
gpioComIF->addGpios(gpioCookieRadSensor);
|
||||||
|
|
||||||
SpiCookie* spiCookieRadSensor = new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR,
|
SpiCookie* spiCookieRadSensor = new SpiCookie(
|
||||||
std::string(q7s::SPI_DEFAULT_DEV), RAD_SENSOR::READ_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR, std::string(q7s::SPI_DEFAULT_DEV),
|
||||||
spi::DEFAULT_MAX_1227_SPEED);
|
RAD_SENSOR::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
||||||
new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor);
|
new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,64 +320,55 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF, SpiComI
|
|||||||
|
|
||||||
gpioComIF->addGpios(gpioCookieSus);
|
gpioComIF->addGpios(gpioCookieSus);
|
||||||
|
|
||||||
SpiCookie* spiCookieSus1 = new SpiCookie(addresses::SUS_1, gpio::NO_GPIO,
|
SpiCookie* spiCookieSus1 =
|
||||||
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
new SpiCookie(addresses::SUS_1, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
|
||||||
SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SpiCookie* spiCookieSus2 = new SpiCookie(addresses::SUS_2, gpio::NO_GPIO,
|
SpiCookie* spiCookieSus2 =
|
||||||
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
new SpiCookie(addresses::SUS_2, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
|
||||||
SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SpiCookie* spiCookieSus3 = new SpiCookie(addresses::SUS_3, gpio::NO_GPIO,
|
SpiCookie* spiCookieSus3 =
|
||||||
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
new SpiCookie(addresses::SUS_3, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
|
||||||
SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SpiCookie* spiCookieSus4 = new SpiCookie(addresses::SUS_4, gpio::NO_GPIO,
|
SpiCookie* spiCookieSus4 =
|
||||||
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
new SpiCookie(addresses::SUS_4, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
|
||||||
SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SpiCookie* spiCookieSus5 = new SpiCookie(addresses::SUS_5, gpio::NO_GPIO,
|
SpiCookie* spiCookieSus5 =
|
||||||
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
new SpiCookie(addresses::SUS_5, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
|
||||||
SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SpiCookie* spiCookieSus6 = new SpiCookie(addresses::SUS_6, gpio::NO_GPIO,
|
SpiCookie* spiCookieSus6 =
|
||||||
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
new SpiCookie(addresses::SUS_6, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
|
||||||
SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SpiCookie* spiCookieSus7 = new SpiCookie(addresses::SUS_7, gpio::NO_GPIO,
|
SpiCookie* spiCookieSus7 =
|
||||||
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
new SpiCookie(addresses::SUS_7, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
|
||||||
SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SpiCookie* spiCookieSus8 = new SpiCookie(addresses::SUS_8, gpio::NO_GPIO,
|
SpiCookie* spiCookieSus8 =
|
||||||
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
new SpiCookie(addresses::SUS_8, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
|
||||||
SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SpiCookie* spiCookieSus9 = new SpiCookie(addresses::SUS_9, gpio::NO_GPIO,
|
SpiCookie* spiCookieSus9 =
|
||||||
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
new SpiCookie(addresses::SUS_9, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
|
||||||
SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SpiCookie* spiCookieSus10 = new SpiCookie(addresses::SUS_10, gpio::NO_GPIO,
|
SpiCookie* spiCookieSus10 =
|
||||||
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
new SpiCookie(addresses::SUS_10, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
|
||||||
SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SpiCookie* spiCookieSus11 = new SpiCookie(addresses::SUS_11, gpio::NO_GPIO,
|
SpiCookie* spiCookieSus11 =
|
||||||
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
new SpiCookie(addresses::SUS_11, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
|
||||||
SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SpiCookie* spiCookieSus12 = new SpiCookie(addresses::SUS_12, gpio::NO_GPIO,
|
SpiCookie* spiCookieSus12 =
|
||||||
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
new SpiCookie(addresses::SUS_12, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
|
||||||
SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SpiCookie* spiCookieSus13 = new SpiCookie(addresses::SUS_13, gpio::NO_GPIO,
|
SpiCookie* spiCookieSus13 =
|
||||||
std::string(q7s::SPI_DEFAULT_DEV), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
new SpiCookie(addresses::SUS_13, gpio::NO_GPIO, std::string(q7s::SPI_DEFAULT_DEV),
|
||||||
SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
|
|
||||||
new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus1, gpioComIF,
|
new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus1, gpioComIF, gpioIds::CS_SUS_1);
|
||||||
gpioIds::CS_SUS_1);
|
new SusHandler(objects::SUS_2, objects::SPI_COM_IF, spiCookieSus2, gpioComIF, gpioIds::CS_SUS_2);
|
||||||
new SusHandler(objects::SUS_2, objects::SPI_COM_IF, spiCookieSus2, gpioComIF,
|
new SusHandler(objects::SUS_3, objects::SPI_COM_IF, spiCookieSus3, gpioComIF, gpioIds::CS_SUS_3);
|
||||||
gpioIds::CS_SUS_2);
|
new SusHandler(objects::SUS_4, objects::SPI_COM_IF, spiCookieSus4, gpioComIF, gpioIds::CS_SUS_4);
|
||||||
new SusHandler(objects::SUS_3, objects::SPI_COM_IF, spiCookieSus3, gpioComIF,
|
new SusHandler(objects::SUS_5, objects::SPI_COM_IF, spiCookieSus5, gpioComIF, gpioIds::CS_SUS_5);
|
||||||
gpioIds::CS_SUS_3);
|
new SusHandler(objects::SUS_6, objects::SPI_COM_IF, spiCookieSus6, gpioComIF, gpioIds::CS_SUS_6);
|
||||||
new SusHandler(objects::SUS_4, objects::SPI_COM_IF, spiCookieSus4, gpioComIF,
|
new SusHandler(objects::SUS_7, objects::SPI_COM_IF, spiCookieSus7, gpioComIF, gpioIds::CS_SUS_7);
|
||||||
gpioIds::CS_SUS_4);
|
new SusHandler(objects::SUS_8, objects::SPI_COM_IF, spiCookieSus8, gpioComIF, gpioIds::CS_SUS_8);
|
||||||
new SusHandler(objects::SUS_5, objects::SPI_COM_IF, spiCookieSus5, gpioComIF,
|
new SusHandler(objects::SUS_9, objects::SPI_COM_IF, spiCookieSus9, gpioComIF, gpioIds::CS_SUS_9);
|
||||||
gpioIds::CS_SUS_5);
|
|
||||||
new SusHandler(objects::SUS_6, objects::SPI_COM_IF, spiCookieSus6, gpioComIF,
|
|
||||||
gpioIds::CS_SUS_6);
|
|
||||||
new SusHandler(objects::SUS_7, objects::SPI_COM_IF, spiCookieSus7, gpioComIF,
|
|
||||||
gpioIds::CS_SUS_7);
|
|
||||||
new SusHandler(objects::SUS_8, objects::SPI_COM_IF, spiCookieSus8, gpioComIF,
|
|
||||||
gpioIds::CS_SUS_8);
|
|
||||||
new SusHandler(objects::SUS_9, objects::SPI_COM_IF, spiCookieSus9, gpioComIF,
|
|
||||||
gpioIds::CS_SUS_9);
|
|
||||||
new SusHandler(objects::SUS_10, objects::SPI_COM_IF, spiCookieSus10, gpioComIF,
|
new SusHandler(objects::SUS_10, objects::SPI_COM_IF, spiCookieSus10, gpioComIF,
|
||||||
gpioIds::CS_SUS_10);
|
gpioIds::CS_SUS_10);
|
||||||
new SusHandler(objects::SUS_11, objects::SPI_COM_IF, spiCookieSus11, gpioComIF,
|
new SusHandler(objects::SUS_11, objects::SPI_COM_IF, spiCookieSus11, gpioComIF,
|
||||||
@ -396,8 +385,8 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
|
|||||||
std::stringstream consumer;
|
std::stringstream consumer;
|
||||||
GpiodRegularByLineName* gpio = nullptr;
|
GpiodRegularByLineName* gpio = nullptr;
|
||||||
consumer << "0x" << std::hex << objects::GYRO_0_ADIS_HANDLER;
|
consumer << "0x" << std::hex << objects::GYRO_0_ADIS_HANDLER;
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ADIS_CS, consumer.str(),
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ADIS_CS, consumer.str(), gpio::DIR_OUT,
|
||||||
gpio::DIR_OUT, gpio::HIGH);
|
gpio::HIGH);
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio);
|
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio);
|
||||||
|
|
||||||
consumer.str("");
|
consumer.str("");
|
||||||
@ -432,8 +421,8 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
|
|||||||
|
|
||||||
consumer.str("");
|
consumer.str("");
|
||||||
consumer << "0x" << std::hex << objects::MGM_2_LIS3_HANDLER;
|
consumer << "0x" << std::hex << objects::MGM_2_LIS3_HANDLER;
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_2_CS, consumer.str(),
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_2_CS, consumer.str(), gpio::DIR_OUT,
|
||||||
gpio::DIR_OUT, gpio::HIGH);
|
gpio::HIGH);
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpio);
|
gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpio);
|
||||||
|
|
||||||
consumer.str("");
|
consumer.str("");
|
||||||
@ -443,14 +432,14 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
|
|||||||
gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio);
|
gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio);
|
||||||
|
|
||||||
consumer.str("");
|
consumer.str("");
|
||||||
consumer << "0x" << std::hex << objects::GPS0_HANDLER;
|
consumer << "0x" << std::hex << objects::GPS_CONTROLLER;
|
||||||
// GNSS reset pins are active low
|
// GNSS reset pins are active low
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::RESET_GNSS_0, consumer.str(), gpio::DIR_OUT,
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::RESET_GNSS_0, consumer.str(), gpio::DIR_OUT,
|
||||||
gpio::HIGH);
|
gpio::HIGH);
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_0_NRESET, gpio);
|
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_0_NRESET, gpio);
|
||||||
|
|
||||||
consumer.str("");
|
consumer.str("");
|
||||||
consumer << "0x" << std::hex << objects::GPS1_HANDLER;
|
consumer << "0x" << std::hex << objects::GPS_CONTROLLER;
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::RESET_GNSS_1, consumer.str(), gpio::DIR_OUT,
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::RESET_GNSS_1, consumer.str(), gpio::DIR_OUT,
|
||||||
gpio::HIGH);
|
gpio::HIGH);
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_1_NRESET, gpio);
|
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_1_NRESET, gpio);
|
||||||
@ -458,8 +447,8 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
|
|||||||
consumer.str("");
|
consumer.str("");
|
||||||
consumer << "0x" << std::hex << objects::GYRO_0_ADIS_HANDLER;
|
consumer << "0x" << std::hex << objects::GYRO_0_ADIS_HANDLER;
|
||||||
// Enable pins must be pulled low for regular operations
|
// Enable pins must be pulled low for regular operations
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ENABLE, consumer.str(),
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ENABLE, consumer.str(), gpio::DIR_OUT,
|
||||||
gpio::DIR_OUT, gpio::LOW);
|
gpio::LOW);
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ENABLE, gpio);
|
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ENABLE, gpio);
|
||||||
|
|
||||||
consumer.str("");
|
consumer.str("");
|
||||||
@ -468,11 +457,24 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
|
|||||||
gpio::LOW);
|
gpio::LOW);
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ENABLE, gpio);
|
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ENABLE, gpio);
|
||||||
|
|
||||||
// TODO: Add enable pins for GPS as soon as new interface board design is finished
|
// Enable pins for GNSS
|
||||||
|
consumer.str("");
|
||||||
|
consumer << "0x" << std::hex << objects::GPS_CONTROLLER;
|
||||||
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::GNSS_0_ENABLE, consumer.str(), gpio::DIR_OUT,
|
||||||
|
gpio::LOW);
|
||||||
|
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_0_ENABLE, gpio);
|
||||||
|
|
||||||
|
consumer.str("");
|
||||||
|
consumer << "0x" << std::hex << objects::GPS_CONTROLLER;
|
||||||
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::GNSS_1_ENABLE, consumer.str(), gpio::DIR_OUT,
|
||||||
|
gpio::LOW);
|
||||||
|
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_1_ENABLE, gpio);
|
||||||
|
|
||||||
gpioComIF->addGpios(gpioCookieAcsBoard);
|
gpioComIF->addGpios(gpioCookieAcsBoard);
|
||||||
|
|
||||||
std::string spiDev = q7s::SPI_DEFAULT_DEV;
|
std::string spiDev = q7s::SPI_DEFAULT_DEV;
|
||||||
SpiCookie* spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev,
|
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);
|
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
||||||
auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_COM_IF,
|
auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_COM_IF,
|
||||||
spiCookie, spi::LIS3_TRANSITION_DELAY);
|
spiCookie, spi::LIS3_TRANSITION_DELAY);
|
||||||
@ -481,7 +483,8 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
|
|||||||
mgmLis3Handler->setToGoToNormalMode(true);
|
mgmLis3Handler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
|
||||||
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
||||||
auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF,
|
auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF,
|
||||||
spiCookie, spi::RM3100_TRANSITION_DELAY);
|
spiCookie, spi::RM3100_TRANSITION_DELAY);
|
||||||
@ -490,7 +493,8 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
|
|||||||
mgmRm3100Handler->setToGoToNormalMode(true);
|
mgmRm3100Handler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev,
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev,
|
||||||
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
||||||
auto mgmLis3Handler2 = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_COM_IF,
|
auto mgmLis3Handler2 = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_COM_IF,
|
||||||
spiCookie, spi::LIS3_TRANSITION_DELAY);
|
spiCookie, spi::LIS3_TRANSITION_DELAY);
|
||||||
@ -499,7 +503,8 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
|
|||||||
mgmLis3Handler2->setToGoToNormalMode(true);
|
mgmLis3Handler2->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev,
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev,
|
||||||
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
||||||
mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF,
|
mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF,
|
||||||
spiCookie, spi::RM3100_TRANSITION_DELAY);
|
spiCookie, spi::RM3100_TRANSITION_DELAY);
|
||||||
@ -517,8 +522,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
|
|||||||
spiCookie, ADIS1650X::Type::ADIS16505);
|
spiCookie, ADIS1650X::Type::ADIS16505);
|
||||||
adisHandler->setStartUpImmediately();
|
adisHandler->setStartUpImmediately();
|
||||||
// Gyro 1 Side A
|
// Gyro 1 Side A
|
||||||
spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev,
|
spiCookie =
|
||||||
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE,
|
||||||
|
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF,
|
auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF,
|
||||||
spiCookie, spi::L3G_TRANSITION_DELAY);
|
spiCookie, spi::L3G_TRANSITION_DELAY);
|
||||||
gyroL3gHandler->setStartUpImmediately();
|
gyroL3gHandler->setStartUpImmediately();
|
||||||
@ -533,8 +539,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
|
|||||||
spiCookie, ADIS1650X::Type::ADIS16505);
|
spiCookie, ADIS1650X::Type::ADIS16505);
|
||||||
adisHandler->setStartUpImmediately();
|
adisHandler->setStartUpImmediately();
|
||||||
// Gyro 3 Side B
|
// Gyro 3 Side B
|
||||||
spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev,
|
spiCookie =
|
||||||
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE,
|
||||||
|
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF,
|
gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF,
|
||||||
spiCookie, spi::L3G_TRANSITION_DELAY);
|
spiCookie, spi::L3G_TRANSITION_DELAY);
|
||||||
gyroL3gHandler->setStartUpImmediately();
|
gyroL3gHandler->setStartUpImmediately();
|
||||||
@ -552,26 +559,11 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
|
|||||||
resetArgsGnss0.gnss1 = false;
|
resetArgsGnss0.gnss1 = false;
|
||||||
resetArgsGnss0.gpioComIF = gpioComIF;
|
resetArgsGnss0.gpioComIF = gpioComIF;
|
||||||
resetArgsGnss0.waitPeriodMs = 100;
|
resetArgsGnss0.waitPeriodMs = 100;
|
||||||
auto uartCookieGps0 = new UartCookie(objects::GPS0_HANDLER, q7s::UART_GNSS_0_DEV,
|
auto gpsHandler0 = new GPSHyperionHandler(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps);
|
||||||
UartModes::CANONICAL, uart::GNSS_BAUD, uart::HYPERION_GPS_REPLY_MAX_BUFFER);
|
|
||||||
uartCookieGps0->setToFlushInput(true);
|
|
||||||
uartCookieGps0->setReadCycles(6);
|
|
||||||
auto uartCookieGps1 = new UartCookie(objects::GPS1_HANDLER, q7s::UART_GNSS_1_DEV,
|
|
||||||
UartModes::CANONICAL, uart::GNSS_BAUD, uart::HYPERION_GPS_REPLY_MAX_BUFFER);
|
|
||||||
uartCookieGps1->setToFlushInput(true);
|
|
||||||
uartCookieGps1->setReadCycles(6);
|
|
||||||
auto gpsHandler0 = new GPSHyperionHandler(objects::GPS0_HANDLER, objects::UART_COM_IF,
|
|
||||||
uartCookieGps0, debugGps);
|
|
||||||
gpsHandler0->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss0);
|
gpsHandler0->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss0);
|
||||||
gpsHandler0->setStartUpImmediately();
|
|
||||||
auto gpsHandler1 = new GPSHyperionHandler(objects::GPS1_HANDLER, objects::UART_COM_IF,
|
|
||||||
uartCookieGps1, debugGps);
|
|
||||||
gpsHandler1->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss1);
|
|
||||||
gpsHandler1->setStartUpImmediately();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createHeaterComponents() {
|
void ObjectFactory::createHeaterComponents() {
|
||||||
|
|
||||||
GpioCookie* heaterGpiosCookie = new GpioCookie;
|
GpioCookie* heaterGpiosCookie = new GpioCookie;
|
||||||
GpiodRegularByLineName* gpio = nullptr;
|
GpiodRegularByLineName* gpio = nullptr;
|
||||||
|
|
||||||
@ -591,24 +583,24 @@ void ObjectFactory::createHeaterComponents() {
|
|||||||
gpio::LOW);
|
gpio::LOW);
|
||||||
heaterGpiosCookie->addGpio(gpioIds::HEATER_2, gpio);
|
heaterGpiosCookie->addGpio(gpioIds::HEATER_2, gpio);
|
||||||
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_3, consumer.str(),
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_3, consumer.str(), gpio::DIR_OUT,
|
||||||
gpio::DIR_OUT, gpio::LOW);
|
gpio::LOW);
|
||||||
heaterGpiosCookie->addGpio(gpioIds::HEATER_3, gpio);
|
heaterGpiosCookie->addGpio(gpioIds::HEATER_3, gpio);
|
||||||
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_4, consumer.str(),
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_4, consumer.str(), gpio::DIR_OUT,
|
||||||
gpio::DIR_OUT, gpio::LOW);
|
gpio::LOW);
|
||||||
heaterGpiosCookie->addGpio(gpioIds::HEATER_4, gpio);
|
heaterGpiosCookie->addGpio(gpioIds::HEATER_4, gpio);
|
||||||
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_5, consumer.str(),
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_5, consumer.str(), gpio::DIR_OUT,
|
||||||
gpio::DIR_OUT, gpio::LOW);
|
gpio::LOW);
|
||||||
heaterGpiosCookie->addGpio(gpioIds::HEATER_5, gpio);
|
heaterGpiosCookie->addGpio(gpioIds::HEATER_5, gpio);
|
||||||
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_6, consumer.str(),
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_6, consumer.str(), gpio::DIR_OUT,
|
||||||
gpio::DIR_OUT, gpio::LOW);
|
gpio::LOW);
|
||||||
heaterGpiosCookie->addGpio(gpioIds::HEATER_6, gpio);
|
heaterGpiosCookie->addGpio(gpioIds::HEATER_6, gpio);
|
||||||
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_7, consumer.str(),
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_7, consumer.str(), gpio::DIR_OUT,
|
||||||
gpio::DIR_OUT, gpio::LOW);
|
gpio::LOW);
|
||||||
heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpio);
|
heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpio);
|
||||||
|
|
||||||
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie,
|
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie,
|
||||||
@ -621,8 +613,8 @@ void ObjectFactory::createSolarArrayDeploymentComponents() {
|
|||||||
|
|
||||||
std::stringstream consumer;
|
std::stringstream consumer;
|
||||||
consumer << "0x" << std::hex << objects::SOLAR_ARRAY_DEPL_HANDLER;
|
consumer << "0x" << std::hex << objects::SOLAR_ARRAY_DEPL_HANDLER;
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::SA_DPL_PIN_0,
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::SA_DPL_PIN_0, consumer.str(), gpio::DIR_OUT,
|
||||||
consumer.str(), gpio::DIR_OUT, gpio::LOW);
|
gpio::LOW);
|
||||||
solarArrayDeplCookie->addGpio(gpioIds::DEPLSA1, gpio);
|
solarArrayDeplCookie->addGpio(gpioIds::DEPLSA1, gpio);
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::SA_DPL_PIN_1, consumer.str(), gpio::DIR_OUT,
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::SA_DPL_PIN_1, consumer.str(), gpio::DIR_OUT,
|
||||||
gpio::LOW);
|
gpio::LOW);
|
||||||
@ -630,14 +622,15 @@ void ObjectFactory::createSolarArrayDeploymentComponents() {
|
|||||||
|
|
||||||
// TODO: Find out burn time. For now set to 1000 ms.
|
// TODO: Find out burn time. For now set to 1000 ms.
|
||||||
new SolarArrayDeploymentHandler(objects::SOLAR_ARRAY_DEPL_HANDLER, objects::GPIO_IF,
|
new SolarArrayDeploymentHandler(objects::SOLAR_ARRAY_DEPL_HANDLER, objects::GPIO_IF,
|
||||||
solarArrayDeplCookie, objects::PCDU_HANDLER, pcduSwitches::DEPLOYMENT_MECHANISM,
|
solarArrayDeplCookie, objects::PCDU_HANDLER,
|
||||||
gpioIds::DEPLSA1, gpioIds::DEPLSA2, 1000);
|
pcduSwitches::DEPLOYMENT_MECHANISM, gpioIds::DEPLSA1,
|
||||||
|
gpioIds::DEPLSA2, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createSyrlinksComponents() {
|
void ObjectFactory::createSyrlinksComponents() {
|
||||||
UartCookie* syrlinksUartCookie = new UartCookie(objects::SYRLINKS_HK_HANDLER,
|
UartCookie* syrlinksUartCookie =
|
||||||
q7s::UART_SYRLINKS_DEV, UartModes::NON_CANONICAL, uart::SYRLINKS_BAUD,
|
new UartCookie(objects::SYRLINKS_HK_HANDLER, q7s::UART_SYRLINKS_DEV, UartModes::NON_CANONICAL,
|
||||||
SYRLINKS::MAX_REPLY_SIZE);
|
uart::SYRLINKS_BAUD, SYRLINKS::MAX_REPLY_SIZE);
|
||||||
syrlinksUartCookie->setParityEven();
|
syrlinksUartCookie->setParityEven();
|
||||||
|
|
||||||
new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie);
|
new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie);
|
||||||
@ -697,84 +690,96 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF *gpioComIF) {
|
|||||||
|
|
||||||
gpioComIF->addGpios(rtdGpioCookie);
|
gpioComIF->addGpios(rtdGpioCookie);
|
||||||
|
|
||||||
SpiCookie* spiRtdIc0 = new SpiCookie(addresses::RTD_IC_3, gpioIds::RTD_IC_3, q7s::SPI_DEFAULT_DEV,
|
SpiCookie* spiRtdIc0 =
|
||||||
Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
|
new SpiCookie(addresses::RTD_IC_3, gpioIds::RTD_IC_3, q7s::SPI_DEFAULT_DEV,
|
||||||
SpiCookie* spiRtdIc1 = new SpiCookie(addresses::RTD_IC_4, gpioIds::RTD_IC_4, q7s::SPI_DEFAULT_DEV,
|
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
|
||||||
Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
|
SpiCookie* spiRtdIc1 =
|
||||||
SpiCookie* spiRtdIc2 = new SpiCookie(addresses::RTD_IC_5, gpioIds::RTD_IC_5, q7s::SPI_DEFAULT_DEV,
|
new SpiCookie(addresses::RTD_IC_4, gpioIds::RTD_IC_4, q7s::SPI_DEFAULT_DEV,
|
||||||
Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
|
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
|
||||||
SpiCookie* spiRtdIc3 = new SpiCookie(addresses::RTD_IC_6, gpioIds::RTD_IC_6, q7s::SPI_DEFAULT_DEV,
|
SpiCookie* spiRtdIc2 =
|
||||||
Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
|
new SpiCookie(addresses::RTD_IC_5, gpioIds::RTD_IC_5, q7s::SPI_DEFAULT_DEV,
|
||||||
SpiCookie* spiRtdIc4 = new SpiCookie(addresses::RTD_IC_7, gpioIds::RTD_IC_7, q7s::SPI_DEFAULT_DEV,
|
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
|
||||||
Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
|
SpiCookie* spiRtdIc3 =
|
||||||
SpiCookie* spiRtdIc5 = new SpiCookie(addresses::RTD_IC_8, gpioIds::RTD_IC_8, q7s::SPI_DEFAULT_DEV,
|
new SpiCookie(addresses::RTD_IC_6, gpioIds::RTD_IC_6, q7s::SPI_DEFAULT_DEV,
|
||||||
Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
|
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
|
||||||
SpiCookie* spiRtdIc6 = new SpiCookie(addresses::RTD_IC_9, gpioIds::RTD_IC_9, q7s::SPI_DEFAULT_DEV,
|
SpiCookie* spiRtdIc4 =
|
||||||
Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
|
new SpiCookie(addresses::RTD_IC_7, gpioIds::RTD_IC_7, q7s::SPI_DEFAULT_DEV,
|
||||||
SpiCookie* spiRtdIc7 = new SpiCookie(addresses::RTD_IC_10, gpioIds::RTD_IC_10,
|
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
|
||||||
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
|
SpiCookie* spiRtdIc5 =
|
||||||
spi::RTD_SPEED);
|
new SpiCookie(addresses::RTD_IC_8, gpioIds::RTD_IC_8, q7s::SPI_DEFAULT_DEV,
|
||||||
SpiCookie* spiRtdIc8 = new SpiCookie(addresses::RTD_IC_11, gpioIds::RTD_IC_11,
|
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
|
||||||
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
|
SpiCookie* spiRtdIc6 =
|
||||||
spi::RTD_SPEED);
|
new SpiCookie(addresses::RTD_IC_9, gpioIds::RTD_IC_9, q7s::SPI_DEFAULT_DEV,
|
||||||
SpiCookie* spiRtdIc9 = new SpiCookie(addresses::RTD_IC_12, gpioIds::RTD_IC_12,
|
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
|
||||||
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
|
SpiCookie* spiRtdIc7 =
|
||||||
spi::RTD_SPEED);
|
new SpiCookie(addresses::RTD_IC_10, gpioIds::RTD_IC_10, q7s::SPI_DEFAULT_DEV,
|
||||||
SpiCookie* spiRtdIc10 = new SpiCookie(addresses::RTD_IC_13, gpioIds::RTD_IC_13,
|
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
|
||||||
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
|
SpiCookie* spiRtdIc8 =
|
||||||
spi::RTD_SPEED);
|
new SpiCookie(addresses::RTD_IC_11, gpioIds::RTD_IC_11, q7s::SPI_DEFAULT_DEV,
|
||||||
SpiCookie* spiRtdIc11 = new SpiCookie(addresses::RTD_IC_14, gpioIds::RTD_IC_14,
|
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
|
||||||
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
|
SpiCookie* spiRtdIc9 =
|
||||||
spi::RTD_SPEED);
|
new SpiCookie(addresses::RTD_IC_12, gpioIds::RTD_IC_12, q7s::SPI_DEFAULT_DEV,
|
||||||
SpiCookie* spiRtdIc12 = new SpiCookie(addresses::RTD_IC_15, gpioIds::RTD_IC_15,
|
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
|
||||||
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
|
SpiCookie* spiRtdIc10 =
|
||||||
spi::RTD_SPEED);
|
new SpiCookie(addresses::RTD_IC_13, gpioIds::RTD_IC_13, q7s::SPI_DEFAULT_DEV,
|
||||||
SpiCookie* spiRtdIc13 = new SpiCookie(addresses::RTD_IC_16, gpioIds::RTD_IC_16,
|
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
|
||||||
std::string(q7s::SPI_DEFAULT_DEV), Max31865Definitions::MAX_REPLY_SIZE,
|
SpiCookie* spiRtdIc11 =
|
||||||
spi::SpiModes::MODE_1, spi::RTD_SPEED);
|
new SpiCookie(addresses::RTD_IC_14, gpioIds::RTD_IC_14, q7s::SPI_DEFAULT_DEV,
|
||||||
SpiCookie* spiRtdIc14 = new SpiCookie(addresses::RTD_IC_17, gpioIds::RTD_IC_17,
|
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
|
||||||
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
|
SpiCookie* spiRtdIc12 =
|
||||||
spi::RTD_SPEED);
|
new SpiCookie(addresses::RTD_IC_15, gpioIds::RTD_IC_15, q7s::SPI_DEFAULT_DEV,
|
||||||
SpiCookie* spiRtdIc15 = new SpiCookie(addresses::RTD_IC_18, gpioIds::RTD_IC_18,
|
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
|
||||||
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
|
SpiCookie* spiRtdIc13 =
|
||||||
spi::RTD_SPEED);
|
new SpiCookie(addresses::RTD_IC_16, gpioIds::RTD_IC_16, std::string(q7s::SPI_DEFAULT_DEV),
|
||||||
|
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
|
||||||
|
SpiCookie* spiRtdIc14 =
|
||||||
|
new SpiCookie(addresses::RTD_IC_17, gpioIds::RTD_IC_17, q7s::SPI_DEFAULT_DEV,
|
||||||
|
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
|
||||||
|
SpiCookie* spiRtdIc15 =
|
||||||
|
new SpiCookie(addresses::RTD_IC_18, gpioIds::RTD_IC_18, q7s::SPI_DEFAULT_DEV,
|
||||||
|
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
|
||||||
|
|
||||||
Max31865PT1000Handler* rtdIc0 = new Max31865PT1000Handler(objects::RTD_IC_3, objects::SPI_COM_IF,
|
Max31865PT1000Handler* rtdIc0 =
|
||||||
spiRtdIc0);
|
new Max31865PT1000Handler(objects::RTD_IC_3, objects::SPI_COM_IF, spiRtdIc0);
|
||||||
Max31865PT1000Handler* rtdIc1 = new Max31865PT1000Handler(objects::RTD_IC_4, objects::SPI_COM_IF,
|
Max31865PT1000Handler* rtdIc1 =
|
||||||
spiRtdIc1);
|
new Max31865PT1000Handler(objects::RTD_IC_4, objects::SPI_COM_IF, spiRtdIc1);
|
||||||
Max31865PT1000Handler* rtdIc2 = new Max31865PT1000Handler(objects::RTD_IC_5, objects::SPI_COM_IF,
|
Max31865PT1000Handler* rtdIc2 =
|
||||||
spiRtdIc2);
|
new Max31865PT1000Handler(objects::RTD_IC_5, objects::SPI_COM_IF, spiRtdIc2);
|
||||||
Max31865PT1000Handler* rtdIc3 = new Max31865PT1000Handler(objects::RTD_IC_6, objects::SPI_COM_IF,
|
Max31865PT1000Handler* rtdIc3 =
|
||||||
spiRtdIc3);
|
new Max31865PT1000Handler(objects::RTD_IC_6, objects::SPI_COM_IF, spiRtdIc3);
|
||||||
Max31865PT1000Handler* rtdIc4 = new Max31865PT1000Handler(objects::RTD_IC_7, objects::SPI_COM_IF,
|
Max31865PT1000Handler* rtdIc4 =
|
||||||
spiRtdIc4);
|
new Max31865PT1000Handler(objects::RTD_IC_7, objects::SPI_COM_IF, spiRtdIc4);
|
||||||
Max31865PT1000Handler* rtdIc5 = new Max31865PT1000Handler(objects::RTD_IC_8, objects::SPI_COM_IF,
|
Max31865PT1000Handler* rtdIc5 =
|
||||||
spiRtdIc5);
|
new Max31865PT1000Handler(objects::RTD_IC_8, objects::SPI_COM_IF, spiRtdIc5);
|
||||||
Max31865PT1000Handler* rtdIc6 = new Max31865PT1000Handler(objects::RTD_IC_9, objects::SPI_COM_IF,
|
Max31865PT1000Handler* rtdIc6 =
|
||||||
spiRtdIc6);
|
new Max31865PT1000Handler(objects::RTD_IC_9, objects::SPI_COM_IF, spiRtdIc6);
|
||||||
Max31865PT1000Handler* rtdIc7 = new Max31865PT1000Handler(objects::RTD_IC_10,
|
Max31865PT1000Handler* rtdIc7 =
|
||||||
objects::SPI_COM_IF, spiRtdIc7);
|
new Max31865PT1000Handler(objects::RTD_IC_10, objects::SPI_COM_IF, spiRtdIc7);
|
||||||
Max31865PT1000Handler* rtdIc8 = new Max31865PT1000Handler(objects::RTD_IC_11,
|
Max31865PT1000Handler* rtdIc8 =
|
||||||
objects::SPI_COM_IF, spiRtdIc8);
|
new Max31865PT1000Handler(objects::RTD_IC_11, objects::SPI_COM_IF, spiRtdIc8);
|
||||||
Max31865PT1000Handler* rtdIc9 = new Max31865PT1000Handler(objects::RTD_IC_12,
|
Max31865PT1000Handler* rtdIc9 =
|
||||||
objects::SPI_COM_IF, spiRtdIc9);
|
new Max31865PT1000Handler(objects::RTD_IC_12, objects::SPI_COM_IF, spiRtdIc9);
|
||||||
Max31865PT1000Handler* rtdIc10 = new Max31865PT1000Handler(objects::RTD_IC_13,
|
Max31865PT1000Handler* rtdIc10 =
|
||||||
objects::SPI_COM_IF, spiRtdIc10);
|
new Max31865PT1000Handler(objects::RTD_IC_13, objects::SPI_COM_IF, spiRtdIc10);
|
||||||
Max31865PT1000Handler* rtdIc11 = new Max31865PT1000Handler(objects::RTD_IC_14,
|
Max31865PT1000Handler* rtdIc11 =
|
||||||
objects::SPI_COM_IF, spiRtdIc11);
|
new Max31865PT1000Handler(objects::RTD_IC_14, objects::SPI_COM_IF, spiRtdIc11);
|
||||||
Max31865PT1000Handler* rtdIc12 = new Max31865PT1000Handler(objects::RTD_IC_15,
|
Max31865PT1000Handler* rtdIc12 =
|
||||||
objects::SPI_COM_IF, spiRtdIc12);
|
new Max31865PT1000Handler(objects::RTD_IC_15, objects::SPI_COM_IF, spiRtdIc12);
|
||||||
Max31865PT1000Handler* rtdIc13 = new Max31865PT1000Handler(objects::RTD_IC_16,
|
Max31865PT1000Handler* rtdIc13 =
|
||||||
objects::SPI_COM_IF, spiRtdIc13);
|
new Max31865PT1000Handler(objects::RTD_IC_16, objects::SPI_COM_IF, spiRtdIc13);
|
||||||
Max31865PT1000Handler* rtdIc14 = new Max31865PT1000Handler(objects::RTD_IC_17,
|
Max31865PT1000Handler* rtdIc14 =
|
||||||
objects::SPI_COM_IF, spiRtdIc14);
|
new Max31865PT1000Handler(objects::RTD_IC_17, objects::SPI_COM_IF, spiRtdIc14);
|
||||||
Max31865PT1000Handler* rtdIc15 = new Max31865PT1000Handler(objects::RTD_IC_18,
|
Max31865PT1000Handler* rtdIc15 =
|
||||||
objects::SPI_COM_IF, spiRtdIc15);
|
new Max31865PT1000Handler(objects::RTD_IC_18, objects::SPI_COM_IF, spiRtdIc15);
|
||||||
|
|
||||||
rtdIc0->setStartUpImmediately();
|
rtdIc0->setStartUpImmediately();
|
||||||
rtdIc1->setStartUpImmediately();
|
rtdIc1->setStartUpImmediately();
|
||||||
rtdIc2->setStartUpImmediately();
|
rtdIc2->setStartUpImmediately();
|
||||||
|
#if OBSW_DEBUG_RTD == 1
|
||||||
|
rtdIc0->setInstantNormal(true);
|
||||||
|
rtdIc1->setInstantNormal(true);
|
||||||
|
rtdIc2->setInstantNormal(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
static_cast<void>(rtdIc0);
|
static_cast<void>(rtdIc0);
|
||||||
static_cast<void>(rtdIc1);
|
static_cast<void>(rtdIc1);
|
||||||
@ -812,73 +817,64 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
std::stringstream consumer;
|
std::stringstream consumer;
|
||||||
GpiodRegularByLineName* gpio = nullptr;
|
GpiodRegularByLineName* gpio = nullptr;
|
||||||
consumer << "0x" << std::hex << objects::RW1;
|
consumer << "0x" << std::hex << objects::RW1;
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_1, consumer.str(), gpio::DIR_OUT,
|
gpio =
|
||||||
gpio::LOW);
|
new GpiodRegularByLineName(q7s::gpioNames::EN_RW_1, consumer.str(), gpio::DIR_OUT, gpio::LOW);
|
||||||
gpioCookieRw->addGpio(gpioIds::EN_RW1, gpio);
|
gpioCookieRw->addGpio(gpioIds::EN_RW1, gpio);
|
||||||
consumer.str("");
|
consumer.str("");
|
||||||
consumer << "0x" << std::hex << objects::RW2;
|
consumer << "0x" << std::hex << objects::RW2;
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_2, consumer.str(), gpio::DIR_OUT,
|
gpio =
|
||||||
gpio::LOW);
|
new GpiodRegularByLineName(q7s::gpioNames::EN_RW_2, consumer.str(), gpio::DIR_OUT, gpio::LOW);
|
||||||
gpioCookieRw->addGpio(gpioIds::EN_RW2, gpio);
|
gpioCookieRw->addGpio(gpioIds::EN_RW2, gpio);
|
||||||
consumer.str("");
|
consumer.str("");
|
||||||
consumer << "0x" << std::hex << objects::RW3;
|
consumer << "0x" << std::hex << objects::RW3;
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_3, consumer.str(), gpio::DIR_OUT,
|
gpio =
|
||||||
gpio::LOW);
|
new GpiodRegularByLineName(q7s::gpioNames::EN_RW_3, consumer.str(), gpio::DIR_OUT, gpio::LOW);
|
||||||
gpioCookieRw->addGpio(gpioIds::EN_RW3, gpio);
|
gpioCookieRw->addGpio(gpioIds::EN_RW3, gpio);
|
||||||
consumer.str("");
|
consumer.str("");
|
||||||
consumer << "0x" << std::hex << objects::RW4;
|
consumer << "0x" << std::hex << objects::RW4;
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_4, consumer.str(), gpio::DIR_OUT,
|
gpio =
|
||||||
gpio::LOW);
|
new GpiodRegularByLineName(q7s::gpioNames::EN_RW_4, consumer.str(), gpio::DIR_OUT, gpio::LOW);
|
||||||
gpioCookieRw->addGpio(gpioIds::EN_RW4, gpio);
|
gpioCookieRw->addGpio(gpioIds::EN_RW4, gpio);
|
||||||
|
|
||||||
/**
|
|
||||||
* This GPIO is only internally connected to the SPI MUX module and responsible to disconnect
|
|
||||||
* 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).
|
|
||||||
*/
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_SELECT,
|
|
||||||
"SPI Reaction Wheel Callback ", gpio::DIR_OUT, gpio::LOW);
|
|
||||||
gpioCookieRw->addGpio(gpioIds::SPI_MUX, gpio);
|
|
||||||
|
|
||||||
gpioComIF->addGpios(gpioCookieRw);
|
gpioComIF->addGpios(gpioCookieRw);
|
||||||
|
|
||||||
auto rw1SpiCookie = new SpiCookie(addresses::RW1, gpioIds::CS_RW1, q7s::SPI_RW_DEV,
|
auto rw1SpiCookie =
|
||||||
RwDefinitions::MAX_REPLY_SIZE, spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback,
|
new SpiCookie(addresses::RW1, gpioIds::CS_RW1, q7s::SPI_RW_DEV, RwDefinitions::MAX_REPLY_SIZE,
|
||||||
nullptr);
|
spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback, nullptr);
|
||||||
auto rw2SpiCookie = new SpiCookie(addresses::RW2, gpioIds::CS_RW2, q7s::SPI_RW_DEV,
|
auto rw2SpiCookie =
|
||||||
RwDefinitions::MAX_REPLY_SIZE, spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback,
|
new SpiCookie(addresses::RW2, gpioIds::CS_RW2, q7s::SPI_RW_DEV, RwDefinitions::MAX_REPLY_SIZE,
|
||||||
nullptr);
|
spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback, nullptr);
|
||||||
auto rw3SpiCookie = new SpiCookie(addresses::RW3, gpioIds::CS_RW3, q7s::SPI_RW_DEV,
|
auto rw3SpiCookie =
|
||||||
RwDefinitions::MAX_REPLY_SIZE, spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback,
|
new SpiCookie(addresses::RW3, gpioIds::CS_RW3, q7s::SPI_RW_DEV, RwDefinitions::MAX_REPLY_SIZE,
|
||||||
nullptr);
|
spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback, nullptr);
|
||||||
auto rw4SpiCookie = new SpiCookie(addresses::RW4, gpioIds::CS_RW4, q7s::SPI_RW_DEV,
|
auto rw4SpiCookie =
|
||||||
RwDefinitions::MAX_REPLY_SIZE, spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback,
|
new SpiCookie(addresses::RW4, gpioIds::CS_RW4, q7s::SPI_RW_DEV, RwDefinitions::MAX_REPLY_SIZE,
|
||||||
nullptr);
|
spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback, nullptr);
|
||||||
|
|
||||||
auto rwHandler1 = new RwHandler(objects::RW1, objects::SPI_COM_IF, rw1SpiCookie, gpioComIF,
|
auto rwHandler1 =
|
||||||
gpioIds::EN_RW1);
|
new RwHandler(objects::RW1, objects::SPI_COM_IF, rw1SpiCookie, gpioComIF, gpioIds::EN_RW1);
|
||||||
#if OBSW_DEBUG_RW == 1
|
#if OBSW_DEBUG_RW == 1
|
||||||
rwHandler1->setStartUpImmediately();
|
rwHandler1->setStartUpImmediately();
|
||||||
#endif
|
#endif
|
||||||
rw1SpiCookie->setCallbackArgs(rwHandler1);
|
rw1SpiCookie->setCallbackArgs(rwHandler1);
|
||||||
rwHandler1->setStartUpImmediately();
|
rwHandler1->setStartUpImmediately();
|
||||||
|
|
||||||
auto rwHandler2 = new RwHandler(objects::RW2, objects::SPI_COM_IF, rw2SpiCookie, gpioComIF,
|
auto rwHandler2 =
|
||||||
gpioIds::EN_RW2);
|
new RwHandler(objects::RW2, objects::SPI_COM_IF, rw2SpiCookie, gpioComIF, gpioIds::EN_RW2);
|
||||||
#if OBSW_DEBUG_RW == 1
|
#if OBSW_DEBUG_RW == 1
|
||||||
rwHandler2->setStartUpImmediately();
|
rwHandler2->setStartUpImmediately();
|
||||||
#endif
|
#endif
|
||||||
rw2SpiCookie->setCallbackArgs(rwHandler2);
|
rw2SpiCookie->setCallbackArgs(rwHandler2);
|
||||||
|
|
||||||
auto rwHandler3 = new RwHandler(objects::RW3, objects::SPI_COM_IF, rw3SpiCookie, gpioComIF,
|
auto rwHandler3 =
|
||||||
gpioIds::EN_RW3);
|
new RwHandler(objects::RW3, objects::SPI_COM_IF, rw3SpiCookie, gpioComIF, gpioIds::EN_RW3);
|
||||||
#if OBSW_DEBUG_RW == 1
|
#if OBSW_DEBUG_RW == 1
|
||||||
rwHandler3->setStartUpImmediately();
|
rwHandler3->setStartUpImmediately();
|
||||||
#endif
|
#endif
|
||||||
rw3SpiCookie->setCallbackArgs(rwHandler3);
|
rw3SpiCookie->setCallbackArgs(rwHandler3);
|
||||||
|
|
||||||
auto rwHandler4 = new RwHandler(objects::RW4, objects::SPI_COM_IF, rw4SpiCookie, gpioComIF,
|
auto rwHandler4 =
|
||||||
gpioIds::EN_RW4);
|
new RwHandler(objects::RW4, objects::SPI_COM_IF, rw4SpiCookie, gpioComIF, gpioIds::EN_RW4);
|
||||||
#if OBSW_DEBUG_RW == 1
|
#if OBSW_DEBUG_RW == 1
|
||||||
rwHandler4->setStartUpImmediately();
|
rwHandler4->setStartUpImmediately();
|
||||||
#endif
|
#endif
|
||||||
@ -952,9 +948,9 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) {
|
|||||||
|
|
||||||
TxRateSetterIF* txRateSetterIF = new PtmeRateSetter(gpioIds::BIT_RATE_SEL, gpioComIF);
|
TxRateSetterIF* txRateSetterIF = new PtmeRateSetter(gpioIds::BIT_RATE_SEL, gpioComIF);
|
||||||
|
|
||||||
CCSDSHandler* ccsdsHandler = new CCSDSHandler(objects::CCSDS_HANDLER, objects::PTME,
|
CCSDSHandler* ccsdsHandler = new CCSDSHandler(
|
||||||
objects::CCSDS_PACKET_DISTRIBUTOR, txRateSetterIF, gpioComIF,
|
objects::CCSDS_HANDLER, objects::PTME, objects::CCSDS_PACKET_DISTRIBUTOR, txRateSetterIF,
|
||||||
gpioIds::RS485_EN_TX_CLOCK, gpioIds::RS485_EN_TX_DATA);
|
gpioComIF, gpioIds::RS485_EN_TX_CLOCK, gpioIds::RS485_EN_TX_DATA);
|
||||||
|
|
||||||
VirtualChannel* vc = nullptr;
|
VirtualChannel* vc = nullptr;
|
||||||
vc = new VirtualChannel(ccsds::VC0, common::VC0_QUEUE_SIZE);
|
vc = new VirtualChannel(ccsds::VC0, common::VC0_QUEUE_SIZE);
|
||||||
@ -1002,7 +998,6 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
|
void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
|
||||||
|
|
||||||
#if BOARD_TE0720 == 0
|
#if BOARD_TE0720 == 0
|
||||||
new Q7STestTask(objects::TEST_TASK);
|
new Q7STestTask(objects::TEST_TASK);
|
||||||
#endif
|
#endif
|
||||||
@ -1012,8 +1007,8 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
/* Configure MIO0 as input */
|
/* Configure MIO0 as input */
|
||||||
GpiodRegular* testGpio = new GpiodRegular("MIO0", gpio::DIR_OUT, 0, "/amba_pl/gpio@41200000", 0);
|
GpiodRegular* testGpio = new GpiodRegular("MIO0", gpio::DIR_OUT, 0, "/amba_pl/gpio@41200000", 0);
|
||||||
#elif OBSW_TEST_GPIO_OPEN_BY_LINE_NAME
|
#elif OBSW_TEST_GPIO_OPEN_BY_LINE_NAME
|
||||||
GpiodRegularByLineName* testGpio = new GpiodRegularByLineName("test-name", "gpio-test",
|
GpiodRegularByLineName* testGpio =
|
||||||
gpio::DIR_OUT, 0);
|
new GpiodRegularByLineName("test-name", "gpio-test", gpio::DIR_OUT, 0);
|
||||||
#else
|
#else
|
||||||
/* Configure MIO0 as input */
|
/* Configure MIO0 as input */
|
||||||
GpiodRegular* testGpio = new GpiodRegular("gpiochip0", 0, "MIO0", gpio::IN, 0);
|
GpiodRegular* testGpio = new GpiodRegular("gpiochip0", 0, "MIO0", gpio::IN, 0);
|
||||||
@ -1025,24 +1020,25 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
|
|
||||||
#if BOARD_TE0720 == 1 && OBSW_TEST_SUS_HANDLER == 1
|
#if BOARD_TE0720 == 1 && OBSW_TEST_SUS_HANDLER == 1
|
||||||
GpioCookie* gpioCookieSus = new GpioCookie;
|
GpioCookie* gpioCookieSus = new GpioCookie;
|
||||||
GpiodRegular* chipSelectSus = new GpiodRegular(std::string("gpiochip1"), 9,
|
GpiodRegular* chipSelectSus = new GpiodRegular(
|
||||||
std::string("Chip Select Sus Sensor"), gpio::DIR_OUT, 1);
|
std::string("gpiochip1"), 9, std::string("Chip Select Sus Sensor"), gpio::DIR_OUT, 1);
|
||||||
gpioCookieSus->addGpio(gpioIds::CS_SUS_1, chipSelectSus);
|
gpioCookieSus->addGpio(gpioIds::CS_SUS_1, chipSelectSus);
|
||||||
gpioComIF->addGpios(gpioCookieSus);
|
gpioComIF->addGpios(gpioCookieSus);
|
||||||
|
|
||||||
SpiCookie* spiCookieSus = new SpiCookie(addresses::SUS_1, std::string("/dev/spidev1.0"),
|
SpiCookie* spiCookieSus =
|
||||||
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
new SpiCookie(addresses::SUS_1, std::string("/dev/spidev1.0"), SUS::MAX_CMD_SIZE,
|
||||||
|
spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
||||||
|
|
||||||
new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus, gpioComIF,
|
new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus, gpioComIF, gpioIds::CS_SUS_1);
|
||||||
gpioIds::CS_SUS_1);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BOARD_TE0720 == 1 && OBSW_TEST_CCSDS_BRIDGE == 1
|
#if BOARD_TE0720 == 1 && OBSW_TEST_CCSDS_BRIDGE == 1
|
||||||
GpioCookie* gpioCookieCcsdsIp = new GpioCookie;
|
GpioCookie* gpioCookieCcsdsIp = new GpioCookie;
|
||||||
GpiodRegular* papbBusyN = new GpiodRegular(std::string("gpiochip0"), 0, std::string("PAPBBusy_VC0"));
|
GpiodRegular* papbBusyN =
|
||||||
|
new GpiodRegular(std::string("gpiochip0"), 0, std::string("PAPBBusy_VC0"));
|
||||||
gpioCookieCcsdsIp->addGpio(gpioIds::PAPB_BUSY_N, papbBusyN);
|
gpioCookieCcsdsIp->addGpio(gpioIds::PAPB_BUSY_N, papbBusyN);
|
||||||
GpiodRegular* papbEmpty = new GpiodRegular(std::string("gpiochip0"), 1,
|
GpiodRegular* papbEmpty =
|
||||||
std::string("PAPBEmpty_VC0"));
|
new GpiodRegular(std::string("gpiochip0"), 1, std::string("PAPBEmpty_VC0"));
|
||||||
gpioCookieCcsdsIp->addGpio(gpioIds::PAPB_EMPTY, papbEmpty);
|
gpioCookieCcsdsIp->addGpio(gpioIds::PAPB_EMPTY, papbEmpty);
|
||||||
gpioComIF->addGpios(gpioCookieCcsdsIp);
|
gpioComIF->addGpios(gpioCookieCcsdsIp);
|
||||||
|
|
||||||
@ -1053,32 +1049,33 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
|
|
||||||
#if BOARD_TE0720 == 1 && OBSW_TEST_RADIATION_SENSOR_HANDLER == 1
|
#if BOARD_TE0720 == 1 && OBSW_TEST_RADIATION_SENSOR_HANDLER == 1
|
||||||
GpioCookie* gpioCookieRadSensor = new GpioCookie;
|
GpioCookie* gpioCookieRadSensor = new GpioCookie;
|
||||||
GpiodRegular* chipSelectRadSensor = new GpiodRegular(std::string("gpiochip1"), 0,
|
GpiodRegular* chipSelectRadSensor = new GpiodRegular(
|
||||||
std::string("Chip select radiation sensor"), gpio::DIR_OUT, 1);
|
std::string("gpiochip1"), 0, std::string("Chip select radiation sensor"), gpio::DIR_OUT, 1);
|
||||||
gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor);
|
gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor);
|
||||||
gpioComIF->addGpios(gpioCookieRadSensor);
|
gpioComIF->addGpios(gpioCookieRadSensor);
|
||||||
|
|
||||||
SpiCookie* spiCookieRadSensor = new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR,
|
SpiCookie* spiCookieRadSensor =
|
||||||
std::string("/dev/spidev1.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR, std::string("/dev/spidev1.0"),
|
||||||
spi::DEFAULT_MAX_1227_SPEED);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
||||||
|
|
||||||
RadiationSensorHandler* radSensor = new RadiationSensorHandler(objects::RAD_SENSOR,
|
RadiationSensorHandler* radSensor =
|
||||||
objects::SPI_COM_IF, spiCookieRadSensor);
|
new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor);
|
||||||
radSensor->setStartUpImmediately();
|
radSensor->setStartUpImmediately();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BOARD_TE0720 == 1 && OBSW_ADD_PLOC_MPSOC == 1
|
#if BOARD_TE0720 == 1 && OBSW_ADD_PLOC_MPSOC == 1
|
||||||
UartCookie* plocUartCookie = new UartCookie(std::string("/dev/ttyPS1"), 115200,
|
UartCookie* plocUartCookie =
|
||||||
PLOC_MPSOC::MAX_REPLY_SIZE);
|
new UartCookie(std::string("/dev/ttyPS1"), 115200, PLOC_MPSOC::MAX_REPLY_SIZE);
|
||||||
/* Testing PlocMPSoCHandler on TE0720-03-1CFA */
|
/* Testing PlocMPSoCHandler on TE0720-03-1CFA */
|
||||||
PlocMPSoCHandler* mpsocPlocHandler = new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF,
|
PlocMPSoCHandler* mpsocPlocHandler =
|
||||||
plocUartCookie);
|
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, plocUartCookie);
|
||||||
mpsocPlocHandler->setStartUpImmediately();
|
mpsocPlocHandler->setStartUpImmediately();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BOARD_TE0720 == 1 && OBSW_TEST_TE7020_HEATER == 1
|
#if BOARD_TE0720 == 1 && OBSW_TEST_TE7020_HEATER == 1
|
||||||
/* Configuration for MIO0 on TE0720-03-1CFA */
|
/* Configuration for MIO0 on TE0720-03-1CFA */
|
||||||
GpiodRegular* heaterGpio = new GpiodRegular(std::string("gpiochip0"), 0, std::string("MIO0"), gpio::IN, 0);
|
GpiodRegular* heaterGpio =
|
||||||
|
new GpiodRegular(std::string("gpiochip0"), 0, std::string("MIO0"), gpio::IN, 0);
|
||||||
GpioCookie* gpioCookie = new GpioCookie;
|
GpioCookie* gpioCookie = new GpioCookie;
|
||||||
gpioCookie->addGpio(gpioIds::HEATER_0, heaterGpio);
|
gpioCookie->addGpio(gpioIds::HEATER_0, heaterGpio);
|
||||||
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER,
|
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER,
|
||||||
@ -1087,9 +1084,9 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
|
|
||||||
#if BOARD_TE0720 == 1 && OBSW_ADD_PLOC_SUPERVISOR == 1
|
#if BOARD_TE0720 == 1 && OBSW_ADD_PLOC_SUPERVISOR == 1
|
||||||
/* Configuration for MIO0 on TE0720-03-1CFA */
|
/* Configuration for MIO0 on TE0720-03-1CFA */
|
||||||
UartCookie* plocSupervisorCookie = new UartCookie(objects::PLOC_SUPERVISOR_HANDLER,
|
UartCookie* plocSupervisorCookie =
|
||||||
std::string("/dev/ttyPS1"), UartModes::NON_CANONICAL, 115200,
|
new UartCookie(objects::PLOC_SUPERVISOR_HANDLER, std::string("/dev/ttyPS1"),
|
||||||
PLOC_SPV::MAX_PACKET_SIZE * 20);
|
UartModes::NON_CANONICAL, 115200, PLOC_SPV::MAX_PACKET_SIZE * 20);
|
||||||
plocSupervisorCookie->setNoFixedSizeReply();
|
plocSupervisorCookie->setNoFixedSizeReply();
|
||||||
PlocSupervisorHandler* plocSupervisor = new PlocSupervisorHandler(
|
PlocSupervisorHandler* plocSupervisor = new PlocSupervisorHandler(
|
||||||
objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, plocSupervisorCookie);
|
objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, plocSupervisorCookie);
|
||||||
@ -1099,5 +1096,4 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
#if OBSW_ADD_SPI_TEST_CODE == 1
|
#if OBSW_ADD_SPI_TEST_CODE == 1
|
||||||
new SpiTestClass(objects::SPI_TEST, gpioComIF);
|
new SpiTestClass(objects::SPI_TEST, gpioComIF);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,6 @@ void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF);
|
|||||||
void createCcsdsComponents(LinuxLibgpioIF* gpioComIF);
|
void createCcsdsComponents(LinuxLibgpioIF* gpioComIF);
|
||||||
void createTestComponents(LinuxLibgpioIF* gpioComIF);
|
void createTestComponents(LinuxLibgpioIF* gpioComIF);
|
||||||
|
|
||||||
};
|
}; // namespace ObjectFactory
|
||||||
|
|
||||||
#endif /* BSP_Q7S_OBJECTFACTORY_H_ */
|
#endif /* BSP_Q7S_OBJECTFACTORY_H_ */
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
#include "ParameterHandler.h"
|
#include "ParameterHandler.h"
|
||||||
|
|
||||||
ParameterHandler::ParameterHandler(std::string mountPrefix): mountPrefix(mountPrefix) {
|
ParameterHandler::ParameterHandler(std::string mountPrefix) : mountPrefix(mountPrefix) {}
|
||||||
}
|
|
||||||
|
|
||||||
void ParameterHandler::setMountPrefix(std::string prefix) {
|
void ParameterHandler::setMountPrefix(std::string prefix) { mountPrefix = prefix; }
|
||||||
mountPrefix = prefix;
|
|
||||||
}
|
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ParameterHandler {
|
class ParameterHandler {
|
||||||
public:
|
public:
|
||||||
ParameterHandler(std::string mountPrefix);
|
ParameterHandler(std::string mountPrefix);
|
||||||
@ -13,10 +11,10 @@ public:
|
|||||||
void setMountPrefix(std::string prefix);
|
void setMountPrefix(std::string prefix);
|
||||||
|
|
||||||
void setUpDummyParameter();
|
void setUpDummyParameter();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string mountPrefix;
|
std::string mountPrefix;
|
||||||
DummyParameter dummyParam;
|
DummyParameter dummyParam;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* BSP_Q7S_CORE_PARAMETERHANDLER_H_ */
|
#endif /* BSP_Q7S_CORE_PARAMETERHANDLER_H_ */
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#include "obsw.h"
|
#include "obsw.h"
|
||||||
#include "OBSWVersion.h"
|
|
||||||
#include "OBSWConfig.h"
|
|
||||||
#include "InitMission.h"
|
|
||||||
#include "watchdogConf.h"
|
|
||||||
|
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
|
||||||
#include "fsfw/FSFWVersion.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "InitMission.h"
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "OBSWVersion.h"
|
||||||
|
#include "fsfw/FSFWVersion.h"
|
||||||
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
#include "watchdogConf.h"
|
||||||
|
|
||||||
static int OBSW_ALREADY_RUNNING = -2;
|
static int OBSW_ALREADY_RUNNING = -2;
|
||||||
|
|
||||||
@ -19,17 +19,18 @@ int obsw::obsw() {
|
|||||||
#else
|
#else
|
||||||
std::cout << "-- Compiled for Linux (TE0720) --" << std::endl;
|
std::cout << "-- Compiled for Linux (TE0720) --" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
std::cout << "-- OBSW v" << SW_VERSION << "." << SW_SUBVERSION <<
|
std::cout << "-- OBSW v" << SW_VERSION << "." << SW_SUBVERSION << "." << SW_REVISION << ", FSFW v"
|
||||||
"." << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << "." <<
|
<< FSFW_VERSION << "." << FSFW_SUBVERSION << "." << FSFW_REVISION << "--" << std::endl;
|
||||||
FSFW_REVISION << "--" << std::endl;
|
|
||||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||||
|
|
||||||
#if Q7S_CHECK_FOR_ALREADY_RUNNING_IMG == 1
|
#if Q7S_CHECK_FOR_ALREADY_RUNNING_IMG == 1
|
||||||
// Check special file here. This file is created or deleted by the eive-watchdog application
|
// Check special file here. This file is created or deleted by the eive-watchdog application
|
||||||
// or systemd service!
|
// or systemd service!
|
||||||
if (std::filesystem::exists(watchdog::RUNNING_FILE_NAME)) {
|
if (std::filesystem::exists(watchdog::RUNNING_FILE_NAME)) {
|
||||||
sif::warning << "File " << watchdog::RUNNING_FILE_NAME << " exists so the software might "
|
sif::warning << "File " << watchdog::RUNNING_FILE_NAME
|
||||||
"already be running. Aborting.." << std::endl;
|
<< " exists so the software might "
|
||||||
|
"already be running. Aborting.."
|
||||||
|
<< std::endl;
|
||||||
return OBSW_ALREADY_RUNNING;
|
return OBSW_ALREADY_RUNNING;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,3 +3,5 @@ target_sources(${TARGET_NAME} PRIVATE
|
|||||||
PlocUpdater.cpp
|
PlocUpdater.cpp
|
||||||
PlocMemoryDumper.cpp
|
PlocMemoryDumper.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_subdirectory(startracker)
|
@ -1,21 +1,21 @@
|
|||||||
#include <fsfw/src/fsfw/serialize/SerializeAdapter.h>
|
|
||||||
#include "fsfw/ipc/QueueFactory.h"
|
|
||||||
#include "PlocMemoryDumper.h"
|
#include "PlocMemoryDumper.h"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fsfw/src/fsfw/serialize/SerializeAdapter.h>
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
PlocMemoryDumper::PlocMemoryDumper(object_id_t objectId) :
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
SystemObject(objectId), commandActionHelper(this), actionHelper(this, nullptr) {
|
|
||||||
|
PlocMemoryDumper::PlocMemoryDumper(object_id_t objectId)
|
||||||
|
: SystemObject(objectId), commandActionHelper(this), actionHelper(this, nullptr) {
|
||||||
commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE);
|
commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlocMemoryDumper::~PlocMemoryDumper() {
|
PlocMemoryDumper::~PlocMemoryDumper() {}
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t PlocMemoryDumper::initialize() {
|
ReturnValue_t PlocMemoryDumper::initialize() {
|
||||||
|
|
||||||
ReturnValue_t result = SystemObject::initialize();
|
ReturnValue_t result = SystemObject::initialize();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
@ -38,9 +38,8 @@ ReturnValue_t PlocMemoryDumper::performOperation(uint8_t operationCode) {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMemoryDumper::executeAction(ActionId_t actionId,
|
ReturnValue_t PlocMemoryDumper::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
MessageQueueId_t commandedBy, const uint8_t* data, size_t size) {
|
const uint8_t* data, size_t size) {
|
||||||
|
|
||||||
if (state != State::IDLE) {
|
if (state != State::IDLE) {
|
||||||
return IS_BUSY;
|
return IS_BUSY;
|
||||||
}
|
}
|
||||||
@ -71,13 +70,9 @@ ReturnValue_t PlocMemoryDumper::executeAction(ActionId_t actionId,
|
|||||||
return EXECUTION_FINISHED;
|
return EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageQueueId_t PlocMemoryDumper::getCommandQueue() const {
|
MessageQueueId_t PlocMemoryDumper::getCommandQueue() const { return commandQueue->getId(); }
|
||||||
return commandQueue->getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageQueueIF* PlocMemoryDumper::getCommandQueuePtr() {
|
MessageQueueIF* PlocMemoryDumper::getCommandQueuePtr() { return commandQueue; }
|
||||||
return commandQueue;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlocMemoryDumper::readCommandQueue() {
|
void PlocMemoryDumper::readCommandQueue() {
|
||||||
CommandMessage message;
|
CommandMessage message;
|
||||||
@ -121,17 +116,12 @@ void PlocMemoryDumper::doStateMachine() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocMemoryDumper::stepSuccessfulReceived(ActionId_t actionId,
|
void PlocMemoryDumper::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) {}
|
||||||
uint8_t step) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlocMemoryDumper::stepFailedReceived(ActionId_t actionId, uint8_t step,
|
void PlocMemoryDumper::stepFailedReceived(ActionId_t actionId, uint8_t step,
|
||||||
ReturnValue_t returnCode) {
|
ReturnValue_t returnCode) {}
|
||||||
}
|
|
||||||
|
|
||||||
void PlocMemoryDumper::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {
|
void PlocMemoryDumper::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlocMemoryDumper::completionSuccessfulReceived(ActionId_t actionId) {
|
void PlocMemoryDumper::completionSuccessfulReceived(ActionId_t actionId) {
|
||||||
switch (pendingCommand) {
|
switch (pendingCommand) {
|
||||||
@ -140,8 +130,7 @@ void PlocMemoryDumper::completionSuccessfulReceived(ActionId_t actionId) {
|
|||||||
if (mram.endAddress == mram.startAddress) {
|
if (mram.endAddress == mram.startAddress) {
|
||||||
triggerEvent(MRAM_DUMP_FINISHED);
|
triggerEvent(MRAM_DUMP_FINISHED);
|
||||||
state = State::IDLE;
|
state = State::IDLE;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
state = State::COMMAND_CONSECUTIVE_MRAM_DUMP;
|
state = State::COMMAND_CONSECUTIVE_MRAM_DUMP;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -153,8 +142,7 @@ void PlocMemoryDumper::completionSuccessfulReceived(ActionId_t actionId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocMemoryDumper::completionFailedReceived(ActionId_t actionId,
|
void PlocMemoryDumper::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) {
|
||||||
ReturnValue_t returnCode) {
|
|
||||||
switch (pendingCommand) {
|
switch (pendingCommand) {
|
||||||
case (PLOC_SPV::FIRST_MRAM_DUMP):
|
case (PLOC_SPV::FIRST_MRAM_DUMP):
|
||||||
case (PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
|
case (PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
|
||||||
@ -179,8 +167,7 @@ void PlocMemoryDumper::commandNextMramDump(ActionId_t dumpCommand) {
|
|||||||
tempEndAddress = mram.startAddress + MAX_MRAM_DUMP_SIZE;
|
tempEndAddress = mram.startAddress + MAX_MRAM_DUMP_SIZE;
|
||||||
mram.startAddress += MAX_MRAM_DUMP_SIZE;
|
mram.startAddress += MAX_MRAM_DUMP_SIZE;
|
||||||
mram.lastStartAddress = tempStartAddress;
|
mram.lastStartAddress = tempStartAddress;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
tempStartAddress = mram.startAddress;
|
tempStartAddress = mram.startAddress;
|
||||||
tempEndAddress = mram.endAddress;
|
tempEndAddress = mram.endAddress;
|
||||||
mram.startAddress = mram.endAddress;
|
mram.startAddress = mram.endAddress;
|
||||||
@ -188,8 +175,8 @@ void PlocMemoryDumper::commandNextMramDump(ActionId_t dumpCommand) {
|
|||||||
|
|
||||||
MemoryParams params(tempStartAddress, tempEndAddress);
|
MemoryParams params(tempStartAddress, tempEndAddress);
|
||||||
|
|
||||||
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
result =
|
||||||
dumpCommand, ¶ms);
|
commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, dumpCommand, ¶ms);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning << "PlocMemoryDumper::commandNextMramDump: Failed to send mram dump command "
|
sif::warning << "PlocMemoryDumper::commandNextMramDump: Failed to send mram dump command "
|
||||||
<< "with start address " << tempStartAddress << " and end address "
|
<< "with start address " << tempStartAddress << " and end address "
|
||||||
@ -203,4 +190,3 @@ void PlocMemoryDumper::commandNextMramDump(ActionId_t dumpCommand) {
|
|||||||
pendingCommand = dumpCommand;
|
pendingCommand = dumpCommand;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,18 +3,18 @@
|
|||||||
|
|
||||||
#include <bsp_q7s/devices/devicedefinitions/PlocMemDumpDefinitions.h>
|
#include <bsp_q7s/devices/devicedefinitions/PlocMemDumpDefinitions.h>
|
||||||
#include <bsp_q7s/devices/devicedefinitions/PlocSupervisorDefinitions.h>
|
#include <bsp_q7s/devices/devicedefinitions/PlocSupervisorDefinitions.h>
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
#include "fsfw/action/CommandActionHelper.h"
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
#include "fsfw/action/ActionHelper.h"
|
#include "fsfw/action/ActionHelper.h"
|
||||||
#include "fsfw/action/HasActionsIF.h"
|
#include "fsfw/action/CommandActionHelper.h"
|
||||||
#include "fsfw/action/CommandsActionsIF.h"
|
#include "fsfw/action/CommandsActionsIF.h"
|
||||||
|
#include "fsfw/action/HasActionsIF.h"
|
||||||
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
#include "fsfw/tasks/ExecutableObjectIF.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"
|
#include "fsfw/tmtcpacket/SpacePacket.h"
|
||||||
|
#include "linux/fsfwconfig/objects/systemObjectList.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Because the buffer of the linux tty driver is limited to 2 x 65535 bytes, this class is
|
* @brief Because the buffer of the linux tty driver is limited to 2 x 65535 bytes, this class is
|
||||||
@ -30,7 +30,6 @@ class PlocMemoryDumper : public SystemObject,
|
|||||||
public HasReturnvaluesIF,
|
public HasReturnvaluesIF,
|
||||||
public CommandsActionsIF {
|
public CommandsActionsIF {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static const ActionId_t NONE = 0;
|
static const ActionId_t NONE = 0;
|
||||||
static const ActionId_t DUMP_MRAM = 1;
|
static const ActionId_t DUMP_MRAM = 1;
|
||||||
|
|
||||||
@ -50,12 +49,12 @@ public:
|
|||||||
void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) override;
|
void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static const uint32_t QUEUE_SIZE = 10;
|
static const uint32_t QUEUE_SIZE = 10;
|
||||||
|
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_MEMORY_DUMPER;
|
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.
|
//! [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);
|
static const ReturnValue_t MRAM_ADDRESS_TOO_HIGH = MAKE_RETURN_CODE(0xA0);
|
||||||
//! [EXPORT] : [COMMENT] The specified end address is lower than the start address
|
//! [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 ReturnValue_t MRAM_INVALID_ADDRESS_COMBINATION = MAKE_RETURN_CODE(0xA1);
|
||||||
|
@ -1,26 +1,28 @@
|
|||||||
#include <sstream>
|
|
||||||
#include <string>
|
|
||||||
#include <fstream>
|
|
||||||
#include <filesystem>
|
|
||||||
|
|
||||||
#include "PlocSupervisorHandler.h"
|
#include "PlocSupervisorHandler.h"
|
||||||
#include "OBSWConfig.h"
|
|
||||||
|
|
||||||
#include <fsfw/globalfunctions/CRC.h>
|
|
||||||
#include <fsfw/datapool/PoolReadGuard.h>
|
#include <fsfw/datapool/PoolReadGuard.h>
|
||||||
|
#include <fsfw/globalfunctions/CRC.h>
|
||||||
#include <fsfw/timemanager/Clock.h>
|
#include <fsfw/timemanager/Clock.h>
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
|
||||||
PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid,
|
PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid,
|
||||||
CookieIF * comCookie) :
|
CookieIF* comCookie)
|
||||||
DeviceHandlerBase(objectId, uartComIFid, comCookie), hkset(this), bootStatusReport(this), latchupStatusReport(
|
: DeviceHandlerBase(objectId, uartComIFid, comCookie),
|
||||||
this) {
|
hkset(this),
|
||||||
|
bootStatusReport(this),
|
||||||
|
latchupStatusReport(this) {
|
||||||
if (comCookie == NULL) {
|
if (comCookie == NULL) {
|
||||||
sif::error << "PlocSupervisorHandler: Invalid com cookie" << std::endl;
|
sif::error << "PlocSupervisorHandler: Invalid com cookie" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlocSupervisorHandler::~PlocSupervisorHandler() {
|
PlocSupervisorHandler::~PlocSupervisorHandler() {}
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::initialize() {
|
ReturnValue_t PlocSupervisorHandler::initialize() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
@ -41,7 +43,6 @@ ReturnValue_t PlocSupervisorHandler::initialize() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PlocSupervisorHandler::doStartUp() {
|
void PlocSupervisorHandler::doStartUp() {
|
||||||
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
|
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
|
||||||
setMode(MODE_NORMAL);
|
setMode(MODE_NORMAL);
|
||||||
@ -50,22 +51,18 @@ void PlocSupervisorHandler::doStartUp(){
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::doShutDown(){
|
void PlocSupervisorHandler::doShutDown() { setMode(_MODE_POWER_DOWN); }
|
||||||
setMode(_MODE_POWER_DOWN);
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::buildNormalDeviceCommand(
|
ReturnValue_t PlocSupervisorHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
||||||
DeviceCommandId_t * id) {
|
|
||||||
return NOTHING_TO_SEND;
|
return NOTHING_TO_SEND;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::buildTransitionDeviceCommand(
|
ReturnValue_t PlocSupervisorHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
||||||
DeviceCommandId_t * id){
|
|
||||||
return NOTHING_TO_SEND;
|
return NOTHING_TO_SEND;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(
|
ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
DeviceCommandId_t deviceCommand, const uint8_t * commandData,
|
const uint8_t* commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
ReturnValue_t result = RETURN_FAILED;
|
ReturnValue_t result = RETURN_FAILED;
|
||||||
switch (deviceCommand) {
|
switch (deviceCommand) {
|
||||||
@ -330,14 +327,12 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
|||||||
PLOC_SPV::SIZE_LATCHUP_STATUS_REPORT);
|
PLOC_SPV::SIZE_LATCHUP_STATUS_REPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t *start,
|
ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
||||||
size_t remainingSize, DeviceCommandId_t *foundId, size_t *foundLen) {
|
DeviceCommandId_t* foundId, size_t* foundLen) {
|
||||||
|
|
||||||
if (nextReplyId == PLOC_SPV::FIRST_MRAM_DUMP) {
|
if (nextReplyId == PLOC_SPV::FIRST_MRAM_DUMP) {
|
||||||
*foundId = PLOC_SPV::FIRST_MRAM_DUMP;
|
*foundId = PLOC_SPV::FIRST_MRAM_DUMP;
|
||||||
return parseMramPackets(start, remainingSize, foundLen);
|
return parseMramPackets(start, remainingSize, foundLen);
|
||||||
}
|
} else if (nextReplyId == PLOC_SPV::CONSECUTIVE_MRAM_DUMP) {
|
||||||
else if (nextReplyId == PLOC_SPV::CONSECUTIVE_MRAM_DUMP) {
|
|
||||||
*foundId = PLOC_SPV::CONSECUTIVE_MRAM_DUMP;
|
*foundId = PLOC_SPV::CONSECUTIVE_MRAM_DUMP;
|
||||||
return parseMramPackets(start, remainingSize, foundLen);
|
return parseMramPackets(start, remainingSize, foundLen);
|
||||||
}
|
}
|
||||||
@ -387,7 +382,6 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t *start,
|
|||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||||
const uint8_t* packet) {
|
const uint8_t* packet) {
|
||||||
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
@ -416,7 +410,8 @@ ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
sif::debug << "PlocSupervisorHandler::interpretDeviceReply: Unknown device reply id" << std::endl;
|
sif::debug << "PlocSupervisorHandler::interpretDeviceReply: Unknown device reply id"
|
||||||
|
<< std::endl;
|
||||||
return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY;
|
return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -424,17 +419,12 @@ ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::setNormalDatapoolEntriesInvalid(){
|
void PlocSupervisorHandler::setNormalDatapoolEntriesInvalid() {}
|
||||||
|
|
||||||
}
|
uint32_t PlocSupervisorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
|
||||||
|
|
||||||
uint32_t PlocSupervisorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo){
|
|
||||||
return 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) {
|
LocalDataPoolManager& poolManager) {
|
||||||
|
|
||||||
localDataPoolMap.emplace(PLOC_SPV::NUM_TMS, new PoolEntry<uint32_t>({0}));
|
localDataPoolMap.emplace(PLOC_SPV::NUM_TMS, new PoolEntry<uint32_t>({0}));
|
||||||
localDataPoolMap.emplace(PLOC_SPV::TEMP_PS, new PoolEntry<uint32_t>({0}));
|
localDataPoolMap.emplace(PLOC_SPV::TEMP_PS, new PoolEntry<uint32_t>({0}));
|
||||||
localDataPoolMap.emplace(PLOC_SPV::TEMP_PL, new PoolEntry<uint32_t>({0}));
|
localDataPoolMap.emplace(PLOC_SPV::TEMP_PL, new PoolEntry<uint32_t>({0}));
|
||||||
@ -478,9 +468,9 @@ ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::iterator command,
|
ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::iterator command,
|
||||||
uint8_t expectedReplies, bool useAlternateId,
|
uint8_t expectedReplies,
|
||||||
|
bool useAlternateId,
|
||||||
DeviceCommandId_t alternateReplyID) {
|
DeviceCommandId_t alternateReplyID) {
|
||||||
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
uint8_t enabledReplies = 0;
|
uint8_t enabledReplies = 0;
|
||||||
@ -585,15 +575,15 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
|
|||||||
* Every command causes at least one acknowledgment and one execution report. Therefore both
|
* Every command causes at least one acknowledgment and one execution report. Therefore both
|
||||||
* replies will be enabled here.
|
* replies will be enabled here.
|
||||||
*/
|
*/
|
||||||
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
result =
|
||||||
PLOC_SPV::ACK_REPORT);
|
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, PLOC_SPV::ACK_REPORT);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
|
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
|
||||||
<< PLOC_SPV::ACK_REPORT << " not in replyMap" << std::endl;
|
<< PLOC_SPV::ACK_REPORT << " not in replyMap" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
result =
|
||||||
PLOC_SPV::EXE_REPORT);
|
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, PLOC_SPV::EXE_REPORT);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
|
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
|
||||||
<< PLOC_SPV::EXE_REPORT << " not in replyMap" << std::endl;
|
<< PLOC_SPV::EXE_REPORT << " not in replyMap" << std::endl;
|
||||||
@ -603,7 +593,6 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::verifyPacket(const uint8_t* start, size_t foundLen) {
|
ReturnValue_t PlocSupervisorHandler::verifyPacket(const uint8_t* start, size_t foundLen) {
|
||||||
|
|
||||||
uint16_t receivedCrc = *(start + foundLen - 2) << 8 | *(start + foundLen - 1);
|
uint16_t receivedCrc = *(start + foundLen - 2) << 8 | *(start + foundLen - 1);
|
||||||
|
|
||||||
uint16_t recalculatedCrc = CRC::crc16ccitt(start, foundLen - 2);
|
uint16_t recalculatedCrc = CRC::crc16ccitt(start, foundLen - 2);
|
||||||
@ -616,7 +605,6 @@ ReturnValue_t PlocSupervisorHandler::verifyPacket(const uint8_t* start, size_t f
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
|
ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
|
||||||
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
result = verifyPacket(data, PLOC_SPV::SIZE_ACK_REPORT);
|
result = verifyPacket(data, PLOC_SPV::SIZE_ACK_REPORT);
|
||||||
@ -635,7 +623,8 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
|
|||||||
switch (apid) {
|
switch (apid) {
|
||||||
case PLOC_SPV::APID_ACK_FAILURE: {
|
case PLOC_SPV::APID_ACK_FAILURE: {
|
||||||
// TODO: Interpretation of status field in acknowledgment report
|
// TODO: Interpretation of status field in acknowledgment report
|
||||||
sif::debug << "PlocSupervisorHandler::handleAckReport: Received Ack failure report" << std::endl;
|
sif::debug << "PlocSupervisorHandler::handleAckReport: Received Ack failure report"
|
||||||
|
<< std::endl;
|
||||||
DeviceCommandId_t commandId = getPendingCommand();
|
DeviceCommandId_t commandId = getPendingCommand();
|
||||||
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
||||||
triggerEvent(SUPV_ACK_FAILURE, commandId);
|
triggerEvent(SUPV_ACK_FAILURE, commandId);
|
||||||
@ -651,7 +640,8 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
sif::debug << "PlocSupervisorHandler::handleAckReport: Invalid APID in Ack report" << std::endl;
|
sif::debug << "PlocSupervisorHandler::handleAckReport: Invalid APID in Ack report"
|
||||||
|
<< std::endl;
|
||||||
result = RETURN_FAILED;
|
result = RETURN_FAILED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -661,7 +651,6 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data) {
|
ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data) {
|
||||||
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
result = verifyPacket(data, PLOC_SPV::SIZE_EXE_REPORT);
|
result = verifyPacket(data, PLOC_SPV::SIZE_EXE_REPORT);
|
||||||
@ -679,14 +668,15 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data)
|
|||||||
}
|
}
|
||||||
case (PLOC_SPV::APID_EXE_FAILURE): {
|
case (PLOC_SPV::APID_EXE_FAILURE): {
|
||||||
// TODO: Interpretation of status field in execution report
|
// TODO: Interpretation of status field in execution report
|
||||||
sif::error << "PlocSupervisorHandler::handleExecutionReport: Received execution failure report"
|
sif::error
|
||||||
|
<< "PlocSupervisorHandler::handleExecutionReport: Received execution failure report"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
DeviceCommandId_t commandId = getPendingCommand();
|
DeviceCommandId_t commandId = getPendingCommand();
|
||||||
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
||||||
triggerEvent(SUPV_EXE_FAILURE, commandId);
|
triggerEvent(SUPV_EXE_FAILURE, commandId);
|
||||||
}
|
} else {
|
||||||
else {
|
sif::debug << "PlocSupervisorHandler::handleExecutionReport: Unknown command id"
|
||||||
sif::debug << "PlocSupervisorHandler::handleExecutionReport: Unknown command id" << std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
sendFailureReport(PLOC_SPV::EXE_REPORT, RECEIVED_EXE_FAILURE);
|
sendFailureReport(PLOC_SPV::EXE_REPORT, RECEIVED_EXE_FAILURE);
|
||||||
disableExeReportReply();
|
disableExeReportReply();
|
||||||
@ -706,43 +696,41 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
|
ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
|
||||||
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
result = verifyPacket(data, PLOC_SPV::SIZE_HK_REPORT);
|
result = verifyPacket(data, PLOC_SPV::SIZE_HK_REPORT);
|
||||||
|
|
||||||
if (result == CRC_FAILURE) {
|
if (result == CRC_FAILURE) {
|
||||||
sif::error << "PlocSupervisorHandler::handleHkReport: Hk report has invalid crc"
|
sif::error << "PlocSupervisorHandler::handleHkReport: Hk report has invalid crc" << std::endl;
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t offset = PLOC_SPV::DATA_FIELD_OFFSET;
|
uint16_t offset = PLOC_SPV::DATA_FIELD_OFFSET;
|
||||||
hkset.tempPs = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
hkset.tempPs = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
||||||
| *(data + offset + 3);
|
*(data + offset + 3);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
hkset.tempPl = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
hkset.tempPl = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
||||||
| *(data + offset + 3);
|
*(data + offset + 3);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
hkset.tempSup = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
hkset.tempSup = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
||||||
| *(data + offset + 3);
|
*(data + offset + 3);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
hkset.uptime = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
hkset.uptime = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
||||||
| *(data + offset + 3);
|
*(data + offset + 3);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
hkset.cpuLoad = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
hkset.cpuLoad = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
||||||
| *(data + offset + 3);
|
*(data + offset + 3);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
hkset.availableHeap = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
hkset.availableHeap = *(data + offset) << 24 | *(data + offset + 1) << 16 |
|
||||||
| *(data + offset + 3);
|
*(data + offset + 2) << 8 | *(data + offset + 3);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
hkset.numTcs = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
hkset.numTcs = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
||||||
| *(data + offset + 3);
|
*(data + offset + 3);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
hkset.numTms = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
hkset.numTms = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
||||||
| *(data + offset + 3);
|
*(data + offset + 3);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
hkset.socState = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
hkset.socState = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
||||||
| *(data + offset + 3);
|
*(data + offset + 3);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
hkset.nvm0_1_state = *(data + offset);
|
hkset.nvm0_1_state = *(data + offset);
|
||||||
offset += 1;
|
offset += 1;
|
||||||
@ -761,7 +749,8 @@ ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
|
|||||||
sif::info << "PlocSupervisorHandler::handleHkReport: temp_sup: " << hkset.tempSup << std::endl;
|
sif::info << "PlocSupervisorHandler::handleHkReport: temp_sup: " << hkset.tempSup << std::endl;
|
||||||
sif::info << "PlocSupervisorHandler::handleHkReport: uptime: " << hkset.uptime << std::endl;
|
sif::info << "PlocSupervisorHandler::handleHkReport: uptime: " << hkset.uptime << std::endl;
|
||||||
sif::info << "PlocSupervisorHandler::handleHkReport: cpu_load: " << hkset.cpuLoad << std::endl;
|
sif::info << "PlocSupervisorHandler::handleHkReport: cpu_load: " << hkset.cpuLoad << std::endl;
|
||||||
sif::info << "PlocSupervisorHandler::handleHkReport: available_heap: " << hkset.availableHeap << std::endl;
|
sif::info << "PlocSupervisorHandler::handleHkReport: available_heap: " << hkset.availableHeap
|
||||||
|
<< std::endl;
|
||||||
sif::info << "PlocSupervisorHandler::handleHkReport: num_tcs: " << hkset.numTcs << std::endl;
|
sif::info << "PlocSupervisorHandler::handleHkReport: num_tcs: " << hkset.numTcs << std::endl;
|
||||||
sif::info << "PlocSupervisorHandler::handleHkReport: num_tms: " << hkset.numTms << std::endl;
|
sif::info << "PlocSupervisorHandler::handleHkReport: num_tms: " << hkset.numTms << std::endl;
|
||||||
sif::info << "PlocSupervisorHandler::handleHkReport: soc_state: " << hkset.socState << std::endl;
|
sif::info << "PlocSupervisorHandler::handleHkReport: soc_state: " << hkset.socState << std::endl;
|
||||||
@ -780,14 +769,14 @@ ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data) {
|
ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data) {
|
||||||
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
result = verifyPacket(data, PLOC_SPV::SIZE_BOOT_STATUS_REPORT);
|
result = verifyPacket(data, PLOC_SPV::SIZE_BOOT_STATUS_REPORT);
|
||||||
|
|
||||||
if (result == CRC_FAILURE) {
|
if (result == CRC_FAILURE) {
|
||||||
sif::error << "PlocSupervisorHandler::handleBootStatusReport: Boot status report has invalid"
|
sif::error << "PlocSupervisorHandler::handleBootStatusReport: Boot status report has invalid"
|
||||||
" crc" << std::endl;
|
" crc"
|
||||||
|
<< std::endl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -835,7 +824,6 @@ ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* data) {
|
ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* data) {
|
||||||
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
result = verifyPacket(data, PLOC_SPV::SIZE_LATCHUP_STATUS_REPORT);
|
result = verifyPacket(data, PLOC_SPV::SIZE_LATCHUP_STATUS_REPORT);
|
||||||
@ -921,8 +909,8 @@ ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* da
|
|||||||
<< latchupStatusReport.timeYear << std::endl;
|
<< latchupStatusReport.timeYear << std::endl;
|
||||||
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: Msec: "
|
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: Msec: "
|
||||||
<< latchupStatusReport.timeMsec << std::endl;
|
<< latchupStatusReport.timeMsec << std::endl;
|
||||||
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: isSet: 0x"
|
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: isSet: 0x" << std::hex
|
||||||
<< std::hex << latchupStatusReport.timeMsec << std::dec << std::endl;
|
<< latchupStatusReport.timeMsec << std::dec << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -953,15 +941,13 @@ void PlocSupervisorHandler::setNextReplyId() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId) {
|
size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId) {
|
||||||
|
|
||||||
size_t replyLen = 0;
|
size_t replyLen = 0;
|
||||||
|
|
||||||
if (nextReplyId == PLOC_SPV::NONE) {
|
if (nextReplyId == PLOC_SPV::NONE) {
|
||||||
return replyLen;
|
return replyLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nextReplyId == PLOC_SPV::FIRST_MRAM_DUMP
|
if (nextReplyId == PLOC_SPV::FIRST_MRAM_DUMP || nextReplyId == PLOC_SPV::CONSECUTIVE_MRAM_DUMP) {
|
||||||
|| nextReplyId == PLOC_SPV::CONSECUTIVE_MRAM_DUMP) {
|
|
||||||
/**
|
/**
|
||||||
* Try to read 20 MRAM packets. If reply is larger, the packets will be read with the
|
* Try to read 20 MRAM packets. If reply is larger, the packets will be read with the
|
||||||
* next doSendRead call. The command will be as long active as the packet with the sequence
|
* next doSendRead call. The command will be as long active as the packet with the sequence
|
||||||
@ -978,8 +964,7 @@ size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId){
|
|||||||
return replyLen;
|
return replyLen;
|
||||||
}
|
}
|
||||||
replyLen = iter->second.replyLen;
|
replyLen = iter->second.replyLen;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::debug << "PlocSupervisorHandler::getNextReplyLength: No entry for reply with reply id "
|
sif::debug << "PlocSupervisorHandler::getNextReplyLength: No entry for reply with reply id "
|
||||||
<< std::hex << nextReplyId << " in deviceReplyMap" << std::endl;
|
<< std::hex << nextReplyId << " in deviceReplyMap" << std::endl;
|
||||||
}
|
}
|
||||||
@ -987,8 +972,8 @@ size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId){
|
|||||||
return replyLen;
|
return replyLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId) {
|
void PlocSupervisorHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
|
||||||
|
DeviceCommandId_t replyId) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
if (wiretappingMode == RAW) {
|
if (wiretappingMode == RAW) {
|
||||||
@ -1043,8 +1028,8 @@ void PlocSupervisorHandler::prepareDisableHk() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::prepareSetBootTimeoutCmd(const uint8_t* commandData) {
|
void PlocSupervisorHandler::prepareSetBootTimeoutCmd(const uint8_t* commandData) {
|
||||||
uint32_t timeout = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8
|
uint32_t timeout = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 |
|
||||||
| *(commandData + 3);
|
*(commandData + 3);
|
||||||
PLOC_SPV::SetBootTimeout packet(timeout);
|
PLOC_SPV::SetBootTimeout packet(timeout);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
||||||
}
|
}
|
||||||
@ -1073,8 +1058,8 @@ ReturnValue_t PlocSupervisorHandler::prepareWatchdogsConfigTimeoutCmd(const uint
|
|||||||
if (watchdog > 2) {
|
if (watchdog > 2) {
|
||||||
return INVALID_WATCHDOG;
|
return INVALID_WATCHDOG;
|
||||||
}
|
}
|
||||||
uint32_t timeout = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16
|
uint32_t timeout = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16 |
|
||||||
| *(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
*(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
||||||
if (timeout < 1000 || timeout > 360000) {
|
if (timeout < 1000 || timeout > 360000) {
|
||||||
return INVALID_WATCHDOG_TIMEOUT;
|
return INVALID_WATCHDOG_TIMEOUT;
|
||||||
}
|
}
|
||||||
@ -1115,8 +1100,8 @@ ReturnValue_t PlocSupervisorHandler::prepareAutoCalibrateAlertCmd(const uint8_t*
|
|||||||
uint8_t offset = 0;
|
uint8_t offset = 0;
|
||||||
uint8_t latchupId = *commandData;
|
uint8_t latchupId = *commandData;
|
||||||
offset += 1;
|
offset += 1;
|
||||||
uint32_t mg = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16
|
uint32_t mg = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16 |
|
||||||
| *(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
*(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
||||||
if (latchupId > 6) {
|
if (latchupId > 6) {
|
||||||
return INVALID_LATCHUP_ID;
|
return INVALID_LATCHUP_ID;
|
||||||
}
|
}
|
||||||
@ -1141,8 +1126,8 @@ ReturnValue_t PlocSupervisorHandler::prepareSetAlertLimitCmd(const uint8_t* comm
|
|||||||
uint8_t offset = 0;
|
uint8_t offset = 0;
|
||||||
uint8_t latchupId = *commandData;
|
uint8_t latchupId = *commandData;
|
||||||
offset += 1;
|
offset += 1;
|
||||||
uint32_t dutycycle = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16
|
uint32_t dutycycle = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16 |
|
||||||
| *(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
*(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
||||||
if (latchupId > 6) {
|
if (latchupId > 6) {
|
||||||
return INVALID_LATCHUP_ID;
|
return INVALID_LATCHUP_ID;
|
||||||
}
|
}
|
||||||
@ -1152,8 +1137,8 @@ ReturnValue_t PlocSupervisorHandler::prepareSetAlertLimitCmd(const uint8_t* comm
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::prepareSetAdcSweetPeriodCmd(const uint8_t* commandData) {
|
ReturnValue_t PlocSupervisorHandler::prepareSetAdcSweetPeriodCmd(const uint8_t* commandData) {
|
||||||
uint32_t sweepPeriod = *(commandData) << 24 | *(commandData + 1) << 16
|
uint32_t sweepPeriod = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 |
|
||||||
| *(commandData + 2) << 8 | *(commandData + 3);
|
*(commandData + 3);
|
||||||
if (sweepPeriod < 21) {
|
if (sweepPeriod < 21) {
|
||||||
return SWEEP_PERIOD_TOO_SMALL;
|
return SWEEP_PERIOD_TOO_SMALL;
|
||||||
}
|
}
|
||||||
@ -1178,8 +1163,8 @@ void PlocSupervisorHandler::prepareSetAdcWindowAndStrideCmd(const uint8_t* comma
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::prepareSetAdcThresholdCmd(const uint8_t* commandData) {
|
void PlocSupervisorHandler::prepareSetAdcThresholdCmd(const uint8_t* commandData) {
|
||||||
uint32_t threshold = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8
|
uint32_t threshold = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 |
|
||||||
| *(commandData + 3);
|
*(commandData + 3);
|
||||||
PLOC_SPV::SetAdcThreshold packet(threshold);
|
PLOC_SPV::SetAdcThreshold packet(threshold);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
||||||
}
|
}
|
||||||
@ -1275,7 +1260,6 @@ void PlocSupervisorHandler::packetToOutBuffer(uint8_t* packetData, size_t fullSi
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::disableAllReplies() {
|
void PlocSupervisorHandler::disableAllReplies() {
|
||||||
|
|
||||||
DeviceReplyMap::iterator iter;
|
DeviceReplyMap::iterator iter;
|
||||||
|
|
||||||
/* Disable ack reply */
|
/* Disable ack reply */
|
||||||
@ -1305,7 +1289,6 @@ void PlocSupervisorHandler::disableAllReplies() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status) {
|
void PlocSupervisorHandler::sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status) {
|
||||||
|
|
||||||
DeviceReplyIter iter = deviceReplyMap.find(replyId);
|
DeviceReplyIter iter = deviceReplyMap.find(replyId);
|
||||||
|
|
||||||
if (iter == deviceReplyMap.end()) {
|
if (iter == deviceReplyMap.end()) {
|
||||||
@ -1316,7 +1299,8 @@ void PlocSupervisorHandler::sendFailureReport(DeviceCommandId_t replyId, ReturnV
|
|||||||
DeviceCommandInfo* info = &(iter->second.command->second);
|
DeviceCommandInfo* info = &(iter->second.command->second);
|
||||||
|
|
||||||
if (info == nullptr) {
|
if (info == nullptr) {
|
||||||
sif::debug << "PlocSupervisorHandler::sendFailureReport: Reply has no active command" << std::endl;
|
sif::debug << "PlocSupervisorHandler::sendFailureReport: Reply has no active command"
|
||||||
|
<< std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1367,7 +1351,6 @@ ReturnValue_t PlocSupervisorHandler::parseMramPackets(const uint8_t *packet, siz
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket(DeviceCommandId_t id) {
|
ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket(DeviceCommandId_t id) {
|
||||||
|
|
||||||
ReturnValue_t result = RETURN_FAILED;
|
ReturnValue_t result = RETURN_FAILED;
|
||||||
|
|
||||||
// Prepare packet for downlink
|
// Prepare packet for downlink
|
||||||
@ -1380,8 +1363,7 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket(DeviceCommandId_t id)
|
|||||||
}
|
}
|
||||||
handleMramDumpFile(id);
|
handleMramDumpFile(id);
|
||||||
if (downlinkMramDump == true) {
|
if (downlinkMramDump == true) {
|
||||||
handleDeviceTM(spacePacketBuffer + PLOC_SPV::SPACE_PACKET_HEADER_LENGTH, packetLen - 1,
|
handleDeviceTM(spacePacketBuffer + PLOC_SPV::SPACE_PACKET_HEADER_LENGTH, packetLen - 1, id);
|
||||||
id);
|
|
||||||
}
|
}
|
||||||
packetInBuffer = false;
|
packetInBuffer = false;
|
||||||
receivedMramDumpPackets++;
|
receivedMramDumpPackets++;
|
||||||
@ -1426,16 +1408,15 @@ void PlocSupervisorHandler::increaseExpectedMramReplies(DeviceCommandId_t id) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint8_t sequenceFlags = spacePacketBuffer[2] >> 6;
|
uint8_t sequenceFlags = spacePacketBuffer[2] >> 6;
|
||||||
if (sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::LAST_PKT)
|
if (sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::LAST_PKT) &&
|
||||||
&& (sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) {
|
(sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) {
|
||||||
// Command expects at least one MRAM packet more and the execution report
|
// Command expects at least one MRAM packet more and the execution report
|
||||||
info->expectedReplies = 2;
|
info->expectedReplies = 2;
|
||||||
// Wait maximum of 2 cycles for next MRAM packet
|
// Wait maximum of 2 cycles for next MRAM packet
|
||||||
mramReplyInfo->delayCycles = 2;
|
mramReplyInfo->delayCycles = 2;
|
||||||
// Also adapting delay cycles for execution report
|
// Also adapting delay cycles for execution report
|
||||||
exeReplyInfo->delayCycles = 3;
|
exeReplyInfo->delayCycles = 3;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Command expects the execution report
|
// Command expects the execution report
|
||||||
info->expectedReplies = 1;
|
info->expectedReplies = 1;
|
||||||
mramReplyInfo->delayCycles = 0;
|
mramReplyInfo->delayCycles = 0;
|
||||||
@ -1456,8 +1437,8 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpFile(DeviceCommandId_t id) {
|
|||||||
uint16_t packetLen = readSpacePacketLength(spacePacketBuffer);
|
uint16_t packetLen = readSpacePacketLength(spacePacketBuffer);
|
||||||
uint8_t sequenceFlags = readSequenceFlags(spacePacketBuffer);
|
uint8_t sequenceFlags = readSequenceFlags(spacePacketBuffer);
|
||||||
if (id == PLOC_SPV::FIRST_MRAM_DUMP) {
|
if (id == PLOC_SPV::FIRST_MRAM_DUMP) {
|
||||||
if (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT)
|
if (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT) ||
|
||||||
|| (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) {
|
(sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) {
|
||||||
result = createMramDumpFile();
|
result = createMramDumpFile();
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
@ -1523,8 +1504,8 @@ ReturnValue_t PlocSupervisorHandler::getTimeStampString(std::string& timeStamp)
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
return GET_TIME_FAILURE;
|
return GET_TIME_FAILURE;
|
||||||
}
|
}
|
||||||
timeStamp = std::to_string(time.year) + "-" + std::to_string(time.month) + "-"
|
timeStamp = std::to_string(time.year) + "-" + std::to_string(time.month) + "-" +
|
||||||
+ std::to_string(time.day) + "--" + std::to_string(time.hour) + "-"
|
std::to_string(time.day) + "--" + std::to_string(time.hour) + "-" +
|
||||||
+ std::to_string(time.minute) + "-" + std::to_string(time.second);
|
std::to_string(time.minute) + "-" + std::to_string(time.second);
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#ifndef MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
|
#ifndef MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
|
||||||
#define MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
|
#define MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
|
||||||
|
|
||||||
#include "devicedefinitions/PlocSupervisorDefinitions.h"
|
|
||||||
#include <bsp_q7s/memory/SdCardManager.h>
|
#include <bsp_q7s/memory/SdCardManager.h>
|
||||||
|
|
||||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||||
#include <fsfw_hal/linux/uart/UartComIF.h>
|
#include <fsfw_hal/linux/uart/UartComIF.h>
|
||||||
|
|
||||||
|
#include "devicedefinitions/PlocSupervisorDefinitions.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is the device handler for the supervisor of the PLOC which is programmed by
|
* @brief This is the device handler for the supervisor of the PLOC which is programmed by
|
||||||
* Thales.
|
* Thales.
|
||||||
@ -21,7 +21,6 @@
|
|||||||
*/
|
*/
|
||||||
class PlocSupervisorHandler : public DeviceHandlerBase {
|
class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie);
|
PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie);
|
||||||
virtual ~PlocSupervisorHandler();
|
virtual ~PlocSupervisorHandler();
|
||||||
|
|
||||||
@ -33,12 +32,11 @@ protected:
|
|||||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
||||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
|
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
|
||||||
void fillCommandAndReplyMap() override;
|
void fillCommandAndReplyMap() override;
|
||||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
|
||||||
const uint8_t * commandData,size_t commandDataLen) override;
|
size_t commandDataLen) override;
|
||||||
ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize,
|
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
|
||||||
DeviceCommandId_t *foundId, size_t *foundLen) override;
|
size_t* foundLen) override;
|
||||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id,
|
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
||||||
const uint8_t *packet) override;
|
|
||||||
void setNormalDatapoolEntriesInvalid() override;
|
void setNormalDatapoolEntriesInvalid() override;
|
||||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
@ -49,7 +47,6 @@ protected:
|
|||||||
size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
|
size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_SUPERVISOR_HANDLER;
|
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_SUPERVISOR_HANDLER;
|
||||||
|
|
||||||
//! [EXPORT] : [COMMENT] Space Packet received from PLOC supervisor has invalid CRC
|
//! [EXPORT] : [COMMENT] Space Packet received from PLOC supervisor has invalid CRC
|
||||||
@ -64,25 +61,32 @@ private:
|
|||||||
static const ReturnValue_t GET_TIME_FAILURE = MAKE_RETURN_CODE(0xA4);
|
static const ReturnValue_t GET_TIME_FAILURE = MAKE_RETURN_CODE(0xA4);
|
||||||
//! [EXPORT] : [COMMENT] Invalid communication interface specified
|
//! [EXPORT] : [COMMENT] Invalid communication interface specified
|
||||||
static const ReturnValue_t INVALID_UART_COM_IF = MAKE_RETURN_CODE(0xA5);
|
static const ReturnValue_t INVALID_UART_COM_IF = MAKE_RETURN_CODE(0xA5);
|
||||||
//! [EXPORT] : [COMMENT] Received command with invalid watchdog parameter. Valid watchdogs are 0 for PS, 1 for PL and 2 for INT
|
//! [EXPORT] : [COMMENT] Received command with invalid watchdog parameter. Valid watchdogs are 0
|
||||||
|
//! for PS, 1 for PL and 2 for INT
|
||||||
static const ReturnValue_t INVALID_WATCHDOG = MAKE_RETURN_CODE(0xA6);
|
static const ReturnValue_t INVALID_WATCHDOG = MAKE_RETURN_CODE(0xA6);
|
||||||
//! [EXPORT] : [COMMENT] Received watchdog timeout config command with invalid timeout. Valid timeouts must be in the range between 1000 and 360000 ms.
|
//! [EXPORT] : [COMMENT] Received watchdog timeout config command with invalid timeout. Valid
|
||||||
|
//! timeouts must be in the range between 1000 and 360000 ms.
|
||||||
static const ReturnValue_t INVALID_WATCHDOG_TIMEOUT = MAKE_RETURN_CODE(0xA7);
|
static const ReturnValue_t INVALID_WATCHDOG_TIMEOUT = MAKE_RETURN_CODE(0xA7);
|
||||||
//! [EXPORT] : [COMMENT] Received latchup config command with invalid latchup ID
|
//! [EXPORT] : [COMMENT] Received latchup config command with invalid latchup ID
|
||||||
static const ReturnValue_t INVALID_LATCHUP_ID = MAKE_RETURN_CODE(0xA8);
|
static const ReturnValue_t INVALID_LATCHUP_ID = MAKE_RETURN_CODE(0xA8);
|
||||||
//! [EXPORT] : [COMMENT] Received set adc sweep period command with invalid sweep period. Must be larger than 21.
|
//! [EXPORT] : [COMMENT] Received set adc sweep period command with invalid sweep period. Must be
|
||||||
|
//! larger than 21.
|
||||||
static const ReturnValue_t SWEEP_PERIOD_TOO_SMALL = MAKE_RETURN_CODE(0xA9);
|
static const ReturnValue_t SWEEP_PERIOD_TOO_SMALL = MAKE_RETURN_CODE(0xA9);
|
||||||
//! [EXPORT] : [COMMENT] Receive auto EM test command with invalid test param. Valid params are 1 and 2.
|
//! [EXPORT] : [COMMENT] Receive auto EM test command with invalid test param. Valid params are 1
|
||||||
|
//! and 2.
|
||||||
static const ReturnValue_t INVALID_TEST_PARAM = MAKE_RETURN_CODE(0xAA);
|
static const ReturnValue_t INVALID_TEST_PARAM = MAKE_RETURN_CODE(0xAA);
|
||||||
//! [EXPORT] : [COMMENT] Returned when scanning for MRAM dump packets failed.
|
//! [EXPORT] : [COMMENT] Returned when scanning for MRAM dump packets failed.
|
||||||
static const ReturnValue_t MRAM_PACKET_PARSING_FAILURE = MAKE_RETURN_CODE(0xAB);
|
static const ReturnValue_t MRAM_PACKET_PARSING_FAILURE = MAKE_RETURN_CODE(0xAB);
|
||||||
//! [EXPORT] : [COMMENT] Returned when the start and stop addresses of the MRAM dump or MRAM wipe commands are invalid (e.g. start address bigger than stop address)
|
//! [EXPORT] : [COMMENT] Returned when the start and stop addresses of the MRAM dump or MRAM wipe
|
||||||
|
//! commands are invalid (e.g. start address bigger than stop address)
|
||||||
static const ReturnValue_t INVALID_MRAM_ADDRESSES = MAKE_RETURN_CODE(0xAC);
|
static const ReturnValue_t INVALID_MRAM_ADDRESSES = MAKE_RETURN_CODE(0xAC);
|
||||||
//! [EXPORT] : [COMMENT] Expect reception of an MRAM dump packet but received space packet with other apid.
|
//! [EXPORT] : [COMMENT] Expect reception of an MRAM dump packet but received space packet with
|
||||||
|
//! other apid.
|
||||||
static const ReturnValue_t NO_MRAM_PACKET = MAKE_RETURN_CODE(0xAD);
|
static const ReturnValue_t NO_MRAM_PACKET = MAKE_RETURN_CODE(0xAD);
|
||||||
//! [EXPORT] : [COMMENT] Path to PLOC directory on SD card does not exist
|
//! [EXPORT] : [COMMENT] Path to PLOC directory on SD card does not exist
|
||||||
static const ReturnValue_t PATH_DOES_NOT_EXIST = MAKE_RETURN_CODE(0xAE);
|
static const ReturnValue_t PATH_DOES_NOT_EXIST = MAKE_RETURN_CODE(0xAE);
|
||||||
//! [EXPORT] : [COMMENT] MRAM dump file does not exists. The file should actually already have been created with the reception of the first dump packet.
|
//! [EXPORT] : [COMMENT] MRAM dump file does not exists. The file should actually already have
|
||||||
|
//! been created with the reception of the first dump packet.
|
||||||
static const ReturnValue_t MRAM_FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xAF);
|
static const ReturnValue_t MRAM_FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xAF);
|
||||||
|
|
||||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_SUPERVISOR_HANDLER;
|
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_SUPERVISOR_HANDLER;
|
||||||
@ -258,7 +262,6 @@ private:
|
|||||||
void prepareSetGpioCmd(const uint8_t* commandData);
|
void prepareSetGpioCmd(const uint8_t* commandData);
|
||||||
void prepareReadGpioCmd(const uint8_t* commandData);
|
void prepareReadGpioCmd(const uint8_t* commandData);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Copies the content of a space packet to the command buffer.
|
* @brief Copies the content of a space packet to the command buffer.
|
||||||
*/
|
*/
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
#include "fsfw/ipc/QueueFactory.h"
|
|
||||||
#include "PlocUpdater.h"
|
#include "PlocUpdater.h"
|
||||||
|
|
||||||
#include <fstream>
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
PlocUpdater::PlocUpdater(object_id_t objectId) :
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
SystemObject(objectId), commandActionHelper(this), actionHelper(this, nullptr) {
|
|
||||||
|
PlocUpdater::PlocUpdater(object_id_t objectId)
|
||||||
|
: SystemObject(objectId), commandActionHelper(this), actionHelper(this, nullptr) {
|
||||||
commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE);
|
commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlocUpdater::~PlocUpdater() {
|
PlocUpdater::~PlocUpdater() {}
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t PlocUpdater::initialize() {
|
ReturnValue_t PlocUpdater::initialize() {
|
||||||
#if BOARD_TE0720 == 0
|
#if BOARD_TE0720 == 0
|
||||||
@ -39,8 +39,8 @@ ReturnValue_t PlocUpdater::performOperation(uint8_t operationCode) {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocUpdater::executeAction(ActionId_t actionId,
|
ReturnValue_t PlocUpdater::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
MessageQueueId_t commandedBy, const uint8_t* data, size_t size) {
|
const uint8_t* data, size_t size) {
|
||||||
ReturnValue_t result = RETURN_FAILED;
|
ReturnValue_t result = RETURN_FAILED;
|
||||||
|
|
||||||
if (state != State::IDLE) {
|
if (state != State::IDLE) {
|
||||||
@ -99,13 +99,9 @@ ReturnValue_t PlocUpdater::executeAction(ActionId_t actionId,
|
|||||||
return EXECUTION_FINISHED;
|
return EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageQueueId_t PlocUpdater::getCommandQueue() const {
|
MessageQueueId_t PlocUpdater::getCommandQueue() const { return commandQueue->getId(); }
|
||||||
return commandQueue->getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageQueueIF* PlocUpdater::getCommandQueuePtr() {
|
MessageQueueIF* PlocUpdater::getCommandQueuePtr() { return commandQueue; }
|
||||||
return commandQueue;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlocUpdater::readCommandQueue() {
|
void PlocUpdater::readCommandQueue() {
|
||||||
CommandMessage message;
|
CommandMessage message;
|
||||||
@ -167,19 +163,19 @@ ReturnValue_t PlocUpdater::getImageLocation(const uint8_t* data, size_t size) {
|
|||||||
|
|
||||||
#if BOARD_TE0720 == 0
|
#if BOARD_TE0720 == 0
|
||||||
// Check if file is stored on SD card and if associated SD card is mounted
|
// Check if file is stored on SD card and if associated SD card is mounted
|
||||||
if (std::string(reinterpret_cast<const char*>(data), SD_PREFIX_LENGTH) == std::string(SdCardManager::SD_0_MOUNT_POINT)) {
|
if (std::string(reinterpret_cast<const char*>(data), SD_PREFIX_LENGTH) ==
|
||||||
if (!isSdCardMounted(sd::SLOT_0)) {
|
std::string(SdCardManager::SD_0_MOUNT_POINT)) {
|
||||||
sif::warning << "PlocUpdater::prepareNvm0AUpdate: SD card 0 not mounted" << std::endl;
|
if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
|
||||||
|
sif::warning << "PlocUpdater::getImageLocation: SD card 0 not mounted" << std::endl;
|
||||||
return SD_NOT_MOUNTED;
|
return SD_NOT_MOUNTED;
|
||||||
}
|
}
|
||||||
}
|
} else if (std::string(reinterpret_cast<const char*>(data), SD_PREFIX_LENGTH) ==
|
||||||
else if (std::string(reinterpret_cast<const char*>(data), SD_PREFIX_LENGTH) == std::string(SdCardManager::SD_1_MOUNT_POINT)) {
|
std::string(SdCardManager::SD_1_MOUNT_POINT)) {
|
||||||
if (!isSdCardMounted(sd::SLOT_0)) {
|
if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
|
||||||
sif::warning << "PlocUpdater::prepareNvm0AUpdate: SD card 1 not mounted" << std::endl;
|
sif::warning << "PlocUpdater::getImageLocation: SD card 1 not mounted" << std::endl;
|
||||||
return SD_NOT_MOUNTED;
|
return SD_NOT_MOUNTED;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// update image not stored on SD card
|
// update image not stored on SD card
|
||||||
}
|
}
|
||||||
#endif /* BOARD_TE0720 == 0 */
|
#endif /* BOARD_TE0720 == 0 */
|
||||||
@ -193,48 +189,11 @@ ReturnValue_t PlocUpdater::getImageLocation(const uint8_t* data, size_t size) {
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BOARD_TE0720 == 0
|
void PlocUpdater::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) {}
|
||||||
bool PlocUpdater::isSdCardMounted(sd::SdCard sdCard) {
|
|
||||||
SdCardManager::SdStatePair active;
|
|
||||||
ReturnValue_t result = sdcMan->getSdCardActiveStatus(active);
|
|
||||||
if (result != RETURN_OK) {
|
|
||||||
sif::debug << "PlocUpdater::isSdCardMounted: Failed to get SD card active state";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (sdCard == sd::SLOT_0) {
|
|
||||||
if (active.first == sd::MOUNTED) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (sdCard == sd::SLOT_1) {
|
|
||||||
if (active.second == sd::MOUNTED) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
sif::debug << "PlocUpdater::isSdCardMounted: Unknown SD card specified" << std::endl;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif /* #if BOARD_TE0720 == 0 */
|
|
||||||
|
|
||||||
void PlocUpdater::stepSuccessfulReceived(ActionId_t actionId,
|
void PlocUpdater::stepFailedReceived(ActionId_t actionId, uint8_t step, ReturnValue_t returnCode) {}
|
||||||
uint8_t step) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlocUpdater::stepFailedReceived(ActionId_t actionId, uint8_t step,
|
void PlocUpdater::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {}
|
||||||
ReturnValue_t returnCode) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlocUpdater::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlocUpdater::completionSuccessfulReceived(ActionId_t actionId) {
|
void PlocUpdater::completionSuccessfulReceived(ActionId_t actionId) {
|
||||||
switch (pendingCommand) {
|
switch (pendingCommand) {
|
||||||
@ -245,8 +204,7 @@ void PlocUpdater::completionSuccessfulReceived(ActionId_t actionId) {
|
|||||||
if (remainingPackets == 0) {
|
if (remainingPackets == 0) {
|
||||||
packetsSent = 0; // Reset packets sent variable for next update sequence
|
packetsSent = 0; // Reset packets sent variable for next update sequence
|
||||||
state = State::UPDATE_VERIFY;
|
state = State::UPDATE_VERIFY;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
state = State::UPDATE_TRANSFER;
|
state = State::UPDATE_TRANSFER;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -263,8 +221,7 @@ void PlocUpdater::completionSuccessfulReceived(ActionId_t actionId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocUpdater::completionFailedReceived(ActionId_t actionId,
|
void PlocUpdater::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) {
|
||||||
ReturnValue_t returnCode) {
|
|
||||||
switch (pendingCommand) {
|
switch (pendingCommand) {
|
||||||
case (PLOC_SPV::UPDATE_AVAILABLE): {
|
case (PLOC_SPV::UPDATE_AVAILABLE): {
|
||||||
triggerEvent(UPDATE_AVAILABLE_FAILED);
|
triggerEvent(UPDATE_AVAILABLE_FAILED);
|
||||||
@ -279,8 +236,7 @@ void PlocUpdater::completionFailedReceived(ActionId_t actionId,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
sif::debug << "PlocUpdater::completionFailedReceived: Invalid pending command "
|
sif::debug << "PlocUpdater::completionFailedReceived: Invalid pending command " << std::endl;
|
||||||
<< std::endl;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
state = State::IDLE;
|
state = State::IDLE;
|
||||||
@ -311,10 +267,12 @@ void PlocUpdater::commandUpdateAvailable() {
|
|||||||
calcImageCrc();
|
calcImageCrc();
|
||||||
|
|
||||||
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_AVAILABLE, static_cast<uint8_t>(image),
|
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_AVAILABLE, static_cast<uint8_t>(image),
|
||||||
static_cast<uint8_t>(partition), imageSize, imageCrc, numOfUpdatePackets);
|
static_cast<uint8_t>(partition), imageSize, imageCrc,
|
||||||
|
numOfUpdatePackets);
|
||||||
|
|
||||||
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
||||||
PLOC_SPV::UPDATE_AVAILABLE, packet.getWholeData(), packet.getFullSize());
|
PLOC_SPV::UPDATE_AVAILABLE, packet.getWholeData(),
|
||||||
|
packet.getFullSize());
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
|
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
|
||||||
<< " packet to supervisor handler" << std::endl;
|
<< " packet to supervisor handler" << std::endl;
|
||||||
@ -344,8 +302,7 @@ void PlocUpdater::commandUpdatePacket() {
|
|||||||
|
|
||||||
if (remainingPackets == 1) {
|
if (remainingPackets == 1) {
|
||||||
payloadLength = imageSize - static_cast<uint16_t>(file.tellg());
|
payloadLength = imageSize - static_cast<uint16_t>(file.tellg());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
payloadLength = MAX_SP_DATA;
|
payloadLength = MAX_SP_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,7 +317,8 @@ void PlocUpdater::commandUpdatePacket() {
|
|||||||
packet.makeCrc();
|
packet.makeCrc();
|
||||||
|
|
||||||
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
||||||
PLOC_SPV::UPDATE_IMAGE_DATA, packet.getWholeData(), packet.getFullSize());
|
PLOC_SPV::UPDATE_IMAGE_DATA, packet.getWholeData(),
|
||||||
|
packet.getFullSize());
|
||||||
|
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update"
|
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update"
|
||||||
@ -382,10 +340,12 @@ void PlocUpdater::commandUpdateVerify() {
|
|||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_VERIFY, static_cast<uint8_t>(image),
|
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_VERIFY, static_cast<uint8_t>(image),
|
||||||
static_cast<uint8_t>(partition), imageSize, imageCrc, numOfUpdatePackets);
|
static_cast<uint8_t>(partition), imageSize, imageCrc,
|
||||||
|
numOfUpdatePackets);
|
||||||
|
|
||||||
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
result =
|
||||||
PLOC_SPV::UPDATE_VERIFY, packet.getWholeData(), packet.getFullSize());
|
commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, PLOC_SPV::UPDATE_VERIFY,
|
||||||
|
packet.getWholeData(), packet.getFullSize());
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
|
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
|
||||||
<< " packet to supervisor handler" << std::endl;
|
<< " packet to supervisor handler" << std::endl;
|
||||||
@ -425,12 +385,9 @@ void PlocUpdater::calcImageCrc() {
|
|||||||
void PlocUpdater::adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet) {
|
void PlocUpdater::adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet) {
|
||||||
if (packetsSent == 0) {
|
if (packetsSent == 0) {
|
||||||
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT));
|
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT));
|
||||||
}
|
} else if (remainingPackets == 1) {
|
||||||
else if (remainingPackets == 1) {
|
|
||||||
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::LAST_PKT));
|
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::LAST_PKT));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::CONTINUED_PKT));
|
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::CONTINUED_PKT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,27 +2,25 @@
|
|||||||
#define MISSION_DEVICES_PLOCUPDATER_H_
|
#define MISSION_DEVICES_PLOCUPDATER_H_
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
#include "devicedefinitions/PlocSupervisorDefinitions.h"
|
#include "devicedefinitions/PlocSupervisorDefinitions.h"
|
||||||
|
|
||||||
#include "fsfw/action/CommandActionHelper.h"
|
|
||||||
#include "fsfw/action/ActionHelper.h"
|
#include "fsfw/action/ActionHelper.h"
|
||||||
#include "fsfw/action/HasActionsIF.h"
|
#include "fsfw/action/CommandActionHelper.h"
|
||||||
#include "fsfw/action/CommandsActionsIF.h"
|
#include "fsfw/action/CommandsActionsIF.h"
|
||||||
|
#include "fsfw/action/HasActionsIF.h"
|
||||||
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
#include "fsfw/tasks/ExecutableObjectIF.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"
|
#include "fsfw/tmtcpacket/SpacePacket.h"
|
||||||
|
#include "linux/fsfwconfig/objects/systemObjectList.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief An object of this class can be used to perform the software updates of the PLOC. The
|
* @brief An object of this class can be used to perform the software updates of the PLOC. The
|
||||||
* software update will be read from one of the SD cards, split into multiple space
|
* software update will be read from one of the SD cards, split into multiple space
|
||||||
* packets and sent to the PlocSupervisorHandler.
|
* packets and sent to the PlocSupervisorHandler.
|
||||||
*
|
*
|
||||||
* @details The MPSoC has two boot memories (NVM0 and NVM1) where each stores two images (Partition A
|
* @details The MPSoC has two boot memories (NVM0 and NVM1) where each stores two images (Partition
|
||||||
* and Partition B)
|
* A and Partition B)
|
||||||
*
|
*
|
||||||
* @author J. Meier
|
* @author J. Meier
|
||||||
*/
|
*/
|
||||||
@ -32,7 +30,6 @@ class PlocUpdater : public SystemObject,
|
|||||||
public HasReturnvaluesIF,
|
public HasReturnvaluesIF,
|
||||||
public CommandsActionsIF {
|
public CommandsActionsIF {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static const ActionId_t UPDATE_A_UBOOT = 0;
|
static const ActionId_t UPDATE_A_UBOOT = 0;
|
||||||
static const ActionId_t UPDATE_A_BITSTREAM = 1;
|
static const ActionId_t UPDATE_A_BITSTREAM = 1;
|
||||||
static const ActionId_t UPDATE_A_LINUX = 2;
|
static const ActionId_t UPDATE_A_LINUX = 2;
|
||||||
@ -58,14 +55,14 @@ public:
|
|||||||
void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) override;
|
void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_UPDATER;
|
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_UPDATER;
|
||||||
|
|
||||||
//! [EXPORT] : [COMMENT] Updater is already performing an update
|
//! [EXPORT] : [COMMENT] Updater is already performing an update
|
||||||
static const ReturnValue_t UPDATER_BUSY = MAKE_RETURN_CODE(0xA0);
|
static const ReturnValue_t UPDATER_BUSY = MAKE_RETURN_CODE(0xA0);
|
||||||
//! [EXPORT] : [COMMENT] Received update command with invalid path string (too long).
|
//! [EXPORT] : [COMMENT] Received update command with invalid path string (too long).
|
||||||
static const ReturnValue_t NAME_TOO_LONG = MAKE_RETURN_CODE(0xA1);
|
static const ReturnValue_t NAME_TOO_LONG = MAKE_RETURN_CODE(0xA1);
|
||||||
//! [EXPORT] : [COMMENT] Received command to initiate update but SD card with update image not mounted.
|
//! [EXPORT] : [COMMENT] Received command to initiate update but SD card with update image not
|
||||||
|
//! mounted.
|
||||||
static const ReturnValue_t SD_NOT_MOUNTED = MAKE_RETURN_CODE(0xA2);
|
static const ReturnValue_t SD_NOT_MOUNTED = MAKE_RETURN_CODE(0xA2);
|
||||||
//! [EXPORT] : [COMMENT] Update file received with update command does not exist.
|
//! [EXPORT] : [COMMENT] Update file received with update command does not exist.
|
||||||
static const ReturnValue_t FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xA3);
|
static const ReturnValue_t FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xA3);
|
||||||
@ -74,13 +71,15 @@ private:
|
|||||||
|
|
||||||
//! [EXPORT] : [COMMENT] Try to read update file but the file does not exist.
|
//! [EXPORT] : [COMMENT] Try to read update file but the file does not exist.
|
||||||
//! P1: Indicates in which state the file read fails
|
//! P1: Indicates in which state the file read fails
|
||||||
//! P2: During the update transfer the second parameter gives information about the number of already sent packets
|
//! P2: During the update transfer the second parameter gives information about the number of
|
||||||
|
//! already sent packets
|
||||||
static const Event UPDATE_FILE_NOT_EXISTS = MAKE_EVENT(0, severity::LOW);
|
static const Event UPDATE_FILE_NOT_EXISTS = MAKE_EVENT(0, severity::LOW);
|
||||||
//! [EXPORT] : [COMMENT] Failed to send command to supervisor handler
|
//! [EXPORT] : [COMMENT] Failed to send command to supervisor handler
|
||||||
//! P1: Return value of CommandActionHelper::commandAction
|
//! P1: Return value of CommandActionHelper::commandAction
|
||||||
//! P2: Action ID of command to send
|
//! P2: Action ID of command to send
|
||||||
static const Event ACTION_COMMANDING_FAILED = MAKE_EVENT(1, severity::LOW);
|
static const Event ACTION_COMMANDING_FAILED = MAKE_EVENT(1, severity::LOW);
|
||||||
//! [EXPORT] : [COMMENT] Supervisor handler replied action message indicating a command execution failure of the update available command
|
//! [EXPORT] : [COMMENT] Supervisor handler replied action message indicating a command execution
|
||||||
|
//! failure of the update available command
|
||||||
static const Event UPDATE_AVAILABLE_FAILED = MAKE_EVENT(2, severity::LOW);
|
static const Event UPDATE_AVAILABLE_FAILED = MAKE_EVENT(2, severity::LOW);
|
||||||
//! [EXPORT] : [COMMENT] Supervisor handler failed to transfer an update space packet.
|
//! [EXPORT] : [COMMENT] Supervisor handler failed to transfer an update space packet.
|
||||||
//! P1: Parameter holds the number of update packets already sent (inclusive the failed packet)
|
//! P1: Parameter holds the number of update packets already sent (inclusive the failed packet)
|
||||||
@ -122,21 +121,11 @@ private:
|
|||||||
|
|
||||||
ActionId_t pendingCommand = PLOC_SPV::NONE;
|
ActionId_t pendingCommand = PLOC_SPV::NONE;
|
||||||
|
|
||||||
enum class Image: uint8_t {
|
enum class Image : uint8_t { NONE, A, B };
|
||||||
NONE,
|
|
||||||
A,
|
|
||||||
B
|
|
||||||
};
|
|
||||||
|
|
||||||
Image image = Image::NONE;
|
Image image = Image::NONE;
|
||||||
|
|
||||||
enum class Partition: uint8_t {
|
enum class Partition : uint8_t { NONE, UBOOT, BITSTREAM, LINUX_OS, APP_SW };
|
||||||
NONE,
|
|
||||||
UBOOT,
|
|
||||||
BITSTREAM,
|
|
||||||
LINUX_OS,
|
|
||||||
APP_SW
|
|
||||||
};
|
|
||||||
|
|
||||||
Partition partition = Partition::NONE;
|
Partition partition = Partition::NONE;
|
||||||
|
|
||||||
@ -174,13 +163,6 @@ private:
|
|||||||
*/
|
*/
|
||||||
void commandUpdateVerify();
|
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
|
|
||||||
|
|
||||||
void calcImageCrc();
|
void calcImageCrc();
|
||||||
|
|
||||||
void adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet);
|
void adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet);
|
||||||
|
@ -5,18 +5,17 @@
|
|||||||
|
|
||||||
class MemoryParams : public SerialLinkedListAdapter<SerializeIF> {
|
class MemoryParams : public SerialLinkedListAdapter<SerializeIF> {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
* @param startAddress Start of address range to dump
|
* @param startAddress Start of address range to dump
|
||||||
* @param endAddress End of address range to dump
|
* @param endAddress End of address range to dump
|
||||||
*/
|
*/
|
||||||
MemoryParams(uint32_t startAddress, uint32_t endAddress) :
|
MemoryParams(uint32_t startAddress, uint32_t endAddress)
|
||||||
startAddress(startAddress), endAddress(endAddress) {
|
: startAddress(startAddress), endAddress(endAddress) {
|
||||||
setLinks();
|
setLinks();
|
||||||
}
|
}
|
||||||
private:
|
|
||||||
|
|
||||||
|
private:
|
||||||
void setLinks() {
|
void setLinks() {
|
||||||
setStart(&startAddress);
|
setStart(&startAddress);
|
||||||
startAddress.setNext(&endAddress);
|
startAddress.setNext(&endAddress);
|
||||||
@ -24,10 +23,6 @@ private:
|
|||||||
|
|
||||||
SerializeElement<uint32_t> startAddress;
|
SerializeElement<uint32_t> startAddress;
|
||||||
SerializeElement<uint32_t> endAddress;
|
SerializeElement<uint32_t> endAddress;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* BSP_Q7S_DEVICES_DEVICEDEFINITIONS_PLOCMEMDUMPDEFINITIONS_H_ */
|
#endif /* BSP_Q7S_DEVICES_DEVICEDEFINITIONS_PLOCMEMDUMPDEFINITIONS_H_ */
|
||||||
|
File diff suppressed because it is too large
Load Diff
62
bsp_q7s/devices/startracker/ArcsecDatalinkLayer.cpp
Normal file
62
bsp_q7s/devices/startracker/ArcsecDatalinkLayer.cpp
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
#include "ArcsecDatalinkLayer.h"
|
||||||
|
|
||||||
|
ArcsecDatalinkLayer::ArcsecDatalinkLayer() { slipInit(); }
|
||||||
|
|
||||||
|
ArcsecDatalinkLayer::~ArcsecDatalinkLayer() {}
|
||||||
|
|
||||||
|
void ArcsecDatalinkLayer::slipInit() {
|
||||||
|
slipInfo.buffer = rxBuffer;
|
||||||
|
slipInfo.maxlength = StarTracker::MAX_FRAME_SIZE;
|
||||||
|
slipInfo.length = 0;
|
||||||
|
slipInfo.unescape_next = 0;
|
||||||
|
slipInfo.prev_state = SLIP_COMPLETE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t ArcsecDatalinkLayer::decodeFrame(const uint8_t* rawData, size_t rawDataSize,
|
||||||
|
size_t* bytesLeft) {
|
||||||
|
size_t bytePos = 0;
|
||||||
|
for (bytePos = 0; bytePos < rawDataSize; bytePos++) {
|
||||||
|
enum arc_dec_result decResult =
|
||||||
|
arc_transport_decode_body(*(rawData + bytePos), &slipInfo, decodedFrame, &decFrameSize);
|
||||||
|
*bytesLeft = rawDataSize - bytePos - 1;
|
||||||
|
switch (decResult) {
|
||||||
|
case ARC_DEC_INPROGRESS: {
|
||||||
|
if (bytePos == rawDataSize - 1) {
|
||||||
|
return DEC_IN_PROGRESS;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
case ARC_DEC_ERROR_FRAME_SHORT:
|
||||||
|
return REPLY_TOO_SHORT;
|
||||||
|
case ARC_DEC_ERROR_CHECKSUM:
|
||||||
|
return CRC_FAILURE;
|
||||||
|
case ARC_DEC_ASYNC:
|
||||||
|
case ARC_DEC_SYNC: {
|
||||||
|
// Reset length of SLIP struct for next frame
|
||||||
|
slipInfo.length = 0;
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
sif::debug << "ArcsecDatalinkLayer::decodeFrame: Unknown result code" << std::endl;
|
||||||
|
break;
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t ArcsecDatalinkLayer::getReplyFrameType() { return decodedFrame[0]; }
|
||||||
|
|
||||||
|
const uint8_t* ArcsecDatalinkLayer::getReply() { return &decodedFrame[1]; }
|
||||||
|
|
||||||
|
void ArcsecDatalinkLayer::encodeFrame(const uint8_t* data, uint32_t length) {
|
||||||
|
arc_transport_encode_body(data, length, encBuffer, &encFrameSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t* ArcsecDatalinkLayer::getEncodedFrame() { return encBuffer; }
|
||||||
|
|
||||||
|
uint32_t ArcsecDatalinkLayer::getEncodedLength() { return encFrameSize; }
|
||||||
|
|
||||||
|
uint8_t ArcsecDatalinkLayer::getStatusField() { return *(decodedFrame + STATUS_OFFSET); }
|
||||||
|
|
||||||
|
uint8_t ArcsecDatalinkLayer::getId() { return *(decodedFrame + ID_OFFSET); }
|
98
bsp_q7s/devices/startracker/ArcsecDatalinkLayer.h
Normal file
98
bsp_q7s/devices/startracker/ArcsecDatalinkLayer.h
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
#ifndef BSP_Q7S_DEVICES_ARCSECDATALINKLAYER_H_
|
||||||
|
#define BSP_Q7S_DEVICES_ARCSECDATALINKLAYER_H_
|
||||||
|
|
||||||
|
#include "StarTrackerDefinitions.h"
|
||||||
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "common/misc.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Helper class to handle the datalinklayer of replies from the star tracker of arcsec.
|
||||||
|
*/
|
||||||
|
class ArcsecDatalinkLayer : public HasReturnvaluesIF {
|
||||||
|
public:
|
||||||
|
static const uint8_t INTERFACE_ID = CLASS_ID::STR_HANDLER;
|
||||||
|
|
||||||
|
//! [EXPORT] : [COMMENT] More data required to complete frame
|
||||||
|
static const ReturnValue_t DEC_IN_PROGRESS = MAKE_RETURN_CODE(0xA0);
|
||||||
|
//! [EXPORT] : [COMMENT] Data too short to represent a valid frame
|
||||||
|
static const ReturnValue_t REPLY_TOO_SHORT = MAKE_RETURN_CODE(0xA1);
|
||||||
|
//! [EXPORT] : [COMMENT] Detected CRC failure in received frame
|
||||||
|
static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA2);
|
||||||
|
|
||||||
|
static const uint8_t STATUS_OK = 0;
|
||||||
|
|
||||||
|
ArcsecDatalinkLayer();
|
||||||
|
virtual ~ArcsecDatalinkLayer();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Applies decoding to data referenced by rawData pointer
|
||||||
|
*
|
||||||
|
* @param rawData Pointer to raw data received from star tracker
|
||||||
|
* @param rawDataSize Size of raw data stream
|
||||||
|
* @param remainingBytes Number of bytes left
|
||||||
|
*/
|
||||||
|
ReturnValue_t decodeFrame(const uint8_t* rawData, size_t rawDataSize, size_t* bytesLeft);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SLIP encodes data pointed to by data pointer.
|
||||||
|
*
|
||||||
|
* @param data Pointer to data to encode
|
||||||
|
* @param length Length of buffer to encode
|
||||||
|
*/
|
||||||
|
void encodeFrame(const uint8_t* data, uint32_t length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns the frame type field of a decoded frame.
|
||||||
|
*/
|
||||||
|
uint8_t getReplyFrameType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns pointer to reply packet (first entry normally action ID, telemetry ID etc.)
|
||||||
|
*/
|
||||||
|
const uint8_t* getReply();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns size of encoded frame
|
||||||
|
*/
|
||||||
|
uint32_t getEncodedLength();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns pointer to encoded frame
|
||||||
|
*/
|
||||||
|
uint8_t* getEncodedFrame();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns status of reply
|
||||||
|
*/
|
||||||
|
uint8_t getStatusField();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns ID of reply
|
||||||
|
*/
|
||||||
|
uint8_t getId();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const uint8_t ID_OFFSET = 1;
|
||||||
|
static const uint8_t STATUS_OFFSET = 2;
|
||||||
|
|
||||||
|
// Used by arcsec slip decoding function process received data
|
||||||
|
uint8_t rxBuffer[StarTracker::MAX_FRAME_SIZE];
|
||||||
|
// Decoded frame will be copied to this buffer
|
||||||
|
uint8_t decodedFrame[StarTracker::MAX_FRAME_SIZE];
|
||||||
|
// Buffer where encoded frames will be stored. First byte of encoded frame represents type of
|
||||||
|
// reply
|
||||||
|
uint8_t encBuffer[StarTracker::MAX_FRAME_SIZE * 2 + 2];
|
||||||
|
// Size of decoded frame
|
||||||
|
uint32_t decFrameSize = 0;
|
||||||
|
// Size of encoded frame
|
||||||
|
uint32_t encFrameSize = 0;
|
||||||
|
|
||||||
|
slip_decode_state slipInfo;
|
||||||
|
|
||||||
|
void slipInit();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* BSP_Q7S_DEVICES_ARCSECDATALINKLAYER_H_ */
|
126
bsp_q7s/devices/startracker/ArcsecJsonKeys.h
Normal file
126
bsp_q7s/devices/startracker/ArcsecJsonKeys.h
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
#ifndef BSP_Q7S_DEVICES_DEVICEDEFINITIONS_ARCSECJSONKEYS_H_
|
||||||
|
#define BSP_Q7S_DEVICES_DEVICEDEFINITIONS_ARCSECJSONKEYS_H_
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Keys used in JSON file of ARCSEC.
|
||||||
|
*/
|
||||||
|
namespace arcseckeys {
|
||||||
|
static const char PROPERTIES[] = "properties";
|
||||||
|
static const char NAME[] = "name";
|
||||||
|
static const char VALUE[] = "value";
|
||||||
|
|
||||||
|
static const char LIMITS[] = "limits";
|
||||||
|
static const char ACTION[] = "action";
|
||||||
|
static const char FPGA18CURRENT[] = "FPGA18Current";
|
||||||
|
static const char FPGA25CURRENT[] = "FPGA25Current";
|
||||||
|
static const char FPGA10CURRENT[] = "FPGA10Current";
|
||||||
|
static const char MCUCURRENT[] = "MCUCurrent";
|
||||||
|
static const char CMOS21CURRENT[] = "CMOS21Current";
|
||||||
|
static const char CMOSPIXCURRENT[] = "CMOSPixCurrent";
|
||||||
|
static const char CMOS33CURRENT[] = "CMOS33Current";
|
||||||
|
static const char CMOSVRESCURRENT[] = "CMOSVResCurrent";
|
||||||
|
static const char CMOS_TEMPERATURE[] = "CMOSTemperature";
|
||||||
|
static const char MCU_TEMPERATURE[] = "MCUTemperature";
|
||||||
|
|
||||||
|
static const char MOUNTING[] = "mounting";
|
||||||
|
static const char qw[] = "qw";
|
||||||
|
static const char qx[] = "qx";
|
||||||
|
static const char qy[] = "qy";
|
||||||
|
static const char qz[] = "qz";
|
||||||
|
|
||||||
|
static const char CAMERA[] = "camera";
|
||||||
|
static const char MODE[] = "mode";
|
||||||
|
static const char FOCALLENGTH[] = "focallength";
|
||||||
|
static const char EXPOSURE[] = "exposure";
|
||||||
|
static const char INTERVAL[] = "interval";
|
||||||
|
static const char OFFSET[] = "offset";
|
||||||
|
static const char PGAGAIN[] = "PGAGain";
|
||||||
|
static const char ADCGAIN[] = "ADCGain";
|
||||||
|
static const char REG_1[] = "reg1";
|
||||||
|
static const char VAL_1[] = "val1";
|
||||||
|
static const char REG_2[] = "reg2";
|
||||||
|
static const char VAL_2[] = "val2";
|
||||||
|
static const char REG_3[] = "reg3";
|
||||||
|
static const char VAL_3[] = "val3";
|
||||||
|
static const char REG_4[] = "reg4";
|
||||||
|
static const char VAL_4[] = "val4";
|
||||||
|
static const char REG_5[] = "reg5";
|
||||||
|
static const char VAL_5[] = "val5";
|
||||||
|
static const char REG_6[] = "reg6";
|
||||||
|
static const char VAL_6[] = "val6";
|
||||||
|
static const char REG_7[] = "reg7";
|
||||||
|
static const char VAL_7[] = "val7";
|
||||||
|
static const char REG_8[] = "reg8";
|
||||||
|
static const char VAL_8[] = "val8";
|
||||||
|
static const char FREQ_1[] = "freq1";
|
||||||
|
static const char FREQ_2[] = "freq2";
|
||||||
|
|
||||||
|
static const char BLOB[] = "blob";
|
||||||
|
static const char MIN_VALUE[] = "minValue";
|
||||||
|
static const char MIN_DISTANCE[] = "minDistance";
|
||||||
|
static const char NEIGHBOUR_DISTANCE[] = "neighbourDistance";
|
||||||
|
static const char NEIGHBOUR_BRIGHT_PIXELS[] = "neighbourBrightPixels";
|
||||||
|
static const char MIN_TOTAL_VALUE[] = "minTotalValue";
|
||||||
|
static const char MAX_TOTAL_VALUE[] = "maxTotalValue";
|
||||||
|
static const char MIN_BRIGHT_NEIGHBOURS[] = "minBrightNeighbours";
|
||||||
|
static const char MAX_BRIGHT_NEIGHBOURS[] = "maxBrightNeighbours";
|
||||||
|
static const char MAX_PIXEL_TO_CONSIDER[] = "maxPixelsToConsider";
|
||||||
|
static const char SIGNAL_THRESHOLD[] = "signalThreshold";
|
||||||
|
static const char DARK_THRESHOLD[] = "darkThreshold";
|
||||||
|
static const char ENABLE_HISTOGRAM[] = "enableHistogram";
|
||||||
|
static const char ENABLE_CONTRAST[] = "enableContrast";
|
||||||
|
static const char BIN_MODE[] = "binMode";
|
||||||
|
|
||||||
|
static const char CENTROIDING[] = "centroiding";
|
||||||
|
static const char ENABLE_FILTER[] = "enableFilter";
|
||||||
|
static const char MAX_QUALITY[] = "maxquality";
|
||||||
|
static const char MIN_QUALITY[] = "minquality";
|
||||||
|
static const char MAX_INTENSITY[] = "maxintensity";
|
||||||
|
static const char MIN_INTENSITY[] = "minintensity";
|
||||||
|
static const char MAX_MAGNITUDE[] = "maxmagnitude";
|
||||||
|
static const char GAUSSIAN_CMAX[] = "gaussianCmax";
|
||||||
|
static const char GAUSSIAN_CMIN[] = "gaussianCmin";
|
||||||
|
static const char TRANSMATRIX_00[] = "transmatrix00";
|
||||||
|
static const char TRANSMATRIX_01[] = "transmatrix01";
|
||||||
|
static const char TRANSMATRIX_10[] = "transmatrix10";
|
||||||
|
static const char TRANSMATRIX_11[] = "transmatrix11";
|
||||||
|
|
||||||
|
static const char LISA[] = "lisa";
|
||||||
|
static const char PREFILTER_DIST_THRESHOLD[] = "prefilterDistThreshold";
|
||||||
|
static const char PREFILTER_ANGLE_THRESHOLD[] = "prefilterAngleThreshold";
|
||||||
|
static const char FOV_WIDTH[] = "fov_width";
|
||||||
|
static const char FOV_HEIGHT[] = "fov_height";
|
||||||
|
static const char FLOAT_STAR_LIMIT[] = "float_star_limit";
|
||||||
|
static const char CLOSE_STAR_LIMIT[] = "close_star_limit";
|
||||||
|
static const char RATING_WEIGHT_CLOSE_STAR_COUNT[] = "rating_weight_close_star_count";
|
||||||
|
static const char RATING_WEIGHT_FRACTION_CLOSE[] = "rating_weight_fraction_close";
|
||||||
|
static const char RATING_WEIGHT_MEAN_SUM[] = "rating_weight_mean_sum";
|
||||||
|
static const char RATING_WEIGHT_DB_STAR_COUNT[] = "rating_weight_db_star_count";
|
||||||
|
static const char MAX_COMBINATIONS[] = "max_combinations";
|
||||||
|
static const char NR_STARS_STOP[] = "nr_stars_stop";
|
||||||
|
static const char FRACTION_CLOSE_STOP[] = "fraction_close_stop";
|
||||||
|
|
||||||
|
static const char MATCHING[] = "matching";
|
||||||
|
static const char SQUARED_DISTANCE_LIMIT[] = "squaredDistanceLimit";
|
||||||
|
static const char SQUARED_SHIFT_LIMIT[] = "squaredShiftLimit";
|
||||||
|
|
||||||
|
static const char VALIDATION[] = "validation";
|
||||||
|
static const char STABLE_COUNT[] = "stable_count";
|
||||||
|
static const char MAX_DIFFERENCE[] = "max_difference";
|
||||||
|
static const char MIN_TRACKER_CONFIDENCE[] = "min_trackerConfidence";
|
||||||
|
static const char MIN_MATCHED_STARS[] = "min_matchedStars";
|
||||||
|
|
||||||
|
static const char TRACKING[] = "tracking";
|
||||||
|
static const char THIN_LIMIT[] = "thinLimit";
|
||||||
|
static const char OUTLIER_THRESHOLD[] = "outlierThreshold";
|
||||||
|
static const char OUTLIER_THRESHOLD_QUEST[] = "outlierThresholdQUEST";
|
||||||
|
static const char TRACKER_CHOICE[] = "trackerChoice";
|
||||||
|
|
||||||
|
static const char ALGO[] = "algo";
|
||||||
|
static const char L2T_MIN_CONFIDENCE[] = "l2t_minConfidence";
|
||||||
|
static const char L2T_MIN_MATCHED[] = "l2t_minConfidence";
|
||||||
|
static const char T2L_MIN_CONFIDENCE[] = "t2l_minConfidence";
|
||||||
|
static const char T2L_MIN_MATCHED[] = "t2l_minMatched";
|
||||||
|
} // namespace arcseckeys
|
||||||
|
|
||||||
|
#endif /* BSP_Q7S_DEVICES_DEVICEDEFINITIONS_ARCSECJSONKEYS_H_ */
|
95
bsp_q7s/devices/startracker/ArcsecJsonParamBase.cpp
Normal file
95
bsp_q7s/devices/startracker/ArcsecJsonParamBase.cpp
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
#include "ArcsecJsonParamBase.h"
|
||||||
|
|
||||||
|
#include "ArcsecJsonKeys.h"
|
||||||
|
|
||||||
|
ArcsecJsonParamBase::ArcsecJsonParamBase(std::string setName) : setName(setName) {}
|
||||||
|
|
||||||
|
ReturnValue_t ArcsecJsonParamBase::create(std::string fullname, uint8_t* buffer) {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
result = init(fullname);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = createCommand(buffer);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t ArcsecJsonParamBase::getParam(const std::string name, std::string& value) {
|
||||||
|
for (json::iterator it = set.begin(); it != set.end(); ++it) {
|
||||||
|
if ((*it)[arcseckeys::NAME] == name) {
|
||||||
|
value = (*it)[arcseckeys::VALUE];
|
||||||
|
convertEmpty(value);
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PARAM_NOT_EXISTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ArcsecJsonParamBase::convertEmpty(std::string& value) {
|
||||||
|
if (value == "") {
|
||||||
|
value = "0";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ArcsecJsonParamBase::addfloat(const std::string value, uint8_t* buffer) {
|
||||||
|
float param = std::stof(value);
|
||||||
|
std::memcpy(buffer, ¶m, sizeof(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ArcsecJsonParamBase::adduint8(const std::string value, uint8_t* buffer) {
|
||||||
|
uint8_t param = std::stoi(value);
|
||||||
|
std::memcpy(buffer, ¶m, sizeof(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ArcsecJsonParamBase::addint16(const std::string value, uint8_t* buffer) {
|
||||||
|
int16_t param = std::stoi(value);
|
||||||
|
std::memcpy(buffer, ¶m, sizeof(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ArcsecJsonParamBase::adduint16(const std::string value, uint8_t* buffer) {
|
||||||
|
uint16_t param = std::stoi(value);
|
||||||
|
std::memcpy(buffer, ¶m, sizeof(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ArcsecJsonParamBase::adduint32(const std::string value, uint8_t* buffer) {
|
||||||
|
uint32_t param = std::stoi(value);
|
||||||
|
std::memcpy(buffer, ¶m, sizeof(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ArcsecJsonParamBase::addSetParamHeader(uint8_t* buffer, uint8_t setId) {
|
||||||
|
*buffer = static_cast<uint8_t>(TMTC_SETPARAMREQ);
|
||||||
|
*(buffer + 1) = setId;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t ArcsecJsonParamBase::init(const std::string filename) {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
if (not std::filesystem::exists(filename)) {
|
||||||
|
sif::warning << "ArcsecJsonParamBase::init: JSON file " << filename << " does not exist"
|
||||||
|
<< std::endl;
|
||||||
|
return JSON_FILE_NOT_EXISTS;
|
||||||
|
}
|
||||||
|
createJsonObject(filename);
|
||||||
|
result = initSet();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ArcsecJsonParamBase::createJsonObject(const std::string fullname) {
|
||||||
|
json j;
|
||||||
|
std::ifstream file(fullname);
|
||||||
|
file >> j;
|
||||||
|
file.close();
|
||||||
|
properties = j[arcseckeys::PROPERTIES];
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t ArcsecJsonParamBase::initSet() {
|
||||||
|
for (json::iterator it = properties.begin(); it != properties.end(); ++it) {
|
||||||
|
if ((*it)["name"] == setName) {
|
||||||
|
set = (*it)["fields"];
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return SET_NOT_EXISTS;
|
||||||
|
}
|
146
bsp_q7s/devices/startracker/ArcsecJsonParamBase.h
Normal file
146
bsp_q7s/devices/startracker/ArcsecJsonParamBase.h
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
#ifndef BSP_Q7S_DEVICES_STARTRACKER_ARCSECJSONPARAMBASE_H_
|
||||||
|
#define BSP_Q7S_DEVICES_STARTRACKER_ARCSECJSONPARAMBASE_H_
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
|
#include <fstream>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
#include "StarTrackerDefinitions.h"
|
||||||
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "thirdparty/arcsec_star_tracker/common/generated/tmtcstructs.h"
|
||||||
|
#include "thirdparty/arcsec_star_tracker/common/genericstructs.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
using json = nlohmann::json;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Base class for creation of parameter configuration commands. Reads parameter set
|
||||||
|
* from a json file located on the filesystem and generates the appropriate command
|
||||||
|
* to apply the parameters to the star tracker software.
|
||||||
|
*
|
||||||
|
* @author J. Meier
|
||||||
|
*/
|
||||||
|
class ArcsecJsonParamBase : public HasReturnvaluesIF {
|
||||||
|
public:
|
||||||
|
static const uint8_t INTERFACE_ID = CLASS_ID::ARCSEC_JSON_BASE;
|
||||||
|
//! [EXPORT] : [COMMENT] Specified json file does not exist
|
||||||
|
static const ReturnValue_t JSON_FILE_NOT_EXISTS = MAKE_RETURN_CODE(1);
|
||||||
|
//! [EXPORT] : [COMMENT] Requested set does not exist in json file
|
||||||
|
static const ReturnValue_t SET_NOT_EXISTS = MAKE_RETURN_CODE(2);
|
||||||
|
//! [EXPORT] : [COMMENT] Requested parameter does not exist in json file
|
||||||
|
static const ReturnValue_t PARAM_NOT_EXISTS = MAKE_RETURN_CODE(3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Constructor
|
||||||
|
*
|
||||||
|
* @param fullname Name with absolute path of json file containing the parameters to set.
|
||||||
|
*/
|
||||||
|
ArcsecJsonParamBase(std::string setName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills a buffer with a parameter set
|
||||||
|
*
|
||||||
|
* @param fullname The name including the absolute path of the json file containing the
|
||||||
|
* parameter set.
|
||||||
|
* @param buffer Pointer to the buffer the command will be written to
|
||||||
|
*/
|
||||||
|
ReturnValue_t create(std::string fullname, uint8_t* buffer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns the size of the parameter command.
|
||||||
|
*/
|
||||||
|
virtual size_t getSize() = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* @brief Reads the value of a parameter from a json set
|
||||||
|
*
|
||||||
|
* @param name The name of the parameter
|
||||||
|
* @param value The string representation of the read value
|
||||||
|
*
|
||||||
|
* @return RETURN_OK if successful, otherwise PARAM_NOT_EXISTS
|
||||||
|
*/
|
||||||
|
ReturnValue_t getParam(const std::string name, std::string& value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Converts empty string which is equal to define a value as zero.
|
||||||
|
*/
|
||||||
|
void convertEmpty(std::string& value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function adds a float represented as string to a buffer
|
||||||
|
*
|
||||||
|
* @param value The float in string representation to add
|
||||||
|
* @param buffer Pointer to the buffer the float will be written to
|
||||||
|
*/
|
||||||
|
void addfloat(const std::string value, uint8_t* buffer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function adds a uint8_t represented as string to a buffer
|
||||||
|
*
|
||||||
|
* @param value The uint8_t in string representation to add
|
||||||
|
* @param buffer Pointer to the buffer the uint8_t will be written to
|
||||||
|
*/
|
||||||
|
void adduint8(const std::string value, uint8_t* buffer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function adds a int16_t represented as string to a buffer
|
||||||
|
*
|
||||||
|
* @param value The int16_t in string representation to add
|
||||||
|
* @param buffer Pointer to the buffer the int16_t will be written to
|
||||||
|
*/
|
||||||
|
void addint16(const std::string value, uint8_t* buffer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function adds a uint16_t represented as string to a buffer
|
||||||
|
*
|
||||||
|
* @param value The uint16_t in string representation to add
|
||||||
|
* @param buffer Pointer to the buffer the uint16_t will be written to
|
||||||
|
*/
|
||||||
|
void adduint16(const std::string value, uint8_t* buffer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function adds a uint32_t represented as string to a buffer
|
||||||
|
*
|
||||||
|
* @param value The uint32_t in string representation to add
|
||||||
|
* @param buffer Pointer to the buffer the uint32_t will be written to
|
||||||
|
*/
|
||||||
|
void adduint32(const std::string value, uint8_t* buffer);
|
||||||
|
|
||||||
|
void addSetParamHeader(uint8_t* buffer, uint8_t setId);
|
||||||
|
|
||||||
|
private:
|
||||||
|
json properties;
|
||||||
|
json set;
|
||||||
|
std::string setName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function must be implemented by the derived class to define creation of a
|
||||||
|
* parameter command.
|
||||||
|
*/
|
||||||
|
virtual ReturnValue_t createCommand(uint8_t* buffer) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initializes the properties json object and the set json object
|
||||||
|
*
|
||||||
|
* @param fullname Name including absolute path to json file
|
||||||
|
* @param setName The name of the set to work on
|
||||||
|
*
|
||||||
|
* @param return JSON_FILE_NOT_EXISTS if specified file does not exist, otherwise
|
||||||
|
* RETURN_OK
|
||||||
|
*/
|
||||||
|
ReturnValue_t init(const std::string filename);
|
||||||
|
|
||||||
|
void createJsonObject(const std::string fullname);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Extracts the json set object form the json file
|
||||||
|
*
|
||||||
|
* @param setName The name of the set to create the json object from
|
||||||
|
*/
|
||||||
|
ReturnValue_t initSet();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* BSP_Q7S_DEVICES_STARTRACKER_ARCSECJSONPARAMBASE_H_ */
|
7
bsp_q7s/devices/startracker/CMakeLists.txt
Normal file
7
bsp_q7s/devices/startracker/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
target_sources(${TARGET_NAME} PRIVATE
|
||||||
|
StarTrackerHandler.cpp
|
||||||
|
StarTrackerJsonCommands.cpp
|
||||||
|
ArcsecDatalinkLayer.cpp
|
||||||
|
ArcsecJsonParamBase.cpp
|
||||||
|
StrHelper.cpp
|
||||||
|
)
|
1048
bsp_q7s/devices/startracker/StarTrackerDefinitions.h
Normal file
1048
bsp_q7s/devices/startracker/StarTrackerDefinitions.h
Normal file
File diff suppressed because it is too large
Load Diff
1947
bsp_q7s/devices/startracker/StarTrackerHandler.cpp
Normal file
1947
bsp_q7s/devices/startracker/StarTrackerHandler.cpp
Normal file
File diff suppressed because it is too large
Load Diff
543
bsp_q7s/devices/startracker/StarTrackerHandler.h
Normal file
543
bsp_q7s/devices/startracker/StarTrackerHandler.h
Normal file
@ -0,0 +1,543 @@
|
|||||||
|
#ifndef MISSION_DEVICES_STARTRACKERHANDLER_H_
|
||||||
|
#define MISSION_DEVICES_STARTRACKERHANDLER_H_
|
||||||
|
|
||||||
|
#include <fsfw/datapool/PoolReadGuard.h>
|
||||||
|
|
||||||
|
#include "ArcsecDatalinkLayer.h"
|
||||||
|
#include "ArcsecJsonParamBase.h"
|
||||||
|
#include "StarTrackerDefinitions.h"
|
||||||
|
#include "StrHelper.h"
|
||||||
|
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
||||||
|
#include "fsfw/src/fsfw/serialize/SerializeAdapter.h"
|
||||||
|
#include "fsfw/timemanager/Countdown.h"
|
||||||
|
#include "thirdparty/arcsec_star_tracker/common/SLIP.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This is the device handler for the star tracker from arcsec.
|
||||||
|
*
|
||||||
|
* @details Datasheet: https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/
|
||||||
|
* Arbeitsdaten/08_Used%20Components/ArcSec_KULeuven_Startracker/
|
||||||
|
* Sagitta%201.0%20Datapack&fileid=659181
|
||||||
|
* @author J. Meier
|
||||||
|
*/
|
||||||
|
class StarTrackerHandler : public DeviceHandlerBase {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructor
|
||||||
|
*
|
||||||
|
* @param objectId
|
||||||
|
* @param comIF
|
||||||
|
* @param comCookie
|
||||||
|
* @param gpioComIF Pointer to gpio communication interface
|
||||||
|
* @param enablePin GPIO connected to the enable pin of the reaction wheels. Must be pulled
|
||||||
|
* to high to enable the device.
|
||||||
|
*/
|
||||||
|
StarTrackerHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
|
||||||
|
StrHelper* strHelper);
|
||||||
|
virtual ~StarTrackerHandler();
|
||||||
|
|
||||||
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Overwrite this function from DHB to handle commands executed by the str image
|
||||||
|
* loader task.
|
||||||
|
*/
|
||||||
|
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
|
const uint8_t* data, size_t size) override;
|
||||||
|
|
||||||
|
void performOperationHook() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void doStartUp() override;
|
||||||
|
void doShutDown() override;
|
||||||
|
void doOffActivity() override;
|
||||||
|
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
||||||
|
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
|
||||||
|
void fillCommandAndReplyMap() override;
|
||||||
|
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
|
||||||
|
size_t commandDataLen) override;
|
||||||
|
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
|
||||||
|
size_t* foundLen) override;
|
||||||
|
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
||||||
|
void setNormalDatapoolEntriesInvalid() override;
|
||||||
|
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||||
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
|
LocalDataPoolManager& poolManager) override;
|
||||||
|
/**
|
||||||
|
* @brief Overwritten here to always read all available data from the UartComIF.
|
||||||
|
*/
|
||||||
|
virtual size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
|
||||||
|
virtual ReturnValue_t doSendReadHook() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const uint8_t INTERFACE_ID = CLASS_ID::STR_HANDLER;
|
||||||
|
|
||||||
|
//! [EXPORT] : [COMMENT] Received reply is too short
|
||||||
|
static const ReturnValue_t REPLY_TOO_SHORT = MAKE_RETURN_CODE(0xB0);
|
||||||
|
//! [EXPORT] : [COMMENT] Received reply with invalid CRC
|
||||||
|
static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xB1);
|
||||||
|
//! [EXPORT] : [COMMENT] Image loader executing
|
||||||
|
static const ReturnValue_t IMAGE_LOADER_EXECUTING = MAKE_RETURN_CODE(0xB2);
|
||||||
|
|
||||||
|
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::STR_HANDLER;
|
||||||
|
|
||||||
|
//! [EXPORT] : [COMMENT] Status in temperature reply signals error
|
||||||
|
static const ReturnValue_t TEMPERATURE_REQ_FAILED = MAKE_RETURN_CODE(0xA0);
|
||||||
|
//! [EXPORT] : [COMMENT] Ping command failed
|
||||||
|
static const ReturnValue_t PING_FAILED = MAKE_RETURN_CODE(0xA1);
|
||||||
|
//! [EXPORT] : [COMMENT] Status in version reply signals error
|
||||||
|
static const ReturnValue_t VERSION_REQ_FAILED = MAKE_RETURN_CODE(0xA3);
|
||||||
|
//! [EXPORT] : [COMMENT] Status in interface reply signals error
|
||||||
|
static const ReturnValue_t INTERFACE_REQ_FAILED = MAKE_RETURN_CODE(0xA4);
|
||||||
|
//! [EXPORT] : [COMMENT] Status in power reply signals error
|
||||||
|
static const ReturnValue_t POWER_REQ_FAILED = MAKE_RETURN_CODE(0xA5);
|
||||||
|
//! [EXPORT] : [COMMENT] Status of reply to parameter set command signals error
|
||||||
|
static const ReturnValue_t SET_PARAM_FAILED = MAKE_RETURN_CODE(0xA6);
|
||||||
|
//! [EXPORT] : [COMMENT] Status of reply to action command signals error
|
||||||
|
static const ReturnValue_t ACTION_FAILED = MAKE_RETURN_CODE(0xA7);
|
||||||
|
//! [EXPORT] : [COMMENT] Received upload image command with invalid length
|
||||||
|
static const ReturnValue_t UPLOAD_TOO_SHORT = MAKE_RETURN_CODE(0xA8);
|
||||||
|
//! [EXPORT] : [COMMENT] Received upload image command with invalid position field
|
||||||
|
static const ReturnValue_t UPLOAD_INVALID_POSITION = MAKE_RETURN_CODE(0xA8);
|
||||||
|
//! [EXPORT] : [COMMENT] Position value in upload image reply not matching sent position
|
||||||
|
static const ReturnValue_t UPLOAD_IMAGE_FAILED = MAKE_RETURN_CODE(0xA9);
|
||||||
|
//! [EXPORT] : [COMMENT] Received upload image command with invalid length
|
||||||
|
static const ReturnValue_t INVALID_UPLOAD_COMMAND = MAKE_RETURN_CODE(0xAA);
|
||||||
|
//! [EXPORT] : [COMMENT] Received invalid path string. Exceeds allowed length
|
||||||
|
static const ReturnValue_t FILE_PATH_TOO_LONG = MAKE_RETURN_CODE(0xAB);
|
||||||
|
//! [EXPORT] : [COMMENT] Name of file received with command is too long
|
||||||
|
static const ReturnValue_t FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xAC);
|
||||||
|
//! [EXPORT] : [COMMENT] Received version reply with invalid program ID
|
||||||
|
static const ReturnValue_t INVALID_PROGRAM = MAKE_RETURN_CODE(0xAD);
|
||||||
|
//! [EXPORT] : [COMMENT] Status field reply signals error
|
||||||
|
static const ReturnValue_t REPLY_ERROR = MAKE_RETURN_CODE(0xAE);
|
||||||
|
//! [EXPORT] : [COMMENT] Status field of contrast reply signals error
|
||||||
|
static const ReturnValue_t CONTRAST_REQ_FAILED = MAKE_RETURN_CODE(0xAE);
|
||||||
|
//! [EXPORT] : [COMMENT] Received command which is too short (some data is missing for proper
|
||||||
|
//! execution)
|
||||||
|
static const ReturnValue_t COMMAND_TOO_SHORT = MAKE_RETURN_CODE(0xAF);
|
||||||
|
//! [EXPORT] : [COMMENT] Received command with invalid length (too few or too many parameters)
|
||||||
|
static const ReturnValue_t INVALID_LENGTH = MAKE_RETURN_CODE(0xB0);
|
||||||
|
//! [EXPORT] : [COMMENT] Region mismatch between send and received data
|
||||||
|
static const ReturnValue_t REGION_MISMATCH = MAKE_RETURN_CODE(0xB1);
|
||||||
|
//! [EXPORT] : [COMMENT] Address mismatch between send and received data
|
||||||
|
static const ReturnValue_t ADDRESS_MISMATCH = MAKE_RETURN_CODE(0xB2);
|
||||||
|
//! [EXPORT] : [COMMENT] Length field mismatch between send and received data
|
||||||
|
static const ReturnValue_t lENGTH_MISMATCH = MAKE_RETURN_CODE(0xB3);
|
||||||
|
//! [EXPORT] : [COMMENT] Specified file does not exist
|
||||||
|
static const ReturnValue_t FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xB4);
|
||||||
|
//! [EXPORT] : [COMMENT] Reply to upload centroid does not match commanded centroid id
|
||||||
|
static const ReturnValue_t UPLOAD_CENTROID_ID_MISMATCH = MAKE_RETURN_CODE(0xB5);
|
||||||
|
//! [EXPORT] : [COMMENT] Download blob pixel command has invalid type field
|
||||||
|
static const ReturnValue_t INVALID_TYPE = MAKE_RETURN_CODE(0xB6);
|
||||||
|
//! [EXPORT] : [COMMENT] Received FPGA action command with invalid ID
|
||||||
|
static const ReturnValue_t INVALID_ID = MAKE_RETURN_CODE(0xB7);
|
||||||
|
|
||||||
|
static const size_t MAX_PATH_SIZE = 50;
|
||||||
|
static const size_t MAX_FILE_NAME = 30;
|
||||||
|
|
||||||
|
// position (uint32) + 1024 image data
|
||||||
|
static const size_t UPLOAD_COMMAND_LEN = 1028;
|
||||||
|
// Max valid position value in upload image command
|
||||||
|
static const uint16_t MAX_POSITION = 4095;
|
||||||
|
static const uint8_t STATUS_OFFSET = 1;
|
||||||
|
static const uint8_t TICKS_OFFSET = 2;
|
||||||
|
static const uint8_t TIME_OFFSET = 6;
|
||||||
|
static const uint8_t TM_DATA_FIELD_OFFSET = 14;
|
||||||
|
static const uint8_t PARAMETER_ID_OFFSET = 0;
|
||||||
|
static const uint8_t ACTION_ID_OFFSET = 0;
|
||||||
|
static const uint8_t ACTION_DATA_OFFSET = 2;
|
||||||
|
// Ping request will reply ping with this ID (data field)
|
||||||
|
static const uint32_t PING_ID = 0x55;
|
||||||
|
static const uint32_t BOOT_REGION_ID = 1;
|
||||||
|
static const MutexIF::TimeoutType TIMEOUT_TYPE = MutexIF::TimeoutType::WAITING;
|
||||||
|
static const uint32_t MUTEX_TIMEOUT = 20;
|
||||||
|
static const uint32_t BOOT_TIMEOUT = 1000;
|
||||||
|
|
||||||
|
class WriteCmd {
|
||||||
|
public:
|
||||||
|
static const uint8_t ADDRESS_OFFSET = 1;
|
||||||
|
static const uint8_t FILE_OFFSET = 5;
|
||||||
|
// Minimum length of a write command (region, address and filename)
|
||||||
|
static const size_t MIN_LENGTH = 7;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ReadCmd {
|
||||||
|
public:
|
||||||
|
static const uint8_t ADDRESS_OFFSET = 1;
|
||||||
|
static const uint8_t LENGTH_OFFSET = 5;
|
||||||
|
static const uint8_t FILE_OFFSET = 9;
|
||||||
|
// Minimum length of a read command (region, address, length and filename)
|
||||||
|
static const size_t MIN_LENGTH = 11;
|
||||||
|
};
|
||||||
|
|
||||||
|
class EraseCmd {
|
||||||
|
public:
|
||||||
|
static const uint8_t LENGTH = 1;
|
||||||
|
uint8_t rememberRegion = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
EraseCmd eraseCmd;
|
||||||
|
|
||||||
|
class UnlockCmd {
|
||||||
|
public:
|
||||||
|
static const uint8_t CODE_OFFSET = 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ChecksumCmd {
|
||||||
|
public:
|
||||||
|
static const uint8_t ADDRESS_OFFSET = 1;
|
||||||
|
static const uint8_t LENGTH_OFFSET = 5;
|
||||||
|
// Length of checksum command
|
||||||
|
static const size_t LENGTH = 9;
|
||||||
|
uint8_t rememberRegion = 0;
|
||||||
|
uint32_t rememberAddress = 0;
|
||||||
|
uint32_t rememberLength = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
ChecksumCmd checksumCmd;
|
||||||
|
|
||||||
|
class SetTimeCmd {
|
||||||
|
public:
|
||||||
|
static const uint8_t LENGTH = 8;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DownloadCentroidCmd {
|
||||||
|
public:
|
||||||
|
static const uint8_t LENGTH = 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
class UploadCentroid {
|
||||||
|
public:
|
||||||
|
uint8_t rememberId = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
UploadCentroid uploadCentroid;
|
||||||
|
|
||||||
|
class DownloadMatchedStarCmd {
|
||||||
|
public:
|
||||||
|
static const uint8_t LENGTH = 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DownloadDbImageCmd {
|
||||||
|
public:
|
||||||
|
static const uint8_t LENGTH = 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DownloadBlobPixCmd {
|
||||||
|
public:
|
||||||
|
static const uint8_t LENGTH = 2;
|
||||||
|
static const uint8_t NORMAL = 0;
|
||||||
|
static const uint8_t FAST = 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
class FpgaDownloadCmd {
|
||||||
|
public:
|
||||||
|
static const uint8_t MIN_LENGTH = 10;
|
||||||
|
};
|
||||||
|
|
||||||
|
class FpgaActionCmd {
|
||||||
|
public:
|
||||||
|
static const uint8_t LENGTH = 1;
|
||||||
|
static const uint8_t ID = 3;
|
||||||
|
};
|
||||||
|
|
||||||
|
MessageQueueIF* eventQueue = nullptr;
|
||||||
|
|
||||||
|
ArcsecDatalinkLayer dataLinkLayer;
|
||||||
|
|
||||||
|
StarTracker::TemperatureSet temperatureSet;
|
||||||
|
StarTracker::VersionSet versionSet;
|
||||||
|
StarTracker::PowerSet powerSet;
|
||||||
|
StarTracker::InterfaceSet interfaceSet;
|
||||||
|
StarTracker::TimeSet timeSet;
|
||||||
|
StarTracker::SolutionSet solutionSet;
|
||||||
|
StarTracker::HistogramSet histogramSet;
|
||||||
|
StarTracker::ContrastSet contrastSet;
|
||||||
|
StarTracker::ChecksumSet checksumSet;
|
||||||
|
StarTracker::DownloadCentroidSet downloadCentroidSet;
|
||||||
|
StarTracker::DownloadMatchedStar downloadMatchedStar;
|
||||||
|
StarTracker::DownloadDBImage downloadDbImage;
|
||||||
|
StarTracker::DownloadBlobPixel downloadBlobPixel;
|
||||||
|
|
||||||
|
// Pointer to object responsible for uploading and downloading images to/from the star tracker
|
||||||
|
StrHelper* strHelper = nullptr;
|
||||||
|
|
||||||
|
uint8_t commandBuffer[StarTracker::MAX_FRAME_SIZE];
|
||||||
|
|
||||||
|
// Countdown to insert delay for star tracker to switch from bootloader to firmware program
|
||||||
|
Countdown bootCountdown;
|
||||||
|
|
||||||
|
std::string paramJsonFile = "/mnt/sd0/startracker/full.json";
|
||||||
|
|
||||||
|
enum class InternalState { TEMPERATURE_REQUEST };
|
||||||
|
|
||||||
|
InternalState internalState = InternalState::TEMPERATURE_REQUEST;
|
||||||
|
|
||||||
|
enum class StartupState {
|
||||||
|
IDLE,
|
||||||
|
CHECK_BOOT_STATE,
|
||||||
|
BOOT,
|
||||||
|
BOOT_DELAY,
|
||||||
|
LIMITS,
|
||||||
|
TRACKING,
|
||||||
|
MOUNTING,
|
||||||
|
CAMERA,
|
||||||
|
BLOB,
|
||||||
|
CENTROIDING,
|
||||||
|
LISA,
|
||||||
|
MATCHING,
|
||||||
|
VALIDATION,
|
||||||
|
ALGO,
|
||||||
|
WAIT_FOR_EXECUTION,
|
||||||
|
DONE
|
||||||
|
};
|
||||||
|
|
||||||
|
StartupState startupState = StartupState::IDLE;
|
||||||
|
|
||||||
|
bool strHelperExecuting = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Handles internal state
|
||||||
|
*/
|
||||||
|
void handleInternalState();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks mode for commands requiring MODE_ON of MODE_NORMAL for execution.
|
||||||
|
*
|
||||||
|
* @param actionId Action id of command to execute
|
||||||
|
*/
|
||||||
|
ReturnValue_t checkMode(ActionId_t actionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function initializes the serial link ip protocol struct slipInfo.
|
||||||
|
*/
|
||||||
|
void slipInit();
|
||||||
|
|
||||||
|
ReturnValue_t scanForActionReply(DeviceCommandId_t* foundId);
|
||||||
|
ReturnValue_t scanForParameterReply(DeviceCommandId_t* foundId);
|
||||||
|
ReturnValue_t scanForTmReply(DeviceCommandId_t* foundId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills command buffer with data to ping the star tracker
|
||||||
|
*/
|
||||||
|
void preparePingRequest();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills command buffer with data to request the time telemetry.
|
||||||
|
*/
|
||||||
|
void prepareTimeRequest();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Handles all received event messages
|
||||||
|
*/
|
||||||
|
void handleEvent(EventMessage* eventMessage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Executes the write command
|
||||||
|
*
|
||||||
|
* @param commandData Pointer to received command data
|
||||||
|
* @param commandDataLen Size of received command data
|
||||||
|
*
|
||||||
|
* @return RETURN_OK if start of execution was successful, otherwise error return value
|
||||||
|
*/
|
||||||
|
ReturnValue_t executeWriteCommand(const uint8_t* commandData, size_t commandDataLen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Starts the execution of the fpga download command
|
||||||
|
*
|
||||||
|
* @param commandData Pointer to buffer with command data
|
||||||
|
* @param commandDataLen Size of received command
|
||||||
|
*/
|
||||||
|
ReturnValue_t executeFpgaDownloadCommand(const uint8_t* commandData, size_t commandDataLen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Extracts information for flash-read-command from TC data and starts execution of
|
||||||
|
* flash-read-procedure
|
||||||
|
*
|
||||||
|
* @param commandData Pointer to received command data
|
||||||
|
* @param commandDataLen Size of received command data
|
||||||
|
*
|
||||||
|
* @return RETURN_OK if start of execution was successful, otherwise error return value
|
||||||
|
*/
|
||||||
|
ReturnValue_t executeReadCommand(const uint8_t* commandData, size_t commandDataLen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills command buffer with data to boot image (works only when star tracker is
|
||||||
|
* in bootloader mode).
|
||||||
|
*/
|
||||||
|
void prepareBootCommand();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills command buffer with command to erase a flash region
|
||||||
|
*/
|
||||||
|
ReturnValue_t prepareEraseCommand(const uint8_t* commandData, size_t commandDataLen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills command buffer with command to unlock flash region
|
||||||
|
*/
|
||||||
|
ReturnValue_t prepareUnlockCommand(const uint8_t* commandData, size_t commandDataLen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills command buffer with command to get the checksum of a flash part
|
||||||
|
*/
|
||||||
|
ReturnValue_t prepareChecksumCommand(const uint8_t* commandData, size_t commandDataLen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills command buffer with command to set the unix time
|
||||||
|
*/
|
||||||
|
ReturnValue_t prepareSetTimeCommand(const uint8_t* commandData, size_t commandDataLen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills command buffer with command to request a centroid
|
||||||
|
*/
|
||||||
|
ReturnValue_t prepareDownloadCentroidCommand(const uint8_t* commandData, size_t commandDataLen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills command buffer with command to upload a centroid for testing purpose
|
||||||
|
*/
|
||||||
|
ReturnValue_t prepareUploadCentroidCommand(const uint8_t* commandData, size_t commandDataLen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills the command buffer with the command to take an image.
|
||||||
|
*/
|
||||||
|
void prepareTakeImageCommand(const uint8_t* commandData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills command buffer with data to request the version telemetry packet
|
||||||
|
*/
|
||||||
|
void prepareVersionRequest();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills the command buffer with data to request the interface telemetry packet.
|
||||||
|
*/
|
||||||
|
void prepareInterfaceRequest();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills the command buffer with data to request the power telemetry packet.
|
||||||
|
*/
|
||||||
|
void preparePowerRequest();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills command buffer with data to reboot star tracker.
|
||||||
|
*/
|
||||||
|
void prepareRebootCommand();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills command buffer with data to subscribe to a telemetry packet.
|
||||||
|
*
|
||||||
|
* @param tmId The ID of the telemetry packet to subscribe to
|
||||||
|
*/
|
||||||
|
void prepareSubscriptionCommand(const uint8_t* tmId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills command buffer with data to request solution telemtry packet (contains
|
||||||
|
* attitude information)
|
||||||
|
*/
|
||||||
|
void prepareSolutionRequest();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills command buffer with data to request temperature from star tracker
|
||||||
|
*/
|
||||||
|
void prepareTemperatureRequest();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills command buffer with data to request histogram
|
||||||
|
*/
|
||||||
|
void prepareHistogramRequest();
|
||||||
|
|
||||||
|
void prepareContrastRequest();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills command buffer with command to reset the error signal of the star tracker
|
||||||
|
*/
|
||||||
|
void prepareErrorResetRequest();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reads parameters from json file specified by string in commandData and
|
||||||
|
* prepares the command to apply the parameter set to the star tracker
|
||||||
|
*
|
||||||
|
* @param commandData Contains string with file name
|
||||||
|
* @param commandDataLen Length of command
|
||||||
|
* @param paramSet The object defining the command generation
|
||||||
|
*
|
||||||
|
* @return RETURN_OK if successful, otherwise error return Value
|
||||||
|
*/
|
||||||
|
ReturnValue_t prepareParamCommand(const uint8_t* commandData, size_t commandDataLen,
|
||||||
|
ArcsecJsonParamBase& paramSet);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills command buffer with data to request matched star.
|
||||||
|
*/
|
||||||
|
ReturnValue_t prepareDownloadMatchedStarCommand(const uint8_t* commandData,
|
||||||
|
size_t commandDataLen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills command buffer with data to request matched star coordinates.
|
||||||
|
*/
|
||||||
|
ReturnValue_t prepareDownloadDbImageCommand(const uint8_t* commandData, size_t commandDataLen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fills command buffer with data to request output of the blob filter algorithm.
|
||||||
|
*/
|
||||||
|
ReturnValue_t prepareDownloadBlobPixelCommand(const uint8_t* commandData, size_t commandDataLen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief With this command the FPGA update will be applied to the star tracker
|
||||||
|
*/
|
||||||
|
ReturnValue_t prepareFpgaActionCommand(const uint8_t* commandData, size_t commandDataLen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Handles action replies with datasets.
|
||||||
|
*/
|
||||||
|
ReturnValue_t handleActionReplySet(LocalPoolDataSetBase& dataset, size_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Default function to handle action replies
|
||||||
|
*/
|
||||||
|
ReturnValue_t handleActionReply();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Handles reply to upload centroid command
|
||||||
|
*/
|
||||||
|
ReturnValue_t handleUploadCentroidReply();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Handles reply to erase command
|
||||||
|
*/
|
||||||
|
ReturnValue_t handleEraseReply();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Handles reply to checksum command
|
||||||
|
*/
|
||||||
|
ReturnValue_t handleChecksumReply();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Handles all set parameter replies
|
||||||
|
*/
|
||||||
|
ReturnValue_t handleSetParamReply();
|
||||||
|
|
||||||
|
ReturnValue_t handlePingReply();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks the loaded program by means of the version set
|
||||||
|
*/
|
||||||
|
ReturnValue_t checkProgram();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Handles the startup state machine
|
||||||
|
*/
|
||||||
|
void handleStartup(const uint8_t* parameterId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Handles telemtry replies and fills the appropriate dataset
|
||||||
|
*
|
||||||
|
* @param dataset Dataset where reply data will be written to
|
||||||
|
* @param size Size of the dataset
|
||||||
|
*
|
||||||
|
* @return RETURN_OK if successful, otherwise error return value
|
||||||
|
*/
|
||||||
|
ReturnValue_t handleTm(LocalPoolDataSetBase& dataset, size_t size);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* MISSION_DEVICES_STARTRACKERHANDLER_H_ */
|
689
bsp_q7s/devices/startracker/StarTrackerJsonCommands.cpp
Normal file
689
bsp_q7s/devices/startracker/StarTrackerJsonCommands.cpp
Normal file
@ -0,0 +1,689 @@
|
|||||||
|
#include "StarTrackerJsonCommands.h"
|
||||||
|
|
||||||
|
#include "ArcsecJsonKeys.h"
|
||||||
|
|
||||||
|
Limits::Limits() : ArcsecJsonParamBase(arcseckeys::LIMITS) {}
|
||||||
|
|
||||||
|
size_t Limits::getSize() { return COMMAND_SIZE; }
|
||||||
|
|
||||||
|
ReturnValue_t Limits::createCommand(uint8_t* buffer) {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
uint8_t offset = 0;
|
||||||
|
std::string param;
|
||||||
|
addSetParamHeader(buffer, StarTracker::ID::LIMITS);
|
||||||
|
offset = 2;
|
||||||
|
result = getParam(arcseckeys::ACTION, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::FPGA18CURRENT, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::FPGA25CURRENT, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::FPGA10CURRENT, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::MCUCURRENT, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::CMOS21CURRENT, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::CMOSPIXCURRENT, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::CMOS33CURRENT, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::CMOSVRESCURRENT, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::CMOS_TEMPERATURE, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::MCU_TEMPERATURE, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tracking::Tracking() : ArcsecJsonParamBase(arcseckeys::TRACKING) {}
|
||||||
|
|
||||||
|
size_t Tracking::getSize() { return COMMAND_SIZE; }
|
||||||
|
|
||||||
|
ReturnValue_t Tracking::createCommand(uint8_t* buffer) {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
uint8_t offset = 0;
|
||||||
|
std::string param;
|
||||||
|
addSetParamHeader(buffer, StarTracker::ID::TRACKING);
|
||||||
|
offset = 2;
|
||||||
|
result = getParam(arcseckeys::THIN_LIMIT, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::OUTLIER_THRESHOLD, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::OUTLIER_THRESHOLD_QUEST, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::TRACKER_CHOICE, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
Mounting::Mounting() : ArcsecJsonParamBase(arcseckeys::MOUNTING) {}
|
||||||
|
|
||||||
|
size_t Mounting::getSize() { return COMMAND_SIZE; }
|
||||||
|
|
||||||
|
ReturnValue_t Mounting::createCommand(uint8_t* buffer) {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
uint8_t offset = 0;
|
||||||
|
std::string param;
|
||||||
|
addSetParamHeader(buffer, StarTracker::ID::MOUNTING);
|
||||||
|
offset = 2;
|
||||||
|
result = getParam(arcseckeys::qw, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::qx, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::qy, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::qz, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
Camera::Camera() : ArcsecJsonParamBase(arcseckeys::CAMERA) {}
|
||||||
|
|
||||||
|
size_t Camera::getSize() { return COMMAND_SIZE; }
|
||||||
|
|
||||||
|
ReturnValue_t Camera::createCommand(uint8_t* buffer) {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
uint8_t offset = 0;
|
||||||
|
std::string param;
|
||||||
|
addSetParamHeader(buffer, StarTracker::ID::CAMERA);
|
||||||
|
offset = 2;
|
||||||
|
result = getParam(arcseckeys::MODE, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::FOCALLENGTH, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::EXPOSURE, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::INTERVAL, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::OFFSET, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addint16(param, buffer + offset);
|
||||||
|
offset += sizeof(int16_t);
|
||||||
|
result = getParam(arcseckeys::PGAGAIN, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::ADCGAIN, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::REG_1, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::VAL_1, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::REG_2, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::VAL_2, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::REG_3, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::VAL_3, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::REG_4, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::VAL_4, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::REG_5, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::VAL_5, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::REG_6, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::VAL_6, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::REG_7, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::VAL_7, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::REG_8, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::VAL_8, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::FREQ_1, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::FREQ_2, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
Blob::Blob() : ArcsecJsonParamBase(arcseckeys::BLOB) {}
|
||||||
|
|
||||||
|
size_t Blob::getSize() { return COMMAND_SIZE; }
|
||||||
|
|
||||||
|
ReturnValue_t Blob::createCommand(uint8_t* buffer) {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
uint8_t offset = 0;
|
||||||
|
std::string param;
|
||||||
|
addSetParamHeader(buffer, StarTracker::ID::BLOB);
|
||||||
|
offset = 2;
|
||||||
|
result = getParam(arcseckeys::MODE, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::MIN_VALUE, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::MIN_DISTANCE, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::NEIGHBOUR_DISTANCE, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::NEIGHBOUR_BRIGHT_PIXELS, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::MIN_TOTAL_VALUE, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint16(param, buffer + offset);
|
||||||
|
offset += sizeof(uint16_t);
|
||||||
|
result = getParam(arcseckeys::MAX_TOTAL_VALUE, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint16(param, buffer + offset);
|
||||||
|
offset += sizeof(uint16_t);
|
||||||
|
result = getParam(arcseckeys::MIN_BRIGHT_NEIGHBOURS, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint16(param, buffer + offset);
|
||||||
|
offset += sizeof(uint16_t);
|
||||||
|
result = getParam(arcseckeys::MAX_BRIGHT_NEIGHBOURS, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint16(param, buffer + offset);
|
||||||
|
offset += sizeof(uint16_t);
|
||||||
|
result = getParam(arcseckeys::MAX_PIXEL_TO_CONSIDER, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint32(param, buffer + offset);
|
||||||
|
offset += sizeof(uint32_t);
|
||||||
|
result = getParam(arcseckeys::SIGNAL_THRESHOLD, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::DARK_THRESHOLD, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::ENABLE_HISTOGRAM, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::ENABLE_CONTRAST, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::BIN_MODE, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
Centroiding::Centroiding() : ArcsecJsonParamBase(arcseckeys::CENTROIDING) {}
|
||||||
|
|
||||||
|
size_t Centroiding::getSize() { return COMMAND_SIZE; }
|
||||||
|
|
||||||
|
ReturnValue_t Centroiding::createCommand(uint8_t* buffer) {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
uint8_t offset = 0;
|
||||||
|
std::string param;
|
||||||
|
addSetParamHeader(buffer, StarTracker::ID::CENTROIDING);
|
||||||
|
offset = 2;
|
||||||
|
result = getParam(arcseckeys::ENABLE_FILTER, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::MAX_QUALITY, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::MIN_QUALITY, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::MAX_INTENSITY, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::MIN_INTENSITY, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::MAX_MAGNITUDE, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::GAUSSIAN_CMAX, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::GAUSSIAN_CMIN, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::TRANSMATRIX_00, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::TRANSMATRIX_01, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::TRANSMATRIX_10, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::TRANSMATRIX_11, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
Lisa::Lisa() : ArcsecJsonParamBase(arcseckeys::LISA) {}
|
||||||
|
|
||||||
|
size_t Lisa::getSize() { return COMMAND_SIZE; }
|
||||||
|
|
||||||
|
ReturnValue_t Lisa::createCommand(uint8_t* buffer) {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
uint8_t offset = 0;
|
||||||
|
std::string param;
|
||||||
|
addSetParamHeader(buffer, StarTracker::ID::LISA);
|
||||||
|
offset = 2;
|
||||||
|
result = getParam(arcseckeys::PREFILTER_DIST_THRESHOLD, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::PREFILTER_ANGLE_THRESHOLD, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::FOV_WIDTH, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::FOV_HEIGHT, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::FLOAT_STAR_LIMIT, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::CLOSE_STAR_LIMIT, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::RATING_WEIGHT_CLOSE_STAR_COUNT, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::RATING_WEIGHT_FRACTION_CLOSE, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::RATING_WEIGHT_DB_STAR_COUNT, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::MAX_COMBINATIONS, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::NR_STARS_STOP, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::FRACTION_CLOSE_STOP, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
Matching::Matching() : ArcsecJsonParamBase(arcseckeys::MATCHING) {}
|
||||||
|
|
||||||
|
size_t Matching::getSize() { return COMMAND_SIZE; }
|
||||||
|
|
||||||
|
ReturnValue_t Matching::createCommand(uint8_t* buffer) {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
uint8_t offset = 0;
|
||||||
|
std::string param;
|
||||||
|
addSetParamHeader(buffer, StarTracker::ID::MATCHING);
|
||||||
|
offset = 2;
|
||||||
|
result = getParam(arcseckeys::SQUARED_DISTANCE_LIMIT, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::SQUARED_SHIFT_LIMIT, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
Validation::Validation() : ArcsecJsonParamBase(arcseckeys::VALIDATION) {}
|
||||||
|
|
||||||
|
size_t Validation::getSize() { return COMMAND_SIZE; }
|
||||||
|
|
||||||
|
ReturnValue_t Validation::createCommand(uint8_t* buffer) {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
uint8_t offset = 0;
|
||||||
|
std::string param;
|
||||||
|
addSetParamHeader(buffer, StarTracker::ID::VALIDATION);
|
||||||
|
offset = 2;
|
||||||
|
result = getParam(arcseckeys::STABLE_COUNT, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::MAX_DIFFERENCE, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::MIN_TRACKER_CONFIDENCE, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::MIN_MATCHED_STARS, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
Algo::Algo() : ArcsecJsonParamBase(arcseckeys::ALGO) {}
|
||||||
|
|
||||||
|
size_t Algo::getSize() { return COMMAND_SIZE; }
|
||||||
|
|
||||||
|
ReturnValue_t Algo::createCommand(uint8_t* buffer) {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
uint8_t offset = 0;
|
||||||
|
std::string param;
|
||||||
|
addSetParamHeader(buffer, StarTracker::ID::ALGO);
|
||||||
|
offset = 2;
|
||||||
|
result = getParam(arcseckeys::MODE, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::L2T_MIN_CONFIDENCE, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::L2T_MIN_MATCHED, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
offset += sizeof(uint8_t);
|
||||||
|
result = getParam(arcseckeys::T2L_MIN_CONFIDENCE, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
addfloat(param, buffer + offset);
|
||||||
|
offset += sizeof(float);
|
||||||
|
result = getParam(arcseckeys::T2L_MIN_MATCHED, param);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
adduint8(param, buffer + offset);
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
176
bsp_q7s/devices/startracker/StarTrackerJsonCommands.h
Normal file
176
bsp_q7s/devices/startracker/StarTrackerJsonCommands.h
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
#ifndef BSP_Q7S_DEVICES_DEVICEDEFINITIONS_STARTRACKERJSONCOMMANDS_H_
|
||||||
|
#define BSP_Q7S_DEVICES_DEVICEDEFINITIONS_STARTRACKERJSONCOMMANDS_H_
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This file defines a few helper classes to generate commands by means of the parameters
|
||||||
|
* defined in the arcsec json files.
|
||||||
|
* @author J. Meier
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "ArcsecJsonParamBase.h"
|
||||||
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Generates command to set the limit parameters
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Limits : public ArcsecJsonParamBase {
|
||||||
|
public:
|
||||||
|
Limits();
|
||||||
|
|
||||||
|
size_t getSize();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const size_t COMMAND_SIZE = 43;
|
||||||
|
|
||||||
|
virtual ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Generates the command to configure the tracking algorithm.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Tracking : public ArcsecJsonParamBase {
|
||||||
|
public:
|
||||||
|
Tracking();
|
||||||
|
|
||||||
|
size_t getSize();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const size_t COMMAND_SIZE = 15;
|
||||||
|
|
||||||
|
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Generates the command to set the mounting quaternion
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Mounting : public ArcsecJsonParamBase {
|
||||||
|
public:
|
||||||
|
Mounting();
|
||||||
|
|
||||||
|
size_t getSize();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const size_t COMMAND_SIZE = 18;
|
||||||
|
|
||||||
|
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Generates the command to set the mounting quaternion
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Camera : public ArcsecJsonParamBase {
|
||||||
|
public:
|
||||||
|
Camera();
|
||||||
|
|
||||||
|
size_t getSize();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const size_t COMMAND_SIZE = 43;
|
||||||
|
|
||||||
|
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Generates the command to configure the blob algorithm
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Blob : public ArcsecJsonParamBase {
|
||||||
|
public:
|
||||||
|
Blob();
|
||||||
|
|
||||||
|
size_t getSize();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const size_t COMMAND_SIZE = 24;
|
||||||
|
|
||||||
|
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Generates the command to configure the centroiding algorithm
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Centroiding : public ArcsecJsonParamBase {
|
||||||
|
public:
|
||||||
|
Centroiding();
|
||||||
|
|
||||||
|
size_t getSize();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const size_t COMMAND_SIZE = 47;
|
||||||
|
|
||||||
|
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Generates the command to configure the LISA (lost in space algorithm)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Lisa : public ArcsecJsonParamBase {
|
||||||
|
public:
|
||||||
|
Lisa();
|
||||||
|
|
||||||
|
size_t getSize();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const size_t COMMAND_SIZE = 48;
|
||||||
|
|
||||||
|
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Generates the command to configure the matching algorithm
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Matching : public ArcsecJsonParamBase {
|
||||||
|
public:
|
||||||
|
Matching();
|
||||||
|
|
||||||
|
size_t getSize();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const size_t COMMAND_SIZE = 10;
|
||||||
|
|
||||||
|
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Generates the command to configure the validation parameters
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Validation : public ArcsecJsonParamBase {
|
||||||
|
public:
|
||||||
|
Validation();
|
||||||
|
|
||||||
|
size_t getSize();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const size_t COMMAND_SIZE = 12;
|
||||||
|
|
||||||
|
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Generates command to configure the mechanism of automatically switching between the
|
||||||
|
* LISA and other algorithms.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Algo : public ArcsecJsonParamBase {
|
||||||
|
public:
|
||||||
|
Algo();
|
||||||
|
|
||||||
|
size_t getSize();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const size_t COMMAND_SIZE = 13;
|
||||||
|
|
||||||
|
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* BSP_Q7S_DEVICES_DEVICEDEFINITIONS_STARTRACKERJSONCOMMANDS_H_ */
|
672
bsp_q7s/devices/startracker/StrHelper.cpp
Normal file
672
bsp_q7s/devices/startracker/StrHelper.cpp
Normal file
@ -0,0 +1,672 @@
|
|||||||
|
#include "StrHelper.h"
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
#include "mission/utility/Timestamp.h"
|
||||||
|
|
||||||
|
StrHelper::StrHelper(object_id_t objectId) : SystemObject(objectId) {}
|
||||||
|
|
||||||
|
StrHelper::~StrHelper() {}
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::initialize() {
|
||||||
|
sdcMan = SdCardManager::instance();
|
||||||
|
if (sdcMan == nullptr) {
|
||||||
|
sif::warning << "StrHelper::initialize: Invalid SD Card Manager" << std::endl;
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::performOperation(uint8_t operationCode) {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
semaphore.acquire();
|
||||||
|
while (true) {
|
||||||
|
switch (internalState) {
|
||||||
|
case InternalState::IDLE: {
|
||||||
|
semaphore.acquire();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case InternalState::UPLOAD_IMAGE: {
|
||||||
|
result = performImageUpload();
|
||||||
|
if (result == RETURN_OK) {
|
||||||
|
triggerEvent(IMAGE_UPLOAD_SUCCESSFUL);
|
||||||
|
} else {
|
||||||
|
triggerEvent(IMAGE_UPLOAD_FAILED);
|
||||||
|
}
|
||||||
|
internalState = InternalState::IDLE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case InternalState::DOWNLOAD_IMAGE: {
|
||||||
|
result = performImageDownload();
|
||||||
|
if (result == RETURN_OK) {
|
||||||
|
triggerEvent(IMAGE_DOWNLOAD_SUCCESSFUL);
|
||||||
|
} else {
|
||||||
|
triggerEvent(IMAGE_DOWNLOAD_FAILED);
|
||||||
|
}
|
||||||
|
internalState = InternalState::IDLE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case InternalState::FLASH_WRITE: {
|
||||||
|
result = performFlashWrite();
|
||||||
|
if (result == RETURN_OK) {
|
||||||
|
triggerEvent(FLASH_WRITE_SUCCESSFUL);
|
||||||
|
} else {
|
||||||
|
triggerEvent(FLASH_WRITE_FAILED);
|
||||||
|
}
|
||||||
|
internalState = InternalState::IDLE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case InternalState::FLASH_READ: {
|
||||||
|
result = performFlashRead();
|
||||||
|
if (result == RETURN_OK) {
|
||||||
|
triggerEvent(FLASH_READ_SUCCESSFUL);
|
||||||
|
} else {
|
||||||
|
triggerEvent(FLASH_READ_FAILED);
|
||||||
|
}
|
||||||
|
internalState = InternalState::IDLE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case InternalState::DOWNLOAD_FPGA_IMAGE: {
|
||||||
|
result = performFpgaDownload();
|
||||||
|
if (result == RETURN_OK) {
|
||||||
|
triggerEvent(FPGA_DOWNLOAD_SUCCESSFUL);
|
||||||
|
} else {
|
||||||
|
triggerEvent(FPGA_DOWNLOAD_FAILED);
|
||||||
|
}
|
||||||
|
internalState = InternalState::IDLE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case InternalState::UPLOAD_FPGA_IMAGE: {
|
||||||
|
result = performFpgaUpload();
|
||||||
|
if (result == RETURN_OK) {
|
||||||
|
triggerEvent(FPGA_UPLOAD_SUCCESSFUL);
|
||||||
|
} else {
|
||||||
|
triggerEvent(FPGA_UPLOAD_FAILED);
|
||||||
|
}
|
||||||
|
internalState = InternalState::IDLE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
sif::debug << "StrHelper::performOperation: Invalid state" << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::setComIF(DeviceCommunicationIF* communicationInterface_) {
|
||||||
|
uartComIF = dynamic_cast<UartComIF*>(communicationInterface_);
|
||||||
|
if (uartComIF == nullptr) {
|
||||||
|
sif::warning << "StrHelper::initialize: Invalid uart com if" << std::endl;
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void StrHelper::setComCookie(CookieIF* comCookie_) { comCookie = comCookie_; }
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::startImageUpload(std::string fullname) {
|
||||||
|
ReturnValue_t result = checkPath(fullname);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
uploadImage.uploadFile = fullname;
|
||||||
|
if (not std::filesystem::exists(fullname)) {
|
||||||
|
return FILE_NOT_EXISTS;
|
||||||
|
}
|
||||||
|
internalState = InternalState::UPLOAD_FPGA_IMAGE;
|
||||||
|
semaphore.release();
|
||||||
|
terminate = false;
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::startImageDownload(std::string path) {
|
||||||
|
ReturnValue_t result = checkPath(path);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (not std::filesystem::exists(path)) {
|
||||||
|
return PATH_NOT_EXISTS;
|
||||||
|
}
|
||||||
|
downloadImage.path = path;
|
||||||
|
internalState = InternalState::DOWNLOAD_IMAGE;
|
||||||
|
terminate = false;
|
||||||
|
semaphore.release();
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void StrHelper::stopProcess() { terminate = true; }
|
||||||
|
|
||||||
|
void StrHelper::setDownloadImageName(std::string filename) { downloadImage.filename = filename; }
|
||||||
|
|
||||||
|
void StrHelper::setFlashReadFilename(std::string filename) { flashRead.filename = filename; }
|
||||||
|
|
||||||
|
void StrHelper::setDownloadFpgaImage(std::string filename) { fpgaDownload.fileName = filename; }
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::startFlashWrite(std::string fullname, uint8_t region, uint32_t address) {
|
||||||
|
ReturnValue_t result = checkPath(fullname);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
flashWrite.fullname = fullname;
|
||||||
|
if (not std::filesystem::exists(flashWrite.fullname)) {
|
||||||
|
return FILE_NOT_EXISTS;
|
||||||
|
}
|
||||||
|
flashWrite.address = address;
|
||||||
|
flashWrite.region = region;
|
||||||
|
internalState = InternalState::FLASH_WRITE;
|
||||||
|
semaphore.release();
|
||||||
|
terminate = false;
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::startFlashRead(std::string path, uint8_t region, uint32_t address,
|
||||||
|
uint32_t length) {
|
||||||
|
ReturnValue_t result = checkPath(path);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
flashRead.path = path;
|
||||||
|
if (not std::filesystem::exists(flashRead.path)) {
|
||||||
|
return FILE_NOT_EXISTS;
|
||||||
|
}
|
||||||
|
flashRead.address = address;
|
||||||
|
flashRead.region = region;
|
||||||
|
flashRead.size = length;
|
||||||
|
internalState = InternalState::FLASH_READ;
|
||||||
|
semaphore.release();
|
||||||
|
terminate = false;
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::startFpgaDownload(std::string path, uint32_t startPosition,
|
||||||
|
uint32_t length) {
|
||||||
|
fpgaDownload.path = path;
|
||||||
|
fpgaDownload.startPosition = startPosition;
|
||||||
|
fpgaDownload.length = length;
|
||||||
|
internalState = InternalState::DOWNLOAD_FPGA_IMAGE;
|
||||||
|
semaphore.release();
|
||||||
|
terminate = false;
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::startFpgaUpload(std::string uploadFile) {
|
||||||
|
fpgaUpload.uploadFile = uploadFile;
|
||||||
|
internalState = InternalState::UPLOAD_FPGA_IMAGE;
|
||||||
|
semaphore.release();
|
||||||
|
terminate = false;
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::performImageDownload() {
|
||||||
|
ReturnValue_t result;
|
||||||
|
struct DownloadActionRequest downloadReq;
|
||||||
|
uint32_t size = 0;
|
||||||
|
uint32_t retries = 0;
|
||||||
|
Timestamp timestamp;
|
||||||
|
std::string image = downloadImage.path + "/" + timestamp.str() + downloadImage.filename;
|
||||||
|
std::ofstream file(image, std::ios_base::app | std::ios_base::out);
|
||||||
|
if (not std::filesystem::exists(image)) {
|
||||||
|
return FILE_CREATION_FAILED;
|
||||||
|
}
|
||||||
|
downloadReq.position = 0;
|
||||||
|
while (downloadReq.position < ImageDownload::LAST_POSITION) {
|
||||||
|
if (terminate) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
arc_pack_download_action_req(&downloadReq, commandBuffer, &size);
|
||||||
|
result = sendAndRead(size, downloadReq.position);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
|
||||||
|
uartComIF->flushUartRxBuffer(comCookie);
|
||||||
|
retries++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = checkActionReply();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
|
||||||
|
uartComIF->flushUartRxBuffer(comCookie);
|
||||||
|
retries++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = checkReplyPosition(downloadReq.position);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
|
||||||
|
uartComIF->flushUartRxBuffer(comCookie);
|
||||||
|
retries++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
file.write(reinterpret_cast<const char*>(datalinkLayer.getReply() + IMAGE_DATA_OFFSET),
|
||||||
|
IMAGE_DATA_SIZE);
|
||||||
|
downloadReq.position++;
|
||||||
|
retries = 0;
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::performImageUpload() {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
uint32_t size = 0;
|
||||||
|
uint32_t imageSize = 0;
|
||||||
|
struct UploadActionRequest uploadReq;
|
||||||
|
uploadReq.position = 0;
|
||||||
|
std::memset(&uploadReq.data, 0, sizeof(uploadReq.data));
|
||||||
|
if (not std::filesystem::exists(uploadImage.uploadFile)) {
|
||||||
|
triggerEvent(STR_HELPER_FILE_NOT_EXISTS, static_cast<uint32_t>(internalState));
|
||||||
|
internalState = InternalState::IDLE;
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
std::ifstream file(uploadImage.uploadFile, std::ifstream::binary);
|
||||||
|
// Set position of next character to end of file input stream
|
||||||
|
file.seekg(0, file.end);
|
||||||
|
// tellg returns position of character in input stream
|
||||||
|
imageSize = file.tellg();
|
||||||
|
while ((uploadReq.position + 1) * SIZE_IMAGE_PART < imageSize) {
|
||||||
|
if (terminate) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
file.seekg(uploadReq.position * SIZE_IMAGE_PART, file.beg);
|
||||||
|
file.read(reinterpret_cast<char*>(uploadReq.data), SIZE_IMAGE_PART);
|
||||||
|
arc_pack_upload_action_req(&uploadReq, commandBuffer, &size);
|
||||||
|
result = sendAndRead(size, uploadReq.position);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
result = checkActionReply();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
uploadReq.position++;
|
||||||
|
}
|
||||||
|
std::memset(uploadReq.data, 0, sizeof(uploadReq.data));
|
||||||
|
uint32_t remainder = imageSize - uploadReq.position * SIZE_IMAGE_PART;
|
||||||
|
file.seekg(uploadReq.position * SIZE_IMAGE_PART, file.beg);
|
||||||
|
file.read(reinterpret_cast<char*>(uploadReq.data), remainder);
|
||||||
|
file.close();
|
||||||
|
uploadReq.position++;
|
||||||
|
arc_pack_upload_action_req(&uploadReq, commandBuffer, &size);
|
||||||
|
result = sendAndRead(size, uploadReq.position);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
result = checkActionReply();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::performFlashWrite() {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
uint32_t size = 0;
|
||||||
|
uint32_t remainingBytes = 0;
|
||||||
|
uint32_t fileSize = 0;
|
||||||
|
struct WriteActionRequest req;
|
||||||
|
if (not std::filesystem::exists(flashWrite.fullname)) {
|
||||||
|
triggerEvent(STR_HELPER_FILE_NOT_EXISTS, static_cast<uint32_t>(internalState));
|
||||||
|
internalState = InternalState::IDLE;
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
std::ifstream file(flashWrite.fullname, std::ifstream::binary);
|
||||||
|
file.seekg(0, file.end);
|
||||||
|
fileSize = file.tellg();
|
||||||
|
remainingBytes = fileSize;
|
||||||
|
req.region = flashWrite.region;
|
||||||
|
req.address = flashWrite.address;
|
||||||
|
req.length = MAX_FLASH_DATA;
|
||||||
|
while (remainingBytes >= MAX_FLASH_DATA) {
|
||||||
|
if (terminate) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
file.seekg(fileSize - remainingBytes, file.beg);
|
||||||
|
file.read(reinterpret_cast<char*>(req.data), MAX_FLASH_DATA);
|
||||||
|
arc_pack_write_action_req(&req, commandBuffer, &size);
|
||||||
|
result = sendAndRead(size, req.address);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
result = checkFlashActionReply(req.region, req.address, req.length);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
remainingBytes = remainingBytes - MAX_FLASH_DATA;
|
||||||
|
}
|
||||||
|
file.seekg(fileSize - remainingBytes, file.beg);
|
||||||
|
file.read(reinterpret_cast<char*>(req.data), remainingBytes);
|
||||||
|
file.close();
|
||||||
|
arc_pack_write_action_req(&req, commandBuffer, &size);
|
||||||
|
result = sendAndRead(size, req.address);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
result = checkFlashActionReply(req.region, req.address, req.length);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::performFlashRead() {
|
||||||
|
ReturnValue_t result;
|
||||||
|
struct ReadActionRequest req;
|
||||||
|
uint32_t bytesRead = 0;
|
||||||
|
uint32_t size = 0;
|
||||||
|
uint32_t retries = 0;
|
||||||
|
Timestamp timestamp;
|
||||||
|
std::string fullname = flashRead.path + "/" + timestamp.str() + flashRead.filename;
|
||||||
|
std::ofstream file(fullname, std::ios_base::app | std::ios_base::out);
|
||||||
|
if (not std::filesystem::exists(fullname)) {
|
||||||
|
return FILE_CREATION_FAILED;
|
||||||
|
}
|
||||||
|
req.region = flashRead.region;
|
||||||
|
while (bytesRead < flashRead.size) {
|
||||||
|
if (terminate) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
if ((flashRead.size - bytesRead) < MAX_FLASH_DATA) {
|
||||||
|
req.length = flashRead.size - bytesRead;
|
||||||
|
} else {
|
||||||
|
req.length = MAX_FLASH_DATA;
|
||||||
|
}
|
||||||
|
req.address = flashRead.address + bytesRead;
|
||||||
|
arc_pack_read_action_req(&req, commandBuffer, &size);
|
||||||
|
result = sendAndRead(size, req.address);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
|
||||||
|
uartComIF->flushUartRxBuffer(comCookie);
|
||||||
|
retries++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = checkActionReply();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
|
||||||
|
uartComIF->flushUartRxBuffer(comCookie);
|
||||||
|
retries++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = checkFlashActionReply(req.region, req.address, req.length);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
|
||||||
|
uartComIF->flushUartRxBuffer(comCookie);
|
||||||
|
retries++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
file.write(reinterpret_cast<const char*>(datalinkLayer.getReply() + FLASH_READ_DATA_OFFSET),
|
||||||
|
req.length);
|
||||||
|
bytesRead += req.length;
|
||||||
|
retries = 0;
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::performFpgaDownload() {
|
||||||
|
ReturnValue_t result;
|
||||||
|
struct DownloadFPGAImageActionRequest req;
|
||||||
|
uint32_t size = 0;
|
||||||
|
uint32_t retries = 0;
|
||||||
|
Timestamp timestamp;
|
||||||
|
std::string image = fpgaDownload.path + "/" + timestamp.str() + fpgaDownload.fileName;
|
||||||
|
std::ofstream file(image, std::ios_base::app | std::ios_base::out);
|
||||||
|
if (not std::filesystem::exists(image)) {
|
||||||
|
return FILE_CREATION_FAILED;
|
||||||
|
}
|
||||||
|
req.pos = fpgaDownload.startPosition;
|
||||||
|
while (req.pos < fpgaDownload.length) {
|
||||||
|
if (terminate) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
if (fpgaDownload.length - req.pos >= FpgaDownload::MAX_DATA) {
|
||||||
|
req.length = FpgaDownload::MAX_DATA;
|
||||||
|
} else {
|
||||||
|
req.length = fpgaDownload.length - req.pos;
|
||||||
|
}
|
||||||
|
arc_pack_downloadfpgaimage_action_req(&req, commandBuffer, &size);
|
||||||
|
result = sendAndRead(size, req.pos);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
|
||||||
|
uartComIF->flushUartRxBuffer(comCookie);
|
||||||
|
retries++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = checkFpgaActionReply(req.pos, req.length);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
|
||||||
|
uartComIF->flushUartRxBuffer(comCookie);
|
||||||
|
retries++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
file.write(reinterpret_cast<const char*>(datalinkLayer.getReply() + FpgaDownload::DATA_OFFSET),
|
||||||
|
req.length);
|
||||||
|
req.pos += req.length;
|
||||||
|
retries = 0;
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::performFpgaUpload() {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
uint32_t commandSize = 0;
|
||||||
|
uint32_t bytesUploaded = 0;
|
||||||
|
uint32_t fileSize = 0;
|
||||||
|
struct UploadFPGAImageActionRequest req;
|
||||||
|
if (not std::filesystem::exists(fpgaUpload.uploadFile)) {
|
||||||
|
triggerEvent(STR_HELPER_FILE_NOT_EXISTS, static_cast<uint32_t>(internalState));
|
||||||
|
internalState = InternalState::IDLE;
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
std::ifstream file(flashWrite.fullname, std::ifstream::binary);
|
||||||
|
file.seekg(0, file.end);
|
||||||
|
fileSize = file.tellg();
|
||||||
|
req.pos = 0;
|
||||||
|
while (bytesUploaded <= fileSize) {
|
||||||
|
if (terminate) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
if (fileSize - bytesUploaded > FpgaUpload::MAX_DATA) {
|
||||||
|
req.length = FpgaUpload::MAX_DATA;
|
||||||
|
} else {
|
||||||
|
req.length = fileSize - bytesUploaded;
|
||||||
|
}
|
||||||
|
file.seekg(bytesUploaded, file.beg);
|
||||||
|
file.read(reinterpret_cast<char*>(req.data), req.length);
|
||||||
|
arc_pack_uploadfpgaimage_action_req(&req, commandBuffer, &commandSize);
|
||||||
|
result = sendAndRead(commandSize, req.pos);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
result = checkFpgaActionReply(req.pos, req.length);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
bytesUploaded += req.length;
|
||||||
|
}
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::sendAndRead(size_t size, uint32_t parameter) {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
ReturnValue_t decResult = RETURN_OK;
|
||||||
|
size_t receivedDataLen = 0;
|
||||||
|
uint8_t* receivedData = nullptr;
|
||||||
|
size_t bytesLeft = 0;
|
||||||
|
uint32_t missedReplies = 0;
|
||||||
|
datalinkLayer.encodeFrame(commandBuffer, size);
|
||||||
|
result = uartComIF->sendMessage(comCookie, datalinkLayer.getEncodedFrame(),
|
||||||
|
datalinkLayer.getEncodedLength());
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::warning << "StrHelper::sendAndRead: Failed to send packet" << std::endl;
|
||||||
|
triggerEvent(STR_HELPER_SENDING_PACKET_FAILED, result, parameter);
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
decResult = ArcsecDatalinkLayer::DEC_IN_PROGRESS;
|
||||||
|
while (decResult == ArcsecDatalinkLayer::DEC_IN_PROGRESS) {
|
||||||
|
result = uartComIF->requestReceiveMessage(comCookie, StarTracker::MAX_FRAME_SIZE * 2 + 2);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::warning << "StrHelper::sendAndRead: Failed to request reply" << std::endl;
|
||||||
|
triggerEvent(STR_HELPER_REQUESTING_MSG_FAILED, result, parameter);
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
result = uartComIF->readReceivedMessage(comCookie, &receivedData, &receivedDataLen);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::warning << "StrHelper::sendAndRead: Failed to read received message" << std::endl;
|
||||||
|
triggerEvent(STR_HELPER_READING_REPLY_FAILED, result, parameter);
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
if (receivedDataLen == 0 && missedReplies < MAX_POLLS) {
|
||||||
|
missedReplies++;
|
||||||
|
continue;
|
||||||
|
} else if ((receivedDataLen == 0) && (missedReplies >= MAX_POLLS)) {
|
||||||
|
triggerEvent(STR_HELPER_NO_REPLY, parameter);
|
||||||
|
return RETURN_FAILED;
|
||||||
|
} else {
|
||||||
|
missedReplies = 0;
|
||||||
|
}
|
||||||
|
decResult = datalinkLayer.decodeFrame(receivedData, receivedDataLen, &bytesLeft);
|
||||||
|
if (bytesLeft != 0) {
|
||||||
|
// This should never happen
|
||||||
|
sif::warning << "StrHelper::sendAndRead: Bytes left after decoding" << std::endl;
|
||||||
|
triggerEvent(STR_HELPER_COM_ERROR, result, parameter);
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (decResult != RETURN_OK) {
|
||||||
|
triggerEvent(STR_HELPER_DEC_ERROR, decResult, parameter);
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::checkActionReply() {
|
||||||
|
uint8_t type = datalinkLayer.getReplyFrameType();
|
||||||
|
if (type != TMTC_ACTIONREPLY) {
|
||||||
|
sif::warning << "StrHelper::checkActionReply: Received reply with invalid type ID" << std::endl;
|
||||||
|
return INVALID_TYPE_ID;
|
||||||
|
}
|
||||||
|
uint8_t status = datalinkLayer.getStatusField();
|
||||||
|
if (status != ArcsecDatalinkLayer::STATUS_OK) {
|
||||||
|
sif::warning << "StrHelper::checkActionReply: Status failure: "
|
||||||
|
<< static_cast<unsigned int>(status) << std::endl;
|
||||||
|
return STATUS_ERROR;
|
||||||
|
}
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::checkReplyPosition(uint32_t expectedPosition) {
|
||||||
|
uint32_t receivedPosition = 0;
|
||||||
|
std::memcpy(&receivedPosition, datalinkLayer.getReply() + POS_OFFSET, sizeof(receivedPosition));
|
||||||
|
if (receivedPosition != expectedPosition) {
|
||||||
|
triggerEvent(POSITION_MISMATCH, receivedPosition);
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::checkFlashActionReply(uint8_t region_, uint32_t address_,
|
||||||
|
uint16_t length_) {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
result = checkActionReply();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
const uint8_t* data = datalinkLayer.getReply();
|
||||||
|
uint8_t region = *(data + REGION_OFFSET);
|
||||||
|
uint32_t address;
|
||||||
|
const uint8_t* addressData = data + ADDRESS_OFFSET;
|
||||||
|
size_t size = sizeof(address);
|
||||||
|
result =
|
||||||
|
SerializeAdapter::deSerialize(&address, &addressData, &size, SerializeIF::Endianness::LITTLE);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::warning << "StrHelper::checkFlashActionReply: Deserialization of address failed"
|
||||||
|
<< std::endl;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
uint16_t length = 0;
|
||||||
|
size = sizeof(length);
|
||||||
|
const uint8_t* lengthData = data + LENGTH_OFFSET;
|
||||||
|
result =
|
||||||
|
SerializeAdapter::deSerialize(&length, lengthData, &size, SerializeIF::Endianness::LITTLE);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::warning << "StrHelper::checkFlashActionReply: Deserialization of length failed"
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
if (region != region_) {
|
||||||
|
return REGION_MISMATCH;
|
||||||
|
}
|
||||||
|
if (address != address_) {
|
||||||
|
return ADDRESS_MISMATCH;
|
||||||
|
}
|
||||||
|
if (length != length_) {
|
||||||
|
return LENGTH_MISMATCH;
|
||||||
|
}
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::checkFpgaActionReply(uint32_t expectedPosition, uint32_t expectedLength) {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
result = checkActionReply();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
const uint8_t* data = datalinkLayer.getReply() + ACTION_DATA_OFFSET;
|
||||||
|
uint32_t position;
|
||||||
|
size_t size = sizeof(position);
|
||||||
|
result = SerializeAdapter::deSerialize(&position, &data, &size, SerializeIF::Endianness::LITTLE);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::warning << "StrHelper::checkFpgaActionReply: Deserialization of position failed"
|
||||||
|
<< std::endl;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
uint32_t length;
|
||||||
|
size = sizeof(length);
|
||||||
|
result = SerializeAdapter::deSerialize(&length, &data, &size, SerializeIF::Endianness::LITTLE);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::warning << "StrHelper::checkFpgaActionReply: Deserialization of length failed"
|
||||||
|
<< std::endl;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t StrHelper::checkPath(std::string name) {
|
||||||
|
if (name.substr(0, sizeof(SdCardManager::SD_0_MOUNT_POINT)) ==
|
||||||
|
std::string(SdCardManager::SD_0_MOUNT_POINT)) {
|
||||||
|
if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
|
||||||
|
sif::warning << "StrHelper::checkPath: SD card 0 not mounted" << std::endl;
|
||||||
|
return SD_NOT_MOUNTED;
|
||||||
|
}
|
||||||
|
} else if (name.substr(0, sizeof(SdCardManager::SD_1_MOUNT_POINT)) ==
|
||||||
|
std::string(SdCardManager::SD_1_MOUNT_POINT)) {
|
||||||
|
if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
|
||||||
|
sif::warning << "StrHelper::checkPath: SD card 1 not mounted" << std::endl;
|
||||||
|
return SD_NOT_MOUNTED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
397
bsp_q7s/devices/startracker/StrHelper.h
Normal file
397
bsp_q7s/devices/startracker/StrHelper.h
Normal file
@ -0,0 +1,397 @@
|
|||||||
|
#ifndef BSP_Q7S_DEVICES_STRHELPER_H_
|
||||||
|
#define BSP_Q7S_DEVICES_STRHELPER_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "ArcsecDatalinkLayer.h"
|
||||||
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
|
#include "fsfw/devicehandlers/CookieIF.h"
|
||||||
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
|
#include "fsfw/osal/linux/BinarySemaphore.h"
|
||||||
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
|
#include "fsfw_hal/linux/uart/UartComIF.h"
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "thirdparty/arcsec_star_tracker/client/generated/actionreq.h"
|
||||||
|
#include "thirdparty/arcsec_star_tracker/common/generated/tmtcstructs.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Helper class for the star tracker handler to accelerate large data transfers.
|
||||||
|
*/
|
||||||
|
class StrHelper : public SystemObject, public ExecutableObjectIF, public HasReturnvaluesIF {
|
||||||
|
public:
|
||||||
|
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::STR_HELPER;
|
||||||
|
|
||||||
|
//! [EXPORT] : [COMMENT] Image upload failed
|
||||||
|
static const Event IMAGE_UPLOAD_FAILED = MAKE_EVENT(0, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Image download failed
|
||||||
|
static const Event IMAGE_DOWNLOAD_FAILED = MAKE_EVENT(1, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Uploading image to star tracker was successfulop
|
||||||
|
static const Event IMAGE_UPLOAD_SUCCESSFUL = MAKE_EVENT(2, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Image download was successful
|
||||||
|
static const Event IMAGE_DOWNLOAD_SUCCESSFUL = MAKE_EVENT(3, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Finished flash write procedure successfully
|
||||||
|
static const Event FLASH_WRITE_SUCCESSFUL = MAKE_EVENT(4, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Finished flash read procedure successfully
|
||||||
|
static const Event FLASH_READ_SUCCESSFUL = MAKE_EVENT(5, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Flash write procedure failed
|
||||||
|
static const Event FLASH_WRITE_FAILED = MAKE_EVENT(6, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Flash read procedure failed
|
||||||
|
static const Event FLASH_READ_FAILED = MAKE_EVENT(7, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Download of FPGA image successful
|
||||||
|
static const Event FPGA_DOWNLOAD_SUCCESSFUL = MAKE_EVENT(8, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Download of FPGA image failed
|
||||||
|
static const Event FPGA_DOWNLOAD_FAILED = MAKE_EVENT(9, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Upload of FPGA image successful
|
||||||
|
static const Event FPGA_UPLOAD_SUCCESSFUL = MAKE_EVENT(10, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Upload of FPGA image failed
|
||||||
|
static const Event FPGA_UPLOAD_FAILED = MAKE_EVENT(11, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Failed to read communication interface reply data
|
||||||
|
//! P1: Return code of failed communication interface read call
|
||||||
|
//! P1: Upload/download position for which the read call failed
|
||||||
|
static const Event STR_HELPER_READING_REPLY_FAILED = MAKE_EVENT(12, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Unexpected stop of decoding sequence
|
||||||
|
//! P1: Return code of failed communication interface read call
|
||||||
|
//! P1: Upload/download position for which the read call failed
|
||||||
|
static const Event STR_HELPER_COM_ERROR = MAKE_EVENT(13, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Star tracker did not send replies (maybe device is powered off)
|
||||||
|
//! P1: Position of upload or download packet for which no reply was sent
|
||||||
|
static const Event STR_HELPER_NO_REPLY = MAKE_EVENT(14, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Error during decoding of received reply occurred
|
||||||
|
// P1: Return value of decoding function
|
||||||
|
// P2: Position of upload/download packet, or address of flash write/read request
|
||||||
|
static const Event STR_HELPER_DEC_ERROR = MAKE_EVENT(15, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Position mismatch
|
||||||
|
//! P1: The expected position and thus the position for which the image upload/download failed
|
||||||
|
static const Event POSITION_MISMATCH = MAKE_EVENT(16, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Specified file does not exist
|
||||||
|
//! P1: Internal state of str helper
|
||||||
|
static const Event STR_HELPER_FILE_NOT_EXISTS = MAKE_EVENT(17, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Sending packet to star tracker failed
|
||||||
|
//! P1: Return code of communication interface sendMessage function
|
||||||
|
//! P2: Position of upload/download packet, or address of flash write/read request for which
|
||||||
|
//! sending failed
|
||||||
|
static const Event STR_HELPER_SENDING_PACKET_FAILED = MAKE_EVENT(18, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Communication interface requesting reply failed
|
||||||
|
//! P1: Return code of failed request
|
||||||
|
//! P1: Upload/download position, or address of flash write/read request for which transmission
|
||||||
|
//! failed
|
||||||
|
static const Event STR_HELPER_REQUESTING_MSG_FAILED = MAKE_EVENT(19, severity::LOW);
|
||||||
|
|
||||||
|
StrHelper(object_id_t objectId);
|
||||||
|
virtual ~StrHelper();
|
||||||
|
|
||||||
|
ReturnValue_t initialize() override;
|
||||||
|
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||||
|
|
||||||
|
ReturnValue_t setComIF(DeviceCommunicationIF* communicationInterface_);
|
||||||
|
void setComCookie(CookieIF* comCookie_);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Starts sequence to upload image to star tracker
|
||||||
|
*
|
||||||
|
* @param uploadImage_ Name including absolute path of the image to upload. Must be previously
|
||||||
|
* transferred to the OBC with the CFDP protocol.
|
||||||
|
*/
|
||||||
|
ReturnValue_t startImageUpload(std::string uploadImage_);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Calling this function initiates the download of an image from the star tracker.
|
||||||
|
*
|
||||||
|
* @param path Path where downloaded image will be stored
|
||||||
|
*/
|
||||||
|
ReturnValue_t startImageDownload(std::string path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Starts the flash write procedure
|
||||||
|
*
|
||||||
|
* @param fullname Full name including absolute path of file to write to flash
|
||||||
|
* @param region Region ID of flash region to write to
|
||||||
|
* @param address Start address of flash write procedure
|
||||||
|
*/
|
||||||
|
ReturnValue_t startFlashWrite(std::string fullname, uint8_t region, uint32_t address);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Starts the flash read procedure
|
||||||
|
*
|
||||||
|
* @param path Path where file with read flash data will be created
|
||||||
|
* @param region Region ID of flash region to read from
|
||||||
|
* @param address Start address of flash section to read
|
||||||
|
* @param length Number of bytes to read from flash
|
||||||
|
*/
|
||||||
|
ReturnValue_t startFlashRead(std::string path, uint8_t region, uint32_t address, uint32_t length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Starts the download of the FPGA image
|
||||||
|
*
|
||||||
|
* @param path The path where the file with the downloaded data will be created
|
||||||
|
* @param startPosition Offset in fpga image to read from
|
||||||
|
* @param length Number of bytes to dwonload from the FPGA image
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
ReturnValue_t startFpgaDownload(std::string path, uint32_t startPosition, uint32_t length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Starts upload of new image to FPGA
|
||||||
|
*
|
||||||
|
* @param uploadFile Full name of file containing FPGA image data
|
||||||
|
*/
|
||||||
|
ReturnValue_t startFpgaUpload(std::string uploadFile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Can be used to interrupt a running data transfer.
|
||||||
|
*/
|
||||||
|
void stopProcess();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Changes the dafault name of downloaded images
|
||||||
|
*/
|
||||||
|
void setDownloadImageName(std::string filename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the name of the file which will be created to store the data read from flash
|
||||||
|
*/
|
||||||
|
void setFlashReadFilename(std::string filename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set download FPGA image name
|
||||||
|
*/
|
||||||
|
void setDownloadFpgaImage(std::string filename);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const uint8_t INTERFACE_ID = CLASS_ID::STR_HELPER;
|
||||||
|
|
||||||
|
//! [EXPORT] : [COMMENT] SD card specified in path string not mounted
|
||||||
|
static const ReturnValue_t SD_NOT_MOUNTED = MAKE_RETURN_CODE(0xA0);
|
||||||
|
//! [EXPORT] : [COMMENT] Specified file does not exist on filesystem
|
||||||
|
static const ReturnValue_t FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xA1);
|
||||||
|
//! [EXPORT] : [COMMENT] Specified path does not exist
|
||||||
|
static const ReturnValue_t PATH_NOT_EXISTS = MAKE_RETURN_CODE(0xA2);
|
||||||
|
//! [EXPORT] : [COMMENT] Failed to create download image or read flash file
|
||||||
|
static const ReturnValue_t FILE_CREATION_FAILED = MAKE_RETURN_CODE(0xA3);
|
||||||
|
//! [EXPORT] : [COMMENT] Region in flash write/read reply does not match expected region
|
||||||
|
static const ReturnValue_t REGION_MISMATCH = MAKE_RETURN_CODE(0xA4);
|
||||||
|
//! [EXPORT] : [COMMENT] Address in flash write/read reply does not match expected address
|
||||||
|
static const ReturnValue_t ADDRESS_MISMATCH = MAKE_RETURN_CODE(0xA5);
|
||||||
|
//! [EXPORT] : [COMMENT] Length in flash write/read reply does not match expected length
|
||||||
|
static const ReturnValue_t LENGTH_MISMATCH = MAKE_RETURN_CODE(0xA6);
|
||||||
|
//! [EXPORT] : [COMMENT] Status field in reply signals error
|
||||||
|
static const ReturnValue_t STATUS_ERROR = MAKE_RETURN_CODE(0xA7);
|
||||||
|
//! [EXPORT] : [COMMENT] Reply has invalid type ID (should be of action reply type)
|
||||||
|
static const ReturnValue_t INVALID_TYPE_ID = MAKE_RETURN_CODE(0xA8);
|
||||||
|
|
||||||
|
// Size of one image part which can be sent per action request
|
||||||
|
static const size_t SIZE_IMAGE_PART = 1024;
|
||||||
|
|
||||||
|
class ImageDownload {
|
||||||
|
public:
|
||||||
|
static const uint32_t LAST_POSITION = 4095;
|
||||||
|
};
|
||||||
|
|
||||||
|
class FpgaDownload {
|
||||||
|
public:
|
||||||
|
static const uint16_t MAX_DATA = 1024;
|
||||||
|
static const uint8_t DATA_OFFSET = 10;
|
||||||
|
// Start position of fpga image part to download
|
||||||
|
uint32_t startPosition = 0;
|
||||||
|
// Length of image part to download
|
||||||
|
uint32_t length = 0;
|
||||||
|
// Path where downloaded FPGA image will be stored
|
||||||
|
std::string path;
|
||||||
|
// Name of file containing downloaded FPGA image
|
||||||
|
std::string fileName = "fpgaimage.bin";
|
||||||
|
};
|
||||||
|
FpgaDownload fpgaDownload;
|
||||||
|
|
||||||
|
class FpgaUpload {
|
||||||
|
public:
|
||||||
|
static const uint32_t MAX_DATA = 1024;
|
||||||
|
// Full name of file to upload
|
||||||
|
std::string uploadFile;
|
||||||
|
};
|
||||||
|
FpgaUpload fpgaUpload;
|
||||||
|
|
||||||
|
static const uint32_t MAX_POLLS = 10000;
|
||||||
|
|
||||||
|
static const uint8_t ACTION_DATA_OFFSET = 2;
|
||||||
|
static const uint8_t POS_OFFSET = 2;
|
||||||
|
static const uint8_t IMAGE_DATA_OFFSET = 5;
|
||||||
|
static const uint8_t FLASH_READ_DATA_OFFSET = 8;
|
||||||
|
static const uint8_t REGION_OFFSET = 2;
|
||||||
|
static const uint8_t ADDRESS_OFFSET = 3;
|
||||||
|
static const uint8_t LENGTH_OFFSET = 7;
|
||||||
|
static const size_t IMAGE_DATA_SIZE = 1024;
|
||||||
|
static const size_t MAX_FLASH_DATA = 1024;
|
||||||
|
static const size_t CONFIG_MAX_DOWNLOAD_RETRIES = 3;
|
||||||
|
|
||||||
|
enum class InternalState {
|
||||||
|
IDLE,
|
||||||
|
UPLOAD_IMAGE,
|
||||||
|
DOWNLOAD_IMAGE,
|
||||||
|
FLASH_WRITE,
|
||||||
|
FLASH_READ,
|
||||||
|
DOWNLOAD_FPGA_IMAGE,
|
||||||
|
UPLOAD_FPGA_IMAGE
|
||||||
|
};
|
||||||
|
|
||||||
|
InternalState internalState = InternalState::IDLE;
|
||||||
|
|
||||||
|
ArcsecDatalinkLayer datalinkLayer;
|
||||||
|
|
||||||
|
BinarySemaphore semaphore;
|
||||||
|
|
||||||
|
class UploadImage {
|
||||||
|
public:
|
||||||
|
// Name including absolute path of image to upload
|
||||||
|
std::string uploadFile;
|
||||||
|
};
|
||||||
|
UploadImage uploadImage;
|
||||||
|
|
||||||
|
class DownloadImage {
|
||||||
|
public:
|
||||||
|
// Path where the downloaded image will be stored
|
||||||
|
std::string path;
|
||||||
|
// Default name of downloaded image, can be changed via command
|
||||||
|
std::string filename = "image.bin";
|
||||||
|
};
|
||||||
|
DownloadImage downloadImage;
|
||||||
|
|
||||||
|
class FlashWrite {
|
||||||
|
public:
|
||||||
|
// File which contains data to write when executing the flash write command
|
||||||
|
std::string fullname;
|
||||||
|
// Will be set with the flash write command
|
||||||
|
uint8_t region = 0;
|
||||||
|
// Will be set with the flash write command and specifies the start address where to write the
|
||||||
|
// flash data to
|
||||||
|
uint32_t address = 0;
|
||||||
|
};
|
||||||
|
FlashWrite flashWrite;
|
||||||
|
|
||||||
|
class FlashRead {
|
||||||
|
public:
|
||||||
|
// Path where the file containing the read data will be stored
|
||||||
|
std::string path = "";
|
||||||
|
// Default name of file containing the data read from flash, can be changed via command
|
||||||
|
std::string filename = "flashread.bin";
|
||||||
|
// Will be set with the flash read command
|
||||||
|
uint8_t region = 0;
|
||||||
|
// Will be set with the flash read command and specifies the start address of the flash section
|
||||||
|
// to read
|
||||||
|
uint32_t address = 0;
|
||||||
|
// Number of bytes to read from flash
|
||||||
|
uint32_t size = 0;
|
||||||
|
};
|
||||||
|
FlashRead flashRead;
|
||||||
|
|
||||||
|
SdCardManager* sdcMan = nullptr;
|
||||||
|
|
||||||
|
uint8_t commandBuffer[StarTracker::MAX_FRAME_SIZE];
|
||||||
|
|
||||||
|
bool terminate = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UART communication object responsible for low level access of star tracker
|
||||||
|
* Must be set by star tracker handler
|
||||||
|
*/
|
||||||
|
UartComIF* uartComIF = nullptr;
|
||||||
|
// Communication cookie. Must be set by the star tracker handler
|
||||||
|
CookieIF* comCookie = nullptr;
|
||||||
|
|
||||||
|
// Queue id of raw data receiver
|
||||||
|
MessageQueueId_t rawDataReceiver = MessageQueueIF::NO_QUEUE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Performs image uploading
|
||||||
|
*/
|
||||||
|
ReturnValue_t performImageUpload();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Performs download of last taken image from the star tracker.
|
||||||
|
*
|
||||||
|
* @details Download is split over multiple packets transporting each a maximum of 1024 bytes.
|
||||||
|
* In case the download of one position fails, the same packet will be again
|
||||||
|
* requested. If the download of the packet fails CONFIG_MAX_DOWNLOAD_RETRIES times,
|
||||||
|
* the download will be stopped.
|
||||||
|
*/
|
||||||
|
ReturnValue_t performImageDownload();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Handles flash write procedure
|
||||||
|
*
|
||||||
|
* @return RETURN_OK if successful, otherwise RETURN_FAILED
|
||||||
|
*/
|
||||||
|
ReturnValue_t performFlashWrite();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sends a sequence of commands to the star tracker to read larger parts from the
|
||||||
|
* flash memory.
|
||||||
|
*/
|
||||||
|
ReturnValue_t performFlashRead();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Performs the download of the FPGA image which requires to be slip over multiple
|
||||||
|
* action requests.
|
||||||
|
*/
|
||||||
|
ReturnValue_t performFpgaDownload();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Performs upload of new FPGA image. Upload sequence split over multiple commands
|
||||||
|
* because one command can only transport 1024 bytes of image data.
|
||||||
|
*/
|
||||||
|
ReturnValue_t performFpgaUpload();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sends packet to the star tracker and reads reply by using the communication
|
||||||
|
* interface
|
||||||
|
*
|
||||||
|
* @param size Size of data beforehand written to the commandBuffer
|
||||||
|
* @param parameter Parameter 2 of trigger event function
|
||||||
|
*
|
||||||
|
* @return RETURN_OK if successful, otherwise RETURN_FAILED
|
||||||
|
*/
|
||||||
|
ReturnValue_t sendAndRead(size_t size, uint32_t parameter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks the header (type id and status fields) of the action reply
|
||||||
|
*
|
||||||
|
* @return RETURN_OK if reply confirms success of packet transfer, otherwise REUTRN_FAILED
|
||||||
|
*/
|
||||||
|
ReturnValue_t checkActionReply();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks the position field in a star tracker upload/download reply.
|
||||||
|
*
|
||||||
|
* @param expectedPosition Value of expected position
|
||||||
|
*
|
||||||
|
* @return RETURN_OK if received position matches expected position, otherwise RETURN_FAILED
|
||||||
|
*/
|
||||||
|
ReturnValue_t checkReplyPosition(uint32_t expectedPosition);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks the region, address and length value of a flash write or read reply.
|
||||||
|
*
|
||||||
|
* @return RETURN_OK if values match expected values, otherwise appropriate error return
|
||||||
|
* value.
|
||||||
|
*/
|
||||||
|
ReturnValue_t checkFlashActionReply(uint8_t region_, uint32_t address_, uint16_t length_);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks the reply to the fpga download and upload request
|
||||||
|
*
|
||||||
|
* @param expectedPosition The expected position value in the reply
|
||||||
|
* @param expectedLength The expected length field in the reply
|
||||||
|
*/
|
||||||
|
ReturnValue_t checkFpgaActionReply(uint32_t expectedPosition, uint32_t expectedLength);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks if a path points to an sd card and whether the SD card is monuted.
|
||||||
|
*
|
||||||
|
* @return SD_NOT_MOUNTED id SD card is not mounted, otherwise RETURN_OK
|
||||||
|
*/
|
||||||
|
ReturnValue_t checkPath(std::string name);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* BSP_Q7S_DEVICES_STRHELPER_H_ */
|
@ -1,18 +1,17 @@
|
|||||||
#include "gpioCallbacks.h"
|
#include "gpioCallbacks.h"
|
||||||
#include "busConf.h"
|
|
||||||
#include <devices/gpioIds.h>
|
#include <devices/gpioIds.h>
|
||||||
|
|
||||||
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
|
||||||
#include <fsfw_hal/common/gpio/GpioCookie.h>
|
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
#include <fsfw_hal/common/gpio/GpioCookie.h>
|
||||||
|
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
||||||
|
|
||||||
|
#include "busConf.h"
|
||||||
|
|
||||||
namespace gpioCallbacks {
|
namespace gpioCallbacks {
|
||||||
|
|
||||||
GpioIF* gpioComInterface;
|
GpioIF* gpioComInterface;
|
||||||
|
|
||||||
void initSpiCsDecoder(GpioIF* gpioComIF) {
|
void initSpiCsDecoder(GpioIF* gpioComIF) {
|
||||||
|
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
|
|
||||||
if (gpioComIF == nullptr) {
|
if (gpioComIF == nullptr) {
|
||||||
@ -42,11 +41,11 @@ void initSpiCsDecoder(GpioIF* gpioComIF) {
|
|||||||
// gpio::OUT, gpio::LOW);
|
// gpio::OUT, gpio::LOW);
|
||||||
// spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit);
|
// spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit);
|
||||||
// /** Setting mux bit 2 to low disables IC1 on the TCS board */
|
// /** Setting mux bit 2 to low disables IC1 on the TCS board */
|
||||||
// spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 2", gpio::OUT, gpio::HIGH);
|
// spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 2",
|
||||||
// spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit);
|
// gpio::OUT, gpio::HIGH); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit);
|
||||||
// /** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */
|
// /** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board
|
||||||
// spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 3", gpio::OUT, gpio::LOW);
|
// */ spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit
|
||||||
// spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit);
|
// 3", gpio::OUT, gpio::LOW); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit);
|
||||||
|
|
||||||
/** The following gpios can take arbitrary initial values */
|
/** The following gpios can take arbitrary initial values */
|
||||||
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_4_PIN, "SPI Mux Bit 4",
|
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_4_PIN, "SPI Mux Bit 4",
|
||||||
@ -58,8 +57,8 @@ void initSpiCsDecoder(GpioIF* gpioComIF) {
|
|||||||
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_6_PIN, "SPI Mux Bit 6",
|
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_6_PIN, "SPI Mux Bit 6",
|
||||||
gpio::DIR_OUT, gpio::LOW);
|
gpio::DIR_OUT, gpio::LOW);
|
||||||
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit);
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit);
|
||||||
GpiodRegularByLineName* enRwDecoder = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_CS,
|
GpiodRegularByLineName* enRwDecoder =
|
||||||
"EN_RW_CS", gpio::DIR_OUT, gpio::HIGH);
|
new GpiodRegularByLineName(q7s::gpioNames::EN_RW_CS, "EN_RW_CS", gpio::DIR_OUT, gpio::HIGH);
|
||||||
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
|
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
|
||||||
|
|
||||||
result = gpioComInterface->addGpios(spiMuxGpios);
|
result = gpioComInterface->addGpios(spiMuxGpios);
|
||||||
@ -71,7 +70,6 @@ void initSpiCsDecoder(GpioIF* gpioComIF) {
|
|||||||
|
|
||||||
void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Levels value,
|
void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Levels value,
|
||||||
void* args) {
|
void* args) {
|
||||||
|
|
||||||
if (gpioComInterface == nullptr) {
|
if (gpioComInterface == nullptr) {
|
||||||
sif::debug << "spiCsDecoderCallback: No gpioComIF specified. Call initSpiCsDecoder "
|
sif::debug << "spiCsDecoderCallback: No gpioComIF specified. Call initSpiCsDecoder "
|
||||||
<< "to specify gpioComIF" << std::endl;
|
<< "to specify gpioComIF" << std::endl;
|
||||||
@ -220,8 +218,7 @@ void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Lev
|
|||||||
default:
|
default:
|
||||||
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
|
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
|
||||||
}
|
}
|
||||||
}
|
} else if (value == gpio::LOW) {
|
||||||
else if (value == gpio::LOW) {
|
|
||||||
switch (gpioId) {
|
switch (gpioId) {
|
||||||
case (gpioIds::RTD_IC_3): {
|
case (gpioIds::RTD_IC_3): {
|
||||||
selectY7();
|
selectY7();
|
||||||
@ -391,8 +388,7 @@ void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Lev
|
|||||||
default:
|
default:
|
||||||
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
|
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::debug << "spiCsDecoderCallback: Invalid value. Must be 0 or 1" << std::endl;
|
sif::debug << "spiCsDecoderCallback: Invalid value. Must be 0 or 1" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -446,13 +442,9 @@ void disableDecoderInterfaceBoardIc2() {
|
|||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void enableRwDecoder() {
|
void enableRwDecoder() { gpioComInterface->pullHigh(gpioIds::EN_RW_CS); }
|
||||||
gpioComInterface->pullHigh(gpioIds::EN_RW_CS);
|
|
||||||
}
|
|
||||||
|
|
||||||
void disableRwDecoder() {
|
void disableRwDecoder() { gpioComInterface->pullLow(gpioIds::EN_RW_CS); }
|
||||||
gpioComInterface->pullLow(gpioIds::EN_RW_CS);
|
|
||||||
}
|
|
||||||
|
|
||||||
void selectY0() {
|
void selectY0() {
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
||||||
@ -509,4 +501,4 @@ void disableAllDecoder() {
|
|||||||
gpioComInterface->pullLow(gpioIds::EN_RW_CS);
|
gpioComInterface->pullLow(gpioIds::EN_RW_CS);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace gpioCallbacks
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
#ifndef LINUX_GPIO_GPIOCALLBACKS_H_
|
#ifndef LINUX_GPIO_GPIOCALLBACKS_H_
|
||||||
#define LINUX_GPIO_GPIOCALLBACKS_H_
|
#define LINUX_GPIO_GPIOCALLBACKS_H_
|
||||||
|
|
||||||
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
|
|
||||||
#include <fsfw_hal/common/gpio/GpioIF.h>
|
#include <fsfw_hal/common/gpio/GpioIF.h>
|
||||||
|
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
|
||||||
|
|
||||||
namespace gpioCallbacks {
|
namespace gpioCallbacks {
|
||||||
|
|
||||||
@ -17,8 +16,8 @@ namespace gpioCallbacks {
|
|||||||
* @brief This function implements the decoding to multiply gpios by using the decoder
|
* @brief This function implements the decoding to multiply gpios by using the decoder
|
||||||
* chips SN74LVC138APWR on the TCS board and the interface board.
|
* chips SN74LVC138APWR on the TCS board and the interface board.
|
||||||
*/
|
*/
|
||||||
void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp,
|
void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Levels value,
|
||||||
gpio::Levels value, void* args);
|
void* args);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
|
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
|
||||||
@ -69,6 +68,6 @@ namespace gpioCallbacks {
|
|||||||
void selectY5();
|
void selectY5();
|
||||||
void selectY6();
|
void selectY6();
|
||||||
void selectY7();
|
void selectY7();
|
||||||
}
|
} // namespace gpioCallbacks
|
||||||
|
|
||||||
#endif /* LINUX_GPIO_GPIOCALLBACKS_H_ */
|
#endif /* LINUX_GPIO_GPIOCALLBACKS_H_ */
|
||||||
|
@ -12,8 +12,7 @@
|
|||||||
* @brief This is the main program for the target hardware.
|
* @brief This is the main program for the target hardware.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int main(void)
|
int main(void) {
|
||||||
{
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#if Q7S_SIMPLE_MODE == 0
|
#if Q7S_SIMPLE_MODE == 0
|
||||||
return obsw::obsw();
|
return obsw::obsw();
|
||||||
|
@ -1,33 +1,29 @@
|
|||||||
#include "FileSystemHandler.h"
|
#include "FileSystemHandler.h"
|
||||||
|
|
||||||
#include "bsp_q7s/core/CoreController.h"
|
|
||||||
|
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
|
||||||
#include "fsfw/memory/GenericFileSystemMessage.h"
|
|
||||||
#include "fsfw/ipc/QueueFactory.h"
|
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <fstream>
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
FileSystemHandler::FileSystemHandler(object_id_t fileSystemHandler):
|
#include "bsp_q7s/core/CoreController.h"
|
||||||
SystemObject(fileSystemHandler) {
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
|
#include "fsfw/memory/GenericFileSystemMessage.h"
|
||||||
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
|
||||||
|
FileSystemHandler::FileSystemHandler(object_id_t fileSystemHandler)
|
||||||
|
: SystemObject(fileSystemHandler) {
|
||||||
mq = QueueFactory::instance()->createMessageQueue(FS_MAX_QUEUE_SIZE);
|
mq = QueueFactory::instance()->createMessageQueue(FS_MAX_QUEUE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystemHandler::~FileSystemHandler() {
|
FileSystemHandler::~FileSystemHandler() { QueueFactory::instance()->deleteMessageQueue(mq); }
|
||||||
QueueFactory::instance()->deleteMessageQueue(mq);
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t FileSystemHandler::performOperation(uint8_t unsignedChar) {
|
ReturnValue_t FileSystemHandler::performOperation(uint8_t unsignedChar) {
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
fileSystemHandlerLoop();
|
fileSystemHandlerLoop();
|
||||||
}
|
} catch (std::bad_alloc& e) {
|
||||||
catch(std::bad_alloc& e) {
|
|
||||||
// Restart OBSW, hints at a memory leak
|
// Restart OBSW, hints at a memory leak
|
||||||
sif::error << "Allocation error in FileSystemHandler::performOperation"
|
sif::error << "Allocation error in FileSystemHandler::performOperation" << e.what()
|
||||||
<< e.what() << std::endl;
|
<< std::endl;
|
||||||
// Set up an error file or a special flag in the scratch buffer for these cases
|
// Set up an error file or a special flag in the scratch buffer for these cases
|
||||||
triggerEvent(CoreController::ALLOC_FAILURE, 0, 0);
|
triggerEvent(CoreController::ALLOC_FAILURE, 0, 0);
|
||||||
CoreController::incrementAllocationFailureCount();
|
CoreController::incrementAllocationFailureCount();
|
||||||
@ -35,7 +31,6 @@ ReturnValue_t FileSystemHandler::performOperation(uint8_t unsignedChar) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FileSystemHandler::fileSystemHandlerLoop() {
|
void FileSystemHandler::fileSystemHandlerLoop() {
|
||||||
CommandMessage filemsg;
|
CommandMessage filemsg;
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
@ -48,10 +43,8 @@ void FileSystemHandler::fileSystemHandlerLoop() {
|
|||||||
result = mq->receiveMessage(&filemsg);
|
result = mq->receiveMessage(&filemsg);
|
||||||
if (result == MessageQueueIF::EMPTY) {
|
if (result == MessageQueueIF::EMPTY) {
|
||||||
break;
|
break;
|
||||||
}
|
} else if (result != HasReturnvaluesIF::RETURN_FAILED) {
|
||||||
else if(result != HasReturnvaluesIF::RETURN_FAILED) {
|
sif::warning << "FileSystemHandler::performOperation: Message reception failed!" << std::endl;
|
||||||
sif::warning << "FileSystemHandler::performOperation: Message reception failed!"
|
|
||||||
<< std::endl;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Command_t command = filemsg.getCommand();
|
Command_t command = filemsg.getCommand();
|
||||||
@ -78,26 +71,23 @@ void FileSystemHandler::fileSystemCheckup() {
|
|||||||
sdcMan->getSdCardActiveStatus(statusPair);
|
sdcMan->getSdCardActiveStatus(statusPair);
|
||||||
sd::SdCard preferredSdCard;
|
sd::SdCard preferredSdCard;
|
||||||
sdcMan->getPreferredSdCard(preferredSdCard);
|
sdcMan->getPreferredSdCard(preferredSdCard);
|
||||||
if((preferredSdCard == sd::SdCard::SLOT_0) and
|
if ((preferredSdCard == sd::SdCard::SLOT_0) and (statusPair.first == sd::SdState::MOUNTED)) {
|
||||||
(statusPair.first == sd::SdState::MOUNTED)) {
|
|
||||||
currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
|
currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
|
||||||
}
|
} else if ((preferredSdCard == sd::SdCard::SLOT_1) and
|
||||||
else if((preferredSdCard == sd::SdCard::SLOT_1) and
|
|
||||||
(statusPair.second == sd::SdState::MOUNTED)) {
|
(statusPair.second == sd::SdState::MOUNTED)) {
|
||||||
currentMountPrefix = SdCardManager::SD_1_MOUNT_POINT;
|
currentMountPrefix = SdCardManager::SD_1_MOUNT_POINT;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
std::string sdString;
|
std::string sdString;
|
||||||
if (preferredSdCard == sd::SdCard::SLOT_0) {
|
if (preferredSdCard == sd::SdCard::SLOT_0) {
|
||||||
sdString = "0";
|
sdString = "0";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sdString = "1";
|
sdString = "1";
|
||||||
}
|
}
|
||||||
sif::warning << "FileSystemHandler::performOperation: "
|
sif::warning << "FileSystemHandler::performOperation: "
|
||||||
"Inconsistent state detected" << std::endl;
|
"Inconsistent state detected"
|
||||||
sif::warning << "Preferred SD card is " << sdString <<
|
<< std::endl;
|
||||||
" but does not appear to be mounted. Attempting fix.." << std::endl;
|
sif::warning << "Preferred SD card is " << sdString
|
||||||
|
<< " but does not appear to be mounted. Attempting fix.." << std::endl;
|
||||||
// This function will appear to fix the inconsistent state
|
// This function will appear to fix the inconsistent state
|
||||||
ReturnValue_t result = sdcMan->sanitizeState(&statusPair, preferredSdCard);
|
ReturnValue_t result = sdcMan->sanitizeState(&statusPair, preferredSdCard);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
@ -108,15 +98,13 @@ void FileSystemHandler::fileSystemCheckup() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageQueueId_t FileSystemHandler::getCommandQueue() const {
|
MessageQueueId_t FileSystemHandler::getCommandQueue() const { return mq->getId(); }
|
||||||
return mq->getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t FileSystemHandler::initialize() {
|
ReturnValue_t FileSystemHandler::initialize() {
|
||||||
coreCtrl = ObjectManager::instance()->get<CoreController>(objects::CORE_CONTROLLER);
|
coreCtrl = ObjectManager::instance()->get<CoreController>(objects::CORE_CONTROLLER);
|
||||||
if (coreCtrl == nullptr) {
|
if (coreCtrl == nullptr) {
|
||||||
sif::error << "FileSystemHandler::initialize: Could not retrieve core controller handle" <<
|
sif::error << "FileSystemHandler::initialize: Could not retrieve core controller handle"
|
||||||
std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
sdcMan = SdCardManager::instance();
|
sdcMan = SdCardManager::instance();
|
||||||
sd::SdCard preferredSdCard;
|
sd::SdCard preferredSdCard;
|
||||||
@ -126,15 +114,14 @@ ReturnValue_t FileSystemHandler::initialize() {
|
|||||||
}
|
}
|
||||||
if (preferredSdCard == sd::SdCard::SLOT_0) {
|
if (preferredSdCard == sd::SdCard::SLOT_0) {
|
||||||
currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
|
currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
|
||||||
}
|
} else if (preferredSdCard == sd::SdCard::SLOT_1) {
|
||||||
else if(preferredSdCard == sd::SdCard::SLOT_1) {
|
|
||||||
currentMountPrefix = SdCardManager::SD_1_MOUNT_POINT;
|
currentMountPrefix = SdCardManager::SD_1_MOUNT_POINT;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FileSystemHandler::appendToFile(const char* repositoryPath,
|
ReturnValue_t FileSystemHandler::appendToFile(const char* repositoryPath, const char* filename,
|
||||||
const char* filename, const uint8_t* data, size_t size,
|
const uint8_t* data, size_t size,
|
||||||
uint16_t packetNumber, FileSystemArgsIF* args) {
|
uint16_t packetNumber, FileSystemArgsIF* args) {
|
||||||
auto path = getInitPath(args) / repositoryPath / filename;
|
auto path = getInitPath(args) / repositoryPath / filename;
|
||||||
if (not std::filesystem::exists(path)) {
|
if (not std::filesystem::exists(path)) {
|
||||||
@ -148,8 +135,9 @@ ReturnValue_t FileSystemHandler::appendToFile(const char* repositoryPath,
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FileSystemHandler::createFile(const char* repositoryPath,
|
ReturnValue_t FileSystemHandler::createFile(const char* repositoryPath, const char* filename,
|
||||||
const char* filename, const uint8_t* data, size_t size, FileSystemArgsIF* args) {
|
const uint8_t* data, size_t size,
|
||||||
|
FileSystemArgsIF* args) {
|
||||||
auto path = getInitPath(args) / filename;
|
auto path = getInitPath(args) / filename;
|
||||||
if (std::filesystem::exists(path)) {
|
if (std::filesystem::exists(path)) {
|
||||||
return FILE_ALREADY_EXISTS;
|
return FILE_ALREADY_EXISTS;
|
||||||
@ -162,8 +150,8 @@ ReturnValue_t FileSystemHandler::createFile(const char* repositoryPath,
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FileSystemHandler::removeFile(const char* repositoryPath,
|
ReturnValue_t FileSystemHandler::removeFile(const char* repositoryPath, const char* filename,
|
||||||
const char* filename, FileSystemArgsIF* args) {
|
FileSystemArgsIF* args) {
|
||||||
auto path = getInitPath(args) / repositoryPath / filename;
|
auto path = getInitPath(args) / repositoryPath / filename;
|
||||||
if (not std::filesystem::exists(path)) {
|
if (not std::filesystem::exists(path)) {
|
||||||
return FILE_DOES_NOT_EXIST;
|
return FILE_DOES_NOT_EXIST;
|
||||||
@ -199,32 +187,28 @@ ReturnValue_t FileSystemHandler::removeDirectory(const char* repositoryPath, con
|
|||||||
if (not deleteRecurively) {
|
if (not deleteRecurively) {
|
||||||
if (std::filesystem::remove(path, err)) {
|
if (std::filesystem::remove(path, err)) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Check error code. Most probably denied permissions because folder is not empty
|
// Check error code. Most probably denied permissions because folder is not empty
|
||||||
sif::warning << "FileSystemHandler::removeDirectory: Deleting directory failed with "
|
sif::warning << "FileSystemHandler::removeDirectory: Deleting directory failed with "
|
||||||
"code " << err.value() << ": " << strerror(err.value()) << std::endl;
|
"code "
|
||||||
|
<< err.value() << ": " << strerror(err.value()) << std::endl;
|
||||||
if (err.value() == ENOTEMPTY) {
|
if (err.value() == ENOTEMPTY) {
|
||||||
return DIRECTORY_NOT_EMPTY;
|
return DIRECTORY_NOT_EMPTY;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return GENERIC_FILE_ERROR;
|
return GENERIC_FILE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (std::filesystem::remove_all(path, err)) {
|
if (std::filesystem::remove_all(path, err)) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::warning << "FileSystemHandler::removeDirectory: Deleting directory failed with "
|
sif::warning << "FileSystemHandler::removeDirectory: Deleting directory failed with "
|
||||||
"code " << err.value() << ": " << strerror(err.value()) << std::endl;
|
"code "
|
||||||
|
<< err.value() << ": " << strerror(err.value()) << std::endl;
|
||||||
// Check error code
|
// Check error code
|
||||||
if (err.value() == ENOTEMPTY) {
|
if (err.value() == ENOTEMPTY) {
|
||||||
return DIRECTORY_NOT_EMPTY;
|
return DIRECTORY_NOT_EMPTY;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return GENERIC_FILE_ERROR;
|
return GENERIC_FILE_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,19 @@
|
|||||||
#ifndef BSP_Q7S_MEMORY_FILESYSTEMHANDLER_H_
|
#ifndef BSP_Q7S_MEMORY_FILESYSTEMHANDLER_H_
|
||||||
#define BSP_Q7S_MEMORY_FILESYSTEMHANDLER_H_
|
#define BSP_Q7S_MEMORY_FILESYSTEMHANDLER_H_
|
||||||
|
|
||||||
#include "SdCardManager.h"
|
|
||||||
#include "OBSWConfig.h"
|
|
||||||
|
|
||||||
#include "fsfw/ipc/MessageQueueIF.h"
|
|
||||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
|
||||||
#include "fsfw/objectmanager/SystemObject.h"
|
|
||||||
#include "fsfw/memory/HasFileSystemIF.h"
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "SdCardManager.h"
|
||||||
|
#include "fsfw/ipc/MessageQueueIF.h"
|
||||||
|
#include "fsfw/memory/HasFileSystemIF.h"
|
||||||
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
|
|
||||||
class CoreController;
|
class CoreController;
|
||||||
|
|
||||||
class FileSystemHandler: public SystemObject,
|
class FileSystemHandler : public SystemObject, public ExecutableObjectIF, public HasFileSystemIF {
|
||||||
public ExecutableObjectIF,
|
|
||||||
public HasFileSystemIF {
|
|
||||||
public:
|
public:
|
||||||
struct FsCommandCfg : public FileSystemArgsIF {
|
struct FsCommandCfg : public FileSystemArgsIF {
|
||||||
// Can be used to automatically use mount prefix of active SD card.
|
// Can be used to automatically use mount prefix of active SD card.
|
||||||
@ -36,18 +33,19 @@ public:
|
|||||||
* @return MessageQueueId_t of the object
|
* @return MessageQueueId_t of the object
|
||||||
*/
|
*/
|
||||||
MessageQueueId_t getCommandQueue() const override;
|
MessageQueueId_t getCommandQueue() const override;
|
||||||
ReturnValue_t appendToFile(const char* repositoryPath,
|
ReturnValue_t appendToFile(const char* repositoryPath, const char* filename, const uint8_t* data,
|
||||||
const char* filename, const uint8_t* data, size_t size,
|
size_t size, uint16_t packetNumber,
|
||||||
uint16_t packetNumber, FileSystemArgsIF* args = nullptr) override;
|
FileSystemArgsIF* args = nullptr) override;
|
||||||
ReturnValue_t createFile(const char* repositoryPath,
|
ReturnValue_t createFile(const char* repositoryPath, const char* filename,
|
||||||
const char* filename, const uint8_t* data = nullptr,
|
const uint8_t* data = nullptr, size_t size = 0,
|
||||||
size_t size = 0, FileSystemArgsIF* args = nullptr) override;
|
FileSystemArgsIF* args = nullptr) override;
|
||||||
ReturnValue_t removeFile(const char* repositoryPath,
|
ReturnValue_t removeFile(const char* repositoryPath, const char* filename,
|
||||||
const char* filename, FileSystemArgsIF* args = nullptr) override;
|
FileSystemArgsIF* args = nullptr) override;
|
||||||
ReturnValue_t createDirectory(const char* repositoryPath, const char* dirname,
|
ReturnValue_t createDirectory(const char* repositoryPath, const char* dirname,
|
||||||
bool createParentDirs, FileSystemArgsIF* args = nullptr) override;
|
bool createParentDirs, FileSystemArgsIF* args = nullptr) override;
|
||||||
ReturnValue_t removeDirectory(const char* repositoryPath, const char* dirname,
|
ReturnValue_t removeDirectory(const char* repositoryPath, const char* dirname,
|
||||||
bool deleteRecurively = false, FileSystemArgsIF* args = nullptr) override;
|
bool deleteRecurively = false,
|
||||||
|
FileSystemArgsIF* args = nullptr) override;
|
||||||
ReturnValue_t renameFile(const char* repositoryPath, const char* oldFilename,
|
ReturnValue_t renameFile(const char* repositoryPath, const char* oldFilename,
|
||||||
const char* newFilename, FileSystemArgsIF* args = nullptr) override;
|
const char* newFilename, FileSystemArgsIF* args = nullptr) override;
|
||||||
|
|
||||||
@ -66,6 +64,4 @@ private:
|
|||||||
void parseCfg(FsCommandCfg* cfg, bool& useMountPrefix);
|
void parseCfg(FsCommandCfg* cfg, bool& useMountPrefix);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* BSP_Q7S_MEMORY_FILESYSTEMMANAGER_H_ */
|
#endif /* BSP_Q7S_MEMORY_FILESYSTEMMANAGER_H_ */
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
#include "SdCardManager.h"
|
#include "SdCardManager.h"
|
||||||
#include "scratchApi.h"
|
|
||||||
|
|
||||||
#include "linux/utility/utility.h"
|
|
||||||
|
|
||||||
#include "fsfw/ipc/MutexFactory.h"
|
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
#include <filesystem>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <filesystem>
|
|
||||||
#include <cstring>
|
#include "fsfw/ipc/MutexFactory.h"
|
||||||
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
#include "linux/utility/utility.h"
|
||||||
|
#include "scratchApi.h"
|
||||||
|
|
||||||
SdCardManager* SdCardManager::factoryInstance = nullptr;
|
SdCardManager* SdCardManager::factoryInstance = nullptr;
|
||||||
|
|
||||||
SdCardManager::SdCardManager(): cmdExecutor(256) {
|
SdCardManager::SdCardManager() : cmdExecutor(256) {}
|
||||||
}
|
|
||||||
|
|
||||||
SdCardManager::~SdCardManager() {
|
SdCardManager::~SdCardManager() {}
|
||||||
}
|
|
||||||
|
|
||||||
void SdCardManager::create() {
|
void SdCardManager::create() {
|
||||||
if (factoryInstance == nullptr) {
|
if (factoryInstance == nullptr) {
|
||||||
@ -39,7 +36,8 @@ ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCar
|
|||||||
if (not blocking) {
|
if (not blocking) {
|
||||||
sif::warning << "SdCardManager::switchOnSdCard: Two-step command but manager is"
|
sif::warning << "SdCardManager::switchOnSdCard: Two-step command but manager is"
|
||||||
" not configured for blocking operation. "
|
" not configured for blocking operation. "
|
||||||
"Forcing blocking mode.." << std::endl;
|
"Forcing blocking mode.."
|
||||||
|
<< std::endl;
|
||||||
blocking = true;
|
blocking = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,11 +61,9 @@ ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCar
|
|||||||
sd::SdState currentState;
|
sd::SdState currentState;
|
||||||
if (sdCard == sd::SdCard::SLOT_0) {
|
if (sdCard == sd::SdCard::SLOT_0) {
|
||||||
currentState = statusPair->first;
|
currentState = statusPair->first;
|
||||||
}
|
} else if (sdCard == sd::SdCard::SLOT_1) {
|
||||||
else if(sdCard == sd::SdCard::SLOT_1) {
|
|
||||||
currentState = statusPair->second;
|
currentState = statusPair->second;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Should not happen
|
// Should not happen
|
||||||
currentState = sd::SdState::OFF;
|
currentState = sd::SdState::OFF;
|
||||||
}
|
}
|
||||||
@ -75,18 +71,14 @@ ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCar
|
|||||||
if (currentState == sd::SdState::ON) {
|
if (currentState == sd::SdState::ON) {
|
||||||
if (not doMountSdCard) {
|
if (not doMountSdCard) {
|
||||||
return ALREADY_ON;
|
return ALREADY_ON;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return mountSdCard(sdCard);
|
return mountSdCard(sdCard);
|
||||||
}
|
}
|
||||||
}
|
} else if (currentState == sd::SdState::MOUNTED) {
|
||||||
else if(currentState == sd::SdState::MOUNTED) {
|
|
||||||
result = ALREADY_MOUNTED;
|
result = ALREADY_MOUNTED;
|
||||||
}
|
} else if (currentState == sd::SdState::OFF) {
|
||||||
else if(currentState == sd::SdState::OFF) {
|
|
||||||
result = setSdCardState(sdCard, true);
|
result = setSdCardState(sdCard, true);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
result = HasReturnvaluesIF::RETURN_FAILED;
|
result = HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +99,8 @@ ReturnValue_t SdCardManager::switchOffSdCard(sd::SdCard sdCard, bool doUnmountSd
|
|||||||
if (doUnmountSdCard) {
|
if (doUnmountSdCard) {
|
||||||
if (not blocking) {
|
if (not blocking) {
|
||||||
sif::warning << "SdCardManager::switchOffSdCard: Two-step command but manager is"
|
sif::warning << "SdCardManager::switchOffSdCard: Two-step command but manager is"
|
||||||
" not configured for blocking operation. Forcing blocking mode.." << std::endl;
|
" not configured for blocking operation. Forcing blocking mode.."
|
||||||
|
<< std::endl;
|
||||||
blocking = true;
|
blocking = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,8 +114,7 @@ ReturnValue_t SdCardManager::switchOffSdCard(sd::SdCard sdCard, bool doUnmountSd
|
|||||||
if (active.first == sd::SdState::OFF) {
|
if (active.first == sd::SdState::OFF) {
|
||||||
return ALREADY_OFF;
|
return ALREADY_OFF;
|
||||||
}
|
}
|
||||||
}
|
} else if (sdCard == sd::SdCard::SLOT_1) {
|
||||||
else if(sdCard == sd::SdCard::SLOT_1) {
|
|
||||||
if (active.second == sd::SdState::OFF) {
|
if (active.second == sd::SdState::OFF) {
|
||||||
return ALREADY_OFF;
|
return ALREADY_OFF;
|
||||||
}
|
}
|
||||||
@ -147,15 +139,13 @@ ReturnValue_t SdCardManager::setSdCardState(sd::SdCard sdCard, bool on) {
|
|||||||
string statestring = "";
|
string statestring = "";
|
||||||
if (sdCard == sd::SdCard::SLOT_0) {
|
if (sdCard == sd::SdCard::SLOT_0) {
|
||||||
sdstring = "0";
|
sdstring = "0";
|
||||||
}
|
} else if (sdCard == sd::SdCard::SLOT_1) {
|
||||||
else if(sdCard == sd::SdCard::SLOT_1) {
|
|
||||||
sdstring = "1";
|
sdstring = "1";
|
||||||
}
|
}
|
||||||
if (on) {
|
if (on) {
|
||||||
currentOp = Operations::SWITCHING_ON;
|
currentOp = Operations::SWITCHING_ON;
|
||||||
statestring = "on";
|
statestring = "on";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
currentOp = Operations::SWITCHING_OFF;
|
currentOp = Operations::SWITCHING_OFF;
|
||||||
statestring = "off";
|
statestring = "off";
|
||||||
}
|
}
|
||||||
@ -205,14 +195,14 @@ ReturnValue_t SdCardManager::mountSdCard(sd::SdCard sdCard) {
|
|||||||
if (sdCard == sd::SdCard::SLOT_0) {
|
if (sdCard == sd::SdCard::SLOT_0) {
|
||||||
mountDev = SD_0_DEV_NAME;
|
mountDev = SD_0_DEV_NAME;
|
||||||
mountPoint = SD_0_MOUNT_POINT;
|
mountPoint = SD_0_MOUNT_POINT;
|
||||||
}
|
} else if (sdCard == sd::SdCard::SLOT_1) {
|
||||||
else if(sdCard == sd::SdCard::SLOT_1) {
|
|
||||||
mountDev = SD_1_DEV_NAME;
|
mountDev = SD_1_DEV_NAME;
|
||||||
mountPoint = SD_1_MOUNT_POINT;
|
mountPoint = SD_1_MOUNT_POINT;
|
||||||
}
|
}
|
||||||
if (not filesystem::exists(mountDev)) {
|
if (not filesystem::exists(mountDev)) {
|
||||||
sif::warning << "SdCardManager::mountSdCard: Device file does not exists. Make sure to"
|
sif::warning << "SdCardManager::mountSdCard: Device file does not exists. Make sure to"
|
||||||
" turn on the SD card" << std::endl;
|
" turn on the SD card"
|
||||||
|
<< std::endl;
|
||||||
return MOUNT_ERROR;
|
return MOUNT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,13 +231,12 @@ ReturnValue_t SdCardManager::unmountSdCard(sd::SdCard sdCard) {
|
|||||||
string mountPoint;
|
string mountPoint;
|
||||||
if (sdCard == sd::SdCard::SLOT_0) {
|
if (sdCard == sd::SdCard::SLOT_0) {
|
||||||
mountPoint = SD_0_MOUNT_POINT;
|
mountPoint = SD_0_MOUNT_POINT;
|
||||||
}
|
} else if (sdCard == sd::SdCard::SLOT_1) {
|
||||||
else if(sdCard == sd::SdCard::SLOT_1) {
|
|
||||||
mountPoint = SD_1_MOUNT_POINT;
|
mountPoint = SD_1_MOUNT_POINT;
|
||||||
}
|
}
|
||||||
if (not filesystem::exists(mountPoint)) {
|
if (not filesystem::exists(mountPoint)) {
|
||||||
sif::error << "SdCardManager::unmountSdCard: Default mount point " << mountPoint <<
|
sif::error << "SdCardManager::unmountSdCard: Default mount point " << mountPoint
|
||||||
"does not exist" << std::endl;
|
<< "does not exist" << std::endl;
|
||||||
return UNMOUNT_ERROR;
|
return UNMOUNT_ERROR;
|
||||||
}
|
}
|
||||||
if (filesystem::is_empty(mountPoint)) {
|
if (filesystem::is_empty(mountPoint)) {
|
||||||
@ -278,7 +267,8 @@ ReturnValue_t SdCardManager::sanitizeState(SdStatePair* statusPair, sd::SdCard p
|
|||||||
}
|
}
|
||||||
if (prefSdCard == sd::SdCard::NONE) {
|
if (prefSdCard == sd::SdCard::NONE) {
|
||||||
result = getPreferredSdCard(prefSdCard);
|
result = getPreferredSdCard(prefSdCard);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {}
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (statusPair == nullptr) {
|
if (statusPair == nullptr) {
|
||||||
sdStatusPtr = std::make_unique<SdStatePair>();
|
sdStatusPtr = std::make_unique<SdStatePair>();
|
||||||
@ -325,16 +315,13 @@ void SdCardManager::processSdStatusLine(std::pair<sd::SdState, sd::SdState> &act
|
|||||||
if (word == "on") {
|
if (word == "on") {
|
||||||
if (currentSd == sd::SdCard::SLOT_0) {
|
if (currentSd == sd::SdCard::SLOT_0) {
|
||||||
active.first = sd::SdState::ON;
|
active.first = sd::SdState::ON;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
active.second = sd::SdState::ON;
|
active.second = sd::SdState::ON;
|
||||||
}
|
}
|
||||||
}
|
} else if (word == "off") {
|
||||||
else if (word == "off") {
|
|
||||||
if (currentSd == sd::SdCard::SLOT_0) {
|
if (currentSd == sd::SdCard::SLOT_0) {
|
||||||
active.first = sd::SdState::OFF;
|
active.first = sd::SdState::OFF;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
active.second = sd::SdState::OFF;
|
active.second = sd::SdState::OFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -343,15 +330,15 @@ void SdCardManager::processSdStatusLine(std::pair<sd::SdState, sd::SdState> &act
|
|||||||
if (mountLine) {
|
if (mountLine) {
|
||||||
if (currentSd == sd::SdCard::SLOT_0) {
|
if (currentSd == sd::SdCard::SLOT_0) {
|
||||||
active.first = sd::SdState::MOUNTED;
|
active.first = sd::SdState::MOUNTED;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
active.second = sd::SdState::MOUNTED;
|
active.second = sd::SdState::MOUNTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idx > 5) {
|
if (idx > 5) {
|
||||||
sif::warning << "SdCardManager::sdCardActive: /tmp/sd_status.txt has more than 6 "
|
sif::warning << "SdCardManager::sdCardActive: /tmp/sd_status.txt has more than 6 "
|
||||||
"lines and might be invalid!" << std::endl;
|
"lines and might be invalid!"
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
idx++;
|
idx++;
|
||||||
@ -397,8 +384,7 @@ std::string SdCardManager::getCurrentMountPrefix(sd::SdCard prefSdCard) {
|
|||||||
}
|
}
|
||||||
if (prefSdCard == sd::SdCard::SLOT_0) {
|
if (prefSdCard == sd::SdCard::SLOT_0) {
|
||||||
return SD_0_MOUNT_POINT;
|
return SD_0_MOUNT_POINT;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return SD_1_MOUNT_POINT;
|
return SD_1_MOUNT_POINT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -446,12 +432,31 @@ SdCardManager::OpStatus SdCardManager::checkCurrentOp(Operations ¤tOp) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SdCardManager::setBlocking(bool blocking) {
|
void SdCardManager::setBlocking(bool blocking) { this->blocking = blocking; }
|
||||||
this->blocking = blocking;
|
|
||||||
|
void SdCardManager::setPrintCommandOutput(bool print) { this->printCmdOutput = print; }
|
||||||
|
|
||||||
|
bool SdCardManager::isSdCardMounted(sd::SdCard sdCard) {
|
||||||
|
SdCardManager::SdStatePair active;
|
||||||
|
ReturnValue_t result = this->getSdCardActiveStatus(active);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::debug << "SdCardManager::isSdCardMounted: Failed to get SD card active state";
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
if (sdCard == sd::SLOT_0) {
|
||||||
void SdCardManager::setPrintCommandOutput(bool print) {
|
if (active.first == sd::MOUNTED) {
|
||||||
this->printCmdOutput = print;
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (sdCard == sd::SLOT_1) {
|
||||||
|
if (active.second == sd::MOUNTED) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sif::debug << "SdCardManager::isSdCardMounted: Unknown SD card specified" << std::endl;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,21 +1,20 @@
|
|||||||
#ifndef BSP_Q7S_MEMORY_SDCARDACCESSMANAGER_H_
|
#ifndef BSP_Q7S_MEMORY_SDCARDACCESSMANAGER_H_
|
||||||
#define BSP_Q7S_MEMORY_SDCARDACCESSMANAGER_H_
|
#define BSP_Q7S_MEMORY_SDCARDACCESSMANAGER_H_
|
||||||
|
|
||||||
#include "fsfw_hal/linux/CommandExecutor.h"
|
|
||||||
#include "definitions.h"
|
|
||||||
#include "returnvalues/classIds.h"
|
|
||||||
#include "events/subsystemIdRanges.h"
|
|
||||||
|
|
||||||
#include "fsfw/events/Event.h"
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
|
||||||
|
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
#include <utility>
|
|
||||||
#include <string>
|
|
||||||
#include <optional>
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <optional>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include "definitions.h"
|
||||||
|
#include "events/subsystemIdRanges.h"
|
||||||
|
#include "fsfw/events/Event.h"
|
||||||
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
#include "fsfw_hal/linux/CommandExecutor.h"
|
||||||
|
#include "returnvalues/classIds.h"
|
||||||
|
|
||||||
class MutexIF;
|
class MutexIF;
|
||||||
|
|
||||||
@ -25,41 +24,26 @@ class MutexIF;
|
|||||||
*/
|
*/
|
||||||
class SdCardManager {
|
class SdCardManager {
|
||||||
friend class SdCardAccess;
|
friend class SdCardAccess;
|
||||||
public:
|
|
||||||
enum class Operations {
|
|
||||||
SWITCHING_ON,
|
|
||||||
SWITCHING_OFF,
|
|
||||||
MOUNTING,
|
|
||||||
UNMOUNTING,
|
|
||||||
IDLE
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class OpStatus {
|
public:
|
||||||
IDLE,
|
enum class Operations { SWITCHING_ON, SWITCHING_OFF, MOUNTING, UNMOUNTING, IDLE };
|
||||||
TIMEOUT,
|
|
||||||
ONGOING,
|
enum class OpStatus { IDLE, TIMEOUT, ONGOING, SUCCESS, FAIL };
|
||||||
SUCCESS,
|
|
||||||
FAIL
|
|
||||||
};
|
|
||||||
|
|
||||||
using SdStatePair = std::pair<sd::SdState, sd::SdState>;
|
using SdStatePair = std::pair<sd::SdState, sd::SdState>;
|
||||||
|
|
||||||
static constexpr uint8_t INTERFACE_ID = CLASS_ID::SD_CARD_MANAGER;
|
static constexpr uint8_t INTERFACE_ID = CLASS_ID::SD_CARD_MANAGER;
|
||||||
|
|
||||||
static constexpr ReturnValue_t OP_ONGOING =
|
static constexpr ReturnValue_t OP_ONGOING = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 0);
|
||||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 0);
|
static constexpr ReturnValue_t ALREADY_ON = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 1);
|
||||||
static constexpr ReturnValue_t ALREADY_ON =
|
|
||||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 1);
|
|
||||||
static constexpr ReturnValue_t ALREADY_MOUNTED =
|
static constexpr ReturnValue_t ALREADY_MOUNTED =
|
||||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 2);
|
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 2);
|
||||||
static constexpr ReturnValue_t ALREADY_OFF =
|
static constexpr ReturnValue_t ALREADY_OFF = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 3);
|
||||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 3);
|
|
||||||
static constexpr ReturnValue_t STATUS_FILE_NEXISTS =
|
static constexpr ReturnValue_t STATUS_FILE_NEXISTS =
|
||||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 10);
|
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 10);
|
||||||
static constexpr ReturnValue_t STATUS_FILE_FORMAT_INVALID =
|
static constexpr ReturnValue_t STATUS_FILE_FORMAT_INVALID =
|
||||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 11);
|
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 11);
|
||||||
static constexpr ReturnValue_t MOUNT_ERROR =
|
static constexpr ReturnValue_t MOUNT_ERROR = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 12);
|
||||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 12);
|
|
||||||
static constexpr ReturnValue_t UNMOUNT_ERROR =
|
static constexpr ReturnValue_t UNMOUNT_ERROR =
|
||||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 13);
|
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 13);
|
||||||
static constexpr ReturnValue_t SYSTEM_CALL_ERROR =
|
static constexpr ReturnValue_t SYSTEM_CALL_ERROR =
|
||||||
@ -195,6 +179,16 @@ public:
|
|||||||
|
|
||||||
void setBlocking(bool blocking);
|
void setBlocking(bool blocking);
|
||||||
void setPrintCommandOutput(bool print);
|
void setPrintCommandOutput(bool print);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks if an SD card is mounted
|
||||||
|
*
|
||||||
|
* @param sdCard The SD crad to check
|
||||||
|
*
|
||||||
|
* @return true if mounted, otherwise false
|
||||||
|
*/
|
||||||
|
bool isSdCardMounted(sd::SdCard sdCard);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CommandExecutor cmdExecutor;
|
CommandExecutor cmdExecutor;
|
||||||
Operations currentOp = Operations::IDLE;
|
Operations currentOp = Operations::IDLE;
|
||||||
|
@ -12,15 +12,8 @@ enum SdState: uint8_t {
|
|||||||
MOUNTED = 2
|
MOUNTED = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SdCard: uint8_t {
|
enum SdCard : uint8_t { SLOT_0 = 0, SLOT_1 = 1, BOTH, NONE };
|
||||||
SLOT_0 = 0,
|
|
||||||
SLOT_1 = 1,
|
|
||||||
BOTH,
|
|
||||||
NONE
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace sd
|
||||||
|
|
||||||
#endif /* BSP_Q7S_MEMORY_DEFINITIONS_H_ */
|
#endif /* BSP_Q7S_MEMORY_DEFINITIONS_H_ */
|
||||||
|
@ -28,7 +28,8 @@ ReturnValue_t scratch::readString(std::string key, std::string &string) {
|
|||||||
size_t pos = line.find("=");
|
size_t pos = line.find("=");
|
||||||
if (pos == std::string::npos) {
|
if (pos == std::string::npos) {
|
||||||
sif::warning << "scratch::readNumber: Output file format invalid, "
|
sif::warning << "scratch::readNumber: Output file format invalid, "
|
||||||
"no \"=\" found" << std::endl;
|
"no \"=\" found"
|
||||||
|
<< std::endl;
|
||||||
// Could not find value
|
// Could not find value
|
||||||
std::remove(filename.c_str());
|
std::remove(filename.c_str());
|
||||||
return KEY_NOT_FOUND;
|
return KEY_NOT_FOUND;
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
#ifndef BSP_Q7S_MEMORY_SCRATCHAPI_H_
|
#ifndef BSP_Q7S_MEMORY_SCRATCHAPI_H_
|
||||||
#define BSP_Q7S_MEMORY_SCRATCHAPI_H_
|
#define BSP_Q7S_MEMORY_SCRATCHAPI_H_
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "linux/utility/utility.h"
|
#include "linux/utility/utility.h"
|
||||||
#include "returnvalues/classIds.h"
|
#include "returnvalues/classIds.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
|
||||||
#include <sstream>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief API for the scratch buffer
|
* @brief API for the scratch buffer
|
||||||
*/
|
*/
|
||||||
@ -62,7 +62,6 @@ inline ReturnValue_t writeNumber(std::string key, T num) noexcept;
|
|||||||
template <typename T, class = typename std::enable_if<std::is_integral<T>::value>::type>
|
template <typename T, class = typename std::enable_if<std::is_integral<T>::value>::type>
|
||||||
inline ReturnValue_t readNumber(std::string key, T& num) noexcept;
|
inline ReturnValue_t readNumber(std::string key, T& num) noexcept;
|
||||||
|
|
||||||
|
|
||||||
// Anonymous namespace
|
// Anonymous namespace
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -81,8 +80,7 @@ ReturnValue_t readToFile(std::string name, std::ifstream& file, std::string& fil
|
|||||||
// Could not find value
|
// Could not find value
|
||||||
std::remove(filename.c_str());
|
std::remove(filename.c_str());
|
||||||
return KEY_NOT_FOUND;
|
return KEY_NOT_FOUND;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
utility::handleSystemError(result, "scratch::readNumber");
|
utility::handleSystemError(result, "scratch::readNumber");
|
||||||
std::remove(filename.c_str());
|
std::remove(filename.c_str());
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
@ -126,7 +124,8 @@ inline ReturnValue_t readNumber(std::string key, T& num) noexcept {
|
|||||||
size_t pos = line.find("=");
|
size_t pos = line.find("=");
|
||||||
if (pos == string::npos) {
|
if (pos == string::npos) {
|
||||||
sif::warning << "scratch::readNumber: Output file format invalid, "
|
sif::warning << "scratch::readNumber: Output file format invalid, "
|
||||||
"no \"=\" found" << std::endl;
|
"no \"=\" found"
|
||||||
|
<< std::endl;
|
||||||
// Could not find value
|
// Could not find value
|
||||||
std::remove(filename.c_str());
|
std::remove(filename.c_str());
|
||||||
return KEY_NOT_FOUND;
|
return KEY_NOT_FOUND;
|
||||||
@ -134,8 +133,7 @@ inline ReturnValue_t readNumber(std::string key, T& num) noexcept {
|
|||||||
std::string valueAsString = line.substr(pos + 1);
|
std::string valueAsString = line.substr(pos + 1);
|
||||||
try {
|
try {
|
||||||
num = std::stoi(valueAsString);
|
num = std::stoi(valueAsString);
|
||||||
}
|
} catch (std::invalid_argument& e) {
|
||||||
catch(std::invalid_argument& e) {
|
|
||||||
sif::warning << "scratch::readNumber: stoi call failed with " << e.what() << std::endl;
|
sif::warning << "scratch::readNumber: stoi call failed with " << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,6 +141,6 @@ inline ReturnValue_t readNumber(std::string key, T& num) noexcept {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace scratch
|
||||||
|
|
||||||
#endif /* BSP_Q7S_MEMORY_SCRATCHAPI_H_ */
|
#endif /* BSP_Q7S_MEMORY_SCRATCHAPI_H_ */
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "simple.h"
|
#include "simple.h"
|
||||||
|
|
||||||
#include "q7sConfig.h"
|
#include "q7sConfig.h"
|
||||||
|
|
||||||
#if Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST == 1
|
#if Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST == 1
|
||||||
@ -8,9 +9,7 @@
|
|||||||
int simple::simple() {
|
int simple::simple() {
|
||||||
cout << "-- Q7S Simple Application --" << endl;
|
cout << "-- Q7S Simple Application --" << endl;
|
||||||
#if Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST == 1
|
#if Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST == 1
|
||||||
{
|
{ FileSystemTest fileSystemTest; }
|
||||||
FileSystemTest fileSystemTest;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TE0720_GPIO_TEST
|
#if TE0720_GPIO_TEST
|
||||||
@ -18,4 +17,3 @@ int simple::simple() {
|
|||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
#include <bsp_q7s/spi/Q7sSpiComIF.h>
|
#include <bsp_q7s/spi/Q7sSpiComIF.h>
|
||||||
|
|
||||||
Q7sSpiComIF::Q7sSpiComIF(object_id_t objectId, GpioIF* gpioComIF) :
|
Q7sSpiComIF::Q7sSpiComIF(object_id_t objectId, GpioIF* gpioComIF) : SpiComIF(objectId, gpioComIF) {}
|
||||||
SpiComIF(objectId, gpioComIF) {
|
|
||||||
}
|
|
||||||
|
|
||||||
Q7sSpiComIF::~Q7sSpiComIF() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Q7sSpiComIF::~Q7sSpiComIF() {}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include <fsfw_hal/linux/spi/SpiComIF.h>
|
#include <fsfw_hal/linux/spi/SpiComIF.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This additional communication interface is required because the SPI busses behind the
|
* @brief This additional communication interface is required because the SPI busses behind the
|
||||||
* devices "/dev/spi2.0" and "dev/spidev3.0" are multiplexed to one SPI interface.
|
* devices "/dev/spi2.0" and "dev/spidev3.0" are multiplexed to one SPI interface.
|
||||||
|
@ -19,10 +19,13 @@ enum commonClassIds: uint8_t {
|
|||||||
CCSDS_IP_CORE_BRIDGE, //IPCI
|
CCSDS_IP_CORE_BRIDGE, //IPCI
|
||||||
PTME, //PTME
|
PTME, //PTME
|
||||||
PLOC_UPDATER, //PLUD
|
PLOC_UPDATER, //PLUD
|
||||||
|
STR_HELPER, //STRHLP
|
||||||
GOM_SPACE_HANDLER, //GOMS
|
GOM_SPACE_HANDLER, //GOMS
|
||||||
PLOC_MEMORY_DUMPER, //PLMEMDUMP
|
PLOC_MEMORY_DUMPER, //PLMEMDUMP
|
||||||
PDEC_HANDLER, //PDEC
|
PDEC_HANDLER, //PDEC
|
||||||
CCSDS_HANDLER, //PDEC
|
CCSDS_HANDLER, //CCSDS
|
||||||
|
ARCSEC_JSON_BASE, //JSONBASE
|
||||||
|
NVM_PARAM_BASE, //NVMB
|
||||||
COMMON_CLASS_ID_END // [EXPORT] : [END]
|
COMMON_CLASS_ID_END // [EXPORT] : [END]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -79,18 +79,18 @@ enum commonObjects: uint32_t {
|
|||||||
SUS_12 = 0x44120043,
|
SUS_12 = 0x44120043,
|
||||||
SUS_13 = 0x44120044,
|
SUS_13 = 0x44120044,
|
||||||
|
|
||||||
GPS0_HANDLER = 0x44130045,
|
GPS_CONTROLLER = 0x44130045,
|
||||||
GPS1_HANDLER = 0x44130146,
|
|
||||||
|
|
||||||
RW1 = 0x44120047,
|
RW1 = 0x44120047,
|
||||||
RW2 = 0x44120148,
|
RW2 = 0x44120148,
|
||||||
RW3 = 0x44120249,
|
RW3 = 0x44120249,
|
||||||
RW4 = 0x44120350,
|
RW4 = 0x44120350,
|
||||||
|
|
||||||
START_TRACKER = 0x44130001,
|
STAR_TRACKER = 0x44130001,
|
||||||
|
|
||||||
PLOC_UPDATER = 0x44330000,
|
PLOC_UPDATER = 0x44330000,
|
||||||
PLOC_MEMORY_DUMPER = 0x44330001
|
PLOC_MEMORY_DUMPER = 0x44330001,
|
||||||
|
STR_HELPER = 0x44330002
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ enum: uint8_t {
|
|||||||
PLOC_UPDATER = 117,
|
PLOC_UPDATER = 117,
|
||||||
PLOC_MEMORY_DUMPER = 118,
|
PLOC_MEMORY_DUMPER = 118,
|
||||||
PDEC_HANDLER = 119,
|
PDEC_HANDLER = 119,
|
||||||
|
STR_HELPER = 120,
|
||||||
COMMON_SUBSYSTEM_ID_END
|
COMMON_SUBSYSTEM_ID_END
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -12,15 +12,15 @@ namespace spi {
|
|||||||
|
|
||||||
// Default values, changing them is not supported for now
|
// Default values, changing them is not supported for now
|
||||||
static constexpr uint32_t DEFAULT_LIS3_SPEED = 976'000;
|
static constexpr uint32_t DEFAULT_LIS3_SPEED = 976'000;
|
||||||
static constexpr uint32_t LIS3_TRANSITION_DELAY = 10000;
|
static constexpr uint32_t LIS3_TRANSITION_DELAY = 5000;
|
||||||
static constexpr spi::SpiModes DEFAULT_LIS3_MODE = spi::SpiModes::MODE_3;
|
static constexpr spi::SpiModes DEFAULT_LIS3_MODE = spi::SpiModes::MODE_3;
|
||||||
|
|
||||||
static constexpr uint32_t DEFAULT_RM3100_SPEED = 976'000;
|
static constexpr uint32_t DEFAULT_RM3100_SPEED = 976'000;
|
||||||
static constexpr uint32_t RM3100_TRANSITION_DELAY = 10000;
|
static constexpr uint32_t RM3100_TRANSITION_DELAY = 5000;
|
||||||
static constexpr spi::SpiModes DEFAULT_RM3100_MODE = spi::SpiModes::MODE_3;
|
static constexpr spi::SpiModes DEFAULT_RM3100_MODE = spi::SpiModes::MODE_3;
|
||||||
|
|
||||||
static constexpr uint32_t DEFAULT_L3G_SPEED = 976'000;
|
static constexpr uint32_t DEFAULT_L3G_SPEED = 976'000;
|
||||||
static constexpr uint32_t L3G_TRANSITION_DELAY = 10000;
|
static constexpr uint32_t L3G_TRANSITION_DELAY = 5000;
|
||||||
static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3;
|
static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3;
|
||||||
|
|
||||||
static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 3'900'000;
|
static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 3'900'000;
|
||||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
|||||||
Subproject commit a45fb1bb1ff839c487581e1b787db966a1cf80cb
|
Subproject commit c1e0bcee6db652d6c474c87a4099e61ecf86b694
|
@ -1,120 +1,140 @@
|
|||||||
2200;STORE_SEND_WRITE_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
2200;STORE_SEND_WRITE_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||||
2201;STORE_WRITE_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
2201;STORE_WRITE_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||||
2202;STORE_SEND_READ_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
2202;STORE_SEND_READ_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||||
2203;STORE_READ_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
2203;STORE_READ_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||||
2204;UNEXPECTED_MSG;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
2204;UNEXPECTED_MSG;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||||
2205;STORING_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
2205;STORING_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||||
2206;TM_DUMP_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
2206;TM_DUMP_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||||
2207;STORE_INIT_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
2207;STORE_INIT_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||||
2208;STORE_INIT_EMPTY;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
2208;STORE_INIT_EMPTY;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||||
2209;STORE_CONTENT_CORRUPTED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
2209;STORE_CONTENT_CORRUPTED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||||
2210;STORE_INITIALIZE;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
2210;STORE_INITIALIZE;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||||
2211;INIT_DONE;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
2211;INIT_DONE;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||||
2212;DUMP_FINISHED;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
2212;DUMP_FINISHED;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||||
2213;DELETION_FINISHED;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
2213;DELETION_FINISHED;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||||
2214;DELETION_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
2214;DELETION_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||||
2215;AUTO_CATALOGS_SENDING_FAILED;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
2215;AUTO_CATALOGS_SENDING_FAILED;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||||
2600;GET_DATA_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/storagemanager/StorageManagerIF.h
|
2600;GET_DATA_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/storagemanager/StorageManagerIF.h
|
||||||
2601;STORE_DATA_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/storagemanager/StorageManagerIF.h
|
2601;STORE_DATA_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/storagemanager/StorageManagerIF.h
|
||||||
2800;DEVICE_BUILDING_COMMAND_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
2800;DEVICE_BUILDING_COMMAND_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||||
2801;DEVICE_SENDING_COMMAND_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
2801;DEVICE_SENDING_COMMAND_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||||
2802;DEVICE_REQUESTING_REPLY_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
2802;DEVICE_REQUESTING_REPLY_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||||
2803;DEVICE_READING_REPLY_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
2803;DEVICE_READING_REPLY_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||||
2804;DEVICE_INTERPRETING_REPLY_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
2804;DEVICE_INTERPRETING_REPLY_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||||
2805;DEVICE_MISSED_REPLY;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
2805;DEVICE_MISSED_REPLY;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||||
2806;DEVICE_UNKNOWN_REPLY;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
2806;DEVICE_UNKNOWN_REPLY;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||||
2807;DEVICE_UNREQUESTED_REPLY;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
2807;DEVICE_UNREQUESTED_REPLY;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||||
2808;INVALID_DEVICE_COMMAND;LOW;Indicates a SW bug in child class.;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
2808;INVALID_DEVICE_COMMAND;LOW;Indicates a SW bug in child class.;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||||
2809;MONITORING_LIMIT_EXCEEDED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
2809;MONITORING_LIMIT_EXCEEDED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||||
2810;MONITORING_AMBIGUOUS;HIGH;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
2810;MONITORING_AMBIGUOUS;HIGH;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||||
4201;FUSE_CURRENT_HIGH;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/power/Fuse.h
|
4201;FUSE_CURRENT_HIGH;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/power/Fuse.h
|
||||||
4202;FUSE_WENT_OFF;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/power/Fuse.h
|
4202;FUSE_WENT_OFF;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/power/Fuse.h
|
||||||
4204;POWER_ABOVE_HIGH_LIMIT;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/power/Fuse.h
|
4204;POWER_ABOVE_HIGH_LIMIT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/power/Fuse.h
|
||||||
4205;POWER_BELOW_LOW_LIMIT;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/power/Fuse.h
|
4205;POWER_BELOW_LOW_LIMIT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/power/Fuse.h
|
||||||
4300;SWITCH_WENT_OFF;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/power/PowerSwitchIF.h
|
4300;SWITCH_WENT_OFF;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/power/PowerSwitchIF.h
|
||||||
5000;HEATER_ON;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/Heater.h
|
5000;HEATER_ON;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h
|
||||||
5001;HEATER_OFF;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/Heater.h
|
5001;HEATER_OFF;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h
|
||||||
5002;HEATER_TIMEOUT;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/Heater.h
|
5002;HEATER_TIMEOUT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h
|
||||||
5003;HEATER_STAYED_ON;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/Heater.h
|
5003;HEATER_STAYED_ON;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h
|
||||||
5004;HEATER_STAYED_OFF;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/Heater.h
|
5004;HEATER_STAYED_OFF;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h
|
||||||
5200;TEMP_SENSOR_HIGH;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h
|
5200;TEMP_SENSOR_HIGH;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h
|
||||||
5201;TEMP_SENSOR_LOW;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h
|
5201;TEMP_SENSOR_LOW;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h
|
||||||
5202;TEMP_SENSOR_GRADIENT;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h
|
5202;TEMP_SENSOR_GRADIENT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h
|
||||||
5901;COMPONENT_TEMP_LOW;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
5901;COMPONENT_TEMP_LOW;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||||
5902;COMPONENT_TEMP_HIGH;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
5902;COMPONENT_TEMP_HIGH;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||||
5903;COMPONENT_TEMP_OOL_LOW;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
5903;COMPONENT_TEMP_OOL_LOW;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||||
5904;COMPONENT_TEMP_OOL_HIGH;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
5904;COMPONENT_TEMP_OOL_HIGH;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||||
5905;TEMP_NOT_IN_OP_RANGE;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
5905;TEMP_NOT_IN_OP_RANGE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||||
7101;FDIR_CHANGED_STATE;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h
|
7101;FDIR_CHANGED_STATE;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h
|
||||||
7102;FDIR_STARTS_RECOVERY;MEDIUM;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h
|
7102;FDIR_STARTS_RECOVERY;MEDIUM;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h
|
||||||
7103;FDIR_TURNS_OFF_DEVICE;MEDIUM;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h
|
7103;FDIR_TURNS_OFF_DEVICE;MEDIUM;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h
|
||||||
7201;MONITOR_CHANGED_STATE;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h
|
7201;MONITOR_CHANGED_STATE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h
|
||||||
7202;VALUE_BELOW_LOW_LIMIT;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h
|
7202;VALUE_BELOW_LOW_LIMIT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h
|
||||||
7203;VALUE_ABOVE_HIGH_LIMIT;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h
|
7203;VALUE_ABOVE_HIGH_LIMIT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h
|
||||||
7204;VALUE_OUT_OF_RANGE;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h
|
7204;VALUE_OUT_OF_RANGE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h
|
||||||
7301;SWITCHING_TM_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/datapool/HkSwitchHelper.h
|
7301;SWITCHING_TM_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datapool/HkSwitchHelper.h
|
||||||
7400;CHANGING_MODE;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
7400;CHANGING_MODE;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
||||||
7401;MODE_INFO;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
7401;MODE_INFO;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
||||||
7402;FALLBACK_FAILED;HIGH;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
7402;FALLBACK_FAILED;HIGH;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
||||||
7403;MODE_TRANSITION_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
7403;MODE_TRANSITION_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
||||||
7404;CANT_KEEP_MODE;HIGH;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
7404;CANT_KEEP_MODE;HIGH;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
||||||
7405;OBJECT_IN_INVALID_MODE;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
7405;OBJECT_IN_INVALID_MODE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
||||||
7406;FORCING_MODE;MEDIUM;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
7406;FORCING_MODE;MEDIUM;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
||||||
7407;MODE_CMD_REJECTED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
7407;MODE_CMD_REJECTED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
||||||
7506;HEALTH_INFO;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
7506;HEALTH_INFO;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
||||||
7507;CHILD_CHANGED_HEALTH;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
7507;CHILD_CHANGED_HEALTH;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
||||||
7508;CHILD_PROBLEMS;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
7508;CHILD_PROBLEMS;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
||||||
7509;OVERWRITING_HEALTH;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
7509;OVERWRITING_HEALTH;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
||||||
7510;TRYING_RECOVERY;MEDIUM;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
7510;TRYING_RECOVERY;MEDIUM;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
||||||
7511;RECOVERY_STEP;MEDIUM;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
7511;RECOVERY_STEP;MEDIUM;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
||||||
7512;RECOVERY_DONE;MEDIUM;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
7512;RECOVERY_DONE;MEDIUM;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
||||||
7900;RF_AVAILABLE;INFO;A RF available signal was detected. P1: raw RFA state, P2: 0;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
7900;RF_AVAILABLE;INFO;A RF available signal was detected. P1: raw RFA state, P2: 0;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||||
7901;RF_LOST;INFO;A previously found RF available signal was lost. P1: raw RFA state, P2: 0;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
7901;RF_LOST;INFO;A previously found RF available signal was lost. P1: raw RFA state, P2: 0;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||||
7902;BIT_LOCK;INFO;A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
7902;BIT_LOCK;INFO;A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||||
7903;BIT_LOCK_LOST;INFO;A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
7903;BIT_LOCK_LOST;INFO;A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||||
7905;FRAME_PROCESSING_FAILED;LOW;The CCSDS Board could not interpret a TC;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
7905;FRAME_PROCESSING_FAILED;LOW;The CCSDS Board could not interpret a TC;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||||
8900;CLOCK_SET;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/pus/Service9TimeManagement.h
|
8900;CLOCK_SET;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||||
8901;CLOCK_SET_FAILURE;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/pus/Service9TimeManagement.h
|
8901;CLOCK_SET_FAILURE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||||
9700;TEST;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/pus/Service17Test.h
|
9700;TEST;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/pus/Service17Test.h
|
||||||
10600;CHANGE_OF_SETUP_PARAMETER;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h
|
10600;CHANGE_OF_SETUP_PARAMETER;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h
|
||||||
10900;GPIO_PULL_HIGH_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/linux/devices/HeaterHandler.h
|
10900;GPIO_PULL_HIGH_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/HeaterHandler.h
|
||||||
10901;GPIO_PULL_LOW_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/linux/devices/HeaterHandler.h
|
10901;GPIO_PULL_LOW_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/HeaterHandler.h
|
||||||
10902;SWITCH_ALREADY_ON;LOW;;/home/eive/EIVE/Robin/eive-obsw/linux/devices/HeaterHandler.h
|
10902;SWITCH_ALREADY_ON;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/HeaterHandler.h
|
||||||
10903;SWITCH_ALREADY_OFF;LOW;;/home/eive/EIVE/Robin/eive-obsw/linux/devices/HeaterHandler.h
|
10903;SWITCH_ALREADY_OFF;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/HeaterHandler.h
|
||||||
10904;MAIN_SWITCH_TIMEOUT;LOW;;/home/eive/EIVE/Robin/eive-obsw/linux/devices/HeaterHandler.h
|
10904;MAIN_SWITCH_TIMEOUT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/HeaterHandler.h
|
||||||
11000;MAIN_SWITCH_ON_TIMEOUT;LOW;;/home/eive/EIVE/Robin/eive-obsw/linux/devices/SolarArrayDeploymentHandler.h
|
11000;MAIN_SWITCH_ON_TIMEOUT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/linux/devices/SolarArrayDeploymentHandler.h
|
||||||
11001;MAIN_SWITCH_OFF_TIMEOUT;LOW;;/home/eive/EIVE/Robin/eive-obsw/linux/devices/SolarArrayDeploymentHandler.h
|
11001;MAIN_SWITCH_OFF_TIMEOUT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/linux/devices/SolarArrayDeploymentHandler.h
|
||||||
11002;DEPLOYMENT_FAILED;HIGH;;/home/eive/EIVE/Robin/eive-obsw/linux/devices/SolarArrayDeploymentHandler.h
|
11002;DEPLOYMENT_FAILED;HIGH;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/linux/devices/SolarArrayDeploymentHandler.h
|
||||||
11003;DEPL_SA1_GPIO_SWTICH_ON_FAILED;HIGH;;/home/eive/EIVE/Robin/eive-obsw/linux/devices/SolarArrayDeploymentHandler.h
|
11003;DEPL_SA1_GPIO_SWTICH_ON_FAILED;HIGH;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/linux/devices/SolarArrayDeploymentHandler.h
|
||||||
11004;DEPL_SA2_GPIO_SWTICH_ON_FAILED;HIGH;;/home/eive/EIVE/Robin/eive-obsw/linux/devices/SolarArrayDeploymentHandler.h
|
11004;DEPL_SA2_GPIO_SWTICH_ON_FAILED;HIGH;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/linux/devices/SolarArrayDeploymentHandler.h
|
||||||
11101;MEMORY_READ_RPT_CRC_FAILURE;LOW;;/home/eive/EIVE/Robin/eive-obsw/mission/devices/PlocMPSoCHandler.h
|
11101;MEMORY_READ_RPT_CRC_FAILURE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocMPSoCHandler.h
|
||||||
11102;ACK_FAILURE;LOW;;/home/eive/EIVE/Robin/eive-obsw/mission/devices/PlocMPSoCHandler.h
|
11102;ACK_FAILURE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocMPSoCHandler.h
|
||||||
11103;EXE_FAILURE;LOW;;/home/eive/EIVE/Robin/eive-obsw/mission/devices/PlocMPSoCHandler.h
|
11103;EXE_FAILURE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocMPSoCHandler.h
|
||||||
11104;CRC_FAILURE_EVENT;LOW;;/home/eive/EIVE/Robin/eive-obsw/mission/devices/PlocMPSoCHandler.h
|
11104;CRC_FAILURE_EVENT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocMPSoCHandler.h
|
||||||
11201;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;/home/eive/EIVE/Robin/eive-obsw/mission/devices/IMTQHandler.h
|
11201;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h
|
||||||
11202;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;/home/eive/EIVE/Robin/eive-obsw/mission/devices/IMTQHandler.h
|
11202;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h
|
||||||
11203;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;/home/eive/EIVE/Robin/eive-obsw/mission/devices/IMTQHandler.h
|
11203;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h
|
||||||
11204;SELF_TEST_PWM_FAILURE;LOW;Get self test result returns PWM failure which concerns the coil actuation. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;/home/eive/EIVE/Robin/eive-obsw/mission/devices/IMTQHandler.h
|
11204;SELF_TEST_PWM_FAILURE;LOW;Get self test result returns PWM failure which concerns the coil actuation. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h
|
||||||
11205;SELF_TEST_TC_FAILURE;LOW;Get self test result returns TC failure (system failure) P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;/home/eive/EIVE/Robin/eive-obsw/mission/devices/IMTQHandler.h
|
11205;SELF_TEST_TC_FAILURE;LOW;Get self test result returns TC failure (system failure) P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h
|
||||||
11206;SELF_TEST_MTM_RANGE_FAILURE;LOW;Get self test result returns failure that MTM values were outside of the expected range. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;/home/eive/EIVE/Robin/eive-obsw/mission/devices/IMTQHandler.h
|
11206;SELF_TEST_MTM_RANGE_FAILURE;LOW;Get self test result returns failure that MTM values were outside of the expected range. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h
|
||||||
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;/home/eive/EIVE/Robin/eive-obsw/mission/devices/IMTQHandler.h
|
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\OneDrive\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.;/home/eive/EIVE/Robin/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\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h
|
||||||
11301;ERROR_STATE;HIGH;Reaction wheel signals an error state;/home/eive/EIVE/Robin/eive-obsw/mission/devices/RwHandler.h
|
11301;ERROR_STATE;HIGH;Reaction wheel signals an error state;C:\Users\jakob\OneDrive\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;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocSupervisorHandler.h
|
11501;SUPV_MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC supervisor crc failure in telemetry packet;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h
|
||||||
11502;SUPV_ACK_FAILURE;LOW;PLOC supervisor received acknowledgment failure report;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocSupervisorHandler.h
|
11502;SUPV_ACK_FAILURE;LOW;PLOC supervisor received acknowledgment failure report;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h
|
||||||
11503;SUPV_EXE_FAILURE;LOW;PLOC received execution failure report;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocSupervisorHandler.h
|
11503;SUPV_EXE_FAILURE;LOW;PLOC received execution failure report;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h
|
||||||
11504;SUPV_CRC_FAILURE_EVENT;LOW;PLOC supervisor reply has invalid crc;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocSupervisorHandler.h
|
11504;SUPV_CRC_FAILURE_EVENT;LOW;PLOC supervisor reply has invalid crc;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h
|
||||||
11600;SANITIZATION_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/memory/SdCardManager.h
|
11600;SANITIZATION_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/memory/SdCardManager.h
|
||||||
11700;UPDATE_FILE_NOT_EXISTS;LOW;;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocUpdater.h
|
11700;UPDATE_FILE_NOT_EXISTS;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
|
||||||
11701;ACTION_COMMANDING_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocUpdater.h
|
11701;ACTION_COMMANDING_FAILED;LOW;;C:\Users\jakob\OneDrive\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;/home/eive/EIVE/Robin/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\OneDrive\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);/home/eive/EIVE/Robin/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\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
|
||||||
11704;UPDATE_VERIFY_FAILED;LOW;Supervisor failed to execute the update verify command.;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocUpdater.h
|
11704;UPDATE_VERIFY_FAILED;LOW;Supervisor failed to execute the update verify command.;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
|
||||||
11705;UPDATE_FINISHED;INFO;MPSoC update successful completed;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocUpdater.h
|
11705;UPDATE_FINISHED;INFO;MPSoC update successful completed;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
|
||||||
11800;SEND_MRAM_DUMP_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocMemoryDumper.h
|
11800;SEND_MRAM_DUMP_FAILED;LOW;;C:\Users\jakob\OneDrive\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;/home/eive/EIVE/Robin/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\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocMemoryDumper.h
|
||||||
11802;MRAM_DUMP_FINISHED;LOW;MRAM dump finished successfully;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocMemoryDumper.h
|
11802;MRAM_DUMP_FINISHED;LOW;MRAM dump finished successfully;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocMemoryDumper.h
|
||||||
11901;INVALID_TC_FRAME;HIGH;;/home/eive/EIVE/Robin/eive-obsw/linux/obc/PdecHandler.h
|
11901;INVALID_TC_FRAME;HIGH;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/linux/obc/PdecHandler.h
|
||||||
11902;INVALID_FAR;HIGH;Read invalid FAR from PDEC after startup;/home/eive/EIVE/Robin/eive-obsw/linux/obc/PdecHandler.h
|
11902;INVALID_FAR;HIGH;Read invalid FAR from PDEC after startup;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/linux/obc/PdecHandler.h
|
||||||
11903;CARRIER_LOCK;INFO;Carrier lock detected;/home/eive/EIVE/Robin/eive-obsw/linux/obc/PdecHandler.h
|
11903;CARRIER_LOCK;INFO;Carrier lock detected;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/linux/obc/PdecHandler.h
|
||||||
11904;BIT_LOCK_PDEC;INFO;Bit lock detected (data valid);/home/eive/EIVE/Robin/eive-obsw/linux/obc/PdecHandler.h
|
11904;BIT_LOCK_PDEC;INFO;Bit lock detected (data valid);C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/linux/obc/PdecHandler.h
|
||||||
|
12000;IMAGE_UPLOAD_FAILED;LOW;Image upload failed;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/startracker/StrHelper.h
|
||||||
|
12001;IMAGE_DOWNLOAD_FAILED;LOW;Image download failed;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/startracker/StrHelper.h
|
||||||
|
12002;IMAGE_UPLOAD_SUCCESSFUL;LOW;Uploading image to star tracker was successfulop;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/startracker/StrHelper.h
|
||||||
|
12003;IMAGE_DOWNLOAD_SUCCESSFUL;LOW;Image download was successful;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/startracker/StrHelper.h
|
||||||
|
12004;FLASH_WRITE_SUCCESSFUL;LOW;Finished flash write procedure successfully;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/startracker/StrHelper.h
|
||||||
|
12005;FLASH_READ_SUCCESSFUL;LOW;Finished flash read procedure successfully;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/startracker/StrHelper.h
|
||||||
|
12006;FLASH_WRITE_FAILED;LOW;Flash write procedure failed;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/startracker/StrHelper.h
|
||||||
|
12007;FLASH_READ_FAILED;LOW;Flash read procedure failed;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/startracker/StrHelper.h
|
||||||
|
12008;FPGA_DOWNLOAD_SUCCESSFUL;LOW;Download of FPGA image successful;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/startracker/StrHelper.h
|
||||||
|
12009;FPGA_DOWNLOAD_FAILED;LOW;Download of FPGA image failed;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/startracker/StrHelper.h
|
||||||
|
12010;FPGA_UPLOAD_SUCCESSFUL;LOW;Upload of FPGA image successful;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/startracker/StrHelper.h
|
||||||
|
12011;FPGA_UPLOAD_FAILED;LOW;Upload of FPGA image failed;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/startracker/StrHelper.h
|
||||||
|
12012;STR_HELPER_READING_REPLY_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/startracker/StrHelper.h
|
||||||
|
12013;STR_HELPER_COM_ERROR;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/startracker/StrHelper.h
|
||||||
|
12014;STR_HELPER_NO_REPLY;LOW;Star tracker did not send replies (maybe device is powered off)P1: Position of upload or download packet for which no reply was sent;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/startracker/StrHelper.h
|
||||||
|
12015;STR_HELPER_DEC_ERROR;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/startracker/StrHelper.h
|
||||||
|
12016;POSITION_MISMATCH;LOW;Position mismatch P1: The expected position and thus the position for which the image upload/download failed;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/startracker/StrHelper.h
|
||||||
|
12017;STR_HELPER_FILE_NOT_EXISTS;LOW;Specified file does not existP1: Internal state of str helper;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/startracker/StrHelper.h
|
||||||
|
12018;STR_HELPER_SENDING_PACKET_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/startracker/StrHelper.h
|
||||||
|
12019;STR_HELPER_REQUESTING_MSG_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/startracker/StrHelper.h
|
||||||
|
|
@ -27,7 +27,7 @@
|
|||||||
0x44120309;MGM_3_RM3100_HANDLER
|
0x44120309;MGM_3_RM3100_HANDLER
|
||||||
0x44120313;GYRO_3_L3G_HANDLER
|
0x44120313;GYRO_3_L3G_HANDLER
|
||||||
0x44120350;RW4
|
0x44120350;RW4
|
||||||
0x44130001;START_TRACKER
|
0x44130001;STAR_TRACKER
|
||||||
0x44130045;GPS0_HANDLER
|
0x44130045;GPS0_HANDLER
|
||||||
0x44130146;GPS1_HANDLER
|
0x44130146;GPS1_HANDLER
|
||||||
0x44140014;IMTQ_HANDLER
|
0x44140014;IMTQ_HANDLER
|
||||||
@ -39,6 +39,7 @@
|
|||||||
0x443200A5;RAD_SENSOR
|
0x443200A5;RAD_SENSOR
|
||||||
0x44330000;PLOC_UPDATER
|
0x44330000;PLOC_UPDATER
|
||||||
0x44330001;PLOC_MEMORY_DUMPER
|
0x44330001;PLOC_MEMORY_DUMPER
|
||||||
|
0x44330002;STR_HELPER
|
||||||
0x44330015;PLOC_MPSOC_HANDLER
|
0x44330015;PLOC_MPSOC_HANDLER
|
||||||
0x44330016;PLOC_SUPERVISOR_HANDLER
|
0x44330016;PLOC_SUPERVISOR_HANDLER
|
||||||
0x444100A2;SOLAR_ARRAY_DEPL_HANDLER
|
0x444100A2;SOLAR_ARRAY_DEPL_HANDLER
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @brief Auto-generated event translation file. Contains 120 translations.
|
* @brief Auto-generated event translation file. Contains 140 translations.
|
||||||
* @details
|
* @details
|
||||||
* Generated on: 2021-11-25 14:09:00
|
* Generated on: 2021-12-29 20:24:08
|
||||||
*/
|
*/
|
||||||
#include "translateEvents.h"
|
#include "translateEvents.h"
|
||||||
|
|
||||||
@ -125,6 +125,26 @@ const char *INVALID_TC_FRAME_STRING = "INVALID_TC_FRAME";
|
|||||||
const char *INVALID_FAR_STRING = "INVALID_FAR";
|
const char *INVALID_FAR_STRING = "INVALID_FAR";
|
||||||
const char *CARRIER_LOCK_STRING = "CARRIER_LOCK";
|
const char *CARRIER_LOCK_STRING = "CARRIER_LOCK";
|
||||||
const char *BIT_LOCK_PDEC_STRING = "BIT_LOCK_PDEC";
|
const char *BIT_LOCK_PDEC_STRING = "BIT_LOCK_PDEC";
|
||||||
|
const char *IMAGE_UPLOAD_FAILED_STRING = "IMAGE_UPLOAD_FAILED";
|
||||||
|
const char *IMAGE_DOWNLOAD_FAILED_STRING = "IMAGE_DOWNLOAD_FAILED";
|
||||||
|
const char *IMAGE_UPLOAD_SUCCESSFUL_STRING = "IMAGE_UPLOAD_SUCCESSFUL";
|
||||||
|
const char *IMAGE_DOWNLOAD_SUCCESSFUL_STRING = "IMAGE_DOWNLOAD_SUCCESSFUL";
|
||||||
|
const char *FLASH_WRITE_SUCCESSFUL_STRING = "FLASH_WRITE_SUCCESSFUL";
|
||||||
|
const char *FLASH_READ_SUCCESSFUL_STRING = "FLASH_READ_SUCCESSFUL";
|
||||||
|
const char *FLASH_WRITE_FAILED_STRING = "FLASH_WRITE_FAILED";
|
||||||
|
const char *FLASH_READ_FAILED_STRING = "FLASH_READ_FAILED";
|
||||||
|
const char *FPGA_DOWNLOAD_SUCCESSFUL_STRING = "FPGA_DOWNLOAD_SUCCESSFUL";
|
||||||
|
const char *FPGA_DOWNLOAD_FAILED_STRING = "FPGA_DOWNLOAD_FAILED";
|
||||||
|
const char *FPGA_UPLOAD_SUCCESSFUL_STRING = "FPGA_UPLOAD_SUCCESSFUL";
|
||||||
|
const char *FPGA_UPLOAD_FAILED_STRING = "FPGA_UPLOAD_FAILED";
|
||||||
|
const char *STR_HELPER_READING_REPLY_FAILED_STRING = "STR_HELPER_READING_REPLY_FAILED";
|
||||||
|
const char *STR_HELPER_COM_ERROR_STRING = "STR_HELPER_COM_ERROR";
|
||||||
|
const char *STR_HELPER_NO_REPLY_STRING = "STR_HELPER_NO_REPLY";
|
||||||
|
const char *STR_HELPER_DEC_ERROR_STRING = "STR_HELPER_DEC_ERROR";
|
||||||
|
const char *POSITION_MISMATCH_STRING = "POSITION_MISMATCH";
|
||||||
|
const char *STR_HELPER_FILE_NOT_EXISTS_STRING = "STR_HELPER_FILE_NOT_EXISTS";
|
||||||
|
const char *STR_HELPER_SENDING_PACKET_FAILED_STRING = "STR_HELPER_SENDING_PACKET_FAILED";
|
||||||
|
const char *STR_HELPER_REQUESTING_MSG_FAILED_STRING = "STR_HELPER_REQUESTING_MSG_FAILED";
|
||||||
|
|
||||||
const char * translateEvents(Event event) {
|
const char * translateEvents(Event event) {
|
||||||
switch( (event & 0xffff) ) {
|
switch( (event & 0xffff) ) {
|
||||||
@ -368,6 +388,46 @@ const char * translateEvents(Event event) {
|
|||||||
return CARRIER_LOCK_STRING;
|
return CARRIER_LOCK_STRING;
|
||||||
case(11904):
|
case(11904):
|
||||||
return BIT_LOCK_PDEC_STRING;
|
return BIT_LOCK_PDEC_STRING;
|
||||||
|
case(12000):
|
||||||
|
return IMAGE_UPLOAD_FAILED_STRING;
|
||||||
|
case(12001):
|
||||||
|
return IMAGE_DOWNLOAD_FAILED_STRING;
|
||||||
|
case(12002):
|
||||||
|
return IMAGE_UPLOAD_SUCCESSFUL_STRING;
|
||||||
|
case(12003):
|
||||||
|
return IMAGE_DOWNLOAD_SUCCESSFUL_STRING;
|
||||||
|
case(12004):
|
||||||
|
return FLASH_WRITE_SUCCESSFUL_STRING;
|
||||||
|
case(12005):
|
||||||
|
return FLASH_READ_SUCCESSFUL_STRING;
|
||||||
|
case(12006):
|
||||||
|
return FLASH_WRITE_FAILED_STRING;
|
||||||
|
case(12007):
|
||||||
|
return FLASH_READ_FAILED_STRING;
|
||||||
|
case(12008):
|
||||||
|
return FPGA_DOWNLOAD_SUCCESSFUL_STRING;
|
||||||
|
case(12009):
|
||||||
|
return FPGA_DOWNLOAD_FAILED_STRING;
|
||||||
|
case(12010):
|
||||||
|
return FPGA_UPLOAD_SUCCESSFUL_STRING;
|
||||||
|
case(12011):
|
||||||
|
return FPGA_UPLOAD_FAILED_STRING;
|
||||||
|
case(12012):
|
||||||
|
return STR_HELPER_READING_REPLY_FAILED_STRING;
|
||||||
|
case(12013):
|
||||||
|
return STR_HELPER_COM_ERROR_STRING;
|
||||||
|
case(12014):
|
||||||
|
return STR_HELPER_NO_REPLY_STRING;
|
||||||
|
case(12015):
|
||||||
|
return STR_HELPER_DEC_ERROR_STRING;
|
||||||
|
case(12016):
|
||||||
|
return POSITION_MISMATCH_STRING;
|
||||||
|
case(12017):
|
||||||
|
return STR_HELPER_FILE_NOT_EXISTS_STRING;
|
||||||
|
case(12018):
|
||||||
|
return STR_HELPER_SENDING_PACKET_FAILED_STRING;
|
||||||
|
case(12019):
|
||||||
|
return STR_HELPER_REQUESTING_MSG_FAILED_STRING;
|
||||||
default:
|
default:
|
||||||
return "UNKNOWN_EVENT";
|
return "UNKNOWN_EVENT";
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* @brief Auto-generated object translation file.
|
* @brief Auto-generated object translation file.
|
||||||
* @details
|
* @details
|
||||||
* Contains 112 translations.
|
* Contains 113 translations.
|
||||||
* Generated on: 2021-11-22 17:04:51
|
* Generated on: 2021-12-21 17:21:23
|
||||||
*/
|
*/
|
||||||
#include "translateObjects.h"
|
#include "translateObjects.h"
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ const char *RW3_STRING = "RW3";
|
|||||||
const char *MGM_3_RM3100_HANDLER_STRING = "MGM_3_RM3100_HANDLER";
|
const char *MGM_3_RM3100_HANDLER_STRING = "MGM_3_RM3100_HANDLER";
|
||||||
const char *GYRO_3_L3G_HANDLER_STRING = "GYRO_3_L3G_HANDLER";
|
const char *GYRO_3_L3G_HANDLER_STRING = "GYRO_3_L3G_HANDLER";
|
||||||
const char *RW4_STRING = "RW4";
|
const char *RW4_STRING = "RW4";
|
||||||
const char *START_TRACKER_STRING = "START_TRACKER";
|
const char *STAR_TRACKER_STRING = "STAR_TRACKER";
|
||||||
const char *GPS0_HANDLER_STRING = "GPS0_HANDLER";
|
const char *GPS0_HANDLER_STRING = "GPS0_HANDLER";
|
||||||
const char *GPS1_HANDLER_STRING = "GPS1_HANDLER";
|
const char *GPS1_HANDLER_STRING = "GPS1_HANDLER";
|
||||||
const char *IMTQ_HANDLER_STRING = "IMTQ_HANDLER";
|
const char *IMTQ_HANDLER_STRING = "IMTQ_HANDLER";
|
||||||
@ -47,6 +47,7 @@ const char *ACU_HANDLER_STRING = "ACU_HANDLER";
|
|||||||
const char *RAD_SENSOR_STRING = "RAD_SENSOR";
|
const char *RAD_SENSOR_STRING = "RAD_SENSOR";
|
||||||
const char *PLOC_UPDATER_STRING = "PLOC_UPDATER";
|
const char *PLOC_UPDATER_STRING = "PLOC_UPDATER";
|
||||||
const char *PLOC_MEMORY_DUMPER_STRING = "PLOC_MEMORY_DUMPER";
|
const char *PLOC_MEMORY_DUMPER_STRING = "PLOC_MEMORY_DUMPER";
|
||||||
|
const char *STR_HELPER_STRING = "STR_HELPER";
|
||||||
const char *PLOC_MPSOC_HANDLER_STRING = "PLOC_MPSOC_HANDLER";
|
const char *PLOC_MPSOC_HANDLER_STRING = "PLOC_MPSOC_HANDLER";
|
||||||
const char *PLOC_SUPERVISOR_HANDLER_STRING = "PLOC_SUPERVISOR_HANDLER";
|
const char *PLOC_SUPERVISOR_HANDLER_STRING = "PLOC_SUPERVISOR_HANDLER";
|
||||||
const char *SOLAR_ARRAY_DEPL_HANDLER_STRING = "SOLAR_ARRAY_DEPL_HANDLER";
|
const char *SOLAR_ARRAY_DEPL_HANDLER_STRING = "SOLAR_ARRAY_DEPL_HANDLER";
|
||||||
@ -180,7 +181,7 @@ const char* translateObject(object_id_t object) {
|
|||||||
case 0x44120350:
|
case 0x44120350:
|
||||||
return RW4_STRING;
|
return RW4_STRING;
|
||||||
case 0x44130001:
|
case 0x44130001:
|
||||||
return START_TRACKER_STRING;
|
return STAR_TRACKER_STRING;
|
||||||
case 0x44130045:
|
case 0x44130045:
|
||||||
return GPS0_HANDLER_STRING;
|
return GPS0_HANDLER_STRING;
|
||||||
case 0x44130146:
|
case 0x44130146:
|
||||||
@ -203,6 +204,8 @@ const char* translateObject(object_id_t object) {
|
|||||||
return PLOC_UPDATER_STRING;
|
return PLOC_UPDATER_STRING;
|
||||||
case 0x44330001:
|
case 0x44330001:
|
||||||
return PLOC_MEMORY_DUMPER_STRING;
|
return PLOC_MEMORY_DUMPER_STRING;
|
||||||
|
case 0x44330002:
|
||||||
|
return STR_HELPER_STRING;
|
||||||
case 0x44330015:
|
case 0x44330015:
|
||||||
return PLOC_MPSOC_HANDLER_STRING;
|
return PLOC_MPSOC_HANDLER_STRING;
|
||||||
case 0x44330016:
|
case 0x44330016:
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "GpioCookie.h"
|
#include "GpioCookie.h"
|
||||||
|
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
|
||||||
GpioCookie::GpioCookie() {
|
GpioCookie::GpioCookie() {}
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t GpioCookie::addGpio(gpioId_t gpioId, GpioBase* gpioConfig) {
|
ReturnValue_t GpioCookie::addGpio(gpioId_t gpioId, GpioBase* gpioConfig) {
|
||||||
if (gpioConfig == nullptr) {
|
if (gpioConfig == nullptr) {
|
||||||
@ -14,8 +14,8 @@ ReturnValue_t GpioCookie::addGpio(gpioId_t gpioId, GpioBase* gpioConfig){
|
|||||||
auto statusPair = gpioMap.emplace(gpioId, gpioConfig);
|
auto statusPair = gpioMap.emplace(gpioId, gpioConfig);
|
||||||
if (statusPair.second == false) {
|
if (statusPair.second == false) {
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
sif::error << "GpioCookie::addGpio: Failed to add GPIO " << gpioId <<
|
sif::error << "GpioCookie::addGpio: Failed to add GPIO " << gpioId << " to GPIO map"
|
||||||
" to GPIO map" << std::endl;
|
<< std::endl;
|
||||||
#endif
|
#endif
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
@ -27,8 +27,6 @@ ReturnValue_t GpioCookie::addGpio(gpioId_t gpioId, GpioBase* gpioConfig){
|
|||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
GpioMap GpioCookie::getGpioMap() const {
|
GpioMap GpioCookie::getGpioMap() const { return gpioMap; }
|
||||||
return gpioMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
GpioCookie::~GpioCookie() {}
|
GpioCookie::~GpioCookie() {}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
#ifndef LINUX_GPIO_GPIOCOOKIE_H_
|
#ifndef LINUX_GPIO_GPIOCOOKIE_H_
|
||||||
#define LINUX_GPIO_GPIOCOOKIE_H_
|
#define LINUX_GPIO_GPIOCOOKIE_H_
|
||||||
|
|
||||||
#include "GpioIF.h"
|
|
||||||
#include "gpioDefinitions.h"
|
|
||||||
#include <fsfw/devicehandlers/CookieIF.h>
|
#include <fsfw/devicehandlers/CookieIF.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
|
|
||||||
|
#include "GpioIF.h"
|
||||||
|
#include "gpioDefinitions.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Cookie for the GpioIF. Allows the GpioIF to determine which
|
* @brief Cookie for the GpioIF. Allows the GpioIF to determine which
|
||||||
* GPIOs to initialize and whether they should be configured as in- or
|
* GPIOs to initialize and whether they should be configured as in- or
|
||||||
@ -18,7 +19,6 @@
|
|||||||
*/
|
*/
|
||||||
class GpioCookie : public CookieIF {
|
class GpioCookie : public CookieIF {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
GpioCookie();
|
GpioCookie();
|
||||||
|
|
||||||
virtual ~GpioCookie();
|
virtual ~GpioCookie();
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#ifndef LINUX_GPIO_GPIOIF_H_
|
#ifndef LINUX_GPIO_GPIOIF_H_
|
||||||
#define LINUX_GPIO_GPIOIF_H_
|
#define LINUX_GPIO_GPIOIF_H_
|
||||||
|
|
||||||
#include "gpioDefinitions.h"
|
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
|
||||||
#include <fsfw/devicehandlers/CookieIF.h>
|
#include <fsfw/devicehandlers/CookieIF.h>
|
||||||
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
|
|
||||||
|
#include "gpioDefinitions.h"
|
||||||
|
|
||||||
class GpioCookie;
|
class GpioCookie;
|
||||||
|
|
||||||
@ -14,7 +15,6 @@ class GpioCookie;
|
|||||||
*/
|
*/
|
||||||
class GpioIF : public HasReturnvaluesIF {
|
class GpioIF : public HasReturnvaluesIF {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual ~GpioIF(){};
|
virtual ~GpioIF(){};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#include "LinuxLibgpioIF.h"
|
#include "LinuxLibgpioIF.h"
|
||||||
#include "GpioCookie.h"
|
|
||||||
|
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
#include <gpiod.h>
|
||||||
#include <linux/gpio/gpioDefinitions.h>
|
#include <linux/gpio/gpioDefinitions.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <unistd.h>
|
|
||||||
#include <gpiod.h>
|
|
||||||
|
|
||||||
|
#include "GpioCookie.h"
|
||||||
|
|
||||||
LinuxLibgpioIF::LinuxLibgpioIF(object_id_t objectId) : SystemObject(objectId) {
|
LinuxLibgpioIF::LinuxLibgpioIF(object_id_t objectId) : SystemObject(objectId) {
|
||||||
struct gpiod_chip* chip = gpiod_chip_open_by_label("/amba_pl/gpio@42030000");
|
struct gpiod_chip* chip = gpiod_chip_open_by_label("/amba_pl/gpio@42030000");
|
||||||
@ -15,8 +15,7 @@ LinuxLibgpioIF::LinuxLibgpioIF(object_id_t objectId) : SystemObject(objectId) {
|
|||||||
sif::debug << chip->name << std::endl;
|
sif::debug << chip->name << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
LinuxLibgpioIF::~LinuxLibgpioIF() {
|
LinuxLibgpioIF::~LinuxLibgpioIF() {}
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t LinuxLibgpioIF::addGpios(GpioCookie* gpioCookie) {
|
ReturnValue_t LinuxLibgpioIF::addGpios(GpioCookie* gpioCookie) {
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
@ -83,16 +82,16 @@ ReturnValue_t LinuxLibgpioIF::configureRegularGpio(gpioId_t gpioId, GpiodRegular
|
|||||||
chipname = regularGpio->chipname;
|
chipname = regularGpio->chipname;
|
||||||
chip = gpiod_chip_open_by_name(chipname.c_str());
|
chip = gpiod_chip_open_by_name(chipname.c_str());
|
||||||
if (!chip) {
|
if (!chip) {
|
||||||
sif::error << "LinuxLibgpioIF::configureGpios: Failed to open chip "
|
sif::error << "LinuxLibgpioIF::configureGpios: Failed to open chip " << chipname
|
||||||
<< chipname << ". Gpio ID: " << gpioId << std::endl;
|
<< ". Gpio ID: " << gpioId << std::endl;
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
lineNum = regularGpio->lineNum;
|
lineNum = regularGpio->lineNum;
|
||||||
lineHandle = gpiod_chip_get_line(chip, lineNum);
|
lineHandle = gpiod_chip_get_line(chip, lineNum);
|
||||||
if (!lineHandle) {
|
if (!lineHandle) {
|
||||||
sif::error << "LinuxLibgpioIF::configureGpios: Failed to open line for GPIO with id "
|
sif::error << "LinuxLibgpioIF::configureGpios: Failed to open line for GPIO with id " << gpioId
|
||||||
<< gpioId << std::endl;
|
<< std::endl;
|
||||||
gpiod_chip_close(chip);
|
gpiod_chip_close(chip);
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
@ -102,11 +101,10 @@ ReturnValue_t LinuxLibgpioIF::configureRegularGpio(gpioId_t gpioId, GpiodRegular
|
|||||||
/* Configure direction and add a description to the GPIO */
|
/* Configure direction and add a description to the GPIO */
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case (gpio::OUT): {
|
case (gpio::OUT): {
|
||||||
result = gpiod_line_request_output(lineHandle, consumer.c_str(),
|
result = gpiod_line_request_output(lineHandle, consumer.c_str(), regularGpio->initValue);
|
||||||
regularGpio->initValue);
|
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
sif::error << "LinuxLibgpioIF::configureGpios: Failed to request line " << lineNum <<
|
sif::error << "LinuxLibgpioIF::configureGpios: Failed to request line " << lineNum
|
||||||
" from GPIO instance with ID: " << gpioId << std::endl;
|
<< " from GPIO instance with ID: " << gpioId << std::endl;
|
||||||
gpiod_line_release(lineHandle);
|
gpiod_line_release(lineHandle);
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
@ -115,19 +113,17 @@ ReturnValue_t LinuxLibgpioIF::configureRegularGpio(gpioId_t gpioId, GpiodRegular
|
|||||||
case (gpio::IN): {
|
case (gpio::IN): {
|
||||||
result = gpiod_line_request_input(lineHandle, consumer.c_str());
|
result = gpiod_line_request_input(lineHandle, consumer.c_str());
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
sif::error << "LinuxLibgpioIF::configureGpios: Failed to request line "
|
sif::error << "LinuxLibgpioIF::configureGpios: Failed to request line " << lineNum
|
||||||
<< lineNum << " from GPIO instance with ID: " << gpioId << std::endl;
|
<< " from GPIO instance with ID: " << gpioId << std::endl;
|
||||||
gpiod_line_release(lineHandle);
|
gpiod_line_release(lineHandle);
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
sif::error << "LinuxLibgpioIF::configureGpios: Invalid direction specified"
|
sif::error << "LinuxLibgpioIF::configureGpios: Invalid direction specified" << std::endl;
|
||||||
<< std::endl;
|
|
||||||
return GPIO_INVALID_INSTANCE;
|
return GPIO_INVALID_INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Write line handle to GPIO configuration instance so it can later be used to set or
|
* Write line handle to GPIO configuration instance so it can later be used to set or
|
||||||
@ -146,14 +142,13 @@ ReturnValue_t LinuxLibgpioIF::pullHigh(gpioId_t gpioId) {
|
|||||||
|
|
||||||
if (gpioMapIter->second->gpioType == gpio::GpioTypes::GPIOD_REGULAR) {
|
if (gpioMapIter->second->gpioType == gpio::GpioTypes::GPIOD_REGULAR) {
|
||||||
return driveGpio(gpioId, dynamic_cast<GpiodRegular*>(gpioMapIter->second), 1);
|
return driveGpio(gpioId, dynamic_cast<GpiodRegular*>(gpioMapIter->second), 1);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
auto gpioCallback = dynamic_cast<GpioCallback*>(gpioMapIter->second);
|
auto gpioCallback = dynamic_cast<GpioCallback*>(gpioMapIter->second);
|
||||||
if (gpioCallback->callback == nullptr) {
|
if (gpioCallback->callback == nullptr) {
|
||||||
return GPIO_INVALID_INSTANCE;
|
return GPIO_INVALID_INSTANCE;
|
||||||
}
|
}
|
||||||
gpioCallback->callback(gpioMapIter->first, gpio::GpioOperation::WRITE,
|
gpioCallback->callback(gpioMapIter->first, gpio::GpioOperation::WRITE, 1,
|
||||||
1, gpioCallback->callbackArgs);
|
gpioCallback->callbackArgs);
|
||||||
}
|
}
|
||||||
return GPIO_TYPE_FAILURE;
|
return GPIO_TYPE_FAILURE;
|
||||||
}
|
}
|
||||||
@ -167,28 +162,27 @@ ReturnValue_t LinuxLibgpioIF::pullLow(gpioId_t gpioId) {
|
|||||||
|
|
||||||
if (gpioMapIter->second->gpioType == gpio::GpioTypes::GPIOD_REGULAR) {
|
if (gpioMapIter->second->gpioType == gpio::GpioTypes::GPIOD_REGULAR) {
|
||||||
return driveGpio(gpioId, dynamic_cast<GpiodRegular*>(gpioMapIter->second), 0);
|
return driveGpio(gpioId, dynamic_cast<GpiodRegular*>(gpioMapIter->second), 0);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
auto gpioCallback = dynamic_cast<GpioCallback*>(gpioMapIter->second);
|
auto gpioCallback = dynamic_cast<GpioCallback*>(gpioMapIter->second);
|
||||||
if (gpioCallback->callback == nullptr) {
|
if (gpioCallback->callback == nullptr) {
|
||||||
return GPIO_INVALID_INSTANCE;
|
return GPIO_INVALID_INSTANCE;
|
||||||
}
|
}
|
||||||
gpioCallback->callback(gpioMapIter->first, gpio::GpioOperation::WRITE,
|
gpioCallback->callback(gpioMapIter->first, gpio::GpioOperation::WRITE, 0,
|
||||||
0, gpioCallback->callbackArgs);
|
gpioCallback->callbackArgs);
|
||||||
}
|
}
|
||||||
return GPIO_TYPE_FAILURE;
|
return GPIO_TYPE_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t LinuxLibgpioIF::driveGpio(gpioId_t gpioId,
|
ReturnValue_t LinuxLibgpioIF::driveGpio(gpioId_t gpioId, GpiodRegular* regularGpio,
|
||||||
GpiodRegular* regularGpio, unsigned int logicLevel) {
|
unsigned int logicLevel) {
|
||||||
if (regularGpio == nullptr) {
|
if (regularGpio == nullptr) {
|
||||||
return GPIO_TYPE_FAILURE;
|
return GPIO_TYPE_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int result = gpiod_line_set_value(regularGpio->lineHandle, logicLevel);
|
int result = gpiod_line_set_value(regularGpio->lineHandle, logicLevel);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
sif::warning << "LinuxLibgpioIF::driveGpio: Failed to pull GPIO with ID " << gpioId <<
|
sif::warning << "LinuxLibgpioIF::driveGpio: Failed to pull GPIO with ID " << gpioId
|
||||||
" to logic level " << logicLevel << std::endl;
|
<< " to logic level " << logicLevel << std::endl;
|
||||||
return DRIVE_GPIO_FAILURE;
|
return DRIVE_GPIO_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,11 +202,8 @@ ReturnValue_t LinuxLibgpioIF::readGpio(gpioId_t gpioId, int* gpioState) {
|
|||||||
return GPIO_TYPE_FAILURE;
|
return GPIO_TYPE_FAILURE;
|
||||||
}
|
}
|
||||||
*gpioState = gpiod_line_get_value(regularGpio->lineHandle);
|
*gpioState = gpiod_line_get_value(regularGpio->lineHandle);
|
||||||
|
} else {
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
@ -247,22 +238,22 @@ ReturnValue_t LinuxLibgpioIF::checkForConflicts(GpioMap& mapToAdd){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ReturnValue_t LinuxLibgpioIF::checkForConflictsRegularGpio(gpioId_t gpioIdToCheck,
|
ReturnValue_t LinuxLibgpioIF::checkForConflictsRegularGpio(gpioId_t gpioIdToCheck,
|
||||||
GpiodRegular* gpioToCheck, GpioMap& mapToAdd) {
|
GpiodRegular* gpioToCheck,
|
||||||
|
GpioMap& mapToAdd) {
|
||||||
/* Cross check with private map */
|
/* Cross check with private map */
|
||||||
gpioMapIter = gpioMap.find(gpioIdToCheck);
|
gpioMapIter = gpioMap.find(gpioIdToCheck);
|
||||||
if (gpioMapIter != gpioMap.end()) {
|
if (gpioMapIter != gpioMap.end()) {
|
||||||
if (gpioMapIter->second->gpioType != gpio::GpioTypes::GPIOD_REGULAR) {
|
if (gpioMapIter->second->gpioType != gpio::GpioTypes::GPIOD_REGULAR) {
|
||||||
sif::warning << "LinuxLibgpioIF::checkForConflicts: ID already exists for different "
|
sif::warning << "LinuxLibgpioIF::checkForConflicts: ID already exists for different "
|
||||||
"GPIO type" << gpioIdToCheck << ". Removing duplicate." << std::endl;
|
"GPIO type"
|
||||||
|
<< gpioIdToCheck << ". Removing duplicate." << std::endl;
|
||||||
mapToAdd.erase(gpioIdToCheck);
|
mapToAdd.erase(gpioIdToCheck);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
@ -281,13 +272,15 @@ ReturnValue_t LinuxLibgpioIF::checkForConflictsRegularGpio(gpioId_t gpioIdToChec
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t LinuxLibgpioIF::checkForConflictsCallbackGpio(gpioId_t gpioIdToCheck,
|
ReturnValue_t LinuxLibgpioIF::checkForConflictsCallbackGpio(gpioId_t gpioIdToCheck,
|
||||||
GpioCallback *callbackGpio, GpioMap& mapToAdd) {
|
GpioCallback* callbackGpio,
|
||||||
|
GpioMap& mapToAdd) {
|
||||||
/* Cross check with private map */
|
/* Cross check with private map */
|
||||||
gpioMapIter = gpioMap.find(gpioIdToCheck);
|
gpioMapIter = gpioMap.find(gpioIdToCheck);
|
||||||
if (gpioMapIter != gpioMap.end()) {
|
if (gpioMapIter != gpioMap.end()) {
|
||||||
if (gpioMapIter->second->gpioType != gpio::GpioTypes::CALLBACK) {
|
if (gpioMapIter->second->gpioType != gpio::GpioTypes::CALLBACK) {
|
||||||
sif::warning << "LinuxLibgpioIF::checkForConflicts: ID already exists for different "
|
sif::warning << "LinuxLibgpioIF::checkForConflicts: ID already exists for different "
|
||||||
"GPIO type" << gpioIdToCheck << ". Removing duplicate." << std::endl;
|
"GPIO type"
|
||||||
|
<< gpioIdToCheck << ". Removing duplicate." << std::endl;
|
||||||
mapToAdd.erase(gpioIdToCheck);
|
mapToAdd.erase(gpioIdToCheck);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#ifndef LINUX_GPIO_LINUXLIBGPIOIF_H_
|
#ifndef LINUX_GPIO_LINUXLIBGPIOIF_H_
|
||||||
#define LINUX_GPIO_LINUXLIBGPIOIF_H_
|
#define LINUX_GPIO_LINUXLIBGPIOIF_H_
|
||||||
|
|
||||||
#include <linux/gpio/GpioIF.h>
|
|
||||||
#include <fsfwconfig/returnvalues/classIds.h>
|
|
||||||
#include <fsfw/objectmanager/SystemObject.h>
|
#include <fsfw/objectmanager/SystemObject.h>
|
||||||
|
#include <fsfwconfig/returnvalues/classIds.h>
|
||||||
|
#include <linux/gpio/GpioIF.h>
|
||||||
|
|
||||||
class GpioCookie;
|
class GpioCookie;
|
||||||
|
|
||||||
@ -16,7 +16,6 @@ class GpioCookie;
|
|||||||
*/
|
*/
|
||||||
class LinuxLibgpioIF : public GpioIF, public SystemObject {
|
class LinuxLibgpioIF : public GpioIF, public SystemObject {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static const uint8_t gpioRetvalId = CLASS_ID::LINUX_LIBGPIO_IF;
|
static const uint8_t gpioRetvalId = CLASS_ID::LINUX_LIBGPIO_IF;
|
||||||
|
|
||||||
static constexpr ReturnValue_t UNKNOWN_GPIO_ID =
|
static constexpr ReturnValue_t UNKNOWN_GPIO_ID =
|
||||||
@ -71,7 +70,6 @@ private:
|
|||||||
* @brief Performs the initial configuration of all GPIOs specified in the GpioMap mapToAdd.
|
* @brief Performs the initial configuration of all GPIOs specified in the GpioMap mapToAdd.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t configureGpios(GpioMap& mapToAdd);
|
ReturnValue_t configureGpios(GpioMap& mapToAdd);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* LINUX_GPIO_LINUXLIBGPIOIF_H_ */
|
#endif /* LINUX_GPIO_LINUXLIBGPIOIF_H_ */
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user