From 7d570182bef3432e0c28651638bfab9fc6f7d5ec Mon Sep 17 00:00:00 2001 From: yangsong8 Date: Fri, 9 Aug 2024 19:03:22 +0800 Subject: [PATCH] usbdev: add usb APIs for polling mode Signed-off-by: yangsong8 --- include/nuttx/usb/usbdev.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/nuttx/usb/usbdev.h b/include/nuttx/usb/usbdev.h index def91ad74c..1199fb3801 100644 --- a/include/nuttx/usb/usbdev.h +++ b/include/nuttx/usb/usbdev.h @@ -72,6 +72,13 @@ #define EP_STALL(ep) (ep)->ops->stall(ep,false) #define EP_RESUME(ep) (ep)->ops->stall(ep,true) +/* Check the endpoint interrupt status, call interrupt handler + * if the transfer is done. This is used for polling mode. + */ + +#define EP_POLL(ep) \ + do { if ((ep)->ops->poll) (ep)->ops->poll(ep); } while (0) + /* USB Device Driver Helpers ************************************************/ /* Allocate an endpoint: @@ -297,6 +304,12 @@ struct usbdev_epops_s /* Stall or resume an endpoint */ CODE int (*stall)(FAR struct usbdev_ep_s *ep, bool resume); + + /* Check the endpoint interrupt status, call interrupt handler + * if the transfer is done. This is used for polling mode. + */ + + CODE void (*poll)(FAR struct usbdev_ep_s *ep); }; /* Representation of one USB endpoint */