embkernel
 All Classes Functions Variables Typedefs Groups Pages
RtosTask.hpp
1 //------------------------------------------------------------------------------
2 //This file is part of embKernel.
3 //See license.txt for the full license governing this code.
4 //------------------------------------------------------------------------------
8 #ifndef RTOS_TASK_HPP_
9 #define RTOS_TASK_HPP_
10 
11 #include "Rtos.hpp"
12 #include "RtosRunnable.hpp"
13 #include "RtosListIterable.hpp"
14 #include <stddef.h>
15 
20 class RtosTask {
21  friend class Rtos;
22  friend class RtosList;
23  friend class RTOS_LIST_CORE;
24  friend class RTOS_LIST_EVENT;
25  friend class RtosInterrupt;
26  friend class RtosSyncObject;
27  friend class RtosPortable;
28 private:
29  void* mCurrentStackPointer;
30  const char* mName;
31  Rtos::PRIORITY mPriority;
32  RtosListIterable mIterableCore;
33  RtosListIterable mIterableSyncObj;
34  bool mIsTimeout;
35  void* mStack;
36  size_t mStackSize;
37 
38  void initVariables(Rtos::PRIORITY priority, const char* name, size_t stackSize);
39 
40 protected:
41  static void caller(RtosRunnable* runnable);
42 
43 public:
44  RtosTask(Rtos::PRIORITY priority, const char* name, size_t stackSize, void (*run)(RtosTask*));
45  RtosTask(Rtos::PRIORITY priority, const char* name, size_t stackSize, RtosRunnable& runnable);
46  ~RtosTask();
47 
48  void suspend();
49  void resume();
50  const char* getName();
51  size_t getStackSize();
52  size_t getFreeStackSize();
53 };
54 
55 #endif /* RTOS_TASK_HPP_ */
56