Skip to content

Commit

Permalink
usbdev: extend the usb req len to size_t
Browse files Browse the repository at this point in the history
Some USB controllers can receive or send multiple data packets then
generate one interrupt. This mechanism can reduce the number of data
copies. Extend req buf to accommodate this.

Signed-off-by: yangsong8 <[email protected]>
  • Loading branch information
yangsong8-a1 authored and xiaoxiang781216 committed Aug 29, 2024
1 parent 75eea1b commit 5a39e83
Show file tree
Hide file tree
Showing 33 changed files with 83 additions and 79 deletions.
6 changes: 3 additions & 3 deletions arch/arm/src/at32/at32_otgfsdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@ static void at32_epin_request(struct at32_usbdev_s *priv,
return;
}

uinfo("EP%d req=%p: len=%d xfrd=%d zlp=%d\n",
uinfo("EP%d req=%p: len=%zu xfrd=%zu zlp=%d\n",
privep->epphy, privreq, privreq->req.len,
privreq->req.xfrd, privep->zlp);

Expand Down Expand Up @@ -1589,7 +1589,7 @@ static void at32_epout_complete(struct at32_usbdev_s *priv,
return;
}

uinfo("EP%d: len=%d xfrd=%d\n",
uinfo("EP%d: len=%zu xfrd=%zu\n",
privep->epphy, privreq->req.len, privreq->req.xfrd);

/* Return the completed read request to the class driver and mark the state
Expand Down Expand Up @@ -1745,7 +1745,7 @@ static inline void at32_epout_receive(struct at32_ep_s *privep,
return;
}

uinfo("EP%d: len=%d xfrd=%d\n",
uinfo("EP%d: len=%zu xfrd=%zu\n",
privep->epphy, privreq->req.len, privreq->req.xfrd);
usbtrace(TRACE_READ(privep->epphy), bcnt);

Expand Down
6 changes: 3 additions & 3 deletions arch/arm/src/efm32/efm32_usbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ static void efm32_epin_request(struct efm32_usbdev_s *priv,
return;
}

uinfo("EP%d req=%p: len=%d xfrd=%d zlp=%d\n",
uinfo("EP%d req=%p: len=%zu xfrd=%zu zlp=%d\n",
privep->epphy, privreq, privreq->req.len,
privreq->req.xfrd, privep->zlp);

Expand Down Expand Up @@ -1506,7 +1506,7 @@ static void efm32_epout_complete(struct efm32_usbdev_s *priv,
return;
}

uinfo("EP%d: len=%d xfrd=%d\n",
uinfo("EP%d: len=%zu xfrd=%zu\n",
privep->epphy, privreq->req.len, privreq->req.xfrd);

/* Return the completed read request to the class driver and mark the state
Expand Down Expand Up @@ -1638,7 +1638,7 @@ static inline void efm32_epout_receive(struct efm32_ep_s *privep,
return;
}

uinfo("EP%d: len=%d xfrd=%d\n",
uinfo("EP%d: len=%zu xfrd=%zu\n",
privep->epphy, privreq->req.len, privreq->req.xfrd);
usbtrace(TRACE_READ(privep->epphy), bcnt);

Expand Down
8 changes: 4 additions & 4 deletions arch/arm/src/kinetis/kinetis_usbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -970,10 +970,10 @@ static void khci_wrcomplete(struct khci_usbdev_s *priv,
epno = USB_EPNO(privep->ep.eplog);

#ifdef CONFIG_USBDEV_NOWRITEAHEAD
uinfo("EP%d: len=%d xfrd=%d inflight=%d\n",
uinfo("EP%d: len=%zu xfrd=%zu inflight=%d\n",
epno, privreq->req.len, privreq->req.xfrd, privreq->inflight[0]);
#else
uinfo("EP%d: len=%d xfrd=%d inflight={%d, %d}\n",
uinfo("EP%d: len=%zu xfrd=%zu inflight={%d, %d}\n",
epno, privreq->req.len, privreq->req.xfrd,
privreq->inflight[0], privreq->inflight[1]);
#endif
Expand Down Expand Up @@ -1291,7 +1291,7 @@ static int khci_wrstart(struct khci_usbdev_s *priv,
bytesleft = privreq->req.len;
}

uinfo("epno=%d req=%p: len=%d xfrd=%d index=%d nullpkt=%d\n",
uinfo("epno=%d req=%p: len=%zu xfrd=%zu index=%d nullpkt=%d\n",
epno, privreq, privreq->req.len, xfrd, index, privep->txnullpkt);

/* Get the number of bytes left to be sent in the packet */
Expand Down Expand Up @@ -1406,7 +1406,7 @@ static int khci_rdcomplete(struct khci_usbdev_s *priv,
bdtout = privep->bdtout;
epno = USB_EPNO(privep->ep.eplog);

uinfo("EP%d: len=%d xfrd=%d\n",
uinfo("EP%d: len=%zu xfrd=%zu\n",
epno, privreq->req.len, privreq->req.xfrd);
bdtinfo("EP%d BDT OUT [%p] {%08x, %08x}\n",
epno, bdtout, bdtout->status, bdtout->addr);
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/lpc17xx_40xx/lpc17_40_usbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ static int lpc17_40_wrrequest(struct lpc17_40_ep_s *privep)
return OK;
}

uinfo("epphy=%d req=%p: len=%d xfrd=%d nullpkt=%d\n",
uinfo("epphy=%d req=%p: len=%zu xfrd=%zu nullpkt=%d\n",
privep->epphy, privreq, privreq->req.len, privreq->req.xfrd,
privep->txnullpkt);

Expand Down Expand Up @@ -1208,7 +1208,7 @@ static int lpc17_40_rdrequest(struct lpc17_40_ep_s *privep)
return OK;
}

uinfo("len=%d xfrd=%d nullpkt=%d\n",
uinfo("len=%zu xfrd=%zu nullpkt=%d\n",
privreq->req.len, privreq->req.xfrd, privep->txnullpkt);

/* Ignore any attempt to receive a zero length packet */
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/lpc214x/lpc214x_usbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ static int lpc214x_wrrequest(struct lpc214x_ep_s *privep)
return OK;
}

uinfo("epphy=%d req=%p: len=%d xfrd=%d nullpkt=%d\n",
uinfo("epphy=%d req=%p: len=%zu xfrd=%zu nullpkt=%d\n",
privep->epphy, privreq, privreq->req.len, privreq->req.xfrd,
privep->txnullpkt);

Expand Down Expand Up @@ -1145,7 +1145,7 @@ static int lpc214x_rdrequest(struct lpc214x_ep_s *privep)
return OK;
}

uinfo("len=%d xfrd=%d nullpkt=%d\n",
uinfo("len=%zu xfrd=%zu nullpkt=%d\n",
privreq->req.len, privreq->req.xfrd, privep->txnullpkt);

/* Ignore any attempt to receive a zero length packet */
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/nrf52/nrf52_usbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ static void nrf52_epout_complete(struct nrf52_ep_s *privep)
return;
}

uinfo("EP%d: len=%d xfrd=%d\n", privep->epphy, privreq->req.len,
uinfo("EP%d: len=%zu xfrd=%zu\n", privep->epphy, privreq->req.len,
privreq->req.xfrd);

/* Return the completed read request to the class driver and mark the
Expand Down Expand Up @@ -1345,7 +1345,7 @@ static void nrf52_epout_receive(struct nrf52_ep_s *privep)
return;
}

uinfo("EP%d: len=%d xfrd=%d\n", privep->epphy,
uinfo("EP%d: len=%zu xfrd=%zu\n", privep->epphy,
privreq->req.len, privreq->req.xfrd);
usbtrace(TRACE_READ(privep->epphy), bcnt);

Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/nrf53/nrf53_usbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ static void nrf53_epout_complete(struct nrf53_ep_s *privep)
return;
}

uinfo("EP%d: len=%d xfrd=%d\n", privep->epphy, privreq->req.len,
uinfo("EP%d: len=%zu xfrd=%zu\n", privep->epphy, privreq->req.len,
privreq->req.xfrd);

/* Return the completed read request to the class driver and mark the
Expand Down Expand Up @@ -1345,7 +1345,7 @@ static void nrf53_epout_receive(struct nrf53_ep_s *privep)
return;
}

uinfo("EP%d: len=%d xfrd=%d\n", privep->epphy,
uinfo("EP%d: len=%zu xfrd=%zu\n", privep->epphy,
privreq->req.len, privreq->req.xfrd);
usbtrace(TRACE_READ(privep->epphy), bcnt);

Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/sam34/sam_udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ static int sam_req_write(struct sam_usbdev_s *priv, struct sam_ep_s *privep)
return -ENOENT;
}

uinfo("epno=%d req=%p: len=%d xfrd=%d inflight=%d zlpneeded=%d\n",
uinfo("epno=%d req=%p: len=%zu xfrd=%zu inflight=%d zlpneeded=%d\n",
epno, privreq, privreq->req.len, privreq->req.xfrd,
privreq->inflight, privep->zlpneeded);

Expand Down Expand Up @@ -1113,7 +1113,7 @@ static int sam_req_read(struct sam_usbdev_s *priv, struct sam_ep_s *privep,
return -ENOENT;
}

uinfo("EP%d: len=%d xfrd=%d\n",
uinfo("EP%d: len=%zu xfrd=%zu\n",
epno, privreq->req.len, privreq->req.xfrd);

/* Ignore any attempt to receive a zero length packet */
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/sama5/sam_udphs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,7 @@ static int sam_req_write(struct sam_usbdev_s *priv, struct sam_ep_s *privep)
return -ENOENT;
}

uinfo("epno=%d req=%p: len=%d xfrd=%d inflight=%d zlpneeded=%d\n",
uinfo("epno=%d req=%p: len=%zu xfrd=%zu inflight=%d zlpneeded=%d\n",
epno, privreq, privreq->req.len, privreq->req.xfrd,
privreq->inflight, privep->zlpneeded);

Expand Down Expand Up @@ -1604,7 +1604,7 @@ static int sam_req_read(struct sam_usbdev_s *priv, struct sam_ep_s *privep,
return -ENOENT;
}

uinfo("EP%d: len=%d xfrd=%d\n",
uinfo("EP%d: len=%zu xfrd=%zu\n",
epno, privreq->req.len, privreq->req.xfrd);

/* Ignore any attempt to receive a zero length packet */
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/samd2l2/sam_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ static int sam_req_write(struct sam_usbdev_s *priv, struct sam_ep_s *privep)
return -ENOENT;
}

uinfo("epno=%d req=%p: len=%d xfrd=%d inflight=%d\n",
uinfo("epno=%d req=%p: len=%zu xfrd=%zu inflight=%d\n",
epno, privreq, privreq->req.len, privreq->req.xfrd,
privreq->inflight);

Expand Down Expand Up @@ -1227,7 +1227,7 @@ static int sam_req_read(struct sam_usbdev_s *priv, struct sam_ep_s *privep,
return -ENOENT;
}

uinfo("EP%d: req.len=%d xfrd=%d recvsize=%d\n",
uinfo("EP%d: req.len=%zu xfrd=%zu recvsize=%d\n",
epno, privreq->req.len, privreq->req.xfrd, recvsize);

/* Ignore any attempt to receive a zero length packet */
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/samd5e5/sam_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1748,7 +1748,7 @@ static int sam_req_write(struct sam_usbdev_s *priv, struct sam_ep_s *privep)
return -ENOENT;
}

uinfo("epno=%d req=%p: len=%d xfrd=%d inflight=%d\n",
uinfo("epno=%d req=%p: len=%zu xfrd=%zu inflight=%d\n",
epno, privreq, privreq->req.len, privreq->req.xfrd,
privreq->inflight);

Expand Down Expand Up @@ -1890,7 +1890,7 @@ static int sam_req_read(struct sam_usbdev_s *priv, struct sam_ep_s *privep,
return -ENOENT;
}

uinfo("EP%d: req.len=%d xfrd=%d recvsize=%d\n",
uinfo("EP%d: req.len=%zu xfrd=%zu recvsize=%d\n",
epno, privreq->req.len, privreq->req.xfrd, recvsize);

/* Ignore any attempt to receive a zero length packet */
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/samv7/sam_usbdevhs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1431,7 +1431,7 @@ static int sam_req_write(struct sam_usbdev_s *priv, struct sam_ep_s *privep)
return -ENOENT;
}

uinfo("epno=%d req=%p: len=%d xfrd=%d inflight=%d zlpneeded=%d\n",
uinfo("epno=%d req=%p: len=%zu xfrd=%zu inflight=%d zlpneeded=%d\n",
epno, privreq, privreq->req.len, privreq->req.xfrd,
privreq->inflight, privep->zlpneeded);

Expand Down Expand Up @@ -1671,7 +1671,7 @@ static int sam_req_read(struct sam_usbdev_s *priv, struct sam_ep_s *privep,
return -ENOENT;
}

uinfo("EP%d: len=%d xfrd=%d\n",
uinfo("EP%d: len=%zu xfrd=%zu\n",
epno, privreq->req.len, privreq->req.xfrd);

/* Ignore any attempt to receive a zero length packet */
Expand Down
6 changes: 3 additions & 3 deletions arch/arm/src/stm32/stm32_otgfsdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,7 @@ static void stm32_epin_request(struct stm32_usbdev_s *priv,
return;
}

uinfo("EP%d req=%p: len=%d xfrd=%d zlp=%d\n",
uinfo("EP%d req=%p: len=%zu xfrd=%zu zlp=%d\n",
privep->epphy, privreq, privreq->req.len,
privreq->req.xfrd, privep->zlp);

Expand Down Expand Up @@ -1548,7 +1548,7 @@ static void stm32_epout_complete(struct stm32_usbdev_s *priv,
return;
}

uinfo("EP%d: len=%d xfrd=%d\n",
uinfo("EP%d: len=%zu xfrd=%zu\n",
privep->epphy, privreq->req.len, privreq->req.xfrd);

/* Return the completed read request to the class driver and mark the state
Expand Down Expand Up @@ -1704,7 +1704,7 @@ static inline void stm32_epout_receive(struct stm32_ep_s *privep,
return;
}

uinfo("EP%d: len=%d xfrd=%d\n",
uinfo("EP%d: len=%zu xfrd=%zu\n",
privep->epphy, privreq->req.len, privreq->req.xfrd);
usbtrace(TRACE_READ(privep->epphy), bcnt);

Expand Down
6 changes: 3 additions & 3 deletions arch/arm/src/stm32/stm32_otghsdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ static void stm32_epin_request(struct stm32_usbdev_s *priv,
return;
}

uinfo("EP%d req=%p: len=%d xfrd=%d zlp=%d\n",
uinfo("EP%d req=%p: len=%zu xfrd=%zu zlp=%d\n",
privep->epphy, privreq, privreq->req.len,
privreq->req.xfrd, privep->zlp);

Expand Down Expand Up @@ -1497,7 +1497,7 @@ static void stm32_epout_complete(struct stm32_usbdev_s *priv,
return;
}

uinfo("EP%d: len=%d xfrd=%d\n",
uinfo("EP%d: len=%zu xfrd=%zu\n",
privep->epphy, privreq->req.len, privreq->req.xfrd);

/* Return the completed read request to the class driver and mark the state
Expand Down Expand Up @@ -1629,7 +1629,7 @@ static inline void stm32_epout_receive(struct stm32_ep_s *privep,
return;
}

uinfo("EP%d: len=%d xfrd=%d\n",
uinfo("EP%d: len=%zu xfrd=%zu\n",
privep->epphy, privreq->req.len, privreq->req.xfrd);
usbtrace(TRACE_READ(privep->epphy), bcnt);

Expand Down
5 changes: 3 additions & 2 deletions arch/arm/src/stm32/stm32_usbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ static int stm32_wrrequest(struct stm32_usbdev_s *priv,
}

epno = USB_EPNO(privep->ep.eplog);
uinfo("epno=%d req=%p: len=%d xfrd=%d nullpkt=%d\n",
uinfo("epno=%d req=%p: len=%zu xfrd=%zu nullpkt=%d\n",
epno, privreq, privreq->req.len,
privreq->req.xfrd, privep->txnullpkt);
UNUSED(epno);
Expand Down Expand Up @@ -1484,7 +1484,8 @@ static int stm32_rdrequest(struct stm32_usbdev_s *priv,
return -ENOENT;
}

uinfo("EP%d: len=%d xfrd=%d\n", epno, privreq->req.len, privreq->req.xfrd);
uinfo("EP%d: len=%zu xfrd=%zu\n",
epno, privreq->req.len, privreq->req.xfrd);

/* Ignore any attempt to receive a zero length packet */

Expand Down
5 changes: 3 additions & 2 deletions arch/arm/src/stm32/stm32_usbfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ static int stm32_wrrequest(struct stm32_usbdev_s *priv,
}

epno = USB_EPNO(privep->ep.eplog);
uinfo("epno=%d req=%p: len=%d xfrd=%d nullpkt=%d\n",
uinfo("epno=%d req=%p: len=%zu xfrd=%zu nullpkt=%d\n",
epno, privreq, privreq->req.len,
privreq->req.xfrd, privep->txnullpkt);
UNUSED(epno);
Expand Down Expand Up @@ -1460,7 +1460,8 @@ static int stm32_rdrequest(struct stm32_usbdev_s *priv,
return -ENOENT;
}

uinfo("EP%d: len=%d xfrd=%d\n", epno, privreq->req.len, privreq->req.xfrd);
uinfo("EP%d: len=%zu xfrd=%zu\n",
epno, privreq->req.len, privreq->req.xfrd);

/* Ignore any attempt to receive a zero length packet */

Expand Down
5 changes: 3 additions & 2 deletions arch/arm/src/stm32f0l0g0/stm32_usbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ static int stm32_wrrequest(struct stm32_usbdev_s *priv,
}

epno = USB_EPNO(privep->ep.eplog);
uinfo("epno=%d req=%p: len=%d xfrd=%d nullpkt=%d\n",
uinfo("epno=%d req=%p: len=%zu xfrd=%zu nullpkt=%d\n",
epno, privreq, privreq->req.len,
privreq->req.xfrd, privep->txnullpkt);
UNUSED(epno);
Expand Down Expand Up @@ -1430,7 +1430,8 @@ static int stm32_rdrequest(struct stm32_usbdev_s *priv,
return -ENOENT;
}

uinfo("EP%d: len=%d xfrd=%d\n", epno, privreq->req.len, privreq->req.xfrd);
uinfo("EP%d: len=%zu xfrd=%zu\n",
epno, privreq->req.len, privreq->req.xfrd);

/* Ignore any attempt to receive a zero length packet */

Expand Down
6 changes: 3 additions & 3 deletions arch/arm/src/stm32f7/stm32_otgdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ static void stm32_epin_request(struct stm32_usbdev_s *priv,
return;
}

uinfo("EP%d req=%p: len=%d xfrd=%d zlp=%d\n",
uinfo("EP%d req=%p: len=%zu xfrd=%zu zlp=%d\n",
privep->epphy, privreq, privreq->req.len,
privreq->req.xfrd, privep->zlp);

Expand Down Expand Up @@ -1608,7 +1608,7 @@ static void stm32_epout_complete(struct stm32_usbdev_s *priv,
return;
}

uinfo("EP%d: len=%d xfrd=%d\n",
uinfo("EP%d: len=%zu xfrd=%zu\n",
privep->epphy, privreq->req.len, privreq->req.xfrd);

/* Return the completed read request to the class driver and mark the state
Expand Down Expand Up @@ -1740,7 +1740,7 @@ static inline void stm32_epout_receive(struct stm32_ep_s *privep,
return;
}

uinfo("EP%d: len=%d xfrd=%d\n", privep->epphy, privreq->req.len,
uinfo("EP%d: len=%zu xfrd=%zu\n", privep->epphy, privreq->req.len,
privreq->req.xfrd);
usbtrace(TRACE_READ(privep->epphy), bcnt);

Expand Down
Loading

0 comments on commit 5a39e83

Please sign in to comment.