rt-thread/port/msc_device.c
void tud_msc_capacity_cb(uint8_t lun, uint32_t *block_count, uint16_t *block_size) {
    (void) lun;
    struct rt_device_blk_geometry blk_geom;

    if (!flash_device) {
        flash_device = rt_device_find(PKG_TINYUSB_DEVICE_MSC_NAME);
    }
    rt_device_control(flash_device, RT_DEVICE_CTRL_BLK_GETGEOME, &blk_geom);

    *block_count = blk_geom.sector_count;
    *block_size = blk_geom.bytes_per_sector;
}
// Invoked when received SCSI_CMD_READ_CAPACITY_10 and SCSI_CMD_READ_FORMAT_CAPACITY to determine the disk size
// Application update block count and block size
Invoked when received SCSI_CMD_READ_CAPACITY_10 and SCSI_CMD_READ_FORMAT_CAPACITY to determine the disk size
Application update block count and block size
Invoked when received SCSI_CMD_READ_CAPACITY_10 and SCSI_CMD_READ_FORMAT_CAPACITY to determine the disk size Application update block count and block size
void tud_msc_capacity_cb(uint8_t lun, uint32_t *block_count, uint16_t *block_size) {
    (void) lun;
    struct rt_device_blk_geometry blk_geom;
    if (!flash_device) {
        flash_device = rt_device_find(PKG_TINYUSB_DEVICE_MSC_NAME);
    }
    rt_device_control(flash_device, RT_DEVICE_CTRL_BLK_GETGEOME, &blk_geom);
    *block_count = blk_geom.sector_count;
    *block_size = blk_geom.bytes_per_sector;
}
void tud_msc_capacity_cb ( uint8_t lun , uint32_t * block_count , uint16_t * block_size ) { ( void ) lun ; struct rt_device_blk_geometry blk_geom ; if ( ! flash_device ) { flash_device = rt_device_find ( PKG_TINYUSB_DEVICE_MSC_NAME ) ; } rt_device_control ( flash_device , RT_DEVICE_CTRL_BLK_GETGEOME , & blk_geom ) ; * block_count = blk_geom . sector_count ; * block_size = blk_geom . bytes_per_sector ; }
Invoked when received SCSI_CMD_READ_CAPACITY_10 and SCSI_CMD_READ_FORMAT_CAPACITY to determine the disk size
Application update block count and block size
Invoked when received SCSI_CMD_READ_CAPACITY_10 and SCSI_CMD_READ_FORMAT_CAPACITY to determine the disk size Application update block count and block size