122 lines
3.4 KiB
C
122 lines
3.4 KiB
C
/**
|
|
******************************************************************************
|
|
* @file usbd_msc_core.h
|
|
* @author MCD Application Team
|
|
* @version V2.0.0
|
|
* @date 18-February-2014
|
|
* @brief header for the usbd_msc_core.c file
|
|
******************************************************************************
|
|
* @attention
|
|
*
|
|
* <h2><center>© COPYRIGHT 2014 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_MSC_CORE_H_
|
|
#define _USB_MSC_CORE_H_
|
|
|
|
#include "usbd_msc_bot.h"
|
|
#include "usbd_msc_scsi.h"
|
|
#include "usbd_ioreq.h"
|
|
|
|
/** @addtogroup USBD_MSC_BOT
|
|
* @{
|
|
*/
|
|
|
|
/** @defgroup USBD_MSC
|
|
* @brief This file is the Header file for USBD_msc.c
|
|
* @{
|
|
*/
|
|
|
|
|
|
/** @defgroup USBD_BOT_Exported_Defines
|
|
* @{
|
|
*/
|
|
#define MSC_MAX_FS_PACKET 0x40
|
|
#define MSC_MAX_HS_PACKET 0x200
|
|
|
|
#define BOT_GET_MAX_LUN 0xFE
|
|
#define BOT_RESET 0xFF
|
|
#define USB_MSC_CONFIG_DESC_SIZ 32
|
|
|
|
|
|
#define MSC_EPIN_ADDR 0x81
|
|
#define MSC_EPOUT_ADDR 0x01
|
|
|
|
/**
|
|
* @}
|
|
*/
|
|
|
|
/** @defgroup USB_CORE_Exported_Types
|
|
* @{
|
|
*/
|
|
typedef struct _USBD_STORAGE
|
|
{
|
|
int8_t (* Init) (uint8_t lun);
|
|
int8_t (* GetCapacity) (uint8_t lun, uint32_t *block_num, uint16_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_StorageTypeDef;
|
|
|
|
|
|
typedef struct
|
|
{
|
|
uint32_t max_lun;
|
|
uint32_t interface;
|
|
uint8_t bot_state;
|
|
uint8_t bot_status;
|
|
uint16_t bot_data_length;
|
|
uint8_t bot_data[MSC_MEDIA_PACKET];
|
|
USBD_MSC_BOT_CBWTypeDef cbw;
|
|
USBD_MSC_BOT_CSWTypeDef csw;
|
|
|
|
USBD_SCSI_SenseTypeDef scsi_sense [SENSE_LIST_DEEPTH];
|
|
uint8_t scsi_sense_head;
|
|
uint8_t scsi_sense_tail;
|
|
|
|
uint16_t scsi_blk_size;
|
|
uint32_t scsi_blk_nbr;
|
|
|
|
uint32_t scsi_blk_addr;
|
|
uint32_t scsi_blk_len;
|
|
}
|
|
USBD_MSC_BOT_HandleTypeDef;
|
|
|
|
/* Structure for MSC process */
|
|
extern USBD_ClassTypeDef USBD_MSC;
|
|
|
|
uint8_t USBD_MSC_RegisterStorage (USBD_HandleTypeDef *pdev,
|
|
USBD_StorageTypeDef *fops);
|
|
/**
|
|
* @}
|
|
*/
|
|
|
|
/**
|
|
* @}
|
|
*/
|
|
#endif // _USB_MSC_CORE_H_
|
|
/**
|
|
* @}
|
|
*/
|
|
|
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|