Merge branch 'development' into mueller/dhb-docs

This commit is contained in:
Ulrich Mohr 2022-02-14 16:34:47 +01:00
commit 918783774f
13 changed files with 57 additions and 52 deletions

View File

@ -70,7 +70,7 @@ ReturnValue_t UioMapper::getMapSize(size_t* size) {
} }
uint32_t sizeTmp = 0; uint32_t sizeTmp = 0;
items = sscanf(hexstring, "%x", &sizeTmp); items = sscanf(hexstring, "%x", &sizeTmp);
if(size != nullptr) { if (size != nullptr) {
*size = sizeTmp; *size = sizeTmp;
} }
if (items != 1) { if (items != 1) {

View File

@ -143,6 +143,9 @@ def handle_tests_type(args, build_dir_list: list):
if which("valgrind") is None: if which("valgrind") is None:
print("Please install valgrind first") print("Please install valgrind first")
sys.exit(1) sys.exit(1)
if os.path.split(os.getcwd())[1] != UNITTEST_FOLDER_NAME:
# If we are in a different directory we try to switch into it but
# this might fail
os.chdir(UNITTEST_FOLDER_NAME) os.chdir(UNITTEST_FOLDER_NAME)
os.system("valgrind --leak-check=full ./fsfw-tests") os.system("valgrind --leak-check=full ./fsfw-tests")
os.chdir("..") os.chdir("..")

View File

@ -30,7 +30,7 @@ class DataLinkLayer : public CCSDSReturnValuesIF {
//! [EXPORT] : [COMMENT] A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0 //! [EXPORT] : [COMMENT] A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0
static const Event BIT_LOCK_LOST = MAKE_EVENT(3, severity::INFO); static const Event BIT_LOCK_LOST = MAKE_EVENT(3, severity::INFO);
// static const Event RF_CHAIN_LOST = MAKE_EVENT(4, severity::INFO); //!< The CCSDS Board // static const Event RF_CHAIN_LOST = MAKE_EVENT(4, severity::INFO); //!< The CCSDS Board
//detected that either bit lock or RF available or both are lost. No parameters. // detected that either bit lock or RF available or both are lost. No parameters.
//! [EXPORT] : [COMMENT] The CCSDS Board could not interpret a TC //! [EXPORT] : [COMMENT] The CCSDS Board could not interpret a TC
static const Event FRAME_PROCESSING_FAILED = MAKE_EVENT(5, severity::LOW); static const Event FRAME_PROCESSING_FAILED = MAKE_EVENT(5, severity::LOW);
/** /**

View File

@ -30,9 +30,9 @@ ReturnValue_t VirtualChannelReception::mapDemultiplexing(TcTransferFrame* frame)
mapChannelIterator iter = mapChannels.find(mapId); mapChannelIterator iter = mapChannels.find(mapId);
if (iter == mapChannels.end()) { if (iter == mapChannels.end()) {
// error << "VirtualChannelReception::mapDemultiplexing on VC " << std::hex << (int) // error << "VirtualChannelReception::mapDemultiplexing on VC " << std::hex << (int)
//channelId // channelId
// << ": MapChannel " << (int) mapId << std::dec << " not found." << // << ": MapChannel " << (int) mapId << std::dec << " not found." <<
//std::endl; // std::endl;
return VC_NOT_FOUND; return VC_NOT_FOUND;
} else { } else {
return (iter->second)->extractPackets(frame); return (iter->second)->extractPackets(frame);

View File

@ -116,8 +116,8 @@ uint16_t CRC::crc16ccitt(uint8_t const input[], uint32_t length, uint16_t starti
// for (int i=0; i<16 ;i++) // for (int i=0; i<16 ;i++)
// { // {
// if (xor_out[i] == true) // if (xor_out[i] == true)
// crc_value = crc_value + pow(2,(15 -i)); // reverse CrC result before Final // crc_value = crc_value + pow(2,(15 -i)); // reverse CrC result before
//XOR //Final XOR
// } // }
// //
// crc_value = 0;// for debug mode // crc_value = 0;// for debug mode

View File

@ -14,30 +14,30 @@ class ModeMessage {
static const uint8_t MESSAGE_ID = messagetypes::MODE_COMMAND; static const uint8_t MESSAGE_ID = messagetypes::MODE_COMMAND;
static const Command_t CMD_MODE_COMMAND = static const Command_t CMD_MODE_COMMAND =
MAKE_COMMAND_ID(0x01); //!> Command to set the specified Mode, replies are: REPLY_MODE_REPLY, MAKE_COMMAND_ID(0x01); //!> Command to set the specified Mode, replies are: REPLY_MODE_REPLY,
//!REPLY_WRONG_MODE_REPLY, and REPLY_REJECTED; don't add any replies, //! REPLY_WRONG_MODE_REPLY, and REPLY_REJECTED; don't add any replies,
//!as this will break the subsystem mode machine!! //! as this will break the subsystem mode machine!!
static const Command_t CMD_MODE_COMMAND_FORCED = MAKE_COMMAND_ID( static const Command_t CMD_MODE_COMMAND_FORCED = MAKE_COMMAND_ID(
0xF1); //!> Command to set the specified Mode, regardless of external control flag, replies 0xF1); //!> Command to set the specified Mode, regardless of external control flag, replies
//!are: REPLY_MODE_REPLY, REPLY_WRONG_MODE_REPLY, and REPLY_REJECTED; don't add any //! are: REPLY_MODE_REPLY, REPLY_WRONG_MODE_REPLY, and REPLY_REJECTED; don't add any
//!replies, as this will break the subsystem mode machine!! //! replies, as this will break the subsystem mode machine!!
static const Command_t REPLY_MODE_REPLY = static const Command_t REPLY_MODE_REPLY =
MAKE_COMMAND_ID(0x02); //!> Reply to a CMD_MODE_COMMAND or CMD_MODE_READ MAKE_COMMAND_ID(0x02); //!> Reply to a CMD_MODE_COMMAND or CMD_MODE_READ
static const Command_t REPLY_MODE_INFO = static const Command_t REPLY_MODE_INFO =
MAKE_COMMAND_ID(0x03); //!> Unrequested info about the current mode (used for composites to MAKE_COMMAND_ID(0x03); //!> Unrequested info about the current mode (used for composites to
//!inform their container of a changed mode) //! inform their container of a changed mode)
static const Command_t REPLY_CANT_REACH_MODE = MAKE_COMMAND_ID( static const Command_t REPLY_CANT_REACH_MODE = MAKE_COMMAND_ID(
0x04); //!> Reply in case a mode command can't be executed. Par1: returnCode, Par2: 0 0x04); //!> Reply in case a mode command can't be executed. Par1: returnCode, Par2: 0
static const Command_t REPLY_WRONG_MODE_REPLY = static const Command_t REPLY_WRONG_MODE_REPLY =
MAKE_COMMAND_ID(0x05); //!> Reply to a CMD_MODE_COMMAND, indicating that a mode was commanded MAKE_COMMAND_ID(0x05); //!> Reply to a CMD_MODE_COMMAND, indicating that a mode was commanded
//!and a transition started but was aborted; the parameters contain //! and a transition started but was aborted; the parameters contain
//!the mode that was reached //! the mode that was reached
static const Command_t CMD_MODE_READ = MAKE_COMMAND_ID( static const Command_t CMD_MODE_READ = MAKE_COMMAND_ID(
0x06); //!> Command to read the current mode and reply with a REPLY_MODE_REPLY 0x06); //!> Command to read the current mode and reply with a REPLY_MODE_REPLY
static const Command_t CMD_MODE_ANNOUNCE = MAKE_COMMAND_ID( static const Command_t CMD_MODE_ANNOUNCE = MAKE_COMMAND_ID(
0x07); //!> Command to trigger an ModeInfo Event. This command does NOT have a reply. 0x07); //!> Command to trigger an ModeInfo Event. This command does NOT have a reply.
static const Command_t CMD_MODE_ANNOUNCE_RECURSIVELY = static const Command_t CMD_MODE_ANNOUNCE_RECURSIVELY =
MAKE_COMMAND_ID(0x08); //!> Command to trigger an ModeInfo Event and to send this command to MAKE_COMMAND_ID(0x08); //!> Command to trigger an ModeInfo Event and to send this command to
//!every child. This command does NOT have a reply. //! every child. This command does NOT have a reply.
static Mode_t getMode(const CommandMessage* message); static Mode_t getMode(const CommandMessage* message);
static Submode_t getSubmode(const CommandMessage* message); static Submode_t getSubmode(const CommandMessage* message);

View File

@ -65,8 +65,8 @@ class PeriodicPosixTask : public PosixThread, public PeriodicTaskIF {
/** /**
* @brief The function containing the actual functionality of the task. * @brief The function containing the actual functionality of the task.
* @details The method sets and starts * @details The method sets and starts
* the task's period, then enters a loop that is repeated indefinitely. Within the loop, * the task's period, then enters a loop that is repeated indefinitely. Within the
* all performOperation methods of the added objects are called. Afterwards the task will be * loop, all performOperation methods of the added objects are called. Afterwards the task will be
* blocked until the next period. On missing the deadline, the deadlineMissedFunction is executed. * blocked until the next period. On missing the deadline, the deadlineMissedFunction is executed.
*/ */
virtual void taskFunctionality(void); virtual void taskFunctionality(void);

View File

@ -13,8 +13,8 @@ class ExecutableObjectIF;
* @brief This class represents a specialized task for periodic activities of multiple objects. * @brief This class represents a specialized task for periodic activities of multiple objects.
* *
* @details MultiObjectTask is an extension to ObjectTask in the way that it is able to execute * @details MultiObjectTask is an extension to ObjectTask in the way that it is able to execute
* multiple objects that implement the ExecutableObjectIF interface. The objects must * multiple objects that implement the ExecutableObjectIF interface. The objects
* be added prior to starting the task. * must be added prior to starting the task.
* @author baetz * @author baetz
* @ingroup task_handling * @ingroup task_handling
*/ */

View File

@ -25,8 +25,8 @@ class RTEMSTaskBase {
* all other attributes are set with default values. * all other attributes are set with default values.
* @param priority Sets the priority of a task. Values range from a low 0 to a high 99. * @param priority Sets the priority of a task. Values range from a low 0 to a high 99.
* @param stack_size The stack size reserved by the operating system for the task. * @param stack_size The stack size reserved by the operating system for the task.
* @param nam The name of the Task, as a null-terminated String. Currently max 4 chars * @param nam The name of the Task, as a null-terminated String. Currently max 4
* supported (excluding Null-terminator), rest will be truncated * chars supported (excluding Null-terminator), rest will be truncated
*/ */
RTEMSTaskBase(rtems_task_priority priority, size_t stack_size, const char *name); RTEMSTaskBase(rtems_task_priority priority, size_t stack_size, const char *name);
/** /**

View File

@ -51,9 +51,9 @@ class RMAP : public HasReturnvaluesIF {
// MAKE_RETURN_CODE(0xE4); //the data that was to be sent was too long for the hw to handle (write // MAKE_RETURN_CODE(0xE4); //the data that was to be sent was too long for the hw to handle (write
// command) or the expected len was bigger than maximal expected len (read command) command was // command) or the expected len was bigger than maximal expected len (read command) command was
// not sent // not sent
// replaced by DeviceCommunicationIF::NULLPOINTER static const ReturnValue_t COMMAND_NULLPOINTER // replaced by DeviceCommunicationIF::NULLPOINTER static const ReturnValue_t
// = MAKE_RETURN_CODE(0xE5); //datalen was != 0 but data was == NULL in write command, or // COMMAND_NULLPOINTER = MAKE_RETURN_CODE(0xE5); //datalen was != 0 but data was == NULL in write
// nullpointer in read command // command, or nullpointer in read command
static const ReturnValue_t COMMAND_CHANNEL_DEACTIVATED = static const ReturnValue_t COMMAND_CHANNEL_DEACTIVATED =
MAKE_RETURN_CODE(0xE6); // the channel has no port set MAKE_RETURN_CODE(0xE6); // the channel has no port set
static const ReturnValue_t COMMAND_PORT_OUT_OF_RANGE = static const ReturnValue_t COMMAND_PORT_OUT_OF_RANGE =
@ -73,8 +73,8 @@ class RMAP : public HasReturnvaluesIF {
static const ReturnValue_t REPLY_MISSMATCH = MAKE_RETURN_CODE( static const ReturnValue_t REPLY_MISSMATCH = MAKE_RETURN_CODE(
0xD3); // a read command was issued, but get_write_rply called, or other way round 0xD3); // a read command was issued, but get_write_rply called, or other way round
static const ReturnValue_t REPLY_TIMEOUT = MAKE_RETURN_CODE(0xD4); // timeout static const ReturnValue_t REPLY_TIMEOUT = MAKE_RETURN_CODE(0xD4); // timeout
// replaced by DeviceCommunicationIF::NULLPOINTER static const ReturnValue_t REPLY_NULLPOINTER = // replaced by DeviceCommunicationIF::NULLPOINTER static const ReturnValue_t REPLY_NULLPOINTER
// MAKE_RETURN_CODE(0xD5);//one of the arguments in a read reply was NULL return values for // = MAKE_RETURN_CODE(0xD5);//one of the arguments in a read reply was NULL return values for
// get_reply // get_reply
static const ReturnValue_t REPLY_INTERFACE_BUSY = static const ReturnValue_t REPLY_INTERFACE_BUSY =
MAKE_RETURN_CODE(0xC0); // Interface is busy (transmission buffer still being processed) MAKE_RETURN_CODE(0xC0); // Interface is busy (transmission buffer still being processed)
@ -169,8 +169,8 @@ class RMAP : public HasReturnvaluesIF {
* @param buffer the data to write * @param buffer the data to write
* @param length length of data * @param length length of data
* @return * @return
* - @c COMMAND_NULLPOINTER datalen was != 0 but data was == NULL in write * - @c COMMAND_NULLPOINTER datalen was != 0 but data was == NULL in
* command * write command
* - return codes of RMAPChannelIF::sendCommand() * - return codes of RMAPChannelIF::sendCommand()
*/ */
static ReturnValue_t sendWriteCommand(RMAPCookie *cookie, const uint8_t *buffer, size_t length); static ReturnValue_t sendWriteCommand(RMAPCookie *cookie, const uint8_t *buffer, size_t length);
@ -205,8 +205,8 @@ class RMAP : public HasReturnvaluesIF {
* @param cookie to cookie to read from * @param cookie to cookie to read from
* @param expLength the expected maximum length of the reply * @param expLength the expected maximum length of the reply
* @return * @return
* - @c COMMAND_NULLPOINTER datalen was != 0 but data was == NULL in write * - @c COMMAND_NULLPOINTER datalen was != 0 but data was == NULL in
* command, or nullpointer in read command * write command, or nullpointer in read command
* - return codes of RMAPChannelIF::sendCommand() * - return codes of RMAPChannelIF::sendCommand()
*/ */
static ReturnValue_t sendReadCommand(RMAPCookie *cookie, uint32_t expLength); static ReturnValue_t sendReadCommand(RMAPCookie *cookie, uint32_t expLength);

View File

@ -73,16 +73,16 @@ class RMAPChannelIF {
* @param datalen length of data * @param datalen length of data
* @return * @return
* - @c RETURN_OK * - @c RETURN_OK
* - @c COMMAND_NO_DESCRIPTORS_AVAILABLE no descriptors available for sending command; * - @c COMMAND_NO_DESCRIPTORS_AVAILABLE no descriptors available for sending
* command was not sent * command; command was not sent
* - @c COMMAND_BUFFER_FULL no receiver buffer available for expected len; command * - @c COMMAND_BUFFER_FULL no receiver buffer available for expected len;
* was not sent
* - @c COMMAND_TOO_BIG the data that was to be sent was too long for the hw to
* handle (write command) or the expected len was bigger than maximal expected len (read command)
* command was not sent * command was not sent
* - @c COMMAND_TOO_BIG the data that was to be sent was too long for the hw
* to handle (write command) or the expected len was bigger than maximal expected len (read
* command) command was not sent
* - @c COMMAND_CHANNEL_DEACTIVATED the channel has no port set * - @c COMMAND_CHANNEL_DEACTIVATED the channel has no port set
* - @c NOT_SUPPORTED if you dont feel like implementing * - @c NOT_SUPPORTED if you dont feel like
* something... * implementing something...
*/ */
virtual ReturnValue_t sendCommand(RMAPCookie *cookie, uint8_t instruction, const uint8_t *data, virtual ReturnValue_t sendCommand(RMAPCookie *cookie, uint8_t instruction, const uint8_t *data,
size_t datalen) = 0; size_t datalen) = 0;
@ -97,8 +97,8 @@ class RMAPChannelIF {
* - @c REPLY_NO_REPLY no reply was received * - @c REPLY_NO_REPLY no reply was received
* - @c REPLY_NOT_SENT command was not sent, implies no reply * - @c REPLY_NOT_SENT command was not sent, implies no reply
* - @c REPLY_NOT_YET_SENT command is still waiting to be sent * - @c REPLY_NOT_YET_SENT command is still waiting to be sent
* - @c WRITE_REPLY_INTERFACE_BUSY Interface is busy (transmission buffer still being * - @c WRITE_REPLY_INTERFACE_BUSY Interface is busy (transmission buffer still
* processed) * being processed)
* - @c WRITE_REPLY_TRANSMISSION_ERROR Interface encountered errors during last * - @c WRITE_REPLY_TRANSMISSION_ERROR Interface encountered errors during last
* operation, data could not be processed. (transmission error) * operation, data could not be processed. (transmission error)
* - @c WRITE_REPLY_INVALID_DATA Invalid data (amount / value) * - @c WRITE_REPLY_INVALID_DATA Invalid data (amount / value)

View File

@ -32,10 +32,10 @@ static const uint8_t RMAP_COMMAND_READ = ((1 << RMAP_COMMAND_BIT) | (1 << RMAP_C
static const uint8_t RMAP_REPLY_WRITE = static const uint8_t RMAP_REPLY_WRITE =
((1 << RMAP_COMMAND_BIT_WRITE) | (1 << RMAP_COMMAND_BIT_REPLY)); ((1 << RMAP_COMMAND_BIT_WRITE) | (1 << RMAP_COMMAND_BIT_REPLY));
static const uint8_t RMAP_REPLY_READ = ((1 << RMAP_COMMAND_BIT_REPLY)); static const uint8_t RMAP_REPLY_READ = ((1 << RMAP_COMMAND_BIT_REPLY));
//#define RMAP_COMMAND_WRITE ((1<<RMAP_COMMAND_BIT) | (1<<RMAP_COMMAND_BIT_WRITE) | //#define RMAP_COMMAND_WRITE ((1<<RMAP_COMMAND_BIT) | (1<<RMAP_COMMAND_BIT_WRITE)
//(1<<RMAP_COMMAND_BIT_REPLY)) #define RMAP_COMMAND_WRITE_VERIFY ((1<<RMAP_COMMAND_BIT) | //| (1<<RMAP_COMMAND_BIT_REPLY)) #define RMAP_COMMAND_WRITE_VERIFY ((1<<RMAP_COMMAND_BIT) |
//(1<<RMAP_COMMAND_BIT_WRITE) | (1<<RMAP_COMMAND_BIT_REPLY) | (1<<RMAP_COMMAND_BIT_VERIFY)) #define //(1<<RMAP_COMMAND_BIT_WRITE) | (1<<RMAP_COMMAND_BIT_REPLY) | (1<<RMAP_COMMAND_BIT_VERIFY)) #define
//RMAP_COMMAND_READ ((1<<RMAP_COMMAND_BIT) | (1<<RMAP_COMMAND_BIT_REPLY)) // RMAP_COMMAND_READ ((1<<RMAP_COMMAND_BIT) | (1<<RMAP_COMMAND_BIT_REPLY))
//#define RMAP_REPLY_WRITE ((1<<RMAP_COMMAND_BIT_WRITE) | //#define RMAP_REPLY_WRITE ((1<<RMAP_COMMAND_BIT_WRITE) |
//(1<<RMAP_COMMAND_BIT_REPLY)) //(1<<RMAP_COMMAND_BIT_REPLY))

View File

@ -45,7 +45,7 @@ TEST_CASE("Command Executor", "[cmd-exec]") {
result = cmdExecutor.check(bytesHaveBeenRead); result = cmdExecutor.check(bytesHaveBeenRead);
REQUIRE(result != CommandExecutor::COMMAND_ERROR); REQUIRE(result != CommandExecutor::COMMAND_ERROR);
usleep(500); usleep(500);
REQUIRE(limitIdx < 5); REQUIRE(limitIdx < 500);
} }
limitIdx = 0; limitIdx = 0;
@ -71,8 +71,9 @@ TEST_CASE("Command Executor", "[cmd-exec]") {
limitIdx++; limitIdx++;
result = cmdExecutor.check(bytesHaveBeenRead); result = cmdExecutor.check(bytesHaveBeenRead);
REQUIRE(result != CommandExecutor::COMMAND_ERROR); REQUIRE(result != CommandExecutor::COMMAND_ERROR);
// This ensures that the tests do not block indefinitely
usleep(500); usleep(500);
REQUIRE(limitIdx < 20); REQUIRE(limitIdx < 500);
} }
limitIdx = 0; limitIdx = 0;
CHECK(bytesHaveBeenRead == true); CHECK(bytesHaveBeenRead == true);
@ -89,7 +90,7 @@ TEST_CASE("Command Executor", "[cmd-exec]") {
std::string allTheReply(reinterpret_cast<char*>(largerReadBuffer)); std::string allTheReply(reinterpret_cast<char*>(largerReadBuffer));
// I am just going to assume that this string is the same across ping implementations // I am just going to assume that this string is the same across ping implementations
// of different Linux systems // of different Linux systems
REQUIRE(allTheReply.find("localhost ping statistics") != std::string::npos); REQUIRE(allTheReply.find("PING localhost") != std::string::npos);
// Now check failing command // Now check failing command
result = cmdExecutor.load("false", false, false); result = cmdExecutor.load("false", false, false);
@ -101,8 +102,9 @@ TEST_CASE("Command Executor", "[cmd-exec]") {
limitIdx++; limitIdx++;
result = cmdExecutor.check(bytesHaveBeenRead); result = cmdExecutor.check(bytesHaveBeenRead);
REQUIRE(result != CommandExecutor::COMMAND_ERROR); REQUIRE(result != CommandExecutor::COMMAND_ERROR);
// This ensures that the tests do not block indefinitely
usleep(500); usleep(500);
REQUIRE(limitIdx < 20); REQUIRE(limitIdx < 500);
} }
REQUIRE(result == HasReturnvaluesIF::RETURN_FAILED); REQUIRE(result == HasReturnvaluesIF::RETURN_FAILED);
REQUIRE(cmdExecutor.getLastError() == 1); REQUIRE(cmdExecutor.getLastError() == 1);