aboutsummaryrefslogtreecommitdiff
path: root/stm/stmusbd
diff options
context:
space:
mode:
authorDamien George2014-05-21 20:14:27 +0100
committerDamien George2014-05-21 20:14:27 +0100
commitaa7cf6f72f4e8a553f892629bb3338ab8c982d57 (patch)
treeb16167eecc2c5e8e5f84bd710308366a166c55e8 /stm/stmusbd
parent63436ce22ee20f56b0083f846261c0b77af9961b (diff)
stm: Remove long-obsolete stm/ port.
Diffstat (limited to 'stm/stmusbd')
-rw-r--r--stm/stmusbd/usbd_cdc_core.h143
-rw-r--r--stm/stmusbd/usbd_cdc_vcp.c222
-rw-r--r--stm/stmusbd/usbd_cdc_vcp.h52
-rw-r--r--stm/stmusbd/usbd_conf.h23
-rw-r--r--stm/stmusbd/usbd_core.c506
-rw-r--r--stm/stmusbd/usbd_core.h120
-rw-r--r--stm/stmusbd/usbd_def.h157
-rw-r--r--stm/stmusbd/usbd_desc.c331
-rw-r--r--stm/stmusbd/usbd_desc.h121
-rw-r--r--stm/stmusbd/usbd_ioreq.c244
-rw-r--r--stm/stmusbd/usbd_ioreq.h121
-rw-r--r--stm/stmusbd/usbd_msc_bot.c401
-rw-r--r--stm/stmusbd/usbd_msc_bot.h153
-rw-r--r--stm/stmusbd/usbd_msc_data.c134
-rw-r--r--stm/stmusbd/usbd_msc_data.h105
-rw-r--r--stm/stmusbd/usbd_msc_mem.h113
-rw-r--r--stm/stmusbd/usbd_msc_scsi.c729
-rw-r--r--stm/stmusbd/usbd_msc_scsi.h195
-rw-r--r--stm/stmusbd/usbd_pyb_core.c958
-rw-r--r--stm/stmusbd/usbd_pyb_core.h4
-rw-r--r--stm/stmusbd/usbd_pyb_core2.c323
-rw-r--r--stm/stmusbd/usbd_req.c868
-rw-r--r--stm/stmusbd/usbd_req.h108
-rw-r--r--stm/stmusbd/usbd_storage_msd.c363
-rw-r--r--stm/stmusbd/usbd_storage_msd.h6
-rw-r--r--stm/stmusbd/usbd_usr.c114
-rw-r--r--stm/stmusbd/usbd_usr.h141
27 files changed, 0 insertions, 6755 deletions
diff --git a/stm/stmusbd/usbd_cdc_core.h b/stm/stmusbd/usbd_cdc_core.h
deleted file mode 100644
index 026462143..000000000
--- a/stm/stmusbd/usbd_cdc_core.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_cdc_core.h
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief header file for the usbd_cdc_core.c file.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-
-#ifndef __USB_CDC_CORE_H_
-#define __USB_CDC_CORE_H_
-
-#include "usbd_ioreq.h"
-
-/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
- * @{
- */
-
-/** @defgroup usbd_cdc
- * @brief This file is the Header file for USBD_cdc.c
- * @{
- */
-
-
-/** @defgroup usbd_cdc_Exported_Defines
- * @{
- */
-#define USB_CDC_CONFIG_DESC_SIZ (98)
-#define USB_CDC_DESC_SIZ (98-9)
-
-#define CDC_DESCRIPTOR_TYPE 0x21
-
-#define DEVICE_CLASS_CDC 0x02
-#define DEVICE_SUBCLASS_CDC 0x00
-
-
-#define USB_DEVICE_DESCRIPTOR_TYPE 0x01
-#define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02
-#define USB_STRING_DESCRIPTOR_TYPE 0x03
-#define USB_INTERFACE_DESCRIPTOR_TYPE 0x04
-#define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05
-
-#define STANDARD_ENDPOINT_DESC_SIZE 0x09
-
-#define CDC_DATA_IN_PACKET_SIZE CDC_DATA_MAX_PACKET_SIZE
-
-#define CDC_DATA_OUT_PACKET_SIZE CDC_DATA_MAX_PACKET_SIZE
-
-/*---------------------------------------------------------------------*/
-/* CDC definitions */
-/*---------------------------------------------------------------------*/
-
-/**************************************************/
-/* CDC Requests */
-/**************************************************/
-#define SEND_ENCAPSULATED_COMMAND 0x00
-#define GET_ENCAPSULATED_RESPONSE 0x01
-#define SET_COMM_FEATURE 0x02
-#define GET_COMM_FEATURE 0x03
-#define CLEAR_COMM_FEATURE 0x04
-#define SET_LINE_CODING 0x20
-#define GET_LINE_CODING 0x21
-#define SET_CONTROL_LINE_STATE 0x22
-#define SEND_BREAK 0x23
-#define NO_CMD 0xFF
-
-/**
- * @}
- */
-
-
-/** @defgroup USBD_CORE_Exported_TypesDefinitions
- * @{
- */
-typedef struct _CDC_IF_PROP
-{
- uint16_t (*pIf_Init) (void);
- uint16_t (*pIf_DeInit) (void);
- uint16_t (*pIf_Ctrl) (uint32_t Cmd, uint8_t* Buf, uint32_t Len);
- uint16_t (*pIf_DataTx) (const uint8_t* Buf, uint32_t Len);
- uint16_t (*pIf_DataRx) (uint8_t* Buf, uint32_t Len);
-}
-CDC_IF_Prop_TypeDef;
-/**
- * @}
- */
-
-
-
-/** @defgroup USBD_CORE_Exported_Macros
- * @{
- */
-
-/**
- * @}
- */
-
-/** @defgroup USBD_CORE_Exported_Variables
- * @{
- */
-
-extern USBD_Class_cb_TypeDef USBD_CDC_cb;
-/**
- * @}
- */
-
-/** @defgroup USB_CORE_Exported_Functions
- * @{
- */
-/**
- * @}
- */
-
-#endif // __USB_CDC_CORE_H_
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/stm/stmusbd/usbd_cdc_vcp.c b/stm/stmusbd/usbd_cdc_vcp.c
deleted file mode 100644
index cb16b58f1..000000000
--- a/stm/stmusbd/usbd_cdc_vcp.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_cdc_vcp.c
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief Generic media access Layer.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
-#pragma data_alignment = 4
-#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
-
-/* Includes ------------------------------------------------------------------*/
-#include "usbd_conf.h"
-#include "usbd_cdc_vcp.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-LINE_CODING linecoding =
- {
- 115200, /* baud rate*/
- 0x00, /* stop bits-1*/
- 0x00, /* parity - none*/
- 0x08 /* nb. of bits 8*/
- };
-
-
-/* These are external variables imported from CDC core to be used for IN
- transfer management. */
-
-extern uint32_t APP_dev_is_connected; // set if CDC device is connected
-
-extern uint8_t APP_Rx_Buffer []; /* Write CDC received data in this buffer.
- These data will be sent over USB IN endpoint
- in the CDC core functions. */
-extern uint32_t APP_Rx_ptr_in; /* Increment this pointer or roll it back to
- start address when writing received data
- in the buffer APP_Rx_Buffer. */
-
-/* Private function prototypes -----------------------------------------------*/
-static uint16_t VCP_Init (void);
-static uint16_t VCP_DeInit (void);
-static uint16_t VCP_Ctrl (uint32_t Cmd, uint8_t* Buf, uint32_t Len);
-static uint16_t VCP_DataTx (const uint8_t* Buf, uint32_t Len);
-static uint16_t VCP_DataRx (uint8_t* Buf, uint32_t Len);
-
-CDC_IF_Prop_TypeDef VCP_fops =
-{
- VCP_Init,
- VCP_DeInit,
- VCP_Ctrl,
- VCP_DataTx,
- VCP_DataRx
-};
-
-/* Private functions ---------------------------------------------------------*/
-/**
- * @brief VCP_Init
- * Initializes the Media on the STM32
- * @param None
- * @retval Result of the opeartion (USBD_OK in all cases)
- */
-static uint16_t VCP_Init(void) {
- return USBD_OK;
-}
-
-/**
- * @brief VCP_DeInit
- * DeInitializes the Media on the STM32
- * @param None
- * @retval Result of the opeartion (USBD_OK in all cases)
- */
-static uint16_t VCP_DeInit(void)
-{
-
- return USBD_OK;
-}
-
-
-/**
- * @brief VCP_Ctrl
- * Manage the CDC class requests
- * @param Cmd: Command code
- * @param Buf: Buffer containing command data (request parameters)
- * @param Len: Number of data to be sent (in bytes)
- * @retval Result of the opeartion (USBD_OK in all cases)
- */
-static uint16_t VCP_Ctrl (uint32_t Cmd, uint8_t* Buf, uint32_t Len)
-{
- switch (Cmd)
- {
- case SEND_ENCAPSULATED_COMMAND:
- /* Not needed for this driver */
- break;
-
- case GET_ENCAPSULATED_RESPONSE:
- /* Not needed for this driver */
- break;
-
- case SET_COMM_FEATURE:
- /* Not needed for this driver */
- break;
-
- case GET_COMM_FEATURE:
- /* Not needed for this driver */
- break;
-
- case CLEAR_COMM_FEATURE:
- /* Not needed for this driver */
- break;
-
- case SET_LINE_CODING:
- /*
- linecoding.bitrate = (uint32_t)(Buf[0] | (Buf[1] << 8) | (Buf[2] << 16) | (Buf[3] << 24));
- linecoding.format = Buf[4];
- linecoding.paritytype = Buf[5];
- linecoding.datatype = Buf[6];
- // Set the new configuration
- VCP_COMConfig(OTHER_CONFIG);
- */
- break;
-
- case GET_LINE_CODING:
- /*
- Buf[0] = (uint8_t)(linecoding.bitrate);
- Buf[1] = (uint8_t)(linecoding.bitrate >> 8);
- Buf[2] = (uint8_t)(linecoding.bitrate >> 16);
- Buf[3] = (uint8_t)(linecoding.bitrate >> 24);
- Buf[4] = linecoding.format;
- Buf[5] = linecoding.paritytype;
- Buf[6] = linecoding.datatype;
- */
- Buf[0] = 0;
- Buf[1] = 0;
- Buf[2] = 0;
- Buf[3] = 0;
- Buf[4] = 0;
- Buf[5] = 0;
- Buf[6] = 0;
- break;
-
- case SET_CONTROL_LINE_STATE:
- APP_dev_is_connected = Len & 0x1; // wValue is passed in Len (bit of a hack)
- break;
-
- case SEND_BREAK:
- /* Not needed for this driver */
- break;
-
- default:
- break;
- }
-
- return USBD_OK;
-}
-
-/**
- * @brief VCP_DataTx
- * CDC received data to be send over USB IN endpoint are managed in
- * this function.
- * @param Buf: Buffer of data to be sent
- * @param Len: Number of data to be sent (in bytes)
- * @retval Result of the opeartion: USBD_OK if all operations are OK else VCP_FAIL
- */
-static uint16_t VCP_DataTx (const uint8_t* Buf, uint32_t Len)
-{
- for (int i = 0; i < Len; i++) {
- APP_Rx_Buffer[APP_Rx_ptr_in] = Buf[i];
- APP_Rx_ptr_in++;
-
- /* To avoid buffer overflow */
- if(APP_Rx_ptr_in == APP_RX_DATA_SIZE) {
- APP_Rx_ptr_in = 0;
- }
- }
-
- return USBD_OK;
-}
-
-/**
- * @brief VCP_DataRx
- * Data received over USB OUT endpoint are sent over CDC interface
- * through this function.
- *
- * @note
- * This function will block any OUT packet reception on USB endpoint
- * untill exiting this function. If you exit this function before transfer
- * is complete on CDC interface (ie. using DMA controller) it will result
- * in receiving more data while previous ones are still not sent.
- *
- * @param Buf: Buffer of data to be received
- * @param Len: Number of data received (in bytes)
- * @retval Result of the opeartion: USBD_OK if all operations are OK else VCP_FAIL
- */
-static uint16_t VCP_DataRx (uint8_t* Buf, uint32_t Len) {
- extern void usb_vcp_receive(uint8_t *buf, uint32_t len);
- usb_vcp_receive(Buf, Len);
- return USBD_OK;
-}
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/stm/stmusbd/usbd_cdc_vcp.h b/stm/stmusbd/usbd_cdc_vcp.h
deleted file mode 100644
index a80e287fa..000000000
--- a/stm/stmusbd/usbd_cdc_vcp.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_cdc_vcp.h
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief Header for usbd_cdc_vcp.c file.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __USBD_CDC_VCP_H
-#define __USBD_CDC_VCP_H
-
-#include "usbd_cdc_core.h"
-#include "usbd_conf.h"
-
-/* Exported typef ------------------------------------------------------------*/
-/* The following structures groups all needed parameters to be configured for the
- ComPort. These parameters can modified on the fly by the host through CDC class
- command class requests. */
-typedef struct
-{
- uint32_t bitrate;
- uint8_t format;
- uint8_t paritytype;
- uint8_t datatype;
-} LINE_CODING;
-
-#define DEFAULT_CONFIG 0
-#define OTHER_CONFIG 1
-
-#endif /* __USBD_CDC_VCP_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/stm/stmusbd/usbd_conf.h b/stm/stmusbd/usbd_conf.h
deleted file mode 100644
index ad4cd73c8..000000000
--- a/stm/stmusbd/usbd_conf.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __USBD_CONF__H__
-#define __USBD_CONF__H__
-
-#define USBD_CFG_MAX_NUM 1
-#define USBD_ITF_MAX_NUM 1 // TODO need more than 1?
-
-// CDC Endpoints parameters
-#define CDC_IN_EP 0x81 /* EP1 for data IN */
-#define CDC_OUT_EP 0x01 /* EP1 for data OUT */
-#define CDC_CMD_EP 0x82 /* EP2 for CDC commands */
-#define CDC_DATA_MAX_PACKET_SIZE 64 /* Endpoint IN & OUT Packet size */
-#define CDC_CMD_PACKET_SZE 8 /* Control Endpoint Packet size */
-#define CDC_IN_FRAME_INTERVAL 5 /* Number of frames between IN transfers */
-#define APP_RX_DATA_SIZE 2048 /* Total size of IN buffer:
- APP_RX_DATA_SIZE*8/MAX_BAUDARATE*1000 should be > CDC_IN_FRAME_INTERVAL */
-
-// MSC parameters
-#define MSC_IN_EP 0x83
-#define MSC_OUT_EP 0x03
-#define MSC_MAX_PACKET 64
-#define MSC_MEDIA_PACKET 2048 /* XXX was 4096; how small can we make it? */
-
-#endif //__USBD_CONF__H__
diff --git a/stm/stmusbd/usbd_core.c b/stm/stmusbd/usbd_core.c
deleted file mode 100644
index fa647eb0f..000000000
--- a/stm/stmusbd/usbd_core.c
+++ /dev/null
@@ -1,506 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_core.c
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief This file provides all the USBD core functions.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "usbd_core.h"
-#include "usbd_req.h"
-#include "usbd_ioreq.h"
-#include "usb_dcd_int.h"
-#include "usb_bsp.h"
-
-/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
-* @{
-*/
-
-
-/** @defgroup USBD_CORE
-* @brief usbd core module
-* @{
-*/
-
-/** @defgroup USBD_CORE_Private_TypesDefinitions
-* @{
-*/
-/**
-* @}
-*/
-
-
-/** @defgroup USBD_CORE_Private_Defines
-* @{
-*/
-
-/**
-* @}
-*/
-
-
-/** @defgroup USBD_CORE_Private_Macros
-* @{
-*/
-/**
-* @}
-*/
-
-
-
-
-/** @defgroup USBD_CORE_Private_FunctionPrototypes
-* @{
-*/
-static uint8_t USBD_SetupStage(USB_OTG_CORE_HANDLE *pdev);
-static uint8_t USBD_DataOutStage(USB_OTG_CORE_HANDLE *pdev , uint8_t epnum);
-static uint8_t USBD_DataInStage(USB_OTG_CORE_HANDLE *pdev , uint8_t epnum);
-static uint8_t USBD_SOF(USB_OTG_CORE_HANDLE *pdev);
-static uint8_t USBD_Reset(USB_OTG_CORE_HANDLE *pdev);
-static uint8_t USBD_Suspend(USB_OTG_CORE_HANDLE *pdev);
-static uint8_t USBD_Resume(USB_OTG_CORE_HANDLE *pdev);
-#ifdef VBUS_SENSING_ENABLED
-static uint8_t USBD_DevConnected(USB_OTG_CORE_HANDLE *pdev);
-static uint8_t USBD_DevDisconnected(USB_OTG_CORE_HANDLE *pdev);
-#endif
-static uint8_t USBD_IsoINIncomplete(USB_OTG_CORE_HANDLE *pdev);
-static uint8_t USBD_IsoOUTIncomplete(USB_OTG_CORE_HANDLE *pdev);
-static uint8_t USBD_RunTestMode (USB_OTG_CORE_HANDLE *pdev) ;
-/**
-* @}
-*/
-
-/** @defgroup USBD_CORE_Private_Variables
-* @{
-*/
-
-__IO USB_OTG_DCTL_TypeDef SET_TEST_MODE;
-
-USBD_DCD_INT_cb_TypeDef USBD_DCD_INT_cb =
-{
- USBD_DataOutStage,
- USBD_DataInStage,
- USBD_SetupStage,
- USBD_SOF,
- USBD_Reset,
- USBD_Suspend,
- USBD_Resume,
- USBD_IsoINIncomplete,
- USBD_IsoOUTIncomplete,
-#ifdef VBUS_SENSING_ENABLED
-USBD_DevConnected,
-USBD_DevDisconnected,
-#endif
-};
-
-USBD_DCD_INT_cb_TypeDef *USBD_DCD_INT_fops = &USBD_DCD_INT_cb;
-/**
-* @}
-*/
-
-/** @defgroup USBD_CORE_Private_Functions
-* @{
-*/
-
-/**
-* @brief USBD_Init
-* Initailizes the device stack and load the class driver
-* @param pdev: device instance
-* @param core_address: USB OTG core ID
-* @param class_cb: Class callback structure address
-* @param usr_cb: User callback structure address
-* @retval None
-*/
-void USBD_Init(USB_OTG_CORE_HANDLE *pdev,
- USB_OTG_CORE_ID_TypeDef coreID,
- USBD_DEVICE *pDevice,
- USBD_Class_cb_TypeDef *class_cb,
- USBD_Usr_cb_TypeDef *usr_cb)
-{
- /* Hardware Init */
- USB_OTG_BSP_Init(pdev);
-
- USBD_DeInit(pdev);
-
- /*Register class and user callbacks */
- pdev->dev.class_cb = class_cb;
- pdev->dev.usr_cb = usr_cb;
- pdev->dev.usr_device = pDevice;
-
- /* set USB OTG core params */
- DCD_Init(pdev , coreID);
-
- /* Upon Init call usr callback */
- pdev->dev.usr_cb->Init();
-
- /* Enable Interrupts */
- USB_OTG_BSP_EnableInterrupt(pdev);
-}
-
-/**
-* @brief USBD_DeInit
-* Re-Initialize th device library
-* @param pdev: device instance
-* @retval status: status
-*/
-USBD_Status USBD_DeInit(USB_OTG_CORE_HANDLE *pdev)
-{
- /* Software Init */
-
- return USBD_OK;
-}
-
-/**
-* @brief USBD_SetupStage
-* Handle the setup stage
-* @param pdev: device instance
-* @retval status
-*/
-static uint8_t USBD_SetupStage(USB_OTG_CORE_HANDLE *pdev)
-{
- USB_SETUP_REQ req;
-
- USBD_ParseSetupRequest(pdev , &req);
-
- switch (req.bmRequest & 0x1F)
- {
- case USB_REQ_RECIPIENT_DEVICE:
- USBD_StdDevReq (pdev, &req);
- break;
-
- case USB_REQ_RECIPIENT_INTERFACE:
- USBD_StdItfReq(pdev, &req);
- break;
-
- case USB_REQ_RECIPIENT_ENDPOINT:
- USBD_StdEPReq(pdev, &req);
- break;
-
- default:
- DCD_EP_Stall(pdev , req.bmRequest & 0x80);
- break;
- }
- return USBD_OK;
-}
-
-/**
-* @brief USBD_DataOutStage
-* Handle data out stage
-* @param pdev: device instance
-* @param epnum: endpoint index
-* @retval status
-*/
-static uint8_t USBD_DataOutStage(USB_OTG_CORE_HANDLE *pdev , uint8_t epnum)
-{
- USB_OTG_EP *ep;
-
- if(epnum == 0)
- {
- ep = &pdev->dev.out_ep[0];
- if ( pdev->dev.device_state == USB_OTG_EP0_DATA_OUT)
- {
- if(ep->rem_data_len > ep->maxpacket)
- {
- ep->rem_data_len -= ep->maxpacket;
-
- if(pdev->cfg.dma_enable == 1)
- {
- /* in slave mode this, is handled by the RxSTSQLvl ISR */
- ep->xfer_buff += ep->maxpacket;
- }
- USBD_CtlContinueRx (pdev,
- ep->xfer_buff,
- MIN(ep->rem_data_len ,ep->maxpacket));
- }
- else
- {
- if((pdev->dev.class_cb->EP0_RxReady != NULL)&&
- (pdev->dev.device_status == USB_OTG_CONFIGURED))
- {
- pdev->dev.class_cb->EP0_RxReady(pdev);
- }
- USBD_CtlSendStatus(pdev);
- }
- }
- }
- else if((pdev->dev.class_cb->DataOut != NULL)&&
- (pdev->dev.device_status == USB_OTG_CONFIGURED))
- {
- pdev->dev.class_cb->DataOut(pdev, epnum);
- }
- return USBD_OK;
-}
-
-/**
-* @brief USBD_DataInStage
-* Handle data in stage
-* @param pdev: device instance
-* @param epnum: endpoint index
-* @retval status
-*/
-static uint8_t USBD_DataInStage(USB_OTG_CORE_HANDLE *pdev , uint8_t epnum)
-{
- USB_OTG_EP *ep;
-
- if(epnum == 0)
- {
- ep = &pdev->dev.in_ep[0];
- if ( pdev->dev.device_state == USB_OTG_EP0_DATA_IN)
- {
- if(ep->rem_data_len > ep->maxpacket)
- {
- ep->rem_data_len -= ep->maxpacket;
- if(pdev->cfg.dma_enable == 1)
- {
- /* in slave mode this, is handled by the TxFifoEmpty ISR */
- ep->xfer_buff += ep->maxpacket;
- }
- USBD_CtlContinueSendData (pdev,
- ep->xfer_buff,
- ep->rem_data_len);
- }
- else
- { /* last packet is MPS multiple, so send ZLP packet */
- if((ep->total_data_len % ep->maxpacket == 0) &&
- (ep->total_data_len >= ep->maxpacket) &&
- (ep->total_data_len < ep->ctl_data_len ))
- {
-
- USBD_CtlContinueSendData(pdev , NULL, 0);
- ep->ctl_data_len = 0;
- }
- else
- {
- if((pdev->dev.class_cb->EP0_TxSent != NULL)&&
- (pdev->dev.device_status == USB_OTG_CONFIGURED))
- {
- pdev->dev.class_cb->EP0_TxSent(pdev);
- }
- USBD_CtlReceiveStatus(pdev);
- }
- }
- }
- if (pdev->dev.test_mode == 1)
- {
- USBD_RunTestMode(pdev);
- pdev->dev.test_mode = 0;
- }
- }
- else if((pdev->dev.class_cb->DataIn != NULL)&&
- (pdev->dev.device_status == USB_OTG_CONFIGURED))
- {
- pdev->dev.class_cb->DataIn(pdev, epnum);
- }
- return USBD_OK;
-}
-
-
-
-
-/**
-* @brief USBD_RunTestMode
-* Launch test mode process
-* @param pdev: device instance
-* @retval status
-*/
-static uint8_t USBD_RunTestMode (USB_OTG_CORE_HANDLE *pdev)
-{
- USB_OTG_WRITE_REG32(&pdev->regs.DREGS->DCTL, SET_TEST_MODE.d32);
- return USBD_OK;
-}
-
-/**
-* @brief USBD_Reset
-* Handle Reset event
-* @param pdev: device instance
-* @retval status
-*/
-
-static uint8_t USBD_Reset(USB_OTG_CORE_HANDLE *pdev)
-{
- /* Open EP0 OUT */
- DCD_EP_Open(pdev,
- 0x00,
- USB_OTG_MAX_EP0_SIZE,
- EP_TYPE_CTRL);
-
- /* Open EP0 IN */
- DCD_EP_Open(pdev,
- 0x80,
- USB_OTG_MAX_EP0_SIZE,
- EP_TYPE_CTRL);
-
- /* Upon Reset call usr call back */
- pdev->dev.device_status = USB_OTG_DEFAULT;
- pdev->dev.usr_cb->DeviceReset(pdev->cfg.speed);
-
- return USBD_OK;
-}
-
-/**
-* @brief USBD_Resume
-* Handle Resume event
-* @param pdev: device instance
-* @retval status
-*/
-
-static uint8_t USBD_Resume(USB_OTG_CORE_HANDLE *pdev)
-{
- /* Upon Resume call usr call back */
- pdev->dev.usr_cb->DeviceResumed();
- pdev->dev.device_status = pdev->dev.device_old_status;
- pdev->dev.device_status = USB_OTG_CONFIGURED;
- return USBD_OK;
-}
-
-
-/**
-* @brief USBD_Suspend
-* Handle Suspend event
-* @param pdev: device instance
-* @retval status
-*/
-
-static uint8_t USBD_Suspend(USB_OTG_CORE_HANDLE *pdev)
-{
- pdev->dev.device_old_status = pdev->dev.device_status;
- pdev->dev.device_status = USB_OTG_SUSPENDED;
- /* Upon Resume call usr call back */
- pdev->dev.usr_cb->DeviceSuspended();
- return USBD_OK;
-}
-
-
-/**
-* @brief USBD_SOF
-* Handle SOF event
-* @param pdev: device instance
-* @retval status
-*/
-
-static uint8_t USBD_SOF(USB_OTG_CORE_HANDLE *pdev)
-{
- if(pdev->dev.class_cb->SOF)
- {
- pdev->dev.class_cb->SOF(pdev);
- }
- return USBD_OK;
-}
-/**
-* @brief USBD_SetCfg
-* Configure device and start the interface
-* @param pdev: device instance
-* @param cfgidx: configuration index
-* @retval status
-*/
-
-USBD_Status USBD_SetCfg(USB_OTG_CORE_HANDLE *pdev, uint8_t cfgidx)
-{
- pdev->dev.class_cb->Init(pdev, cfgidx);
-
- /* Upon set config call usr call back */
- pdev->dev.usr_cb->DeviceConfigured();
- return USBD_OK;
-}
-
-/**
-* @brief USBD_ClrCfg
-* Clear current configuration
-* @param pdev: device instance
-* @param cfgidx: configuration index
-* @retval status: USBD_Status
-*/
-USBD_Status USBD_ClrCfg(USB_OTG_CORE_HANDLE *pdev, uint8_t cfgidx)
-{
- pdev->dev.class_cb->DeInit(pdev, cfgidx);
- return USBD_OK;
-}
-
-/**
-* @brief USBD_IsoINIncomplete
-* Handle iso in incomplete event
-* @param pdev: device instance
-* @retval status
-*/
-static uint8_t USBD_IsoINIncomplete(USB_OTG_CORE_HANDLE *pdev)
-{
- pdev->dev.class_cb->IsoINIncomplete(pdev);
- return USBD_OK;
-}
-
-/**
-* @brief USBD_IsoOUTIncomplete
-* Handle iso out incomplete event
-* @param pdev: device instance
-* @retval status
-*/
-static uint8_t USBD_IsoOUTIncomplete(USB_OTG_CORE_HANDLE *pdev)
-{
- pdev->dev.class_cb->IsoOUTIncomplete(pdev);
- return USBD_OK;
-}
-
-#ifdef VBUS_SENSING_ENABLED
-/**
-* @brief USBD_DevConnected
-* Handle device connection event
-* @param pdev: device instance
-* @retval status
-*/
-static uint8_t USBD_DevConnected(USB_OTG_CORE_HANDLE *pdev)
-{
- pdev->dev.usr_cb->DeviceConnected();
- pdev->dev.connection_status = 1;
- return USBD_OK;
-}
-
-/**
-* @brief USBD_DevDisconnected
-* Handle device disconnection event
-* @param pdev: device instance
-* @retval status
-*/
-static uint8_t USBD_DevDisconnected(USB_OTG_CORE_HANDLE *pdev)
-{
- pdev->dev.usr_cb->DeviceDisconnected();
- pdev->dev.class_cb->DeInit(pdev, 0);
- pdev->dev.connection_status = 0;
- return USBD_OK;
-}
-#endif
-/**
-* @}
-*/
-
-
-/**
-* @}
-*/
-
-
-/**
-* @}
-*/
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
diff --git a/stm/stmusbd/usbd_core.h b/stm/stmusbd/usbd_core.h
deleted file mode 100644
index 60d185b78..000000000
--- a/stm/stmusbd/usbd_core.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_core.h
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief Header file for usbd_core.c
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __USBD_CORE_H
-#define __USBD_CORE_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "usb_dcd.h"
-#include "usbd_def.h"
-//#include "usbd_conf.h"
-
-/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
- * @{
- */
-
-/** @defgroup USBD_CORE
- * @brief This file is the Header file for usbd_core.c file
- * @{
- */
-
-
-/** @defgroup USBD_CORE_Exported_Defines
- * @{
- */
-
-typedef enum {
- USBD_OK = 0,
- USBD_BUSY,
- USBD_FAIL,
-}USBD_Status;
-/**
- * @}
- */
-
-
-/** @defgroup USBD_CORE_Exported_TypesDefinitions
- * @{
- */
-
-
-/**
- * @}
- */
-
-
-
-/** @defgroup USBD_CORE_Exported_Macros
- * @{
- */
-
-/**
- * @}
- */
-
-/** @defgroup USBD_CORE_Exported_Variables
- * @{
- */
-
-/**
- * @}
- */
-
-/** @defgroup USBD_CORE_Exported_FunctionsPrototype
- * @{
- */
-void USBD_Init(USB_OTG_CORE_HANDLE *pdev,
- USB_OTG_CORE_ID_TypeDef coreID,
- USBD_DEVICE *pDevice,
- USBD_Class_cb_TypeDef *class_cb,
- USBD_Usr_cb_TypeDef *usr_cb);
-
-USBD_Status USBD_DeInit(USB_OTG_CORE_HANDLE *pdev);
-
-USBD_Status USBD_ClrCfg(USB_OTG_CORE_HANDLE *pdev, uint8_t cfgidx);
-
-USBD_Status USBD_SetCfg(USB_OTG_CORE_HANDLE *pdev, uint8_t cfgidx);
-
-/**
- * @}
- */
-
-#endif /* __USBD_CORE_H */
-
-/**
- * @}
- */
-
-/**
-* @}
-*/
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
-
-
diff --git a/stm/stmusbd/usbd_def.h b/stm/stmusbd/usbd_def.h
deleted file mode 100644
index bdf72d249..000000000
--- a/stm/stmusbd/usbd_def.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_def.h
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief general defines for the usb device library
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-
-#ifndef __USBD_DEF_H
-#define __USBD_DEF_H
-
-/* Includes ------------------------------------------------------------------*/
-//#include "usbd_conf.h"
-#define USB_MAX_STR_DESC_SIZ 255
-
-/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
- * @{
- */
-
-/** @defgroup USB_DEF
- * @brief general defines for the usb device library file
- * @{
- */
-
-/** @defgroup USB_DEF_Exported_Defines
- * @{
- */
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#define USB_LEN_DEV_QUALIFIER_DESC 0x0A
-#define USB_LEN_DEV_DESC 0x12
-#define USB_LEN_CFG_DESC 0x09
-#define USB_LEN_IF_DESC 0x09
-#define USB_LEN_EP_DESC 0x07
-#define USB_LEN_OTG_DESC 0x03
-
-#define USBD_IDX_LANGID_STR 0x00
-#define USBD_IDX_MFC_STR 0x01
-#define USBD_IDX_PRODUCT_STR 0x02
-#define USBD_IDX_SERIAL_STR 0x03
-#define USBD_IDX_CONFIG_STR 0x04
-#define USBD_IDX_INTERFACE_STR 0x05
-
-#define USB_REQ_TYPE_STANDARD 0x00
-#define USB_REQ_TYPE_CLASS 0x20
-#define USB_REQ_TYPE_VENDOR 0x40
-#define USB_REQ_TYPE_MASK 0x60
-
-#define USB_REQ_RECIPIENT_DEVICE 0x00
-#define USB_REQ_RECIPIENT_INTERFACE 0x01
-#define USB_REQ_RECIPIENT_ENDPOINT 0x02
-#define USB_REQ_RECIPIENT_MASK 0x03
-
-#define USB_REQ_GET_STATUS 0x00
-#define USB_REQ_CLEAR_FEATURE 0x01
-#define USB_REQ_SET_FEATURE 0x03
-#define USB_REQ_SET_ADDRESS 0x05
-#define USB_REQ_GET_DESCRIPTOR 0x06
-#define USB_REQ_SET_DESCRIPTOR 0x07
-#define USB_REQ_GET_CONFIGURATION 0x08
-#define USB_REQ_SET_CONFIGURATION 0x09
-#define USB_REQ_GET_INTERFACE 0x0A
-#define USB_REQ_SET_INTERFACE 0x0B
-#define USB_REQ_SYNCH_FRAME 0x0C
-
-#define USB_DESC_TYPE_DEVICE 1
-#define USB_DESC_TYPE_CONFIGURATION 2
-#define USB_DESC_TYPE_STRING 3
-#define USB_DESC_TYPE_INTERFACE 4
-#define USB_DESC_TYPE_ENDPOINT 5
-#define USB_DESC_TYPE_DEVICE_QUALIFIER 6
-#define USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION 7
-
-
-#define USB_CONFIG_REMOTE_WAKEUP 2
-#define USB_CONFIG_SELF_POWERED 1
-
-#define USB_FEATURE_EP_HALT 0
-#define USB_FEATURE_REMOTE_WAKEUP 1
-#define USB_FEATURE_TEST_MODE 2
-
-/**
- * @}
- */
-
-
-/** @defgroup USBD_DEF_Exported_TypesDefinitions
- * @{
- */
-/**
- * @}
- */
-
-
-
-/** @defgroup USBD_DEF_Exported_Macros
- * @{
- */
-#define SWAPBYTE(addr) (((uint16_t)(*((uint8_t *)(addr)))) + \
- (((uint16_t)(*(((uint8_t *)(addr)) + 1))) << 8))
-
-#define LOBYTE(x) ((uint8_t)(x & 0x00FF))
-#define HIBYTE(x) ((uint8_t)((x & 0xFF00) >>8))
-/**
- * @}
- */
-
-/** @defgroup USBD_DEF_Exported_Variables
- * @{
- */
-
-/**
- * @}
- */
-
-/** @defgroup USBD_DEF_Exported_FunctionsPrototype
- * @{
- */
-
-/**
- * @}
- */
-
-#endif /* __USBD_DEF_H */
-
-/**
- * @}
- */
-
-/**
-* @}
-*/
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/stm/stmusbd/usbd_desc.c b/stm/stmusbd/usbd_desc.c
deleted file mode 100644
index 1edbdbfac..000000000
--- a/stm/stmusbd/usbd_desc.c
+++ /dev/null
@@ -1,331 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_desc.c
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief This file provides the USBD descriptors and string formating method.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "usbd_core.h"
-#include "usbd_desc.h"
-#include "usbd_req.h"
-#include "usb_regs.h"
-
-/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
- * @{
- */
-
-
-/** @defgroup USBD_DESC
- * @brief USBD descriptors module
- * @{
- */
-
-/** @defgroup USBD_DESC_Private_TypesDefinitions
- * @{
- */
-/**
- * @}
- */
-
-
-/** @defgroup USBD_DESC_Private_Defines
- * @{
- */
-/*
-#define USBD_VID 0x0483 // TODO set VID
-#define USBD_PID 0x5720 // TODO set PID
-
-#define USBD_LANGID_STRING 0x409
-#define USBD_MANUFACTURER_STRING "STMicroelectronics" // TODO set
-#define USBD_PRODUCT_HS_STRING "VCP/MSC in HS Mode" // TODO set
-#define USBD_SERIALNUMBER_HS_STRING "00000000001A" // TODO set
-#define USBD_PRODUCT_FS_STRING "VCP/MSC in FS Mode" // TODO set
-#define USBD_SERIALNUMBER_FS_STRING "00000000001B" // TODO set
-#define USBD_CONFIGURATION_HS_STRING "VCP/MSC Config" // TODO set
-#define USBD_INTERFACE_HS_STRING "VCP/MSC Interface" // TODO set
-#define USBD_CONFIGURATION_FS_STRING "VCP/MSC Config" // TODO set
-#define USBD_INTERFACE_FS_STRING "VCP/MSC Interface" // TODO set
-*/
-/**
- * @}
- */
-
-// seems we need to use this VID/PID to get it to work on windows
-
-#define USBD_VID 0x0483
-#define USBD_PID 0x5740
-
-#define USBD_LANGID_STRING 0x409
-#define USBD_MANUFACTURER_STRING "STMicroelectronics"
-#define USBD_PRODUCT_HS_STRING "STM32 Virtual ComPort in HS mode"
-#define USBD_SERIALNUMBER_HS_STRING "00000000050B"
-#define USBD_PRODUCT_FS_STRING "STM32 Virtual ComPort in FS Mode"
-#define USBD_SERIALNUMBER_FS_STRING "00000000050C"
-#define USBD_CONFIGURATION_HS_STRING "VCP Config"
-#define USBD_INTERFACE_HS_STRING "VCP Interface"
-#define USBD_CONFIGURATION_FS_STRING "VCP Config"
-#define USBD_INTERFACE_FS_STRING "VCP Interface"
-
-
-/** @defgroup USBD_DESC_Private_Macros
- * @{
- */
-/**
- * @}
- */
-
-
-/** @defgroup USBD_DESC_Private_Variables
- * @{
- */
-
-USBD_DEVICE USR_desc =
-{
- USBD_USR_DeviceDescriptor,
- USBD_USR_LangIDStrDescriptor,
- USBD_USR_ManufacturerStrDescriptor,
- USBD_USR_ProductStrDescriptor,
- USBD_USR_SerialStrDescriptor,
- USBD_USR_ConfigStrDescriptor,
- USBD_USR_InterfaceStrDescriptor,
-
-};
-
-#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
- #if defined ( __ICCARM__ ) /*!< IAR Compiler */
- #pragma data_alignment=4
- #endif
-#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
-/* USB Standard Device Descriptor */
-__ALIGN_BEGIN static uint8_t USBD_DeviceDesc[USB_SIZ_DEVICE_DESC] __ALIGN_END =
-{
- 0x12, // bLength
- USB_DEVICE_DESCRIPTOR_TYPE, // bDescriptorType
- 0x00, // bcdUSB: v2.0
- 0x02,
- 0xef, // bDeviceClass: Miscellaneous Device Class
- 0x02, // bDeviceSubClass: Common Class
- 0x01, // bDeviceProtocol: Interface Association Descriptor
- USB_OTG_MAX_EP0_SIZE, // bMaxPacketSize
- LOBYTE(USBD_VID), // idVendor
- HIBYTE(USBD_VID), // idVendor
- LOBYTE(USBD_PID), // idVendor
- HIBYTE(USBD_PID), // idVendor
- 0x00, // bcdDevice: rel. 2.00
- 0x02,
- USBD_IDX_MFC_STR, /*Index of manufacturer string*/
- USBD_IDX_PRODUCT_STR, /*Index of product string*/
- USBD_IDX_SERIAL_STR, /*Index of serial number string*/
- USBD_CFG_MAX_NUM // bNumConfigurations: 1
- } ; /* USB_DeviceDescriptor */
-
-#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
- #if defined ( __ICCARM__ ) /*!< IAR Compiler */
- #pragma data_alignment=4
- #endif
-#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
-/* USB Standard Device Descriptor */
-__ALIGN_BEGIN uint8_t USBD_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC] __ALIGN_END =
-{
- USB_LEN_DEV_QUALIFIER_DESC,
- USB_DESC_TYPE_DEVICE_QUALIFIER,
- 0x00,
- 0x02,
- 0x00,
- 0x00,
- 0x00,
- 0x40,
- 0x01,
- 0x00,
-};
-
-#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
- #if defined ( __ICCARM__ ) /*!< IAR Compiler */
- #pragma data_alignment=4
- #endif
-#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
-/* USB Standard Device Descriptor */
-__ALIGN_BEGIN uint8_t USBD_LangIDDesc[USB_SIZ_STRING_LANGID] __ALIGN_END =
-{
- USB_SIZ_STRING_LANGID,
- USB_DESC_TYPE_STRING,
- LOBYTE(USBD_LANGID_STRING),
- HIBYTE(USBD_LANGID_STRING),
-};
-/**
- * @}
- */
-
-
-/** @defgroup USBD_DESC_Private_FunctionPrototypes
- * @{
- */
-/**
- * @}
- */
-
-
-/** @defgroup USBD_DESC_Private_Functions
- * @{
- */
-
-/**
-* @brief USBD_USR_DeviceDescriptor
-* return the device descriptor
-* @param speed : current device speed
-* @param length : pointer to data length variable
-* @retval pointer to descriptor buffer
-*/
-uint8_t * USBD_USR_DeviceDescriptor( uint8_t speed , uint16_t *length)
-{
- *length = sizeof(USBD_DeviceDesc);
- return USBD_DeviceDesc;
-}
-
-/**
-* @brief USBD_USR_LangIDStrDescriptor
-* return the LangID string descriptor
-* @param speed : current device speed
-* @param length : pointer to data length variable
-* @retval pointer to descriptor buffer
-*/
-uint8_t * USBD_USR_LangIDStrDescriptor( uint8_t speed , uint16_t *length)
-{
- *length = sizeof(USBD_LangIDDesc);
- return USBD_LangIDDesc;
-}
-
-
-/**
-* @brief USBD_USR_ProductStrDescriptor
-* return the product string descriptor
-* @param speed : current device speed
-* @param length : pointer to data length variable
-* @retval pointer to descriptor buffer
-*/
-uint8_t * USBD_USR_ProductStrDescriptor( uint8_t speed , uint16_t *length)
-{
-
-
- if(speed == 0)
- {
- USBD_GetString (USBD_PRODUCT_HS_STRING, USBD_StrDesc, length);
- }
- else
- {
- USBD_GetString (USBD_PRODUCT_FS_STRING, USBD_StrDesc, length);
- }
- return USBD_StrDesc;
-}
-
-/**
-* @brief USBD_USR_ManufacturerStrDescriptor
-* return the manufacturer string descriptor
-* @param speed : current device speed
-* @param length : pointer to data length variable
-* @retval pointer to descriptor buffer
-*/
-uint8_t * USBD_USR_ManufacturerStrDescriptor( uint8_t speed , uint16_t *length)
-{
- USBD_GetString (USBD_MANUFACTURER_STRING, USBD_StrDesc, length);
- return USBD_StrDesc;
-}
-
-/**
-* @brief USBD_USR_SerialStrDescriptor
-* return the serial number string descriptor
-* @param speed : current device speed
-* @param length : pointer to data length variable
-* @retval pointer to descriptor buffer
-*/
-uint8_t * USBD_USR_SerialStrDescriptor( uint8_t speed , uint16_t *length)
-{
- if(speed == USB_OTG_SPEED_HIGH)
- {
- USBD_GetString (USBD_SERIALNUMBER_HS_STRING, USBD_StrDesc, length);
- }
- else
- {
- USBD_GetString (USBD_SERIALNUMBER_FS_STRING, USBD_StrDesc, length);
- }
- return USBD_StrDesc;
-}
-
-/**
-* @brief USBD_USR_ConfigStrDescriptor
-* return the configuration string descriptor
-* @param speed : current device speed
-* @param length : pointer to data length variable
-* @retval pointer to descriptor buffer
-*/
-uint8_t * USBD_USR_ConfigStrDescriptor( uint8_t speed , uint16_t *length)
-{
- if(speed == USB_OTG_SPEED_HIGH)
- {
- USBD_GetString (USBD_CONFIGURATION_HS_STRING, USBD_StrDesc, length);
- }
- else
- {
- USBD_GetString (USBD_CONFIGURATION_FS_STRING, USBD_StrDesc, length);
- }
- return USBD_StrDesc;
-}
-
-
-/**
-* @brief USBD_USR_InterfaceStrDescriptor
-* return the interface string descriptor
-* @param speed : current device speed
-* @param length : pointer to data length variable
-* @retval pointer to descriptor buffer
-*/
-uint8_t * USBD_USR_InterfaceStrDescriptor( uint8_t speed , uint16_t *length)
-{
- if(speed == 0)
- {
- USBD_GetString (USBD_INTERFACE_HS_STRING, USBD_StrDesc, length);
- }
- else
- {
- USBD_GetString (USBD_INTERFACE_FS_STRING, USBD_StrDesc, length);
- }
- return USBD_StrDesc;
-}
-
-/**
- * @}
- */
-
-
-/**
- * @}
- */
-
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
diff --git a/stm/stmusbd/usbd_desc.h b/stm/stmusbd/usbd_desc.h
deleted file mode 100644
index c6da3158b..000000000
--- a/stm/stmusbd/usbd_desc.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_desc.h
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief header file for the usbd_desc.c file
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-
-#ifndef __USB_DESC_H
-#define __USB_DESC_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "usbd_def.h"
-
-/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
- * @{
- */
-
-/** @defgroup USB_DESC
- * @brief general defines for the usb device library file
- * @{
- */
-
-/** @defgroup USB_DESC_Exported_Defines
- * @{
- */
-#define USB_DEVICE_DESCRIPTOR_TYPE 0x01
-#define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02
-#define USB_STRING_DESCRIPTOR_TYPE 0x03
-#define USB_INTERFACE_DESCRIPTOR_TYPE 0x04
-#define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05
-#define USB_INTERFACE_ASSOCIATION_TYPE 0x0b
-#define USB_SIZ_DEVICE_DESC 18
-#define USB_SIZ_STRING_LANGID 4
-
-/**
- * @}
- */
-
-
-/** @defgroup USBD_DESC_Exported_TypesDefinitions
- * @{
- */
-/**
- * @}
- */
-
-
-
-/** @defgroup USBD_DESC_Exported_Macros
- * @{
- */
-/**
- * @}
- */
-
-/** @defgroup USBD_DESC_Exported_Variables
- * @{
- */
-//extern uint8_t USBD_DeviceDesc [USB_SIZ_DEVICE_DESC];
-extern uint8_t USBD_StrDesc[USB_MAX_STR_DESC_SIZ];
-extern uint8_t USBD_OtherSpeedCfgDesc[USB_LEN_CFG_DESC];
-extern uint8_t USBD_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC];
-extern uint8_t USBD_LangIDDesc[USB_SIZ_STRING_LANGID];
-extern USBD_DEVICE USR_desc;
-/**
- * @}
- */
-
-/** @defgroup USBD_DESC_Exported_FunctionsPrototype
- * @{
- */
-
-
-uint8_t * USBD_USR_DeviceDescriptor( uint8_t speed , uint16_t *length);
-uint8_t * USBD_USR_LangIDStrDescriptor( uint8_t speed , uint16_t *length);
-uint8_t * USBD_USR_ManufacturerStrDescriptor ( uint8_t speed , uint16_t *length);
-uint8_t * USBD_USR_ProductStrDescriptor ( uint8_t speed , uint16_t *length);
-uint8_t * USBD_USR_SerialStrDescriptor( uint8_t speed , uint16_t *length);
-uint8_t * USBD_USR_ConfigStrDescriptor( uint8_t speed , uint16_t *length);
-uint8_t * USBD_USR_InterfaceStrDescriptor( uint8_t speed , uint16_t *length);
-
-#ifdef USB_SUPPORT_USER_STRING_DESC
-uint8_t * USBD_USR_USRStringDesc (uint8_t speed, uint8_t idx , uint16_t *length);
-#endif /* USB_SUPPORT_USER_STRING_DESC */
-
-/**
- * @}
- */
-
-#endif /* __USBD_DESC_H */
-
-/**
- * @}
- */
-
-/**
-* @}
-*/
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/stm/stmusbd/usbd_ioreq.c b/stm/stmusbd/usbd_ioreq.c
deleted file mode 100644
index a9e4a8636..000000000
--- a/stm/stmusbd/usbd_ioreq.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_ioreq.c
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief This file provides the IO requests APIs for control endpoints.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "usbd_ioreq.h"
-
-/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
- * @{
- */
-
-
-/** @defgroup USBD_IOREQ
- * @brief control I/O requests module
- * @{
- */
-
-/** @defgroup USBD_IOREQ_Private_TypesDefinitions
- * @{
- */
-/**
- * @}
- */
-
-
-/** @defgroup USBD_IOREQ_Private_Defines
- * @{
- */
-
-/**
- * @}
- */
-
-
-/** @defgroup USBD_IOREQ_Private_Macros
- * @{
- */
-/**
- * @}
- */
-
-
-/** @defgroup USBD_IOREQ_Private_Variables
- * @{
- */
-
-/**
- * @}
- */
-
-
-/** @defgroup USBD_IOREQ_Private_FunctionPrototypes
- * @{
- */
-/**
- * @}
- */
-
-
-/** @defgroup USBD_IOREQ_Private_Functions
- * @{
- */
-
-/**
-* @brief USBD_CtlSendData
-* send data on the ctl pipe
-* @param pdev: device instance
-* @param buff: pointer to data buffer
-* @param len: length of data to be sent
-* @retval status
-*/
-USBD_Status USBD_CtlSendData (USB_OTG_CORE_HANDLE *pdev,
- uint8_t *pbuf,
- uint16_t len)
-{
- USBD_Status ret = USBD_OK;
-
- pdev->dev.in_ep[0].total_data_len = len;
- pdev->dev.in_ep[0].rem_data_len = len;
- pdev->dev.device_state = USB_OTG_EP0_DATA_IN;
-
- DCD_EP_Tx (pdev, 0, pbuf, len);
-
- return ret;
-}
-
-/**
-* @brief USBD_CtlContinueSendData
-* continue sending data on the ctl pipe
-* @param pdev: device instance
-* @param buff: pointer to data buffer
-* @param len: length of data to be sent
-* @retval status
-*/
-USBD_Status USBD_CtlContinueSendData (USB_OTG_CORE_HANDLE *pdev,
- uint8_t *pbuf,
- uint16_t len)
-{
- USBD_Status ret = USBD_OK;
-
- DCD_EP_Tx (pdev, 0, pbuf, len);
-
-
- return ret;
-}
-
-/**
-* @brief USBD_CtlPrepareRx
-* receive data on the ctl pipe
-* @param pdev: USB OTG device instance
-* @param buff: pointer to data buffer
-* @param len: length of data to be received
-* @retval status
-*/
-USBD_Status USBD_CtlPrepareRx (USB_OTG_CORE_HANDLE *pdev,
- uint8_t *pbuf,
- uint16_t len)
-{
- USBD_Status ret = USBD_OK;
-
- pdev->dev.out_ep[0].total_data_len = len;
- pdev->dev.out_ep[0].rem_data_len = len;
- pdev->dev.device_state = USB_OTG_EP0_DATA_OUT;
-
- DCD_EP_PrepareRx (pdev,
- 0,
- pbuf,
- len);
-
-
- return ret;
-}
-
-/**
-* @brief USBD_CtlContinueRx
-* continue receive data on the ctl pipe
-* @param pdev: USB OTG device instance
-* @param buff: pointer to data buffer
-* @param len: length of data to be received
-* @retval status
-*/
-USBD_Status USBD_CtlContinueRx (USB_OTG_CORE_HANDLE *pdev,
- uint8_t *pbuf,
- uint16_t len)
-{
- USBD_Status ret = USBD_OK;
-
- DCD_EP_PrepareRx (pdev,
- 0,
- pbuf,
- len);
- return ret;
-}
-/**
-* @brief USBD_CtlSendStatus
-* send zero lzngth packet on the ctl pipe
-* @param pdev: USB OTG device instance
-* @retval status
-*/
-USBD_Status USBD_CtlSendStatus (USB_OTG_CORE_HANDLE *pdev)
-{
- USBD_Status ret = USBD_OK;
- pdev->dev.device_state = USB_OTG_EP0_STATUS_IN;
- DCD_EP_Tx (pdev,
- 0,
- NULL,
- 0);
-
- USB_OTG_EP0_OutStart(pdev);
-
- return ret;
-}
-
-/**
-* @brief USBD_CtlReceiveStatus
-* receive zero lzngth packet on the ctl pipe
-* @param pdev: USB OTG device instance
-* @retval status
-*/
-USBD_Status USBD_CtlReceiveStatus (USB_OTG_CORE_HANDLE *pdev)
-{
- USBD_Status ret = USBD_OK;
- pdev->dev.device_state = USB_OTG_EP0_STATUS_OUT;
- DCD_EP_PrepareRx ( pdev,
- 0,
- NULL,
- 0);
-
- USB_OTG_EP0_OutStart(pdev);
-
- return ret;
-}
-
-
-/**
-* @brief USBD_GetRxCount
-* returns the received data length
-* @param pdev: USB OTG device instance
-* epnum: endpoint index
-* @retval Rx Data blength
-*/
-uint16_t USBD_GetRxCount (USB_OTG_CORE_HANDLE *pdev , uint8_t epnum)
-{
- return pdev->dev.out_ep[epnum].xfer_count;
-}
-
-/**
- * @}
- */
-
-
-/**
- * @}
- */
-
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/stm/stmusbd/usbd_ioreq.h b/stm/stmusbd/usbd_ioreq.h
deleted file mode 100644
index 3f6aea1a9..000000000
--- a/stm/stmusbd/usbd_ioreq.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_ioreq.h
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief header file for the usbd_ioreq.c file
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-
-#ifndef __USBD_IOREQ_H_
-#define __USBD_IOREQ_H_
-
-/* Includes ------------------------------------------------------------------*/
-#include "usbd_def.h"
-#include "usbd_core.h"
-
-/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
- * @{
- */
-
-/** @defgroup USBD_IOREQ
- * @brief header file for the usbd_ioreq.c file
- * @{
- */
-
-/** @defgroup USBD_IOREQ_Exported_Defines
- * @{
- */
-/**
- * @}
- */
-
-
-/** @defgroup USBD_IOREQ_Exported_Types
- * @{
- */
-
-
-/**
- * @}
- */
-
-
-
-/** @defgroup USBD_IOREQ_Exported_Macros
- * @{
- */
-
-/**
- * @}
- */
-
-/** @defgroup USBD_IOREQ_Exported_Variables
- * @{
- */
-
-/**
- * @}
- */
-
-/** @defgroup USBD_IOREQ_Exported_FunctionsPrototype
- * @{
- */
-
-USBD_Status USBD_CtlSendData (USB_OTG_CORE_HANDLE *pdev,
- uint8_t *buf,
- uint16_t len);
-
-USBD_Status USBD_CtlContinueSendData (USB_OTG_CORE_HANDLE *pdev,
- uint8_t *pbuf,
- uint16_t len);
-
-USBD_Status USBD_CtlPrepareRx (USB_OTG_CORE_HANDLE *pdev,
- uint8_t *pbuf,
- uint16_t len);
-
-USBD_Status USBD_CtlContinueRx (USB_OTG_CORE_HANDLE *pdev,
- uint8_t *pbuf,
- uint16_t len);
-
-USBD_Status USBD_CtlSendStatus (USB_OTG_CORE_HANDLE *pdev);
-
-USBD_Status USBD_CtlReceiveStatus (USB_OTG_CORE_HANDLE *pdev);
-
-uint16_t USBD_GetRxCount (USB_OTG_CORE_HANDLE *pdev ,
- uint8_t epnum);
-
-/**
- * @}
- */
-
-#endif /* __USBD_IOREQ_H_ */
-
-/**
- * @}
- */
-
-/**
-* @}
-*/
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/stm/stmusbd/usbd_msc_bot.c b/stm/stmusbd/usbd_msc_bot.c
deleted file mode 100644
index 20dbc4863..000000000
--- a/stm/stmusbd/usbd_msc_bot.c
+++ /dev/null
@@ -1,401 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_msc_bot.c
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief This file provides all the BOT protocol core functions.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "usbd_msc_bot.h"
-#include "usbd_msc_scsi.h"
-#include "usbd_ioreq.h"
-#include "usbd_msc_mem.h"
-#include "usbd_conf.h"
-
-/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
- * @{
- */
-
-
-/** @defgroup MSC_BOT
- * @brief BOT protocol module
- * @{
- */
-
-/** @defgroup MSC_BOT_Private_TypesDefinitions
- * @{
- */
-/**
- * @}
- */
-
-
-/** @defgroup MSC_BOT_Private_Defines
- * @{
- */
-
-/**
- * @}
- */
-
-
-/** @defgroup MSC_BOT_Private_Macros
- * @{
- */
-/**
- * @}
- */
-
-
-/** @defgroup MSC_BOT_Private_Variables
- * @{
- */
-uint16_t MSC_BOT_DataLen;
-uint8_t MSC_BOT_State;
-uint8_t MSC_BOT_Status;
-
-#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
- #if defined ( __ICCARM__ ) /*!< IAR Compiler */
- #pragma data_alignment=4
- #endif
-#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
-__ALIGN_BEGIN uint8_t MSC_BOT_Data[MSC_MEDIA_PACKET] __ALIGN_END ;
-
-#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
- #if defined ( __ICCARM__ ) /*!< IAR Compiler */
- #pragma data_alignment=4
- #endif
-#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
-__ALIGN_BEGIN MSC_BOT_CBW_TypeDef MSC_BOT_cbw __ALIGN_END ;
-
-#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
- #if defined ( __ICCARM__ ) /*!< IAR Compiler */
- #pragma data_alignment=4
- #endif
-#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
-__ALIGN_BEGIN MSC_BOT_CSW_TypeDef MSC_BOT_csw __ALIGN_END ;
-/**
- * @}
- */
-
-
-/** @defgroup MSC_BOT_Private_FunctionPrototypes
- * @{
- */
-static void MSC_BOT_CBW_Decode (USB_OTG_CORE_HANDLE *pdev);
-
-static void MSC_BOT_SendData (USB_OTG_CORE_HANDLE *pdev,
- uint8_t* pbuf,
- uint16_t len);
-
-static void MSC_BOT_Abort(USB_OTG_CORE_HANDLE *pdev);
-/**
- * @}
- */
-
-
-/** @defgroup MSC_BOT_Private_Functions
- * @{
- */
-
-
-
-/**
-* @brief MSC_BOT_Init
-* Initialize the BOT Process
-* @param pdev: device instance
-* @retval None
-*/
-void MSC_BOT_Init (USB_OTG_CORE_HANDLE *pdev)
-{
- MSC_BOT_State = BOT_IDLE;
- MSC_BOT_Status = BOT_STATE_NORMAL;
- USBD_STORAGE_fops->Init(0);
-
- DCD_EP_Flush(pdev, MSC_OUT_EP);
- DCD_EP_Flush(pdev, MSC_IN_EP);
- /* Prapare EP to Receive First BOT Cmd */
- DCD_EP_PrepareRx (pdev,
- MSC_OUT_EP,
- (uint8_t *)&MSC_BOT_cbw,
- BOT_CBW_LENGTH);
-}
-
-/**
-* @brief MSC_BOT_Reset
-* Reset the BOT Machine
-* @param pdev: device instance
-* @retval None
-*/
-void MSC_BOT_Reset (USB_OTG_CORE_HANDLE *pdev)
-{
- MSC_BOT_State = BOT_IDLE;
- MSC_BOT_Status = BOT_STATE_RECOVERY;
- /* Prapare EP to Receive First BOT Cmd */
- DCD_EP_PrepareRx (pdev,
- MSC_OUT_EP,
- (uint8_t *)&MSC_BOT_cbw,
- BOT_CBW_LENGTH);
-}
-
-/**
-* @brief MSC_BOT_DeInit
-* Uninitialize the BOT Machine
-* @param pdev: device instance
-* @retval None
-*/
-void MSC_BOT_DeInit (USB_OTG_CORE_HANDLE *pdev)
-{
- MSC_BOT_State = BOT_IDLE;
-}
-
-/**
-* @brief MSC_BOT_DataIn
-* Handle BOT IN data stage
-* @param pdev: device instance
-* @param epnum: endpoint index
-* @retval None
-*/
-void MSC_BOT_DataIn (USB_OTG_CORE_HANDLE *pdev,
- uint8_t epnum)
-{
-
- switch (MSC_BOT_State)
- {
- case BOT_DATA_IN:
- if(SCSI_ProcessCmd(pdev,
- MSC_BOT_cbw.bLUN,
- &MSC_BOT_cbw.CB[0]) < 0)
- {
- MSC_BOT_SendCSW (pdev, CSW_CMD_FAILED);
- }
- break;
-
- case BOT_SEND_DATA:
- case BOT_LAST_DATA_IN:
- MSC_BOT_SendCSW (pdev, CSW_CMD_PASSED);
-
- break;
-
- default:
- break;
- }
-}
-/**
-* @brief MSC_BOT_DataOut
-* Proccess MSC OUT data
-* @param pdev: device instance
-* @param epnum: endpoint index
-* @retval None
-*/
-void MSC_BOT_DataOut (USB_OTG_CORE_HANDLE *pdev,
- uint8_t epnum)
-{
- switch (MSC_BOT_State)
- {
- case BOT_IDLE:
- MSC_BOT_CBW_Decode(pdev);
- break;
-
- case BOT_DATA_OUT:
-
- if(SCSI_ProcessCmd(pdev,
- MSC_BOT_cbw.bLUN,
- &MSC_BOT_cbw.CB[0]) < 0)
- {
- MSC_BOT_SendCSW (pdev, CSW_CMD_FAILED);
- }
-
- break;
-
- default:
- break;
- }
-
-}
-
-/**
-* @brief MSC_BOT_CBW_Decode
-* Decode the CBW command and set the BOT state machine accordingtly
-* @param pdev: device instance
-* @retval None
-*/
-static void MSC_BOT_CBW_Decode (USB_OTG_CORE_HANDLE *pdev)
-{
-
- MSC_BOT_csw.dTag = MSC_BOT_cbw.dTag;
- MSC_BOT_csw.dDataResidue = MSC_BOT_cbw.dDataLength;
-
- if ((USBD_GetRxCount (pdev ,MSC_OUT_EP) != BOT_CBW_LENGTH) ||
- (MSC_BOT_cbw.dSignature != BOT_CBW_SIGNATURE)||
- (MSC_BOT_cbw.bLUN > 1) ||
- (MSC_BOT_cbw.bCBLength < 1) ||
- (MSC_BOT_cbw.bCBLength > 16))
- {
-
- SCSI_SenseCode(MSC_BOT_cbw.bLUN,
- ILLEGAL_REQUEST,
- INVALID_CDB);
- MSC_BOT_Status = BOT_STATE_ERROR;
- MSC_BOT_Abort(pdev);
-
- }
- else
- {
- if(SCSI_ProcessCmd(pdev,
- MSC_BOT_cbw.bLUN,
- &MSC_BOT_cbw.CB[0]) < 0)
- {
- MSC_BOT_Abort(pdev);
- }
- /*Burst xfer handled internally*/
- else if ((MSC_BOT_State != BOT_DATA_IN) &&
- (MSC_BOT_State != BOT_DATA_OUT) &&
- (MSC_BOT_State != BOT_LAST_DATA_IN))
- {
- if (MSC_BOT_DataLen > 0)
- {
- MSC_BOT_SendData(pdev,
- MSC_BOT_Data,
- MSC_BOT_DataLen);
- }
- else if (MSC_BOT_DataLen == 0)
- {
- MSC_BOT_SendCSW (pdev,
- CSW_CMD_PASSED);
- }
- }
- }
-}
-
-/**
-* @brief MSC_BOT_SendData
-* Send the requested data
-* @param pdev: device instance
-* @param buf: pointer to data buffer
-* @param len: Data Length
-* @retval None
-*/
-static void MSC_BOT_SendData(USB_OTG_CORE_HANDLE *pdev,
- uint8_t* buf,
- uint16_t len)
-{
-
- len = MIN (MSC_BOT_cbw.dDataLength, len);
- MSC_BOT_csw.dDataResidue -= len;
- MSC_BOT_csw.bStatus = CSW_CMD_PASSED;
- MSC_BOT_State = BOT_SEND_DATA;
-
- DCD_EP_Tx (pdev, MSC_IN_EP, buf, len);
-}
-
-/**
-* @brief MSC_BOT_SendCSW
-* Send the Command Status Wrapper
-* @param pdev: device instance
-* @param status : CSW status
-* @retval None
-*/
-void MSC_BOT_SendCSW (USB_OTG_CORE_HANDLE *pdev,
- uint8_t CSW_Status)
-{
- MSC_BOT_csw.dSignature = BOT_CSW_SIGNATURE;
- MSC_BOT_csw.bStatus = CSW_Status;
- MSC_BOT_State = BOT_IDLE;
-
- DCD_EP_Tx (pdev,
- MSC_IN_EP,
- (uint8_t *)&MSC_BOT_csw,
- BOT_CSW_LENGTH);
-
- /* Prapare EP to Receive next Cmd */
- DCD_EP_PrepareRx (pdev,
- MSC_OUT_EP,
- (uint8_t *)&MSC_BOT_cbw,
- BOT_CBW_LENGTH);
-
-}
-
-/**
-* @brief MSC_BOT_Abort
-* Abort the current transfer
-* @param pdev: device instance
-* @retval status
-*/
-
-static void MSC_BOT_Abort (USB_OTG_CORE_HANDLE *pdev)
-{
-
- if ((MSC_BOT_cbw.bmFlags == 0) &&
- (MSC_BOT_cbw.dDataLength != 0) &&
- (MSC_BOT_Status == BOT_STATE_NORMAL) )
- {
- DCD_EP_Stall(pdev, MSC_OUT_EP );
- }
- DCD_EP_Stall(pdev, MSC_IN_EP);
-
- if(MSC_BOT_Status == BOT_STATE_ERROR)
- {
- DCD_EP_PrepareRx (pdev,
- MSC_OUT_EP,
- (uint8_t *)&MSC_BOT_cbw,
- BOT_CBW_LENGTH);
- }
-}
-
-/**
-* @brief MSC_BOT_CplClrFeature
-* Complete the clear feature request
-* @param pdev: device instance
-* @param epnum: endpoint index
-* @retval None
-*/
-
-void MSC_BOT_CplClrFeature (USB_OTG_CORE_HANDLE *pdev, uint8_t epnum)
-{
- if(MSC_BOT_Status == BOT_STATE_ERROR )/* Bad CBW Signature */
- {
- DCD_EP_Stall(pdev, MSC_IN_EP);
- MSC_BOT_Status = BOT_STATE_NORMAL;
- }
- else if(((epnum & 0x80) == 0x80) && ( MSC_BOT_Status != BOT_STATE_RECOVERY))
- {
- MSC_BOT_SendCSW (pdev, CSW_CMD_FAILED);
- }
-
-}
-/**
- * @}
- */
-
-
-/**
- * @}
- */
-
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/stm/stmusbd/usbd_msc_bot.h b/stm/stmusbd/usbd_msc_bot.h
deleted file mode 100644
index 53c95fbe4..000000000
--- a/stm/stmusbd/usbd_msc_bot.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_msc_bot.h
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief header for the usbd_msc_bot.c file
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-
-#include "usbd_core.h"
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __USBD_MSC_BOT_H
-#define __USBD_MSC_BOT_H
-
-/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
- * @{
- */
-
-/** @defgroup MSC_BOT
- * @brief This file is the Header file for usbd_bot.c
- * @{
- */
-
-
-/** @defgroup USBD_CORE_Exported_Defines
- * @{
- */
-#define BOT_IDLE 0 /* Idle state */
-#define BOT_DATA_OUT 1 /* Data Out state */
-#define BOT_DATA_IN 2 /* Data In state */
-#define BOT_LAST_DATA_IN 3 /* Last Data In Last */
-#define BOT_SEND_DATA 4 /* Send Immediate data */
-
-#define BOT_CBW_SIGNATURE 0x43425355
-#define BOT_CSW_SIGNATURE 0x53425355
-#define BOT_CBW_LENGTH 31
-#define BOT_CSW_LENGTH 13
-
-/* CSW Status Definitions */
-#define CSW_CMD_PASSED 0x00
-#define CSW_CMD_FAILED 0x01
-#define CSW_PHASE_ERROR 0x02
-
-/* BOT Status */
-#define BOT_STATE_NORMAL 0
-#define BOT_STATE_RECOVERY 1
-#define BOT_STATE_ERROR 2
-
-
-#define DIR_IN 0
-#define DIR_OUT 1
-#define BOTH_DIR 2
-
-/**
- * @}
- */
-
-/** @defgroup MSC_CORE_Private_TypesDefinitions
- * @{
- */
-
-typedef struct _MSC_BOT_CBW
-{
- uint32_t dSignature;
- uint32_t dTag;
- uint32_t dDataLength;
- uint8_t bmFlags;
- uint8_t bLUN;
- uint8_t bCBLength;
- uint8_t CB[16];
-}
-MSC_BOT_CBW_TypeDef;
-
-
-typedef struct _MSC_BOT_CSW
-{
- uint32_t dSignature;
- uint32_t dTag;
- uint32_t dDataResidue;
- uint8_t bStatus;
-}
-MSC_BOT_CSW_TypeDef;
-
-/**
- * @}
- */
-
-
-/** @defgroup USBD_CORE_Exported_Types
- * @{
- */
-
-extern uint8_t MSC_BOT_Data[];
-extern uint16_t MSC_BOT_DataLen;
-extern uint8_t MSC_BOT_State;
-extern uint8_t MSC_BOT_BurstMode;
-extern MSC_BOT_CBW_TypeDef MSC_BOT_cbw;
-extern MSC_BOT_CSW_TypeDef MSC_BOT_csw;
-/**
- * @}
- */
-/** @defgroup USBD_CORE_Exported_FunctionsPrototypes
- * @{
- */
-void MSC_BOT_Init (USB_OTG_CORE_HANDLE *pdev);
-void MSC_BOT_Reset (USB_OTG_CORE_HANDLE *pdev);
-void MSC_BOT_DeInit (USB_OTG_CORE_HANDLE *pdev);
-void MSC_BOT_DataIn (USB_OTG_CORE_HANDLE *pdev,
- uint8_t epnum);
-
-void MSC_BOT_DataOut (USB_OTG_CORE_HANDLE *pdev,
- uint8_t epnum);
-
-void MSC_BOT_SendCSW (USB_OTG_CORE_HANDLE *pdev,
- uint8_t CSW_Status);
-
-void MSC_BOT_CplClrFeature (USB_OTG_CORE_HANDLE *pdev,
- uint8_t epnum);
-/**
- * @}
- */
-
-#endif /* __USBD_MSC_BOT_H */
-/**
- * @}
- */
-
-/**
-* @}
-*/
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
diff --git a/stm/stmusbd/usbd_msc_data.c b/stm/stmusbd/usbd_msc_data.c
deleted file mode 100644
index 1dc7d22e7..000000000
--- a/stm/stmusbd/usbd_msc_data.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_msc_data.c
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief This file provides all the vital inquiry pages and sense data.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "usbd_msc_data.h"
-
-
-/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
- * @{
- */
-
-
-/** @defgroup MSC_DATA
- * @brief Mass storage info/data module
- * @{
- */
-
-/** @defgroup MSC_DATA_Private_TypesDefinitions
- * @{
- */
-/**
- * @}
- */
-
-
-/** @defgroup MSC_DATA_Private_Defines
- * @{
- */
-/**
- * @}
- */
-
-
-/** @defgroup MSC_DATA_Private_Macros
- * @{
- */
-/**
- * @}
- */
-
-
-/** @defgroup MSC_DATA_Private_Variables
- * @{
- */
-
-
-/* USB Mass storage Page 0 Inquiry Data */
-const uint8_t MSC_Page00_Inquiry_Data[] = {//7
- 0x00,
- 0x00,
- 0x00,
- (LENGTH_INQUIRY_PAGE00 - 4),
- 0x00,
- 0x80,
- 0x83
-};
-/* USB Mass storage sense 6 Data */
-const uint8_t MSC_Mode_Sense6_data[] = {
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00
-};
-/* USB Mass storage sense 10 Data */
-const uint8_t MSC_Mode_Sense10_data[] = {
- 0x00,
- 0x06,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00
-};
-/**
- * @}
- */
-
-
-/** @defgroup MSC_DATA_Private_FunctionPrototypes
- * @{
- */
-/**
- * @}
- */
-
-
-/** @defgroup MSC_DATA_Private_Functions
- * @{
- */
-
-/**
- * @}
- */
-
-
-/**
- * @}
- */
-
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/stm/stmusbd/usbd_msc_data.h b/stm/stmusbd/usbd_msc_data.h
deleted file mode 100644
index 7c0d13679..000000000
--- a/stm/stmusbd/usbd_msc_data.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_msc_data.h
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief header for the usbd_msc_data.c file
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-
-#ifndef _USBD_MSC_DATA_H_
-#define _USBD_MSC_DATA_H_
-
-/* Includes ------------------------------------------------------------------*/
-#include "usb_conf.h"
-//#include "usbd_conf.h"
-
-/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
- * @{
- */
-
-/** @defgroup USB_INFO
- * @brief general defines for the usb device library file
- * @{
- */
-
-/** @defgroup USB_INFO_Exported_Defines
- * @{
- */
-#define MODE_SENSE6_LEN 8
-#define MODE_SENSE10_LEN 8
-#define LENGTH_INQUIRY_PAGE00 7
-#define LENGTH_FORMAT_CAPACITIES 20
-
-/**
- * @}
- */
-
-
-/** @defgroup USBD_INFO_Exported_TypesDefinitions
- * @{
- */
-/**
- * @}
- */
-
-
-
-/** @defgroup USBD_INFO_Exported_Macros
- * @{
- */
-
-/**
- * @}
- */
-
-/** @defgroup USBD_INFO_Exported_Variables
- * @{
- */
-extern const uint8_t MSC_Page00_Inquiry_Data[];
-extern const uint8_t MSC_Mode_Sense6_data[];
-extern const uint8_t MSC_Mode_Sense10_data[] ;
-
-/**
- * @}
- */
-
-/** @defgroup USBD_INFO_Exported_FunctionsPrototype
- * @{
- */
-
-/**
- * @}
- */
-
-#endif /* _USBD_MSC_DATA_H_ */
-
-/**
- * @}
- */
-
-/**
-* @}
-*/
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/stm/stmusbd/usbd_msc_mem.h b/stm/stmusbd/usbd_msc_mem.h
deleted file mode 100644
index 888c79674..000000000
--- a/stm/stmusbd/usbd_msc_mem.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_msc_mem.h
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief header for the STORAGE DISK file file
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-
-#ifndef __USBD_MEM_H
-#define __USBD_MEM_H
-/* Includes ------------------------------------------------------------------*/
-#include "usb_conf.h"
-#include "usbd_def.h"
-
-
-/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
- * @{
- */
-
-/** @defgroup USBD_MEM
- * @brief header file for the storage disk file
- * @{
- */
-
-/** @defgroup USBD_MEM_Exported_Defines
- * @{
- */
-#define USBD_STD_INQUIRY_LENGTH 36
-/**
- * @}
- */
-
-
-/** @defgroup USBD_MEM_Exported_TypesDefinitions
- * @{
- */
-
-typedef struct _USBD_STORAGE
-{
- int8_t (* Init) (uint8_t lun);
- int8_t (* GetCapacity) (uint8_t lun, uint32_t *block_num, uint32_t *block_size);
- int8_t (* IsReady) (uint8_t lun);
- int8_t (* IsWriteProtected) (uint8_t lun);
- int8_t (* Read) (uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len);
- int8_t (* Write)(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len);
- int8_t (* GetMaxLun)(void);
- int8_t *pInquiry;
-
-}USBD_STORAGE_cb_TypeDef;
-/**
- * @}
- */
-
-
-
-/** @defgroup USBD_MEM_Exported_Macros
- * @{
- */
-
-/**
- * @}
- */
-
-/** @defgroup USBD_MEM_Exported_Variables
- * @{
- */
-
-/**
- * @}
- */
-
-/** @defgroup USBD_MEM_Exported_FunctionsPrototype
- * @{
- */
-extern USBD_STORAGE_cb_TypeDef *USBD_STORAGE_fops;
-/**
- * @}
- */
-
-#endif /* __USBD_MEM_H */
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
-* @}
-*/
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/stm/stmusbd/usbd_msc_scsi.c b/stm/stmusbd/usbd_msc_scsi.c
deleted file mode 100644
index e1e557f54..000000000
--- a/stm/stmusbd/usbd_msc_scsi.c
+++ /dev/null
@@ -1,729 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_msc_scsi.c
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief This file provides all the USBD SCSI layer functions.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "usbd_msc_bot.h"
-#include "usbd_msc_scsi.h"
-#include "usbd_msc_mem.h"
-#include "usbd_msc_data.h"
-#include "usbd_conf.h"
-
-
-
-/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
- * @{
- */
-
-
-/** @defgroup MSC_SCSI
- * @brief Mass storage SCSI layer module
- * @{
- */
-
-/** @defgroup MSC_SCSI_Private_TypesDefinitions
- * @{
- */
-/**
- * @}
- */
-
-
-/** @defgroup MSC_SCSI_Private_Defines
- * @{
- */
-
-/**
- * @}
- */
-
-
-/** @defgroup MSC_SCSI_Private_Macros
- * @{
- */
-/**
- * @}
- */
-
-
-/** @defgroup MSC_SCSI_Private_Variables
- * @{
- */
-
-SCSI_Sense_TypeDef SCSI_Sense [SENSE_LIST_DEEPTH];
-uint8_t SCSI_Sense_Head;
-uint8_t SCSI_Sense_Tail;
-
-uint32_t SCSI_blk_size;
-uint32_t SCSI_blk_nbr;
-
-uint32_t SCSI_blk_addr;
-uint32_t SCSI_blk_len;
-
-USB_OTG_CORE_HANDLE *cdev;
-/**
- * @}
- */
-
-
-/** @defgroup MSC_SCSI_Private_FunctionPrototypes
- * @{
- */
-static int8_t SCSI_TestUnitReady(uint8_t lun, uint8_t *params);
-static int8_t SCSI_Inquiry(uint8_t lun, uint8_t *params);
-static int8_t SCSI_ReadFormatCapacity(uint8_t lun, uint8_t *params);
-static int8_t SCSI_ReadCapacity10(uint8_t lun, uint8_t *params);
-static int8_t SCSI_RequestSense (uint8_t lun, uint8_t *params);
-static int8_t SCSI_StartStopUnit(uint8_t lun, uint8_t *params);
-static int8_t SCSI_ModeSense6 (uint8_t lun, uint8_t *params);
-static int8_t SCSI_ModeSense10 (uint8_t lun, uint8_t *params);
-static int8_t SCSI_Write10(uint8_t lun , uint8_t *params);
-static int8_t SCSI_Read10(uint8_t lun , uint8_t *params);
-static int8_t SCSI_Verify10(uint8_t lun, uint8_t *params);
-static int8_t SCSI_CheckAddressRange (uint8_t lun ,
- uint32_t blk_offset ,
- uint16_t blk_nbr);
-static int8_t SCSI_ProcessRead (uint8_t lun);
-
-static int8_t SCSI_ProcessWrite (uint8_t lun);
-/**
- * @}
- */
-
-
-/** @defgroup MSC_SCSI_Private_Functions
- * @{
- */
-
-
-/**
-* @brief SCSI_ProcessCmd
-* Process SCSI commands
-* @param pdev: device instance
-* @param lun: Logical unit number
-* @param params: Command parameters
-* @retval status
-*/
-int8_t SCSI_ProcessCmd(USB_OTG_CORE_HANDLE *pdev,
- uint8_t lun,
- uint8_t *params)
-{
- cdev = pdev;
-
- switch (params[0])
- {
- case SCSI_TEST_UNIT_READY:
- return SCSI_TestUnitReady(lun, params);
-
- case SCSI_REQUEST_SENSE:
- return SCSI_RequestSense (lun, params);
- case SCSI_INQUIRY:
- return SCSI_Inquiry(lun, params);
-
- case SCSI_START_STOP_UNIT:
- return SCSI_StartStopUnit(lun, params);
-
- case SCSI_ALLOW_MEDIUM_REMOVAL:
- return SCSI_StartStopUnit(lun, params);
-
- case SCSI_MODE_SENSE6:
- return SCSI_ModeSense6 (lun, params);
-
- case SCSI_MODE_SENSE10:
- return SCSI_ModeSense10 (lun, params);
-
- case SCSI_READ_FORMAT_CAPACITIES:
- return SCSI_ReadFormatCapacity(lun, params);
-
- case SCSI_READ_CAPACITY10:
- return SCSI_ReadCapacity10(lun, params);
-
- case SCSI_READ10:
- return SCSI_Read10(lun, params);
-
- case SCSI_WRITE10:
- return SCSI_Write10(lun, params);
-
- case SCSI_VERIFY10:
- return SCSI_Verify10(lun, params);
-
- default:
- SCSI_SenseCode(lun,
- ILLEGAL_REQUEST,
- INVALID_CDB);
- return -1;
- }
-}
-
-
-/**
-* @brief SCSI_TestUnitReady
-* Process SCSI Test Unit Ready Command
-* @param lun: Logical unit number
-* @param params: Command parameters
-* @retval status
-*/
-static int8_t SCSI_TestUnitReady(uint8_t lun, uint8_t *params)
-{
-
- /* case 9 : Hi > D0 */
- if (MSC_BOT_cbw.dDataLength != 0)
- {
- SCSI_SenseCode(MSC_BOT_cbw.bLUN,
- ILLEGAL_REQUEST,
- INVALID_CDB);
- return -1;
- }
-
- if(USBD_STORAGE_fops->IsReady(lun) !=0 )
- {
- SCSI_SenseCode(lun,
- NOT_READY,
- MEDIUM_NOT_PRESENT);
- return -1;
- }
- MSC_BOT_DataLen = 0;
- return 0;
-}
-
-/**
-* @brief SCSI_Inquiry
-* Process Inquiry command
-* @param lun: Logical unit number
-* @param params: Command parameters
-* @retval status
-*/
-static int8_t SCSI_Inquiry(uint8_t lun, uint8_t *params)
-{
- uint8_t* pPage;
- uint16_t len;
-
- if (params[1] & 0x01)/*Evpd is set*/
- {
- pPage = (uint8_t *)MSC_Page00_Inquiry_Data;
- len = LENGTH_INQUIRY_PAGE00;
- }
- else
- {
-
- pPage = (uint8_t *)&USBD_STORAGE_fops->pInquiry[lun * USBD_STD_INQUIRY_LENGTH];
- len = pPage[4] + 5;
-
- if (params[4] <= len)
- {
- len = params[4];
- }
- }
- MSC_BOT_DataLen = len;
-
- while (len)
- {
- len--;
- MSC_BOT_Data[len] = pPage[len];
- }
- return 0;
-}
-
-/**
-* @brief SCSI_ReadCapacity10
-* Process Read Capacity 10 command
-* @param lun: Logical unit number
-* @param params: Command parameters
-* @retval status
-*/
-static int8_t SCSI_ReadCapacity10(uint8_t lun, uint8_t *params)
-{
-
- if(USBD_STORAGE_fops->GetCapacity(lun, &SCSI_blk_nbr, &SCSI_blk_size) != 0)
- {
- SCSI_SenseCode(lun,
- NOT_READY,
- MEDIUM_NOT_PRESENT);
- return -1;
- }
- else
- {
-
- MSC_BOT_Data[0] = (uint8_t)((SCSI_blk_nbr - 1) >> 24); // dpgeorge added paren
- MSC_BOT_Data[1] = (uint8_t)((SCSI_blk_nbr - 1) >> 16); // dpgeorge added paren
- MSC_BOT_Data[2] = (uint8_t)((SCSI_blk_nbr - 1) >> 8); // dpgeorge added paren
- MSC_BOT_Data[3] = (uint8_t)(SCSI_blk_nbr - 1);
-
- MSC_BOT_Data[4] = (uint8_t)(SCSI_blk_size >> 24);
- MSC_BOT_Data[5] = (uint8_t)(SCSI_blk_size >> 16);
- MSC_BOT_Data[6] = (uint8_t)(SCSI_blk_size >> 8);
- MSC_BOT_Data[7] = (uint8_t)(SCSI_blk_size);
-
- MSC_BOT_DataLen = 8;
- return 0;
- }
-}
-/**
-* @brief SCSI_ReadFormatCapacity
-* Process Read Format Capacity command
-* @param lun: Logical unit number
-* @param params: Command parameters
-* @retval status
-*/
-static int8_t SCSI_ReadFormatCapacity(uint8_t lun, uint8_t *params)
-{
-
- uint32_t blk_size;
- uint32_t blk_nbr;
- uint16_t i;
-
- for(i=0 ; i < 12 ; i++)
- {
- MSC_BOT_Data[i] = 0;
- }
-
- if(USBD_STORAGE_fops->GetCapacity(lun, &blk_nbr, &blk_size) != 0)
- {
- SCSI_SenseCode(lun,
- NOT_READY,
- MEDIUM_NOT_PRESENT);
- return -1;
- }
- else
- {
- MSC_BOT_Data[3] = 0x08;
- MSC_BOT_Data[4] = (uint8_t)((blk_nbr - 1) >> 24); // dpgeorge added paren
- MSC_BOT_Data[5] = (uint8_t)((blk_nbr - 1) >> 16); // dpgeorge added paren
- MSC_BOT_Data[6] = (uint8_t)((blk_nbr - 1) >> 8); // dpgeorge added paren
- MSC_BOT_Data[7] = (uint8_t)(blk_nbr - 1);
-
- MSC_BOT_Data[8] = 0x02;
- MSC_BOT_Data[9] = (uint8_t)(blk_size >> 16);
- MSC_BOT_Data[10] = (uint8_t)(blk_size >> 8);
- MSC_BOT_Data[11] = (uint8_t)(blk_size);
-
- MSC_BOT_DataLen = 12;
- return 0;
- }
-}
-/**
-* @brief SCSI_ModeSense6
-* Process Mode Sense6 command
-* @param lun: Logical unit number
-* @param params: Command parameters
-* @retval status
-*/
-static int8_t SCSI_ModeSense6 (uint8_t lun, uint8_t *params)
-{
-
- uint16_t len = 8 ;
- MSC_BOT_DataLen = len;
-
- while (len)
- {
- len--;
- MSC_BOT_Data[len] = MSC_Mode_Sense6_data[len];
- }
- return 0;
-}
-
-/**
-* @brief SCSI_ModeSense10
-* Process Mode Sense10 command
-* @param lun: Logical unit number
-* @param params: Command parameters
-* @retval status
-*/
-static int8_t SCSI_ModeSense10 (uint8_t lun, uint8_t *params)
-{
- uint16_t len = 8;
-
- MSC_BOT_DataLen = len;
-
- while (len)
- {
- len--;
- MSC_BOT_Data[len] = MSC_Mode_Sense10_data[len];
- }
- return 0;
-}
-
-/**
-* @brief SCSI_RequestSense
-* Process Request Sense command
-* @param lun: Logical unit number
-* @param params: Command parameters
-* @retval status
-*/
-
-static int8_t SCSI_RequestSense (uint8_t lun, uint8_t *params)
-{
- uint8_t i;
-
- for(i=0 ; i < REQUEST_SENSE_DATA_LEN ; i++)
- {
- MSC_BOT_Data[i] = 0;
- }
-
- MSC_BOT_Data[0] = 0x70;
- MSC_BOT_Data[7] = REQUEST_SENSE_DATA_LEN - 6;
-
- if((SCSI_Sense_Head != SCSI_Sense_Tail)) {
-
- MSC_BOT_Data[2] = SCSI_Sense[SCSI_Sense_Head].Skey;
- MSC_BOT_Data[12] = SCSI_Sense[SCSI_Sense_Head].w.b.ASCQ;
- MSC_BOT_Data[13] = SCSI_Sense[SCSI_Sense_Head].w.b.ASC;
- SCSI_Sense_Head++;
-
- if (SCSI_Sense_Head == SENSE_LIST_DEEPTH)
- {
- SCSI_Sense_Head = 0;
- }
- }
- MSC_BOT_DataLen = REQUEST_SENSE_DATA_LEN;
-
- if (params[4] <= REQUEST_SENSE_DATA_LEN)
- {
- MSC_BOT_DataLen = params[4];
- }
- return 0;
-}
-
-/**
-* @brief SCSI_SenseCode
-* Load the last error code in the error list
-* @param lun: Logical unit number
-* @param sKey: Sense Key
-* @param ASC: Additional Sense Key
-* @retval none
-
-*/
-void SCSI_SenseCode(uint8_t lun, uint8_t sKey, uint8_t ASC)
-{
- SCSI_Sense[SCSI_Sense_Tail].Skey = sKey;
- SCSI_Sense[SCSI_Sense_Tail].w.ASC = ASC << 8;
- SCSI_Sense_Tail++;
- if (SCSI_Sense_Tail == SENSE_LIST_DEEPTH)
- {
- SCSI_Sense_Tail = 0;
- }
-}
-/**
-* @brief SCSI_StartStopUnit
-* Process Start Stop Unit command
-* @param lun: Logical unit number
-* @param params: Command parameters
-* @retval status
-*/
-static int8_t SCSI_StartStopUnit(uint8_t lun, uint8_t *params)
-{
- MSC_BOT_DataLen = 0;
- return 0;
-}
-
-/**
-* @brief SCSI_Read10
-* Process Read10 command
-* @param lun: Logical unit number
-* @param params: Command parameters
-* @retval status
-*/
-static int8_t SCSI_Read10(uint8_t lun , uint8_t *params)
-{
- if(MSC_BOT_State == BOT_IDLE) /* Idle */
- {
-
- /* case 10 : Ho <> Di */
-
- if ((MSC_BOT_cbw.bmFlags & 0x80) != 0x80)
- {
- SCSI_SenseCode(MSC_BOT_cbw.bLUN,
- ILLEGAL_REQUEST,
- INVALID_CDB);
- return -1;
- }
-
- if(USBD_STORAGE_fops->IsReady(lun) !=0 )
- {
- SCSI_SenseCode(lun,
- NOT_READY,
- MEDIUM_NOT_PRESENT);
- return -1;
- }
-
- SCSI_blk_addr = (params[2] << 24) | \
- (params[3] << 16) | \
- (params[4] << 8) | \
- params[5];
-
- SCSI_blk_len = (params[7] << 8) | \
- params[8];
-
-
-
- if( SCSI_CheckAddressRange(lun, SCSI_blk_addr, SCSI_blk_len) < 0)
- {
- return -1; /* error */
- }
-
- MSC_BOT_State = BOT_DATA_IN;
- SCSI_blk_addr *= SCSI_blk_size;
- SCSI_blk_len *= SCSI_blk_size;
-
- /* cases 4,5 : Hi <> Dn */
- if (MSC_BOT_cbw.dDataLength != SCSI_blk_len)
- {
- SCSI_SenseCode(MSC_BOT_cbw.bLUN,
- ILLEGAL_REQUEST,
- INVALID_CDB);
- return -1;
- }
- }
- MSC_BOT_DataLen = MSC_MEDIA_PACKET;
-
- return SCSI_ProcessRead(lun);
-}
-
-/**
-* @brief SCSI_Write10
-* Process Write10 command
-* @param lun: Logical unit number
-* @param params: Command parameters
-* @retval status
-*/
-
-static int8_t SCSI_Write10 (uint8_t lun , uint8_t *params)
-{
- if (MSC_BOT_State == BOT_IDLE) /* Idle */
- {
-
- /* case 8 : Hi <> Do */
-
- if ((MSC_BOT_cbw.bmFlags & 0x80) == 0x80)
- {
- SCSI_SenseCode(MSC_BOT_cbw.bLUN,
- ILLEGAL_REQUEST,
- INVALID_CDB);
- return -1;
- }
-
- /* Check whether Media is ready */
- if(USBD_STORAGE_fops->IsReady(lun) !=0 )
- {
- SCSI_SenseCode(lun,
- NOT_READY,
- MEDIUM_NOT_PRESENT);
- return -1;
- }
-
- /* Check If media is write-protected */
- if(USBD_STORAGE_fops->IsWriteProtected(lun) !=0 )
- {
- SCSI_SenseCode(lun,
- NOT_READY,
- WRITE_PROTECTED);
- return -1;
- }
-
-
- SCSI_blk_addr = (params[2] << 24) | \
- (params[3] << 16) | \
- (params[4] << 8) | \
- params[5];
- SCSI_blk_len = (params[7] << 8) | \
- params[8];
-
- /* check if LBA address is in the right range */
- if(SCSI_CheckAddressRange(lun, SCSI_blk_addr, SCSI_blk_len) < 0)
- {
- return -1; /* error */
- }
-
- SCSI_blk_addr *= SCSI_blk_size;
- SCSI_blk_len *= SCSI_blk_size;
-
- /* cases 3,11,13 : Hn,Ho <> D0 */
- if (MSC_BOT_cbw.dDataLength != SCSI_blk_len)
- {
- SCSI_SenseCode(MSC_BOT_cbw.bLUN,
- ILLEGAL_REQUEST,
- INVALID_CDB);
- return -1;
- }
-
- /* Prepare EP to receive first data packet */
- MSC_BOT_State = BOT_DATA_OUT;
- DCD_EP_PrepareRx (cdev,
- MSC_OUT_EP,
- MSC_BOT_Data,
- MIN (SCSI_blk_len, MSC_MEDIA_PACKET));
- }
- else /* Write Process ongoing */
- {
- return SCSI_ProcessWrite(lun);
- }
- return 0;
-}
-
-
-/**
-* @brief SCSI_Verify10
-* Process Verify10 command
-* @param lun: Logical unit number
-* @param params: Command parameters
-* @retval status
-*/
-
-static int8_t SCSI_Verify10(uint8_t lun , uint8_t *params){
- if ((params[1]& 0x02) == 0x02)
- {
- SCSI_SenseCode (lun, ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
- return -1; /* Error, Verify Mode Not supported*/
- }
-
- if(SCSI_CheckAddressRange(lun, SCSI_blk_addr, SCSI_blk_len) < 0)
- {
- return -1; /* error */
- }
- MSC_BOT_DataLen = 0;
- return 0;
-}
-
-/**
-* @brief SCSI_CheckAddressRange
-* Check address range
-* @param lun: Logical unit number
-* @param blk_offset: first block address
-* @param blk_nbr: number of block to be processed
-* @retval status
-*/
-static int8_t SCSI_CheckAddressRange (uint8_t lun , uint32_t blk_offset , uint16_t blk_nbr)
-{
-
- if ((blk_offset + blk_nbr) > SCSI_blk_nbr )
- {
- SCSI_SenseCode(lun, ILLEGAL_REQUEST, ADDRESS_OUT_OF_RANGE);
- return -1;
- }
- return 0;
-}
-
-/**
-* @brief SCSI_ProcessRead
-* Handle Read Process
-* @param lun: Logical unit number
-* @retval status
-*/
-static int8_t SCSI_ProcessRead (uint8_t lun)
-{
- uint32_t len;
-
- len = MIN(SCSI_blk_len , MSC_MEDIA_PACKET);
-
- if( USBD_STORAGE_fops->Read(lun ,
- MSC_BOT_Data,
- SCSI_blk_addr / SCSI_blk_size,
- len / SCSI_blk_size) < 0)
- {
-
- SCSI_SenseCode(lun, HARDWARE_ERROR, UNRECOVERED_READ_ERROR);
- return -1;
- }
-
-
- DCD_EP_Tx (cdev,
- MSC_IN_EP,
- MSC_BOT_Data,
- len);
-
-
- SCSI_blk_addr += len;
- SCSI_blk_len -= len;
-
- /* case 6 : Hi = Di */
- MSC_BOT_csw.dDataResidue -= len;
-
- if (SCSI_blk_len == 0)
- {
- MSC_BOT_State = BOT_LAST_DATA_IN;
- }
- return 0;
-}
-
-/**
-* @brief SCSI_ProcessWrite
-* Handle Write Process
-* @param lun: Logical unit number
-* @retval status
-*/
-
-static int8_t SCSI_ProcessWrite (uint8_t lun)
-{
- uint32_t len;
-
- len = MIN(SCSI_blk_len , MSC_MEDIA_PACKET);
-
- if(USBD_STORAGE_fops->Write(lun ,
- MSC_BOT_Data,
- SCSI_blk_addr / SCSI_blk_size,
- len / SCSI_blk_size) < 0)
- {
- SCSI_SenseCode(lun, HARDWARE_ERROR, WRITE_FAULT);
- return -1;
- }
-
-
- SCSI_blk_addr += len;
- SCSI_blk_len -= len;
-
- /* case 12 : Ho = Do */
- MSC_BOT_csw.dDataResidue -= len;
-
- if (SCSI_blk_len == 0)
- {
- MSC_BOT_SendCSW (cdev, CSW_CMD_PASSED);
- }
- else
- {
- /* Prapare EP to Receive next packet */
- DCD_EP_PrepareRx (cdev,
- MSC_OUT_EP,
- MSC_BOT_Data,
- MIN (SCSI_blk_len, MSC_MEDIA_PACKET));
- }
-
- return 0;
-}
-/**
- * @}
- */
-
-
-/**
- * @}
- */
-
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/stm/stmusbd/usbd_msc_scsi.h b/stm/stmusbd/usbd_msc_scsi.h
deleted file mode 100644
index 1b8e35af1..000000000
--- a/stm/stmusbd/usbd_msc_scsi.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_msc_scsi.h
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief header for the usbd_msc_scsi.c file
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __USBD_MSC_SCSI_H
-#define __USBD_MSC_SCSI_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "usbd_def.h"
-
-/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
- * @{
- */
-
-/** @defgroup USBD_SCSI
- * @brief header file for the storage disk file
- * @{
- */
-
-/** @defgroup USBD_SCSI_Exported_Defines
- * @{
- */
-
-#define SENSE_LIST_DEEPTH 4
-
-/* SCSI Commands */
-#define SCSI_FORMAT_UNIT 0x04
-#define SCSI_INQUIRY 0x12
-#define SCSI_MODE_SELECT6 0x15
-#define SCSI_MODE_SELECT10 0x55
-#define SCSI_MODE_SENSE6 0x1A
-#define SCSI_MODE_SENSE10 0x5A
-#define SCSI_ALLOW_MEDIUM_REMOVAL 0x1E
-#define SCSI_READ6 0x08
-#define SCSI_READ10 0x28
-#define SCSI_READ12 0xA8
-#define SCSI_READ16 0x88
-
-#define SCSI_READ_CAPACITY10 0x25
-#define SCSI_READ_CAPACITY16 0x9E
-
-#define SCSI_REQUEST_SENSE 0x03
-#define SCSI_START_STOP_UNIT 0x1B
-#define SCSI_TEST_UNIT_READY 0x00
-#define SCSI_WRITE6 0x0A
-#define SCSI_WRITE10 0x2A
-#define SCSI_WRITE12 0xAA
-#define SCSI_WRITE16 0x8A
-
-#define SCSI_VERIFY10 0x2F
-#define SCSI_VERIFY12 0xAF
-#define SCSI_VERIFY16 0x8F
-
-#define SCSI_SEND_DIAGNOSTIC 0x1D
-#define SCSI_READ_FORMAT_CAPACITIES 0x23
-
-#define NO_SENSE 0
-#define RECOVERED_ERROR 1
-#define NOT_READY 2
-#define MEDIUM_ERROR 3
-#define HARDWARE_ERROR 4
-#define ILLEGAL_REQUEST 5
-#define UNIT_ATTENTION 6
-#define DATA_PROTECT 7
-#define BLANK_CHECK 8
-#define VENDOR_SPECIFIC 9
-#define COPY_ABORTED 10
-#define ABORTED_COMMAND 11
-#define VOLUME_OVERFLOW 13
-#define MISCOMPARE 14
-
-
-#define INVALID_CDB 0x20
-#define INVALID_FIELED_IN_COMMAND 0x24
-#define PARAMETER_LIST_LENGTH_ERROR 0x1A
-#define INVALID_FIELD_IN_PARAMETER_LIST 0x26
-#define ADDRESS_OUT_OF_RANGE 0x21
-#define MEDIUM_NOT_PRESENT 0x3A
-#define MEDIUM_HAVE_CHANGED 0x28
-#define WRITE_PROTECTED 0x27
-#define UNRECOVERED_READ_ERROR 0x11
-#define WRITE_FAULT 0x03
-
-#define READ_FORMAT_CAPACITY_DATA_LEN 0x0C
-#define READ_CAPACITY10_DATA_LEN 0x08
-#define MODE_SENSE10_DATA_LEN 0x08
-#define MODE_SENSE6_DATA_LEN 0x04
-#define REQUEST_SENSE_DATA_LEN 0x12
-#define STANDARD_INQUIRY_DATA_LEN 0x24
-#define BLKVFY 0x04
-
-extern uint8_t Page00_Inquiry_Data[];
-extern uint8_t Standard_Inquiry_Data[];
-extern uint8_t Standard_Inquiry_Data2[];
-extern uint8_t Mode_Sense6_data[];
-extern uint8_t Mode_Sense10_data[];
-extern uint8_t Scsi_Sense_Data[];
-extern uint8_t ReadCapacity10_Data[];
-extern uint8_t ReadFormatCapacity_Data [];
-/**
- * @}
- */
-
-
-/** @defgroup USBD_SCSI_Exported_TypesDefinitions
- * @{
- */
-
-typedef struct _SENSE_ITEM {
- char Skey;
- union {
- struct _ASCs {
- char ASC;
- char ASCQ;
- }b;
- unsigned int ASC;
- char *pData;
- } w;
-} SCSI_Sense_TypeDef;
-/**
- * @}
- */
-
-/** @defgroup USBD_SCSI_Exported_Macros
- * @{
- */
-
-/**
- * @}
- */
-
-/** @defgroup USBD_SCSI_Exported_Variables
- * @{
- */
-extern SCSI_Sense_TypeDef SCSI_Sense [SENSE_LIST_DEEPTH];
-extern uint8_t SCSI_Sense_Head;
-extern uint8_t SCSI_Sense_Tail;
-
-/**
- * @}
- */
-/** @defgroup USBD_SCSI_Exported_FunctionsPrototype
- * @{
- */
-int8_t SCSI_ProcessCmd(USB_OTG_CORE_HANDLE *pdev,
- uint8_t lun,
- uint8_t *cmd);
-
-void SCSI_SenseCode(uint8_t lun,
- uint8_t sKey,
- uint8_t ASC);
-
-/**
- * @}
- */
-
-#endif /* __USBD_MSC_SCSI_H */
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
-* @}
-*/
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
diff --git a/stm/stmusbd/usbd_pyb_core.c b/stm/stmusbd/usbd_pyb_core.c
deleted file mode 100644
index 5fcf9bb18..000000000
--- a/stm/stmusbd/usbd_pyb_core.c
+++ /dev/null
@@ -1,958 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_cdc_core.c
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief This file provides the high layer firmware functions to manage the
- * following functionalities of the USB CDC Class:
- * - Initialization and Configuration of high and low layer
- * - Enumeration as CDC Device (and enumeration for each implemented memory interface)
- * - OUT/IN data transfer
- * - Command IN transfer (class requests management)
- * - Error management
- *
- * @verbatim
- *
- * ===================================================================
- * CDC Class Driver Description
- * ===================================================================
- * This driver manages the "Universal Serial Bus Class Definitions for Communications Devices
- * Revision 1.2 November 16, 2007" and the sub-protocol specification of "Universal Serial Bus
- * Communications Class Subclass Specification for PSTN Devices Revision 1.2 February 9, 2007"
- * This driver implements the following aspects of the specification:
- * - Device descriptor management
- * - Configuration descriptor management
- * - Enumeration as CDC device with 2 data endpoints (IN and OUT) and 1 command endpoint (IN)
- * - Requests management (as described in section 6.2 in specification)
- * - Abstract Control Model compliant
- * - Union Functional collection (using 1 IN endpoint for control)
- * - Data interface class
-
- * @note
- * For the Abstract Control Model, this core allows only transmitting the requests to
- * lower layer dispatcher (ie. usbd_cdc_vcp.c/.h) which should manage each request and
- * perform relative actions.
- *
- * These aspects may be enriched or modified for a specific user application.
- *
- * This driver doesn't implement the following aspects of the specification
- * (but it is possible to manage these features with some modifications on this driver):
- * - Any class-specific aspect relative to communication classes should be managed by user application.
- * - All communication classes other than PSTN are not managed
- *
- * @endverbatim
- *
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include <stdio.h>
-
-#include "usbd_cdc_core.h"
-#include "usbd_desc.h"
-#include "usbd_req.h"
-#include "usbd_conf.h"
-#include "usbd_msc_bot.h"
-#include "usbd_msc_mem.h"
-
-// CDC VCP is the first interface
-// the option below is supposed to select between MSC (1) and HID (0) for the
-// second USB interface, but it does not work (only VCP+MSC works)
-// to use HID on its own (ie no VCP), the functions in usbd_pyb_core2.c can be
-// used, and selected in the call to pyb_usb_dev_init().
-#define USB_PYB_USE_MSC (1)
-
-#if USB_PYB_USE_MSC
-//#define USB_PYB_CONFIG_DESC_SIZ (67) // for only CDC VCP interfaces
-#define USB_PYB_CONFIG_DESC_SIZ (98) // for both CDC VCP and MSC interfaces
-#else // USE_HID
-#define USB_PYB_CONFIG_DESC_SIZ (100) // for both CDC VCP and HID interfaces
-#endif
-
-#define MSC_EPIN_SIZE MSC_MAX_PACKET
-#define MSC_EPOUT_SIZE MSC_MAX_PACKET
-
-#define HID_MOUSE_REPORT_DESC_SIZE (74)
-
-#define HID_DESCRIPTOR_TYPE 0x21
-#define HID_REPORT_DESC 0x22
-
-// HID parameters
-#define HID_IN_EP (0x83)
-#define HID_IN_PACKET (4) /* maximum, and actual, packet size */
-
-/*********************************************
- PYB Device library callbacks
- *********************************************/
-static uint8_t usbd_pyb_Init (void *pdev, uint8_t cfgidx);
-static uint8_t usbd_pyb_DeInit (void *pdev, uint8_t cfgidx);
-static uint8_t usbd_pyb_Setup (void *pdev, USB_SETUP_REQ *req);
-static uint8_t usbd_pyb_EP0_RxReady (void *pdev);
-static uint8_t usbd_pyb_DataIn (void *pdev, uint8_t epnum);
-static uint8_t usbd_pyb_DataOut (void *pdev, uint8_t epnum);
-static uint8_t usbd_pyb_SOF (void *pdev);
-
-/*********************************************
- PYB specific management functions
- *********************************************/
-static void Handle_USBAsynchXfer (void *pdev);
-static uint8_t *usbd_pyb_GetCfgDesc (uint8_t speed, uint16_t *length);
-
-/** @defgroup usbd_cdc_Private_Variables
- * @{
- */
-extern CDC_IF_Prop_TypeDef VCP_fops;
-extern uint8_t USBD_DeviceDesc [USB_SIZ_DEVICE_DESC];
-
-__ALIGN_BEGIN static uint8_t usbd_cdc_AltSet __ALIGN_END = 0;
-__ALIGN_BEGIN static uint8_t USB_Rx_Buffer[CDC_DATA_MAX_PACKET_SIZE] __ALIGN_END;
-__ALIGN_BEGIN uint8_t APP_Rx_Buffer[APP_RX_DATA_SIZE] __ALIGN_END;
-
-__ALIGN_BEGIN static uint8_t CmdBuff[CDC_CMD_PACKET_SZE] __ALIGN_END;
-
-#if USB_PYB_USE_MSC
-__ALIGN_BEGIN static uint8_t USBD_MSC_MaxLun __ALIGN_END = 0;
-__ALIGN_BEGIN static uint8_t USBD_MSC_AltSet __ALIGN_END = 0;
-#else
-__ALIGN_BEGIN static uint8_t USBD_HID_AltSet __ALIGN_END = 0;
-__ALIGN_BEGIN static uint8_t USBD_HID_Protocol __ALIGN_END = 0;
-__ALIGN_BEGIN static uint8_t USBD_HID_IdleState __ALIGN_END = 0;
-#endif
-
-uint32_t APP_Rx_ptr_in = 0;
-uint32_t APP_Rx_ptr_out = 0;
-uint32_t APP_Rx_length = 0;
-
-uint8_t USB_Tx_State = 0;
-
-static uint32_t cdcCmd = 0xFF;
-static uint32_t cdcLen = 0;
-
-/* PYB interface class callbacks structure */
-USBD_Class_cb_TypeDef USBD_PYB_cb =
-{
- usbd_pyb_Init,
- usbd_pyb_DeInit,
- usbd_pyb_Setup,
- NULL, // EP0_TxSent
- usbd_pyb_EP0_RxReady,
- usbd_pyb_DataIn,
- usbd_pyb_DataOut,
- usbd_pyb_SOF,
- NULL, // IsoINIncomplete
- NULL, // IsoOUTIncomplete
- usbd_pyb_GetCfgDesc,
- // for OTG_HS support need to add other cfg desc here
-};
-
-#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
- #if defined ( __ICCARM__ ) /*!< IAR Compiler */
- #pragma data_alignment=4
- #endif
-#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
-/* USB PYB device Configuration Descriptor */
-__ALIGN_BEGIN static uint8_t usbd_pyb_CfgDesc[USB_PYB_CONFIG_DESC_SIZ] __ALIGN_END =
-{
- //--------------------------------------------------------------------------
- // Configuration Descriptor
- 0x09, // bLength: Configuration Descriptor size
- USB_CONFIGURATION_DESCRIPTOR_TYPE, // bDescriptorType: Configuration
- LOBYTE(USB_PYB_CONFIG_DESC_SIZ), // wTotalLength: no of returned bytes
- HIBYTE(USB_PYB_CONFIG_DESC_SIZ),
- 0x03, // bNumInterfaces: 3 interfaces
- 0x01, // bConfigurationValue: Configuration value
- 0x04, // iConfiguration: Index of string descriptor describing the configuration
- 0x80, // bmAttributes: bus powered; 0xc0 for self powered
- 0xfa, // bMaxPower: in units of 2mA
-
- //==========================================================================
- // Interface Association for CDC VCP
- 0x08, // bLength: 8 bytes
- USB_INTERFACE_ASSOCIATION_TYPE, // bDescriptorType: IAD
- 0x00, // bFirstInterface: first interface for this association
- 0x02, // bInterfaceCount: nummber of interfaces for this association
- 0x00, // bFunctionClass: ?
- 0x00, // bFunctionSubClass: ?
- 0x00, // bFunctionProtocol: ?
- 0x04, // iFunction: index of string for this function
-
- //--------------------------------------------------------------------------
- // Interface Descriptor
- 0x09, // bLength: Interface Descriptor size
- USB_INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType: Interface
- 0x00, // bInterfaceNumber: Number of Interface
- 0x00, // bAlternateSetting: Alternate setting
- 0x01, // bNumEndpoints: One endpoints used
- 0x02, // bInterfaceClass: Communication Interface Class
- 0x02, // bInterfaceSubClass: Abstract Control Model
- 0x01, // bInterfaceProtocol: Common AT commands
- 0x00, // iInterface:
-
- // Header Functional Descriptor
- 0x05, // bLength: Endpoint Descriptor size
- 0x24, // bDescriptorType: CS_INTERFACE
- 0x00, // bDescriptorSubtype: Header Func Desc
- 0x10, // bcdCDC: spec release number
- 0x01, // ?
-
- // Call Management Functional Descriptor
- 0x05, // bFunctionLength
- 0x24, // bDescriptorType: CS_INTERFACE
- 0x01, // bDescriptorSubtype: Call Management Func Desc
- 0x00, // bmCapabilities: D0+D1
- 0x01, // bDataInterface: 1
-
- // ACM Functional Descriptor
- 0x04, // bFunctionLength
- 0x24, // bDescriptorType: CS_INTERFACE
- 0x02, // bDescriptorSubtype: Abstract Control Management desc
- 0x02, // bmCapabilities
-
- // Union Functional Descriptor
- 0x05, // bFunctionLength
- 0x24, // bDescriptorType: CS_INTERFACE
- 0x06, // bDescriptorSubtype: Union func desc
- 0x00, // bMasterInterface: Communication class interface
- 0x01, // bSlaveInterface0: Data Class Interface
-
- // Endpoint 2 Descriptor
- 0x07, // bLength: Endpoint Descriptor size
- USB_ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType: Endpoint
- CDC_CMD_EP, // bEndpointAddress
- 0x03, // bmAttributes: Interrupt
- LOBYTE(CDC_CMD_PACKET_SZE), // wMaxPacketSize:
- HIBYTE(CDC_CMD_PACKET_SZE),
- 0x80, // bInterval: polling interval in frames of 1ms
-
- //--------------------------------------------------------------------------
- // Data class interface descriptor
- 0x09, // bLength: Endpoint Descriptor size
- USB_INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType: interface
- 0x01, // bInterfaceNumber: Number of Interface
- 0x00, // bAlternateSetting: Alternate setting
- 0x02, // bNumEndpoints: Two endpoints used
- 0x0A, // bInterfaceClass: CDC
- 0x00, // bInterfaceSubClass: ?
- 0x00, // bInterfaceProtocol: ?
- 0x00, // iInterface:
-
- // Endpoint OUT Descriptor
- 0x07, // bLength: Endpoint Descriptor size
- USB_ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType: Endpoint
- CDC_OUT_EP, // bEndpointAddress
- 0x02, // bmAttributes: Bulk
- LOBYTE(CDC_DATA_MAX_PACKET_SIZE), // wMaxPacketSize:
- HIBYTE(CDC_DATA_MAX_PACKET_SIZE),
- 0x00, // bInterval: ignore for Bulk transfer
-
- // Endpoint IN Descriptor
- 0x07, // bLength: Endpoint Descriptor size
- USB_ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType: Endpoint
- CDC_IN_EP, // bEndpointAddress
- 0x02, // bmAttributes: Bulk
- LOBYTE(CDC_DATA_MAX_PACKET_SIZE), // wMaxPacketSize:
- HIBYTE(CDC_DATA_MAX_PACKET_SIZE),
- 0x00, // bInterval: ignore for Bulk transfer
-
-#if USB_PYB_USE_MSC
- //==========================================================================
- // MSC only has 1 interface so doesn't need an IAD
-
- //--------------------------------------------------------------------------
- // Interface Descriptor
- 0x09, // bLength: Interface Descriptor size
- USB_INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType: interface descriptor
- 0x02, // bInterfaceNumber: Number of Interface
- 0x00, // bAlternateSetting: Alternate setting
- 0x02, // bNumEndpoints
- 0x08, // bInterfaceClass: MSC Class
- 0x06, // bInterfaceSubClass : SCSI transparent
- 0x50, // nInterfaceProtocol
- 0x00, // iInterface:
-
- // Endpoint IN descriptor
- 0x07, // bLength: Endpoint descriptor length
- USB_ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType: Endpoint descriptor type
- MSC_IN_EP, // bEndpointAddress: IN, address 3
- 0x02, // bmAttributes: Bulk endpoint type
- LOBYTE(MSC_MAX_PACKET), // wMaxPacketSize
- HIBYTE(MSC_MAX_PACKET),
- 0x00, // bInterval: ignore for Bulk transfer
-
- // Endpoint OUT descriptor
- 0x07, // bLength: Endpoint descriptor length
- USB_ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType: Endpoint descriptor type
- MSC_OUT_EP, // bEndpointAddress: OUT, address 3
- 0x02, // bmAttributes: Bulk endpoint type
- LOBYTE(MSC_MAX_PACKET), // wMaxPacketSize
- HIBYTE(MSC_MAX_PACKET),
- 0x00, // bInterval: ignore for Bulk transfer
-
-#else
- //==========================================================================
- // HID only has 1 interface so doesn't need an IAD
-
- //--------------------------------------------------------------------------
- // Interface Descriptor
- 0x09, // bLength: Interface Descriptor size
- USB_INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType: interface descriptor
- 0x02, // bInterfaceNumber: Number of Interface
- 0x00, // bAlternateSetting: Alternate setting
- 0x01, // bNumEndpoints
- 0x03, // bInterfaceClass: HID Class
- 0x01, // bInterfaceSubClass: 0=no boot, 1=BOOT
- 0x02, // nInterfaceProtocol: 0=none, 1=keyboard, 2=mouse
- 0x00, // iInterface:
-
- // Descriptor of Joystick Mouse HID
- 0x09, // bLength: HID Descriptor size
- HID_DESCRIPTOR_TYPE, // bDescriptorType: HID
- 0x11, // bcdHID: HID Class Spec release number, low byte
- 0x01, // bcdHID: high byte
- 0x00, // bCountryCode: Hardware target country (0=unsupported)
- 0x01, // bNumDescriptors: Number of HID class descriptors to follow
- HID_REPORT_DESC, // bDescriptorType: report
- HID_MOUSE_REPORT_DESC_SIZE, // wItemLength: Total length of Report descriptor
- 0x00,
-
- // Endpoint IN descriptor
- 0x07, // bLength: Endpoint descriptor length
- USB_ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType: Endpoint descriptor type
- HID_IN_EP, // bEndpointAddress: IN, address of HID
- 0x03, // bmAttributes: Interrupt endpoint type
- LOBYTE(HID_IN_PACKET), // wMaxPacketSize
- HIBYTE(HID_IN_PACKET),
- 0x0a, // bInterval: polling interval, units of 1ms
-
-#endif
-};
-
-#if !USB_PYB_USE_MSC
-__ALIGN_BEGIN static uint8_t HID_MOUSE_ReportDesc[HID_MOUSE_REPORT_DESC_SIZE] __ALIGN_END =
-{
- 0x05, 0x01,
- 0x09, 0x02,
- 0xA1, 0x01,
- 0x09, 0x01,
-
- 0xA1, 0x00,
- 0x05, 0x09,
- 0x19, 0x01,
- 0x29, 0x03,
-
- 0x15, 0x00,
- 0x25, 0x01,
- 0x95, 0x03,
- 0x75, 0x01,
-
- 0x81, 0x02,
- 0x95, 0x01,
- 0x75, 0x05,
- 0x81, 0x01,
-
- 0x05, 0x01,
- 0x09, 0x30,
- 0x09, 0x31,
- 0x09, 0x38,
-
- 0x15, 0x81,
- 0x25, 0x7F,
- 0x75, 0x08,
- 0x95, 0x03,
-
- 0x81, 0x06,
- 0xC0, 0x09,
- 0x3c, 0x05,
- 0xff, 0x09,
-
- 0x01, 0x15,
- 0x00, 0x25,
- 0x01, 0x75,
- 0x01, 0x95,
-
- 0x02, 0xb1,
- 0x22, 0x75,
- 0x06, 0x95,
- 0x01, 0xb1,
-
- 0x01, 0xc0
-};
-#endif
-
-/** @defgroup usbd_pyb_Private_Functions
- * @{
- */
-
-/**
- * @brief usbd_pyb_Init
- * Initilaize the PYB interface
- * @param pdev: device instance
- * @param cfgidx: Configuration index
- * @retval status
- */
-static uint8_t usbd_pyb_Init(void *pdev, uint8_t cfgidx) {
- // deinit first to reset
- usbd_pyb_DeInit(pdev, cfgidx);
-
- //----------------------------------
- // CDC VCP component
-
- // Open EP IN
- DCD_EP_Open(pdev,
- CDC_IN_EP,
- CDC_DATA_IN_PACKET_SIZE,
- USB_OTG_EP_BULK);
-
- // Open EP OUT
- DCD_EP_Open(pdev,
- CDC_OUT_EP,
- CDC_DATA_OUT_PACKET_SIZE,
- USB_OTG_EP_BULK);
-
- // Open Command IN EP
- DCD_EP_Open(pdev,
- CDC_CMD_EP,
- CDC_CMD_PACKET_SZE,
- USB_OTG_EP_INT);
-
- /*
- // can use this to dynamically set the device class
- uint8_t *pbuf = USBD_DeviceDesc;
- pbuf[4] = DEVICE_CLASS_CDC;
- pbuf[5] = DEVICE_SUBCLASS_CDC;
- */
-
- // Initialize the Interface physical components
- VCP_fops.pIf_Init();
-
- // Prepare Out endpoint to receive next packet */
- DCD_EP_PrepareRx(pdev,
- CDC_OUT_EP,
- (uint8_t*)(USB_Rx_Buffer),
- CDC_DATA_OUT_PACKET_SIZE);
-
-#if USB_PYB_USE_MSC
- //----------------------------------
- // MSC component
-
- // Open EP IN
- DCD_EP_Open(pdev,
- MSC_IN_EP,
- MSC_EPIN_SIZE,
- USB_OTG_EP_BULK);
-
- // Open EP OUT
- DCD_EP_Open(pdev,
- MSC_OUT_EP,
- MSC_EPOUT_SIZE,
- USB_OTG_EP_BULK);
-
- // Init the BOT layer
- MSC_BOT_Init(pdev);
-
-#else
- //----------------------------------
- // HID component
-
- // Open EP IN
- DCD_EP_Open(pdev,
- HID_IN_EP,
- HID_IN_PACKET,
- USB_OTG_EP_INT);
-#endif
-
- return USBD_OK;
-}
-
-/**
- * @brief usbd_pyb_Init
- * DeInitialize the CDC layer
- * @param pdev: device instance
- * @param cfgidx: Configuration index
- * @retval status
- */
-static uint8_t usbd_pyb_DeInit(void *pdev, uint8_t cfgidx) {
- //----------------------------------
- // CDC VCP component
- // close CDC EPs
- DCD_EP_Close(pdev, CDC_IN_EP);
- DCD_EP_Close(pdev, CDC_OUT_EP);
- DCD_EP_Close(pdev, CDC_CMD_EP);
-
- // Restore default state of the Interface physical components
- VCP_fops.pIf_DeInit();
-
-#if USB_PYB_USE_MSC
- //----------------------------------
- // MSC component
-
- // Close MSC EPs
- DCD_EP_Close(pdev, MSC_IN_EP);
- DCD_EP_Close(pdev, MSC_OUT_EP);
-
- // Un Init the BOT layer
- MSC_BOT_DeInit(pdev);
-
-#else
- //----------------------------------
- // HID component
-
- // Close HID EP
- DCD_EP_Close(pdev, HID_IN_EP);
-#endif
-
- return USBD_OK;
-}
-
-#define BOT_GET_MAX_LUN 0xFE
-#define BOT_RESET 0xFF
-
-#define HID_REQ_SET_PROTOCOL (0x0B)
-#define HID_REQ_GET_PROTOCOL (0x03)
-#define HID_REQ_SET_IDLE (0x0A)
-#define HID_REQ_GET_IDLE (0x02)
-#define HID_REQ_SET_REPORT (0x09) // used?
-#define HID_REQ_GET_REPORT (0x01) // used?
-
-/**
- * @brief usbd_pyb_Setup
- * Handle the CDC specific requests
- * @param pdev: instance
- * @param req: usb requests
- * @retval status
- */
-static uint8_t usbd_pyb_Setup(void *pdev, USB_SETUP_REQ *req) {
- switch (req->bmRequest & (USB_REQ_TYPE_MASK | USB_REQ_RECIPIENT_MASK)) {
-
- // Standard Device Request ---------------------------------------------
- case (USB_REQ_TYPE_STANDARD | USB_REQ_RECIPIENT_DEVICE):
- /*
- switch (req->bRequest) {
- case USB_REQ_GET_DESCRIPTOR:
- {
- uint16_t len = USB_CDC_DESC_SIZ; // XXX WRONG!
- uint8_t *pbuf = usbd_pyb_CfgDesc + 9;
- if ((req->wValue >> 8) == CDC_DESCRIPTOR_TYPE) {
- pbuf = usbd_pyb_CfgDesc + 9 + (9 * USBD_ITF_MAX_NUM); // TODO
- len = MIN(USB_CDC_DESC_SIZ, req->wLength); // TODO
- }
- return USBD_CtlSendData(pdev, pbuf, len);
- // TODO stuff here for HID, using HID_MOUSE_ReportDesc
- }
- }
- */
- break;
-
- // Standard Interface Request ------------------------------------------
- case (USB_REQ_TYPE_STANDARD | USB_REQ_RECIPIENT_INTERFACE):
- switch (req->bRequest) {
- case USB_REQ_GET_DESCRIPTOR: // needed for HID; SU 0x81 0x06 0x2200 0x00 request
- // wIndex & 0xff is the interface
- if ((req->wIndex & 0xff) <= 1) {
- // CDC VCP
- } else {
-#if USB_PYB_USE_MSC
-#else
- uint16_t len = 0;
- uint8_t *pbuf = NULL;
- if (req->wValue >> 8 == HID_REPORT_DESC) {
- len = MIN(HID_MOUSE_REPORT_DESC_SIZE , req->wLength);
- pbuf = HID_MOUSE_ReportDesc;
- return USBD_CtlSendData(pdev, pbuf, len);
- } else if( req->wValue >> 8 == HID_DESCRIPTOR_TYPE) {
- pbuf = usbd_pyb_CfgDesc + /* skip VCP */ 0x09 + 0x08 + 0x09 + 0x05 + 0x05 + 0x04 + 0x05 + 0x07 + 0x09 + 0x07 + 0x07 + /* skip iface descr */ 0x09;
- len = MIN(0x09, req->wLength);
- return USBD_CtlSendData(pdev, pbuf, len);
- }
-#endif
- }
- break;
-
- case USB_REQ_GET_INTERFACE:
- // wIndex & 0xff is the interface
- if ((req->wIndex & 0xff) <= 1) {
- return USBD_CtlSendData(pdev, &usbd_cdc_AltSet, 1);
- } else {
-#if USB_PYB_USE_MSC
- return USBD_CtlSendData(pdev, &USBD_MSC_AltSet, 1);
-#else
- return USBD_CtlSendData(pdev, &USBD_HID_AltSet, 1);
-#endif
- }
-
- case USB_REQ_SET_INTERFACE:
- if ((uint8_t)(req->wValue) < USBD_ITF_MAX_NUM) { // TODO
- if ((req->wIndex & 0xff) <= 1) {
- usbd_cdc_AltSet = req->wValue;
- } else {
-#if USB_PYB_USE_MSC
- USBD_MSC_AltSet = req->wValue;
-#else
- USBD_HID_AltSet = req->wValue;
-#endif
- }
- return USBD_OK;
- }
- }
- break;
-
- // Standard Endpoint Request -------------------------------------------
- case (USB_REQ_TYPE_STANDARD | USB_REQ_RECIPIENT_ENDPOINT):
- // req->wIndex is the endpoint number, including direction
-#if USB_PYB_USE_MSC
- if (req->wIndex == MSC_IN_EP || req->wIndex == MSC_OUT_EP) {
- // MSC component
- switch (req->bRequest) {
- case USB_REQ_CLEAR_FEATURE:
-
- // Flush the FIFO and Clear the stall status
- DCD_EP_Flush(pdev, (uint8_t)req->wIndex);
-
- // Re-activate the EP
- DCD_EP_Close(pdev, (uint8_t)req->wIndex);
-
- if ((((uint8_t)req->wIndex) & 0x80) == 0x80) {
- DCD_EP_Open(pdev, ((uint8_t)req->wIndex), MSC_EPIN_SIZE, USB_OTG_EP_BULK);
- } else {
- DCD_EP_Open(pdev, ((uint8_t)req->wIndex), MSC_EPOUT_SIZE, USB_OTG_EP_BULK);
- }
-
- // Handle BOT error
- MSC_BOT_CplClrFeature(pdev, (uint8_t)req->wIndex);
- return USBD_OK;
- }
- }
-#endif
- break;
-
- // CDC Class Requests ------------------------------
- case (USB_REQ_TYPE_CLASS | USB_REQ_RECIPIENT_INTERFACE):
- // req->wIndex is the recipient interface number
- if (req->wIndex == 0) {
- // CDC component, communications interface (TODO do we need to handle if#1?)
-
- // Check if the request is a data setup packet
- if (req->wLength) {
- if (req->bmRequest & 0x80) {
- // Device-to-Host request
-
- // Get the data to be sent to Host from interface layer
- VCP_fops.pIf_Ctrl(req->bRequest, CmdBuff, req->wLength);
-
- // Send the data to the host
- return USBD_CtlSendData(pdev, CmdBuff, req->wLength);
-
- } else {
- // Host-to-Device requeset
-
- // Set the value of the current command to be processed */
- cdcCmd = req->bRequest;
- cdcLen = req->wLength;
-
- // Prepare the reception of the buffer over EP0
- // Next step: the received data will be managed in usbd_cdc_EP0_TxSent() function.
- return USBD_CtlPrepareRx(pdev, CmdBuff, req->wLength);
- }
- } else {
- // Not a Data request
-
- // Transfer the command to the interface layer */
- return VCP_fops.pIf_Ctrl(req->bRequest, NULL, req->wValue);
- }
-
- } else if (req->wIndex == 2) {
-#if USB_PYB_USE_MSC
- // MSC component
- switch (req->bRequest) {
- case BOT_GET_MAX_LUN:
- if ((req->wValue == 0) && (req->wLength == 1) && ((req->bmRequest & 0x80) == 0x80)) {
- USBD_MSC_MaxLun = USBD_STORAGE_fops->GetMaxLun();
- if (USBD_MSC_MaxLun > 0) {
- return USBD_CtlSendData(pdev, &USBD_MSC_MaxLun, 1);
- }
- }
- break;
-
- case BOT_RESET:
- if ((req->wValue == 0) && (req->wLength == 0) && ((req->bmRequest & 0x80) != 0x80)) {
- MSC_BOT_Reset(pdev);
- return USBD_OK;
- }
- break;
- }
-#else
- // HID component
- switch (req->bRequest) {
- case HID_REQ_SET_PROTOCOL:
- USBD_HID_Protocol = req->wValue;
- return USBD_OK;
-
- case HID_REQ_GET_PROTOCOL:
- return USBD_CtlSendData(pdev, &USBD_HID_Protocol, 1);
-
- case HID_REQ_SET_IDLE:
- USBD_HID_IdleState = (req->wValue >> 8);
- return USBD_OK;
-
- case HID_REQ_GET_IDLE:
- return USBD_CtlSendData(pdev, &USBD_HID_IdleState, 1);
- }
-#endif
- }
- break;
- }
-
- printf("SU %x %x %x %x\n", req->bmRequest, req->bRequest, req->wValue, req->wIndex);
-
- // invalid command
- USBD_CtlError(pdev, req);
- return USBD_FAIL;
-}
-
-/**
- * @brief usbd_pyb_EP0_RxReady
- * Data received on control endpoint
- * @param pdev: device device instance
- * @retval status
- */
-static uint8_t usbd_pyb_EP0_RxReady(void *pdev) {
- if (cdcCmd != NO_CMD) {
- // Process the data
- VCP_fops.pIf_Ctrl(cdcCmd, CmdBuff, cdcLen);
-
- // Reset the command variable to default value
- cdcCmd = NO_CMD;
- }
-
- return USBD_OK;
-}
-
-/**
- * @brief usbd_pyb_DataIn
- * Data sent on non-control IN endpoint
- * @param pdev: device instance
- * @param epnum: endpoint number
- * @retval status
- */
-static uint8_t usbd_pyb_DataIn(void *pdev, uint8_t epnum) {
- uint16_t USB_Tx_ptr;
- uint16_t USB_Tx_length;
-
- switch (epnum) {
- case (CDC_IN_EP & 0x7f): // TODO is this correct?
- case (CDC_CMD_EP & 0x7f): // TODO is this correct?
- if (USB_Tx_State == 1) {
- if (APP_Rx_length == 0) {
- USB_Tx_State = 0;
- } else {
- if (APP_Rx_length > CDC_DATA_IN_PACKET_SIZE) {
- USB_Tx_ptr = APP_Rx_ptr_out;
- USB_Tx_length = CDC_DATA_IN_PACKET_SIZE;
-
- APP_Rx_ptr_out += CDC_DATA_IN_PACKET_SIZE;
- APP_Rx_length -= CDC_DATA_IN_PACKET_SIZE;
- } else {
- USB_Tx_ptr = APP_Rx_ptr_out;
- USB_Tx_length = APP_Rx_length;
-
- APP_Rx_ptr_out += APP_Rx_length;
- APP_Rx_length = 0;
- }
-
- // Prepare the available data buffer to be sent on IN endpoint
- DCD_EP_Tx(pdev,
- CDC_IN_EP,
- (uint8_t*)&APP_Rx_Buffer[USB_Tx_ptr],
- USB_Tx_length);
- }
- }
- return USBD_OK;
-
-#if USB_PYB_USE_MSC
- case (MSC_IN_EP & 0x7f): // TODO?
- MSC_BOT_DataIn(pdev, epnum);
- return USBD_OK;
-
-#else
- case (HID_IN_EP & 0x7f):
- /* Ensure that the FIFO is empty before a new transfer, this condition could
- be caused by a new transfer before the end of the previous transfer */
- DCD_EP_Flush(pdev, HID_IN_EP);
- return USBD_OK;
-#endif
- }
-
- printf("DI %x\n", epnum);
-
- return USBD_OK;
-}
-
-/**
- * @brief usbd_pyb_DataOut
- * Data received on non-control Out endpoint
- * @param pdev: device instance
- * @param epnum: endpoint number
- * @retval status
- */
-static uint8_t usbd_pyb_DataOut(void *pdev, uint8_t epnum) {
- uint16_t USB_Rx_Cnt;
-
- switch (epnum) {
- case (CDC_OUT_EP & 0x7f): // TODO is this correct?
- // Get the received data buffer and update the counter */
- USB_Rx_Cnt = ((USB_OTG_CORE_HANDLE*)pdev)->dev.out_ep[epnum].xfer_count;
-
- /* USB data will be immediately processed, this allow next USB traffic being
- NAKed till the end of the application Xfer */
- VCP_fops.pIf_DataRx(USB_Rx_Buffer, USB_Rx_Cnt);
-
- // Prepare Out endpoint to receive next packet */
- DCD_EP_PrepareRx(pdev,
- CDC_OUT_EP,
- (uint8_t*)(USB_Rx_Buffer),
- CDC_DATA_OUT_PACKET_SIZE);
- return USBD_OK;
-
-#if USB_PYB_USE_MSC
- case (MSC_OUT_EP & 0x7f): // TODO is this correct?
- MSC_BOT_DataOut(pdev, epnum);
- return USBD_OK;
-#endif
- }
-
- printf("DO %x\n", epnum);
-
- return USBD_OK;
-}
-
-/**
- * @brief usbd_pyb_SOF
- * Start Of Frame event management
- * @param pdev: instance
- * @retval status
- */
-static uint8_t usbd_pyb_SOF(void *pdev) {
- static uint32_t FrameCount = 0;
-
- // TODO do we need to check that this is for CDC/VCP? can we even do that?
-
- if (FrameCount++ == CDC_IN_FRAME_INTERVAL) {
- // Reset the frame counter */
- FrameCount = 0;
-
- // Check the data to be sent through IN pipe */
- Handle_USBAsynchXfer(pdev);
- }
-
- return USBD_OK;
-}
-
-/**
- * @brief Handle_USBAsynchXfer
- * Send data to USB
- * @param pdev: instance
- * @retval None
- */
-static void Handle_USBAsynchXfer (void *pdev)
-{
- uint16_t USB_Tx_ptr;
- uint16_t USB_Tx_length;
-
- if(USB_Tx_State != 1)
- {
- if (APP_Rx_ptr_out == APP_RX_DATA_SIZE)
- {
- APP_Rx_ptr_out = 0;
- }
-
- if(APP_Rx_ptr_out == APP_Rx_ptr_in)
- {
- USB_Tx_State = 0;
- return;
- }
-
- if(APP_Rx_ptr_out > APP_Rx_ptr_in) // rollback */
- {
- APP_Rx_length = APP_RX_DATA_SIZE - APP_Rx_ptr_out;
-
- }
- else
- {
- APP_Rx_length = APP_Rx_ptr_in - APP_Rx_ptr_out;
-
- }
-#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
- APP_Rx_length &= ~0x03;
-#endif // USB_OTG_HS_INTERNAL_DMA_ENABLED */
-
- if (APP_Rx_length > CDC_DATA_IN_PACKET_SIZE)
- {
- USB_Tx_ptr = APP_Rx_ptr_out;
- USB_Tx_length = CDC_DATA_IN_PACKET_SIZE;
-
- APP_Rx_ptr_out += CDC_DATA_IN_PACKET_SIZE;
- APP_Rx_length -= CDC_DATA_IN_PACKET_SIZE;
- }
- else
- {
- USB_Tx_ptr = APP_Rx_ptr_out;
- USB_Tx_length = APP_Rx_length;
-
- APP_Rx_ptr_out += APP_Rx_length;
- APP_Rx_length = 0;
- }
- USB_Tx_State = 1;
-
- DCD_EP_Tx (pdev,
- CDC_IN_EP,
- (uint8_t*)&APP_Rx_Buffer[USB_Tx_ptr],
- USB_Tx_length);
- }
-
-}
-
-/**
- * @brief usbd_pyb_GetCfgDesc
- * Return configuration descriptor
- * @param speed : current device speed
- * @param length : pointer data length
- * @retval pointer to descriptor buffer
- */
-static uint8_t *usbd_pyb_GetCfgDesc(uint8_t speed, uint16_t *length) {
- *length = sizeof(usbd_pyb_CfgDesc);
- return usbd_pyb_CfgDesc;
-}
-
-/**
- * @brief USBD_HID_SendReport
- * Send HID Report
- * @param pdev: device instance
- * @param buff: pointer to report (4 bytes: ?, x, y, ?)
- * @retval status
- */
-/*
-uint8_t USBD_HID_SendReport(USB_OTG_CORE_HANDLE *pdev, uint8_t *report, uint16_t len) {
- if (pdev->dev.device_status == USB_OTG_CONFIGURED) {
- DCD_EP_Tx(pdev, HID_IN_EP, report, len);
- }
- return USBD_OK;
-}
-*/
diff --git a/stm/stmusbd/usbd_pyb_core.h b/stm/stmusbd/usbd_pyb_core.h
deleted file mode 100644
index 761ca2253..000000000
--- a/stm/stmusbd/usbd_pyb_core.h
+++ /dev/null
@@ -1,4 +0,0 @@
-extern USBD_Class_cb_TypeDef USBD_PYB_cb;
-extern USBD_Class_cb_TypeDef USBD_PYB_HID_cb;
-
-uint8_t USBD_HID_SendReport(USB_OTG_CORE_HANDLE *pdev, uint8_t *report, uint16_t len);
diff --git a/stm/stmusbd/usbd_pyb_core2.c b/stm/stmusbd/usbd_pyb_core2.c
deleted file mode 100644
index c1abda3e7..000000000
--- a/stm/stmusbd/usbd_pyb_core2.c
+++ /dev/null
@@ -1,323 +0,0 @@
-#include <stdio.h>
-
-#include "usbd_ioreq.h"
-#include "usbd_desc.h"
-#include "usbd_req.h"
-#include "usbd_pyb_core.h"
-
-#define USB_PYB_CONFIG_DESC_SIZ (34)
-
-#define HID_MOUSE_REPORT_DESC_SIZE (74)
-
-#define HID_DESCRIPTOR_TYPE (0x21)
-#define HID_REPORT_DESC (0x22)
-
-#define HID_IN_EP (0x81)
-#define HID_IN_PACKET (4) /* maximum, and actual, packet size */
-
-/*********************************************
- PYB Device library callbacks
- *********************************************/
-
-static uint8_t usbd_pyb_Init (void *pdev, uint8_t cfgidx);
-static uint8_t usbd_pyb_DeInit (void *pdev, uint8_t cfgidx);
-static uint8_t usbd_pyb_Setup (void *pdev, USB_SETUP_REQ *req);
-static uint8_t usbd_pyb_DataIn (void *pdev, uint8_t epnum);
-
-/*********************************************
- PYB specific management functions
- *********************************************/
-
-static uint8_t *usbd_pyb_GetCfgDesc(uint8_t speed, uint16_t *length);
-
-__ALIGN_BEGIN static uint8_t USBD_HID_AltSet __ALIGN_END = 0;
-__ALIGN_BEGIN static uint8_t USBD_HID_Protocol __ALIGN_END = 0;
-__ALIGN_BEGIN static uint8_t USBD_HID_IdleState __ALIGN_END = 0;
-
-/* PYB interface class callbacks structure */
-USBD_Class_cb_TypeDef USBD_PYB_HID_cb =
-{
- usbd_pyb_Init,
- usbd_pyb_DeInit,
- usbd_pyb_Setup,
- NULL, // EP0_TxSent
- NULL, // usbd_pyb_EP0_RxReady,
- usbd_pyb_DataIn,
- NULL, // usbd_pyb_DataOut,
- NULL, // usbd_pyb_SOF,
- NULL, // IsoINIncomplete
- NULL, // IsoOUTIncomplete
- usbd_pyb_GetCfgDesc,
- // for OTG_HS support need to add other cfg desc here
-};
-
-/* USB PYB device Configuration Descriptor */
-__ALIGN_BEGIN static uint8_t usbd_pyb_CfgDesc[USB_PYB_CONFIG_DESC_SIZ] __ALIGN_END =
-{
- //--------------------------------------------------------------------------
- // Configuration Descriptor
- 0x09, // bLength: Configuration Descriptor size
- USB_CONFIGURATION_DESCRIPTOR_TYPE, // bDescriptorType: Configuration
- LOBYTE(USB_PYB_CONFIG_DESC_SIZ), // wTotalLength: no of returned bytes
- HIBYTE(USB_PYB_CONFIG_DESC_SIZ),
- 0x01, // bNumInterfaces: 1 interfaces
- 0x01, // bConfigurationValue: Configuration value
- 0x04, // iConfiguration: Index of string descriptor describing the configuration
- 0x80, // bmAttributes: bus powered; 0xc0 for self powered
- 0xfa, // bMaxPower: in units of 2mA
-
- //--------------------------------------------------------------------------
- // Interface Descriptor
- 0x09, // bLength: Interface Descriptor size
- USB_INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType: interface descriptor
- 0x00, // bInterfaceNumber: Number of Interface
- 0x00, // bAlternateSetting: Alternate setting
- 0x01, // bNumEndpoints
- 0x03, // bInterfaceClass: HID Class
- 0x01, // bInterfaceSubClass: 0=no boot, 1=BOOT
- 0x02, // nInterfaceProtocol: 0=none, 1=keyboard, 2=mouse
- 0x00, // iInterface:
-
- // Descriptor of Joystick Mouse HID
- 0x09, // bLength: HID Descriptor size
- HID_DESCRIPTOR_TYPE, // bDescriptorType: HID
- 0x11, // bcdHID: HID Class Spec release number, low byte
- 0x01, // bcdHID: high byte
- 0x00, // bCountryCode: Hardware target country (0=unsupported)
- 0x01, // bNumDescriptors: Number of HID class descriptors to follow
- HID_REPORT_DESC, // bDescriptorType: report
- HID_MOUSE_REPORT_DESC_SIZE, // wItemLength: Total length of Report descriptor
- 0x00,
-
- // Endpoint IN descriptor
- 0x07, // bLength: Endpoint descriptor length
- USB_ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType: Endpoint descriptor type
- HID_IN_EP, // bEndpointAddress: IN, address of HID
- 0x03, // bmAttributes: Interrupt endpoint type
- LOBYTE(HID_IN_PACKET), // wMaxPacketSize
- HIBYTE(HID_IN_PACKET),
- 0x0a, // bInterval: polling interval, units of 1ms
-};
-
-__ALIGN_BEGIN static uint8_t HID_MOUSE_ReportDesc[HID_MOUSE_REPORT_DESC_SIZE] __ALIGN_END =
-{
- 0x05, 0x01,
- 0x09, 0x02,
- 0xA1, 0x01,
- 0x09, 0x01,
-
- 0xA1, 0x00,
- 0x05, 0x09,
- 0x19, 0x01,
- 0x29, 0x03,
-
- 0x15, 0x00,
- 0x25, 0x01,
- 0x95, 0x03,
- 0x75, 0x01,
-
- 0x81, 0x02,
- 0x95, 0x01,
- 0x75, 0x05,
- 0x81, 0x01,
-
- 0x05, 0x01,
- 0x09, 0x30,
- 0x09, 0x31,
- 0x09, 0x38,
-
- 0x15, 0x81,
- 0x25, 0x7F,
- 0x75, 0x08,
- 0x95, 0x03,
-
- 0x81, 0x06,
- 0xC0, 0x09,
- 0x3c, 0x05,
- 0xff, 0x09,
-
- 0x01, 0x15,
- 0x00, 0x25,
- 0x01, 0x75,
- 0x01, 0x95,
-
- 0x02, 0xb1,
- 0x22, 0x75,
- 0x06, 0x95,
- 0x01, 0xb1,
-
- 0x01, 0xc0
-};
-
-/**
- * @brief usbd_pyb_Init
- * Initilaize the PYB interface
- * @param pdev: device instance
- * @param cfgidx: Configuration index
- * @retval status
- */
-static uint8_t usbd_pyb_Init(void *pdev, uint8_t cfgidx) {
- // deinit first to reset
- usbd_pyb_DeInit(pdev, cfgidx);
-
- // Open EP IN
- DCD_EP_Open(pdev,
- HID_IN_EP,
- HID_IN_PACKET,
- USB_OTG_EP_INT);
-
- return USBD_OK;
-}
-
-/**
- * @brief usbd_pyb_Init
- * DeInitialize the CDC layer
- * @param pdev: device instance
- * @param cfgidx: Configuration index
- * @retval status
- */
-static uint8_t usbd_pyb_DeInit(void *pdev, uint8_t cfgidx) {
- // Close HID EP
- DCD_EP_Close(pdev, HID_IN_EP);
-
- return USBD_OK;
-}
-
-#define HID_REQ_SET_PROTOCOL (0x0B)
-#define HID_REQ_GET_PROTOCOL (0x03)
-#define HID_REQ_SET_IDLE (0x0A)
-#define HID_REQ_GET_IDLE (0x02)
-#define HID_REQ_SET_REPORT (0x09) // used?
-#define HID_REQ_GET_REPORT (0x01) // used?
-
-/**
- * @brief usbd_pyb_Setup
- * Handle the CDC specific requests
- * @param pdev: instance
- * @param req: usb requests
- * @retval status
- */
-static uint8_t usbd_pyb_Setup(void *pdev, USB_SETUP_REQ *req) {
- switch (req->bmRequest & (USB_REQ_TYPE_MASK | USB_REQ_RECIPIENT_MASK)) {
-
- // Standard Device Request ---------------------------------------------
- case (USB_REQ_TYPE_STANDARD | USB_REQ_RECIPIENT_DEVICE):
- break;
-
- // Standard Interface Request ------------------------------------------
- case (USB_REQ_TYPE_STANDARD | USB_REQ_RECIPIENT_INTERFACE):
- switch (req->bRequest) {
- case USB_REQ_GET_DESCRIPTOR: // needed for HID; SU 0x81 0x06 0x2200 0x00 request
- // wIndex & 0xff is the interface
- if ((req->wIndex & 0xff) == 0) {
- uint16_t len = 0;
- uint8_t *pbuf = NULL;
- if( req->wValue >> 8 == HID_REPORT_DESC) {
- len = MIN(HID_MOUSE_REPORT_DESC_SIZE , req->wLength);
- pbuf = HID_MOUSE_ReportDesc;
- return USBD_CtlSendData (pdev, pbuf, len);
- } else if( req->wValue >> 8 == HID_DESCRIPTOR_TYPE) {
- pbuf = usbd_pyb_CfgDesc + 0x09 + 0x09;
- len = MIN(0x09 , req->wLength);
- return USBD_CtlSendData (pdev, pbuf, len);
- }
- }
-
- case USB_REQ_GET_INTERFACE:
- // wIndex & 0xff is the interface
- if ((req->wIndex & 0xff) == 0) {
- return USBD_CtlSendData(pdev, &USBD_HID_AltSet, 1);
- }
-
- case USB_REQ_SET_INTERFACE:
- if ((uint8_t)(req->wValue) < USBD_ITF_MAX_NUM) { // TODO
- if ((req->wIndex & 0xff) == 0) {
- USBD_HID_AltSet = req->wValue;
- }
- return USBD_OK;
- }
- }
- break;
-
- // Standard Endpoint Request -------------------------------------------
- case (USB_REQ_TYPE_STANDARD | USB_REQ_RECIPIENT_ENDPOINT):
- // req->wIndex is the endpoint number, including direction
- break;
-
- // CDC Class Requests ------------------------------
- case (USB_REQ_TYPE_CLASS | USB_REQ_RECIPIENT_INTERFACE):
- // req->wIndex is the recipient interface number
- if (req->wIndex == 0) {
- // HID component
- switch (req->bRequest) {
- case HID_REQ_SET_PROTOCOL:
- USBD_HID_Protocol = req->wValue;
- return USBD_OK;
-
- case HID_REQ_GET_PROTOCOL:
- return USBD_CtlSendData(pdev, &USBD_HID_Protocol, 1);
-
- case HID_REQ_SET_IDLE:
- USBD_HID_IdleState = (req->wValue >> 8);
- return USBD_OK;
-
- case HID_REQ_GET_IDLE:
- return USBD_CtlSendData(pdev, &USBD_HID_IdleState, 1);
- }
- }
- break;
- }
-
- printf("SU %x %x %x %x\n", req->bmRequest, req->bRequest, req->wValue, req->wIndex);
-
- // invalid command
- USBD_CtlError(pdev, req);
- return USBD_FAIL;
-}
-
-/**
- * @brief usbd_pyb_DataIn
- * Data sent on non-control IN endpoint
- * @param pdev: device instance
- * @param epnum: endpoint number
- * @retval status
- */
-static uint8_t usbd_pyb_DataIn(void *pdev, uint8_t epnum) {
- switch (epnum) {
- case (HID_IN_EP & 0x7f):
- /* Ensure that the FIFO is empty before a new transfer, this condition could
- be caused by a new transfer before the end of the previous transfer */
- DCD_EP_Flush(pdev, HID_IN_EP);
- return USBD_OK;
- }
-
- printf("DI %x\n", epnum);
-
- return USBD_OK;
-}
-
-/**
- * @brief usbd_pyb_GetCfgDesc
- * Return configuration descriptor
- * @param speed : current device speed
- * @param length : pointer data length
- * @retval pointer to descriptor buffer
- */
-static uint8_t *usbd_pyb_GetCfgDesc(uint8_t speed, uint16_t *length) {
- *length = sizeof(usbd_pyb_CfgDesc);
- return usbd_pyb_CfgDesc;
-}
-
-/**
- * @brief USBD_HID_SendReport
- * Send HID Report
- * @param pdev: device instance
- * @param buff: pointer to report (4 bytes: ?, x, y, ?)
- * @retval status
- */
-uint8_t USBD_HID_SendReport(USB_OTG_CORE_HANDLE *pdev, uint8_t *report, uint16_t len) {
- if (pdev->dev.device_status == USB_OTG_CONFIGURED) {
- DCD_EP_Tx(pdev, HID_IN_EP, report, len);
- }
- return USBD_OK;
-}
diff --git a/stm/stmusbd/usbd_req.c b/stm/stmusbd/usbd_req.c
deleted file mode 100644
index 02217cdcc..000000000
--- a/stm/stmusbd/usbd_req.c
+++ /dev/null
@@ -1,868 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_req.c
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief This file provides the standard USB requests following chapter 9.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "usbd_req.h"
-#include "usbd_ioreq.h"
-#include "usbd_desc.h"
-
-
-/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
- * @{
- */
-
-
-/** @defgroup USBD_REQ
- * @brief USB standard requests module
- * @{
- */
-
-/** @defgroup USBD_REQ_Private_TypesDefinitions
- * @{
- */
-/**
- * @}
- */
-
-
-/** @defgroup USBD_REQ_Private_Defines
- * @{
- */
-
-/**
- * @}
- */
-
-
-/** @defgroup USBD_REQ_Private_Macros
- * @{
- */
-/**
- * @}
- */
-
-
-/** @defgroup USBD_REQ_Private_Variables
- * @{
- */
-extern __IO USB_OTG_DCTL_TypeDef SET_TEST_MODE;
-
-#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
- #if defined ( __ICCARM__ ) /*!< IAR Compiler */
- #pragma data_alignment=4
- #endif
-#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
-__ALIGN_BEGIN uint32_t USBD_ep_status __ALIGN_END = 0;
-
-#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
- #if defined ( __ICCARM__ ) /*!< IAR Compiler */
- #pragma data_alignment=4
- #endif
-#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
-__ALIGN_BEGIN uint32_t USBD_default_cfg __ALIGN_END = 0;
-
-#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
- #if defined ( __ICCARM__ ) /*!< IAR Compiler */
- #pragma data_alignment=4
- #endif
-#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
-__ALIGN_BEGIN uint32_t USBD_cfg_status __ALIGN_END = 0;
-
-#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
- #if defined ( __ICCARM__ ) /*!< IAR Compiler */
- #pragma data_alignment=4
- #endif
-#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
-__ALIGN_BEGIN uint8_t USBD_StrDesc[USB_MAX_STR_DESC_SIZ] __ALIGN_END ;
-/**
- * @}
- */
-
-
-/** @defgroup USBD_REQ_Private_FunctionPrototypes
- * @{
- */
-static void USBD_GetDescriptor(USB_OTG_CORE_HANDLE *pdev,
- USB_SETUP_REQ *req);
-
-static void USBD_SetAddress(USB_OTG_CORE_HANDLE *pdev,
- USB_SETUP_REQ *req);
-
-static void USBD_SetConfig(USB_OTG_CORE_HANDLE *pdev,
- USB_SETUP_REQ *req);
-
-static void USBD_GetConfig(USB_OTG_CORE_HANDLE *pdev,
- USB_SETUP_REQ *req);
-
-static void USBD_GetStatus(USB_OTG_CORE_HANDLE *pdev,
- USB_SETUP_REQ *req);
-
-static void USBD_SetFeature(USB_OTG_CORE_HANDLE *pdev,
- USB_SETUP_REQ *req);
-
-static void USBD_ClrFeature(USB_OTG_CORE_HANDLE *pdev,
- USB_SETUP_REQ *req);
-
-static uint8_t USBD_GetLen(const char *buf);
-/**
- * @}
- */
-
-
-/** @defgroup USBD_REQ_Private_Functions
- * @{
- */
-
-
-/**
-* @brief USBD_StdDevReq
-* Handle standard usb device requests
-* @param pdev: device instance
-* @param req: usb request
-* @retval status
-*/
-USBD_Status USBD_StdDevReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req)
-{
- USBD_Status ret = USBD_OK;
-
- switch (req->bRequest)
- {
- case USB_REQ_GET_DESCRIPTOR:
-
- USBD_GetDescriptor (pdev, req) ;
- break;
-
- case USB_REQ_SET_ADDRESS:
- USBD_SetAddress(pdev, req);
- break;
-
- case USB_REQ_SET_CONFIGURATION:
- USBD_SetConfig (pdev , req);
- break;
-
- case USB_REQ_GET_CONFIGURATION:
- USBD_GetConfig (pdev , req);
- break;
-
- case USB_REQ_GET_STATUS:
- USBD_GetStatus (pdev , req);
- break;
-
-
- case USB_REQ_SET_FEATURE:
- USBD_SetFeature (pdev , req);
- break;
-
- case USB_REQ_CLEAR_FEATURE:
- USBD_ClrFeature (pdev , req);
- break;
-
- default:
- USBD_CtlError(pdev , req);
- break;
- }
-
- return ret;
-}
-
-/**
-* @brief USBD_StdItfReq
-* Handle standard usb interface requests
-* @param pdev: USB OTG device instance
-* @param req: usb request
-* @retval status
-*/
-USBD_Status USBD_StdItfReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req)
-{
- USBD_Status ret = USBD_OK;
-
- switch (pdev->dev.device_status)
- {
- case USB_OTG_CONFIGURED:
-
- if (LOBYTE(req->wIndex) <= USBD_ITF_MAX_NUM)
- {
- pdev->dev.class_cb->Setup (pdev, req);
-
- if((req->wLength == 0)&& (ret == USBD_OK))
- {
- USBD_CtlSendStatus(pdev);
- }
- }
- else
- {
- USBD_CtlError(pdev , req);
- }
- break;
-
- default:
- USBD_CtlError(pdev , req);
- break;
- }
- return ret;
-}
-
-/**
-* @brief USBD_StdEPReq
-* Handle standard usb endpoint requests
-* @param pdev: USB OTG device instance
-* @param req: usb request
-* @retval status
-*/
-USBD_Status USBD_StdEPReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req)
-{
-
- uint8_t ep_addr;
- USBD_Status ret = USBD_OK;
-
- ep_addr = LOBYTE(req->wIndex);
-
- switch (req->bRequest)
- {
-
- case USB_REQ_SET_FEATURE :
-
- switch (pdev->dev.device_status)
- {
- case USB_OTG_ADDRESSED:
- if ((ep_addr != 0x00) && (ep_addr != 0x80))
- {
- DCD_EP_Stall(pdev , ep_addr);
- }
- break;
-
- case USB_OTG_CONFIGURED:
- if (req->wValue == USB_FEATURE_EP_HALT)
- {
- if ((ep_addr != 0x00) && (ep_addr != 0x80))
- {
- DCD_EP_Stall(pdev , ep_addr);
-
- }
- }
- pdev->dev.class_cb->Setup (pdev, req);
- USBD_CtlSendStatus(pdev);
-
- break;
-
- default:
- USBD_CtlError(pdev , req);
- break;
- }
- break;
-
- case USB_REQ_CLEAR_FEATURE :
-
- switch (pdev->dev.device_status)
- {
- case USB_OTG_ADDRESSED:
- if ((ep_addr != 0x00) && (ep_addr != 0x80))
- {
- DCD_EP_Stall(pdev , ep_addr);
- }
- break;
-
- case USB_OTG_CONFIGURED:
- if (req->wValue == USB_FEATURE_EP_HALT)
- {
- if ((ep_addr != 0x00) && (ep_addr != 0x80))
- {
- DCD_EP_ClrStall(pdev , ep_addr);
- pdev->dev.class_cb->Setup (pdev, req);
- }
- USBD_CtlSendStatus(pdev);
- }
- break;
-
- default:
- USBD_CtlError(pdev , req);
- break;
- }
- break;
-
- case USB_REQ_GET_STATUS:
- switch (pdev->dev.device_status)
- {
- case USB_OTG_ADDRESSED:
- if ((ep_addr != 0x00) && (ep_addr != 0x80))
- {
- DCD_EP_Stall(pdev , ep_addr);
- }
- break;
-
- case USB_OTG_CONFIGURED:
-
-
- if ((ep_addr & 0x80)== 0x80)
- {
- if(pdev->dev.in_ep[ep_addr & 0x7F].is_stall)
- {
- USBD_ep_status = 0x0001;
- }
- else
- {
- USBD_ep_status = 0x0000;
- }
- }
- else if ((ep_addr & 0x80)== 0x00)
- {
- if(pdev->dev.out_ep[ep_addr].is_stall)
- {
- USBD_ep_status = 0x0001;
- }
-
- else
- {
- USBD_ep_status = 0x0000;
- }
- }
- USBD_CtlSendData (pdev,
- (uint8_t *)&USBD_ep_status,
- 2);
- break;
-
- default:
- USBD_CtlError(pdev , req);
- break;
- }
- break;
-
- default:
- break;
- }
- return ret;
-}
-/**
-* @brief USBD_GetDescriptor
-* Handle Get Descriptor requests
-* @param pdev: device instance
-* @param req: usb request
-* @retval status
-*/
-static void USBD_GetDescriptor(USB_OTG_CORE_HANDLE *pdev,
- USB_SETUP_REQ *req)
-{
- uint16_t len;
- uint8_t *pbuf;
-
-
- switch (req->wValue >> 8)
- {
- case USB_DESC_TYPE_DEVICE:
- pbuf = pdev->dev.usr_device->GetDeviceDescriptor(pdev->cfg.speed, &len);
- if ((req->wLength == 64) ||( pdev->dev.device_status == USB_OTG_DEFAULT))
- {
- len = 8;
- }
- break;
-
- case USB_DESC_TYPE_CONFIGURATION:
- pbuf = (uint8_t *)pdev->dev.class_cb->GetConfigDescriptor(pdev->cfg.speed, &len);
-#ifdef USB_OTG_HS_CORE
- if((pdev->cfg.speed == USB_OTG_SPEED_FULL )&&
- (pdev->cfg.phy_itface == USB_OTG_ULPI_PHY))
- {
- pbuf = (uint8_t *)pdev->dev.class_cb->GetOtherConfigDescriptor(pdev->cfg.speed, &len);
- }
-#endif
- pbuf[1] = USB_DESC_TYPE_CONFIGURATION;
- pdev->dev.pConfig_descriptor = pbuf;
- break;
-
- case USB_DESC_TYPE_STRING:
- switch ((uint8_t)(req->wValue))
- {
- case USBD_IDX_LANGID_STR:
- pbuf = pdev->dev.usr_device->GetLangIDStrDescriptor(pdev->cfg.speed, &len);
- break;
-
- case USBD_IDX_MFC_STR:
- pbuf = pdev->dev.usr_device->GetManufacturerStrDescriptor(pdev->cfg.speed, &len);
- break;
-
- case USBD_IDX_PRODUCT_STR:
- pbuf = pdev->dev.usr_device->GetProductStrDescriptor(pdev->cfg.speed, &len);
- break;
-
- case USBD_IDX_SERIAL_STR:
- pbuf = pdev->dev.usr_device->GetSerialStrDescriptor(pdev->cfg.speed, &len);
- break;
-
- case USBD_IDX_CONFIG_STR:
- pbuf = pdev->dev.usr_device->GetConfigurationStrDescriptor(pdev->cfg.speed, &len);
- break;
-
- case USBD_IDX_INTERFACE_STR:
- pbuf = pdev->dev.usr_device->GetInterfaceStrDescriptor(pdev->cfg.speed, &len);
- break;
-
- default:
-#ifdef USB_SUPPORT_USER_STRING_DESC
- pbuf = pdev->dev.class_cb->GetUsrStrDescriptor(pdev->cfg.speed, (req->wValue) , &len);
- break;
-#else
- USBD_CtlError(pdev , req);
- return;
-#endif /* USBD_CtlError(pdev , req); */
- }
- break;
- case USB_DESC_TYPE_DEVICE_QUALIFIER:
-#ifdef USB_OTG_HS_CORE
- if(pdev->cfg.speed == USB_OTG_SPEED_HIGH )
- {
-
- pbuf = (uint8_t *)pdev->dev.class_cb->GetConfigDescriptor(pdev->cfg.speed, &len);
-
- USBD_DeviceQualifierDesc[4]= pbuf[14];
- USBD_DeviceQualifierDesc[5]= pbuf[15];
- USBD_DeviceQualifierDesc[6]= pbuf[16];
-
- pbuf = USBD_DeviceQualifierDesc;
- len = USB_LEN_DEV_QUALIFIER_DESC;
- break;
- }
- else
- {
- USBD_CtlError(pdev , req);
- return;
- }
-#else
- USBD_CtlError(pdev , req);
- return;
-#endif
-
- case USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION:
-#ifdef USB_OTG_HS_CORE
-
- if(pdev->cfg.speed == USB_OTG_SPEED_HIGH )
- {
- pbuf = (uint8_t *)pdev->dev.class_cb->GetOtherConfigDescriptor(pdev->cfg.speed, &len);
- pbuf[1] = USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION;
- break;
- }
- else
- {
- USBD_CtlError(pdev , req);
- return;
- }
-#else
- USBD_CtlError(pdev , req);
- return;
-#endif
-
-
- default:
- USBD_CtlError(pdev , req);
- return;
- }
-
- if((len != 0)&& (req->wLength != 0))
- {
-
- len = MIN(len , req->wLength);
-
- USBD_CtlSendData (pdev,
- pbuf,
- len);
- }
-
-}
-
-/**
-* @brief USBD_SetAddress
-* Set device address
-* @param pdev: device instance
-* @param req: usb request
-* @retval status
-*/
-static void USBD_SetAddress(USB_OTG_CORE_HANDLE *pdev,
- USB_SETUP_REQ *req)
-{
- uint8_t dev_addr;
-
- if ((req->wIndex == 0) && (req->wLength == 0))
- {
- dev_addr = (uint8_t)(req->wValue) & 0x7F;
-
- if (pdev->dev.device_status == USB_OTG_CONFIGURED)
- {
- USBD_CtlError(pdev , req);
- }
- else
- {
- pdev->dev.device_address = dev_addr;
- DCD_EP_SetAddress(pdev, dev_addr);
- USBD_CtlSendStatus(pdev);
-
- if (dev_addr != 0)
- {
- pdev->dev.device_status = USB_OTG_ADDRESSED;
- }
- else
- {
- pdev->dev.device_status = USB_OTG_DEFAULT;
- }
- }
- }
- else
- {
- USBD_CtlError(pdev , req);
- }
-}
-
-/**
-* @brief USBD_SetConfig
-* Handle Set device configuration request
-* @param pdev: device instance
-* @param req: usb request
-* @retval status
-*/
-static void USBD_SetConfig(USB_OTG_CORE_HANDLE *pdev,
- USB_SETUP_REQ *req)
-{
-
- static uint8_t cfgidx;
-
- cfgidx = (uint8_t)(req->wValue);
-
- if (cfgidx > USBD_CFG_MAX_NUM )
- {
- USBD_CtlError(pdev , req);
- }
- else
- {
- switch (pdev->dev.device_status)
- {
- case USB_OTG_ADDRESSED:
- if (cfgidx)
- {
- pdev->dev.device_config = cfgidx;
- pdev->dev.device_status = USB_OTG_CONFIGURED;
- USBD_SetCfg(pdev , cfgidx);
- USBD_CtlSendStatus(pdev);
- }
- else
- {
- USBD_CtlSendStatus(pdev);
- }
- break;
-
- case USB_OTG_CONFIGURED:
- if (cfgidx == 0)
- {
- pdev->dev.device_status = USB_OTG_ADDRESSED;
- pdev->dev.device_config = cfgidx;
- USBD_ClrCfg(pdev , cfgidx);
- USBD_CtlSendStatus(pdev);
-
- }
- else if (cfgidx != pdev->dev.device_config)
- {
- /* Clear old configuration */
- USBD_ClrCfg(pdev , pdev->dev.device_config);
-
- /* set new configuration */
- pdev->dev.device_config = cfgidx;
- USBD_SetCfg(pdev , cfgidx);
- USBD_CtlSendStatus(pdev);
- }
- else
- {
- USBD_CtlSendStatus(pdev);
- }
- break;
-
- default:
- USBD_CtlError(pdev , req);
- break;
- }
- }
-}
-
-/**
-* @brief USBD_GetConfig
-* Handle Get device configuration request
-* @param pdev: device instance
-* @param req: usb request
-* @retval status
-*/
-static void USBD_GetConfig(USB_OTG_CORE_HANDLE *pdev,
- USB_SETUP_REQ *req)
-{
-
- if (req->wLength != 1)
- {
- USBD_CtlError(pdev , req);
- }
- else
- {
- switch (pdev->dev.device_status )
- {
- case USB_OTG_ADDRESSED:
-
- USBD_CtlSendData (pdev,
- (uint8_t *)&USBD_default_cfg,
- 1);
- break;
-
- case USB_OTG_CONFIGURED:
-
- USBD_CtlSendData (pdev,
- &pdev->dev.device_config,
- 1);
- break;
-
- default:
- USBD_CtlError(pdev , req);
- break;
- }
- }
-}
-
-/**
-* @brief USBD_GetStatus
-* Handle Get Status request
-* @param pdev: device instance
-* @param req: usb request
-* @retval status
-*/
-static void USBD_GetStatus(USB_OTG_CORE_HANDLE *pdev,
- USB_SETUP_REQ *req)
-{
-
-
- switch (pdev->dev.device_status)
- {
- case USB_OTG_ADDRESSED:
- case USB_OTG_CONFIGURED:
-
-#ifdef USBD_SELF_POWERED
- USBD_cfg_status = USB_CONFIG_SELF_POWERED;
-#else
- USBD_cfg_status = 0x00;
-#endif
-
- if (pdev->dev.DevRemoteWakeup)
- {
- USBD_cfg_status |= USB_CONFIG_REMOTE_WAKEUP;
- }
-
- USBD_CtlSendData (pdev,
- (uint8_t *)&USBD_cfg_status,
- 2);
- break;
-
- default :
- USBD_CtlError(pdev , req);
- break;
- }
-}
-
-
-/**
-* @brief USBD_SetFeature
-* Handle Set device feature request
-* @param pdev: device instance
-* @param req: usb request
-* @retval status
-*/
-static void USBD_SetFeature(USB_OTG_CORE_HANDLE *pdev,
- USB_SETUP_REQ *req)
-{
-
- USB_OTG_DCTL_TypeDef dctl;
- uint8_t test_mode = 0;
-
- if (req->wValue == USB_FEATURE_REMOTE_WAKEUP)
- {
- pdev->dev.DevRemoteWakeup = 1;
- pdev->dev.class_cb->Setup (pdev, req);
- USBD_CtlSendStatus(pdev);
- }
-
- else if ((req->wValue == USB_FEATURE_TEST_MODE) &&
- ((req->wIndex & 0xFF) == 0))
- {
- dctl.d32 = USB_OTG_READ_REG32(&pdev->regs.DREGS->DCTL);
-
- test_mode = req->wIndex >> 8;
- switch (test_mode)
- {
- case 1: // TEST_J
- dctl.b.tstctl = 1;
- break;
-
- case 2: // TEST_K
- dctl.b.tstctl = 2;
- break;
-
- case 3: // TEST_SE0_NAK
- dctl.b.tstctl = 3;
- break;
-
- case 4: // TEST_PACKET
- dctl.b.tstctl = 4;
- break;
-
- case 5: // TEST_FORCE_ENABLE
- dctl.b.tstctl = 5;
- break;
- }
- SET_TEST_MODE = dctl;
- pdev->dev.test_mode = 1;
- USBD_CtlSendStatus(pdev);
- }
-
-}
-
-
-/**
-* @brief USBD_ClrFeature
-* Handle clear device feature request
-* @param pdev: device instance
-* @param req: usb request
-* @retval status
-*/
-static void USBD_ClrFeature(USB_OTG_CORE_HANDLE *pdev,
- USB_SETUP_REQ *req)
-{
- switch (pdev->dev.device_status)
- {
- case USB_OTG_ADDRESSED:
- case USB_OTG_CONFIGURED:
- if (req->wValue == USB_FEATURE_REMOTE_WAKEUP)
- {
- pdev->dev.DevRemoteWakeup = 0;
- pdev->dev.class_cb->Setup (pdev, req);
- USBD_CtlSendStatus(pdev);
- }
- break;
-
- default :
- USBD_CtlError(pdev , req);
- break;
- }
-}
-
-/**
-* @brief USBD_ParseSetupRequest
-* Copy buffer into setup structure
-* @param pdev: device instance
-* @param req: usb request
-* @retval None
-*/
-
-void USBD_ParseSetupRequest( USB_OTG_CORE_HANDLE *pdev,
- USB_SETUP_REQ *req)
-{
- req->bmRequest = *(uint8_t *) (pdev->dev.setup_packet);
- req->bRequest = *(uint8_t *) (pdev->dev.setup_packet + 1);
- req->wValue = SWAPBYTE (pdev->dev.setup_packet + 2);
- req->wIndex = SWAPBYTE (pdev->dev.setup_packet + 4);
- req->wLength = SWAPBYTE (pdev->dev.setup_packet + 6);
-
- pdev->dev.in_ep[0].ctl_data_len = req->wLength ;
- pdev->dev.device_state = USB_OTG_EP0_SETUP;
-}
-
-/**
-* @brief USBD_CtlError
-* Handle USB low level Error
-* @param pdev: device instance
-* @param req: usb request
-* @retval None
-*/
-
-void USBD_CtlError( USB_OTG_CORE_HANDLE *pdev,
- USB_SETUP_REQ *req)
-{
-
- DCD_EP_Stall(pdev , 0x80);
- DCD_EP_Stall(pdev , 0);
- USB_OTG_EP0_OutStart(pdev);
-}
-
-
-/**
- * @brief USBD_GetString
- * Convert Ascii string into unicode one
- * @param desc : descriptor buffer
- * @param unicode : Formatted string buffer (unicode)
- * @param len : descriptor length
- * @retval None
- */
-void USBD_GetString(const char *desc, uint8_t *unicode, uint16_t *len)
-{
- uint8_t idx = 0;
-
- if (desc != NULL)
- {
- *len = USBD_GetLen(desc) * 2 + 2;
- unicode[idx++] = *len;
- unicode[idx++] = USB_DESC_TYPE_STRING;
-
- while (*desc != NULL)
- {
- unicode[idx++] = *desc++;
- unicode[idx++] = 0x00;
- }
- }
-}
-
-/**
- * @brief USBD_GetLen
- * return the string length
- * @param buf : pointer to the ascii string buffer
- * @retval string length
- */
-static uint8_t USBD_GetLen(const char *buf)
-{
- uint8_t len = 0;
-
- while (*buf != NULL)
- {
- len++;
- buf++;
- }
-
- return len;
-}
-/**
- * @}
- */
-
-
-/**
- * @}
- */
-
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/stm/stmusbd/usbd_req.h b/stm/stmusbd/usbd_req.h
deleted file mode 100644
index 4853186c0..000000000
--- a/stm/stmusbd/usbd_req.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_req.h
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief header file for the usbd_req.c file
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-
-#ifndef __USB_REQUEST_H_
-#define __USB_REQUEST_H_
-
-/* Includes ------------------------------------------------------------------*/
-#include "usbd_def.h"
-#include "usbd_core.h"
-#include "usbd_conf.h"
-
-
-/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
- * @{
- */
-
-/** @defgroup USBD_REQ
- * @brief header file for the usbd_ioreq.c file
- * @{
- */
-
-/** @defgroup USBD_REQ_Exported_Defines
- * @{
- */
-/**
- * @}
- */
-
-
-/** @defgroup USBD_REQ_Exported_Types
- * @{
- */
-/**
- * @}
- */
-
-
-
-/** @defgroup USBD_REQ_Exported_Macros
- * @{
- */
-/**
- * @}
- */
-
-/** @defgroup USBD_REQ_Exported_Variables
- * @{
- */
-/**
- * @}
- */
-
-/** @defgroup USBD_REQ_Exported_FunctionsPrototype
- * @{
- */
-
-USBD_Status USBD_StdDevReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req);
-USBD_Status USBD_StdItfReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req);
-USBD_Status USBD_StdEPReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req);
-void USBD_ParseSetupRequest( USB_OTG_CORE_HANDLE *pdev,
- USB_SETUP_REQ *req);
-
-void USBD_CtlError( USB_OTG_CORE_HANDLE *pdev,
- USB_SETUP_REQ *req);
-
-void USBD_GetString(const char *desc, uint8_t *unicode, uint16_t *len);
-/**
- * @}
- */
-
-#endif /* __USB_REQUEST_H_ */
-
-/**
- * @}
- */
-
-/**
-* @}
-*/
-
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/stm/stmusbd/usbd_storage_msd.c b/stm/stmusbd/usbd_storage_msd.c
deleted file mode 100644
index d8650280c..000000000
--- a/stm/stmusbd/usbd_storage_msd.c
+++ /dev/null
@@ -1,363 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_storage_msd.c
- * @author MCD application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief This file provides the disk operations functions.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Heavily modified by dpgeorge for Micro Python.
- *
- ******************************************************************************
- */
-
-#include "usbd_msc_mem.h"
-#include "usb_conf.h"
-#include "usbd_storage_msd.h"
-
-#include "misc.h"
-#include "storage.h"
-#include "diskio.h"
-#include "sdcard.h"
-
-/******************************************************************************/
-// Callback functions for when the internal flash is the mass storage device
-
-static const int8_t FLASH_STORAGE_Inquirydata[] = { // 36 bytes
- /* LUN 0 */
- 0x00,
- 0x00, // 0x00 for a fixed drive, 0x80 for a removable drive
- 0x02,
- 0x02,
- (USBD_STD_INQUIRY_LENGTH - 5),
- 0x00,
- 0x00,
- 0x00,
- 'S', 'T', 'M', ' ', ' ', ' ', ' ', ' ', /* Manufacturer : 8 bytes */
- 'm', 'i', 'c', 'r', 'o', 'S', 'D', ' ', /* Product : 16 Bytes */
- 'F', 'l', 'a', 's', 'h', ' ', ' ', ' ',
- '1', '.', '0' ,'0', /* Version : 4 Bytes */
-};
-
-/**
- * @brief Initialize the storage medium
- * @param lun : logical unit number
- * @retval Status
- */
-int8_t FLASH_STORAGE_Init(uint8_t lun) {
- storage_init();
- return 0;
-}
-
-/**
- * @brief return medium capacity and block size
- * @param lun : logical unit number
- * @param block_num : number of physical block
- * @param block_size : size of a physical block
- * @retval Status
- */
-int8_t FLASH_STORAGE_GetCapacity(uint8_t lun, uint32_t *block_num, uint32_t *block_size) {
- *block_size = storage_get_block_size();
- *block_num = storage_get_block_count();
- return 0;
-}
-
-/**
- * @brief check whether the medium is ready
- * @param lun : logical unit number
- * @retval Status
- */
-int8_t FLASH_STORAGE_IsReady(uint8_t lun) {
- return 0;
-}
-
-/**
- * @brief check whether the medium is write-protected
- * @param lun : logical unit number
- * @retval Status
- */
-int8_t FLASH_STORAGE_IsWriteProtected(uint8_t lun) {
- return 0;
-}
-
-/**
- * @brief Read data from the medium
- * @param lun : logical unit number
- * @param buf : Pointer to the buffer to save data
- * @param blk_addr : address of 1st block to be read
- * @param blk_len : nmber of blocks to be read
- * @retval Status
- */
-int8_t FLASH_STORAGE_Read(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len) {
- disk_read(0, buf, blk_addr, blk_len);
- /*
- for (int i = 0; i < blk_len; i++) {
- if (!storage_read_block(buf + i * FLASH_BLOCK_SIZE, blk_addr + i)) {
- return -1;
- }
- }
- */
- return 0;
-}
-
-/**
- * @brief Write data to the medium
- * @param lun : logical unit number
- * @param buf : Pointer to the buffer to write from
- * @param blk_addr : address of 1st block to be written
- * @param blk_len : nmber of blocks to be read
- * @retval Status
- */
-int8_t FLASH_STORAGE_Write (uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len) {
- disk_write(0, buf, blk_addr, blk_len);
- /*
- for (int i = 0; i < blk_len; i++) {
- if (!storage_write_block(buf + i * FLASH_BLOCK_SIZE, blk_addr + i)) {
- return -1;
- }
- }
- */
- storage_flush(); // XXX hack for now so that the cache is always flushed
- return 0;
-}
-
-/**
- * @brief Return number of supported logical unit
- * @param None
- * @retval number of logical unit
- */
-int8_t FLASH_STORAGE_GetMaxLun(void) {
- return 0;
-}
-
-static const USBD_STORAGE_cb_TypeDef USBD_FLASH_STORAGE_fops = {
- FLASH_STORAGE_Init,
- FLASH_STORAGE_GetCapacity,
- FLASH_STORAGE_IsReady,
- FLASH_STORAGE_IsWriteProtected,
- FLASH_STORAGE_Read,
- FLASH_STORAGE_Write,
- FLASH_STORAGE_GetMaxLun,
- (int8_t *)FLASH_STORAGE_Inquirydata,
-};
-
-/******************************************************************************/
-// Callback functions for when the SD card is the mass storage device
-
-static const int8_t SDCARD_STORAGE_Inquirydata[] = { // 36 bytes
- /* LUN 0 */
- 0x00,
- 0x80, // 0x00 for a fixed drive, 0x80 for a removable drive
- 0x02,
- 0x02,
- (USBD_STD_INQUIRY_LENGTH - 5),
- 0x00,
- 0x00,
- 0x00,
- 'S', 'T', 'M', ' ', ' ', ' ', ' ', ' ', /* Manufacturer : 8 bytes */
- 'm', 'i', 'c', 'r', 'o', 'S', 'D', ' ', /* Product : 16 Bytes */
- 'S', 'D', ' ', 'c', 'a', 'r', 'd', ' ',
- '1', '.', '0' ,'0', /* Version : 4 Bytes */
-};
-
-/**
- * @brief Initialize the storage medium
- * @param lun : logical unit number
- * @retval Status
- */
-int8_t SDCARD_STORAGE_Init(uint8_t lun) {
- /*
-#ifndef USE_STM3210C_EVAL
- NVIC_InitTypeDef NVIC_InitStructure;
- NVIC_InitStructure.NVIC_IRQChannel = SDIO_IRQn;
- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority =0;
- NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
- NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
- NVIC_Init(&NVIC_InitStructure);
-#endif
- if( SD_Init() != 0)
- {
- return (-1);
- }
- */
- if (!sdcard_power_on()) {
- return -1;
- }
-
- return 0;
-
-}
-
-/**
- * @brief return medium capacity and block size
- * @param lun : logical unit number
- * @param block_num : number of physical block
- * @param block_size : size of a physical block
- * @retval Status
- */
-int8_t SDCARD_STORAGE_GetCapacity(uint8_t lun, uint32_t *block_num, uint32_t *block_size) {
-/*
-#ifdef USE_STM3210C_EVAL
- SD_CardInfo SDCardInfo;
- SD_GetCardInfo(&SDCardInfo);
-#else
- if(SD_GetStatus() != 0 ) {
- return (-1);
- }
-#endif
- */
-
- *block_size = SDCARD_BLOCK_SIZE;
- *block_num = sdcard_get_capacity_in_bytes() / SDCARD_BLOCK_SIZE;
-
- return 0;
-}
-
-/**
- * @brief check whether the medium is ready
- * @param lun : logical unit number
- * @retval Status
- */
-int8_t SDCARD_STORAGE_IsReady(uint8_t lun) {
- /*
-#ifndef USE_STM3210C_EVAL
-
- static int8_t last_status = 0;
-
- if(last_status < 0)
- {
- SD_Init();
- last_status = 0;
- }
-
- if(SD_GetStatus() != 0)
- {
- last_status = -1;
- return (-1);
- }
-#else
- if( SD_Init() != 0)
- {
- return (-1);
- }
-#endif
-*/
- return 0;
-}
-
-/**
- * @brief check whether the medium is write-protected
- * @param lun : logical unit number
- * @retval Status
- */
-int8_t SDCARD_STORAGE_IsWriteProtected(uint8_t lun) {
- return 0;
-}
-
-/**
- * @brief Read data from the medium
- * @param lun : logical unit number
- * @param buf : Pointer to the buffer to save data
- * @param blk_addr : address of 1st block to be read
- * @param blk_len : nmber of blocks to be read
- * @retval Status
- */
-int8_t SDCARD_STORAGE_Read(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len) {
- // TODO replace with call to sdcard_read_multi_blocks
- for (int i = 0; i < blk_len; i++) {
- if (!sdcard_read_block(buf + i * SDCARD_BLOCK_SIZE, blk_addr + i)) {
- return -1;
- }
- }
- /*
- if (SD_ReadMultiBlocks(buf, blk_addr * 512, 512, blk_len) != 0) {
- return -1;
- }
-#ifndef USE_STM3210C_EVAL
- SD_WaitReadOperation();
- while (SD_GetStatus() != SD_TRANSFER_OK);
-#endif
-*/
- return 0;
-}
-
-/**
- * @brief Write data to the medium
- * @param lun : logical unit number
- * @param buf : Pointer to the buffer to write from
- * @param blk_addr : address of 1st block to be written
- * @param blk_len : nmber of blocks to be read
- * @retval Status
- */
-int8_t SDCARD_STORAGE_Write(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len) {
- // TODO replace with call to sdcard_write_multi_blocks
- for (int i = 0; i < blk_len; i++) {
- if (!sdcard_write_block(buf + i * SDCARD_BLOCK_SIZE, blk_addr + i)) {
- return -1;
- }
- }
- /*
- if( SD_WriteMultiBlocks (buf, blk_addr * 512, 512, blk_len) != 0) {
- return -1;
- }
-#ifndef USE_STM3210C_EVAL
- SD_WaitWriteOperation();
- while (SD_GetStatus() != SD_TRANSFER_OK);
-#endif
-*/
- return 0;
-}
-
-/**
- * @brief Return number of supported logical unit
- * @param None
- * @retval number of logical unit
- */
-int8_t SDCARD_STORAGE_GetMaxLun(void) {
- return 0;
-}
-
-static const USBD_STORAGE_cb_TypeDef USBD_SDCARD_STORAGE_fops = {
- SDCARD_STORAGE_Init,
- SDCARD_STORAGE_GetCapacity,
- SDCARD_STORAGE_IsReady,
- SDCARD_STORAGE_IsWriteProtected,
- SDCARD_STORAGE_Read,
- SDCARD_STORAGE_Write,
- SDCARD_STORAGE_GetMaxLun,
- (int8_t *)SDCARD_STORAGE_Inquirydata,
-};
-
-/******************************************************************************/
-// Callback functions for when the SD card is the mass storage device
-
-// default to flash as the storage device
-USBD_STORAGE_cb_TypeDef *USBD_STORAGE_fops = (USBD_STORAGE_cb_TypeDef*)&USBD_FLASH_STORAGE_fops;
-
-void usbd_storage_select_medium(usbd_storage_medium_kind_t medium_kind) {
- switch (medium_kind) {
- case USBD_STORAGE_MEDIUM_FLASH:
- USBD_STORAGE_fops = (USBD_STORAGE_cb_TypeDef*)&USBD_FLASH_STORAGE_fops;
- break;
-
- case USBD_STORAGE_MEDIUM_SDCARD:
- USBD_STORAGE_fops = (USBD_STORAGE_cb_TypeDef*)&USBD_SDCARD_STORAGE_fops;
- break;
- }
-}
diff --git a/stm/stmusbd/usbd_storage_msd.h b/stm/stmusbd/usbd_storage_msd.h
deleted file mode 100644
index fac7b0469..000000000
--- a/stm/stmusbd/usbd_storage_msd.h
+++ /dev/null
@@ -1,6 +0,0 @@
-typedef enum {
- USBD_STORAGE_MEDIUM_FLASH,
- USBD_STORAGE_MEDIUM_SDCARD,
-} usbd_storage_medium_kind_t;
-
-void usbd_storage_select_medium(usbd_storage_medium_kind_t medium_kind);
diff --git a/stm/stmusbd/usbd_usr.c b/stm/stmusbd/usbd_usr.c
deleted file mode 100644
index daa2ddbcb..000000000
--- a/stm/stmusbd/usbd_usr.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_usr.c
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief This file includes the user application layer
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-#include "usbd_usr.h"
-#include "usbd_ioreq.h"
-
-USBD_Usr_cb_TypeDef USR_cb = {
- USBD_USR_Init,
- USBD_USR_DeviceReset,
- USBD_USR_DeviceConfigured,
- USBD_USR_DeviceSuspended,
- USBD_USR_DeviceResumed,
- USBD_USR_DeviceConnected,
- USBD_USR_DeviceDisconnected,
-};
-
-/**
-* @brief USBD_USR_Init
-* Displays the message on LCD for host lib initialization
-* @param None
-* @retval None
-*/
-void USBD_USR_Init() {
- //printf("USB OTG FS\n");
- //printf("USB device start\n");
-}
-
-/**
-* @brief USBD_USR_DeviceReset
-* Displays the message on LCD on device Reset Event
-* @param speed : device speed
-* @retval None
-*/
-void USBD_USR_DeviceReset(uint8_t speed) {
- //printf("USB reset %d\n", speed);
-}
-
-/**
-* @brief USBD_USR_DeviceConfigured
-* Displays the message on LCD on device configuration Event
-* @param None
-* @retval Staus
-*/
-void USBD_USR_DeviceConfigured() {
- //printf("USB dev config\n");
-}
-
-/**
-* @brief USBD_USR_DeviceSuspended
-* Displays the message on LCD on device suspend Event
-* @param None
-* @retval None
-*/
-void USBD_USR_DeviceSuspended() {
- //printf("USB dev suspend\n");
-}
-
-/**
-* @brief USBD_USR_DeviceResumed
-* Displays the message on LCD on device resume Event
-* @param None
-* @retval None
-*/
-void USBD_USR_DeviceResumed() {
- //printf("USB dev resume\n");
-}
-
-
-/**
-* @brief USBD_USR_DeviceConnected
-* Displays the message on LCD on device connection Event
-* @param None
-* @retval Staus
-*/
-void USBD_USR_DeviceConnected() {
- //printf("USB dev connect\n");
-}
-
-
-/**
-* @brief USBD_USR_DeviceDisonnected
-* Displays the message on LCD on device disconnection Event
-* @param None
-* @retval Staus
-*/
-void USBD_USR_DeviceDisconnected() {
- //printf("USB dev disconn\n");
-}
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/stm/stmusbd/usbd_usr.h b/stm/stmusbd/usbd_usr.h
deleted file mode 100644
index bd5ff3e2e..000000000
--- a/stm/stmusbd/usbd_usr.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- ******************************************************************************
- * @file usbd_usr.h
- * @author MCD Application Team
- * @version V1.1.0
- * @date 19-March-2012
- * @brief Header file for usbd_usr.c
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __USBD_USR_H__
-#define __USBD_USR_H__
-
-/* Includes ------------------------------------------------------------------*/
-#include "usbd_core.h"
-
-
-/** @addtogroup USBD_USER
- * @{
- */
-
-/** @addtogroup USBD_MSC_DEMO_USER_CALLBACKS
- * @{
- */
-
-/** @defgroup USBD_USR
- * @brief This file is the Header file for usbd_usr.c
- * @{
- */
-
-
-/** @defgroup USBD_USR_Exported_Types
- * @{
- */
-
-extern USBD_Usr_cb_TypeDef USR_cb;
-extern USBD_Usr_cb_TypeDef USR_FS_cb;
-extern USBD_Usr_cb_TypeDef USR_HS_cb;
-
-
-
-/**
- * @}
- */
-
-
-
-/** @defgroup USBD_USR_Exported_Defines
- * @{
- */
-
-/**
- * @}
- */
-
-/** @defgroup USBD_USR_Exported_Macros
- * @{
- */
-/**
- * @}
- */
-
-/** @defgroup USBD_USR_Exported_Variables
- * @{
- */
-
-void USBD_USR_Init(void);
-void USBD_USR_DeviceReset (uint8_t speed);
-void USBD_USR_DeviceConfigured (void);
-void USBD_USR_DeviceSuspended(void);
-void USBD_USR_DeviceResumed(void);
-
-void USBD_USR_DeviceConnected(void);
-void USBD_USR_DeviceDisconnected(void);
-
-void USBD_USR_FS_Init(void);
-void USBD_USR_FS_DeviceReset (uint8_t speed);
-void USBD_USR_FS_DeviceConfigured (void);
-void USBD_USR_FS_DeviceSuspended(void);
-void USBD_USR_FS_DeviceResumed(void);
-
-void USBD_USR_FS_DeviceConnected(void);
-void USBD_USR_FS_DeviceDisconnected(void);
-
-void USBD_USR_HS_Init(void);
-void USBD_USR_HS_DeviceReset (uint8_t speed);
-void USBD_USR_HS_DeviceConfigured (void);
-void USBD_USR_HS_DeviceSuspended(void);
-void USBD_USR_HS_DeviceResumed(void);
-
-void USBD_USR_HS_DeviceConnected(void);
-void USBD_USR_HS_DeviceDisconnected(void);
-
-/**
- * @}
- */
-
-/** @defgroup USBD_USR_Exported_FunctionsPrototype
- * @{
- */
-/**
- * @}
- */
-
-#endif /*__USBD_USR_H__*/
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
-
-
-