Changeset 65108 in vbox
- Timestamp:
- Jan 4, 2017 2:07:09 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/ATAPIPassthrough.cpp
r64410 r65108 24 24 #include <VBox/cdefs.h> 25 25 #include <VBox/scsi.h> 26 #include <VBox/scsiinline.h> 26 27 27 28 #include "ATAPIPassthrough.h" … … 111 112 } TRACKLIST, *PTRACKLIST; 112 113 113 DECLINLINE(uint16_t) atapiBE2H_U16(const uint8_t *pbBuf)114 {115 return (pbBuf[0] << 8) | pbBuf[1];116 }117 118 119 DECLINLINE(uint32_t) atapiBE2H_U24(const uint8_t *pbBuf)120 {121 return (pbBuf[0] << 16) | (pbBuf[1] << 8) | pbBuf[2];122 }123 124 125 DECLINLINE(uint32_t) atapiBE2H_U32(const uint8_t *pbBuf)126 {127 return (pbBuf[0] << 24) | (pbBuf[1] << 16) | (pbBuf[2] << 8) | pbBuf[3];128 }129 130 DECLINLINE(int64_t) atapiMSF2LBA(const uint8_t *pbBuf)131 {132 return ((int64_t)(pbBuf[0] * 60 + pbBuf[1]) * 75 + pbBuf[2]) - 150; /* 2 second pregap */133 }134 114 135 115 /** … … 247 227 pTrack->enmMainDataForm = enmTrackDataForm; 248 228 pTrack->enmSubChnDataForm = enmSubChnDataForm; 249 pTrack->iLbaStart = atapiMSF2LBA(&pbCueSheetEntry[5]);229 pTrack->iLbaStart = scsiMSF2LBA(&pbCueSheetEntry[5]); 250 230 if (pbCueSheetEntry[1] != 0xaa) 251 231 { 252 232 /* Calculate number of sectors from the next entry. */ 253 int64_t iLbaNext = atapiMSF2LBA(&pbCueSheetEntry[5+8]);233 int64_t iLbaNext = scsiMSF2LBA(&pbCueSheetEntry[5+8]); 254 234 pTrack->cSectors = iLbaNext - pTrack->iLbaStart; 255 235 } … … 273 253 { 274 254 int rc = VINF_SUCCESS; 275 unsigned cbCueSheet = atapiBE2H_U24(pbCDB + 6);255 unsigned cbCueSheet = scsiBE2H_U24(pbCDB + 6); 276 256 unsigned cTracks = cbCueSheet / 8; 277 257 … … 318 298 RT_NOREF(iTrack, cbBuffer); /** @todo unused parameters */ 319 299 int rc = VINF_SUCCESS; 320 unsigned cbToc = atapiBE2H_U16(pbBuf);300 unsigned cbToc = scsiBE2H_U16(pbBuf); 321 301 uint8_t iTrackFirst = pbBuf[2]; 322 302 unsigned cTracks; … … 342 322 pTrack->enmSubChnDataForm = SUBCHNDATAFORM_0; 343 323 if (fMSF) 344 pTrack->iLbaStart = atapiMSF2LBA(&pbBuf[4]);324 pTrack->iLbaStart = scsiMSF2LBA(&pbBuf[4]); 345 325 else 346 pTrack->iLbaStart = atapiBE2H_U32(&pbBuf[4]);326 pTrack->iLbaStart = scsiBE2H_U32(&pbBuf[4]); 347 327 348 328 if (pbBuf[2] != 0xaa) … … 352 332 353 333 if (fMSF) 354 iLbaNext = atapiMSF2LBA(&pbBuf[4+8]);334 iLbaNext = scsiMSF2LBA(&pbBuf[4+8]); 355 335 else 356 iLbaNext = atapiBE2H_U32(&pbBuf[4+8]);336 iLbaNext = scsiBE2H_U32(&pbBuf[4+8]); 357 337 358 338 pTrack->cSectors = iLbaNext - pTrack->iLbaStart; … … 373 353 { 374 354 int rc = VINF_SUCCESS; 375 uint16_t cbBuffer = atapiBE2H_U16(&pbCDB[7]);355 uint16_t cbBuffer = scsiBE2H_U16(&pbCDB[7]); 376 356 bool fMSF = (pbCDB[1] & 0x2) != 0; 377 357 uint8_t uFmt = pbCDB[2] & 0xf;
Note:
See TracChangeset
for help on using the changeset viewer.