/* UART Set Baudrate. 
The baud rate is computed from the IPG bus clock. The bus clock must be calculated by using ccm_calculate_clocks before calling this function. */
void uart_set_baudrate(uint32_t uart, uint32_t baud)
/* UART Set Baudrate. 
The baud rate is computed from the IPG bus clock. The bus clock must be calculated by using ccm_calculate_clocks before calling this function. */
void uart_set_baudrate(uint32_t uart, uint32_t baud)
{
	uint32_t bd_clk = ccm_ipg_bus_clk / baud;
	uint32_t sbr;
	bd_clk /= 8;
	sbr = bd_clk / 2 + (bd_clk & 0x1);
	UART_BDL(uart) = sbr & UART_BDL_SBR_MASK;
	UART_BDH(uart) = (sbr >> 8) & UART_BDH_SBR_MASK;
}