| version 1.4, 2005/03/05 11:58:02 | version 1.6, 2005/04/04 11:50:59 | 
| Line 17 | Line 17 | 
 | #include        "atapicmd.h" | #include        "atapicmd.h" | 
 | #include        "sxsi.h" | #include        "sxsi.h" | 
 |  |  | 
 |  | // #define      YUIDEBUG | 
 |  |  | 
 |  |  | 
 | // INQUIRY | // INQUIRY | 
 | static const UINT8 cdrom_inquiry[] = { | static const UINT8 cdrom_inquiry[] = { | 
 |  | #ifdef YUIDEBUG | 
 |  | // うちのドライブの奴 NECCDは Product Level 3.00以上で modesense10のコードがちげー | 
 |  | 0x05,   // CD-ROM | 
 |  | 0x80,   // bit7: Removable Medium Bit, other: Reserved | 
 |  | 0x00,   // version [7-6: ISO, ECMA: 5-3, 2-0: ANSI(00)] | 
 |  | 0x21,   // 7-4: ATAPI version, 3-0: Response Data Format | 
 |  | 0x1f,   // Additional length | 
 |  | 0x00,0x00,0x00, // Reserved | 
 |  | 'N', 'E', 'C', ' ', ' ', ' ', ' ', ' ', // Vendor ID | 
 |  | 'C', 'D', '-', 'R', 'O', 'M', ' ', 'D', // Product ID | 
 |  | 'R', 'I', 'V', 'E', ':', '2', '5', '1', // Product ID | 
 |  | '4', '.', '0', '9'      // Product Revision Level | 
 |  | #else | 
 | 0x05,   // CD-ROM | 0x05,   // CD-ROM | 
 | 0x80,   // bit7: Removable Medium Bit, other: Reserved | 0x80,   // bit7: Removable Medium Bit, other: Reserved | 
 | 0x00,   // version [7-6: ISO, ECMA: 5-3, 2-0: ANSI(00)] | 0x00,   // version [7-6: ISO, ECMA: 5-3, 2-0: ANSI(00)] | 
| Line 30  static const UINT8 cdrom_inquiry[] = { | Line 45  static const UINT8 cdrom_inquiry[] = { | 
 | 'C', 'D', '-', 'R', 'O', 'M', ' ', 'D', // Product ID | 'C', 'D', '-', 'R', 'O', 'M', ' ', 'D', // Product ID | 
 | 'R', 'I', 'V', 'E', ' ', ' ', ' ', ' ', // Product ID | 'R', 'I', 'V', 'E', ' ', ' ', ' ', ' ', // Product ID | 
 | '1', '.', '0', ' '      // Product Revision Level | '1', '.', '0', ' '      // Product Revision Level | 
 |  | #endif | 
 | }; | }; | 
 |  |  | 
 | static void senddata(IDEDRV drv, UINT size, UINT limit) { | static void senddata(IDEDRV drv, UINT size, UINT limit) { | 
| Line 318  static const BYTE defval_pagecode_0e[PC_ | Line 334  static const BYTE defval_pagecode_0e[PC_ | 
 | 0x0e, 0x0e, 0x04, 0x00, 0x00, 0x00, 0x00, 0x4b, | 0x0e, 0x0e, 0x04, 0x00, 0x00, 0x00, 0x00, 0x4b, | 
 | 0x01, 0xff, 0x02, 0xff, 0x00, 0x00, 0x00, 0x00, | 0x01, 0xff, 0x02, 0xff, 0x00, 0x00, 0x00, 0x00, | 
 | }; | }; | 
 |  |  | 
 | static const BYTE defval_pagecode_2a[PC_2A_SIZE] = { | static const BYTE defval_pagecode_2a[PC_2A_SIZE] = { | 
 |  | #ifdef YUIDEBUG | 
 |  | 0x2a, 0x12, 0x00, 0x00, 0x71, 0x65, 0x89, 0x07, | 
 |  | 0x02, 0xc2, 0x00, 0xff, 0x00, 0x80, 0x02, 0xc2, | 
 |  | 0x00, 0x00, 0x00, 0x00, | 
 |  | #else | 
 | 0x2a, 0x12, 0x00, 0x00, 0x00, 0x00, 0x20, 0x03, | 0x2a, 0x12, 0x00, 0x00, 0x00, 0x00, 0x20, 0x03, | 
 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 
 | 0x00, 0x00, 0x00, 0x00, | 0x00, 0x00, 0x00, 0x00, | 
 |  | #endif | 
 | }; | }; | 
 |  |  | 
 | // 0x55: MODE SELECT | // 0x55: MODE SELECT | 
| Line 364  static void atapi_cmd_mode_sense(IDEDRV | Line 387  static void atapi_cmd_mode_sense(IDEDRV | 
 | if (!(drv->media & IDEIO_MEDIA_LOADED)) { | if (!(drv->media & IDEIO_MEDIA_LOADED)) { | 
 | drv->buf[2] = 0x70;     // Door closed, no disc present | drv->buf[2] = 0x70;     // Door closed, no disc present | 
 | } | } | 
 |  | else if ((drv->media & (IDEIO_MEDIA_COMBINE)) == IDEIO_MEDIA_AUDIO) { | 
 |  | drv->buf[2] = 0x02;     // 120mm CD-ROM audio only | 
 |  | } | 
 |  | else if ((drv->media & (IDEIO_MEDIA_COMBINE)) == IDEIO_MEDIA_COMBINE) { | 
 |  | drv->buf[2] = 0x03;     // 120mm CD-ROM data & audio combined | 
 |  | } | 
 | else { | else { | 
| drv->buf[2] = 0x00;     // 120mm CD-ROM data only | drv->buf[2] = 0x01;     // 120mm CD-ROM data only | 
 | } | } | 
 | cnt = 8; | cnt = 8; | 
 | if (cnt > leng) { | if (cnt > leng) { | 
| Line 441  static void atapi_cmd_mode_sense(IDEDRV | Line 470  static void atapi_cmd_mode_sense(IDEDRV | 
 | if (cnt > leng) { | if (cnt > leng) { | 
 | goto length_exceeded; | goto length_exceeded; | 
 | } | } | 
 |  | #if 0 | 
 |  | /*FALLTHROUGH*/ | 
 |  |  | 
 |  | case 0x00: | 
 |  | #endif | 
 | break; | break; | 
 |  |  | 
 | default: | default: | 
| Line 476  static void atapi_cmd_readtoc(IDEDRV drv | Line 510  static void atapi_cmd_readtoc(IDEDRV drv | 
 | leng = (drv->buf[7] << 8) + drv->buf[8]; | leng = (drv->buf[7] << 8) + drv->buf[8]; | 
 | format = (drv->buf[9] >> 6); | format = (drv->buf[9] >> 6); | 
 | TRACEOUT(("atapi_cmd_readtoc fmt=%d leng=%d", format, leng)); | TRACEOUT(("atapi_cmd_readtoc fmt=%d leng=%d", format, leng)); | 
 | switch(format) { |  | 
 | case 1: // multi session |  | 
 | ZeroMemory(drv->buf, 12); |  | 
 | drv->buf[1] = 0x0a; |  | 
 | drv->buf[2] = 0x01; |  | 
 | drv->buf[3] = 0x01; |  | 
 | senddata(drv, 12, leng); |  | 
 | break; |  | 
 |  |  | 
| default: | switch (format) { | 
| senderror(drv); | #ifdef YUIDEBUG | 
| break; | case 0: // track info | 
|  | // これ、PN専用。 | 
|  | // 後で ccd等からデータを作ろう | 
|  | drv->buf[0x00] = 0x00;  drv->buf[0x01] = 0x3a; | 
|  | drv->buf[0x02] = 0x01; | 
|  | drv->buf[0x03] = 0x06; | 
|  |  | 
|  | drv->buf[0x04] = 0x00;  drv->buf[0x05] = 0x14; | 
|  | drv->buf[0x06] = 0x01; | 
|  | drv->buf[0x07] = 0x00; | 
|  | drv->buf[0x08] = 0x00; | 
|  | drv->buf[0x09] = 0x00; | 
|  | drv->buf[0x0a] = 0x02; | 
|  | drv->buf[0x0b] = 0x00; | 
|  |  | 
|  | drv->buf[0x0c] = 0x00;  drv->buf[0x0d] = 0x10; | 
|  | drv->buf[0x0e] = 0x02; | 
|  | drv->buf[0x0f] = 0x00; | 
|  | drv->buf[0x10] = 0x00; | 
|  | drv->buf[0x11] = 0x29; | 
|  | drv->buf[0x12] = 0x1c; | 
|  | drv->buf[0x13] = 0x34; | 
|  |  | 
|  | drv->buf[0x14] = 0x00;  drv->buf[0x15] = 0x10; | 
|  | drv->buf[0x16] = 0x03; | 
|  | drv->buf[0x17] = 0x00; | 
|  | drv->buf[0x18] = 0x00; | 
|  | drv->buf[0x19] = 0x29; | 
|  | drv->buf[0x1a] = 0x20; | 
|  | drv->buf[0x1b] = 0x43; | 
|  |  | 
|  | drv->buf[0x1c] = 0x00;  drv->buf[0x1d] = 0x10; | 
|  | drv->buf[0x1e] = 0x04; | 
|  | drv->buf[0x1f] = 0x00; | 
|  | drv->buf[0x20] = 0x00; | 
|  | drv->buf[0x21] = 0x2b; | 
|  | drv->buf[0x22] = 0x07; | 
|  | drv->buf[0x23] = 0x19; | 
|  |  | 
|  | drv->buf[0x24] = 0x00;  drv->buf[0x25] = 0x10; | 
|  | drv->buf[0x26] = 0x05; | 
|  | drv->buf[0x27] = 0x00; | 
|  | drv->buf[0x28] = 0x00; | 
|  | drv->buf[0x29] = 0x2e; | 
|  | drv->buf[0x2a] = 0x39; | 
|  | drv->buf[0x2b] = 0x1d; | 
|  |  | 
|  | drv->buf[0x2c] = 0x00;  drv->buf[0x2d] = 0x10; | 
|  | drv->buf[0x2e] = 0x06; | 
|  | drv->buf[0x2f] = 0x00; | 
|  | drv->buf[0x30] = 0x00; | 
|  | drv->buf[0x31] = 0x34; | 
|  | drv->buf[0x32] = 0x0b; | 
|  | drv->buf[0x33] = 0x13; | 
|  |  | 
|  | drv->buf[0x34] = 0x00;  drv->buf[0x35] = 0x10; | 
|  | drv->buf[0x36] = 0xaa; | 
|  | drv->buf[0x37] = 0x00; | 
|  | drv->buf[0x38] = 0x00; | 
|  | drv->buf[0x39] = 0x3b; | 
|  | drv->buf[0x3a] = 0x1e; | 
|  | drv->buf[0x3b] = 0x0b; | 
|  | senddata(drv, 0x3c, leng); | 
|  | break; | 
|  | #endif | 
|  |  | 
|  | case 1: // multi session | 
|  | ZeroMemory(drv->buf, 12); | 
|  | drv->buf[1] = 0x0a; | 
|  | drv->buf[2] = 0x01; | 
|  | drv->buf[3] = 0x01; | 
|  | drv->buf[5] = 0x14; | 
|  | drv->buf[6] = 0x01; | 
|  | drv->buf[10] = 0x02; | 
|  | senddata(drv, 12, leng); | 
|  | break; | 
|  |  | 
|  | default: | 
|  | senderror(drv); | 
|  | break; | 
 | } | } | 
 | } | } | 
 |  |  |