Release v2.7.0

This commit is contained in:
slimih
2020-08-31 08:40:19 +01:00
parent edbaa3cd1d
commit d1a9b6baea
42 changed files with 4402 additions and 2180 deletions

View File

@@ -111,13 +111,13 @@ static int8_t SCSI_UpdateBotData(USBD_MSC_BOT_HandleTypeDef *hmsc,
/**
* @brief SCSI_ProcessCmd
* Process SCSI commands
* @param pdev: device instance
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
* @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(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *cmd)
{
int8_t ret;
@@ -125,71 +125,71 @@ int8_t SCSI_ProcessCmd(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *cmd)
switch (cmd[0])
{
case SCSI_TEST_UNIT_READY:
ret = SCSI_TestUnitReady(pdev, lun, cmd);
break;
case SCSI_TEST_UNIT_READY:
ret = SCSI_TestUnitReady(pdev, lun, cmd);
break;
case SCSI_REQUEST_SENSE:
ret = SCSI_RequestSense(pdev, lun, cmd);
break;
case SCSI_REQUEST_SENSE:
ret = SCSI_RequestSense(pdev, lun, cmd);
break;
case SCSI_INQUIRY:
ret = SCSI_Inquiry(pdev, lun, cmd);
break;
case SCSI_INQUIRY:
ret = SCSI_Inquiry(pdev, lun, cmd);
break;
case SCSI_START_STOP_UNIT:
ret = SCSI_StartStopUnit(pdev, lun, cmd);
break;
case SCSI_START_STOP_UNIT:
ret = SCSI_StartStopUnit(pdev, lun, cmd);
break;
case SCSI_ALLOW_MEDIUM_REMOVAL:
ret = SCSI_AllowPreventRemovable(pdev, lun, cmd);
break;
case SCSI_ALLOW_MEDIUM_REMOVAL:
ret = SCSI_AllowPreventRemovable(pdev, lun, cmd);
break;
case SCSI_MODE_SENSE6:
ret = SCSI_ModeSense6(pdev, lun, cmd);
break;
case SCSI_MODE_SENSE6:
ret = SCSI_ModeSense6(pdev, lun, cmd);
break;
case SCSI_MODE_SENSE10:
ret = SCSI_ModeSense10(pdev, lun, cmd);
break;
case SCSI_MODE_SENSE10:
ret = SCSI_ModeSense10(pdev, lun, cmd);
break;
case SCSI_READ_FORMAT_CAPACITIES:
ret = SCSI_ReadFormatCapacity(pdev, lun, cmd);
break;
case SCSI_READ_FORMAT_CAPACITIES:
ret = SCSI_ReadFormatCapacity(pdev, lun, cmd);
break;
case SCSI_READ_CAPACITY10:
ret = SCSI_ReadCapacity10(pdev, lun, cmd);
break;
case SCSI_READ_CAPACITY10:
ret = SCSI_ReadCapacity10(pdev, lun, cmd);
break;
case SCSI_READ_CAPACITY16:
ret = SCSI_ReadCapacity16(pdev, lun, cmd);
break;
case SCSI_READ_CAPACITY16:
ret = SCSI_ReadCapacity16(pdev, lun, cmd);
break;
case SCSI_READ10:
ret = SCSI_Read10(pdev, lun, cmd);
break;
case SCSI_READ10:
ret = SCSI_Read10(pdev, lun, cmd);
break;
case SCSI_READ12:
ret = SCSI_Read12(pdev, lun, cmd);
break;
case SCSI_READ12:
ret = SCSI_Read12(pdev, lun, cmd);
break;
case SCSI_WRITE10:
ret = SCSI_Write10(pdev, lun, cmd);
break;
case SCSI_WRITE10:
ret = SCSI_Write10(pdev, lun, cmd);
break;
case SCSI_WRITE12:
ret = SCSI_Write12(pdev, lun, cmd);
break;
case SCSI_WRITE12:
ret = SCSI_Write12(pdev, lun, cmd);
break;
case SCSI_VERIFY10:
ret = SCSI_Verify10(pdev, lun, cmd);
break;
case SCSI_VERIFY10:
ret = SCSI_Verify10(pdev, lun, cmd);
break;
default:
SCSI_SenseCode(pdev, lun, ILLEGAL_REQUEST, INVALID_CDB);
hmsc->bot_status = USBD_BOT_STATUS_ERROR;
ret = -1;
break;
default:
SCSI_SenseCode(pdev, lun, ILLEGAL_REQUEST, INVALID_CDB);
hmsc->bot_status = USBD_BOT_STATUS_ERROR;
ret = -1;
break;
}
return ret;
@@ -197,12 +197,12 @@ int8_t SCSI_ProcessCmd(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *cmd)
/**
* @brief SCSI_TestUnitReady
* Process SCSI Test Unit Ready Command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
* @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(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params)
{
UNUSED(params);
@@ -237,12 +237,12 @@ static int8_t SCSI_TestUnitReady(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t
/**
* @brief SCSI_Inquiry
* Process Inquiry command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
* @brief SCSI_Inquiry
* Process Inquiry command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
static int8_t SCSI_Inquiry(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params)
{
uint8_t *pPage;
@@ -275,7 +275,7 @@ static int8_t SCSI_Inquiry(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *param
}
else
{
pPage = (uint8_t *)&((USBD_StorageTypeDef *)pdev->pUserData)->pInquiry[lun * STANDARD_INQUIRY_DATA_LEN];
pPage = (uint8_t *) &((USBD_StorageTypeDef *)pdev->pUserData)->pInquiry[lun * STANDARD_INQUIRY_DATA_LEN];
len = (uint16_t)pPage[4] + 5U;
if (params[4] <= len)
@@ -291,12 +291,12 @@ static int8_t SCSI_Inquiry(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *param
/**
* @brief SCSI_ReadCapacity10
* Process Read Capacity 10 command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
* @brief SCSI_ReadCapacity10
* Process Read Capacity 10 command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
static int8_t SCSI_ReadCapacity10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params)
{
UNUSED(params);
@@ -329,12 +329,12 @@ static int8_t SCSI_ReadCapacity10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t
/**
* @brief SCSI_ReadCapacity16
* Process Read Capacity 16 command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
* @brief SCSI_ReadCapacity16
* Process Read Capacity 16 command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
static int8_t SCSI_ReadCapacity16(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params)
{
UNUSED(params);
@@ -353,7 +353,7 @@ static int8_t SCSI_ReadCapacity16(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t
hmsc->bot_data_length = ((uint32_t)params[10] << 24) |
((uint32_t)params[11] << 16) |
((uint32_t)params[12] << 8) |
(uint32_t)params[13];
(uint32_t)params[13];
for (idx = 0U; idx < hmsc->bot_data_length; idx++)
{
@@ -373,19 +373,19 @@ static int8_t SCSI_ReadCapacity16(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t
hmsc->bot_data_length = ((uint32_t)params[10] << 24) |
((uint32_t)params[11] << 16) |
((uint32_t)params[12] << 8) |
(uint32_t)params[13];
(uint32_t)params[13];
return 0;
}
/**
* @brief SCSI_ReadFormatCapacity
* Process Read Format Capacity command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
* @brief SCSI_ReadFormatCapacity
* Process Read Format Capacity command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
static int8_t SCSI_ReadFormatCapacity(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params)
{
UNUSED(params);
@@ -426,12 +426,12 @@ static int8_t SCSI_ReadFormatCapacity(USBD_HandleTypeDef *pdev, uint8_t lun, uin
/**
* @brief SCSI_ModeSense6
* Process Mode Sense6 command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
* @brief SCSI_ModeSense6
* Process Mode Sense6 command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
static int8_t SCSI_ModeSense6(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params)
{
UNUSED(lun);
@@ -450,12 +450,12 @@ static int8_t SCSI_ModeSense6(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *pa
/**
* @brief SCSI_ModeSense10
* Process Mode Sense10 command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
* @brief SCSI_ModeSense10
* Process Mode Sense10 command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
static int8_t SCSI_ModeSense10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params)
{
UNUSED(lun);
@@ -474,12 +474,12 @@ static int8_t SCSI_ModeSense10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *p
/**
* @brief SCSI_RequestSense
* Process Request Sense command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
* @brief SCSI_RequestSense
* Process Request Sense command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
static int8_t SCSI_RequestSense(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params)
{
UNUSED(lun);
@@ -525,14 +525,14 @@ static int8_t SCSI_RequestSense(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *
/**
* @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 Code
* @retval none
* @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 Code
* @retval none
*/
*/
void SCSI_SenseCode(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t sKey, uint8_t ASC)
{
UNUSED(lun);
@@ -551,12 +551,12 @@ void SCSI_SenseCode(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t sKey, uint8_t
/**
* @brief SCSI_StartStopUnit
* Process Start Stop Unit command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
* @brief SCSI_StartStopUnit
* Process Start Stop Unit command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
static int8_t SCSI_StartStopUnit(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params)
{
UNUSED(lun);
@@ -592,12 +592,12 @@ static int8_t SCSI_StartStopUnit(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t
/**
* @brief SCSI_AllowPreventRemovable
* Process Allow Prevent Removable medium command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
* @brief SCSI_AllowPreventRemovable
* Process Allow Prevent Removable medium command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
static int8_t SCSI_AllowPreventRemovable(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params)
{
UNUSED(lun);
@@ -619,12 +619,12 @@ static int8_t SCSI_AllowPreventRemovable(USBD_HandleTypeDef *pdev, uint8_t lun,
/**
* @brief SCSI_Read10
* Process Read10 command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
* @brief SCSI_Read10
* Process Read10 command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
static int8_t SCSI_Read10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params)
{
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef *)pdev->pClassData;
@@ -680,12 +680,12 @@ static int8_t SCSI_Read10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params
/**
* @brief SCSI_Read12
* Process Read12 command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
* @brief SCSI_Read12
* Process Read12 command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
static int8_t SCSI_Read12(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params)
{
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef *)pdev->pClassData;
@@ -743,12 +743,12 @@ static int8_t SCSI_Read12(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params
/**
* @brief SCSI_Write10
* Process Write10 command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
* @brief SCSI_Write10
* Process Write10 command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
static int8_t SCSI_Write10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params)
{
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef *)pdev->pClassData;
@@ -823,12 +823,12 @@ static int8_t SCSI_Write10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *param
/**
* @brief SCSI_Write12
* Process Write12 command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
* @brief SCSI_Write12
* Process Write12 command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
static int8_t SCSI_Write12(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params)
{
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef *)pdev->pClassData;
@@ -907,12 +907,12 @@ static int8_t SCSI_Write12(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *param
/**
* @brief SCSI_Verify10
* Process Verify10 command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
* @brief SCSI_Verify10
* Process Verify10 command
* @param lun: Logical unit number
* @param params: Command parameters
* @retval status
*/
static int8_t SCSI_Verify10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params)
{
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef *)pdev->pClassData;
@@ -934,13 +934,13 @@ static int8_t SCSI_Verify10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *para
}
/**
* @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
*/
* @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(USBD_HandleTypeDef *pdev, uint8_t lun,
uint32_t blk_offset, uint32_t blk_nbr)
{
@@ -956,11 +956,11 @@ static int8_t SCSI_CheckAddressRange(USBD_HandleTypeDef *pdev, uint8_t lun,
}
/**
* @brief SCSI_ProcessRead
* Handle Read Process
* @param lun: Logical unit number
* @retval status
*/
* @brief SCSI_ProcessRead
* Handle Read Process
* @param lun: Logical unit number
* @retval status
*/
static int8_t SCSI_ProcessRead(USBD_HandleTypeDef *pdev, uint8_t lun)
{
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef *)pdev->pClassData;
@@ -993,11 +993,11 @@ static int8_t SCSI_ProcessRead(USBD_HandleTypeDef *pdev, uint8_t lun)
}
/**
* @brief SCSI_ProcessWrite
* Handle Write Process
* @param lun: Logical unit number
* @retval status
*/
* @brief SCSI_ProcessWrite
* Handle Write Process
* @param lun: Logical unit number
* @retval status
*/
static int8_t SCSI_ProcessWrite(USBD_HandleTypeDef *pdev, uint8_t lun)
{
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef *)pdev->pClassData;
@@ -1036,13 +1036,13 @@ static int8_t SCSI_ProcessWrite(USBD_HandleTypeDef *pdev, uint8_t lun)
/**
* @brief SCSI_UpdateBotData
* fill the requested Data to transmit buffer
* @param hmsc handler
* @param params: Data buffer
* @param length: Data length
* @retval status
*/
* @brief SCSI_UpdateBotData
* fill the requested Data to transmit buffer
* @param hmsc handler
* @param pBuff: Data buffer
* @param length: Data length
* @retval status
*/
static int8_t SCSI_UpdateBotData(USBD_MSC_BOT_HandleTypeDef *hmsc,
uint8_t *pBuff, uint16_t length)
{