PageRenderTime 17ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 29/** @addtogroup libscsi
 30 * @{
 31 */
 32/**
 33 * @file SCSI Multi-Media Commands.
 34 */
 35
 36#ifndef LIBSCSI_MMC_H_
 37#define LIBSCSI_MMC_H_
 38
 39#include <stdint.h>
 40
 41/** SCSI command codes defined in SCSI-MMC */
 42enum scsi_cmd_mmc {
 43	SCSI_CMD_READ_TOC	= 0x43
 44};
 45
 46/** SCSI Read TOC/PMA/ATIP command.
 47 *
 48 * Note: For SFF 8020 the command must be padded to 12 bytes.
 49 */
 50typedef struct {
 51	/** Operation code (SCSI_CMD_READ_TOC) */
 52	uint8_t op_code;
 53	/** Reserved, MSF, Reserved */
 54	uint8_t msf;
 55	/** Reserved, Format */
 56	uint8_t format;
 57	/** Reserved */
 58	uint8_t reserved_3;
 59	/** Reserved */
 60	uint8_t reserved_4;
 61	/** Reserved */
 62	uint8_t reserved_5;
 63	/** Track/Session Number */
 64	uint8_t track_sess_no;
 65	/** Allocation Length */
 66	uint16_t alloc_len;
 67	/** Control */
 68	uint8_t control;
 69} __attribute__((packed)) scsi_cdb_read_toc_t;
 70
 71/** TOC Track Descriptor */
 72typedef struct {
 73	/** Reserved */
 74	uint8_t reserved0;
 75	/** ADR, Control */
 76	uint8_t adr_control;
 77	/** Track Number */
 78	uint8_t track_no;
 79	/** Reserved */
 80	uint8_t reserved3;
 81	/** Track Start Address */
 82	uint32_t start_addr;
 83} __attribute__((packed)) scsi_toc_track_desc_t;
 84
 85/** Read TOC response format 00001b: Multi-session Information
 86 *
 87 * Returned for Read TOC command with Format 0001b
 88 */
 89typedef struct {
 90	/** TOC Data Length */
 91	uint16_t toc_len;
 92	/** First Complete Session Number */
 93	uint8_t first_sess;
 94	/** Last Complete Session Number */
 95	uint8_t last_sess;
 96	/** TOC Track Descriptor for first track in last complete session */
 97	scsi_toc_track_desc_t ftrack_lsess;
 98} __attribute__((packed)) scsi_toc_multisess_data_t;
 99
100#endif
101
102/** @}
103 */