Search
lxdream.org :: lxdream/src/gdrom/ide.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gdrom/ide.c
changeset 858:368fc0dcd57c
prev833:1ea87e0221f8
next888:9892c970b95a
author nkeynes
date Fri Sep 12 11:59:49 2008 +0000 (11 years ago)
permissions -rw-r--r--
last change Implement packet command 10h drive status
file annotate diff log raw
1.1 --- a/src/gdrom/ide.c Wed Aug 27 09:42:16 2008 +0000
1.2 +++ b/src/gdrom/ide.c Fri Sep 12 11:59:49 2008 +0000
1.3 @@ -501,6 +501,34 @@
1.4 ide_raise_interrupt();
1.5 idereg.status = 0x50;
1.6 break;
1.7 + case PKT_CMD_DRIVE_STATUS:
1.8 + lba = cmd[2];
1.9 + if( lba >= GDROM_DRIVE_STATUS_LENGTH ) {
1.10 + ide_set_error(PKT_ERR_BADFIELD);
1.11 + } else {
1.12 + uint8_t status = ide_get_drive_status();
1.13 + /* FIXME: Refactor read_position to avoid this kind of crud */
1.14 + char tmp[16];
1.15 + gdrom_disc->read_position( gdrom_disc, idereg.current_lba, tmp );
1.16 +
1.17 + length = cmd[4];
1.18 + if( lba+length > GDROM_DRIVE_STATUS_LENGTH )
1.19 + length = GDROM_DRIVE_STATUS_LENGTH - lba;
1.20 + char data[10];
1.21 + data[0] = status & 0x0F;
1.22 + data[1] = status & 0xF0;
1.23 + data[2] = tmp[4];
1.24 + data[3] = tmp[5];
1.25 + data[4] = tmp[6];
1.26 + data[5] = tmp[11];
1.27 + data[6] = tmp[12];
1.28 + data[7] = tmp[13];
1.29 + data[8] = 0;
1.30 + data[9] = 0;
1.31 + memcpy( data_buffer, data + lba, length );
1.32 + ide_start_packet_read( length, 0 );
1.33 + }
1.34 + break;
1.35 case PKT_CMD_MODE_SENSE:
1.36 lba = cmd[2];
1.37 if( lba >= GDROM_MODE_LENGTH ) {
.