Search
lxdream.org :: lxdream/src/gdrom/ide.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gdrom/ide.c
changeset 258:8864fae65928
prev256:8bac2f96ca1b
next342:850502f0e8de
author nkeynes
date Fri Dec 29 00:23:16 2006 +0000 (13 years ago)
permissions -rw-r--r--
last change Fix byte-count handling in accordance with the actual DC chip
file annotate diff log raw
1.1 --- a/src/gdrom/ide.c Thu Dec 21 11:13:10 2006 +0000
1.2 +++ b/src/gdrom/ide.c Fri Dec 29 00:23:16 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: ide.c,v 1.21 2006-12-21 11:13:10 nkeynes Exp $
1.6 + * $Id: ide.c,v 1.22 2006-12-29 00:23:13 nkeynes Exp $
1.7 *
1.8 * IDE interface implementation
1.9 *
1.10 @@ -223,10 +223,8 @@
1.11 } else {
1.12 idereg.state = IDE_STATE_PIO_READ;
1.13 idereg.status = 0x58;
1.14 - idereg.lba1 = length & 0xFF;
1.15 - idereg.lba2 = (length >> 8) & 0xFF;
1.16 - // idereg.lba1 = blocksize & 0xFF;
1.17 - // idereg.lba2 = blocksize >> 8;
1.18 + idereg.lba1 = blocksize & 0xFF;
1.19 + idereg.lba2 = blocksize >> 8;
1.20 idereg.block_length = blocksize;
1.21 idereg.block_left = blocksize;
1.22 ide_raise_interrupt( );
1.23 @@ -449,7 +447,7 @@
1.24 if( lba+length > sizeof(gdrom_ident) )
1.25 length = sizeof(gdrom_ident) - lba;
1.26 memcpy( data_buffer, gdrom_ident + lba, length );
1.27 - ide_start_packet_read( length, blocksize );
1.28 + ide_start_packet_read( length, length );
1.29 }
1.30 break;
1.31 case PKT_CMD_SENSE:
1.32 @@ -457,7 +455,7 @@
1.33 if( length > 10 )
1.34 length = 10;
1.35 memcpy( data_buffer, idereg.gdrom_sense, length );
1.36 - ide_start_packet_read( length, blocksize );
1.37 + ide_start_packet_read( length, length );
1.38 break;
1.39 case PKT_CMD_READ_TOC:
1.40 length = (cmd[3]<<8) | cmd[4];
1.41 @@ -468,7 +466,7 @@
1.42 if( status != PKT_ERR_OK ) {
1.43 ide_set_packet_result( status );
1.44 } else {
1.45 - ide_start_packet_read( length, blocksize );
1.46 + ide_start_packet_read( length, length );
1.47 }
1.48 break;
1.49 case PKT_CMD_SESSION_INFO:
1.50 @@ -479,7 +477,7 @@
1.51 if( status != PKT_ERR_OK ) {
1.52 ide_set_packet_result( status );
1.53 } else {
1.54 - ide_start_packet_read( length, blocksize );
1.55 + ide_start_packet_read( length, length );
1.56 }
1.57 break;
1.58 case PKT_CMD_PLAY_CD:
1.59 @@ -515,10 +513,11 @@
1.60 idereg.gdrom_sense[5] = (lba >> 16) & 0xFF;
1.61 idereg.gdrom_sense[6] = (lba >> 8) & 0xFF;
1.62 idereg.gdrom_sense[7] = lba & 0xFF;
1.63 + WARN( " => Read CD returned sense key %02X, %02X", status & 0xFF, status >> 8 );
1.64 } else {
1.65 idereg.last_read_lba = lba + length;
1.66 idereg.last_read_track = gdrom_get_track_no_by_lba( idereg.last_read_lba );
1.67 - ide_start_packet_read( datalen, blocksize );
1.68 + ide_start_packet_read( datalen, 0x0800 );
1.69 }
1.70 break;
1.71 case PKT_CMD_SPIN_UP:
1.72 @@ -537,7 +536,7 @@
1.73 length = sizeof(gdrom_status);
1.74 }
1.75 memcpy( data_buffer, gdrom_status, length );
1.76 - ide_start_packet_read( length, blocksize );
1.77 + ide_start_packet_read( length, length );
1.78 break;
1.79 case 1:
1.80 if( length > 14 ) {
1.81 @@ -559,7 +558,7 @@
1.82 data_buffer[11] = (idereg.last_read_lba >> 16) & 0xFF;
1.83 data_buffer[12] = (idereg.last_read_lba >> 8) & 0xFF;
1.84 data_buffer[13] = idereg.last_read_lba & 0xFF;
1.85 - ide_start_packet_read( length, blocksize );
1.86 + ide_start_packet_read( length, length );
1.87 break;
1.88 }
1.89 }
1.90 @@ -570,7 +569,7 @@
1.91 * For sake of something to do, it returns the results from a test dump
1.92 */
1.93 memcpy( data_buffer, gdrom_71, sizeof(gdrom_71) );
1.94 - ide_start_packet_read( sizeof(gdrom_71), blocksize );
1.95 + ide_start_packet_read( sizeof(gdrom_71), sizeof(gdrom_71) );
1.96 break;
1.97 default:
1.98 ide_set_packet_result( PKT_ERR_BADCMD ); /* Invalid command */
.