stm32f0:usart: Correctly allow >8bit words.
Make them 16bit regs, like on other periphs. This allows proper access to the "8th" bit. (0..8 is 9 bits, not 8) Found and reported in https://github.com/libopencm3/libopencm3/pull/651
This commit is contained in:
parent
6dd7b3ecc5
commit
7ee1d948e9
@ -100,13 +100,13 @@
|
||||
#define USART3_ICR USART_ICR(USART3_BASE)
|
||||
#define USART4_ICR USART_ICR(USART4_BASE)
|
||||
|
||||
#define USART_RDR(usart_base) MMIO8((usart_base) + 0x24)
|
||||
#define USART_RDR(usart_base) MMIO16((usart_base) + 0x24)
|
||||
#define USART1_RDR USART_RDR(USART1_BASE)
|
||||
#define USART2_RDR USART_RDR(USART2_BASE)
|
||||
#define USART3_RDR USART_RDR(USART3_BASE)
|
||||
#define USART4_RDR USART_RDR(USART4_BASE)
|
||||
|
||||
#define USART_TDR(usart_base) MMIO8((usart_base) + 0x28)
|
||||
#define USART_TDR(usart_base) MMIO16((usart_base) + 0x28)
|
||||
#define USART1_TDR USART_TDR(USART1_BASE)
|
||||
#define USART2_TDR USART_TDR(USART2_BASE)
|
||||
#define USART3_TDR USART_TDR(USART3_BASE)
|
||||
@ -309,12 +309,12 @@ void usart_set_mode(uint32_t usart, uint32_t mode);
|
||||
void usart_set_flow_control(uint32_t usart, uint32_t flowcontrol);
|
||||
void usart_enable(uint32_t usart);
|
||||
void usart_disable(uint32_t usart);
|
||||
void usart_send(uint32_t usart, uint8_t data);
|
||||
uint8_t usart_recv(uint32_t usart);
|
||||
void usart_send(uint32_t usart, uint16_t data);
|
||||
uint16_t usart_recv(uint32_t usart);
|
||||
void usart_wait_send_ready(uint32_t usart);
|
||||
void usart_wait_recv_ready(uint32_t usart);
|
||||
void usart_send_blocking(uint32_t usart, uint8_t data);
|
||||
uint8_t usart_recv_blocking(uint32_t usart);
|
||||
void usart_send_blocking(uint32_t usart, uint16_t data);
|
||||
uint16_t usart_recv_blocking(uint32_t usart);
|
||||
void usart_enable_rx_dma(uint32_t usart);
|
||||
void usart_disable_rx_dma(uint32_t usart);
|
||||
void usart_enable_tx_dma(uint32_t usart);
|
||||
|
@ -158,7 +158,7 @@ void usart_disable(uint32_t usart)
|
||||
* @param data
|
||||
*/
|
||||
|
||||
void usart_send(uint32_t usart, uint8_t data)
|
||||
void usart_send(uint32_t usart, uint16_t data)
|
||||
{
|
||||
USART_TDR(usart) = data;
|
||||
}
|
||||
@ -173,7 +173,7 @@ void usart_send(uint32_t usart, uint8_t data)
|
||||
* @returns data word.
|
||||
*/
|
||||
|
||||
uint8_t usart_recv(uint32_t usart)
|
||||
uint16_t usart_recv(uint32_t usart)
|
||||
{
|
||||
/* Receive data. */
|
||||
return USART_RDR(usart);
|
||||
@ -218,7 +218,7 @@ void usart_wait_recv_ready(uint32_t usart)
|
||||
* @param data word to send
|
||||
*/
|
||||
|
||||
void usart_send_blocking(uint32_t usart, uint8_t data)
|
||||
void usart_send_blocking(uint32_t usart, uint16_t data)
|
||||
{
|
||||
usart_wait_send_ready(usart);
|
||||
usart_send(usart, data);
|
||||
@ -233,7 +233,7 @@ void usart_send_blocking(uint32_t usart, uint8_t data)
|
||||
* @returns data word.
|
||||
*/
|
||||
|
||||
uint8_t usart_recv_blocking(uint32_t usart)
|
||||
uint16_t usart_recv_blocking(uint32_t usart)
|
||||
{
|
||||
usart_wait_recv_ready(usart);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user