mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 21:36:28 +08:00
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:
committed by
Alan C. Assis
parent
4a4ad26474
commit
3d37e85b13
@@ -57,14 +57,13 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static ssize_t btuart_read(FAR struct btuart_upperhalf_s *upper,
|
static ssize_t btuart_read(FAR struct btuart_upperhalf_s *upper,
|
||||||
FAR uint8_t *buffer, size_t buflen,
|
FAR uint8_t *buffer, size_t buflen)
|
||||||
size_t minread)
|
|
||||||
{
|
{
|
||||||
FAR const struct btuart_lowerhalf_s *lower;
|
FAR const struct btuart_lowerhalf_s *lower;
|
||||||
ssize_t ntotal = 0;
|
ssize_t ntotal = 0;
|
||||||
ssize_t nread;
|
ssize_t nread;
|
||||||
|
|
||||||
wlinfo("buflen %zu minread %zu\n", buflen, minread);
|
wlinfo("buflen %zu\n", buflen);
|
||||||
|
|
||||||
DEBUGASSERT(upper != NULL && upper->lower != NULL);
|
DEBUGASSERT(upper != NULL && upper->lower != NULL);
|
||||||
lower = upper->lower;
|
lower = upper->lower;
|
||||||
@@ -73,17 +72,11 @@ static ssize_t btuart_read(FAR struct btuart_upperhalf_s *upper,
|
|||||||
while (buflen > 0)
|
while (buflen > 0)
|
||||||
{
|
{
|
||||||
nread = lower->read(lower, buffer, buflen);
|
nread = lower->read(lower, buffer, buflen);
|
||||||
if (nread == 0 || nread == -EINTR)
|
if (nread == -EINTR)
|
||||||
{
|
{
|
||||||
wlwarn("Got zero bytes from UART\n");
|
continue;
|
||||||
if (ntotal < minread)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else if (nread < 0)
|
else if (nread <= 0)
|
||||||
{
|
{
|
||||||
wlwarn("Returned error %zd\n", nread);
|
wlwarn("Returned error %zd\n", nread);
|
||||||
return ntotal > 0 ? ntotal : nread;
|
return ntotal > 0 ? ntotal : nread;
|
||||||
@@ -117,7 +110,6 @@ static void btuart_rxwork(FAR void *arg)
|
|||||||
upper = (FAR struct btuart_upperhalf_s *)arg;
|
upper = (FAR struct btuart_upperhalf_s *)arg;
|
||||||
|
|
||||||
nread = btuart_read(upper, &upper->rxbuf[upper->rxlen],
|
nread = btuart_read(upper, &upper->rxbuf[upper->rxlen],
|
||||||
sizeof(upper->rxbuf) - upper->rxlen,
|
|
||||||
sizeof(upper->rxbuf) - upper->rxlen);
|
sizeof(upper->rxbuf) - upper->rxlen);
|
||||||
if (nread <= 0)
|
if (nread <= 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user