From 94c39caa5016660c13ab09b80f4950b37fca5003 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sun, 7 Sep 2014 16:27:42 +0200 Subject: [PATCH] OP-1275 - Fix PIOS_COM to be used with no PIOS_INCLUDE_FREERTOS defined --- flight/pios/common/pios_com.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/flight/pios/common/pios_com.c b/flight/pios/common/pios_com.c index fb6023696..8c9155955 100644 --- a/flight/pios/common/pios_com.c +++ b/flight/pios/common/pios_com.c @@ -167,10 +167,11 @@ out_fail: return -1; } +#if defined(PIOS_INCLUDE_FREERTOS) static void PIOS_COM_UnblockRx(struct pios_com_dev *com_dev, bool *need_yield) { -#if defined(PIOS_INCLUDE_FREERTOS) static signed portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + xSemaphoreGiveFromISR(com_dev->rx_sem, &xHigherPriorityTaskWoken); if (xHigherPriorityTaskWoken != pdFALSE) { @@ -178,15 +179,19 @@ static void PIOS_COM_UnblockRx(struct pios_com_dev *com_dev, bool *need_yield) } else { *need_yield = false; } -#else - *need_yield = false; -#endif } +#else +static void PIOS_COM_UnblockRx(__attribute__((unused)) struct pios_com_dev *com_dev, bool *need_yield) +{ + *need_yield = false; +} +#endif +#if defined(PIOS_INCLUDE_FREERTOS) static void PIOS_COM_UnblockTx(struct pios_com_dev *com_dev, bool *need_yield) { -#if defined(PIOS_INCLUDE_FREERTOS) static signed portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + xSemaphoreGiveFromISR(com_dev->tx_sem, &xHigherPriorityTaskWoken); if (xHigherPriorityTaskWoken != pdFALSE) { @@ -194,10 +199,14 @@ static void PIOS_COM_UnblockTx(struct pios_com_dev *com_dev, bool *need_yield) } else { *need_yield = false; } -#else - *need_yield = false; -#endif } +#else +static void PIOS_COM_UnblockTx(__attribute__((unused)) struct pios_com_dev *com_dev, bool *need_yield) +{ + *need_yield = false; +} +#endif + static uint16_t PIOS_COM_RxInCallback(uint32_t context, uint8_t *buf, uint16_t buf_len, uint16_t *headroom, bool *need_yield) {