--- /dev/null
+/*
+ * Copyright (C) 2015 Czech Technical University in Prague
+ *
+ * Authors:
+ * - Michal Sojka <sojkam1@fel.cvut.cz>
+ *
+ * This document contains proprietary information belonging to Czech
+ * Technical University in Prague. Passing on and copying of this
+ * document, and communication of its contents is not permitted
+ * without prior written authorization.
+ *
+ */
+
+#ifndef RPP_MUTEX_H
+#define RPP_MUTEX_H
+
+#ifndef RPP_THREADSAFE
+#define RPP_THREADSAFE 1
+#endif
+
+#if RPP_THREADSAFE
+
+#include <os/semphr.h>
+
+#define RPP_MUTEX_DEFINE(mutex) static xSemaphoreHandle mutex
+#define RPP_MUTEX_INIT(mutex) (((mutex) = xSemaphoreCreateMutex()) != NULL)
+#define RPP_MUTEX_LOCK(mutex) xSemaphoreTake((mutex), portMAX_DELAY)
+#define RPP_MUTEX_UNLOCK(mutex) xSemaphoreGive(mutex)
+
+#else
+
+#define RPP_MUTEX_DEFINE(mutex)
+#define RPP_MUTEX_INIT(mutex) true
+#define RPP_MUTEX_LOCK(mutex)
+#define RPP_MUTEX_UNLOCK(mutex)
+
+#endif
+
+#endif