Embedded Wireless Framework
ewf_platform_freertos.h
Go to the documentation of this file.
1 /************************************************************************/
9 #ifndef __ewf_platform_freertos__h__included__
10 #define __ewf_platform_freertos__h__included__
11 
12 #include "ewf_platform.h"
13 
14 #include "FreeRTOS.h"
15 #include "task.h"
16 #include "semphr.h"
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 /************************************************************************/
31 #define EWF_PLATFORM_TICKS_PER_SECOND (configTICK_RATE_HZ)
32 
34 #define EWF_PLATFORM_THREAD_PRIORITY_HIGH (configMAX_PRIORITIES - 1)
35 #define EWF_PLATFORM_THREAD_PRIORITY_MEDIUM (configMAX_PRIORITIES / 2)
36 #define EWF_PLATFORM_THREAD_PRIORITY_LOW (1)
37 
38 /************************************************************************/
43 {
44  StaticTask_t task;
45  char * name_ptr;
46  ewf_platform_thread_function thread_function_ptr;
47  void* thread_function_data;
48  StackType_t * stack_ptr;
49  uint32_t stack_size;
50  UBaseType_t priority;
51  TaskHandle_t task_handle;
52 };
53 
54 #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) \
55 do { \
56 static StackType_t _ewf_platform_thread__stack__##thread_name_symb[stack_size_param / sizeof(StackType_t ) + 1]; \
57 static struct _ewf_platform_thread _ewf_platform_thread__##thread_name_symb = {0}; \
58 _ewf_platform_thread__##thread_name_symb.name_ptr = #thread_name_symb; \
59 _ewf_platform_thread__##thread_name_symb.thread_function_ptr = thread_function_ptr_param; \
60 _ewf_platform_thread__##thread_name_symb.thread_function_data = thread_function_data_param; \
61 _ewf_platform_thread__##thread_name_symb.stack_ptr = _ewf_platform_thread__stack__##thread_name_symb; \
62 _ewf_platform_thread__##thread_name_symb.stack_size = stack_size_param / sizeof(StackType_t); \
63 _ewf_platform_thread__##thread_name_symb.priority = thread_priority_param; \
64 _ewf_platform_thread__##thread_name_symb.task_handle = NULL; \
65 thread_ptr = &(_ewf_platform_thread__##thread_name_symb); \
66 } while(0)
67 
69 {
70  SemaphoreHandle_t semaphore_handle;
71  StaticSemaphore_t semaphore;
72 };
73 
74 #define EWF_PLATFORM_MUTEX_STATIC_DECLARE(mutex_ptr, mutex_name) \
75 do { \
76 static struct _ewf_platform_mutex _ewf_platform_mutex__##mutex_name = {0}; \
77 mutex_ptr = &(_ewf_platform_mutex__##mutex_name); \
78 } while(0)
79 
84 {
85  QueueHandle_t xQueue;
86  StaticQueue_t xStaticQueue;
87  char* name_cstr;
88  uint32_t message_size;
89  UBaseType_t uxQueueLength;
90  UBaseType_t uxItemSize;
91  uint8_t* pucQueueStorageBuffer;
92 };
93 
101 #define EWF_PLATFORM_QUEUE_STATIC_DECLARE(queue_ptr, queue_name_symb, item_type_param, item_count_param) \
102 do { \
103 static uint8_t ewf_platform_queue__buffer__##queue_name_symb[sizeof(item_type_param) * item_count_param]; \
104 static ewf_platform_queue ewf_platform_queue__##queue_name_symb = {0}; \
105 ewf_platform_queue__##queue_name_symb.name_cstr = #queue_name_symb; \
106 ewf_platform_queue__##queue_name_symb.uxQueueLength = item_count_param; \
107 ewf_platform_queue__##queue_name_symb.uxItemSize = sizeof(item_type_param); \
108 ewf_platform_queue__##queue_name_symb.pucQueueStorageBuffer = ewf_platform_queue__buffer__##queue_name_symb; \
109 queue_ptr = &(ewf_platform_queue__##queue_name_symb); \
110 } while(0)
111 
112 #ifdef __cplusplus
113 }
114 #endif
115 
116 #endif /* __ewf_platform_freertos__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