Changeset 25966 in vbox for trunk/src/VBox/Devices/Storage/fdc.c
- Timestamp:
- Jan 22, 2010 11:15:43 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56818
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/fdc.c
r22793 r25966 1 1 #ifdef VBOX 2 /* $Id: $ */ 2 3 /** @file 3 * 4 * VBox storage devices: 5 * Floppy disk controller 4 * VBox storage devices: Floppy disk controller 6 5 */ 7 6 … … 55 54 #include <VBox/pdmdev.h> 56 55 #include <iprt/assert.h> 56 #include <iprt/string.h> 57 57 #include <iprt/uuid.h> 58 #include <iprt/string.h>59 58 60 59 #include "Builtins.h" … … 143 142 } fdisk_flags_t; 144 143 144 #ifdef VBOX 145 /** 146 * The status for one drive. 147 * 148 * @implements PDMIBASE 149 * @implements PDMIBLOCKPORT 150 * @implements PDMIMOUNTNOTIFY 151 */ 152 #endif 145 153 typedef struct fdrive_t { 146 154 #ifndef VBOX … … 356 364 /* @todo */ /** @todo r=bird: todo what exactly?!?!? */ 357 365 { 358 uint64_t size =drv->pDrvBlock->pfnGetSize (drv->pDrvBlock);359 nb_sectors = size / 512;366 uint64_t size2 = drv->pDrvBlock->pfnGetSize (drv->pDrvBlock); 367 nb_sectors = size2 / 512; 360 368 } 361 369 #endif /* VBOX */ … … 495 503 #define FD_FORMAT_CMD(state) ((state) & FD_STATE_FORMAT) 496 504 505 #ifdef VBOX 506 /** 507 * Floppy controller state. 508 * 509 * @implements PDMILEDPORTS 510 */ 511 #endif 497 512 struct fdctrl_t { 498 513 #ifndef VBOX … … 540 555 PPDMDEVINS pDevIns; 541 556 542 /** Status Port -The base interface. */557 /** Status LUN: The base interface. */ 543 558 PDMIBASE IBaseStatus; 544 /** Status Port -The Leds interface. */559 /** Status LUN: The Leds interface. */ 545 560 PDMILEDPORTS ILeds; 546 /** Status Port -The Partner of ILeds. */561 /** Status LUN: The Partner of ILeds. */ 547 562 PPDMILEDCONNECTORS pLedsConnector; 548 563 #endif … … 1243 1258 { 1244 1259 uint32_t read; 1245 int rc = PDMDevHlpDMAWriteMemory(fdctrl->pDevIns, nchan,1246 fdctrl->fifo + rel_pos,1247 fdctrl->data_pos,1248 len, &read);1260 int rc2 = PDMDevHlpDMAWriteMemory(fdctrl->pDevIns, nchan, 1261 fdctrl->fifo + rel_pos, 1262 fdctrl->data_pos, 1263 len, &read); 1249 1264 dump (fdctrl->fifo + rel_pos, len); 1250 AssertMsgRC (rc , ("DMAWriteMemory -> %Rrc\n", rc));1265 AssertMsgRC (rc2, ("DMAWriteMemory -> %Rrc\n", rc2)); 1251 1266 } 1252 1267 #else … … 1262 1277 { 1263 1278 uint32_t written; 1264 int rc = PDMDevHlpDMAReadMemory(fdctrl->pDevIns, nchan,1265 fdctrl->fifo + rel_pos,1266 fdctrl->data_pos,1267 len, &written);1268 AssertMsgRC (rc , ("DMAReadMemory -> %Rrc\n", rc));1279 int rc2 = PDMDevHlpDMAReadMemory(fdctrl->pDevIns, nchan, 1280 fdctrl->fifo + rel_pos, 1281 fdctrl->data_pos, 1282 len, &written); 1283 AssertMsgRC (rc2, ("DMAReadMemory -> %Rrc\n", rc2)); 1269 1284 } 1270 1285 #else … … 1308 1323 int ret; 1309 1324 #ifdef VBOX 1310 int rc;1311 1325 uint32_t read; 1312 1313 rc = PDMDevHlpDMAReadMemory (fdctrl->pDevIns, nchan, tmpbuf, 1314 fdctrl->data_pos, len, &read); 1315 AssertMsg (RT_SUCCESS (rc), ("DMAReadMemory -> %Rrc\n", rc)); 1326 int rc2 = PDMDevHlpDMAReadMemory (fdctrl->pDevIns, nchan, tmpbuf, 1327 fdctrl->data_pos, len, &read); 1328 AssertMsg (RT_SUCCESS (rc2), ("DMAReadMemory -> %Rrc2\n", rc2)); 1316 1329 #else 1317 1330 DMA_read_memory (nchan, tmpbuf, fdctrl->data_pos, len); … … 2485 2498 2486 2499 /** 2487 * Queries an interface to the driver. 2488 * 2489 * @returns Pointer to interface. 2490 * @returns NULL if the interface was not supported by the device. 2491 * @param pInterface Pointer to IDEState::IBase. 2492 * @param enmInterface The requested interface identification. 2500 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 2493 2501 */ 2494 static DECLCALLBACK(void *) fdQueryInterface (PPDMIBASE pInterface, 2495 PDMINTERFACE enmInterface) 2496 { 2497 fdrive_t *drv = PDMIBASE_2_FDRIVE(pInterface); 2498 switch (enmInterface) { 2499 case PDMINTERFACE_BASE: 2500 return &drv->IBase; 2501 case PDMINTERFACE_BLOCK_PORT: 2502 return &drv->IPort; 2503 case PDMINTERFACE_MOUNT_NOTIFY: 2504 return &drv->IMountNotify; 2505 default: 2506 return NULL; 2507 } 2502 static DECLCALLBACK(void *) fdQueryInterface (PPDMIBASE pInterface, const char *pszIID) 2503 { 2504 fdrive_t *pDrive = PDMIBASE_2_FDRIVE(pInterface); 2505 if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0) 2506 return &pDrive->IBase; 2507 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_BLOCK_PORT) == 0) 2508 return &pDrive->IPort; 2509 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_MOUNT_NOTIFY) == 0) 2510 return &pDrive->IMountNotify; 2511 return NULL; 2508 2512 } 2509 2513 … … 2532 2536 2533 2537 /** 2534 * Queries an interface to the status LUN. 2535 * 2536 * @returns Pointer to interface. 2537 * @returns NULL if the interface was not supported by the device. 2538 * @param pInterface Pointer to IDEState::IBase. 2539 * @param enmInterface The requested interface identification. 2538 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 2540 2539 */ 2541 static DECLCALLBACK(void *) fdcStatusQueryInterface (PPDMIBASE pInterface, 2542 PDMINTERFACE enmInterface) 2543 { 2544 fdctrl_t *fdctrl = (fdctrl_t *) 2545 ((uintptr_t)pInterface - RT_OFFSETOF (fdctrl_t, IBaseStatus)); 2546 switch (enmInterface) { 2547 case PDMINTERFACE_BASE: 2548 return &fdctrl->IBaseStatus; 2549 case PDMINTERFACE_LED_PORTS: 2550 return &fdctrl->ILeds; 2551 default: 2552 return NULL; 2553 } 2540 static DECLCALLBACK(void *) fdcStatusQueryInterface(PPDMIBASE pInterface, const char *pszIID) 2541 { 2542 fdctrl_t *pThis = RT_FROM_MEMBER (pInterface, fdctrl_t, IBaseStatus); 2543 2544 if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0) 2545 return &pThis->IBaseStatus; 2546 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0) 2547 return &pThis->ILeds; 2548 return NULL; 2554 2549 } 2555 2550
Note:
See TracChangeset
for help on using the changeset viewer.