Skip to content

Commit

Permalink
Merge pull request ChibiOS#350 from BMichiel/fix_usb_msd_padding
Browse files Browse the repository at this point in the history
Fixed some issues with usb_msd for stm32l496
  • Loading branch information
fpoussin committed Jan 11, 2023
2 parents af37905 + 44b12e5 commit a224be1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions os/hal/include/hal_usb_msd.h
Expand Up @@ -95,7 +95,7 @@ typedef struct {
uint8_t lun;
uint8_t cmd_len;
uint8_t cmd_data[16];
} msd_cbw_t;
} __attribute__((packed)) msd_cbw_t;

/**
* @brief Represents command status wrapper structure.
Expand All @@ -106,7 +106,7 @@ typedef struct {
uint32_t tag;
uint32_t data_residue;
uint8_t status;
} msd_csw_t;
} __attribute__((packed)) msd_csw_t;

/**
* @brief Transport handler passed to SCSI layer.
Expand Down
2 changes: 1 addition & 1 deletion os/hal/src/hal_usb_msd.c
Expand Up @@ -190,7 +190,7 @@ static uint32_t scsi_transport_receive(const SCSITransport *transport,
usb_scsi_transport_handler_t *trp = transport->handler;
msg_t status = usbReceive(trp->usbp, trp->ep, data, len);
if (MSG_RESET != status)
return status;
return len;
else
return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions os/various/lib_scsi.c
Expand Up @@ -274,11 +274,11 @@ static bool read_format_capacities(SCSITarget *scsip, const uint8_t *cmd) {
memcpy(ret.blocknum, &tmp, 4);

uint8_t formatted_media = 0b10;
uint16_t blocklen = bdi.blk_size;
uint16_t blocklen = (uint16_t)bdi.blk_size;
ret.blocklen[0] = formatted_media;
ret.blocklen[1] = 0;
ret.blocklen[2] = blocklen >> 8;
ret.blocklen[3] = blocklen & 0xFF;
ret.blocklen[2] = (uint8_t)blocklen >> 8;
ret.blocklen[3] = (uint8_t)blocklen & 0xFF;

ret.header[3] = 1 * 8;

Expand Down

0 comments on commit a224be1

Please sign in to comment.