uart: critical section compliant API in ISR context

This commit is contained in:
Mahavir Jain 2019-11-14 11:44:21 +05:30
parent d0a37704a3
commit ecf09382da

View file

@ -413,7 +413,7 @@ static esp_err_t UART_ISR_ATTR uart_pattern_enqueue(uart_port_t uart_num, int po
{
UART_CHECK((p_uart_obj[uart_num]), "uart driver error", ESP_FAIL);
esp_err_t ret = ESP_OK;
UART_ENTER_CRITICAL(&uart_spinlock[uart_num]);
UART_ENTER_CRITICAL_ISR(&uart_spinlock[uart_num]);
uart_pat_rb_t *p_pos = &p_uart_obj[uart_num]->rx_pattern_pos;
int next = p_pos->wr + 1;
if (next >= p_pos->len) {
@ -427,7 +427,7 @@ static esp_err_t UART_ISR_ATTR uart_pattern_enqueue(uart_port_t uart_num, int po
p_pos->wr = next;
ret = ESP_OK;
}
UART_EXIT_CRITICAL(&uart_spinlock[uart_num]);
UART_EXIT_CRITICAL_ISR(&uart_spinlock[uart_num]);
return ret;
}