adding unittests for EIVE
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
This commit is contained in:
parent
74fa4835e2
commit
ababb5c062
@ -60,26 +60,34 @@ set(LIB_LWGPS_NAME lwgps)
|
|||||||
set(LIB_ARCSEC wire)
|
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_JSON_NAME nlohmann_json::nlohmann_json)
|
set(LIB_JSON_NAME nlohmann_json::nlohmann_json)
|
||||||
|
|
||||||
# Set path names
|
# Set path names
|
||||||
set(FSFW_PATH fsfw)
|
set(FSFW_PATH fsfw)
|
||||||
set(MISSION_PATH mission)
|
set(MISSION_PATH mission)
|
||||||
set(TEST_PATH test/testtasks)
|
set(TEST_PATH test/testtasks)
|
||||||
|
set(UNITTEST_PATH unittest)
|
||||||
set(LINUX_PATH linux)
|
set(LINUX_PATH linux)
|
||||||
set(COMMON_PATH common)
|
set(COMMON_PATH common)
|
||||||
set(WATCHDOG_PATH watchdog)
|
set(WATCHDOG_PATH watchdog)
|
||||||
set(COMMON_CONFIG_PATH ${COMMON_PATH}/config)
|
set(COMMON_CONFIG_PATH ${COMMON_PATH}/config)
|
||||||
|
|
||||||
set(FSFW_HAL_LIB_PATH fsfw_hal)
|
set(LIB_CSP_PATH ${THIRD_PARTY_FOLDER}/libcsp)
|
||||||
set(CSP_LIB_PATH ${THIRD_PARTY_FOLDER}/libcsp)
|
set(LIB_ETL_PATH ${THIRD_PARTY_FOLDER}/etl)
|
||||||
set(ETL_LIB_PATH ${THIRD_PARTY_FOLDER}/etl)
|
set(LIB_CATCH2_PATH ${THIRD_PARTY_FOLDER}/Catch2)
|
||||||
set(LWGPS_LIB_PATH ${THIRD_PARTY_FOLDER}/lwgps)
|
set(LIB_LWGPS_PATH ${THIRD_PARTY_FOLDER}/lwgps)
|
||||||
set(ARCSEC_LIB_PATH ${THIRD_PARTY_FOLDER}/arcsec_star_tracker)
|
set(LIB_ARCSEC_PATH ${THIRD_PARTY_FOLDER}/arcsec_star_tracker)
|
||||||
set(LIB_JSON_PATH ${THIRD_PARTY_FOLDER}/json)
|
set(LIB_JSON_PATH ${THIRD_PARTY_FOLDER}/json)
|
||||||
|
|
||||||
set(FSFW_WARNING_SHADOW_LOCAL_GCC OFF)
|
set(FSFW_WARNING_SHADOW_LOCAL_GCC OFF)
|
||||||
set(ADD_LINUX_FILES False)
|
set(EIVE_ADD_LINUX_FILES False)
|
||||||
|
|
||||||
|
if(FSFW_CUSTOM_UNITTEST_RUNNER OR FSFW_ADD_UNITTESTS)
|
||||||
|
set(CATCH2_TARGET Catch2)
|
||||||
|
else()
|
||||||
|
set(CATCH2_TARGET Catch2WithMain)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Analyse different OS and architecture/target options, determine BSP_PATH,
|
# Analyse different OS and architecture/target options, determine BSP_PATH,
|
||||||
# display information about compiler etc.
|
# display information about compiler etc.
|
||||||
@ -92,7 +100,7 @@ if(TGT_BSP)
|
|||||||
)
|
)
|
||||||
set(FSFW_CONFIG_PATH "linux/fsfwconfig")
|
set(FSFW_CONFIG_PATH "linux/fsfwconfig")
|
||||||
if(NOT BUILD_Q7S_SIMPLE_MODE)
|
if(NOT BUILD_Q7S_SIMPLE_MODE)
|
||||||
set(ADD_LINUX_FILES TRUE)
|
set(EIVE_ADD_LINUX_FILES TRUE)
|
||||||
set(ADD_CSP_LIB TRUE)
|
set(ADD_CSP_LIB TRUE)
|
||||||
set(FSFW_HAL_ADD_LINUX ON)
|
set(FSFW_HAL_ADD_LINUX ON)
|
||||||
endif()
|
endif()
|
||||||
@ -145,7 +153,7 @@ set(FSFW_ADDITIONAL_INC_PATHS
|
|||||||
add_executable(${TARGET_NAME})
|
add_executable(${TARGET_NAME})
|
||||||
|
|
||||||
if(EIVE_ADD_ETL_LIB)
|
if(EIVE_ADD_ETL_LIB)
|
||||||
add_subdirectory(${ETL_LIB_PATH})
|
add_subdirectory(${LIB_ETL_PATH})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(EIVE_ADD_JSON_LIB)
|
if(EIVE_ADD_JSON_LIB)
|
||||||
@ -153,22 +161,26 @@ if(EIVE_ADD_JSON_LIB)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT EIVE_BUILD_WATCHDOG)
|
if(NOT EIVE_BUILD_WATCHDOG)
|
||||||
if(ADD_LINUX_FILES)
|
if(EIVE_ADD_LINUX_FILES)
|
||||||
add_subdirectory(${LINUX_PATH})
|
add_subdirectory(${LINUX_PATH})
|
||||||
endif()
|
endif()
|
||||||
add_subdirectory(${BSP_PATH})
|
add_subdirectory(${BSP_PATH})
|
||||||
add_subdirectory(${COMMON_PATH})
|
add_subdirectory(${COMMON_PATH})
|
||||||
if(ADD_CSP_LIB)
|
if(ADD_CSP_LIB)
|
||||||
add_subdirectory(${CSP_LIB_PATH})
|
add_subdirectory(${LIB_CSP_PATH})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG))
|
if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG))
|
||||||
add_subdirectory(${LWGPS_LIB_PATH})
|
add_subdirectory(${LIB_LWGPS_PATH})
|
||||||
add_subdirectory(${FSFW_PATH})
|
add_subdirectory(${FSFW_PATH})
|
||||||
add_subdirectory(${MISSION_PATH})
|
add_subdirectory(${MISSION_PATH})
|
||||||
add_subdirectory(${TEST_PATH})
|
add_subdirectory(${TEST_PATH})
|
||||||
add_subdirectory(${ARCSEC_LIB_PATH})
|
add_subdirectory(${LIB_ARCSEC_PATH})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(EIVE_BUILD_UNITTEST)
|
||||||
|
add_subdirectory(${UNITTEST_PATH})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(EIVE_BUILD_WATCHDOG)
|
if(EIVE_BUILD_WATCHDOG)
|
||||||
@ -196,6 +208,7 @@ if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG))
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(NOT EIVE_BUILD_WATCHDOG)
|
if(NOT EIVE_BUILD_WATCHDOG)
|
||||||
if(ADD_CSP_LIB)
|
if(ADD_CSP_LIB)
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
target_link_libraries(${TARGET_NAME} PRIVATE
|
||||||
@ -216,6 +229,12 @@ if(EIVE_ADD_JSON_LIB)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(EIVE_BUILD_UNITTEST)
|
||||||
|
target_link_libraries(${TARGET_NAME} PRIVATE
|
||||||
|
${CATCH2_TARGET}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
target_link_libraries(${TARGET_NAME} PRIVATE
|
||||||
${LIB_CXX_FS}
|
${LIB_CXX_FS}
|
||||||
)
|
)
|
||||||
@ -225,7 +244,7 @@ target_include_directories(${TARGET_NAME} PRIVATE
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${FSFW_CONFIG_PATH}
|
${FSFW_CONFIG_PATH}
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
${ARCSEC_LIB_PATH}
|
${LIB_ARCSEC_PATH}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/q7s")
|
if(TGT_BSP MATCHES "arm/q7s")
|
||||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
|||||||
Subproject commit 5ee315f8ca3b0bb27d5a368948ecd115c6a055c9
|
Subproject commit 354e158cc196d7deaf7de24ebcc96f5f6f5f20eb
|
1
unittest/CMakeLists.txt
Normal file
1
unittest/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
add_subdirectory(testcfg)
|
9
unittest/testcfg/CMakeLists.txt
Normal file
9
unittest/testcfg/CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
target_sources(${TARGET_NAME} PRIVATE
|
||||||
|
ipc/MissionMessageTypes.cpp
|
||||||
|
pollingsequence/PollingSequenceFactory.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
# Add include paths for the executable
|
||||||
|
target_include_directories(${TARGET_NAME} PUBLIC
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
)
|
78
unittest/testcfg/FSFWConfig.h.in
Normal file
78
unittest/testcfg/FSFWConfig.h.in
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
#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 0
|
||||||
|
|
||||||
|
//! More FSFW related printouts. Useful for development.
|
||||||
|
#define FSFW_ENHANCED_PRINTOUT 0
|
||||||
|
|
||||||
|
//! Can be used to completely disable printouts, even the C stdio ones.
|
||||||
|
//! By default, printouts will be disabled for the unit tests.
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_ENHANCED_PRINTOUT == 0
|
||||||
|
#ifndef FSFW_DISABLE_PRINTOUT
|
||||||
|
#define FSFW_DISABLE_PRINTOUT 1
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//! Can be used to enable additional debugging printouts for developing the FSFW
|
||||||
|
#define FSFW_PRINT_VERBOSITY_LEVEL 0
|
||||||
|
|
||||||
|
//! Can be used to disable the ANSI color sequences for C stdio.
|
||||||
|
#define FSFW_COLORED_OUTPUT 0
|
||||||
|
|
||||||
|
//! 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 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;
|
||||||
|
|
||||||
|
//! 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 !
|
||||||
|
static constexpr uint8_t FSFW_CSB_FIFO_DEPTH = 6;
|
||||||
|
|
||||||
|
static constexpr size_t FSFW_PRINT_BUFFER_SIZE = 124;
|
||||||
|
|
||||||
|
static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 1500;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_FSFWCONFIG_H_ */
|
8
unittest/testcfg/OBSWConfig.h.in
Normal file
8
unittest/testcfg/OBSWConfig.h.in
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef TESTCFG_OBSWCONFIG_H_
|
||||||
|
#define TESTCFG_OBSWCONFIG_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* TESTCFG_OBSWCONFIG_H_ */
|
21
unittest/testcfg/TestsConfig.h.in
Normal file
21
unittest/testcfg/TestsConfig.h.in
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#ifndef FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_
|
||||||
|
#define FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_
|
||||||
|
|
||||||
|
#define FSFW_ADD_DEFAULT_FACTORY_FUNCTIONS 1
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
#include "objects/systemObjectList.h"
|
||||||
|
#include "events/subsystemIdRanges.h"
|
||||||
|
#include "returnvalues/classIds.h"
|
||||||
|
|
||||||
|
namespace config {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Add mission configuration flags here */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_ */
|
5
unittest/testcfg/devices/logicalAddresses.cpp
Normal file
5
unittest/testcfg/devices/logicalAddresses.cpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#include "logicalAddresses.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
15
unittest/testcfg/devices/logicalAddresses.h
Normal file
15
unittest/testcfg/devices/logicalAddresses.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef CONFIG_DEVICES_LOGICALADDRESSES_H_
|
||||||
|
#define CONFIG_DEVICES_LOGICALADDRESSES_H_
|
||||||
|
|
||||||
|
#include <fsfw/devicehandlers/CookieIF.h>
|
||||||
|
#include <fsfw/unittest/config/objects/systemObjectList.h>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace addresses {
|
||||||
|
/* Logical addresses have uint32_t datatype */
|
||||||
|
enum logicalAddresses: address_t {
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* CONFIG_DEVICES_LOGICALADDRESSES_H_ */
|
4
unittest/testcfg/devices/powerSwitcherList.cpp
Normal file
4
unittest/testcfg/devices/powerSwitcherList.cpp
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#include "powerSwitcherList.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
12
unittest/testcfg/devices/powerSwitcherList.h
Normal file
12
unittest/testcfg/devices/powerSwitcherList.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#ifndef CONFIG_DEVICES_POWERSWITCHERLIST_H_
|
||||||
|
#define CONFIG_DEVICES_POWERSWITCHERLIST_H_
|
||||||
|
|
||||||
|
namespace switches {
|
||||||
|
/* Switches are uint8_t datatype and go from 0 to 255 */
|
||||||
|
enum switcherList {
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* CONFIG_DEVICES_POWERSWITCHERLIST_H_ */
|
18
unittest/testcfg/events/subsystemIdRanges.h
Normal file
18
unittest/testcfg/events/subsystemIdRanges.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
|
||||||
|
#define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <fsfw/events/fwSubsystemIdRanges.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Custom subsystem IDs can be added here
|
||||||
|
* @details
|
||||||
|
* Subsystem IDs are used to create unique events.
|
||||||
|
*/
|
||||||
|
namespace SUBSYSTEM_ID {
|
||||||
|
enum: uint8_t {
|
||||||
|
SUBSYSTEM_ID_START = FW_SUBSYSTEM_ID_RANGE,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ */
|
12
unittest/testcfg/ipc/MissionMessageTypes.cpp
Normal file
12
unittest/testcfg/ipc/MissionMessageTypes.cpp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include "MissionMessageTypes.h"
|
||||||
|
|
||||||
|
#include <fsfw/ipc/CommandMessage.h>
|
||||||
|
|
||||||
|
void messagetypes::clearMissionMessage(CommandMessage* message) {
|
||||||
|
switch(message->getMessageType()) {
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
22
unittest/testcfg/ipc/MissionMessageTypes.h
Normal file
22
unittest/testcfg/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_ */
|
32
unittest/testcfg/objects/systemObjectList.h
Normal file
32
unittest/testcfg/objects/systemObjectList.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#ifndef HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
||||||
|
#define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <fsfw/objectmanager/frameworkObjects.h>
|
||||||
|
|
||||||
|
// The objects will be instantiated in the ID order
|
||||||
|
namespace objects {
|
||||||
|
enum sourceObjects: uint32_t {
|
||||||
|
/* All addresses between start and end are reserved for the FSFW */
|
||||||
|
FSFW_CONFIG_RESERVED_START = PUS_SERVICE_1_VERIFICATION,
|
||||||
|
FSFW_CONFIG_RESERVED_END = TM_STORE,
|
||||||
|
|
||||||
|
CCSDS_DISTRIBUTOR = 10,
|
||||||
|
PUS_DISTRIBUTOR = 11,
|
||||||
|
TM_FUNNEL = 12,
|
||||||
|
|
||||||
|
UDP_BRIDGE = 15,
|
||||||
|
UDP_POLLING_TASK = 16,
|
||||||
|
|
||||||
|
TEST_ECHO_COM_IF = 20,
|
||||||
|
TEST_DEVICE = 21,
|
||||||
|
|
||||||
|
HK_RECEIVER_MOCK = 22,
|
||||||
|
TEST_LOCAL_POOL_OWNER_BASE = 25,
|
||||||
|
|
||||||
|
SHARED_SET_ID = 26
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* BSP_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ */
|
39
unittest/testcfg/pollingsequence/PollingSequenceFactory.cpp
Normal file
39
unittest/testcfg/pollingsequence/PollingSequenceFactory.cpp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#include "PollingSequenceFactory.h"
|
||||||
|
|
||||||
|
#include <TestsConfig.h>
|
||||||
|
|
||||||
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||||
|
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||||
|
|
||||||
|
ReturnValue_t pst::pollingSequenceInitDefault(
|
||||||
|
FixedTimeslotTaskIF *thisSequence) {
|
||||||
|
/* Length of a communication cycle */
|
||||||
|
uint32_t length = thisSequence->getPeriodMs();
|
||||||
|
|
||||||
|
/* Add polling sequence table here */
|
||||||
|
thisSequence->addSlot(objects::TEST_DEVICE, 0,
|
||||||
|
DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::TEST_DEVICE, 0.3,
|
||||||
|
DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::TEST_DEVICE, 0.45 * length,
|
||||||
|
DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::TEST_DEVICE, 0.6 * length,
|
||||||
|
DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::TEST_DEVICE, 0.8 * length,
|
||||||
|
DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED
|
||||||
|
sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!"
|
||||||
|
<< std::endl;
|
||||||
|
#else
|
||||||
|
sif::printError("pst::pollingSequenceInitDefault: Sequence invalid!");
|
||||||
|
#endif
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
32
unittest/testcfg/pollingsequence/PollingSequenceFactory.h
Normal file
32
unittest/testcfg/pollingsequence/PollingSequenceFactory.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#ifndef POLLINGSEQUENCEFACTORY_H_
|
||||||
|
#define POLLINGSEQUENCEFACTORY_H_
|
||||||
|
|
||||||
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
|
|
||||||
|
class FixedTimeslotTaskIF;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All device handlers are scheduled by adding them into Polling Sequence Tables (PST)
|
||||||
|
* to satisfy stricter timing requirements of device communication,
|
||||||
|
* A device handler has four different communication steps:
|
||||||
|
* 1. DeviceHandlerIF::SEND_WRITE -> Send write via interface
|
||||||
|
* 2. DeviceHandlerIF::GET_WRITE -> Get confirmation for write
|
||||||
|
* 3. DeviceHandlerIF::SEND_READ -> Send read request
|
||||||
|
* 4. DeviceHandlerIF::GET_READ -> Read from interface
|
||||||
|
* The PST specifies precisely when the respective ComIF functions are called
|
||||||
|
* during the communication cycle time.
|
||||||
|
* The task is created using the FixedTimeslotTaskIF,
|
||||||
|
* which utilises the underlying Operating System Abstraction Layer (OSAL)
|
||||||
|
*
|
||||||
|
* @param thisSequence FixedTimeslotTaskIF * object is passed inside the Factory class when creating the PST
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
namespace pst {
|
||||||
|
|
||||||
|
/* Default PST */
|
||||||
|
ReturnValue_t pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* POLLINGSEQUENCEINIT_H_ */
|
16
unittest/testcfg/returnvalues/classIds.h
Normal file
16
unittest/testcfg/returnvalues/classIds.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#ifndef CONFIG_RETURNVALUES_CLASSIDS_H_
|
||||||
|
#define CONFIG_RETURNVALUES_CLASSIDS_H_
|
||||||
|
|
||||||
|
#include <fsfw/returnvalues/FwClassIds.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CLASS_ID defintions which are required for custom returnvalues.
|
||||||
|
*/
|
||||||
|
namespace CLASS_ID {
|
||||||
|
enum {
|
||||||
|
MISSION_CLASS_ID_START = FW_CLASS_ID_COUNT,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* CONFIG_RETURNVALUES_CLASSIDS_H_ */
|
18
unittest/testcfg/tmtc/apid.h
Normal file
18
unittest/testcfg/tmtc/apid.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef CONFIG_TMTC_APID_H_
|
||||||
|
#define CONFIG_TMTC_APID_H_
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Application Process Definition: entity, uniquely identified by an
|
||||||
|
* application process ID (APID), capable of generating telemetry source
|
||||||
|
* packets and receiving telecommand packets.
|
||||||
|
*
|
||||||
|
* Chose APID(s) for mission and define it here.
|
||||||
|
*/
|
||||||
|
namespace apid {
|
||||||
|
static const uint16_t DEFAULT_APID = 0x00;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* CONFIG_TMTC_APID_H_ */
|
25
unittest/testcfg/tmtc/pusIds.h
Normal file
25
unittest/testcfg/tmtc/pusIds.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#ifndef CONFIG_TMTC_PUSIDS_HPP_
|
||||||
|
#define CONFIG_TMTC_PUSIDS_HPP_
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace pus {
|
||||||
|
enum Ids: uint8_t {
|
||||||
|
PUS_SERVICE_1 = 1,
|
||||||
|
PUS_SERVICE_2 = 2,
|
||||||
|
PUS_SERVICE_3 = 3,
|
||||||
|
PUS_SERVICE_5 = 5,
|
||||||
|
PUS_SERVICE_6 = 6,
|
||||||
|
PUS_SERVICE_8 = 8,
|
||||||
|
PUS_SERVICE_9 = 9,
|
||||||
|
PUS_SERVICE_11 = 11,
|
||||||
|
PUS_SERVICE_17 = 17,
|
||||||
|
PUS_SERVICE_19 = 19,
|
||||||
|
PUS_SERVICE_20 = 20,
|
||||||
|
PUS_SERVICE_23 = 23,
|
||||||
|
PUS_SERVICE_200 = 200,
|
||||||
|
PUS_SERVICE_201 = 201,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* CONFIG_TMTC_PUSIDS_HPP_ */
|
Loading…
Reference in New Issue
Block a user