19#ifndef EQUEUE_PLATFORM_H
20#define EQUEUE_PLATFORM_H
37#if !defined(EQUEUE_PLATFORM_POSIX) \
38 && !defined(EQUEUE_PLATFORM_MBED)
39#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__MINGW32__) || defined(__MINGW64__)
40#define EQUEUE_PLATFORM_POSIX
41#elif defined(__MBED__)
42#define EQUEUE_PLATFORM_MBED
44#warning "Unknown platform! Please update equeue_platform.h"
49#if defined(EQUEUE_PLATFORM_POSIX)
51#elif defined(EQUEUE_PLATFORM_MBED)
53#include "mbed_rtos_storage.h"
65void equeue_tick_init(
void);
66unsigned equeue_tick(
void);
76#if defined(EQUEUE_PLATFORM_POSIX)
77typedef pthread_mutex_t equeue_mutex_t;
78#elif defined(EQUEUE_PLATFORM_WINDOWS)
79typedef CRITICAL_SECTION equeue_mutex_t;
80#elif defined(EQUEUE_PLATFORM_MBED)
81typedef unsigned equeue_mutex_t;
82#elif defined(EQUEUE_PLATFORM_FREERTOS)
83typedef UBaseType_t equeue_mutex_t;
94int equeue_mutex_create(equeue_mutex_t *mutex);
95void equeue_mutex_destroy(equeue_mutex_t *mutex);
96void equeue_mutex_lock(equeue_mutex_t *mutex);
97void equeue_mutex_unlock(equeue_mutex_t *mutex);
111#if defined(EQUEUE_PLATFORM_POSIX)
112typedef struct equeue_sema {
113 pthread_mutex_t mutex;
117#elif defined(EQUEUE_PLATFORM_MBED) && MBED_CONF_RTOS_API_PRESENT
118typedef struct equeue_sema {
121 osEventFlagsId_t _id;
122 mbed_rtos_storage_event_flags_t _obj_mem;
125#elif defined(EQUEUE_PLATFORM_MBED)
126typedef int equeue_sema_t;
143int equeue_sema_create(equeue_sema_t *sema);
144void equeue_sema_destroy(equeue_sema_t *sema);
145void equeue_sema_signal(equeue_sema_t *sema);
146bool equeue_sema_wait(equeue_sema_t *sema,
int ms);