EE445M RTOS
Taken at the University of Texas Spring 2015
semaphorepp.hpp
Go to the documentation of this file.
1 /* -*- mode: c++; c-basic-offset: 4; -*- */
2 /* Created by Hershal Bhave and Eric Crosson 2015-03-08 */
3 /* Revision history: Look in Git FGT */
4 #ifndef __semaphorepp__
5 #define __semaphorepp__
6 
7 #include <stdint.h>
8 
9 #include "criticalpp.hpp"
10 
11 #define TEST_SEMAPHORE 1
12 
17 class semaphore : public critical {
18 private:
19  int16_t value;
20 #if TEST_SEMAPHORE == 1
21  uint32_t total_posts;
22 #endif
23 public:
24  semaphore();
25  semaphore(int16_t initial_value);
26 
27  void init(void);
28 
30  void post(void);
31 
33  void wait(void);
34 
36  void take(void);
37 
39  bool guard(void);
40 
42  bool blocked(void);
43 
45  void reset(void);
46 };
47 
48 #endif
49 
50 /* End Doxygen group
51  * @}
52  */
53 
54 /* Local Variables: */
55 /* firestarter: (compile "make -k -j32 -C ~/workspace/ee445m-labs/build/") */
56 /* End: */
bool guard(void)
Definition: semaphorepp.cpp:57
void post(void)
Definition: semaphorepp.cpp:45
void wait(void)
Definition: semaphorepp.cpp:35
bool blocked(void)
Definition: semaphorepp.cpp:68
void reset(void)
Definition: semaphorepp.cpp:28
uint32_t total_posts
Definition: semaphorepp.hpp:21
void init(void)
Definition: semaphorepp.cpp:21
void take(void)
int16_t value
Definition: semaphorepp.hpp:19