Search
lxdream.org :: lxdream/src/drivers/cdrom/sector.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/cdrom/sector.c
changeset 1178:e55ec927d55d
prev1121:c2d827cbdf37
next1296:30ecee61f811
author Nathan Keynes <nkeynes@lxdream.org>
date Sat Sep 17 22:39:36 2011 +1000 (9 years ago)
permissions -rw-r--r--
last change Fix structure packing on v55 nero images (64-bit)
Add basic support for track mode 16 (CDDA + subchannel data, 2448 bytes)
file annotate diff log raw
1.1 --- a/src/drivers/cdrom/sector.c Fri Sep 10 21:42:41 2010 +1000
1.2 +++ b/src/drivers/cdrom/sector.c Sat Sep 17 22:39:36 2011 +1000
1.3 @@ -43,13 +43,14 @@
1.4 CDROM_READ_MODE2|CDROM_READ_DATA, CDROM_READ_MODE2_FORM1|CDROM_READ_DATA,
1.5 CDROM_READ_MODE2_FORM1|CDROM_READ_DATA,
1.6 CDROM_READ_MODE2|CDROM_READ_DATA|CDROM_READ_SUBHEADER|CDROM_READ_ECC,
1.7 - CDROM_READ_RAW, CDROM_READ_RAW };
1.8 + CDROM_READ_RAW, CDROM_READ_RAW,
1.9 + CDROM_READ_CDDA|CDROM_READ_DATA};
1.10
1.11 /* Block size for each sector mode */
1.12 -const uint32_t cdrom_sector_size[] = { 0, 2352, 2048, 2336, 2048, 2324, 2336, 2352, 2352 };
1.13 +const uint32_t cdrom_sector_size[] = { 0, 2352, 2048, 2336, 2048, 2324, 2336, 2352, 2352, 2448 };
1.14
1.15 const char *cdrom_sector_mode_names[] = { "Unknown", "Audio", "Mode 1", "Mode 2", "Mode 2 Form 1", "Mode 2 Form 2",
1.16 - "Mode 2 semiraw", "XA Raw", "Non-XA Raw" };
1.17 + "Mode 2 semiraw", "XA Raw", "Non-XA Raw", "CDDA+Subchan" };
1.18
1.19
1.20 /********************* Public functions *************************/
1.21 @@ -152,7 +153,7 @@
1.22 switch( read_sector_type ) {
1.23 case CDROM_READ_ANY: break;
1.24 case CDROM_READ_CDDA:
1.25 - if( sector_mode != SECTOR_CDDA )
1.26 + if( sector_mode != SECTOR_CDDA && sector_mode != SECTOR_CDDA_SUBCHANNEL )
1.27 return CDROM_ERROR_BADREADMODE;
1.28 break;
1.29 case CDROM_READ_MODE1:
1.30 @@ -175,6 +176,7 @@
1.31 /* Check the fields requested are sane per MMC (non-contiguous regions prohibited) */
1.32 switch( sector_mode ) {
1.33 case SECTOR_CDDA:
1.34 + case SECTOR_CDDA_SUBCHANNEL:
1.35 return CDROM_ERROR_OK; /* Everything is OK */
1.36 case SECTOR_MODE2_FORM1:
1.37 case SECTOR_MODE2_FORM2:
1.38 @@ -301,7 +303,7 @@
1.39 cdrom_lba_t lba, cdrom_count_t block_count, cdrom_read_mode_t mode,
1.40 unsigned char *buf, size_t *length )
1.41 {
1.42 - unsigned char tmp[CDROM_MAX_SECTOR_SIZE];
1.43 + unsigned char tmp[2448];
1.44 int read_sector_type = CDROM_READ_TYPE(mode);
1.45 int read_sector_fields = CDROM_READ_FIELDS(mode);
1.46 int i;
1.47 @@ -319,6 +321,17 @@
1.48 device->read_blocks( device, lba, block_count, buf );
1.49 }
1.50 break;
1.51 + case SECTOR_CDDA_SUBCHANNEL:
1.52 + if( read_sector_type != CDROM_READ_ANY && read_sector_type != CDROM_READ_CDDA )
1.53 + return CDROM_ERROR_BADREADMODE;
1.54 + if( read_sector_fields != 0 ) {
1.55 + len = block_count * 2352;
1.56 + for( i=0; i<block_count; i++ ) {
1.57 + device->read_blocks( device, lba+i, 1, tmp );
1.58 + memcpy( &buf[2352*i], tmp, 2352 );
1.59 + }
1.60 + }
1.61 + break;
1.62 case SECTOR_RAW_XA:
1.63 case SECTOR_RAW_NONXA:
1.64 case SECTOR_SEMIRAW_MODE2:
.