/* Configure USART to work in SYNC mode and act as a master.  */
uint32_t usart_init_sync_master(Usart *p_usart, const sam_usart_opt_t *p_usart_opt, uint32_t ul_mck)
/* Configure USART to work in SYNC mode and act as a master.  */
uint32_t usart_init_sync_master(Usart *p_usart, const sam_usart_opt_t *p_usart_opt, uint32_t ul_mck)
{
	static uint32_t ul_reg_val;
	usart_reset(p_usart);
	ul_reg_val = 0;
	if (!p_usart_opt || usart_set_sync_master_baudrate(p_usart,
			p_usart_opt->baudrate, ul_mck)) {
		return 1;
	}
	ul_reg_val |= p_usart_opt->char_length | p_usart_opt->parity_type |
			p_usart_opt->channel_mode | p_usart_opt->stop_bits;
	ul_reg_val |= US_MR_USART_MODE_NORMAL | US_MR_CLKO;
	p_usart->US_MR |= ul_reg_val;
	return 0;
}