projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
CI: Build on Arch (bleeding-ege) and Ubuntu (stable) AVR-GCC toolchains.
[pub/USBasp.git]
/
LUFA
/
Drivers
/
USB
/
Core
/
DeviceStandardReq.c
diff --git
a/LUFA/Drivers/USB/Core/DeviceStandardReq.c
b/LUFA/Drivers/USB/Core/DeviceStandardReq.c
index
61082cf
..
45b43c2
100644
(file)
--- a/
LUFA/Drivers/USB/Core/DeviceStandardReq.c
+++ b/
LUFA/Drivers/USB/Core/DeviceStandardReq.c
@@
-1,13
+1,13
@@
/*
LUFA Library
/*
LUFA Library
- Copyright (C) Dean Camera, 201
2
.
+ Copyright (C) Dean Camera, 201
8
.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
- Copyright 201
2
Dean Camera (dean [at] fourwalledcubicle [dot] com)
+ Copyright 201
8
Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
@@
-18,7
+18,7
@@
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
- The author disclaim all warranties with regard to this
+ The author disclaim
s
all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
@@
-109,21
+109,24
@@
void USB_Device_ProcessControlRequest(void)
USB_Device_SetConfiguration();
break;
USB_Device_SetConfiguration();
break;
+
+ default:
+ break;
}
}
if (Endpoint_IsSETUPReceived())
{
}
}
if (Endpoint_IsSETUPReceived())
{
- Endpoint_StallTransaction();
Endpoint_ClearSETUP();
Endpoint_ClearSETUP();
+ Endpoint_StallTransaction();
}
}
static void USB_Device_SetAddress(void)
{
}
}
static void USB_Device_SetAddress(void)
{
- uint8_t
DeviceAddress
= (USB_ControlRequest.wValue & 0x7F);
- uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask();
-
GlobalInterruptDisable(
);
+ uint8_t
DeviceAddress
= (USB_ControlRequest.wValue & 0x7F);
+
+
USB_Device_SetDeviceAddress(DeviceAddress
);
Endpoint_ClearSETUP();
Endpoint_ClearSETUP();
@@
-131,10
+134,9
@@
static void USB_Device_SetAddress(void)
while (!(Endpoint_IsINReady()));
while (!(Endpoint_IsINReady()));
- USB_Device_SetDeviceAddress(DeviceAddress);
- USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default;
+ USB_Device_EnableDeviceAddress(DeviceAddress);
-
SetGlobalInterruptMask(CurrentGlobalInt)
;
+
USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default
;
}
static void USB_Device_SetConfiguration(void)
}
static void USB_Device_SetConfiguration(void)
@@
-150,8
+152,8
@@
static void USB_Device_SetConfiguration(void)
#define MemoryAddressSpace MEMSPACE_FLASH
#elif defined(USE_EEPROM_DESCRIPTORS)
#define MemoryAddressSpace MEMSPACE_EEPROM
#define MemoryAddressSpace MEMSPACE_FLASH
#elif defined(USE_EEPROM_DESCRIPTORS)
#define MemoryAddressSpace MEMSPACE_EEPROM
- #elif defined(USE_
S
RAM_DESCRIPTORS)
- #define MemoryAddressSpace MEMSPACE_
S
RAM
+ #elif defined(USE_RAM_DESCRIPTORS)
+ #define MemoryAddressSpace MEMSPACE_RAM
#else
uint8_t MemoryAddressSpace;
#endif
#else
uint8_t MemoryAddressSpace;
#endif
@@
-289,8
+291,8
@@
static void USB_Device_GetStatus(void)
switch (USB_ControlRequest.bmRequestType)
{
switch (USB_ControlRequest.bmRequestType)
{
- #if !defined(NO_DEVICE_SELF_POWER) || !defined(NO_DEVICE_REMOTE_WAKEUP)
case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE):
case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE):
+ {
#if !defined(NO_DEVICE_SELF_POWER)
if (USB_Device_CurrentlySelfPowered)
CurrentStatus |= FEATURE_SELFPOWERED_ENABLED;
#if !defined(NO_DEVICE_SELF_POWER)
if (USB_Device_CurrentlySelfPowered)
CurrentStatus |= FEATURE_SELFPOWERED_ENABLED;
@@
-301,17
+303,24
@@
static void USB_Device_GetStatus(void)
CurrentStatus |= FEATURE_REMOTE_WAKEUP_ENABLED;
#endif
break;
CurrentStatus |= FEATURE_REMOTE_WAKEUP_ENABLED;
#endif
break;
- #endif
- #if !defined(CONTROL_ONLY_DEVICE)
+ }
case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT):
case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT):
- Endpoint_SelectEndpoint((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);
+ {
+ #if !defined(CONTROL_ONLY_DEVICE)
+ uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);
+
+ if (EndpointIndex >= ENDPOINT_TOTAL_ENDPOINTS)
+ return;
+
+ Endpoint_SelectEndpoint(EndpointIndex);
CurrentStatus = Endpoint_IsStalled();
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
CurrentStatus = Endpoint_IsStalled();
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
+ #endif
break;
break;
- #endif
+ }
default:
return;
}
default:
return;
}
@@
-330,20
+339,23
@@
static void USB_Device_ClearSetFeature(void)
{
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
case REQREC_DEVICE:
{
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
case REQREC_DEVICE:
+ {
if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_DeviceRemoteWakeup)
USB_Device_RemoteWakeupEnabled = (USB_ControlRequest.bRequest == REQ_SetFeature);
else
return;
break;
if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_DeviceRemoteWakeup)
USB_Device_RemoteWakeupEnabled = (USB_ControlRequest.bRequest == REQ_SetFeature);
else
return;
break;
+ }
#endif
#if !defined(CONTROL_ONLY_DEVICE)
case REQREC_ENDPOINT:
#endif
#if !defined(CONTROL_ONLY_DEVICE)
case REQREC_ENDPOINT:
+ {
if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_EndpointHalt)
{
uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);
if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_EndpointHalt)
{
uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);
- if (EndpointIndex == ENDPOINT_CONTROLEP)
+ if (EndpointIndex == ENDPOINT_CONTROLEP
|| EndpointIndex >= ENDPOINT_TOTAL_ENDPOINTS
)
return;
Endpoint_SelectEndpoint(EndpointIndex);
return;
Endpoint_SelectEndpoint(EndpointIndex);
@@
-364,6
+376,7
@@
static void USB_Device_ClearSetFeature(void)
}
break;
}
break;
+ }
#endif
default:
return;
#endif
default:
return;