Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Class/MSC/Inc/usbd_msc.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ typedef struct _USBD_STORAGE
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;
uint8_t *pInquiry;

} USBD_StorageTypeDef;

Expand Down
34 changes: 32 additions & 2 deletions Class/MSC/Src/usbd_msc_scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1175,12 +1175,12 @@ static int8_t SCSI_CheckAddressRange(USBD_HandleTypeDef *pdev, uint8_t lun,
}

/**
* @brief SCSI_ProcessRead
* @brief SCSI_ProcessReadNow
* Handle Read Process
* @param lun: Logical unit number
* @retval status
*/
static int8_t SCSI_ProcessRead(USBD_HandleTypeDef *pdev, uint8_t lun)
int8_t SCSI_ProcessReadNow(USBD_HandleTypeDef *pdev, uint8_t lun)
{
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
USBD_MSC_BOT_LUN_TypeDef *p_scsi_blk = &hmsc->scsi_blk[lun];
Expand Down Expand Up @@ -1224,6 +1224,36 @@ static int8_t SCSI_ProcessRead(USBD_HandleTypeDef *pdev, uint8_t lun)
return 0;
}

__weak void SCSI_ProcessReadReady(void)
{
/* signalize to OS -> reading from MSC is ready */
}

/**
* @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->pClassDataCmsit[pdev->classId];

if (hmsc == NULL)
{
return -1;
}

#if MSC_READ_IN_THREAD
UNUSED(lun);
SCSI_ProcessReadReady();
#else
SCSI_ProcessReadNow(pdev, lun);
#endif

return 0;
}

/**
* @brief SCSI_ProcessWrite
* Handle Write Process
Expand Down
2 changes: 1 addition & 1 deletion Class/MSC/Src/usbd_msc_storage_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int8_t STORAGE_Write(uint8_t lun, uint8_t *buf, uint32_t blk_addr,
int8_t STORAGE_GetMaxLun(void);

/* USB Mass storage Standard Inquiry Data */
int8_t STORAGE_Inquirydata[] = /* 36 */
uint8_t STORAGE_Inquirydata[] = /* 36 */
{

/* LUN 0 */
Expand Down
1 change: 1 addition & 0 deletions Core/Inc/usbd_conf_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ extern "C" {

/* MSC Class Config */
#define MSC_MEDIA_PACKET 8192U
#define MSC_READ_IN_THREAD 0U

/* CDC Class Config */
#define USBD_CDC_INTERVAL 2000U
Expand Down