Init commit
This commit is contained in:
14
bsp_linux/CMakeLists.txt
Normal file
14
bsp_linux/CMakeLists.txt
Normal file
@ -0,0 +1,14 @@
|
||||
target_sources(${TARGET_NAME}
|
||||
PRIVATE
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(fsfwconfig)
|
||||
add_subdirectory(utility)
|
||||
add_subdirectory(test)
|
||||
|
||||
target_include_directories(${TARGET_NAME}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
5
bsp_linux/core/CMakeLists.txt
Normal file
5
bsp_linux/core/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
target_sources(${TARGET_NAME}
|
||||
PRIVATE
|
||||
InitMission.cpp
|
||||
ObjectFactory.cpp
|
||||
)
|
248
bsp_linux/core/InitMission.cpp
Normal file
248
bsp_linux/core/InitMission.cpp
Normal file
@ -0,0 +1,248 @@
|
||||
#include "InitMission.h"
|
||||
#include <OBSWConfig.h>
|
||||
|
||||
#include <bsp_linux/fsfwconfig/objects/systemObjectList.h>
|
||||
#include <bsp_linux/fsfwconfig/pollingsequence/pollingSequenceFactory.h>
|
||||
|
||||
#include <mission/utility/TaskCreation.h>
|
||||
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||
#include <fsfw/tasks/PeriodicTaskIF.h>
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
|
||||
#include <fsfw/ipc/MessageQueueSenderIF.h>
|
||||
#include <fsfw/ipc/CommandMessage.h>
|
||||
#include <fsfw/modes/ModeMessage.h>
|
||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||
#include <mission/assemblies/TestAssembly.h>
|
||||
|
||||
void InitMission::createTasks() {
|
||||
TaskFactory* taskFactory = TaskFactory::instance();
|
||||
if(taskFactory == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if OBSW_ADD_CORE_COMPONENTS == 1
|
||||
/* TMTC Distribution */
|
||||
PeriodicTaskIF* distributerTask = taskFactory->
|
||||
createPeriodicTask("DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, nullptr);
|
||||
ReturnValue_t result = distributerTask->addComponent(objects::CCSDS_DISTRIBUTOR);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("CCSDS distributor", objects::CCSDS_DISTRIBUTOR);
|
||||
}
|
||||
result = distributerTask->addComponent(objects::PUS_DISTRIBUTOR);
|
||||
if (result!=HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS distributor", objects::PUS_DISTRIBUTOR);
|
||||
}
|
||||
result = distributerTask->addComponent(objects::TM_FUNNEL);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("TM funnel", objects::TM_FUNNEL);
|
||||
}
|
||||
|
||||
/* UDP bridge */
|
||||
PeriodicTaskIF* udpBridgeTask = taskFactory->createPeriodicTask(
|
||||
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, nullptr);
|
||||
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("UDP bridge", objects::UDP_BRIDGE);
|
||||
}
|
||||
/* UDP polling task */
|
||||
PeriodicTaskIF* udpPollingTask = taskFactory->createPeriodicTask(
|
||||
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.1, nullptr);
|
||||
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("UDP polling", objects::UDP_POLLING_TASK);
|
||||
}
|
||||
|
||||
PeriodicTaskIF* eventTask = taskFactory->createPeriodicTask(
|
||||
"EVENT_MGMT", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.1, nullptr);
|
||||
result = eventTask->addComponent(objects::EVENT_MANAGER);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||
task::printInitError("Event Manager", objects::EVENT_MANAGER);
|
||||
}
|
||||
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
|
||||
|
||||
#if OBSW_ADD_TASK_EXAMPLE == 1
|
||||
FixedTimeslotTaskIF* timeslotDemoTask = taskFactory->createFixedTimeslotTask
|
||||
("PST_TASK", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.5, nullptr);
|
||||
result = pst::pollingSequenceExamples(timeslotDemoTask);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "InitMission::createTasks: Timeslot demo task"
|
||||
<<" initialization failed!" << std::endl;
|
||||
#else
|
||||
sif::printError("InitMission::createTasks: Timeslot demo task"
|
||||
" initialization failed!\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
PeriodicTaskIF* readerTask = taskFactory->
|
||||
createPeriodicTask("READER_TASK", 40,
|
||||
PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
|
||||
result = readerTask->addComponent(objects::TEST_DUMMY_4);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("Dummy 4", objects::TEST_DUMMY_4);
|
||||
}
|
||||
#endif /* OBSW_ADD_TASK_EXAMPLE == 1 */
|
||||
|
||||
#if OBSW_ADD_PUS_STACK == 1
|
||||
/* PUS Services */
|
||||
PeriodicTaskIF* pusVerification = taskFactory->createPeriodicTask(
|
||||
"PUS_VERIF_1", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, nullptr);
|
||||
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS 1", objects::PUS_SERVICE_1_VERIFICATION);
|
||||
}
|
||||
|
||||
PeriodicTaskIF* pusHighPrio = taskFactory->createPeriodicTask(
|
||||
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, nullptr);
|
||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS 2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||
}
|
||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||
task::printInitError("PUS 5",objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||
}
|
||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS 9", objects::PUS_SERVICE_9_TIME_MGMT);
|
||||
}
|
||||
|
||||
PeriodicTaskIF* pusMedPrio = taskFactory->createPeriodicTask(
|
||||
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, nullptr);
|
||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS 8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||
}
|
||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS 20", objects::PUS_SERVICE_20_PARAMETERS);
|
||||
}
|
||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS 200", objects::PUS_SERVICE_200_MODE_MGMT);
|
||||
}
|
||||
|
||||
PeriodicTaskIF* pusLowPrio = taskFactory->createPeriodicTask(
|
||||
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, nullptr);
|
||||
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("PUS 17", objects::PUS_SERVICE_17_TEST);
|
||||
}
|
||||
#endif /* OBSW_ADD_PUS_STACK == 1 */
|
||||
|
||||
#if OBSW_ADD_DEVICE_HANDLER_DEMO == 1
|
||||
FixedTimeslotTaskIF* testDeviceTask = taskFactory->createFixedTimeslotTask(
|
||||
"PST_TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
|
||||
result = pst::pollingSequenceDevices(testDeviceTask);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "InitMission::createTasks: Test PST initialization failed!" << std::endl;
|
||||
#else
|
||||
sif::printError("InitMission::createTasks: Test PST initialization failed!\n\r");
|
||||
#endif
|
||||
}
|
||||
PeriodicTaskIF* assemblyTask = taskFactory->createPeriodicTask("ASS_TASK", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, nullptr);
|
||||
if(assemblyTask == nullptr){
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "InitMission::createTasks: Test Assembly Task creation failed!" << std::endl;
|
||||
#else
|
||||
sif::printError("InitMission::createTasks: Test Assembly Task creation failed!\n\r");
|
||||
#endif
|
||||
}
|
||||
result = assemblyTask->addComponent(objects::TEST_ASSEMBLY);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if(assemblyTask == nullptr){
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "InitMission::createTasks: Test Assembly Task adding failed!" << std::endl;
|
||||
#else
|
||||
sif::printError("InitMission::createTasks: Test Assembly Task adding failed!\n\r");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif /* OBSW_ADD_DEVICE_HANDLER_DEMO == 1 */
|
||||
|
||||
#if OBSW_ADD_CONTROLLER_DEMO == 1
|
||||
PeriodicTaskIF* controllerTask = taskFactory->createPeriodicTask(
|
||||
"TEST_CTRL", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, nullptr);
|
||||
result = controllerTask->addComponent(objects::TEST_CONTROLLER);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("Controller Task", objects::TEST_CONTROLLER);
|
||||
}
|
||||
#endif /* OBSW_ADD_CONTROLLER_DEMO == 1 */
|
||||
|
||||
PeriodicTaskIF* testTask = taskFactory->createPeriodicTask(
|
||||
"TEST", 15, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
|
||||
result = testTask->addComponent(objects::TEST_TASK);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
task::printInitError("Test Task", objects::TEST_TASK);
|
||||
}
|
||||
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "Starting tasks.." << std::endl;
|
||||
#else
|
||||
sif::printInfo("Starting tasks..\n");
|
||||
#endif
|
||||
|
||||
#if OBSW_ADD_CORE_COMPONENTS == 1
|
||||
distributerTask->startTask();
|
||||
udpBridgeTask->startTask();
|
||||
udpPollingTask->startTask();
|
||||
eventTask->startTask();
|
||||
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
|
||||
|
||||
#if OBSW_ADD_PUS_STACK == 1
|
||||
pusVerification->startTask();
|
||||
pusHighPrio->startTask();
|
||||
pusMedPrio->startTask();
|
||||
pusLowPrio->startTask();
|
||||
#endif /* OBSW_ADD_PUS_STACK == 1 */
|
||||
|
||||
#if OBSW_ADD_TASK_EXAMPLE == 1
|
||||
timeslotDemoTask->startTask();
|
||||
readerTask->startTask();
|
||||
#endif /* OBSW_ADD_TASK_EXAMPLE == 1 */
|
||||
|
||||
#if OBSW_ADD_DEVICE_HANDLER_DEMO == 1
|
||||
testDeviceTask->startTask();
|
||||
assemblyTask->startTask();
|
||||
#endif /* OBSW_ADD_DEVICE_HANDLER_DEMO == 1 */
|
||||
|
||||
#if OBSW_ADD_CONTROLLER_DEMO == 1
|
||||
controllerTask->startTask();
|
||||
#endif /* OBSW_ADD_CONTROLLER_DEMO == 1 */
|
||||
|
||||
testTask->startTask();
|
||||
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "Tasks started.." << std::endl;
|
||||
#else
|
||||
sif::printInfo("Tasks started..\n");
|
||||
#endif
|
||||
|
||||
|
||||
#if OBSW_ADD_DEVICE_HANDLER_DEMO
|
||||
HasModesIF* assembly = objectManager->get<HasModesIF>(objects::TEST_ASSEMBLY);
|
||||
if (assembly == nullptr){
|
||||
return;
|
||||
}
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "Waiting 5 Seconds and then command Test Assembly to Normal, Dual" << std::endl;
|
||||
#else
|
||||
sif::printInfo("Waiting 5 Seconds and then command Test Assembly to Normal, Dual \n");
|
||||
#endif
|
||||
|
||||
TaskFactory::delayTask(5000);
|
||||
CommandMessage modeMessage;
|
||||
ModeMessage::setModeMessage(&modeMessage, ModeMessage::CMD_MODE_COMMAND, DeviceHandlerIF::MODE_NORMAL, TestAssembly::submodes::DUAL);
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "Commanding Test Assembly to Normal, Dual" << std::endl;
|
||||
#else
|
||||
sif::printInfo("Commanding Test Assembly to Normal, Dual \n");
|
||||
#endif
|
||||
MessageQueueSenderIF::sendMessage(assembly->getCommandQueue(), &modeMessage, MessageQueueIF::NO_QUEUE);
|
||||
#endif
|
||||
}
|
8
bsp_linux/core/InitMission.h
Normal file
8
bsp_linux/core/InitMission.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef MISSION_CORE_INITMISSION_H_
|
||||
#define MISSION_CORE_INITMISSION_H_
|
||||
|
||||
namespace InitMission {
|
||||
void createTasks();
|
||||
};
|
||||
|
||||
#endif /* MISSION_CORE_INITMISSION_H_ */
|
59
bsp_linux/core/ObjectFactory.cpp
Normal file
59
bsp_linux/core/ObjectFactory.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
#include <OBSWConfig.h>
|
||||
|
||||
#include <bsp_linux/core/ObjectFactory.h>
|
||||
#include <bsp_linux/fsfwconfig/objects/systemObjectList.h>
|
||||
#include <bsp_linux/fsfwconfig/OBSWConfig.h>
|
||||
#include <bsp_linux/fsfwconfig/tmtc/apid.h>
|
||||
#include <bsp_linux/fsfwconfig/tmtc/pusIds.h>
|
||||
|
||||
#include <test/TestTask.h>
|
||||
|
||||
#include <mission/utility/TmFunnel.h>
|
||||
#include <mission/core/GenericFactory.h>
|
||||
|
||||
#include <fsfw/datapoollocal/LocalDataPoolManager.h>
|
||||
#include <fsfw/monitoring/MonitoringMessageContent.h>
|
||||
#include <fsfw/storagemanager/PoolManager.h>
|
||||
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
|
||||
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
||||
#include <fsfw/tmtcservices/PusServiceBase.h>
|
||||
#include <fsfw/osal/common/UdpTcPollingTask.h>
|
||||
#include <fsfw/osal/common/UdpTmTcBridge.h>
|
||||
|
||||
|
||||
void ObjectFactory::produce() {
|
||||
/* Located inside the GenericFactory source file */
|
||||
Factory::setStaticFrameworkObjectIds();
|
||||
|
||||
#if OBSW_ADD_CORE_COMPONENTS == 1
|
||||
{
|
||||
LocalPool::LocalPoolConfig poolCfg = {
|
||||
{16, 100},{32, 50}, {64, 25}, {128,15}, {1024, 5}
|
||||
};
|
||||
new PoolManager(objects::TC_STORE, poolCfg);
|
||||
}
|
||||
|
||||
{
|
||||
LocalPool::LocalPoolConfig poolCfg = {
|
||||
{16, 100},{32, 50}, {64, 25}, {128,15}, {1024, 5}
|
||||
};
|
||||
new PoolManager(objects::TM_STORE, poolCfg);
|
||||
}
|
||||
|
||||
{
|
||||
LocalPool::LocalPoolConfig poolCfg = {
|
||||
{16, 100},{32, 50}, {64, 25}, {128,15}, {1024, 5}
|
||||
};
|
||||
new PoolManager(objects::IPC_STORE, poolCfg);
|
||||
}
|
||||
|
||||
/* TMTC Reception via UDP socket */
|
||||
auto tmtcBridge = new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_DISTRIBUTOR,
|
||||
objects::TM_STORE, objects::TC_STORE);
|
||||
tmtcBridge->setMaxNumberOfPacketsStored(20);
|
||||
new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
|
||||
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
|
||||
|
||||
ObjectFactory::produceGenericObjects();
|
||||
new TestTask(objects::TEST_TASK, false);
|
||||
}
|
10
bsp_linux/core/ObjectFactory.h
Normal file
10
bsp_linux/core/ObjectFactory.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef MISSION_CORE_OBJECTFACTORY_H_
|
||||
#define MISSION_CORE_OBJECTFACTORY_H_
|
||||
|
||||
|
||||
namespace ObjectFactory {
|
||||
void setStatics();
|
||||
void produce();
|
||||
};
|
||||
|
||||
#endif /* MISSION_CORE_OBJECTFACTORY_H_ */
|
8
bsp_linux/fsfwconfig/CMakeLists.txt
Normal file
8
bsp_linux/fsfwconfig/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
ipc/missionMessageTypes.cpp
|
||||
)
|
||||
|
||||
# Add include paths for the executable
|
||||
target_include_directories(${TARGET_NAME} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
72
bsp_linux/fsfwconfig/FSFWConfig.h
Normal file
72
bsp_linux/fsfwconfig/FSFWConfig.h
Normal file
@ -0,0 +1,72 @@
|
||||
#ifndef CONFIG_FSFWCONFIG_H_
|
||||
#define CONFIG_FSFWCONFIG_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
//! Used to determine whether C++ ostreams are used which can increase
|
||||
//! the binary size significantly. If this is disabled,
|
||||
//! the C stdio functions can be used alternatively
|
||||
#define FSFW_CPP_OSTREAM_ENABLED 1
|
||||
|
||||
//! More FSFW related printouts depending on level. Useful for development.
|
||||
#define FSFW_VERBOSE_LEVEL 1
|
||||
|
||||
//! Can be used to completely disable printouts, even the C stdio ones.
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_VERBOSE_LEVEL == 0
|
||||
#define FSFW_DISABLE_PRINTOUT 0
|
||||
#endif
|
||||
|
||||
#define FSFW_USE_PUS_C_TELEMETRY 1
|
||||
|
||||
//! Can be used to disable the ANSI color sequences for C stdio.
|
||||
#define FSFW_COLORED_OUTPUT 1
|
||||
|
||||
//! 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
|
||||
//! Specify whether info events are printed too.
|
||||
#define FSFW_DEBUG_INFO 1
|
||||
#include "objects/translateObjects.h"
|
||||
#include "events/translateEvents.h"
|
||||
#else
|
||||
#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
|
||||
|
||||
//! Specify whether a special mode store is used for Subsystem components.
|
||||
#define FSFW_USE_MODESTORE 0
|
||||
|
||||
//! Defines if the real time scheduler for linux should be used.
|
||||
//! If set to 0, this will also disable priority settings for linux
|
||||
//! as most systems will not allow to set nice values without privileges
|
||||
//! For embedded linux system set this to 1.
|
||||
//! If set to 1 the binary needs "cap_sys_nice=eip" privileges to run
|
||||
#define FSFW_USE_REALTIME_FOR_LINUX 0
|
||||
|
||||
namespace fsfwconfig {
|
||||
|
||||
//! Default timestamp size. The default timestamp will be an seven byte CDC short timestamp.
|
||||
static constexpr uint8_t FSFW_MISSION_TIMESTAMP_SIZE = 7;
|
||||
|
||||
//! 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;
|
||||
|
||||
//! Defines the FIFO depth of each commanding service base which
|
||||
//! also determines how many commands a CSB service can handle in one cycle
|
||||
//! simultaneously. This will increase the required RAM for
|
||||
//! each CSB service !
|
||||
static constexpr uint8_t FSFW_CSB_FIFO_DEPTH = 6;
|
||||
|
||||
static constexpr size_t FSFW_PRINT_BUFFER_SIZE = 124;
|
||||
|
||||
}
|
||||
|
||||
#endif /* CONFIG_FSFWCONFIG_H_ */
|
25
bsp_linux/fsfwconfig/OBSWConfig.h
Normal file
25
bsp_linux/fsfwconfig/OBSWConfig.h
Normal file
@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @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 FSFWCONFIG_OBSWCONFIG_H_
|
||||
#define FSFWCONFIG_OBSWCONFIG_H_
|
||||
|
||||
#include <commonConfig.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "events/subsystemIdRanges.h"
|
||||
#include "objects/systemObjectList.h"
|
||||
|
||||
namespace config {
|
||||
#endif
|
||||
|
||||
/* Add mission configuration flags here */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FSFWCONFIG_OBSWCONFIG_H_ */
|
11
bsp_linux/fsfwconfig/events/subsystemIdRanges.h
Normal file
11
bsp_linux/fsfwconfig/events/subsystemIdRanges.h
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef FSFWCONFIG_TMTC_SUBSYSTEMIDRANGES_H_
|
||||
#define FSFWCONFIG_TMTC_SUBSYSTEMIDRANGES_H_
|
||||
|
||||
#include <commonConfig.h>
|
||||
|
||||
namespace SUBSYSTEM_ID {
|
||||
enum subsystemId: uint8_t {
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* FSFWCONFIG_TMTC_SUBSYSTEMIDRANGES_H_ */
|
8
bsp_linux/fsfwconfig/fsfwconfig.mk
Normal file
8
bsp_linux/fsfwconfig/fsfwconfig.mk
Normal file
@ -0,0 +1,8 @@
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/datapool/*.cpp)
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/events/*.cpp)
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/ipc/*.cpp)
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/objects/*.cpp)
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/pollingsequence/*.cpp)
|
||||
|
||||
INCLUDES += $(CURRENTPATH)
|
||||
INCLUDES += $(CURRENTPATH)/events
|
11
bsp_linux/fsfwconfig/ipc/missionMessageTypes.cpp
Normal file
11
bsp_linux/fsfwconfig/ipc/missionMessageTypes.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include "missionMessageTypes.h"
|
||||
#include <fsfw/ipc/CommandMessage.h>
|
||||
#include <fsfw/ipc/CommandMessageCleaner.h>
|
||||
|
||||
void messagetypes::clearMissionMessage(CommandMessage* message) {
|
||||
switch((message->getMessageType())) {
|
||||
default:
|
||||
message->setCommand(CommandMessage::CMD_NONE);
|
||||
break;
|
||||
}
|
||||
}
|
19
bsp_linux/fsfwconfig/ipc/missionMessageTypes.h
Normal file
19
bsp_linux/fsfwconfig/ipc/missionMessageTypes.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef FSFWCONFIG_IPC_MISSIONMESSAGETYPES_H_
|
||||
#define FSFWCONFIG_IPC_MISSIONMESSAGETYPES_H_
|
||||
|
||||
#include <fsfw/ipc/FwMessageTypes.h>
|
||||
|
||||
class CommandMessage;
|
||||
|
||||
namespace messagetypes {
|
||||
/* First type must have number MESSAGE_TYPE::FW_MESSAGES_COUNT! */
|
||||
/* Remember to add new message types to the clearMissionMessage function below! */
|
||||
enum MISSION_MESSAGE_TYPE {
|
||||
COSTUM_MESSAGE = FW_MESSAGES_COUNT,
|
||||
};
|
||||
|
||||
void clearMissionMessage(CommandMessage* message);
|
||||
|
||||
}
|
||||
|
||||
#endif /* FSFWCONFIG_IPC_MISSIONMESSAGETYPES_H_ */
|
17
bsp_linux/fsfwconfig/objects/systemObjectList.h
Normal file
17
bsp_linux/fsfwconfig/objects/systemObjectList.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef FSFWCONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
||||
#define FSFWCONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
||||
|
||||
#include <commonSystemObjects.h>
|
||||
|
||||
namespace objects {
|
||||
enum mission_objects: object_id_t {
|
||||
/* 0x62 ('b') Board and mission specific objects */
|
||||
UDP_BRIDGE = 0x62000300,
|
||||
UDP_POLLING_TASK = 0x62000400,
|
||||
/* Generic name for FSFW static ID setter */
|
||||
DOWNLINK_DESTINATION = UDP_BRIDGE,
|
||||
LINUX_SPI_COM_IF = 0x63000001,
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* FSFWCONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ */
|
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Add polling sequence initialization which are not common to every BSP here.
|
||||
*/
|
||||
#include "pollingSequenceFactory.h"
|
||||
|
@ -0,0 +1,14 @@
|
||||
#ifndef POLLINGSEQUENCE_POLLINGSEQUENCFACTORY_H_
|
||||
#define POLLINGSEQUENCE_POLLINGSEQUENCFACTORY_H_
|
||||
|
||||
#include <bsp_hosted/fsfwconfig/OBSWConfig.h>
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
|
||||
class FixedTimeslotTaskIF;
|
||||
|
||||
namespace pst {
|
||||
ReturnValue_t pollingSequenceExamples(FixedTimeslotTaskIF *thisSequence);
|
||||
ReturnValue_t pollingSequenceDevices(FixedTimeslotTaskIF* thisSequence);
|
||||
}
|
||||
|
||||
#endif /* POLLINGSEQUENCE_POLLINGSEQUENCFACTORY_H_ */
|
14
bsp_linux/fsfwconfig/returnvalues/classIds.h
Normal file
14
bsp_linux/fsfwconfig/returnvalues/classIds.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef FSFWCONFIG_RETURNVALUES_CLASSIDS_H_
|
||||
#define FSFWCONFIG_RETURNVALUES_CLASSIDS_H_
|
||||
|
||||
#include <commonConfig.h>
|
||||
|
||||
namespace CLASS_ID {
|
||||
enum classIds: uint8_t {
|
||||
LINUX_LIBGPIO_IF = COMMON_CLASS_ID_COUNT + 1,
|
||||
LINUX_SPI_COM_IF
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif /* FSFWCONFIG_RETURNVALUES_CLASSIDS_H_ */
|
11
bsp_linux/fsfwconfig/tmtc/apid.h
Normal file
11
bsp_linux/fsfwconfig/tmtc/apid.h
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef FSFWCONFIG_TMTC_APID_H_
|
||||
#define FSFWCONFIG_TMTC_APID_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <commonConfig.h>
|
||||
|
||||
namespace apid {
|
||||
static const uint16_t APID = COMMON_APID;
|
||||
};
|
||||
|
||||
#endif /* FSFWCONFIG_TMTC_APID_H_ */
|
6
bsp_linux/fsfwconfig/tmtc/pusIds.h
Normal file
6
bsp_linux/fsfwconfig/tmtc/pusIds.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef FSFWCONFIG_TMTC_PUSIDS_H_
|
||||
#define FSFWCONFIG_TMTC_PUSIDS_H_
|
||||
|
||||
#include <commonConfig.h>
|
||||
|
||||
#endif /* FSFWCONFIG_TMTC_PUSIDS_H_ */
|
72
bsp_linux/main.cpp
Normal file
72
bsp_linux/main.cpp
Normal file
@ -0,0 +1,72 @@
|
||||
#include <bsp_hosted/core/InitMission.h>
|
||||
#include <bsp_hosted/core/ObjectFactory.h>
|
||||
|
||||
#include <test/MutexExample.h>
|
||||
#include <mission/utility/PusPacketCreator.h>
|
||||
#include <common/utility/utility.h>
|
||||
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
|
||||
#if defined(RASPBERRY_PI)
|
||||
static const char* COMPILE_PRINTOUT = "Raspberry Pi";
|
||||
#elif defined(BEAGLE_BONE_BLACK)
|
||||
static const char* COMPILE_PRINTOUT = "Beagle Bone Black";
|
||||
#elif defined(LINUX)
|
||||
static const char* COMPILE_PRINTOUT = "Host";
|
||||
#else
|
||||
static const char* COMPILE_PRINTOUT = "Unknown device";
|
||||
#endif
|
||||
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
/* On Linux, no carriage return is added. */
|
||||
ServiceInterfaceStream sif::debug("DEBUG");
|
||||
ServiceInterfaceStream sif::info("INFO");
|
||||
ServiceInterfaceStream sif::warning("WARNING");
|
||||
ServiceInterfaceStream sif::error("ERROR", false, false, true);
|
||||
#endif
|
||||
|
||||
ObjectManagerIF *objectManager = nullptr;
|
||||
|
||||
int main() {
|
||||
|
||||
utility::commonInitPrint("Linux", COMPILE_PRINTOUT);
|
||||
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "Producing system objects.." << std::endl;
|
||||
#else
|
||||
sif::printInfo("Producing system objects..\n");
|
||||
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||
|
||||
objectManager = new ObjectManager(ObjectFactory::produce);
|
||||
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "Objects created successfully.." << std::endl;
|
||||
sif::info << "Initializing objects.." << std::endl;
|
||||
#else
|
||||
sif::printInfo("Objects created successfully..\n");
|
||||
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||
|
||||
objectManager->initialize();
|
||||
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "Creating tasks.." << std::endl;
|
||||
#else
|
||||
sif::printInfo("Creating tasks..\n");
|
||||
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||
|
||||
InitMission::createTasks();
|
||||
|
||||
MutexExample::example();
|
||||
PusPacketCreator::createPusPacketAndPrint();
|
||||
|
||||
|
||||
|
||||
/* Permanent loop. */
|
||||
for(;;) {
|
||||
/* Sleep main thread, not needed anymore. */
|
||||
TaskFactory::delayTask(5000);
|
||||
}
|
||||
return 0;
|
||||
}
|
7
bsp_linux/test/CMakeLists.txt
Normal file
7
bsp_linux/test/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
target_sources(${TARGET_NAME}
|
||||
PUBLIC
|
||||
SpiTest.cpp
|
||||
)
|
||||
|
||||
|
||||
|
4
bsp_linux/test/SpiTest.cpp
Normal file
4
bsp_linux/test/SpiTest.cpp
Normal file
@ -0,0 +1,4 @@
|
||||
#include "SpiTest.h"
|
||||
|
||||
SpiTest::SpiTest(object_id_t objectId): SystemObject(objectId) {
|
||||
}
|
15
bsp_linux/test/SpiTest.h
Normal file
15
bsp_linux/test/SpiTest.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef BSP_LINUX_TEST_SPITEST_H_
|
||||
#define BSP_LINUX_TEST_SPITEST_H_
|
||||
|
||||
#include <fsfw/objectmanager/SystemObject.h>
|
||||
#include <fsfw/tasks/ExecutableObjectIF.h>
|
||||
|
||||
class SpiTest: public ExecutableObjectIF, SystemObject {
|
||||
public:
|
||||
SpiTest(object_id_t objectId);
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif /* BSP_LINUX_TEST_SPITEST_H_ */
|
7
bsp_linux/utility/CMakeLists.txt
Normal file
7
bsp_linux/utility/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
target_sources(${TARGET_NAME}
|
||||
PUBLIC
|
||||
printChar.c
|
||||
)
|
||||
|
||||
|
||||
|
12
bsp_linux/utility/printChar.c
Normal file
12
bsp_linux/utility/printChar.c
Normal file
@ -0,0 +1,12 @@
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
void printChar(const char* character, bool errStream) {
|
||||
if(errStream) {
|
||||
fprintf( stderr, "%c", *character);
|
||||
} else {
|
||||
printf("%c", *character);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user