Mark3 Realtime Kernel
eventflag.h
Go to the documentation of this file.
1 /*===========================================================================
2  _____ _____ _____ _____
3  ___| _|__ __|_ |__ __|__ |__ __| __ |__ ______
4 | \ / | || \ || | || |/ / ||___ |
5 | \/ | || \ || \ || \ ||___ |
6 |__/\__/|__|_||__|\__\ __||__|\__\ __||__|\__\ __||______|
7  |_____| |_____| |_____| |_____|
8 
9 --[Mark3 Realtime Platform]--------------------------------------------------
10 
11 Copyright (c) 2012 - 2019 m0slevin, all rights reserved.
12 See license.txt for more information
13 ===========================================================================*/
18 #pragma once
19 
20 #include "mark3cfg.h"
21 #include "kernel.h"
22 #include "kerneltypes.h"
23 #include "blocking.h"
24 #include "thread.h"
25 
26 #if KERNEL_EVENT_FLAGS
27 namespace Mark3
28 {
29 //---------------------------------------------------------------------------
45 class EventFlag : public BlockingObject
46 {
47 public:
48  void* operator new(size_t sz, void* pv) { return reinterpret_cast<EventFlag*>(pv); };
49  ~EventFlag();
50 
54  void Init();
55 
64  uint16_t Wait(uint16_t u16Mask_, EventFlagOperation eMode_);
65 
75  uint16_t Wait(uint16_t u16Mask_, EventFlagOperation eMode_, uint32_t u32TimeMS_);
76 
83  void WakeMe(Thread* pclChosenOne_);
84 
91  void Set(uint16_t u16Mask_);
92 
97  void Clear(uint16_t u16Mask_);
98 
103  uint16_t GetMask();
104 
105 private:
117  uint16_t Wait_i(uint16_t u16Mask_, EventFlagOperation eMode_, uint32_t u32TimeMS_);
118 
119  uint16_t m_u16SetMask;
120 };
121 } // namespace Mark3
122 #endif // #if KERNEL_EVENT_FLAGS
uint16_t m_u16SetMask
Event flags currently set in this object.
Definition: eventflag.h:119
EventFlagOperation
Definition: kerneltypes.h:50
Basic data type primatives used throughout the OS.
Kernel initialization and startup class.
uint16_t GetMask()
GetMask Returns the state of the 16-bit bitmask within this object.
void Set(uint16_t u16Mask_)
Set Set additional flags in this object (logical OR). This API can potentially result in threads bloc...
Blocking object base class declarations.
void Clear(uint16_t u16Mask_)
ClearFlags - Clear a specific set of flags within this object, specific by bitmask.
Definition: atomic.cpp:23
Mark3 Kernel Configuration This file is used to configure the kernel for your specific application in...
Platform independent thread class declarations Threads are an atomic unit of execution, and each instance of the thread class represents an instance of a program running of the processor. The Thread is the fundmanetal user-facing object in the kernel - it is what makes multiprocessing possible from application code.
uint16_t Wait_i(uint16_t u16Mask_, EventFlagOperation eMode_, uint32_t u32TimeMS_)
Wait_i Interal abstraction used to manage both timed and untimed wait operations. ...
The Thread Class. This object providing the fundamental thread control data structures and functions ...
Definition: thread.h:64
uint16_t Wait(uint16_t u16Mask_, EventFlagOperation eMode_)
Wait Block a thread on the specific flags in this event flag group.
void Init()
Init Initializes the EventFlag object prior to use.
The EventFlag class. This class implements a blocking object, similar to a semaphore or mutex...
Definition: eventflag.h:45
The BlockingObject class. Class implementing thread-blocking primatives. used for implementing things...
Definition: blocking.h:65
void WakeMe(Thread *pclChosenOne_)
WakeMe Wake the given thread, currently blocking on this object.