1 /*
2  * Copyright (c) 2022 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_INCLUDE_USBH_CH9_H
8 #define ZEPHYR_INCLUDE_USBH_CH9_H
9 
10 #include <stdint.h>
11 #include <zephyr/usb/usbh.h>
12 
13 #include "usbh_device.h"
14 
15 /*
16  * Mainly used for testing, and driver support is optional. Use it to
17  * enable or disable omitting the status stage for all requests.
18  */
19 void usbh_req_omit_status(const bool omit);
20 
21 int usbh_req_setup(struct usb_device *const udev,
22 		   const uint8_t bmRequestType,
23 		   const uint8_t bRequest,
24 		   const uint16_t wValue,
25 		   const uint16_t wIndex,
26 		   const uint16_t wLength,
27 		   struct net_buf *const data);
28 
29 int usbh_req_desc(struct usb_device *const udev,
30 		  const uint8_t type, const uint8_t index,
31 		  const uint16_t id,
32 		  const uint16_t len,
33 		  struct net_buf *const data);
34 
35 int usbh_req_desc_dev(struct usb_device *const udev,
36 		      const uint16_t len,
37 		      struct usb_device_descriptor *const dev);
38 
39 int usbh_req_desc_cfg(struct usb_device *const udev,
40 		      const uint8_t index,
41 		      const uint16_t len,
42 		      struct usb_cfg_descriptor *const desc);
43 
44 int usbh_req_set_alt(struct usb_device *const udev,
45 		     const uint8_t iface,
46 		     const uint8_t alt);
47 
48 int usbh_req_set_address(struct usb_device *const udev,
49 			 const uint8_t addr);
50 
51 int usbh_req_set_cfg(struct usb_device *const udev,
52 		     const uint8_t cfg);
53 
54 int usbh_req_get_cfg(struct usb_device *const udev,
55 		     uint8_t *const cfg);
56 
57 int usbh_req_set_sfs_rwup(struct usb_device *const udev);
58 
59 int usbh_req_clear_sfs_rwup(struct usb_device *const udev);
60 
61 int usbh_req_set_sfs_halt(struct usb_device *const udev, const uint8_t ep);
62 
63 int usbh_req_clear_sfs_halt(struct usb_device *const udev, const uint8_t ep);
64 
65 int usbh_req_set_hcfs_ppwr(const struct usb_device *udev,
66 			   const uint8_t port);
67 
68 int usbh_req_set_hcfs_prst(const struct usb_device *udev,
69 			   const uint8_t port);
70 
71 #endif /* ZEPHYR_INCLUDE_USBH_CH9_H */
72