/* the transmit data length,and we have four choices:5, 6, 7, and 8 bits.  */
static int32_t dw_usart_set_databit(dw_usart_reg_t *addr, usart_data_bits_e databits)
/* the transmit data length,and we have four choices:5, 6, 7, and 8 bits.  */
static int32_t dw_usart_set_databit(dw_usart_reg_t *addr, usart_data_bits_e databits)
{
    WAIT_USART_IDLE(addr);
    switch (databits) {
        case USART_DATA_BITS_5:
            addr->LCR &= LCR_WORD_SIZE_5;
            break;
        case USART_DATA_BITS_6:
            addr->LCR &= 0xfd;
            addr->LCR |= LCR_WORD_SIZE_6;
            break;
        case USART_DATA_BITS_7:
            addr->LCR &= 0xfe;
            addr->LCR |= LCR_WORD_SIZE_7;
            break;
        case USART_DATA_BITS_8:
            addr->LCR |= LCR_WORD_SIZE_8;
            break;
        default:
            return ERR_USART(EDRV_USART_DATA_BITS);
    }
    return 0;
}