Embedded Wireless Framework
ewf_platform_win32.h
Go to the documentation of this file.
1 /************************************************************************/
9 #ifndef __ewf_platform_win32__h__included__
10 #define __ewf_platform_win32__h__included__
11 
12 #include "ewf_platform.h"
13 
14 #ifndef EWF_PLATFORM_WIN32
15 #error EWF_PLATFORM_WIN32 must be defined before including this file
16 #endif
17 
18 #include <WinSock2.h>
19 #include <windows.h>
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 /************************************************************************/
32 /************************************************************************/
40 #define EWF_PLATFORM_TICKS_PER_SECOND (1000)
41 
43 #define EWF_THREAD_PRIORITY_HIGH (THREAD_PRIORITY_ABOVE_NORMAL)
44 #define EWF_THREAD_PRIORITY_MEDIUM (THREAD_PRIORITY_NORMAL)
45 #define EWF_THREAD_PRIORITY_LOW (THREAD_PRIORITY_IDLE)
46 
47 /************************************************************************/
52 {
53  HANDLE hThread;
54  unsigned dwThreadId;
55  ewf_platform_thread_function thread_function_ptr;
56  void* thread_function_data;
57 };
58 
59 #define EWF_PLATFORM_THREAD_STATIC_DECLARE(thread_ptr, thread_name_symb, thread_function_ptr_param, thread_function_data_param, stack_size_param, thread_priority_param) \
60 do { \
61 static ULONG _ewf_platform_thread__stack__##thread_name_symb[stack_size_param / sizeof(ULONG)]; \
62 static struct _ewf_platform_thread _ewf_platform_thread__##thread_name_symb = {0}; \
63 _ewf_platform_thread__##thread_name_symb.thread_function_ptr = thread_function_ptr_param; \
64 _ewf_platform_thread__##thread_name_symb.thread_function_data = thread_function_data_param; \
65 thread_ptr = &(_ewf_platform_thread__##thread_name_symb); \
66 } while(0)
67 
69 {
70  HANDLE hMutex;
71 };
72 
73 #define EWF_PLATFORM_MUTEX_STATIC_DECLARE(mutex_ptr, mutex_name_symb) \
74 do { \
75 static struct _ewf_platform_mutex _ewf_platform_mutex__##mutex_name_symb = {0}; \
76 mutex_ptr = &(_ewf_platform_mutex__##mutex_name_symb); \
77 } while(0)
78 
80 {
81  HANDLE hMutex;
82  void* data;
83  uint32_t item_size;
84  volatile uint32_t queue_size;
85  volatile uint32_t tail_index;
86  volatile uint32_t used_count;
87 };
88 
96 #define EWF_PLATFORM_QUEUE_STATIC_DECLARE(queue_ptr, queue_name_symb, item_type, item_count) \
97 do { \
98 static item_type ewf_platform_queue__data__##queue_name_symb[item_count]; \
99 static ewf_platform_queue ewf_platform_queue__##queue_name_symb = {0}; \
100 ewf_platform_queue__##queue_name_symb.data = ewf_platform_queue__data__##queue_name_symb; \
101 ewf_platform_queue__##queue_name_symb.item_size = sizeof(item_type); \
102 ewf_platform_queue__##queue_name_symb.queue_size = item_count; \
103 ewf_platform_queue__##queue_name_symb.tail_index = 0; \
104 ewf_platform_queue__##queue_name_symb.used_count = 0; \
105 queue_ptr = &(ewf_platform_queue__##queue_name_symb); \
106 } while(0)
107 
108 /************************************************************************/
112 #ifdef __cplusplus
113 }
114 #endif
115 
116 #endif /* __ewf_platform_win32__h__included__ */
The Embedded Wireless Framework Software Platform API.
The platform mutex structure.
Definition: ewf_platform_freertos.h:69
The platform queue structure.
Definition: ewf_platform_bare_metal.h:74
The platform thread structure.
Definition: ewf_platform_freertos.h:43