Remove minread para in btuart_read.
In file_read(), asynchronous reading is supported, so partial reads and the minread parameter are no longer needed. Signed-off-by: zhongzhijie1 <zhongzhijie1@xiaomi.com>
This commit is contained in:
parent
4a4ad26474
commit
3d37e85b13
1 changed files with 5 additions and 13 deletions
|
|
@ -57,14 +57,13 @@
|
|||
****************************************************************************/
|
||||
|
||||
static ssize_t btuart_read(FAR struct btuart_upperhalf_s *upper,
|
||||
FAR uint8_t *buffer, size_t buflen,
|
||||
size_t minread)
|
||||
FAR uint8_t *buffer, size_t buflen)
|
||||
{
|
||||
FAR const struct btuart_lowerhalf_s *lower;
|
||||
ssize_t ntotal = 0;
|
||||
ssize_t nread;
|
||||
|
||||
wlinfo("buflen %zu minread %zu\n", buflen, minread);
|
||||
wlinfo("buflen %zu\n", buflen);
|
||||
|
||||
DEBUGASSERT(upper != NULL && upper->lower != NULL);
|
||||
lower = upper->lower;
|
||||
|
|
@ -73,17 +72,11 @@ static ssize_t btuart_read(FAR struct btuart_upperhalf_s *upper,
|
|||
while (buflen > 0)
|
||||
{
|
||||
nread = lower->read(lower, buffer, buflen);
|
||||
if (nread == 0 || nread == -EINTR)
|
||||
if (nread == -EINTR)
|
||||
{
|
||||
wlwarn("Got zero bytes from UART\n");
|
||||
if (ntotal < minread)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
else if (nread < 0)
|
||||
else if (nread <= 0)
|
||||
{
|
||||
wlwarn("Returned error %zd\n", nread);
|
||||
return ntotal > 0 ? ntotal : nread;
|
||||
|
|
@ -117,7 +110,6 @@ static void btuart_rxwork(FAR void *arg)
|
|||
upper = (FAR struct btuart_upperhalf_s *)arg;
|
||||
|
||||
nread = btuart_read(upper, &upper->rxbuf[upper->rxlen],
|
||||
sizeof(upper->rxbuf) - upper->rxlen,
|
||||
sizeof(upper->rxbuf) - upper->rxlen);
|
||||
if (nread <= 0)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue