1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ 2 /* 3 * Libbrasero-media 4 * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app@wanadoo.fr> 5 * 6 * Libbrasero-media is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * The Libbrasero-media authors hereby grant permission for non-GPL compatible 12 * GStreamer plugins to be used and distributed together with GStreamer 13 * and Libbrasero-media. This permission is above and beyond the permissions granted 14 * by the GPL license by which Libbrasero-media is covered. If you modify this code 15 * you may extend this exception to your version of the code, but you are not 16 * obligated to do so. If you do not wish to do so, delete this exception 17 * statement from your version. 18 * 19 * Libbrasero-media is distributed in the hope that it will be useful, 20 * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 * GNU Library General Public License for more details. 23 * 24 * You should have received a copy of the GNU General Public License 25 * along with this program; if not, write to: 26 * The Free Software Foundation, Inc., 27 * 51 Franklin Street, Fifth Floor 28 * Boston, MA 02110-1301, USA. 29 */ 30 31 #include <glib.h> 32 33 #include "scsi-base.h" 34 35 #ifndef _SCSI_READ_TRACK_INFORMATION_H 36 #define _SCSI_READ_TRACK_INFORMATION_H 37 38 G_BEGIN_DECLS 39 40 typedef enum { 41 BRASERO_SCSI_DATA_MODE_1 = 0x01, 42 BRASERO_SCSI_DATA_MODE_2_XA = 0x02, 43 BRASERO_SCSI_DATA_BLOCK_TYPE = 0x0F 44 } BraseroScsiDataMode; 45 46 #if G_BYTE_ORDER == G_LITTLE_ENDIAN 47 48 struct _BraseroScsiTrackInfo { 49 uchar len [2]; 50 51 uchar track_num_low; 52 uchar session_num_low; 53 54 uchar reserved0; 55 56 uchar track_mode :4; 57 uchar copy :1; 58 uchar damage :1; 59 uchar layer_jmp_rcd_status :2; 60 61 uchar data_mode :4; 62 /* the 4 next bits indicate the track status */ 63 uchar fixed_packet :1; 64 uchar packet :1; 65 uchar blank :1; 66 uchar reserved_track :1; 67 68 uchar next_wrt_address_valid :1; 69 uchar last_recorded_blk_valid :1; 70 uchar reserved1 :6; 71 72 uchar start_lba [4]; 73 uchar next_wrt_address [4]; 74 uchar free_blocks [4]; 75 uchar packet_size [4]; 76 uchar track_size [4]; 77 uchar last_recorded_blk [4]; 78 79 uchar track_num_high; 80 uchar session_num_high; 81 82 uchar reserved2 [2]; /* 36 bytes MMC1 */ 83 84 uchar rd_compat_lba [4]; /* 40 bytes */ 85 uchar next_layer_jmp [4]; 86 uchar last_layer_jmp [4]; /* 48 bytes */ 87 }; 88 89 #else 90 91 struct _BraseroScsiTrackInfo { 92 uchar len [2]; 93 94 uchar track_num_low; 95 uchar session_num_low; 96 97 uchar reserved0; 98 99 uchar layer_jmp_rcd_status :2; 100 uchar damage :1; 101 uchar copy :1; 102 uchar track_mode :4; 103 104 /* the 4 next bits indicate the track status */ 105 uchar reserved_track :1; 106 uchar blank :1; 107 uchar packet :1; 108 uchar fixed_packet :1; 109 uchar data_mode :4; 110 111 uchar reserved1 :6; 112 uchar last_recorded_blk_valid :1; 113 uchar next_wrt_address_valid :1; 114 115 uchar start_lba [4]; 116 uchar next_wrt_address [4]; 117 uchar free_blocks [4]; 118 uchar packet_size [4]; 119 uchar track_size [4]; 120 uchar last_recorded_blk [4]; 121 122 uchar track_num_high; 123 uchar session_num_high; 124 125 uchar reserved2 [2]; 126 127 uchar rd_compat_lba [4]; 128 uchar next_layer_jmp [4]; 129 uchar last_layer_jmp [4]; 130 }; 131 132 #endif 133 134 typedef struct _BraseroScsiTrackInfo BraseroScsiTrackInfo; 135 136 #define BRASERO_SCSI_TRACK_NUM(track) (((track).track_num_high << 8) + (track).track_num_low) 137 #define BRASERO_SCSI_SESSION_NUM(track) (((track).session_num_high << 8) + (track).session_num_low) 138 #define BRASERO_SCSI_TRACK_NUM_PTR(track) (((track)->track_num_high << 8) + (track)->track_num_low) 139 #define BRASERO_SCSI_SESSION_NUM_PTR(track) (((track)->session_num_high << 8) + (track)->session_num_low) 140 141 G_END_DECLS 142 143 #endif /* _SCSI_READ_TRACK_INFORMATION_H */ 144 145 146