diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2011-07-08 07:25:56 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2011-07-08 07:25:56 +0000 |
commit | 137ce280c1e9c33e9393f1dfd6bb160c131bd1a4 (patch) | |
tree | 9db0900f06376a93ef2b6d9e9ef1edbfdc2a1f79 /LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c | |
parent | bcb627e1a1bb9f013670d981ead2db97d7c70608 (diff) | |
download | lufa-137ce280c1e9c33e9393f1dfd6bb160c131bd1a4.tar.gz lufa-137ce280c1e9c33e9393f1dfd6bb160c131bd1a4.tar.bz2 lufa-137ce280c1e9c33e9393f1dfd6bb160c131bd1a4.zip |
Updated all host mode demos and projects to use the EVENT_USB_Host_DeviceEnumerationComplete() event callback for device configuration instead of manual host state machine manipulations in the main application task.
Added new USB_Host_ConfigurationNumber global variable to indicate the selected configuration in an attached device.
Renamed global state variables that are specific to a certain USB mode to clearly indicate which mode the variable relates to, by changing the USB_* prefix to USB_Device_* or USB_Host_*.
Removed the HOST_STATE_WaitForDeviceRemoval and HOST_STATE_Suspended host state machine states, as these are no longer required.
Altered the USB_Host_SetDeviceConfiguration() function to update the new USB_Host_ConfigurationNumber global as required.
Moved out the Host mode standard request convenience/helper functions from the architecture specific Host driver files to the architecture agnostic HostStandardReq.c driver file.
Diffstat (limited to 'LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c')
-rw-r--r-- | LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c index 4802463f0..571ab6c8a 100644 --- a/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c @@ -178,15 +178,15 @@ void USB_ResetInterface(void) #if defined(USB_CAN_BE_DEVICE) static void USB_Init_Device(void) { - USB_DeviceState = DEVICE_STATE_Unattached; - USB_ConfigurationNumber = 0; + USB_DeviceState = DEVICE_STATE_Unattached; + USB_Device_ConfigurationNumber = 0; #if !defined(NO_DEVICE_REMOTE_WAKEUP) - USB_RemoteWakeupEnabled = false; + USB_Device_RemoteWakeupEnabled = false; #endif #if !defined(NO_DEVICE_SELF_POWER) - USB_CurrentlySelfPowered = false; + USB_Device_CurrentlySelfPowered = false; #endif #if !defined(FIXED_CONTROL_ENDPOINT_SIZE) @@ -199,21 +199,21 @@ static void USB_Init_Device(void) if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DeviceDescriptorPtr, &DescriptorAddressSpace) != NO_DESCRIPTOR) { if (DescriptorAddressSpace == MEMSPACE_FLASH) - USB_ControlEndpointSize = pgm_read_byte(&DeviceDescriptorPtr->Endpoint0Size); + USB_Device_ControlEndpointSize = pgm_read_byte(&DeviceDescriptorPtr->Endpoint0Size); else if (DescriptorAddressSpace == MEMSPACE_EEPROM) - USB_ControlEndpointSize = eeprom_read_byte(&DeviceDescriptorPtr->Endpoint0Size); + USB_Device_ControlEndpointSize = eeprom_read_byte(&DeviceDescriptorPtr->Endpoint0Size); else - USB_ControlEndpointSize = DeviceDescriptorPtr->Endpoint0Size; + USB_Device_ControlEndpointSize = DeviceDescriptorPtr->Endpoint0Size; } #else if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DeviceDescriptorPtr) != NO_DESCRIPTOR) { #if defined(USE_RAM_DESCRIPTORS) - USB_ControlEndpointSize = DeviceDescriptorPtr->Endpoint0Size; + USB_Device_ControlEndpointSize = DeviceDescriptorPtr->Endpoint0Size; #elif defined(USE_EEPROM_DESCRIPTORS) - USB_ControlEndpointSize = eeprom_read_byte(&DeviceDescriptorPtr->Endpoint0Size); + USB_Device_ControlEndpointSize = eeprom_read_byte(&DeviceDescriptorPtr->Endpoint0Size); #else - USB_ControlEndpointSize = pgm_read_byte(&DeviceDescriptorPtr->Endpoint0Size); + USB_Device_ControlEndpointSize = pgm_read_byte(&DeviceDescriptorPtr->Endpoint0Size); #endif } #endif @@ -229,7 +229,7 @@ static void USB_Init_Device(void) #endif Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL, - ENDPOINT_DIR_OUT, USB_ControlEndpointSize, + ENDPOINT_DIR_OUT, USB_Device_ControlEndpointSize, ENDPOINT_BANK_SINGLE); USB_INT_Clear(USB_INT_SUSPI); @@ -243,8 +243,9 @@ static void USB_Init_Device(void) #if defined(USB_CAN_BE_HOST) static void USB_Init_Host(void) { - USB_HostState = HOST_STATE_Unattached; - USB_ControlPipeSize = PIPE_CONTROLPIPE_DEFAULT_SIZE; + USB_HostState = HOST_STATE_Unattached; + USB_Host_ConfigurationNumber = 0; + USB_Host_ControlPipeSize = PIPE_CONTROLPIPE_DEFAULT_SIZE; USB_Host_HostMode_On(); @@ -254,7 +255,7 @@ static void USB_Init_Host(void) USB_INT_Enable(USB_INT_SRPI); USB_INT_Enable(USB_INT_BCERRI); - + USB_Attach(); } #endif |