X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fcpu%2Fcortex-m3%2Fdrv%2Fser_stm32.h;h=885513b94acd6ef77076d53245c80261f8b2ac5b;hb=1185bd2bb58da6239fc031b8e6034992d6fc3cc0;hp=2da1b09e44a1464ae82afa4a6d821a8947d09df0;hpb=e70c73c7eedf8644b88a66acacf913335e3395a9;p=bertos.git diff --git a/bertos/cpu/cortex-m3/drv/ser_stm32.h b/bertos/cpu/cortex-m3/drv/ser_stm32.h index 2da1b09e..885513b9 100644 --- a/bertos/cpu/cortex-m3/drv/ser_stm32.h +++ b/bertos/cpu/cortex-m3/drv/ser_stm32.h @@ -49,23 +49,24 @@ enum { SER_UART1 = 0, SER_UART2, +#if CPU_CM3_STM32F103RB || CPU_CM3_STM32F103RE SER_UART3, - +#endif SER_CNT //< Number of serial ports }; /* Software errors */ -#define SERRF_RXFIFOOVERRUN BV(0) //< Rx FIFO buffer overrun -#define SERRF_RXTIMEOUT BV(1) //< Receive timeout -#define SERRF_TXTIMEOUT BV(2) //< Transmit timeout +#define SERRF_RXFIFOOVERRUN BV(6) //< Rx FIFO buffer overrun +#define SERRF_RXTIMEOUT BV(5) //< Receive timeout +#define SERRF_TXTIMEOUT BV(4) //< Transmit timeout /* * Hardware errors. */ -#define SERRF_RXSROVERRUN 0 //< Input overrun -#define SERRF_FRAMEERROR 0 //< Stop bit missing -#define SERRF_PARITYERROR 0 //< Parity error -#define SERRF_NOISEERROR 0 //< Noise error +#define SERRF_RXSROVERRUN SR_ORE //< Input overrun +#define SERRF_FRAMEERROR SR_FE //< Stop bit missing +#define SERRF_PARITYERROR SR_PE //< Parity error +#define SERRF_NOISEERROR SR_NE //< Noise error /* Serial error/status flags */ typedef uint32_t serstatus_t; @@ -98,13 +99,13 @@ INLINE bool stm32_uartTxDone(uint32_t base) INLINE bool stm32_uartTxReady(uint32_t base) { struct stm32_usart *_base = (struct stm32_usart *)base; - return (_base->SR & (BV(7) | BV(6))); + return (_base->SR & (BV(CR1_TXEIE) | BV(CR1_TCIE))); } INLINE bool stm32_uartRxReady(uint32_t base) { struct stm32_usart *_base = (struct stm32_usart *)base; - return (_base->SR & BV(5)); + return (_base->SR & BV(CR1_RXNEIE)); } INLINE int stm32_uartPutChar(uint32_t base, unsigned char c)