some fixes
This commit is contained in:
159
bsp_hosted/InitMission.cpp
Normal file
159
bsp_hosted/InitMission.cpp
Normal file
@ -0,0 +1,159 @@
|
||||
#include <bsp_linux/InitMission.h>
|
||||
#include <bsp_linux/ObjectFactory.h>
|
||||
|
||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||
#include <fsfw/datapool/DataPool.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||
#include <fsfw/tasks/PeriodicTaskIF.h>
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
#include <fsfwconfig/objects/systemObjectList.h>
|
||||
#include <fsfwconfig/OBSWConfig.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
// This is configured for linux without \cr
|
||||
#ifdef LINUX
|
||||
ServiceInterfaceStream sif::debug("DEBUG");
|
||||
ServiceInterfaceStream sif::info("INFO");
|
||||
ServiceInterfaceStream sif::warning("WARNING");
|
||||
ServiceInterfaceStream sif::error("ERROR", false, false, true);
|
||||
#else
|
||||
ServiceInterfaceStream sif::debug("DEBUG", true);
|
||||
ServiceInterfaceStream sif::info("INFO", true);
|
||||
ServiceInterfaceStream sif::warning("WARNING", true);
|
||||
ServiceInterfaceStream sif::error("ERROR", true, false, true);
|
||||
#endif
|
||||
|
||||
ObjectManagerIF *objectManager = nullptr;
|
||||
|
||||
//Initialize Data Pool
|
||||
DataPool dataPool(nullptr);
|
||||
|
||||
void InitMission::initMission() {
|
||||
sif::info << "Building global objects.." << std::endl;
|
||||
/* Instantiate global object manager and also create all objects */
|
||||
objectManager = new ObjectManager(ObjectFactory::produce);
|
||||
sif::info << "Initializing all objects.." << std::endl;
|
||||
objectManager->initialize();
|
||||
|
||||
/* This function creates and starts all tasks */
|
||||
initTasks();
|
||||
}
|
||||
|
||||
void InitMission::initTasks(){
|
||||
/* TMTC Distribution */
|
||||
PeriodicTaskIF* TmTcDistributor = TaskFactory::instance()->
|
||||
createPeriodicTask("DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE,
|
||||
0.100, nullptr);
|
||||
ReturnValue_t result = TmTcDistributor->addComponent(
|
||||
objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||
if(result!=HasReturnvaluesIF::RETURN_OK){
|
||||
sif::error << "Object add component failed" << std::endl;
|
||||
}
|
||||
result = TmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
||||
if(result!=HasReturnvaluesIF::RETURN_OK){
|
||||
sif::error << "Object add component failed" << std::endl;
|
||||
}
|
||||
result = TmTcDistributor->addComponent(objects::TM_FUNNEL);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "Object add component failed" << std::endl;
|
||||
}
|
||||
|
||||
/* UDP bridge */
|
||||
PeriodicTaskIF* UdpBridgeTask = TaskFactory::instance()->createPeriodicTask(
|
||||
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE,
|
||||
0.2, nullptr);
|
||||
result = UdpBridgeTask->addComponent(objects::UDP_BRIDGE);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
|
||||
}
|
||||
PeriodicTaskIF* UdpPollingTask = TaskFactory::instance()->
|
||||
createPeriodicTask("UDP_POLLING", 80,
|
||||
PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, nullptr);
|
||||
result = UdpPollingTask->addComponent(objects::UDP_POLLING_TASK);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "Add component UDP Polling failed" << std::endl;
|
||||
}
|
||||
|
||||
/* PUS Services */
|
||||
PeriodicTaskIF* PusVerification = TaskFactory::instance()->
|
||||
createPeriodicTask("PUS_VERIF_1", 40,
|
||||
PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, nullptr);
|
||||
result = PusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||
sif::error << "Object add component failed" << std::endl;
|
||||
}
|
||||
|
||||
PeriodicTaskIF* PusEvents = TaskFactory::instance()->
|
||||
createPeriodicTask("PUS_VERIF_1", 60,
|
||||
PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, nullptr);
|
||||
result = PusVerification->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||
sif::error << "Object add component failed" << std::endl;
|
||||
}
|
||||
|
||||
PeriodicTaskIF* PusHighPrio = TaskFactory::instance()->
|
||||
createPeriodicTask("PUS_HIGH_PRIO", 50,
|
||||
PeriodicTaskIF::MINIMUM_STACK_SIZE,
|
||||
0.200, nullptr);
|
||||
result = PusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||
if(result!=HasReturnvaluesIF::RETURN_OK){
|
||||
sif::error << "Object add component failed" << std::endl;
|
||||
}
|
||||
result = PusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
||||
if(result!=HasReturnvaluesIF::RETURN_OK){
|
||||
sif::error << "Object add component failed" << std::endl;
|
||||
}
|
||||
|
||||
PeriodicTaskIF* PusMedPrio = TaskFactory::instance()->
|
||||
createPeriodicTask("PUS_HIGH_PRIO", 40,
|
||||
PeriodicTaskIF::MINIMUM_STACK_SIZE,
|
||||
0.8, nullptr);
|
||||
result = PusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||
if(result!=HasReturnvaluesIF::RETURN_OK){
|
||||
sif::error << "Object add component failed" << std::endl;
|
||||
}
|
||||
result = PusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
||||
if(result!=HasReturnvaluesIF::RETURN_OK){
|
||||
sif::error << "Object add component failed" << std::endl;
|
||||
}
|
||||
|
||||
PeriodicTaskIF* PusLowPrio = TaskFactory::instance()->
|
||||
createPeriodicTask("PUSB", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE,
|
||||
1.6, nullptr);
|
||||
result = PusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
||||
if(result!=HasReturnvaluesIF::RETURN_OK){
|
||||
sif::error << "Object add component failed" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
FixedTimeslotTaskIF* TestTimeslotTask = TaskFactory::instance()->
|
||||
createFixedTimeslotTask("PST_TEST_TASK", 10,
|
||||
PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
|
||||
result = pst::pollingSequenceTestFunction(TestTimeslotTask);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "InitMission::createTasks: Test PST initialization "
|
||||
<< "failed!" << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
//Main thread sleep
|
||||
sif::info << "Starting tasks.." << std::endl;
|
||||
TmTcDistributor->startTask();
|
||||
UdpBridgeTask->startTask();
|
||||
UdpPollingTask->startTask();
|
||||
|
||||
PusVerification->startTask();
|
||||
PusEvents->startTask();
|
||||
PusHighPrio->startTask();
|
||||
PusMedPrio->startTask();
|
||||
PusLowPrio->startTask();
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
TestTimeslotTask->startTask();
|
||||
#endif
|
||||
sif::info << "Tasks started.." << std::endl;
|
||||
}
|
9
bsp_hosted/InitMission.h
Normal file
9
bsp_hosted/InitMission.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef BSP_LINUX_INITMISSION_H_
|
||||
#define BSP_LINUX_INITMISSION_H_
|
||||
|
||||
namespace InitMission {
|
||||
void initMission();
|
||||
void initTasks();
|
||||
};
|
||||
|
||||
#endif /* BSP_LINUX_INITMISSION_H_ */
|
61
bsp_hosted/ObjectFactory.cpp
Normal file
61
bsp_hosted/ObjectFactory.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
#include "ObjectFactory.h"
|
||||
|
||||
#include <OBSWConfig.h>
|
||||
#include <objects/systemObjectList.h>
|
||||
#include <tmtc/apid.h>
|
||||
#include <tmtc/pusIds.h>
|
||||
|
||||
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
||||
#include <fsfw/tmtcservices/PusServiceBase.h>
|
||||
|
||||
#include <mission/core/GenericFactory.h>
|
||||
#include <mission/utility/TmFunnel.h>
|
||||
|
||||
#ifdef LINUX
|
||||
#include <fsfw/osal/linux/TcUnixUdpPollingTask.h>
|
||||
#include <fsfw/osal/linux/TmTcUnixUdpBridge.h>
|
||||
#elif WIN32
|
||||
#include <fsfw/osal/windows/TcWinUdpPollingTask.h>
|
||||
#include <fsfw/osal/windows/TmTcWinUdpBridge.h>
|
||||
#endif
|
||||
|
||||
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
|
||||
|
||||
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
#include <test/testtasks/TestTask.h>
|
||||
#endif
|
||||
|
||||
void Factory::setStaticFrameworkObjectIds(){
|
||||
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||
PusServiceBase::packetDestination = objects::TM_FUNNEL;
|
||||
|
||||
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
|
||||
|
||||
TmFunnel::downlinkDestination = objects::UDP_BRIDGE;
|
||||
// No storage object for now.
|
||||
TmFunnel::storageDestination = objects::NO_OBJECT;
|
||||
|
||||
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
|
||||
TmPacketStored::timeStamperId = objects::TIME_STAMPER;
|
||||
}
|
||||
|
||||
void ObjectFactory::produce(){
|
||||
Factory::setStaticFrameworkObjectIds();
|
||||
ObjectFactory::produceGenericObjects();
|
||||
|
||||
#ifdef LINUX
|
||||
new TmTcUnixUdpBridge(objects::UDP_BRIDGE,
|
||||
objects::CCSDS_PACKET_DISTRIBUTOR,
|
||||
objects::TM_STORE, objects::TC_STORE);
|
||||
new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
|
||||
#elif WIN32
|
||||
new TmTcWinUdpBridge(objects::UDP_BRIDGE,
|
||||
objects::CCSDS_PACKET_DISTRIBUTOR, objects::TM_STORE,
|
||||
objects::TC_STORE);
|
||||
new TcWinUdpPollingTask(objects::UDP_POLLING_TASK,
|
||||
objects::UDP_BRIDGE);
|
||||
#endif
|
||||
|
||||
}
|
17
bsp_hosted/ObjectFactory.h
Normal file
17
bsp_hosted/ObjectFactory.h
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* ObjectFactory.h
|
||||
*
|
||||
* Created on: Sep 22, 2020
|
||||
* Author: steffen
|
||||
*/
|
||||
|
||||
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
||||
#define BSP_LINUX_OBJECTFACTORY_H_
|
||||
|
||||
|
||||
namespace ObjectFactory {
|
||||
void setStatics();
|
||||
void produce();
|
||||
};
|
||||
|
||||
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
38
bsp_hosted/boardconfig/etl_profile.h
Normal file
38
bsp_hosted/boardconfig/etl_profile.h
Normal file
@ -0,0 +1,38 @@
|
||||
///\file
|
||||
|
||||
/******************************************************************************
|
||||
The MIT License(MIT)
|
||||
|
||||
Embedded Template Library.
|
||||
https://github.com/ETLCPP/etl
|
||||
https://www.etlcpp.com
|
||||
|
||||
Copyright(c) 2019 jwellbelove
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files(the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions :
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
#ifndef __ETL_PROFILE_H__
|
||||
#define __ETL_PROFILE_H__
|
||||
|
||||
#define ETL_CHECK_PUSH_POP
|
||||
|
||||
#define ETL_CPP11_SUPPORTED 1
|
||||
#define ETL_NO_NULLPTR_SUPPORT 0
|
||||
|
||||
#endif
|
14
bsp_hosted/boardconfig/gcov.h
Normal file
14
bsp_hosted/boardconfig/gcov.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef LINUX_GCOV_H_
|
||||
#define LINUX_GCOV_H_
|
||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||
|
||||
#ifdef GCOV
|
||||
extern "C" void __gcov_flush();
|
||||
#else
|
||||
void __gcov_flush() {
|
||||
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
||||
"coverage information is desired.\n" << std::flush;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LINUX_GCOV_H_ */
|
15
bsp_hosted/boardconfig/print.c
Normal file
15
bsp_hosted/boardconfig/print.c
Normal file
@ -0,0 +1,15 @@
|
||||
#include "print.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void printChar(const char* character, bool errStream) {
|
||||
if(errStream) {
|
||||
putc(*character, stderr);
|
||||
return;
|
||||
}
|
||||
putc(*character, stdout);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
8
bsp_hosted/boardconfig/print.h
Normal file
8
bsp_hosted/boardconfig/print.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef BSP_HOSTED_BOARDCONFIG_PRINT_H_
|
||||
#define BSP_HOSTED_BOARDCONFIG_PRINT_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
void printChar(const char* character, bool errStream);
|
||||
|
||||
#endif /* BSP_HOSTED_BOARDCONFIG_PRINT_H_ */
|
11
bsp_hosted/bsp_hosted.mk
Normal file
11
bsp_hosted/bsp_hosted.mk
Normal file
@ -0,0 +1,11 @@
|
||||
# add main and others
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/*.cpp)
|
||||
CSRC += $(wildcard $(CURRENTPATH)/*.c)
|
||||
|
||||
CSRC += $(wildcard $(CURRENTPATH)/boardconfig/*.c)
|
||||
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/comIF/*.cpp)
|
||||
CSRC += $(wildcard $(CURRENTPATH)/comIF/*.c)
|
||||
|
||||
INCLUDES += $(CURRENTPATH)/boardconfig
|
||||
INCLUDES += $(CURRENTPATH)/fsfwconfig
|
373
bsp_hosted/comIF/ArduinoComIF.cpp
Normal file
373
bsp_hosted/comIF/ArduinoComIF.cpp
Normal file
@ -0,0 +1,373 @@
|
||||
#include <bsp_hosted/comIF/ArduinoComIF.h>
|
||||
#include <bsp_hosted/comIF/ArduinoCookie.h>
|
||||
#include <fsfw/globalfunctions/DleEncoder.h>
|
||||
#include <fsfw/globalfunctions/CRC.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||
|
||||
// This only works on Linux
|
||||
#ifdef LINUX
|
||||
#include <termios.h>
|
||||
#elif WIN32
|
||||
#include <windows.h>
|
||||
#include <strsafe.h>
|
||||
#endif
|
||||
|
||||
#include <cstring>
|
||||
|
||||
ArduinoComIF::ArduinoComIF(object_id_t setObjectId, bool promptComIF,
|
||||
const char *serialDevice):
|
||||
rxBuffer(MAX_PACKET_SIZE * MAX_NUMBER_OF_SPI_DEVICES*10, true),
|
||||
SystemObject(setObjectId) {
|
||||
#ifdef LINUX
|
||||
initialized = false;
|
||||
serialPort = ::open("/dev/ttyUSB0", O_RDWR);
|
||||
|
||||
if (serialPort < 0) {
|
||||
//configuration error
|
||||
printf("Error %i from open: %s\n", errno, strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
struct termios tty;
|
||||
memset(&tty, 0, sizeof tty);
|
||||
|
||||
// Read in existing settings, and handle any error
|
||||
if (tcgetattr(serialPort, &tty) != 0) {
|
||||
printf("Error %i from tcgetattr: %s\n", errno, strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
tty.c_cflag &= ~PARENB; // Clear parity bit, disabling parity
|
||||
tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication
|
||||
tty.c_cflag |= CS8; // 8 bits per byte
|
||||
tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control
|
||||
tty.c_lflag &= ~ICANON; //Disable Canonical Mode
|
||||
tty.c_oflag &= ~OPOST; // Prevent special interpretation of output bytes (e.g. newline chars)
|
||||
tty.c_oflag &= ~ONLCR; // Prevent conversion of newline to carriage return/line feed
|
||||
tty.c_cc[VTIME] = 0; // Non Blocking
|
||||
tty.c_cc[VMIN] = 0;
|
||||
|
||||
cfsetispeed(&tty, B9600); //Baudrate
|
||||
|
||||
if (tcsetattr(serialPort, TCSANOW, &tty) != 0) {
|
||||
//printf("Error %i from tcsetattr: %s\n", errno, strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
#elif WIN32
|
||||
DCB serialParams = { 0 };
|
||||
|
||||
// we need to ask the COM port from the user.
|
||||
if(promptComIF) {
|
||||
sif::info << "Please enter the COM port (c to cancel): " << std::flush;
|
||||
std::string comPort;
|
||||
while(hCom == INVALID_HANDLE_VALUE) {
|
||||
|
||||
std::getline(std::cin, comPort);
|
||||
if(comPort[0] == 'c') {
|
||||
break;
|
||||
}
|
||||
const TCHAR *pcCommPort = comPort.c_str();
|
||||
hCom = CreateFileA(pcCommPort, //port name
|
||||
GENERIC_READ | GENERIC_WRITE, //Read/Write
|
||||
0, // No Sharing
|
||||
NULL, // No Security
|
||||
OPEN_EXISTING,// Open existing port only
|
||||
0, // Non Overlapped I/O
|
||||
NULL); // Null for Comm Devices
|
||||
|
||||
if (hCom == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
if(GetLastError() == 2) {
|
||||
sif::error << "COM Port does not found!" << std::endl;
|
||||
}
|
||||
else {
|
||||
TCHAR err[128];
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL,
|
||||
GetLastError(),
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
err, sizeof(err), NULL);
|
||||
// Handle the error.
|
||||
sif::info << "CreateFileA Error code: " << GetLastError()
|
||||
<< std::endl;
|
||||
sif::error << err << std::flush;
|
||||
}
|
||||
sif::info << "Please enter a valid COM port: " << std::flush;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
serialParams.DCBlength = sizeof(serialParams);
|
||||
if(baudRate == 9600) {
|
||||
serialParams.BaudRate = CBR_9600;
|
||||
}
|
||||
if(baudRate == 115200) {
|
||||
serialParams.BaudRate = CBR_115200;
|
||||
}
|
||||
else {
|
||||
serialParams.BaudRate = baudRate;
|
||||
}
|
||||
|
||||
serialParams.ByteSize = 8;
|
||||
serialParams.Parity = NOPARITY;
|
||||
serialParams.StopBits = ONESTOPBIT;
|
||||
SetCommState(hCom, &serialParams);
|
||||
|
||||
COMMTIMEOUTS timeout = { 0 };
|
||||
// This will set the read operation to be blocking until data is received
|
||||
// and then read continuously until there is a gap of one millisecond.
|
||||
timeout.ReadIntervalTimeout = 1;
|
||||
timeout.ReadTotalTimeoutConstant = 0;
|
||||
timeout.ReadTotalTimeoutMultiplier = 0;
|
||||
timeout.WriteTotalTimeoutConstant = 0;
|
||||
timeout.WriteTotalTimeoutMultiplier = 0;
|
||||
SetCommTimeouts(hCom, &timeout);
|
||||
// Serial port should now be read for operations.
|
||||
#endif
|
||||
}
|
||||
|
||||
ArduinoComIF::~ArduinoComIF() {
|
||||
#ifdef LINUX
|
||||
::close(serialPort);
|
||||
#elif WIN32
|
||||
CloseHandle(hCom);
|
||||
#endif
|
||||
}
|
||||
ReturnValue_t ArduinoComIF::initializeInterface(CookieIF * cookie) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t ArduinoComIF::sendMessage(CookieIF *cookie, const uint8_t *data,
|
||||
size_t len) {
|
||||
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie*>(cookie);
|
||||
if (arduinoCookie == nullptr) {
|
||||
return INVALID_COOKIE_TYPE;
|
||||
}
|
||||
|
||||
return sendMessage(arduinoCookie->command, arduinoCookie->address, data,
|
||||
len);
|
||||
}
|
||||
|
||||
ReturnValue_t ArduinoComIF::getSendSuccess(CookieIF *cookie) {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t ArduinoComIF::requestReceiveMessage(CookieIF *cookie,
|
||||
size_t requestLen) {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie,
|
||||
uint8_t **buffer, size_t *size) {
|
||||
|
||||
handleSerialPortRx();
|
||||
|
||||
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie*>(cookie);
|
||||
if (arduinoCookie == nullptr) {
|
||||
return INVALID_COOKIE_TYPE;
|
||||
}
|
||||
|
||||
*buffer = arduinoCookie->replyBuffer.data();
|
||||
*size = arduinoCookie->receivedDataLen;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t ArduinoComIF::sendMessage(uint8_t command,
|
||||
uint8_t address, const uint8_t *data, size_t dataLen) {
|
||||
if (dataLen > UINT16_MAX) {
|
||||
return TOO_MUCH_DATA;
|
||||
}
|
||||
|
||||
//being conservative here
|
||||
uint8_t sendBuffer[(dataLen + 6) * 2 + 2];
|
||||
|
||||
sendBuffer[0] = DleEncoder::STX_CHAR;
|
||||
|
||||
uint8_t *currentPosition = sendBuffer + 1;
|
||||
size_t remainingLen = sizeof(sendBuffer) - 1;
|
||||
size_t encodedLen = 0;
|
||||
|
||||
ReturnValue_t result = DleEncoder::encode(&command, 1, currentPosition,
|
||||
remainingLen, &encodedLen, false);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
currentPosition += encodedLen;
|
||||
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
||||
|
||||
result = DleEncoder::encode(&address, 1, currentPosition, remainingLen,
|
||||
&encodedLen, false);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
currentPosition += encodedLen;
|
||||
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
||||
|
||||
uint8_t temporaryBuffer[2];
|
||||
|
||||
//note to Lukas: yes we _could_ use Serialize here, but for 16 bit it is a bit too much...
|
||||
temporaryBuffer[0] = dataLen >> 8; //we checked dataLen above
|
||||
temporaryBuffer[1] = dataLen;
|
||||
|
||||
result = DleEncoder::encode(temporaryBuffer, 2, currentPosition,
|
||||
remainingLen, &encodedLen, false);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
currentPosition += encodedLen;
|
||||
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
||||
|
||||
//encoding the actual data
|
||||
result = DleEncoder::encode(data, dataLen, currentPosition, remainingLen,
|
||||
&encodedLen, false);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
currentPosition += encodedLen;
|
||||
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
||||
|
||||
uint16_t crc = CRC::crc16ccitt(&command, 1);
|
||||
crc = CRC::crc16ccitt(&address, 1, crc);
|
||||
//fortunately the length is still there
|
||||
crc = CRC::crc16ccitt(temporaryBuffer, 2, crc);
|
||||
crc = CRC::crc16ccitt(data, dataLen, crc);
|
||||
|
||||
temporaryBuffer[0] = crc >> 8;
|
||||
temporaryBuffer[1] = crc;
|
||||
|
||||
result = DleEncoder::encode(temporaryBuffer, 2, currentPosition,
|
||||
remainingLen, &encodedLen, false);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
currentPosition += encodedLen;
|
||||
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
||||
|
||||
if (remainingLen > 0) {
|
||||
*currentPosition = DleEncoder::ETX_CHAR;
|
||||
}
|
||||
remainingLen -= 1;
|
||||
|
||||
encodedLen = sizeof(sendBuffer) - remainingLen;
|
||||
|
||||
#ifdef LINUX
|
||||
ssize_t writtenlen = write(serialPort, sendBuffer, encodedLen);
|
||||
if (writtenlen < 0) {
|
||||
//we could try to find out what happened...
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
if (writtenlen != encodedLen) {
|
||||
//the OS failed us, we do not try to block until everything is written, as
|
||||
//we can not block the whole system here
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
return RETURN_OK;
|
||||
#elif WIN32
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
void ArduinoComIF::handleSerialPortRx() {
|
||||
#ifdef LINUX
|
||||
uint32_t availableSpace = rxBuffer.availableWriteSpace();
|
||||
|
||||
uint8_t dataFromSerial[availableSpace];
|
||||
|
||||
ssize_t bytesRead = read(serialPort, dataFromSerial,
|
||||
sizeof(dataFromSerial));
|
||||
|
||||
if (bytesRead < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
rxBuffer.writeData(dataFromSerial, bytesRead);
|
||||
|
||||
uint8_t dataReceivedSoFar[rxBuffer.maxSize()];
|
||||
|
||||
uint32_t dataLenReceivedSoFar = 0;
|
||||
|
||||
rxBuffer.readData(dataReceivedSoFar, sizeof(dataReceivedSoFar), true,
|
||||
&dataLenReceivedSoFar);
|
||||
|
||||
//look for STX
|
||||
size_t firstSTXinRawData = 0;
|
||||
while ((firstSTXinRawData < dataLenReceivedSoFar)
|
||||
&& (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX)) {
|
||||
firstSTXinRawData++;
|
||||
}
|
||||
|
||||
if (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX) {
|
||||
//there is no STX in our data, throw it away...
|
||||
rxBuffer.deleteData(dataLenReceivedSoFar);
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t packet[MAX_PACKET_SIZE];
|
||||
size_t packetLen = 0;
|
||||
|
||||
size_t readSize = 0;
|
||||
|
||||
ReturnValue_t result = DleEncoder::decode(
|
||||
dataReceivedSoFar + firstSTXinRawData,
|
||||
dataLenReceivedSoFar - firstSTXinRawData, &readSize, packet,
|
||||
sizeof(packet), &packetLen);
|
||||
|
||||
size_t toDelete = firstSTXinRawData;
|
||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||
handlePacket(packet, packetLen);
|
||||
|
||||
// after handling the packet, we can delete it from the raw stream,
|
||||
// it has been copied to packet
|
||||
toDelete += readSize;
|
||||
}
|
||||
|
||||
//remove Data which was processed
|
||||
rxBuffer.deleteData(toDelete);
|
||||
#elif WIN32
|
||||
#endif
|
||||
}
|
||||
|
||||
void ArduinoComIF::setBaudrate(uint32_t baudRate) {
|
||||
this->baudRate = baudRate;
|
||||
}
|
||||
|
||||
void ArduinoComIF::handlePacket(uint8_t *packet, size_t packetLen) {
|
||||
uint16_t crc = CRC::crc16ccitt(packet, packetLen);
|
||||
if (crc != 0) {
|
||||
//CRC error
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t command = packet[0];
|
||||
uint8_t address = packet[1];
|
||||
|
||||
uint16_t size = (packet[2] << 8) + packet[3];
|
||||
|
||||
if (size != packetLen - 6) {
|
||||
//Invalid Length
|
||||
return;
|
||||
}
|
||||
|
||||
switch (command) {
|
||||
case ArduinoCookie::SPI: {
|
||||
//ArduinoCookie **itsComplicated;
|
||||
auto findIter = spiMap.find(address);
|
||||
if (findIter == spiMap.end()) {
|
||||
//we do no know this address
|
||||
return;
|
||||
}
|
||||
ArduinoCookie& cookie = findIter->second;
|
||||
if (packetLen > cookie.maxReplySize + 6) {
|
||||
packetLen = cookie.maxReplySize + 6;
|
||||
}
|
||||
std::memcpy(cookie.replyBuffer.data(), packet + 4, packetLen - 6);
|
||||
cookie.receivedDataLen = packetLen - 6;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
69
bsp_hosted/comIF/ArduinoComIF.h
Normal file
69
bsp_hosted/comIF/ArduinoComIF.h
Normal file
@ -0,0 +1,69 @@
|
||||
#ifndef MISSION_ARDUINOCOMMINTERFACE_H_
|
||||
#define MISSION_ARDUINOCOMMINTERFACE_H_
|
||||
|
||||
#include <fsfw/container/FixedMap.h>
|
||||
#include <fsfw/container/SimpleRingBuffer.h>
|
||||
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
#include <fsfw/objectmanager/SystemObject.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
//Forward declaration, so users don't peek
|
||||
class ArduinoCookie;
|
||||
|
||||
class ArduinoComIF: public SystemObject,
|
||||
public DeviceCommunicationIF {
|
||||
public:
|
||||
static const uint8_t MAX_NUMBER_OF_SPI_DEVICES = 8;
|
||||
static const uint8_t MAX_PACKET_SIZE = 64;
|
||||
|
||||
static const uint8_t COMMAND_INVALID = -1;
|
||||
static const uint8_t COMMAND_SPI = 1;
|
||||
|
||||
ArduinoComIF(object_id_t setObjectId, bool promptComIF = false,
|
||||
const char *serialDevice = nullptr);
|
||||
void setBaudrate(uint32_t baudRate);
|
||||
|
||||
virtual ~ArduinoComIF();
|
||||
|
||||
/** DeviceCommunicationIF overrides */
|
||||
virtual ReturnValue_t initializeInterface(CookieIF * cookie) override;
|
||||
virtual ReturnValue_t sendMessage(CookieIF *cookie,
|
||||
const uint8_t * sendData, size_t sendLen) override;
|
||||
virtual ReturnValue_t getSendSuccess(CookieIF *cookie) override;
|
||||
virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie,
|
||||
size_t requestLen) override;
|
||||
virtual ReturnValue_t readReceivedMessage(CookieIF *cookie,
|
||||
uint8_t **buffer, size_t *size) override;
|
||||
|
||||
private:
|
||||
#ifdef LINUX
|
||||
#elif WIN32
|
||||
HANDLE hCom = INVALID_HANDLE_VALUE;
|
||||
#endif
|
||||
// remembering if the initialization in the ctor worked
|
||||
// if not, all calls are disabled
|
||||
bool initialized = false;
|
||||
int serialPort = 0;
|
||||
// Default baud rate is 9600 for now.
|
||||
uint32_t baudRate = 9600;
|
||||
|
||||
//used to know where to put the data if a reply is received
|
||||
std::map<uint8_t, ArduinoCookie> spiMap;
|
||||
|
||||
SimpleRingBuffer rxBuffer;
|
||||
|
||||
ReturnValue_t sendMessage(uint8_t command, uint8_t address,
|
||||
const uint8_t *data, size_t dataLen);
|
||||
void handleSerialPortRx();
|
||||
|
||||
void handlePacket(uint8_t *packet, size_t packetLen);
|
||||
};
|
||||
|
||||
#endif /* MISSION_ARDUINOCOMMINTERFACE_H_ */
|
8
bsp_hosted/comIF/ArduinoCookie.cpp
Normal file
8
bsp_hosted/comIF/ArduinoCookie.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include <bsp_hosted/comIF/ArduinoCookie.h>
|
||||
|
||||
ArduinoCookie::ArduinoCookie(Protocol_t protocol, uint8_t address,
|
||||
const size_t maxReplySize) :
|
||||
protocol(protocol), command(protocol), address(address),
|
||||
maxReplySize(maxReplySize), replyBuffer(maxReplySize) {
|
||||
}
|
||||
|
27
bsp_hosted/comIF/ArduinoCookie.h
Normal file
27
bsp_hosted/comIF/ArduinoCookie.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef MISSION_ARDUINO_ARDUINOCOOKIE_H_
|
||||
#define MISSION_ARDUINO_ARDUINOCOOKIE_H_
|
||||
|
||||
#include <fsfw/devicehandlers/CookieIF.h>
|
||||
#include <vector>
|
||||
|
||||
class ArduinoCookie: public CookieIF {
|
||||
public:
|
||||
enum Protocol_t: uint8_t {
|
||||
INVALID,
|
||||
SPI,
|
||||
I2C
|
||||
};
|
||||
|
||||
ArduinoCookie(Protocol_t protocol, uint8_t address,
|
||||
const size_t maxReplySize);
|
||||
|
||||
Protocol_t protocol;
|
||||
uint8_t command;
|
||||
uint8_t address;
|
||||
std::vector<uint8_t> replyBuffer;
|
||||
size_t receivedDataLen = 0;
|
||||
size_t maxReplySize;
|
||||
|
||||
};
|
||||
|
||||
#endif /* MISSION_ARDUINO_ARDUINOCOOKIE_H_ */
|
54
bsp_hosted/fsfwconfig/FSFWConfig.h
Normal file
54
bsp_hosted/fsfwconfig/FSFWConfig.h
Normal file
@ -0,0 +1,54 @@
|
||||
#ifndef CONFIG_FSFWCONFIG_H_
|
||||
#define CONFIG_FSFWCONFIG_H_
|
||||
|
||||
#include <FSFWVersion.h>
|
||||
#include <cstddef>
|
||||
|
||||
//! Used to determine whether C++ ostreams are used
|
||||
//! Those can lead to code bloat.
|
||||
#define FSFW_CPP_OSTREAM_ENABLED 1
|
||||
|
||||
//! Reduced printout to further decrese code size
|
||||
//! Be careful, this also turns off most diagnostic prinouts!
|
||||
#define FSFW_REDUCED_PRINTOUT 0
|
||||
|
||||
//! Can be used to enable debugging printouts for developing the FSFW
|
||||
#define FSFW_DEBUGGING 0
|
||||
|
||||
//! Defines the FIFO depth of each commanding service base which
|
||||
//! also determines how many commands a CSB service can handle in one cycle
|
||||
//! simulataneously. This will increase the required RAM for
|
||||
//! each CSB service !
|
||||
#define FSFW_CSB_FIFO_DEPTH 6
|
||||
|
||||
//! If FSFW_OBJ_EVENT_TRANSLATION is set to one,
|
||||
//! additional output which requires the translation files translateObjects
|
||||
//! and translateEvents (and their compiled source files)
|
||||
#define FSFW_OBJ_EVENT_TRANSLATION 0
|
||||
|
||||
#if FSFW_OBJ_EVENT_TRANSLATION == 1
|
||||
#define FSFW_DEBUG_OUTPUT 1
|
||||
//! Specify whether info events are printed too.
|
||||
#define FSFW_DEBUG_INFO 1
|
||||
#include <translateObjects.h>
|
||||
#include <translateEvents.h>
|
||||
#else
|
||||
#define FSFW_DEBUG_OUTPUT 0
|
||||
#endif
|
||||
|
||||
//! When using the newlib nano library, C99 support for stdio facilities
|
||||
//! will not be provided. This define should be set to 1 if this is the case.
|
||||
#define FSFW_NO_C99_IO 1
|
||||
|
||||
namespace fsfwconfig {
|
||||
//! Default timestamp size. The default timestamp will be an eight byte CDC
|
||||
//! short timestamp.
|
||||
static constexpr uint8_t FSFW_MISSION_TIMESTAMP_SIZE = 8;
|
||||
|
||||
//! Configure the allocated pool sizes for the event manager.
|
||||
static constexpr size_t FSFW_EVENTMGMR_MATCHTREE_NODES = 240;
|
||||
static constexpr size_t FSFW_EVENTMGMT_EVENTIDMATCHERS = 120;
|
||||
static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_FSFWCONFIG_H_ */
|
14
bsp_hosted/fsfwconfig/OBSWConfig.h
Normal file
14
bsp_hosted/fsfwconfig/OBSWConfig.h
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @brief This file can be used to add preprocessor define for conditional
|
||||
* code inclusion exclusion or various other project constants and
|
||||
* properties in one place.
|
||||
*/
|
||||
#ifndef CONFIG_OBSWCONFIG_H_
|
||||
#define CONFIG_OBSWCONFIG_H_
|
||||
|
||||
#define ADD_TEST_FOLDER 1
|
||||
|
||||
// Define not used yet, PUS stack and TMTC tasks are always started
|
||||
#define ADD_PUS_STACK 1
|
||||
|
||||
#endif /* CONFIG_OBSWCONFIG_H_ */
|
12
bsp_hosted/fsfwconfig/OBSWVersion.h
Normal file
12
bsp_hosted/fsfwconfig/OBSWVersion.h
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef FSFWCONFIG_OBSWVERSION_H_
|
||||
#define FSFWCONFIG_OBSWVERSION_H_
|
||||
|
||||
const char* const SW_NAME = "eive";
|
||||
|
||||
#define SW_VERSION 0
|
||||
#define SW_SUBVERSION 2
|
||||
#define SW_SUBSUBVERSION 0
|
||||
|
||||
|
||||
|
||||
#endif /* FSFWCONFIG_OBSWVERSION_H_ */
|
26
bsp_hosted/fsfwconfig/events/subsystemIdRanges.h
Normal file
26
bsp_hosted/fsfwconfig/events/subsystemIdRanges.h
Normal file
@ -0,0 +1,26 @@
|
||||
#ifndef CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
|
||||
#define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
|
||||
|
||||
#include <fsfw/events/fwSubsystemIdRanges.h>
|
||||
#include <cstdint>
|
||||
|
||||
/**
|
||||
* These IDs are part of the ID for an event thrown by a subsystem.
|
||||
* Numbers 0-80 are reserved for FSFW Subsystem IDs (framework/events/)
|
||||
*/
|
||||
namespace SUBSYSTEM_ID {
|
||||
enum: uint8_t {
|
||||
SUBSYSTE_ID_START = FW_SUBSYSTEM_ID_RANGE,
|
||||
PUS_SERVICE_2,
|
||||
PUS_SERVICE_3,
|
||||
PUS_SERVICE_5,
|
||||
PUS_SERVICE_6,
|
||||
PUS_SERVICE_8,
|
||||
PUS_SERVICE_23,
|
||||
MGM_LIS3MDL,
|
||||
|
||||
DUMMY_DEVICE,
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ */
|
15
bsp_hosted/fsfwconfig/fsfwconfig.mk
Normal file
15
bsp_hosted/fsfwconfig/fsfwconfig.mk
Normal file
@ -0,0 +1,15 @@
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/cdatapool/*.cpp)
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/ipc/*.cpp)
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/objects/*.cpp)
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/pollingsequence/*.cpp)
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/events/*.cpp)
|
||||
|
||||
INCLUDES += $(CURRENTPATH)
|
||||
INCLUDES += $(CURRENTPATH)/objects
|
||||
INCLUDES += $(CURRENTPATH)/ipc
|
||||
INCLUDES += $(CURRENTPATH)/pollingsequence
|
||||
INCLUDES += $(CURRENTPATH)/returnvalues
|
||||
INCLUDES += $(CURRENTPATH)/tmtc
|
||||
INCLUDES += $(CURRENTPATH)/events
|
||||
INCLUDES += $(CURRENTPATH)/devices
|
||||
INCLUDES += $(CURRENTPATH)/cdatapool
|
11
bsp_hosted/fsfwconfig/ipc/MissionMessageTypes.cpp
Normal file
11
bsp_hosted/fsfwconfig/ipc/MissionMessageTypes.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include "MissionMessageTypes.h"
|
||||
#include <fsfw/ipc/CommandMessage.h>
|
||||
|
||||
void messagetypes::clearMissionMessage(CommandMessage* message) {
|
||||
switch(message->getMessageType()) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
22
bsp_hosted/fsfwconfig/ipc/MissionMessageTypes.h
Normal file
22
bsp_hosted/fsfwconfig/ipc/MissionMessageTypes.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef CONFIG_IPC_MISSIONMESSAGETYPES_H_
|
||||
#define CONFIG_IPC_MISSIONMESSAGETYPES_H_
|
||||
|
||||
#include <fsfw/ipc/FwMessageTypes.h>
|
||||
|
||||
class CommandMessage;
|
||||
|
||||
/**
|
||||
* Custom command messages are specified here.
|
||||
* Most messages needed to use FSFW are already located in
|
||||
* <fsfw/ipc/FwMessageTypes.h>
|
||||
* @param message Generic Command Message
|
||||
*/
|
||||
namespace messagetypes{
|
||||
enum MESSAGE_TYPE {
|
||||
MISSION_MESSAGE_TYPE_START = FW_MESSAGES_COUNT,
|
||||
};
|
||||
|
||||
void clearMissionMessage(CommandMessage* message);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_IPC_MISSIONMESSAGETYPES_H_ */
|
19
bsp_hosted/fsfwconfig/returnvalues/classIds.h
Normal file
19
bsp_hosted/fsfwconfig/returnvalues/classIds.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef CONFIG_RETURNVALUES_CLASSIDS_H_
|
||||
#define CONFIG_RETURNVALUES_CLASSIDS_H_
|
||||
|
||||
#include <fsfw/returnvalues/FwClassIds.h>
|
||||
|
||||
/**
|
||||
* Source IDs starts at 73 for now
|
||||
* Framework IDs for ReturnValues run from 0 to 56
|
||||
* and are located inside <fsfw/returnvalues/FwClassIds.h>
|
||||
*/
|
||||
namespace CLASS_ID {
|
||||
enum {
|
||||
MISSION_CLASS_ID_START = FW_CLASS_ID_COUNT,
|
||||
MGM_LIS3MDL
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif /* CONFIG_RETURNVALUES_CLASSIDS_H_ */
|
34
bsp_hosted/main.cpp
Normal file
34
bsp_hosted/main.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include <bsp_hosted/fsfwconfig/OBSWVersion.h>
|
||||
#include <bsp_linux/InitMission.h>
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
#include <iostream>
|
||||
|
||||
#ifdef WIN32
|
||||
static const char* COMPILE_PRINTOUT = "Windows";
|
||||
#elif LINUX
|
||||
static const char* COMPILE_PRINTOUT = "Linux";
|
||||
#else
|
||||
static const char* COMPILE_PRINTOUT = "unknown OS";
|
||||
#endif
|
||||
/**
|
||||
* @brief This is the main program for the hosted build. It can be run for
|
||||
* Linux and Windows.
|
||||
* @return
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||
std::cout << "-- Compiled for " << COMPILE_PRINTOUT << " --" << std::endl;
|
||||
std::cout << "-- Software version " << SW_NAME << " v" << SW_VERSION << "."
|
||||
<< SW_SUBVERSION << "." << SW_SUBSUBVERSION << " -- " << std::endl;
|
||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||
|
||||
InitMission::initMission();
|
||||
|
||||
for(;;) {
|
||||
// suspend main thread by sleeping it.
|
||||
TaskFactory::delayTask(5000);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user