Merge branch 'mueller_framework' into front_branch

changes for new freertos task monitor
This commit is contained in:
Robin Müller 2020-07-11 11:57:46 +02:00
commit ffba664144
11 changed files with 65 additions and 62 deletions

View File

@ -157,3 +157,6 @@ ReturnValue_t FixedTimeslotTask::sleepFor(uint32_t ms) {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
TaskHandle_t FixedTimeslotTask::getTaskHandle() const {
return handle;
}

View File

@ -57,6 +57,8 @@ public:
ReturnValue_t sleepFor(uint32_t ms) override; ReturnValue_t sleepFor(uint32_t ms) override;
TaskHandle_t getTaskHandle() const;
protected: protected:
bool started; bool started;
TaskHandle_t handle; TaskHandle_t handle;

View File

@ -126,6 +126,10 @@ void PeriodicTask::checkMissedDeadline(const TickType_t xLastWakeTime,
} }
} }
TaskHandle_t PeriodicTask::getTaskHandle() const {
return handle;
}
void PeriodicTask::handleMissedDeadline() { void PeriodicTask::handleMissedDeadline() {
#ifdef DEBUG #ifdef DEBUG
sif::warning << "PeriodicTask: " << pcTaskGetName(NULL) << sif::warning << "PeriodicTask: " << pcTaskGetName(NULL) <<

View File

@ -69,6 +69,8 @@ public:
uint32_t getPeriodMs() const override; uint32_t getPeriodMs() const override;
ReturnValue_t sleepFor(uint32_t ms) override; ReturnValue_t sleepFor(uint32_t ms) override;
TaskHandle_t getTaskHandle() const;
protected: protected:
bool started; bool started;
TaskHandle_t handle; TaskHandle_t handle;

View File

@ -18,6 +18,7 @@ TaskHandle_t TaskManagement::getCurrentTaskHandle() {
return xTaskGetCurrentTaskHandle(); return xTaskGetCurrentTaskHandle();
} }
configSTACK_DEPTH_TYPE TaskManagement::getTaskStackHighWatermark() { configSTACK_DEPTH_TYPE TaskManagement::getTaskStackHighWatermark(
return uxTaskGetStackHighWaterMark(TaskManagement::getCurrentTaskHandle()); TaskHandle_t task) {
return uxTaskGetStackHighWaterMark(task);
} }

View File

@ -57,7 +57,8 @@ public:
* @return Smallest value of stack remaining since the task was started in * @return Smallest value of stack remaining since the task was started in
* words. * words.
*/ */
static configSTACK_DEPTH_TYPE getTaskStackHighWatermark(); static configSTACK_DEPTH_TYPE getTaskStackHighWatermark(
TaskHandle_t task = nullptr);
}; };
#endif /* FRAMEWORK_OSAL_FREERTOS_TASKMANAGEMENT_H_ */ #endif /* FRAMEWORK_OSAL_FREERTOS_TASKMANAGEMENT_H_ */

View File

@ -60,13 +60,11 @@ ReturnValue_t Service2DeviceAccess::prepareCommand(CommandMessage* message,
uint32_t* state, object_id_t objectId) { uint32_t* state, object_id_t objectId) {
switch(static_cast<Subservice>(subservice)){ switch(static_cast<Subservice>(subservice)){
case Subservice::RAW_COMMANDING: { case Subservice::RAW_COMMANDING: {
return prepareRawCommand(dynamic_cast<CommandMessage*>(message), return prepareRawCommand(message, tcData, tcDataLen);
tcData, tcDataLen);
} }
break; break;
case Subservice::TOGGLE_WIRETAPPING: { case Subservice::TOGGLE_WIRETAPPING: {
return prepareWiretappingCommand(dynamic_cast<CommandMessage*>(message), return prepareWiretappingCommand(message, tcData, tcDataLen);
tcData, tcDataLen);
} }
break; break;
default: default:

View File

@ -59,8 +59,15 @@ ReturnValue_t Service8FunctionManagement::prepareCommand(
ReturnValue_t Service8FunctionManagement::prepareDirectCommand( ReturnValue_t Service8FunctionManagement::prepareDirectCommand(
CommandMessage *message, const uint8_t *tcData, size_t tcDataLen) { CommandMessage *message, const uint8_t *tcData, size_t tcDataLen) {
if(tcDataLen < sizeof(object_id_t) + sizeof(ActionId_t)) {
sif::debug << "Service8FunctionManagement::prepareDirectCommand:"
<< " TC size smaller thant minimum size of direct command."
<< std::endl;
return CommandingServiceBase::INVALID_TC;
}
// Create direct command instance by extracting data from Telecommand // Create direct command instance by extracting data from Telecommand
DirectCommand command(tcData,tcDataLen); DirectCommand command(tcData, tcDataLen);
// store additional parameters into the IPC Store // store additional parameters into the IPC Store
store_address_t parameterAddress; store_address_t parameterAddress;

View File

@ -1,22 +1,3 @@
/**
* \file Service8Packets.h
*
* \brief Structure of a Direct Command.
* Normal reply (subservice 130) consists of
* 1. Target object ID
* 2. Action ID (taget device has specified functions with action IDs)
* 3. Return Code
* 4. Optional step number for step replies
*
* Data reply (subservice 132) consists of
* 1. Target Object ID
* 2. Action ID
* 3. Data
*
* \date 01.07.2019
* \author R. Mueller
*/
#ifndef FRAMEWORK_PUS_SERVICEPACKETS_SERVICE8PACKETS_H_ #ifndef FRAMEWORK_PUS_SERVICEPACKETS_SERVICE8PACKETS_H_
#define FRAMEWORK_PUS_SERVICEPACKETS_SERVICE8PACKETS_H_ #define FRAMEWORK_PUS_SERVICEPACKETS_SERVICE8PACKETS_H_
@ -29,23 +10,21 @@
/** /**
* \brief Subservice 128 * @brief Subservice 128
* \ingroup spacepackets * @ingroup spacepackets
*/ */
class DirectCommand: public SerialLinkedListAdapter<SerializeIF> { //!< [EXPORT] : [SUBSERVICE] 128 class DirectCommand: public SerialLinkedListAdapter<SerializeIF> { //!< [EXPORT] : [SUBSERVICE] 128
public: public:
//typedef uint16_t typeOfMaxData;
//static const typeOfMaxData MAX_DATA = 256; DirectCommand(const uint8_t* tcData, size_t size) {
DirectCommand(const uint8_t* dataBuffer_, uint32_t size_) { SerializeAdapter::deSerialize(&objectId, &tcData, &size,
size_t size = sizeof(objectId);
SerializeAdapter::deSerialize(&objectId,&dataBuffer_,&size,
SerializeIF::Endianness::BIG); SerializeIF::Endianness::BIG);
size = sizeof(actionId); SerializeAdapter::deSerialize(&actionId, &tcData, &size,
SerializeAdapter::deSerialize(&actionId,&dataBuffer_,&size,
SerializeIF::Endianness::BIG); SerializeIF::Endianness::BIG);
parameterBuffer = dataBuffer_; parameterBuffer = tcData;
parametersSize = size_ - sizeof(objectId) - sizeof(actionId); parametersSize = size;
} }
ActionId_t getActionId() const { ActionId_t getActionId() const {
return actionId; return actionId;
} }
@ -73,8 +52,12 @@ private:
/** /**
* \brief Subservice 130 * @brief Subservice 130
* \ingroup spacepackets * Data reply (subservice 130) consists of
* 1. Target Object ID
* 2. Action ID
* 3. Data
* @ingroup spacepackets
*/ */
class DataReply: public SerialLinkedListAdapter<SerializeIF> { //!< [EXPORT] : [SUBSERVICE] 130 class DataReply: public SerialLinkedListAdapter<SerializeIF> { //!< [EXPORT] : [SUBSERVICE] 130
public: public:
@ -100,8 +83,10 @@ private:
/** /**
* \brief Subservice 132 * @brief Subservice 132
* \ingroup spacepackets * @details
* Not used yet. Telecommand Verification takes care of this.
* @ingroup spacepackets
*/ */
class DirectReply: public SerialLinkedListAdapter<SerializeIF> { //!< [EXPORT] : [SUBSERVICE] 132 class DirectReply: public SerialLinkedListAdapter<SerializeIF> { //!< [EXPORT] : [SUBSERVICE] 132
public: public:
@ -124,7 +109,7 @@ private:
returnCode.setNext(&step); returnCode.setNext(&step);
} }
} }
bool isDataReply; //!< [EXPORT] : [IGNORE]
bool isStep; //!< [EXPORT] : [IGNORE] bool isStep; //!< [EXPORT] : [IGNORE]
SerializeElement<object_id_t> objectId; //!< [EXPORT] : [IGNORE] SerializeElement<object_id_t> objectId; //!< [EXPORT] : [IGNORE]
SerializeElement<ActionId_t> actionId; //!< [EXPORT] : [IGNORE] SerializeElement<ActionId_t> actionId; //!< [EXPORT] : [IGNORE]

View File

@ -7,9 +7,8 @@ PusParser::PusParser(uint16_t maxExpectedPusPackets,
ReturnValue_t PusParser::parsePusPackets(const uint8_t *frame, ReturnValue_t PusParser::parsePusPackets(const uint8_t *frame,
size_t frameSize) { size_t frameSize) {
if(frame == nullptr) { if(frame == nullptr or frameSize < 5) {
sif::error << "PusParser::parsePusPackets: Frame pointers in invalid!" sif::error << "PusParser::parsePusPackets: Frame invalid!" << std::endl;
<< std::endl;
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
@ -25,15 +24,13 @@ ReturnValue_t PusParser::parsePusPackets(const uint8_t *frame,
} }
size_t packetSize = lengthField + 7; size_t packetSize = lengthField + 7;
// sif::debug << frameSize << std::endl;
// Size of a pus packet is the value in the packet length field plus 7. // Size of a pus packet is the value in the packet length field plus 7.
if(packetSize > frameSize) if(packetSize > frameSize) {
{ if(storeSplitPackets) {
if(storeSplitPackets)
{
indexSizePairFIFO.insert(indexSizePair(0, frameSize)); indexSizePairFIFO.insert(indexSizePair(0, frameSize));
} }
else else {
{
sif::debug << "TcSerialPollingTask::readNextPacket: Next packet " sif::debug << "TcSerialPollingTask::readNextPacket: Next packet "
"larger than remaining frame," << std::endl; "larger than remaining frame," << std::endl;
sif::debug << "Throwing away packet. Detected packet size: " sif::debug << "Throwing away packet. Detected packet size: "
@ -41,8 +38,7 @@ ReturnValue_t PusParser::parsePusPackets(const uint8_t *frame,
} }
return SPLIT_PACKET; return SPLIT_PACKET;
} }
else else {
{
indexSizePairFIFO.insert(indexSizePair(0, packetSize)); indexSizePairFIFO.insert(indexSizePair(0, packetSize));
if(packetSize == frameSize) { if(packetSize == frameSize) {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
@ -77,6 +73,11 @@ PusParser::indexSizePair PusParser::getNextFifoPair() {
ReturnValue_t PusParser::readNextPacket(const uint8_t *frame, ReturnValue_t PusParser::readNextPacket(const uint8_t *frame,
size_t frameSize, size_t& currentIndex) { size_t frameSize, size_t& currentIndex) {
// sif::debug << startIndex << std::endl; // sif::debug << startIndex << std::endl;
if(currentIndex + 5 > frameSize) {
currentIndex = frameSize;
return HasReturnvaluesIF::RETURN_OK;
}
uint16_t lengthField = frame[currentIndex + 4] << 8 | uint16_t lengthField = frame[currentIndex + 4] << 8 |
frame[currentIndex + 5]; frame[currentIndex + 5];
if(lengthField == 0) { if(lengthField == 0) {
@ -88,12 +89,10 @@ ReturnValue_t PusParser::readNextPacket(const uint8_t *frame,
size_t remainingSize = frameSize - currentIndex; size_t remainingSize = frameSize - currentIndex;
if(nextPacketSize > remainingSize) if(nextPacketSize > remainingSize)
{ {
if(storeSplitPackets) if(storeSplitPackets) {
{
indexSizePairFIFO.insert(indexSizePair(currentIndex, remainingSize)); indexSizePairFIFO.insert(indexSizePair(currentIndex, remainingSize));
} }
else else {
{
sif::debug << "TcSerialPollingTask::readNextPacket: Next packet " sif::debug << "TcSerialPollingTask::readNextPacket: Next packet "
"larger than remaining frame," << std::endl; "larger than remaining frame," << std::endl;
sif::debug << "Throwing away packet. Detected packet size: " sif::debug << "Throwing away packet. Detected packet size: "

View File

@ -63,11 +63,12 @@ public:
* @return * @return
*/ */
indexSizePair getNextFifoPair(); indexSizePair getNextFifoPair();
private:
//! A FIFO is used to store information about multiple PUS packets private:
//! inside the receive buffer. The maximum number of entries is defined /** A FIFO is used to store information about multiple PUS packets
//! by the first constructor argument. * inside the receive buffer. The maximum number of entries is defined
* by the first constructor argument.
*/
DynamicFIFO<indexSizePair> indexSizePairFIFO; DynamicFIFO<indexSizePair> indexSizePairFIFO;
bool storeSplitPackets = false; bool storeSplitPackets = false;