summaryrefslogtreecommitdiff
path: root/src/osal
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-11-18 09:36:16 +0700
committerhathach <[email protected]>2025-11-18 09:36:16 +0700
commit98f7b0c7ba03fd770616195a6312e1bb65e5155f (patch)
tree6dce3fafc3794fd3cd1f13bd0cc04bfb84989e24 /src/osal
parentbeea882c6bcee352b5ff69446aef9fc43237bab0 (diff)
parent66c84528f67c0eedc23d25221500d820e702d93f (diff)
Merge branch 'master' into fork/HiFiPhile/dwc2_iso_incomp
Diffstat (limited to 'src/osal')
-rw-r--r--src/osal/osal.h21
-rw-r--r--src/osal/osal_freertos.h14
-rw-r--r--src/osal/osal_none.h6
-rw-r--r--src/osal/osal_pico.h5
4 files changed, 22 insertions, 24 deletions
diff --git a/src/osal/osal.h b/src/osal/osal.h
index a33280425..44521620f 100644
--- a/src/osal/osal.h
+++ b/src/osal/osal.h
@@ -24,8 +24,8 @@
* This file is part of the TinyUSB stack.
*/
-#ifndef _TUSB_OSAL_H_
-#define _TUSB_OSAL_H_
+#ifndef TUSB_OSAL_H_
+#define TUSB_OSAL_H_
#ifdef __cplusplus
extern "C" {
@@ -33,7 +33,7 @@
#include "common/tusb_common.h"
-typedef void (*osal_task_func_t)( void * );
+typedef void (*osal_task_func_t)(void* param);
// Timeout
#define OSAL_TIMEOUT_NOTIMEOUT (0) // Return immediately
@@ -71,10 +71,9 @@ typedef void (*osal_task_func_t)( void * );
#error OS is not supported yet
#endif
-//--------------------------------------------------------------------+
-// OSAL Porting API
-// Should be implemented as static inline function in osal_port.h header
-/*
+/*--------------------------------------------------------------------
+ OSAL Porting API
+ Should be implemented as static inline function in osal_port.h header
void osal_spin_init(osal_spinlock_t *ctx);
void osal_spin_lock(osal_spinlock_t *ctx, bool in_isr)
void osal_spin_unlock(osal_spinlock_t *ctx, bool in_isr);
@@ -83,7 +82,7 @@ typedef void (*osal_task_func_t)( void * );
bool osal_semaphore_delete(osal_semaphore_t semd_hdl);
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
+ void osal_semaphore_reset(osal_semaphore_t sem_hdl);
osal_mutex_t osal_mutex_create(osal_mutex_def_t* mdef);
bool osal_mutex_delete(osal_mutex_t mutex_hdl)
@@ -95,11 +94,11 @@ typedef void (*osal_task_func_t)( void * );
bool osal_queue_receive(osal_queue_t qhdl, void* data, uint32_t msec);
bool osal_queue_send(osal_queue_t qhdl, void const * data, bool in_isr);
bool osal_queue_empty(osal_queue_t qhdl);
-*/
-//--------------------------------------------------------------------+
+--------------------------------------------------------------------------*/
+
#ifdef __cplusplus
}
#endif
-#endif /* _TUSB_OSAL_H_ */
+#endif
diff --git a/src/osal/osal_freertos.h b/src/osal/osal_freertos.h
index bde5ec010..9aeda4d01 100644
--- a/src/osal/osal_freertos.h
+++ b/src/osal/osal_freertos.h
@@ -70,15 +70,15 @@ typedef struct {
} osal_queue_def_t;
#if defined(configQUEUE_REGISTRY_SIZE) && (configQUEUE_REGISTRY_SIZE>0)
- #define _OSAL_Q_NAME(_name) .name = #_name
+ #define OSAL_Q_NAME(_name) .name = #_name
#else
- #define _OSAL_Q_NAME(_name)
+ #define OSAL_Q_NAME(_name)
#endif
// _int_set is not used with an RTOS
#define OSAL_QUEUE_DEF(_int_set, _name, _depth, _type) \
static _type _name##_##buf[_depth];\
- osal_queue_def_t _name = { .depth = _depth, .item_sz = sizeof(_type), .buf = _name##_##buf, _OSAL_Q_NAME(_name) }
+ osal_queue_def_t _name = { .depth = _depth, .item_sz = sizeof(_type), .buf = _name##_##buf, OSAL_Q_NAME(_name) }
//--------------------------------------------------------------------+
// TASK API
@@ -137,7 +137,7 @@ TU_ATTR_ALWAYS_INLINE static inline void osal_spin_init(osal_spinlock_t *ctx) {
TU_ATTR_ALWAYS_INLINE static inline void osal_spin_lock(osal_spinlock_t *ctx, bool in_isr) {
if (in_isr) {
- if (!TUP_MCU_MULTIPLE_CORE) {
+ if (TUP_MCU_MULTIPLE_CORE == 0) {
(void) ctx;
return; // single core MCU does not need to lock in ISR
}
@@ -149,7 +149,7 @@ TU_ATTR_ALWAYS_INLINE static inline void osal_spin_lock(osal_spinlock_t *ctx, bo
TU_ATTR_ALWAYS_INLINE static inline void osal_spin_unlock(osal_spinlock_t *ctx, bool in_isr) {
if (in_isr) {
- if (!TUP_MCU_MULTIPLE_CORE) {
+ if (TUP_MCU_MULTIPLE_CORE == 0) {
(void) ctx;
return; // single core MCU does not need to lock in ISR
}
@@ -166,7 +166,7 @@ TU_ATTR_ALWAYS_INLINE static inline void osal_spin_unlock(osal_spinlock_t *ctx,
//--------------------------------------------------------------------+
TU_ATTR_ALWAYS_INLINE static inline osal_semaphore_t osal_semaphore_create(osal_semaphore_def_t *semdef) {
#if configSUPPORT_STATIC_ALLOCATION
- return xSemaphoreCreateBinaryStatic(semdef);
+ return xSemaphoreCreateBinaryStatic((StaticSemaphore_t*) semdef);
#else
(void) semdef;
return xSemaphoreCreateBinary();
@@ -174,7 +174,7 @@ TU_ATTR_ALWAYS_INLINE static inline osal_semaphore_t osal_semaphore_create(osal_
}
TU_ATTR_ALWAYS_INLINE static inline bool osal_semaphore_delete(osal_semaphore_t semd_hdl) {
- vSemaphoreDelete(semd_hdl);
+ vSemaphoreDelete((SemaphoreHandle_t) semd_hdl);
return true;
}
diff --git a/src/osal/osal_none.h b/src/osal/osal_none.h
index 3e397ef35..bc86dcb28 100644
--- a/src/osal/osal_none.h
+++ b/src/osal/osal_none.h
@@ -35,7 +35,7 @@ extern "C" {
// Spinlock API
//--------------------------------------------------------------------+
typedef struct {
- void (* interrupt_set)(bool);
+ void (* interrupt_set)(bool enabled);
} osal_spinlock_t;
// For SMP, spinlock must be locked by hardware, cannot just use interrupt
@@ -141,7 +141,7 @@ TU_ATTR_ALWAYS_INLINE static inline bool osal_mutex_unlock(osal_mutex_t mutex_hd
#include "common/tusb_fifo.h"
typedef struct {
- void (* interrupt_set)(bool);
+ void (* interrupt_set)(bool enabled);
tu_fifo_t ff;
} osal_queue_def_t;
@@ -156,7 +156,7 @@ typedef osal_queue_def_t* osal_queue_t;
}
TU_ATTR_ALWAYS_INLINE static inline osal_queue_t osal_queue_create(osal_queue_def_t* qdef) {
- tu_fifo_clear(&qdef->ff);
+ (void) tu_fifo_clear(&qdef->ff);
return (osal_queue_t) qdef;
}
diff --git a/src/osal/osal_pico.h b/src/osal/osal_pico.h
index ace5907d7..f5385071a 100644
--- a/src/osal/osal_pico.h
+++ b/src/osal/osal_pico.h
@@ -81,8 +81,7 @@ TU_ATTR_ALWAYS_INLINE static inline bool osal_semaphore_delete(osal_semaphore_t
TU_ATTR_ALWAYS_INLINE static inline bool osal_semaphore_post(osal_semaphore_t sem_hdl, bool in_isr) {
(void) in_isr;
- sem_release(sem_hdl);
- return true;
+ return sem_release(sem_hdl);
}
TU_ATTR_ALWAYS_INLINE static inline bool osal_semaphore_wait(osal_semaphore_t sem_hdl, uint32_t msec) {
@@ -139,7 +138,7 @@ typedef osal_queue_def_t* osal_queue_t;
TU_ATTR_ALWAYS_INLINE static inline osal_queue_t osal_queue_create(osal_queue_def_t* qdef) {
critical_section_init(&qdef->critsec);
- tu_fifo_clear(&qdef->ff);
+ (void) tu_fifo_clear(&qdef->ff);
return (osal_queue_t) qdef;
}