driver: bugfix/fix uart parity and frame error bug

1. modify definition for uart_parity_t
2. fix bugs in uart interrupt handler for parity err and frame err.
This commit is contained in:
Wangjialin 2016-11-16 14:44:06 +08:00
parent d7599ab16d
commit 37cbb0bdea
2 changed files with 6 additions and 5 deletions

View file

@ -68,8 +68,8 @@ typedef enum {
typedef enum { typedef enum {
UART_PARITY_DISABLE = 0x0, /*!< Disable UART parity*/ UART_PARITY_DISABLE = 0x0, /*!< Disable UART parity*/
UART_PARITY_EVEN = 0x10, /*!< Enable UART even parity*/ UART_PARITY_EVEN = 0x2, /*!< Enable UART even parity*/
UART_PARITY_ODD = 0x11 /*!< Enable UART odd parity*/ UART_PARITY_ODD = 0x3 /*!< Enable UART odd parity*/
} uart_parity_t; } uart_parity_t;
typedef enum { typedef enum {

View file

@ -603,10 +603,10 @@ static void IRAM_ATTR uart_rx_intr_handler_default(void *param)
} else if(uart_intr_status & UART_BRK_DET_INT_ST_M) { } else if(uart_intr_status & UART_BRK_DET_INT_ST_M) {
uart_reg->int_clr.brk_det = 1; uart_reg->int_clr.brk_det = 1;
uart_event.type = UART_BREAK; uart_event.type = UART_BREAK;
} else if(uart_intr_status & UART_FRM_ERR_INT_ST_M) { } else if(uart_intr_status & UART_PARITY_ERR_INT_ST_M ) {
uart_reg->int_clr.parity_err = 1; uart_reg->int_clr.parity_err = 1;
uart_event.type = UART_FRAME_ERR; uart_event.type = UART_FRAME_ERR;
} else if(uart_intr_status & UART_PARITY_ERR_INT_ST_M) { } else if(uart_intr_status & UART_FRM_ERR_INT_ST_M) {
uart_reg->int_clr.frm_err = 1; uart_reg->int_clr.frm_err = 1;
uart_event.type = UART_PARITY_ERR; uart_event.type = UART_PARITY_ERR;
} else if(uart_intr_status & UART_TX_BRK_DONE_INT_ST_M) { } else if(uart_intr_status & UART_TX_BRK_DONE_INT_ST_M) {
@ -964,7 +964,8 @@ esp_err_t uart_driver_install(uart_port_t uart_num, int rx_buffer_size, int tx_b
| UART_RXFIFO_TOUT_INT_ENA_M | UART_RXFIFO_TOUT_INT_ENA_M
| UART_FRM_ERR_INT_ENA_M | UART_FRM_ERR_INT_ENA_M
| UART_RXFIFO_OVF_INT_ENA_M | UART_RXFIFO_OVF_INT_ENA_M
| UART_BRK_DET_INT_ENA_M, | UART_BRK_DET_INT_ENA_M
| UART_PARITY_ERR_INT_ENA_M,
.rxfifo_full_thresh = UART_FULL_THRESH_DEFAULT, .rxfifo_full_thresh = UART_FULL_THRESH_DEFAULT,
.rx_timeout_thresh = UART_TOUT_THRESH_DEFAULT, .rx_timeout_thresh = UART_TOUT_THRESH_DEFAULT,
.txfifo_empty_intr_thresh = UART_EMPTY_THRESH_DEFAULT .txfifo_empty_intr_thresh = UART_EMPTY_THRESH_DEFAULT