Initial implementation of USART API functions.

The usart_set_baudrate() function is currently hardcoded to certain
settings, that needs to be fixed later.
This commit is contained in:
Uwe Hermann
2009-07-25 03:24:08 +02:00
parent 712261bb52
commit c6ec621b1a
2 changed files with 97 additions and 1 deletions

View File

@@ -132,6 +132,11 @@
#define PARITY_ODD 0x02
#define PARITY_EVEN 0x03
/* CR1_TE/CR1_RE combined values */
#define MODE_RX 0x01
#define MODE_TX 0x02
#define MODE_TX_RX 0x03
/* --- USART_CR2 values ---------------------------------------------------- */
#define CR2_LINEN (1 << 14) /* LIN mode enable */
@@ -177,4 +182,17 @@
/* TODO */
/* --- Function prototypes ------------------------------------------------- */
void usart_set_baudrate(u32 usart, u32 baud);
void usart_set_databits(u32 usart, u32 bits);
void usart_set_stopbits(u32 usart, u32 stopbits);
void usart_set_parity(u32 usart, u32 parity);
void usart_set_mode(u32 usart, u32 mode);
void usart_set_flow_control(u32 usart, u32 flowcontrol);
void usart_enable(u32 usart);
void usart_disable(u32 usart);
void usart_send(u32 usart, u16 data);
u16 usart_recv(u32 usart);
#endif