F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
TaskUserInterface.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title Os/Interfaces/TaskUserInterface.hpp
3 // \brief types shared by Os::Task users and implementations
4 //
5 // Includes no other Os service header, so both Os/Task.hpp and the Os::Task implementations may include it.
6 // ======================================================================
7 #ifndef OS_INTERFACES_TASKUSERINTERFACE_HPP_
8 #define OS_INTERFACES_TASKUSERINTERFACE_HPP_
9 
10 #include <Fw/Deprecate.hpp>
11 #include <Fw/FPrimeBasicTypes.hpp>
12 #include <Fw/Time/TimeInterval.hpp>
13 #include <Fw/Types/Assert.hpp>
15 #include <Os/Os.hpp>
16 #include <Os/TaskString.hpp>
17 #include <limits>
18 
19 namespace Os {
20 
22 class TaskHandle {};
23 
30  static constexpr FwSizeType TASK_DEFAULT = std::numeric_limits<FwSizeType>::max();
31 
36  static constexpr FwTaskPriorityType TASK_PRIORITY_DEFAULT = std::numeric_limits<FwTaskPriorityType>::max();
37 
38  enum Status {
52  };
53 
55 
57 
59  typedef void (*taskRoutine)(void* ptr);
60 
61  class Arguments {
62  public:
76  const taskRoutine routine,
77  void* const routine_argument = nullptr,
79  const FwSizeType stackSize = TASK_DEFAULT,
80  const FwSizeType cpuAffinity = TASK_DEFAULT,
81  const FwTaskIdType identifier = static_cast<FwTaskIdType>(TASK_DEFAULT))
82  : m_name(name),
83  m_routine(routine),
84  m_routine_argument(routine_argument),
85  m_priority(priority),
86  m_stackSize(stackSize),
87  m_cpuAffinity(cpuAffinity),
88  m_identifier(identifier) {
89  FW_ASSERT(routine != nullptr);
90  }
91 
92  public:
100  };
101 };
102 
103 } // namespace Os
104 
105 #endif // OS_INTERFACES_TASKUSERINTERFACE_HPP_
PlatformTaskIdType FwTaskIdType
The type of task identifiers used.
Task handle representation.
PlatformSizeType FwSizeType
unable to set the task affinity
void(* taskRoutine)(void *ptr)
Prototype for task routine started in task context.
error trying to delay the task
Task is in an invalid state for the operation.
types and constants shared by users of Os::Task and by its implementations
started task with invalid priority
permissions error setting-up tasks
Task feature is not supported.
message sent/received okay
Arguments(const Fw::ConstStringBase &name, const taskRoutine routine, void *const routine_argument=nullptr, const FwTaskPriorityType priority=TASK_PRIORITY_DEFAULT, const FwSizeType stackSize=TASK_DEFAULT, const FwSizeType cpuAffinity=TASK_DEFAULT, const FwTaskIdType identifier=static_cast< FwTaskIdType >(TASK_DEFAULT))
construct a set of arguments to start a task
unexpected error return value
PlatformTaskPriorityType FwTaskPriorityType
The type of task priorities used.
error trying to join the task
A read-only abstract superclass for StringBase.
static constexpr FwTaskPriorityType TASK_PRIORITY_DEFAULT
started task with invalid parameters
unable to allocate more tasks
static constexpr FwSizeType TASK_DEFAULT
started with invalid stack size
#define FW_ASSERT(...)
Definition: Assert.hpp:14