/uspace/lib/scsi/include/scsi/mmc.h

https://gitlab.com/vhelen/vhelen · C Header · 103 lines · 31 code · 9 blank · 63 comment · 0 complexity · 9e69f04bde467a5b0d55ec071a44ff02 MD5 · raw file

  1. /*
  2. * Copyright (c) 2014 Jiri Svoboda
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. *
  9. * - Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * - Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * - The name of the author may not be used to endorse or promote products
  15. * derived from this software without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  18. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  19. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  20. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  21. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  22. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  23. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  24. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  26. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. */
  28. /** @addtogroup libscsi
  29. * @{
  30. */
  31. /**
  32. * @file SCSI Multi-Media Commands.
  33. */
  34. #ifndef LIBSCSI_MMC_H_
  35. #define LIBSCSI_MMC_H_
  36. #include <stdint.h>
  37. /** SCSI command codes defined in SCSI-MMC */
  38. enum scsi_cmd_mmc {
  39. SCSI_CMD_READ_TOC = 0x43
  40. };
  41. /** SCSI Read TOC/PMA/ATIP command.
  42. *
  43. * Note: For SFF 8020 the command must be padded to 12 bytes.
  44. */
  45. typedef struct {
  46. /** Operation code (SCSI_CMD_READ_TOC) */
  47. uint8_t op_code;
  48. /** Reserved, MSF, Reserved */
  49. uint8_t msf;
  50. /** Reserved, Format */
  51. uint8_t format;
  52. /** Reserved */
  53. uint8_t reserved_3;
  54. /** Reserved */
  55. uint8_t reserved_4;
  56. /** Reserved */
  57. uint8_t reserved_5;
  58. /** Track/Session Number */
  59. uint8_t track_sess_no;
  60. /** Allocation Length */
  61. uint16_t alloc_len;
  62. /** Control */
  63. uint8_t control;
  64. } __attribute__((packed)) scsi_cdb_read_toc_t;
  65. /** TOC Track Descriptor */
  66. typedef struct {
  67. /** Reserved */
  68. uint8_t reserved0;
  69. /** ADR, Control */
  70. uint8_t adr_control;
  71. /** Track Number */
  72. uint8_t track_no;
  73. /** Reserved */
  74. uint8_t reserved3;
  75. /** Track Start Address */
  76. uint32_t start_addr;
  77. } __attribute__((packed)) scsi_toc_track_desc_t;
  78. /** Read TOC response format 00001b: Multi-session Information
  79. *
  80. * Returned for Read TOC command with Format 0001b
  81. */
  82. typedef struct {
  83. /** TOC Data Length */
  84. uint16_t toc_len;
  85. /** First Complete Session Number */
  86. uint8_t first_sess;
  87. /** Last Complete Session Number */
  88. uint8_t last_sess;
  89. /** TOC Track Descriptor for first track in last complete session */
  90. scsi_toc_track_desc_t ftrack_lsess;
  91. } __attribute__((packed)) scsi_toc_multisess_data_t;
  92. #endif
  93. /** @}
  94. */