From b24866225a6301d3a663f874725e83c012dc25d3 Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Wed, 26 Dec 2012 17:36:00 +0100 Subject: digital/beacon: add bitcloud stack into common directory digital/zigbit --- .../USBClasses/common/src/usbSetupProcess.c | 90 ++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 digital/zigbit/bitcloud/stack/Components/HAL/drivers/USBClasses/common/src/usbSetupProcess.c (limited to 'digital/zigbit/bitcloud/stack/Components/HAL/drivers/USBClasses/common/src/usbSetupProcess.c') diff --git a/digital/zigbit/bitcloud/stack/Components/HAL/drivers/USBClasses/common/src/usbSetupProcess.c b/digital/zigbit/bitcloud/stack/Components/HAL/drivers/USBClasses/common/src/usbSetupProcess.c new file mode 100644 index 00000000..2a3b305e --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/HAL/drivers/USBClasses/common/src/usbSetupProcess.c @@ -0,0 +1,90 @@ +/****************************************************************************//** + \file usbSetupProcess.c + + \brief Implementation of setup (after numeration) proccess. + + \author + Atmel Corporation: http://www.atmel.com \n + Support email: avr@atmel.com + + Copyright (c) 2008-2011, Atmel Corporation. All rights reserved. + Licensed under Atmel's Limited License Agreement (BitCloudTM). + + \internal + History: + 26/08/11 N. Fomin - Created +*******************************************************************************/ +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#if (APP_INTERFACE == APP_INTERFACE_VCP) + #include + #if (MSD_SUPPORT == 1) + #include + #endif // (MSD_SUPPORT == 1) +#else + #if (MSD_SUPPORT == 1) + #include + #else + #include + #endif // (MSD_SUPPORT == 1) +#endif // (APP_INTERFACE == APP_INTERFACE_VCP) +#if (DFU_SUPPORT == 1) + #include + #if (APP_INTERFACE != APP_INTERFACE_VCP) && (MSD_SUPPORT != 1) + #error + #endif // (APP_INTERFACE != APP_INTERFACE_VCP) || (MSD_SUPPORT != 1) +#endif // (DFU_SUPPORT == 1) + +/****************************************************************************** +Usb setup process request handler + +Parameters: + data - pointer to host's request +******************************************************************************/ +void setupProcessRequestHandler(uint8_t *data) +{ + UsbRequest_t *pRequest = NULL; + + pRequest = (UsbRequest_t *)data; + if (NULL == pRequest) + return; + + switch (pRequest->wIndex) + { + #if (APP_INTERFACE == APP_INTERFACE_VCP) + case NUMBER_OF_FIRST_INTERFACE: + vcpRequestHandler(data); + break; + #endif // (APP_INTERFACE == APP_INTERFACE_VCP) + /* MSC commands */ + #if (MSD_SUPPORT == 1) + #if (APP_INTERFACE == APP_INTERFACE_VCP) + case NUMBER_OF_THIRD_INTERFACE: + #else + case NUMBER_OF_FIRST_INTERFACE: + #endif + msdRequestHandler(data); + break; + #endif // (MSD_SUPPORT == 1) + #if (DFU_SUPPORT == 1) + #if (APP_INTERFACE == APP_INTERFACE_VCP) + #if (MSD_SUPPORT == 1) + case NUMBER_OF_FOURTH_INTERFACE: + #else + case NUMBER_OF_THIRD_INTERFACE: + #endif + #else + case NUMBER_OF_SECOND_INTERFACE: + #endif // (APP_INTERFACE == APP_INTERFACE_VCP) + dfuRequestHandler(data); + break; + #endif // (DFU_SUPPORT == 1) + default: + HAL_Stall(0); + break; + } +} + +// eof usbSetupProcess.c -- cgit v1.2.3