Commit 22cedef9 authored by Damien George's avatar Damien George
Browse files

stmhal/usbdev: For MSC implement SCSI SYNCHRONIZE_CACHE command.

Currently just a dummy command that returns "success", but it's needed for
some O/S's to correctly talk with the SCSI layer.
parent e1cda003
...@@ -55,6 +55,8 @@ ...@@ -55,6 +55,8 @@
#define SCSI_MODE_SENSE6 0x1A #define SCSI_MODE_SENSE6 0x1A
#define SCSI_MODE_SENSE10 0x5A #define SCSI_MODE_SENSE10 0x5A
#define SCSI_ALLOW_MEDIUM_REMOVAL 0x1E #define SCSI_ALLOW_MEDIUM_REMOVAL 0x1E
#define SCSI_SYNCHRONIZE_CACHE10 0x35
#define SCSI_SYNCHRONIZE_CACHE16 0x91
#define SCSI_READ6 0x08 #define SCSI_READ6 0x08
#define SCSI_READ10 0x28 #define SCSI_READ10 0x28
#define SCSI_READ12 0xA8 #define SCSI_READ12 0xA8
......
...@@ -89,6 +89,7 @@ static int8_t SCSI_StartStopUnit(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t ...@@ -89,6 +89,7 @@ static int8_t SCSI_StartStopUnit(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t
static int8_t SCSI_AllowMediumRemoval(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params); static int8_t SCSI_AllowMediumRemoval(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params);
static int8_t SCSI_ModeSense6 (USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params); static int8_t SCSI_ModeSense6 (USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params);
static int8_t SCSI_ModeSense10 (USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params); static int8_t SCSI_ModeSense10 (USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params);
static int8_t SCSI_SynchronizeCache(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params);
static int8_t SCSI_Write10(USBD_HandleTypeDef *pdev, uint8_t lun , uint8_t *params); static int8_t SCSI_Write10(USBD_HandleTypeDef *pdev, uint8_t lun , uint8_t *params);
static int8_t SCSI_Read10(USBD_HandleTypeDef *pdev, uint8_t lun , uint8_t *params); static int8_t SCSI_Read10(USBD_HandleTypeDef *pdev, uint8_t lun , uint8_t *params);
static int8_t SCSI_Verify10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params); static int8_t SCSI_Verify10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params);
...@@ -151,6 +152,10 @@ int8_t SCSI_ProcessCmd(USBD_HandleTypeDef *pdev, ...@@ -151,6 +152,10 @@ int8_t SCSI_ProcessCmd(USBD_HandleTypeDef *pdev,
case SCSI_MODE_SENSE10: case SCSI_MODE_SENSE10:
return SCSI_ModeSense10 (pdev, lun, params); return SCSI_ModeSense10 (pdev, lun, params);
case SCSI_SYNCHRONIZE_CACHE10:
case SCSI_SYNCHRONIZE_CACHE16:
return SCSI_SynchronizeCache(pdev, lun, params);
case SCSI_READ_FORMAT_CAPACITIES: case SCSI_READ_FORMAT_CAPACITIES:
return SCSI_ReadFormatCapacity(pdev, lun, params); return SCSI_ReadFormatCapacity(pdev, lun, params);
...@@ -374,6 +379,13 @@ static int8_t SCSI_ModeSense10 (USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t ...@@ -374,6 +379,13 @@ static int8_t SCSI_ModeSense10 (USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t
return 0; return 0;
} }
static int8_t SCSI_SynchronizeCache(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params) {
// nothing to synchronize, so just return "success"
USBD_MSC_BOT_HandleTypeDef *hmsc = pdev->pClassData;
hmsc->bot_data_length = 0;
return 0;
}
/** /**
* @brief SCSI_RequestSense * @brief SCSI_RequestSense
* Process Request Sense command * Process Request Sense command
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment