From f0b7f48adfb6db81fd2d33853f9ec92c845250a1 Mon Sep 17 00:00:00 2001 From: chengkai Date: Wed, 22 Nov 2023 21:49:22 +0800 Subject: [PATCH] bluetooth:fix h5 ack to controller timeout h5 ack which send to controller always timeout, which causing controller would send repend hci data until host send back h5 ack. Signed-off-by: chengkai --- drivers/serial/uart_bth5.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/serial/uart_bth5.c b/drivers/serial/uart_bth5.c index 1b7385edce..9e88eed6b6 100644 --- a/drivers/serial/uart_bth5.c +++ b/drivers/serial/uart_bth5.c @@ -73,7 +73,6 @@ #define H5_SET_TYPE(hdr, type) ((hdr)[1] |= (type)) #define H5_SET_LEN(hdr, len) (((hdr)[1] |= ((len)&0x0f) << 4), ((hdr)[2] |= (len) >> 4)) -#define H5_ACK_TIMEOUT MSEC2TICK(250) /* 250ms */ #define H5_RTX_TIMEOUT MSEC2TICK(150) /* 150ms */ union bt_hdr_u @@ -466,11 +465,7 @@ h5_recv_handle(FAR struct uart_bth5_s *dev) if (H5_HDR_RELIABLE(hdr)) { dev->txack = (dev->txack + 1) & 0x07; - if (work_available(&dev->ackworker)) - { - work_queue(HPWORK, &dev->ackworker, h5_ack_work, dev, - H5_ACK_TIMEOUT); - } + h5_ack_work(dev); } dev->rxack = H5_HDR_ACK(hdr); @@ -563,7 +558,7 @@ h5_rx_header(FAR struct uart_bth5_s *dev, uint8_t c) if (H5_HDR_RELIABLE(hdr) && H5_HDR_SEQ(hdr) != dev->txack) { - work_queue(HPWORK, &dev->ackworker, h5_ack_work, dev, 0); + h5_ack_work(dev); h5_rx_reset(dev); return -EINVAL; } @@ -1114,7 +1109,7 @@ uart_bth5_write(FAR struct file *filep, FAR const char *buffer, if (h5_unack_size(&dev->unackpool) > dev->txwin) { - work_queue(HPWORK, &dev->ackworker, h5_ack_work, dev, 0); + h5_ack_work(dev); if (filep->f_oflags & O_NONBLOCK) { ret = -EAGAIN;