Skip to content

Commit

Permalink
fix rda5981x uart recieve bug (alibaba#704)
Browse files Browse the repository at this point in the history
  • Loading branch information
meixuxunxue authored and librae8226 committed Nov 14, 2018
1 parent aa51f9f commit 60b3e33
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion platform/mcu/rda5981x/hal/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ int32_t hal_uart_recv_II(uart_dev_t *uart, void *data, uint32_t expect_size,
uint32_t *recv_size, uint32_t timeout)
{

uint32_t size = 0;
if (0 == is_inited[uart->port]) {
hal_uart_init(uart);
is_inited[uart->port] = 1;
Expand All @@ -77,10 +78,11 @@ int32_t hal_uart_recv_II(uart_dev_t *uart, void *data, uint32_t expect_size,
*recv_data = (uint8_t)serial_getc(&serial_obj[uart->port]);
recv_data++;
expect_size--;
size++;
}

if (NULL != recv_size)
recv_size = expect_size;
*recv_size = size;

return 0;
}
Expand Down

0 comments on commit 60b3e33

Please sign in to comment.