sonycd535.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. #ifndef SONYCD535_H
  2. #define SONYCD535_H
  3. /*
  4. * define all the commands recognized by the CDU-531/5
  5. */
  6. #define SONY535_REQUEST_DRIVE_STATUS_1 (0x80)
  7. #define SONY535_REQUEST_SENSE (0x82)
  8. #define SONY535_REQUEST_DRIVE_STATUS_2 (0x84)
  9. #define SONY535_REQUEST_ERROR_STATUS (0x86)
  10. #define SONY535_REQUEST_AUDIO_STATUS (0x88)
  11. #define SONY535_INQUIRY (0x8a)
  12. #define SONY535_SET_INACTIVITY_TIME (0x90)
  13. #define SONY535_SEEK_AND_READ_N_BLOCKS_1 (0xa0)
  14. #define SONY535_SEEK_AND_READ_N_BLOCKS_2 (0xa4)
  15. #define SONY535_PLAY_AUDIO (0xa6)
  16. #define SONY535_REQUEST_DISC_CAPACITY (0xb0)
  17. #define SONY535_REQUEST_TOC_DATA (0xb2)
  18. #define SONY535_REQUEST_SUB_Q_DATA (0xb4)
  19. #define SONY535_REQUEST_ISRC (0xb6)
  20. #define SONY535_REQUEST_UPC_EAN (0xb8)
  21. #define SONY535_SET_DRIVE_MODE (0xc0)
  22. #define SONY535_REQUEST_DRIVE_MODE (0xc2)
  23. #define SONY535_SET_RETRY_COUNT (0xc4)
  24. #define SONY535_DIAGNOSTIC_1 (0xc6)
  25. #define SONY535_DIAGNOSTIC_4 (0xcc)
  26. #define SONY535_DIAGNOSTIC_5 (0xce)
  27. #define SONY535_EJECT_CADDY (0xd0)
  28. #define SONY535_DISABLE_EJECT_BUTTON (0xd2)
  29. #define SONY535_ENABLE_EJECT_BUTTON (0xd4)
  30. #define SONY535_HOLD (0xe0)
  31. #define SONY535_AUDIO_PAUSE_ON_OFF (0xe2)
  32. #define SONY535_SET_VOLUME (0xe8)
  33. #define SONY535_STOP (0xf0)
  34. #define SONY535_SPIN_UP (0xf2)
  35. #define SONY535_SPIN_DOWN (0xf4)
  36. #define SONY535_CLEAR_PARAMETERS (0xf6)
  37. #define SONY535_CLEAR_ENDING_ADDRESS (0xf8)
  38. /*
  39. * define some masks
  40. */
  41. #define SONY535_DATA_NOT_READY_BIT (0x1)
  42. #define SONY535_RESULT_NOT_READY_BIT (0x2)
  43. /*
  44. * drive status 1
  45. */
  46. #define SONY535_STATUS1_COMMAND_ERROR (0x1)
  47. #define SONY535_STATUS1_DATA_ERROR (0x2)
  48. #define SONY535_STATUS1_SEEK_ERROR (0x4)
  49. #define SONY535_STATUS1_DISC_TYPE_ERROR (0x8)
  50. #define SONY535_STATUS1_NOT_SPINNING (0x10)
  51. #define SONY535_STATUS1_EJECT_BUTTON_PRESSED (0x20)
  52. #define SONY535_STATUS1_CADDY_NOT_INSERTED (0x40)
  53. #define SONY535_STATUS1_BYTE_TWO_FOLLOWS (0x80)
  54. /*
  55. * drive status 2
  56. */
  57. #define SONY535_CDD_LOADING_ERROR (0x7)
  58. #define SONY535_CDD_NO_DISC (0x8)
  59. #define SONY535_CDD_UNLOADING_ERROR (0x9)
  60. #define SONY535_CDD_CADDY_NOT_INSERTED (0xd)
  61. #define SONY535_ATN_RESET_OCCURRED (0x2)
  62. #define SONY535_ATN_DISC_CHANGED (0x4)
  63. #define SONY535_ATN_RESET_AND_DISC_CHANGED (0x6)
  64. #define SONY535_ATN_EJECT_IN_PROGRESS (0xe)
  65. #define SONY535_ATN_BUSY (0xf)
  66. /*
  67. * define some parameters
  68. */
  69. #define SONY535_AUDIO_DRIVE_MODE (0)
  70. #define SONY535_CDROM_DRIVE_MODE (0xe0)
  71. #define SONY535_PLAY_OP_PLAYBACK (0)
  72. #define SONY535_PLAY_OP_ENTER_HOLD (1)
  73. #define SONY535_PLAY_OP_SET_AUDIO_ENDING_ADDR (2)
  74. #define SONY535_PLAY_OP_SCAN_FORWARD (3)
  75. #define SONY535_PLAY_OP_SCAN_BACKWARD (4)
  76. /*
  77. * convert from msf format to block number
  78. */
  79. #define SONY_BLOCK_NUMBER(m,s,f) (((m)*60L+(s))*75L+(f))
  80. #define SONY_BLOCK_NUMBER_MSF(x) (((x)[0]*60L+(x)[1])*75L+(x)[2])
  81. /*
  82. * error return values from the doSonyCmd() routines
  83. */
  84. #define TIME_OUT (-1)
  85. #define NO_CDROM (-2)
  86. #define BAD_STATUS (-3)
  87. #define CD_BUSY (-4)
  88. #define NOT_DATA_CD (-5)
  89. #define NO_ROOM (-6)
  90. #define LOG_START_OFFSET 150 /* Offset of first logical sector */
  91. #define SONY_JIFFIES_TIMEOUT (5*HZ) /* Maximum time
  92. the drive will wait/try for an
  93. operation */
  94. #define SONY_READY_RETRIES (50000) /* How many times to retry a
  95. spin waiting for a register
  96. to come ready */
  97. #define SONY535_FAST_POLLS (10000) /* how many times recheck
  98. status waiting for a data
  99. to become ready */
  100. typedef unsigned char Byte;
  101. /*
  102. * This is the complete status returned from the drive configuration request
  103. * command.
  104. */
  105. struct s535_sony_drive_config
  106. {
  107. char vendor_id[8];
  108. char product_id[16];
  109. char product_rev_level[4];
  110. };
  111. /* The following is returned from the request sub-q data command */
  112. struct s535_sony_subcode
  113. {
  114. unsigned char address :4;
  115. unsigned char control :4;
  116. unsigned char track_num;
  117. unsigned char index_num;
  118. unsigned char rel_msf[3];
  119. unsigned char abs_msf[3];
  120. };
  121. struct s535_sony_disc_capacity
  122. {
  123. Byte mFirstTrack, sFirstTrack, fFirstTrack;
  124. Byte mLeadOut, sLeadOut, fLeadOut;
  125. };
  126. /*
  127. * The following is returned from the request TOC (Table Of Contents) command.
  128. * (last_track_num-first_track_num+1) values are valid in tracks.
  129. */
  130. struct s535_sony_toc
  131. {
  132. unsigned char reserved0 :4;
  133. unsigned char control0 :4;
  134. unsigned char point0;
  135. unsigned char first_track_num;
  136. unsigned char reserved0a;
  137. unsigned char reserved0b;
  138. unsigned char reserved1 :4;
  139. unsigned char control1 :4;
  140. unsigned char point1;
  141. unsigned char last_track_num;
  142. unsigned char dummy1;
  143. unsigned char dummy2;
  144. unsigned char reserved2 :4;
  145. unsigned char control2 :4;
  146. unsigned char point2;
  147. unsigned char lead_out_start_msf[3];
  148. struct
  149. {
  150. unsigned char reserved :4;
  151. unsigned char control :4;
  152. unsigned char track;
  153. unsigned char track_start_msf[3];
  154. } tracks[100];
  155. unsigned int lead_out_start_lba;
  156. };
  157. #endif /* SONYCD535_H */