This is the PAL (Platform Adaptation Layer) for the Pubnub C-core library.

Dependencies:   Pubnub_c_core

Dependents:   Pubnub_mbed2_sync

Committer:
sveljko
Date:
Tue Dec 06 10:22:54 2016 +0000
Revision:
3:be58f6801809
Parent:
0:389a44951c54
Update doc for srand_from_pubnub_time()

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sveljko 0:389a44951c54 1 /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */
sveljko 0:389a44951c54 2 #if !defined INC_PBPAL_MUTEX
sveljko 0:389a44951c54 3 #define INC_PBPAL_MUTEX
sveljko 0:389a44951c54 4
sveljko 0:389a44951c54 5 /** @file pbpal_mutex.h
sveljko 0:389a44951c54 6 PAL for mutex(es) on mbed, using CMSIS-RTOS API.
sveljko 0:389a44951c54 7 */
sveljko 0:389a44951c54 8
sveljko 0:389a44951c54 9 #include "cmsis_os.h"
sveljko 0:389a44951c54 10
sveljko 0:389a44951c54 11 struct pbcmsis_mutex {
sveljko 0:389a44951c54 12 osMutexId mutid;
sveljko 0:389a44951c54 13 osMutexDef_t mutdef;
sveljko 0:389a44951c54 14 };
sveljko 0:389a44951c54 15
sveljko 0:389a44951c54 16 typedef struct pbcmsis_mutex pbpal_mutex_t;
sveljko 0:389a44951c54 17
sveljko 0:389a44951c54 18 #define pbpal_mutex_init(m) do { \
sveljko 0:389a44951c54 19 memset(&((m).mutdef), 0, sizeof (m).mutdef); \
sveljko 0:389a44951c54 20 (m).mutid = osMutexCreate((m).mutef); \
sveljko 0:389a44951c54 21 } while (0)
sveljko 0:389a44951c54 22
sveljko 0:389a44951c54 23 #define pbpal_mutex_lock(m) osMutexWait((m).mutid, osWaitForever)
sveljko 0:389a44951c54 24 #define pbpal_mutex_unlock(m) osMutexRelease((m).mutid)
sveljko 0:389a44951c54 25 #define pbpal_mutex_destroy(m) osMutexDelete((m).mutid)
sveljko 0:389a44951c54 26 #define pbpal_mutex_decl_and_init(m) pbpal_mutex_t m = { 0 }; (m).mutid = osMutexCreate(&(m).mutdef)
sveljko 0:389a44951c54 27 #define pbpal_mutex_static_decl_and_init(m) static pbpal_mutex_t m = { 0 }
sveljko 0:389a44951c54 28 #define pbpal_mutex_init_static(m) (m).mutid = osMutexCreate(&(m).mutdef)
sveljko 0:389a44951c54 29
sveljko 0:389a44951c54 30
sveljko 0:389a44951c54 31 #endif /*!defined INC_PBPAL_MUTEX*/
sveljko 0:389a44951c54 32