Split usb_status_code_transfer_config_t as usb_status_code_read_config_t and usb_status_code_write_config_t
This commit is contained in:
@@ -9,7 +9,7 @@ void UsbCommand_ReadConfig(bool isHardware)
|
||||
uint16_t offset = GET_USB_BUFFER_UINT16(2);
|
||||
|
||||
if (length > USB_GENERIC_HID_OUT_BUFFER_LENGTH-1) {
|
||||
SET_USB_BUFFER_UINT8(0, UsbStatusCode_TransferConfig_LengthTooLarge);
|
||||
SET_USB_BUFFER_UINT8(0, UsbStatusCode_ReadConfig_LengthTooLarge);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ void UsbCommand_ReadConfig(bool isHardware)
|
||||
uint16_t bufferLength = isHardware ? HARDWARE_CONFIG_SIZE : USER_CONFIG_SIZE;
|
||||
|
||||
if (offset + length > bufferLength) {
|
||||
SET_USB_BUFFER_UINT8(0, UsbStatusCode_TransferConfig_BufferOutOfBounds);
|
||||
SET_USB_BUFFER_UINT8(0, UsbStatusCode_ReadConfig_BufferOutOfBounds);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,4 +5,11 @@
|
||||
|
||||
void UsbCommand_ReadConfig(bool isHardware);
|
||||
|
||||
// Typedefs:
|
||||
|
||||
typedef enum {
|
||||
UsbStatusCode_ReadConfig_LengthTooLarge = 2,
|
||||
UsbStatusCode_ReadConfig_BufferOutOfBounds = 3,
|
||||
} usb_status_code_read_config_t;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,7 +9,7 @@ void UsbCommand_WriteConfig(bool isHardware)
|
||||
uint16_t offset = GET_USB_BUFFER_UINT16(2);
|
||||
|
||||
if (length > USB_GENERIC_HID_OUT_BUFFER_LENGTH-4) {
|
||||
SET_USB_BUFFER_UINT8(0, UsbStatusCode_TransferConfig_LengthTooLarge);
|
||||
SET_USB_BUFFER_UINT8(0, UsbStatusCode_WriteConfig_LengthTooLarge);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ void UsbCommand_WriteConfig(bool isHardware)
|
||||
uint16_t bufferLength = isHardware ? HARDWARE_CONFIG_SIZE : USER_CONFIG_SIZE;
|
||||
|
||||
if (offset + length > bufferLength) {
|
||||
SET_USB_BUFFER_UINT8(0, UsbStatusCode_TransferConfig_BufferOutOfBounds);
|
||||
SET_USB_BUFFER_UINT8(0, UsbStatusCode_WriteConfig_BufferOutOfBounds);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,4 +5,11 @@
|
||||
|
||||
void UsbCommand_WriteConfig(bool isHardware);
|
||||
|
||||
// Typedefs:
|
||||
|
||||
typedef enum {
|
||||
UsbStatusCode_WriteConfig_LengthTooLarge = 2,
|
||||
UsbStatusCode_WriteConfig_BufferOutOfBounds = 3,
|
||||
} usb_status_code_write_config_t;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -41,11 +41,6 @@
|
||||
UsbStatusCode_InvalidCommand = 1,
|
||||
} usb_status_code_general_t;
|
||||
|
||||
typedef enum {
|
||||
UsbStatusCode_TransferConfig_LengthTooLarge = 2,
|
||||
UsbStatusCode_TransferConfig_BufferOutOfBounds = 3,
|
||||
} usb_status_code_transfer_config_t;
|
||||
|
||||
// Functions:
|
||||
|
||||
void UsbProtocolHandler(void);
|
||||
|
||||
Reference in New Issue
Block a user