Changeset 37460 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Jun 15, 2011 7:43:59 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/fdc.c
r37459 r37460 189 189 } fdrive_t; 190 190 191 #define NUM_HEADS(drv) (drv->flags & FDISK_DBL_SIDES ? 2 : 1) 192 191 193 static void fd_init(fdrive_t *drv) 192 194 { … … 200 202 201 203 static int fd_sector_calc(uint8_t head, uint8_t track, uint8_t sect, 202 uint8_t last_sect )203 { 204 return (((track * 2) + head) * last_sect) + sect - 1; /* sect >= 1 */204 uint8_t last_sect, uint8_t num_heads) 205 { 206 return (((track * num_heads) + head) * last_sect) + sect - 1; /* sect >= 1 */ 205 207 } 206 208 … … 208 210 static int fd_sector(fdrive_t *drv) 209 211 { 210 return fd_sector_calc(drv->head, drv->track, drv->sect, drv->last_sect );212 return fd_sector_calc(drv->head, drv->track, drv->sect, drv->last_sect, NUM_HEADS(drv)); 211 213 } 212 214 … … 239 241 return 3; 240 242 } 241 sector = fd_sector_calc(head, track, sect, drv->last_sect );243 sector = fd_sector_calc(head, track, sect, drv->last_sect, NUM_HEADS(drv)); 242 244 ret = 0; 243 245 if (sector != fd_sector(drv)) { … … 1159 1161 FLOPPY_DPRINTF("Start transfer at %d %d %02x %02x (%d)\n", 1160 1162 GET_CUR_DRV(fdctrl), kh, kt, ks, 1161 fd_sector_calc(kh, kt, ks, cur_drv->last_sect ));1163 fd_sector_calc(kh, kt, ks, cur_drv->last_sect, NUM_HEADS(cur_drv))); 1162 1164 switch (fd_seek(cur_drv, kh, kt, ks, fdctrl->config & FD_CONFIG_EIS)) { 1163 1165 case 2: … … 1570 1572 FLOPPY_DPRINTF("format sector at %d %d %02x %02x (%d)\n", 1571 1573 GET_CUR_DRV(fdctrl), kh, kt, ks, 1572 fd_sector_calc(kh, kt, ks, cur_drv->last_sect ));1574 fd_sector_calc(kh, kt, ks, cur_drv->last_sect, NUM_HEADS(cur_drv))); 1573 1575 switch (fd_seek(cur_drv, kh, kt, ks, fdctrl->config & FD_CONFIG_EIS)) { 1574 1576 case 2:
Note:
See TracChangeset
for help on using the changeset viewer.