Revert "feat(pxp): add zephyr support" (#6261)
This commit is contained in:
@@ -25,11 +25,6 @@
|
|||||||
#include "semphr.h"
|
#include "semphr.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__ZEPHYR__)
|
|
||||||
#include <zephyr/kernel.h>
|
|
||||||
#include <zephyr/irq.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
*********************/
|
*********************/
|
||||||
@@ -66,8 +61,8 @@ static void _pxp_wait(void);
|
|||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
#if LV_USE_OS
|
#if defined(SDK_OS_FREE_RTOS)
|
||||||
static lv_thread_sync_t pxp_sync;
|
static SemaphoreHandle_t xPXPIdleSemaphore;
|
||||||
#endif
|
#endif
|
||||||
static volatile bool ucPXPIdle;
|
static volatile bool ucPXPIdle;
|
||||||
|
|
||||||
@@ -88,23 +83,26 @@ static pxp_cfg_t _pxp_default_cfg = {
|
|||||||
|
|
||||||
void PXP_IRQHandler(void)
|
void PXP_IRQHandler(void)
|
||||||
{
|
{
|
||||||
|
#if defined(SDK_OS_FREE_RTOS)
|
||||||
|
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
if(kPXP_CompleteFlag & PXP_GetStatusFlags(PXP_ID)) {
|
if(kPXP_CompleteFlag & PXP_GetStatusFlags(PXP_ID)) {
|
||||||
PXP_ClearStatusFlags(PXP_ID, kPXP_CompleteFlag);
|
PXP_ClearStatusFlags(PXP_ID, kPXP_CompleteFlag);
|
||||||
#if LV_USE_OS
|
#if defined(SDK_OS_FREE_RTOS)
|
||||||
lv_thread_sync_signal(&pxp_sync);
|
xSemaphoreGiveFromISR(xPXPIdleSemaphore, &xHigherPriorityTaskWoken);
|
||||||
|
|
||||||
|
/* If xHigherPriorityTaskWoken is now set to pdTRUE then a context switch
|
||||||
|
should be performed to ensure the interrupt returns directly to the highest
|
||||||
|
priority task. The macro used for this purpose is dependent on the port in
|
||||||
|
use and may be called portEND_SWITCHING_ISR(). */
|
||||||
|
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
||||||
#else
|
#else
|
||||||
ucPXPIdle = true;
|
ucPXPIdle = true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__ZEPHYR__)
|
|
||||||
static void PXP_ZephyrIRQHandler(void *)
|
|
||||||
{
|
|
||||||
PXP_IRQHandler();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pxp_cfg_t * pxp_get_default_cfg(void)
|
pxp_cfg_t * pxp_get_default_cfg(void)
|
||||||
{
|
{
|
||||||
return &_pxp_default_cfg;
|
return &_pxp_default_cfg;
|
||||||
@@ -116,32 +114,22 @@ pxp_cfg_t * pxp_get_default_cfg(void)
|
|||||||
|
|
||||||
static void _pxp_interrupt_init(void)
|
static void _pxp_interrupt_init(void)
|
||||||
{
|
{
|
||||||
#if LV_USE_OS
|
|
||||||
if(lv_thread_sync_init(&pxp_sync) != LV_RESULT_OK) {
|
|
||||||
PXP_ASSERT_MSG(false, "Failed to init thread_sync.");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(SDK_OS_FREE_RTOS)
|
#if defined(SDK_OS_FREE_RTOS)
|
||||||
|
xPXPIdleSemaphore = xSemaphoreCreateBinary();
|
||||||
|
PXP_ASSERT_MSG(xPXPIdleSemaphore, "xSemaphoreCreateBinary failed!");
|
||||||
|
|
||||||
NVIC_SetPriority(PXP_IRQ_ID, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 1);
|
NVIC_SetPriority(PXP_IRQ_ID, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 1);
|
||||||
NVIC_EnableIRQ(PXP_IRQ_ID);
|
|
||||||
#elif defined(__ZEPHYR__)
|
|
||||||
IRQ_CONNECT(DT_IRQN(DT_NODELABEL(pxp)), CONFIG_LV_Z_PXP_INTERRUPT_PRIORITY, PXP_ZephyrIRQHandler, NULL, 0);
|
|
||||||
irq_enable(DT_IRQN(DT_NODELABEL(pxp)));
|
|
||||||
#endif
|
#endif
|
||||||
ucPXPIdle = true;
|
ucPXPIdle = true;
|
||||||
|
|
||||||
|
NVIC_EnableIRQ(PXP_IRQ_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _pxp_interrupt_deinit(void)
|
static void _pxp_interrupt_deinit(void)
|
||||||
{
|
{
|
||||||
#if defined(SDK_OS_FREE_RTOS)
|
|
||||||
NVIC_DisableIRQ(PXP_IRQ_ID);
|
NVIC_DisableIRQ(PXP_IRQ_ID);
|
||||||
#elif defined(__ZEPHYR__)
|
#if defined(SDK_OS_FREE_RTOS)
|
||||||
irq_disable(DT_IRQN(DT_NODELABEL(pxp)));
|
vSemaphoreDelete(xPXPIdleSemaphore);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if LV_USE_OS
|
|
||||||
lv_thread_sync_delete(&pxp_sync);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,10 +149,12 @@ static void _pxp_run(void)
|
|||||||
*/
|
*/
|
||||||
static void _pxp_wait(void)
|
static void _pxp_wait(void)
|
||||||
{
|
{
|
||||||
|
#if defined(SDK_OS_FREE_RTOS)
|
||||||
|
/* Return if PXP was never started, otherwise the semaphore will lock forever. */
|
||||||
if(ucPXPIdle == true)
|
if(ucPXPIdle == true)
|
||||||
return;
|
return;
|
||||||
#if LV_USE_OS
|
|
||||||
if(lv_thread_sync_wait(&pxp_sync) == LV_RESULT_OK)
|
if(xSemaphoreTake(xPXPIdleSemaphore, portMAX_DELAY) == pdTRUE)
|
||||||
ucPXPIdle = true;
|
ucPXPIdle = true;
|
||||||
#else
|
#else
|
||||||
while(ucPXPIdle == false) {
|
while(ucPXPIdle == false) {
|
||||||
|
|||||||
Reference in New Issue
Block a user