usb: Add buffer alignment checks

EDCI/EHCI controllers only allow 0x1000 aligned buffers.
So reply with a specific error type instead of a EP xfer error.
This commit is contained in:
CTCaer
2020-11-26 01:54:10 +02:00
parent bd4517abab
commit caae685fab
3 changed files with 15 additions and 0 deletions

View File

@@ -28,6 +28,7 @@
#define USB_EP_BUFFER_2_TD (USB_TD_BUFFER_MAX_SIZE * 2)
#define USB_EP_BUFFER_4_TD (USB_TD_BUFFER_MAX_SIZE * 4)
#define USB_EP_BUFFER_MAX_SIZE (USB_EP_BUFFER_4_TD)
#define USB_EP_BUFFER_ALIGN (USB_TD_BUFFER_PAGE_SIZE)
#define USB_XFER_START false
#define USB_XFER_SYNCED true
@@ -134,6 +135,7 @@ typedef enum _usb_error_t
USB_ERROR_XFER_ERROR = 5,
USB2_ERROR_XFER_EP_DISABLED = 28,
USB2_ERROR_XFER_NOT_ALIGNED = 29,
} usb_error_t;
typedef struct _usb_ctrl_setup_t