/* Configure USART to work in SYNC mode and act as a slave.  */
uint32_t usart_init_sync_slave(Usart *p_usart, const sam_usart_opt_t *p_usart_opt)
/* Configure USART to work in SYNC mode and act as a slave.  */
uint32_t usart_init_sync_slave(Usart *p_usart, const sam_usart_opt_t *p_usart_opt)
{
	static uint32_t ul_reg_val;
	usart_reset(p_usart);
	ul_reg_val = 0;
	usart_set_sync_slave_baudrate(p_usart);
	if (!p_usart_opt) {
		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;
	p_usart->US_MR |= ul_reg_val;
	return 0;
}