Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
usbd_core_msc.c
00001 /** 00002 * @file usbd_core_msc.c 00003 * @brief Mass Storage Class driver 00004 * 00005 * DAPLink Interface Firmware 00006 * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved 00007 * SPDX-License-Identifier: Apache-2.0 00008 * 00009 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00010 * not use this file except in compliance with the License. 00011 * You may obtain a copy of the License at 00012 * 00013 * http://www.apache.org/licenses/LICENSE-2.0 00014 * 00015 * Unless required by applicable law or agreed to in writing, software 00016 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00017 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00018 * See the License for the specific language governing permissions and 00019 * limitations under the License. 00020 */ 00021 00022 #include <string.h> 00023 00024 #include "rl_usb.h" 00025 #include "usb_for_lib.h" 00026 00027 00028 /* 00029 * Clear Feature USB Device Request - MSC specific handling 00030 * Parameters: EPNum: Endpoint number 00031 * Return Value: None 00032 */ 00033 00034 __weak void USBD_ReqClrFeature_MSC(U32 EPNum) 00035 { 00036 USBD_MSC_ClrStallEP(EPNum); 00037 } 00038 00039 00040 /* 00041 * USB Device Endpoint 0 Event Callback - MSC specific handling (Setup Request To Interface) 00042 * Parameters: none 00043 * Return Value: TRUE - Setup class request ok, FALSE - Setup class request not supported 00044 */ 00045 00046 __weak BOOL USBD_EndPoint0_Setup_MSC_ReqToIF(void) 00047 { 00048 if (USBD_SetupPacket.wIndexL == usbd_msc_if_num) { /* IF number correct? */ 00049 switch (USBD_SetupPacket.bRequest) { 00050 case MSC_REQUEST_RESET: 00051 if ((USBD_SetupPacket.wValue == 0) && /* RESET with invalid parameters -> STALL */ 00052 (USBD_SetupPacket.wLength == 0)) { 00053 if (USBD_MSC_Reset()) { 00054 USBD_StatusInStage(); 00055 return (__TRUE); 00056 } 00057 } 00058 00059 break; 00060 00061 case MSC_REQUEST_GET_MAX_LUN: 00062 if ((USBD_SetupPacket.wValue == 0) && /* GET_MAX_LUN with invalid parameters -> STALL */ 00063 (USBD_SetupPacket.wLength == 1)) { 00064 if (USBD_MSC_GetMaxLUN()) { 00065 USBD_EP0Data.pData = USBD_EP0Buf; 00066 USBD_DataInStage(); 00067 return (__TRUE); 00068 } 00069 } 00070 00071 break; 00072 } 00073 } 00074 00075 return (__FALSE); 00076 }
Generated on Tue Jul 12 2022 15:37:26 by
