9 #ifndef __ewf_platform_pthread__h__included__
10 #define __ewf_platform_pthread__h__included__
14 #ifndef EWF_PLATFORM_PTHREAD
15 #error EWF_PLATFORM_PTHREAD must be defined before including this file
39 #define EWF_PLATFORM_TICKS_PER_SECOND (1000)
42 #define EWF_THREAD_PRIORITY_HIGH (THREAD_PRIORITY_ABOVE_NORMAL)
43 #define EWF_THREAD_PRIORITY_MEDIUM (THREAD_PRIORITY_NORMAL)
44 #define EWF_THREAD_PRIORITY_LOW (THREAD_PRIORITY_IDLE)
54 ewf_platform_thread_function thread_function_ptr;
55 void* thread_function_data;
60 #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) \
62 static ewf_platform_thread__##thread_name_symb = {0}; \
63 ewf_platform_pthread__##thread_name_symb.thread_function_ptr = thread_function_ptr_param; \
64 ewf_platform_pthread__##thread_name_symb.thread_function_data = thread_function_data_param; \
65 ewf_platform_pthread__##thread_name_symb.stacksize = stack_size_param; \
66 ewf_platform_pthread__##thread_name_symb.prio = thread_priority_param; \
67 thread_ptr = &(ewf_platform_pthread__##thread_name_symb); \
72 pthread_mutex_t mutex;
73 pthread_mutexattr_t mutexattr;
76 #define EWF_PLATFORM_MUTEX_STATIC_DECLARE(mutex_ptr, mutex_name_symb) \
78 static ewf_platform_mutex ewf_platform_mutex__##mutex_name_symb = {0}; \
79 mutex_ptr = &(ewf_platform_mutex__##mutex_name_symb); \
84 pthread_mutex_t mutex;
85 pthread_mutexattr_t mutexattr;
88 volatile uint32_t queue_size;
89 volatile uint32_t tail_index;
90 volatile uint32_t used_count;
100 #define EWF_PLATFORM_QUEUE_STATIC_DECLARE(queue_ptr, queue_name_symb, item_type, item_count) \
102 static item_type ewf_platform_queue__data__##queue_name_symb[item_count]; \
103 static ewf_platform_queue ewf_platform_queue__##queue_name_symb = {0}; \
104 ewf_platform_queue__##queue_name_symb.data = ewf_platform_queue__data__##queue_name_symb; \
105 ewf_platform_queue__##queue_name_symb.item_size = sizeof(item_type); \
106 ewf_platform_queue__##queue_name_symb.queue_size = item_count; \
107 ewf_platform_queue__##queue_name_symb.tail_index = 0; \
108 ewf_platform_queue__##queue_name_symb.used_count = 0; \
109 queue_ptr = &(ewf_platform_queue__##queue_name_symb); \