Embedded Wireless Framework
ewf_platform.h
Go to the documentation of this file.
1 /************************************************************************/
9 #ifndef __ewf_platform__h__included__
10 #define __ewf_platform__h__included__
11 
12 #include "ewf.h"
13 
14 /****************************************************************************
15  * Check for platform definitions, define/undef EWF_PLATFORM_HAS_THREADING
16  ****************************************************************************/
17 
18 #if defined(EWF_PLATFORM_BARE_METAL) && !defined(EWF_PLATFORM_THREADX) && !defined(EWF_PLATFORM_FREERTOS) && !defined(EWF_PLATFORM_WIN32) && !defined(EWF_PLATFORM_PTHREAD)
19 #undef EWF_PLATFORM_HAS_THREADING
20 #elif !defined(EWF_PLATFORM_BARE_METAL) && defined(EWF_PLATFORM_THREADX) && !defined(EWF_PLATFORM_FREERTOS) && !defined(EWF_PLATFORM_WIN32) && !defined(EWF_PLATFORM_PTHREAD)
21 #define EWF_PLATFORM_HAS_THREADING
22 #elif !defined(EWF_PLATFORM_BARE_METAL) && !defined(EWF_PLATFORM_THREADX) && defined(EWF_PLATFORM_FREERTOS) && !defined(EWF_PLATFORM_WIN32) && !defined(EWF_PLATFORM_PTHREAD)
23 #define EWF_PLATFORM_HAS_THREADING
24 #elif !defined(EWF_PLATFORM_BARE_METAL) && !defined(EWF_PLATFORM_THREADX) && !defined(EWF_PLATFORM_FREERTOS) && defined(EWF_PLATFORM_WIN32) && !defined(EWF_PLATFORM_PTHREAD)
25 #define EWF_PLATFORM_HAS_THREADING
26 #elif !defined(EWF_PLATFORM_BARE_METAL) && !defined(EWF_PLATFORM_THREADX) && !defined(EWF_PLATFORM_FREERTOS) && !defined(EWF_PLATFORM_WIN32) && defined(EWF_PLATFORM_PTHREAD)
27 #define EWF_PLATFORM_HAS_THREADING
28 #else
29 #error One and only one valid platform should be defined (check the file ewf.config.h and/or your build settings)
30 #endif
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /************************************************************************/
48 
49 #ifdef EWF_PLATFORM_HAS_THREADING
50 
51 /************************************************************************/
60 enum ewf_platform_thread_priority;
61 
66 
70 typedef struct _ewf_platform_thread ewf_platform_thread;
71 
75 typedef ewf_result(*ewf_platform_thread_function)(void *);
76 
82 ewf_result ewf_platform_thread_create(ewf_platform_thread * thread_ptr);
83 
88 ewf_result ewf_platform_thread_destroy(ewf_platform_thread * thread_ptr);
89 
95 ewf_result ewf_platform_thread_start(ewf_platform_thread * thread_ptr);
96 
101 ewf_result ewf_platform_thread_stop(ewf_platform_thread * thread_ptr);
102 
103 /************************************************************************/
107 #endif /* EWF_PLATFORM_HAS_THREADING */
108 
109 #ifdef EWF_PLATFORM_HAS_THREADING
110 
111 /************************************************************************/
120 struct _ewf_platform_mutex;
121 
125 typedef struct _ewf_platform_mutex ewf_platform_mutex;
126 
132 ewf_result ewf_platform_mutex_create(ewf_platform_mutex * mutex_ptr);
133 
138 ewf_result ewf_platform_mutex_destroy(ewf_platform_mutex * mutex_ptr);
139 
145 ewf_result ewf_platform_mutex_get(ewf_platform_mutex * mutex_ptr);
146 
151 ewf_result ewf_platform_mutex_put(ewf_platform_mutex * mutex_ptr);
152 
153 /************************************************************************/
157 #endif /* EWF_PLATFORM_HAS_THREADING */
158 
159 /************************************************************************/
168 struct _ewf_platform_queue;
169 
174 
180 
186 
191 ewf_result ewf_platform_queue_enqueue(ewf_platform_queue* queue_ptr, const void* data_ptr, uint32_t data_size, bool wait);
192 
197 ewf_result ewf_platform_queue_dequeue(ewf_platform_queue* queue_ptr, void* buffer_ptr, uint32_t* buffer_size_ptr, bool wait);
198 
199 /************************************************************************/
203 /************************************************************************/
207 #ifdef __cplusplus
208 }
209 #endif
210 
211 /****************************************************************************
212  * Include the platform specific header
213  ****************************************************************************/
214 
215 #if defined(EWF_PLATFORM_BARE_METAL)
216 #include "ewf_platform_bare_metal.h"
217 #elif defined(EWF_PLATFORM_THREADX)
218 #include "ewf_platform_threadx.h"
219 #elif defined(EWF_PLATFORM_FREERTOS)
220 #include "ewf_platform_freertos.h"
221 #elif defined(EWF_PLATFORM_WIN32)
222 #include "ewf_platform_win32.h"
223 #elif defined(EWF_PLATFORM_PTHREAD)
224 #include "ewf_platform_pthread.h"
225 #else
226 #error No valid platform defined!
227 #endif
228 
229 #endif /* __ewf_platform__h__included__ */
The Embedded Wireless Framework.
The Embedded Wireless Framework bare metal platform.
The Embedded Wireless Framework freeRTOS platform API.
The Embedded Wireless Framework POSIX threads platform API.
The Embedded Wireless Framework ThreadX platform.
The Embedded Wireless Framework WIN32 platform.
enum _ewf_result ewf_result
Success and error result codes specific to the EWF API.
ewf_result ewf_platform_queue_enqueue(ewf_platform_queue *queue_ptr, const void *data_ptr, uint32_t data_size, bool wait)
Enqueue an item.
Definition: ewf_platform_bare_metal.c:45
ewf_result ewf_platform_queue_create(ewf_platform_queue *queue_ptr)
Create a queue.
Definition: ewf_platform_bare_metal.c:19
ewf_result ewf_platform_queue_destroy(ewf_platform_queue *queue_ptr)
Destroy a queue.
Definition: ewf_platform_bare_metal.c:32
ewf_result ewf_platform_queue_dequeue(ewf_platform_queue *queue_ptr, void *buffer_ptr, uint32_t *buffer_size_ptr, bool wait)
Dequeue an item.
Definition: ewf_platform_bare_metal.c:97
ewf_result ewf_platform_sleep(uint32_t time)
Sleeps for a number of time ticks.
Definition: ewf_platform_bare_metal.c:13
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