mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-20 18:40:57 +00:00
correct freertos prio issue
This commit is contained in:
parent
52ed2547cd
commit
04cace7619
@ -201,7 +201,7 @@ typedef enum {
|
||||
#ifdef CORE_M4
|
||||
#define __CM4_REV 0x0000 /*!< Cortex-M4 Core Revision */
|
||||
#define __MPU_PRESENT 1 /*!< MPU present or not */
|
||||
#define __NVIC_PRIO_BITS 4 /*!< Number of Bits used for Priority Levels */
|
||||
#define __NVIC_PRIO_BITS 3 /*!< Number of Bits used for Priority Levels */
|
||||
#define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */
|
||||
#define __FPU_PRESENT 1 /*!< FPU present or not */
|
||||
/** @} */ /* End of group Configuration_of_CMSIS */
|
||||
|
@ -110,7 +110,7 @@ static inline bool osal_queue_send(osal_queue_t const queue_hdl, void const * da
|
||||
|
||||
static inline void osal_queue_flush(osal_queue_t const queue_hdl)
|
||||
{
|
||||
xQueueReset(queue_hdl);
|
||||
// xQueueReset(queue_hdl);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
@ -128,22 +128,34 @@ static inline bool osal_semaphore_post(osal_semaphore_t sem_hdl)
|
||||
{
|
||||
if (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk)
|
||||
{
|
||||
return xSemaphoreGive(sem_hdl);
|
||||
return xSemaphoreGiveFromISR(sem_hdl, NULL);
|
||||
}else
|
||||
{
|
||||
return xSemaphoreGiveFromISR(sem_hdl, NULL);
|
||||
return xSemaphoreGive(sem_hdl);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void osal_semaphore_wait(osal_semaphore_t sem_hdl, uint32_t msec, tusb_error_t *p_error)
|
||||
{
|
||||
uint32_t const ticks = (msec == OSAL_TIMEOUT_WAIT_FOREVER) ? portMAX_DELAY : osal_tick_from_msec(msec);
|
||||
(*p_error) = ( xSemaphoreTake(sem_hdl, ticks) == pdPASS ) ? TUSB_ERROR_NONE : TUSB_ERROR_OSAL_TIMEOUT;
|
||||
|
||||
BaseType_t result;
|
||||
|
||||
if (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk)
|
||||
{
|
||||
result = xSemaphoreTakeFromISR(sem_hdl, NULL);
|
||||
}else
|
||||
{
|
||||
result = xSemaphoreTake(sem_hdl, ticks);
|
||||
}
|
||||
|
||||
(*p_error) = result ? TUSB_ERROR_NONE : TUSB_ERROR_OSAL_TIMEOUT;
|
||||
}
|
||||
|
||||
static inline void osal_semaphore_reset(osal_semaphore_t const sem_hdl)
|
||||
{
|
||||
(void) xSemaphoreTake(sem_hdl, 0);
|
||||
tusb_error_t err;
|
||||
osal_semaphore_wait(sem_hdl, 0, &err);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
|
37
vendor/freertos/FreeRTOSConfig.h
vendored
37
vendor/freertos/FreeRTOSConfig.h
vendored
@ -13,18 +13,25 @@
|
||||
#define configCPU_CLOCK_HZ SystemCoreClock
|
||||
#endif
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||
#define configMAX_PRIORITIES (8 )
|
||||
#define configMINIMAL_STACK_SIZE (128 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 16*1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN 32
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 0
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 10 // used to name queue/semaphore with debugger
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
#define configTICK_RATE_HZ ( 1000 )
|
||||
#define configMAX_PRIORITIES (8 )
|
||||
#define configMINIMAL_STACK_SIZE (128 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 16*1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN 32
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 0
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 10 // used to name queue/semaphore with debugger
|
||||
#define configUSE_QUEUE_SETS 0
|
||||
#define configUSE_TIME_SLICING 0
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
#define configENABLE_BACKWARD_COMPATIBILITY 1
|
||||
|
||||
#define configSUPPORT_STATIC_ALLOCATION 0
|
||||
|
||||
/* Hook function related definitions. */
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
@ -80,7 +87,7 @@
|
||||
#ifdef __NVIC_PRIO_BITS
|
||||
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||
#else
|
||||
#define configPRIO_BITS 5 // 32 priority levels FIXME IAR Assembler will wrongly get this default value
|
||||
#define configPRIO_BITS 5 // 32 priority levels
|
||||
#endif
|
||||
|
||||
/* The lowest interrupt priority that can be used in a call to a "set priority"
|
||||
@ -95,10 +102,10 @@ PRIORITY THAN THIS! (higher priorities are lower numeric values. */
|
||||
|
||||
/* Interrupt priorities used by the kernel port layer itself. These are generic
|
||||
to all Cortex-M ports, and do not rely on any particular library functions. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
#define configKERNEL_INTERRUPT_PRIORITY configLIBRARY_LOWEST_INTERRUPT_PRIORITY // ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
|
||||
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
||||
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY //( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
|
||||
#endif /* __FREERTOS_CONFIG__H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user