rtems changes taken over from upstream

This commit is contained in:
Robin Müller 2020-12-03 18:57:50 +01:00
parent b7a29235f8
commit c5c776e676
6 changed files with 36 additions and 28 deletions

View File

@ -78,8 +78,9 @@ ReturnValue_t MultiObjectTask::addComponent(object_id_t object) {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
objectList.push_back(newObject); objectList.push_back(newObject);
ReturnValue_t result = newObject->initializeAfterTaskCreation(); newObject->setTaskIF(this);
return result;
return HasReturnvaluesIF::RETURN_OK;
} }
uint32_t MultiObjectTask::getPeriodMs() const { uint32_t MultiObjectTask::getPeriodMs() const {

View File

@ -1,11 +1,5 @@
/** #ifndef FSFW_OSAL_RTEMS_MULTIOBJECTTASK_H_
* @file MultiObjectTask.h #define FSFW_OSAL_RTEMS_MULTIOBJECTTASK_H_
* @brief This file defines the MultiObjectTask class.
* @date 30.01.2014
* @author baetz
*/
#ifndef MULTIOBJECTTASK_H_
#define MULTIOBJECTTASK_H_
#include "../../objectmanager/ObjectManagerIF.h" #include "../../objectmanager/ObjectManagerIF.h"
#include "../../tasks/PeriodicTaskIF.h" #include "../../tasks/PeriodicTaskIF.h"
@ -21,7 +15,7 @@ class ExecutableObjectIF;
* @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 be * multiple objects that implement the ExecutableObjectIF interface. The objects must be
* added prior to starting the task. * added prior to starting the task.
* * @author baetz
* @ingroup task_handling * @ingroup task_handling
*/ */
class MultiObjectTask: public TaskBase, public PeriodicTaskIF { class MultiObjectTask: public TaskBase, public PeriodicTaskIF {
@ -63,11 +57,11 @@ public:
* @param object Id of the object to add. * @param object Id of the object to add.
* @return RETURN_OK on success, RETURN_FAILED if the object could not be added. * @return RETURN_OK on success, RETURN_FAILED if the object could not be added.
*/ */
ReturnValue_t addComponent(object_id_t object); ReturnValue_t addComponent(object_id_t object) override;
uint32_t getPeriodMs() const; uint32_t getPeriodMs() const override;
ReturnValue_t sleepFor(uint32_t ms); ReturnValue_t sleepFor(uint32_t ms) override;
protected: protected:
typedef std::vector<ExecutableObjectIF*> ObjectList; //!< Typedef for the List of objects. typedef std::vector<ExecutableObjectIF*> ObjectList; //!< Typedef for the List of objects.
/** /**
@ -110,4 +104,4 @@ protected:
void taskFunctionality(void); void taskFunctionality(void);
}; };
#endif /* MULTIOBJECTTASK_H_ */ #endif /* FSFW_OSAL_RTEMS_MULTIOBJECTTASK_H_ */

View File

@ -1,7 +1,6 @@
#include "Mutex.h" #include "Mutex.h"
#include "../../serviceinterface/ServiceInterfaceStream.h" #include "../../serviceinterface/ServiceInterfaceStream.h"
const uint32_t MutexIF::NO_TIMEOUT = RTEMS_NO_TIMEOUT;
uint8_t Mutex::count = 0; uint8_t Mutex::count = 0;
Mutex::Mutex() : Mutex::Mutex() :
@ -24,8 +23,22 @@ Mutex::~Mutex() {
} }
} }
ReturnValue_t Mutex::lockMutex(uint32_t timeoutMs) { ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType =
rtems_status_code status = rtems_semaphore_obtain(mutexId, RTEMS_WAIT, timeoutMs); TimeoutType::BLOCKING, uint32_t timeoutMs) {
if(timeoutMs == MutexIF::TimeoutType::BLOCKING) {
rtems_status_code status = rtems_semaphore_obtain(mutexId,
RTEMS_WAIT, RTEMS_NO_TIMEOUT);
}
else if(timeoutMs == MutexIF::TimeoutType::POLLING) {
timeoutMs = RTEMS_NO_TIMEOUT;
rtems_status_code status = rtems_semaphore_obtain(mutexId,
RTEMS_NO_WAIT, 0);
}
else {
rtems_status_code status = rtems_semaphore_obtain(mutexId,
RTEMS_WAIT, timeoutMs);
}
switch(status){ switch(status){
case RTEMS_SUCCESSFUL: case RTEMS_SUCCESSFUL:
//semaphore obtained successfully //semaphore obtained successfully

View File

@ -1,5 +1,5 @@
#ifndef OS_RTEMS_MUTEX_H_ #ifndef FRAMEWORK_OSAL_RTEMS_MUTEX_H_
#define OS_RTEMS_MUTEX_H_ #define FRAMEWORK_OSAL_RTEMS_MUTEX_H_
#include "../../ipc/MutexIF.h" #include "../../ipc/MutexIF.h"
#include "RtemsBasic.h" #include "RtemsBasic.h"
@ -8,7 +8,7 @@ class Mutex : public MutexIF {
public: public:
Mutex(); Mutex();
~Mutex(); ~Mutex();
ReturnValue_t lockMutex(uint32_t timeoutMs); ReturnValue_t lockMutex(TimeoutType timeoutType, uint32_t timeoutMs = 0);
ReturnValue_t unlockMutex(); ReturnValue_t unlockMutex();
private: private:
rtems_id mutexId; rtems_id mutexId;

View File

@ -1,7 +1,7 @@
#include "../../tasks/FixedSequenceSlot.h" #include "../../devicehandlers/FixedSequenceSlot.h"
#include "../../objectmanager/SystemObjectIF.h" #include "../../objectmanager/SystemObjectIF.h"
#include "../../osal/rtems/PollingTask.h" #include "PollingTask.h"
#include "../../osal/rtems/RtemsBasic.h" #include "RtemsBasic.h"
#include "../../returnvalues/HasReturnvaluesIF.h" #include "../../returnvalues/HasReturnvaluesIF.h"
#include "../../serviceinterface/ServiceInterfaceStream.h" #include "../../serviceinterface/ServiceInterfaceStream.h"
#include <rtems/bspIo.h> #include <rtems/bspIo.h>
@ -73,7 +73,7 @@ ReturnValue_t PollingTask::addSlot(object_id_t componentId,
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
sif::error << "Component " << std::hex << componentId << error << "Component " << std::hex << componentId <<
" not found, not adding it to pst" << std::endl; " not found, not adding it to pst" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
@ -82,7 +82,7 @@ uint32_t PollingTask::getPeriodMs() const {
return pst.getLengthMs(); return pst.getLengthMs();
} }
ReturnValue_t PollingTask::checkAndInitializeSequence() const { ReturnValue_t PollingTask::checkSequence() const {
return pst.checkSequence(); return pst.checkSequence();
} }

View File

@ -1,7 +1,7 @@
#ifndef POLLINGTASK_H_ #ifndef POLLINGTASK_H_
#define POLLINGTASK_H_ #define POLLINGTASK_H_
#include "../../tasks/FixedSlotSequence.h" #include "../../devicehandlers/FixedSlotSequence.h"
#include "../../tasks/FixedTimeslotTaskIF.h" #include "../../tasks/FixedTimeslotTaskIF.h"
#include "TaskBase.h" #include "TaskBase.h"
@ -42,7 +42,7 @@ class PollingTask: public TaskBase, public FixedTimeslotTaskIF {
uint32_t getPeriodMs() const; uint32_t getPeriodMs() const;
ReturnValue_t checkAndInitializeSequence() const; ReturnValue_t checkSequence() const;
ReturnValue_t sleepFor(uint32_t ms); ReturnValue_t sleepFor(uint32_t ms);
protected: protected: