Search
lxdream.org :: lxdream :: r858:368fc0dcd57c
lxdream 0.9.1
released Jun 29
Download Now
changeset858:368fc0dcd57c
parent857:3d8944884eaa
child859:b941c703ccd6
authornkeynes
dateFri Sep 12 11:59:49 2008 +0000 (12 years ago)
Implement packet command 10h drive status
src/gdrom/ide.c
src/gdrom/ide.h
src/gdrom/packet.h
1.1 --- a/src/gdrom/ide.c Fri Sep 12 05:36:00 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 ) {
2.1 --- a/src/gdrom/ide.h Fri Sep 12 05:36:00 2008 +0000
2.2 +++ b/src/gdrom/ide.h Fri Sep 12 11:59:49 2008 +0000
2.3 @@ -29,6 +29,7 @@
2.4 extern "C" {
2.5 #endif
2.6
2.7 +#define GDROM_DRIVE_STATUS_LENGTH 10
2.8 #define GDROM_SENSE_LENGTH 10
2.9 #define GDROM_MODE_LENGTH 32
2.10
3.1 --- a/src/gdrom/packet.h Fri Sep 12 05:36:00 2008 +0000
3.2 +++ b/src/gdrom/packet.h Fri Sep 12 11:59:49 2008 +0000
3.3 @@ -23,9 +23,9 @@
3.4 /**
3.5 * Valid command codes (hex):
3.6 * 00 Test
3.7 - * 10
3.8 - * 11 Inquiry
3.9 - * 12
3.10 + * 10 Drive Status
3.11 + * 11 Mode Sense
3.12 + * 12 Mode Select
3.13 * 13 Request Sense
3.14 * 14 Read TOC
3.15 * 15 Read session info
3.16 @@ -50,6 +50,7 @@
3.17 */
3.18
3.19 #define PKT_CMD_TEST_READY 0x00
3.20 +#define PKT_CMD_DRIVE_STATUS 0x10
3.21 #define PKT_CMD_MODE_SENSE 0x11
3.22 #define PKT_CMD_MODE_SELECT 0x12
3.23 #define PKT_CMD_SENSE 0x13
.