| /* | |
| * Copyright (c) 2024 The Fuchsia Authors | |
| * | |
| * SPDX-License-Identifier: BSD-3-Clause | |
| */ | |
| #include <linux/usb/gadget.h> | |
| #include <linux/usb/composite.h> | |
| /* | |
| * 32 KiB amortizes per-request USB gadget queue and UEFI transport handoff | |
| * overhead by 8x vs 4 KiB while staying within L1 data cache and within | |
| * DWC2's 10-bit packet-count field (1023 packets) at both High-Speed (512 B | |
| * MPS) and Full-Speed (64 B MPS = 512 packets). | |
| */ | |
| #define EP_BUFFER_SIZE 32768 | |
| typedef void (*usb_req_cb)(struct usb_ep *ep, struct usb_request *req); | |
| struct f_fastboot { | |
| struct usb_function usb_function; | |
| /* IN/OUT EP's and corresponding requests */ | |
| struct usb_ep *in_ep, *out_ep; | |
| struct usb_request *in_req, *out_req; | |
| }; | |
| // `fastboot_func` contains USB IN/OUT EP's and the corresponding USB requests. | |
| extern struct f_fastboot *fastboot_func; | |
| // Sets custom Fastboot USB completion callback. | |
| int set_fastboot_usb_completion_cb(usb_req_cb out_req, usb_req_cb in_req); | |
| // Resets to default Fastboot USB completion callback. | |
| void reset_fastboot_usb_completion_cb(void); |