update osal for mynewt

This commit is contained in:
hathach
2019-03-21 00:36:52 +07:00
parent 87962a222d
commit a1a6220ac8
3 changed files with 57 additions and 56 deletions

View File

@@ -65,11 +65,6 @@ static inline bool osal_semaphore_post(osal_semaphore_t sem_hdl, bool in_isr)
return true;
}
static inline void osal_semaphore_reset(osal_semaphore_t sem_hdl)
{
sem_hdl->count = 0;
}
// TODO blocking for now
static inline bool osal_semaphore_wait (osal_semaphore_t sem_hdl, uint32_t msec)
{
@@ -81,6 +76,11 @@ static inline bool osal_semaphore_wait (osal_semaphore_t sem_hdl, uint32_t msec)
return true;
}
static inline void osal_semaphore_reset(osal_semaphore_t sem_hdl)
{
sem_hdl->count = 0;
}
//--------------------------------------------------------------------+
// MUTEX API
// Within tinyusb, mutex is never used in ISR context
@@ -94,8 +94,8 @@ static inline osal_mutex_t osal_mutex_create(osal_mutex_def_t* mdef)
return mdef;
}
#define osal_mutex_unlock(_mutex_hdl) osal_semaphore_post(_mutex_hdl, false)
#define osal_mutex_lock osal_semaphore_wait
#define osal_mutex_unlock(_mutex_hdl) osal_semaphore_post(_mutex_hdl, false)
//--------------------------------------------------------------------+
// QUEUE API