Merge remote-tracking branch 'upstream/development' into mueller/dev-printout-runtime-configurable

This commit is contained in:
Robin Müller 2022-02-28 15:00:38 +01:00
commit cf45eca100
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
8 changed files with 46 additions and 22 deletions

View File

@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- HAL Devicehandlers: Periodic printout is run-time configurable now
## Additions
- Linux HAL: Add wiretapping option for I2C. Enabled with `FSFW_HAL_I2C_WIRETAPPING` defined to 1
# [v4.0.0]
## Additions

View File

@ -1,4 +1,13 @@
#include "fsfw_hal/linux/i2c/I2cComIF.h"
#include "I2cComIF.h"
#include "fsfw/FSFW.h"
#include "fsfw/serviceinterface.h"
#include "fsfw_hal/linux/UnixFileGuard.h"
#include "fsfw_hal/linux/utility.h"
#if FSFW_HAL_I2C_WIRETAPPING == 1
#include "fsfw/globalfunctions/arrayprinter.h"
#endif
#include <errno.h>
#include <fcntl.h>
@ -8,11 +17,6 @@
#include <cstring>
#include "fsfw/FSFW.h"
#include "fsfw/serviceinterface.h"
#include "fsfw_hal/linux/UnixFileGuard.h"
#include "fsfw_hal/linux/utility.h"
I2cComIF::I2cComIF(object_id_t objectId) : SystemObject(objectId) {}
I2cComIF::~I2cComIF() {}
@ -112,6 +116,11 @@ ReturnValue_t I2cComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
#endif
return HasReturnvaluesIF::RETURN_FAILED;
}
#if FSFW_HAL_I2C_WIRETAPPING == 1
sif::info << "Sent I2C data to bus " << deviceFile << ":" << std::endl;
arrayprinter::print(sendData, sendLen);
#endif
return HasReturnvaluesIF::RETURN_OK;
}
@ -176,6 +185,11 @@ ReturnValue_t I2cComIF::requestReceiveMessage(CookieIF* cookie, size_t requestLe
return HasReturnvaluesIF::RETURN_FAILED;
}
#if FSFW_HAL_I2C_WIRETAPPING == 1
sif::info << "I2C read bytes from bus " << deviceFile << ":" << std::endl;
arrayprinter::print(replyBuffer, requestLen);
#endif
i2cDeviceMapIter->second.replyLen = requestLen;
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -57,4 +57,9 @@
#define FSFW_HAL_SPI_WIRETAPPING 0
#endif
// Can be used for low-level debugging of the I2C bus
#ifndef FSFW_HAL_I2C_WIRETAPPING
#define FSFW_HAL_I2C_WIRETAPPING 0
#endif
#endif /* FSFW_FSFW_H_ */

View File

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

View File

@ -65,9 +65,10 @@ class PeriodicPosixTask : public PosixThread, public PeriodicTaskIF {
/**
* @brief The function containing the actual functionality of the task.
* @details The method sets and starts
* the task's period, then enters a loop that is repeated indefinitely. Within the
* 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.
* the task's period, then enters a loop that is repeated indefinitely. Within
* the 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.
*/
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.
*
* @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 be added prior to starting the task.
* multiple objects that implement the ExecutableObjectIF interface. The
* objects must be added prior to starting the task.
* @author baetz
* @ingroup task_handling
*/

View File

@ -169,8 +169,8 @@ class RMAP : public HasReturnvaluesIF {
* @param buffer the data to write
* @param length length of data
* @return
* - @c COMMAND_NULLPOINTER datalen was != 0 but data was == NULL in
* write command
* - @c COMMAND_NULLPOINTER datalen was != 0 but data was == NULL
* in write command
* - return codes of RMAPChannelIF::sendCommand()
*/
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 expLength the expected maximum length of the reply
* @return
* - @c COMMAND_NULLPOINTER datalen was != 0 but data was == NULL in
* write command, or nullpointer in read command
* - @c COMMAND_NULLPOINTER datalen was != 0 but data was == NULL
* in write command, or nullpointer in read command
* - return codes of RMAPChannelIF::sendCommand()
*/
static ReturnValue_t sendReadCommand(RMAPCookie *cookie, uint32_t expLength);

View File

@ -75,10 +75,10 @@ class RMAPChannelIF {
* - @c RETURN_OK
* - @c COMMAND_NO_DESCRIPTORS_AVAILABLE no descriptors available for sending
* command; command was not sent
* - @c COMMAND_BUFFER_FULL no receiver buffer available for expected len;
* 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
* - @c COMMAND_BUFFER_FULL no receiver buffer available for expected
* len; 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 NOT_SUPPORTED if you dont feel like
@ -97,8 +97,8 @@ class RMAPChannelIF {
* - @c REPLY_NO_REPLY no reply was received
* - @c REPLY_NOT_SENT command was not sent, implies no reply
* - @c REPLY_NOT_YET_SENT command is still waiting to be sent
* - @c WRITE_REPLY_INTERFACE_BUSY Interface is busy (transmission buffer still
* being processed)
* - @c WRITE_REPLY_INTERFACE_BUSY Interface is busy (transmission buffer
* still being processed)
* - @c WRITE_REPLY_TRANSMISSION_ERROR Interface encountered errors during last
* operation, data could not be processed. (transmission error)
* - @c WRITE_REPLY_INVALID_DATA Invalid data (amount / value)