From fd96b288824caaa3ee4e5e03887f016de9df80cf Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Thu, 1 Apr 2010 04:30:21 +0000 Subject: More improvements to the incomplete BluetoothHost demo - add Disconnection Event processing. Remove unused macro in the host mode demos for the maximum Configuration Descriptor size. --- .../Incomplete/BluetoothHost/ConfigDescriptor.c | 23 ++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c') diff --git a/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c b/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c index ba4ac4d3b0..4c94eaabab 100644 --- a/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c +++ b/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c @@ -28,8 +28,23 @@ this software. */ +/** \file + * + * USB Device Configuration Descriptor processing routines, to determine the correct pipe configurations + * needed to communication with an attached USB device. Descriptors are special computer-readable structures + * which the host requests upon device enumeration, to determine the device's capabilities and functions. + */ + #include "ConfigDescriptor.h" +/** Reads and processes an attached device's descriptors, to determine compatibility and pipe configurations. This + * routine will read in the entire configuration descriptor, and configure the hosts pipes to correctly communicate + * with compatible devices. + * + * This routine searches for a BT interface descriptor containing bulk IN and OUT data endpoints. + * + * \return An error code from the \ref Bluetooth_GetConfigDescriptorDataCodes_t enum. + */ uint8_t ProcessConfigurationDescriptor(void) { uint8_t ConfigDescriptorData[512]; @@ -47,7 +62,7 @@ uint8_t ProcessConfigurationDescriptor(void) case HOST_GETCONFIG_BuffOverflow: return DescriptorTooLarge; default: - return ControlErrorDuringConfigRead; + return ControlError; } /* The bluetooth USB transport addendum mandates that the data (not streaming voice) endpoints @@ -56,7 +71,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* Ensure that an interface was found, and the end of the descriptor was not reached */ if (!(CurrConfigBytesRem)) - return NoInterfaceFound; + return NoBTInterfaceFound; /* Get the data IN, data OUT and event notification endpoints for the bluetooth interface */ while (FoundEndpoints != ((1 << BLUETOOTH_DATA_IN_PIPE) | (1 << BLUETOOTH_DATA_OUT_PIPE) | @@ -64,7 +79,7 @@ uint8_t ProcessConfigurationDescriptor(void) { /* Fetch the next endpoint from the current bluetooth interface */ if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation, - NextInterfaceBluetoothDataEndpoint)) + DComp_NextInterfaceBluetoothDataEndpoint)) { /* Descriptor not found, error out */ return NoEndpointFound; @@ -118,7 +133,7 @@ uint8_t ProcessConfigurationDescriptor(void) return SuccessfulConfigRead; } -uint8_t NextInterfaceBluetoothDataEndpoint(void* CurrentDescriptor) +uint8_t DComp_NextInterfaceBluetoothDataEndpoint(void* CurrentDescriptor) { /* PURPOSE: Find next interface endpoint descriptor before next interface descriptor */ -- cgit v1.2.3