revision 259:7c6881790cc2
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 259:7c6881790cc2 |
parent | 258:8864fae65928 |
child | 260:c82e26ec0cac |
author | nkeynes |
date | Fri Dec 29 00:24:43 2006 +0000 (17 years ago) |
Limit number of sectors read at once (linux driver seems to throw a hissy
fit if you request too many at a time)
fit if you request too many at a time)
src/gdrom/linux.c | view | annotate | diff | log |
1.1 --- a/src/gdrom/linux.c Fri Dec 29 00:23:16 2006 +00001.2 +++ b/src/gdrom/linux.c Fri Dec 29 00:24:43 2006 +00001.3 @@ -1,5 +1,5 @@1.4 /**1.5 - * $Id: linux.c,v 1.1 2006-12-14 12:31:38 nkeynes Exp $1.6 + * $Id: linux.c,v 1.2 2006-12-29 00:24:43 nkeynes Exp $1.7 *1.8 * Linux cd-rom device driver1.9 *1.10 @@ -29,6 +29,7 @@1.12 #define MAXTOCENTRIES 600 /* This is a fairly generous overestimate really */1.13 #define MAXTOCSIZE 4 + (MAXTOCENTRIES*11)1.14 +#define MAX_SECTORS_PER_CALL 321.16 #define MSFTOLBA( m,s,f ) (f + (s*CD_FRAMES) + (m*CD_FRAMES*CD_SECS))1.18 @@ -207,22 +208,31 @@1.19 {1.20 int fd = fileno(disc->file);1.21 uint32_t real_sector = sector - CD_MSF_OFFSET;1.22 - int buflen = sector_count * 2048;1.23 + uint32_t sector_size = 2048;1.24 + int buflen = sector_count * sector_size;1.25 + int i;1.26 char cmd[12] = { 0xBE, 0x10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };1.27 - cmd[2] = (real_sector >> 24) & 0xFF;1.28 - cmd[3] = (real_sector >> 16) & 0xFF;1.29 - cmd[4] = (real_sector >> 8) & 0xFF;1.30 - cmd[5] = real_sector & 0xFF;1.31 - cmd[6] = (sector_count >> 16) & 0xFF;1.32 - cmd[7] = (sector_count >> 8) & 0xFF;1.33 - cmd[8] = sector_count & 0xFF;1.34 - cmd[9] = 0x10;1.35 +1.36 + for( i=0; i<sector_count; i += MAX_SECTORS_PER_CALL ) {1.37 + int count = MIN(MAX_SECTORS_PER_CALL, sector_count);1.38 + cmd[2] = (real_sector >> 24) & 0xFF;1.39 + cmd[3] = (real_sector >> 16) & 0xFF;1.40 + cmd[4] = (real_sector >> 8) & 0xFF;1.41 + cmd[5] = real_sector & 0xFF;1.42 + cmd[6] = (count >> 16) & 0xFF;1.43 + cmd[7] = (count >> 8) & 0xFF;1.44 + cmd[8] = count & 0xFF;1.45 + cmd[9] = 0x10;1.47 - gdrom_error_t status = linux_send_command( fd, cmd, buf, buflen, CGC_DATA_READ );1.48 - if( status == 0 ) {1.49 - *length = buflen;1.50 + gdrom_error_t status = linux_send_command( fd, cmd, buf, count * sector_size, CGC_DATA_READ );1.51 + if( status != 0 ) {1.52 + return status;1.53 + }1.54 + real_sector += count;1.55 + buf += count * sector_size;1.56 }1.57 - return status;1.58 + *length = buflen;1.59 + return 0;1.60 }1.62 /**
.