clean up
This commit is contained in:
@@ -21,6 +21,8 @@ TinyUSB is an open-source cross-platform USB Host/Device stack for embedded syst
|
|||||||
|
|
||||||
## Device Stack
|
## Device Stack
|
||||||
|
|
||||||
|
Support suspend, resume, remote wakeup with auto generated descritpors
|
||||||
|
|
||||||
- Human Interface Device (HID): Keyboard, Mouse, Generic
|
- Human Interface Device (HID): Keyboard, Mouse, Generic
|
||||||
- Communication Class (CDC)
|
- Communication Class (CDC)
|
||||||
- Mass Storage Class (MSC)
|
- Mass Storage Class (MSC)
|
||||||
|
|||||||
@@ -34,7 +34,6 @@
|
|||||||
/** \addtogroup group_osal
|
/** \addtogroup group_osal
|
||||||
* @{ */
|
* @{ */
|
||||||
|
|
||||||
#include "tusb_option.h"
|
|
||||||
#include "common/tusb_common.h"
|
#include "common/tusb_common.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@@ -48,34 +47,33 @@ enum
|
|||||||
|
|
||||||
typedef void (*osal_task_func_t)( void * );
|
typedef void (*osal_task_func_t)( void * );
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// OSAL Porting API
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
#if 0
|
||||||
|
void osal_task_delay(uint32_t msec);
|
||||||
|
|
||||||
|
//------------- Semaphore -------------//
|
||||||
|
osal_semaphore_t osal_semaphore_create(osal_semaphore_def_t* semdef);
|
||||||
|
bool osal_semaphore_post(osal_semaphore_t sem_hdl, bool in_isr);
|
||||||
|
bool osal_semaphore_wait (osal_semaphore_t sem_hdl, uint32_t msec);
|
||||||
|
|
||||||
|
void osal_semaphore_reset(osal_semaphore_t sem_hdl); // TODO removed
|
||||||
|
|
||||||
|
//------------- Mutex -------------//
|
||||||
|
osal_mutex_t osal_mutex_create(osal_mutex_def_t* mdef);
|
||||||
|
bool osal_mutex_lock (osal_mutex_t sem_hdl, uint32_t msec);
|
||||||
|
bool osal_mutex_unlock(osal_mutex_t mutex_hdl);
|
||||||
|
|
||||||
|
//------------- Queue -------------//
|
||||||
|
osal_queue_t osal_queue_create(osal_queue_def_t* qdef);
|
||||||
|
bool osal_queue_receive(osal_queue_t const qhdl, void* data);
|
||||||
|
bool osal_queue_send(osal_queue_t const qhdl, void const * data, bool in_isr);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
#if CFG_TUSB_OS == OPT_OS_NONE
|
||||||
#include "osal_none.h"
|
#include "osal_none.h"
|
||||||
#else
|
#else
|
||||||
/* RTOS Porting API
|
|
||||||
*
|
|
||||||
* Task
|
|
||||||
* void osal_task_delay(uint32_t msec)
|
|
||||||
*
|
|
||||||
* Queue
|
|
||||||
* osal_queue_def_t, osal_queue_t
|
|
||||||
* osal_queue_t osal_queue_create(osal_queue_def_t* qdef)
|
|
||||||
* osal_queue_receive (osal_queue_t const queue_hdl, void *p_data, uint32_t msec, uint32_t *p_error)
|
|
||||||
* bool osal_queue_send(osal_queue_t const queue_hdl, void const * data, bool in_isr)
|
|
||||||
*
|
|
||||||
* Semaphore
|
|
||||||
* osal_semaphore_def_t, osal_semaphore_t
|
|
||||||
* osal_semaphore_t osal_semaphore_create(osal_semaphore_def_t* semdef)
|
|
||||||
* bool osal_semaphore_post(osal_semaphore_t sem_hdl, bool in_isr)
|
|
||||||
* bool osal_semaphore_wait(osal_semaphore_t sem_hdl, uint32_t msec)
|
|
||||||
* void osal_semaphore_reset(osal_semaphore_t const sem_hdl)
|
|
||||||
*
|
|
||||||
* Mutex
|
|
||||||
* osal_mutex_t
|
|
||||||
* osal_mutex_create(osal_mutex_def_t* mdef)
|
|
||||||
* bool osal_mutex_unlock(osal_mutex_t mutex_hdl)
|
|
||||||
* void osal_mutex_lock(osal_mutex_t mutex_hdl, uint32_t msec, uint32_t *p_error)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if CFG_TUSB_OS == OPT_OS_FREERTOS
|
#if CFG_TUSB_OS == OPT_OS_FREERTOS
|
||||||
#include "osal_freertos.h"
|
#include "osal_freertos.h"
|
||||||
#elif CFG_TUSB_OS == OPT_OS_MYNEWT
|
#elif CFG_TUSB_OS == OPT_OS_MYNEWT
|
||||||
|
|||||||
@@ -83,7 +83,10 @@ static inline osal_mutex_t osal_mutex_create(osal_mutex_def_t* mdef)
|
|||||||
return xSemaphoreCreateMutexStatic(mdef);
|
return xSemaphoreCreateMutexStatic(mdef);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define osal_mutex_lock osal_semaphore_wait
|
static inline bool osal_mutex_lock (osal_mutex_t mutex_hdl, uint32_t msec)
|
||||||
|
{
|
||||||
|
return osal_semaphore_wait(mutex_hdl, msec);
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool osal_mutex_unlock(osal_mutex_t mutex_hdl)
|
static inline bool osal_mutex_unlock(osal_mutex_t mutex_hdl)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -95,8 +95,15 @@ static inline osal_mutex_t osal_mutex_create(osal_mutex_def_t* mdef)
|
|||||||
return mdef;
|
return mdef;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define osal_mutex_lock osal_semaphore_wait
|
static inline bool osal_mutex_lock (osal_mutex_t mutex_hdl, uint32_t msec)
|
||||||
#define osal_mutex_unlock(_mutex_hdl) osal_semaphore_post(_mutex_hdl, false)
|
{
|
||||||
|
return osal_semaphore_wait(mutex_hdl, msec);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool osal_mutex_unlock(osal_mutex_t mutex_hdl)
|
||||||
|
{
|
||||||
|
return osal_semaphore_post(mutex_hdl, false);
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// QUEUE API
|
// QUEUE API
|
||||||
|
|||||||
Reference in New Issue
Block a user