drivers: nrf: Fix values in UARTE async API callback.
There is possibility that endrx interrupt will be triggered in the middle of timer interrupt responsible for UARTE timeout, this patch handles this case. Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
This commit is contained in:
parent
59e2f230e0
commit
117bc6dfa4
1 changed files with 4 additions and 4 deletions
|
@ -636,13 +636,13 @@ static void rx_timeout(struct k_timer *timer)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if there is data that was not sent to user yet */
|
/* Check if there is data that was not sent to user yet */
|
||||||
if (data->async->rx_total_byte_cnt
|
|
||||||
!= data->async->rx_total_user_byte_cnt) {
|
s32_t len = data->async->rx_total_byte_cnt
|
||||||
|
- data->async->rx_total_user_byte_cnt;
|
||||||
|
if (len > 0) {
|
||||||
if (data->async->rx_timeout_left
|
if (data->async->rx_timeout_left
|
||||||
< data->async->rx_timeout_slab) {
|
< data->async->rx_timeout_slab) {
|
||||||
/* rx_timeout ms elapsed since last receiving */
|
/* rx_timeout ms elapsed since last receiving */
|
||||||
u32_t len = data->async->rx_total_byte_cnt
|
|
||||||
- data->async->rx_total_user_byte_cnt;
|
|
||||||
struct uart_event evt = {
|
struct uart_event evt = {
|
||||||
.type = UART_RX_RDY,
|
.type = UART_RX_RDY,
|
||||||
.data.rx.buf = data->async->rx_buf,
|
.data.rx.buf = data->async->rx_buf,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue