The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/ata/atapi-cd.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 1998 - 2008 Søren Schmidt <sos@FreeBSD.org>
    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  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer,
   10  *    without modification, immediately at the beginning of the file.
   11  * 2. 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  *
   15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   25  *
   26  * $FreeBSD$
   27  */
   28 
   29 /* CDROM Table Of Contents */
   30 #define MAXTRK 99
   31 struct toc {
   32     struct ioc_toc_header       hdr;
   33     struct cd_toc_entry         tab[MAXTRK + 1];
   34 };
   35 
   36 /* DVD CSS authentication */
   37 struct dvd_miscauth {
   38     u_int16_t   length;
   39     u_int16_t   reserved;
   40     u_int8_t    data[2048];
   41 };
   42 
   43 /* CDROM Audio Control Parameters Page */
   44 struct audiopage {
   45     /* mode page data header */
   46     u_int16_t   data_length;
   47     u_int8_t    medium_type;
   48     u_int8_t    dev_spec;
   49     u_int8_t    unused[2];
   50     u_int16_t   blk_desc_len;
   51 
   52     /* audio control page */
   53     u_int8_t    page_code;
   54 #define ATAPI_CDROM_AUDIO_PAGE      0x0e
   55 #define ATAPI_CDROM_AUDIO_PAGE_MASK 0x4e
   56 
   57     u_int8_t    param_len;
   58     u_int8_t    flags;
   59 #define CD_PA_SOTC      0x02
   60 #define CD_PA_IMMED     0x04
   61 
   62     u_int8_t    reserved3;
   63     u_int8_t    reserved4;
   64     u_int8_t    reserved5;
   65     u_int16_t   lb_per_sec;
   66     struct port_control {
   67         u_int8_t        channels:4;
   68 #define CHANNEL_0       1
   69 #define CHANNEL_1       2
   70 #define CHANNEL_2       4
   71 #define CHANNEL_3       8
   72 
   73         u_int8_t        volume;
   74     } port[4];
   75 };
   76 
   77 
   78 /* CDROM Capabilities and Mechanical Status Page */
   79 struct cappage {
   80     /* mode page data header */
   81     u_int16_t   data_length;
   82     u_int8_t    medium_type;
   83 #define MST_TYPE_MASK_LOW       0x0f
   84 #define MST_FMT_NONE            0x00
   85 #define MST_DATA_120            0x01
   86 #define MST_AUDIO_120           0x02
   87 #define MST_COMB_120            0x03
   88 #define MST_PHOTO_120           0x04
   89 #define MST_DATA_80             0x05
   90 #define MST_AUDIO_80            0x06
   91 #define MST_COMB_80             0x07
   92 #define MST_PHOTO_80            0x08
   93 
   94 #define MST_TYPE_MASK_HIGH      0x70
   95 #define MST_CDROM               0x00
   96 #define MST_CDR                 0x10
   97 #define MST_CDRW                0x20
   98 #define MST_DVD                 0x40
   99 
  100 #define MST_NO_DISC             0x70
  101 #define MST_DOOR_OPEN           0x71
  102 #define MST_FMT_ERROR           0x72
  103 
  104     u_int8_t    dev_spec;
  105     u_int16_t   unused;
  106     u_int16_t   blk_desc_len;
  107 
  108     /* capabilities page */
  109     u_int8_t    page_code;
  110 #define ATAPI_CDROM_CAP_PAGE    0x2a
  111 
  112     u_int8_t    param_len;
  113 
  114     u_int16_t   media;
  115 #define MST_READ_CDR            0x0100
  116 #define MST_READ_CDRW           0x0200
  117 #define MST_READ_PACKET         0x0400
  118 #define MST_READ_DVDROM         0x0800
  119 #define MST_READ_DVDR           0x1000
  120 #define MST_READ_DVDRAM         0x2000
  121 #define MST_WRITE_CDR           0x0001
  122 #define MST_WRITE_CDRW          0x0002
  123 #define MST_WRITE_TEST          0x0004
  124 #define MST_WRITE_DVDR          0x0010
  125 #define MST_WRITE_DVDRAM        0x0020
  126 
  127     u_int16_t   capabilities;
  128 #define MST_AUDIO_PLAY          0x0100
  129 #define MST_COMPOSITE           0x0200
  130 #define MST_AUDIO_P1            0x0400
  131 #define MST_AUDIO_P2            0x0800
  132 #define MST_MODE2_f1            0x1000
  133 #define MST_MODE2_f2            0x2000
  134 #define MST_MULTISESSION        0x4000
  135 #define MST_BURNPROOF           0x8000
  136 #define MST_READ_CDDA           0x0001
  137 #define MST_CDDA_STREAM         0x0002
  138 #define MST_COMBINED_RW         0x0004
  139 #define MST_CORRECTED_RW        0x0008
  140 #define MST_SUPPORT_C2          0x0010
  141 #define MST_ISRC                0x0020
  142 #define MST_UPC                 0x0040
  143 
  144     u_int8_t    mechanism;
  145 #define MST_LOCKABLE            0x01
  146 #define MST_LOCKED              0x02
  147 #define MST_PREVENT             0x04
  148 #define MST_EJECT               0x08
  149 #define MST_MECH_MASK           0xe0
  150 #define MST_MECH_CADDY          0x00
  151 #define MST_MECH_TRAY           0x20
  152 #define MST_MECH_POPUP          0x40
  153 #define MST_MECH_CHANGER        0x80
  154 #define MST_MECH_CARTRIDGE      0xa0
  155 
  156     uint8_t     audio;
  157 #define MST_SEP_VOL             0x01
  158 #define MST_SEP_MUTE            0x02
  159 
  160     u_int16_t   max_read_speed;         /* max raw data rate in bytes/1000 */
  161     u_int16_t   max_vol_levels;         /* number of discrete volume levels */
  162     u_int16_t   buf_size;               /* internal buffer size in bytes/1024 */
  163     u_int16_t   cur_read_speed;         /* current data rate in bytes/1000  */
  164 
  165     u_int8_t    reserved3;
  166     u_int8_t    misc;
  167 
  168     u_int16_t   max_write_speed;        /* max raw data rate in bytes/1000 */
  169     u_int16_t   cur_write_speed;        /* current data rate in bytes/1000  */
  170     u_int16_t   copy_protect_rev;
  171     u_int16_t   reserved4;
  172 };
  173 
  174 #define CH_READY                0
  175 #define CH_LOADING              1
  176 #define CH_UNLOADING            2
  177 #define CH_INITIALIZING         3
  178 
  179 #define CD_IDLE                 0
  180 #define CD_AUDIO_ACTIVE         1
  181 #define CD_AUDIO_SCAN           2
  182 #define CD_HOST_ACTIVE          3
  183 #define CD_NO_STATE             7
  184 
  185 /* CDROM Changer mechanism status structure */
  186 struct changer {
  187     u_int8_t    current_slot    :5;     /* active changer slot */
  188     u_int8_t    mech_state      :2;     /* current changer state */
  189 
  190     u_int8_t    fault           :1;     /* fault in last operation */
  191     u_int8_t    reserved0       :5;
  192     u_int8_t    cd_state        :3;     /* current mechanism state */
  193 
  194     u_int8_t    current_lba[3];         /* current LBA */
  195     u_int8_t    slots;                  /* number of available slots */
  196     u_int16_t   table_length;           /* slot table length */
  197     struct {
  198         u_int8_t        changed :1;     /* media has changed in this slot */
  199         u_int8_t        unused  :6;
  200         u_int8_t        present :1;     /* slot has a CD present */
  201         u_int8_t        reserved0;
  202         u_int8_t        reserved1;
  203         u_int8_t        reserved2;
  204     } slot[32];
  205 };
  206 
  207 /* CDROM Write Parameters Mode Page (Burners ONLY) */
  208 struct write_param {
  209     /* mode page data header */
  210     u_int16_t   data_length;
  211     u_int8_t    medium_type;
  212     u_int8_t    dev_spec;
  213     u_int8_t    unused[2];
  214     u_int16_t   blk_desc_len;
  215 
  216     /* write parameters page */
  217     u_int8_t    page_code;
  218 #define ATAPI_CDROM_WRITE_PARAMETERS_PAGE      0x05
  219 
  220     u_int8_t    page_length;            /* 0x32 */
  221     u_int8_t    write_type      :4;     /* write stream type */
  222 #define CDR_WTYPE_PACKET        0x00
  223 #define CDR_WTYPE_TRACK         0x01
  224 #define CDR_WTYPE_SESSION       0x02
  225 #define CDR_WTYPE_RAW           0x03
  226 
  227     u_int8_t    test_write      :1;     /* test write enable */
  228     u_int8_t    link_size_valid :1;
  229     u_int8_t    burnproof       :1;     /* BurnProof enable */
  230     u_int8_t    reserved2_7     :1;
  231     u_int8_t    track_mode      :4;     /* track mode */
  232 #define CDR_TMODE_AUDIO         0x00
  233 #define CDR_TMODE_AUDIO_PREEMP  0x01
  234 #define CDR_TMODE_ALLOW_COPY    0x02
  235 #define CDR_TMODE_DATA          0x04
  236 #define CDR_TMODE_QUAD_AUDIO    0x08
  237 
  238     u_int8_t    copy            :1;     /* generation stamp */
  239     u_int8_t    fp              :1;     /* fixed packet type */
  240     u_int8_t    session_type    :2;     /* session type */
  241 #define CDR_SESS_NONE           0x00
  242 #define CDR_SESS_FINAL          0x01
  243 #define CDR_SESS_RESERVED       0x02
  244 #define CDR_SESS_MULTI          0x03
  245 
  246     u_int8_t    datablock_type  :4;     /* data type code (see cdrio.h) */
  247     u_int8_t    reserved4_4567  :4;
  248     u_int8_t    link_size;
  249     u_int8_t    reserved6;
  250     u_int8_t    host_app_code   :6;     /* host application code */
  251     u_int8_t    reserved7_67    :2;
  252     u_int8_t    session_format;         /* session format */
  253 #define CDR_SESS_CDROM          0x00
  254 #define CDR_SESS_CDI            0x10
  255 #define CDR_SESS_CDROM_XA       0x20
  256 
  257     u_int8_t    reserved9;
  258     u_int32_t   packet_size;            /* packet size in bytes */
  259     u_int16_t   audio_pause_length;     /* audio pause length in secs */
  260     u_int8_t    media_catalog_number[16];
  261     u_int8_t    isr_code[16];
  262     u_int8_t    sub_hdr_byte0;
  263     u_int8_t    sub_hdr_byte1;
  264     u_int8_t    sub_hdr_byte2;
  265     u_int8_t    sub_hdr_byte3;
  266     u_int8_t    vendor_specific_byte0;
  267     u_int8_t    vendor_specific_byte1;
  268     u_int8_t    vendor_specific_byte2;
  269     u_int8_t    vendor_specific_byte3;
  270 } __packed;
  271 
  272 /* CDROM Read Track Information structure */
  273 struct acd_track_info {
  274     u_int16_t   data_length;
  275     u_int8_t    track_number;           /* current track number */
  276     u_int8_t    session_number;         /* current session number */
  277     u_int8_t    reserved4;
  278     u_int8_t    track_mode      :4;     /* mode of this track */
  279     u_int8_t    copy            :1;     /* generation stamp */
  280     u_int8_t    damage          :1;     /* damaged track */
  281     u_int8_t    reserved5_67    :2;
  282     u_int8_t    data_mode       :4;     /* data mode of this disc */
  283     u_int8_t    fp              :1;     /* fixed packet */
  284     u_int8_t    packet          :1;     /* packet track */
  285     u_int8_t    blank           :1;     /* blank (empty) track */
  286     u_int8_t    rt              :1;     /* reserved track */
  287     u_int8_t    nwa_valid       :1;     /* next_writeable_addr field valid */
  288     u_int8_t    reserved7_17    :7;
  289     u_int       track_start_addr;       /* start of this track */
  290     u_int       next_writeable_addr;    /* next writeable addr on this disc */
  291     u_int       free_blocks;            /* free block on this disc */
  292     u_int       fixed_packet_size;      /* size of packets on this track */
  293     u_int       track_length;           /* length of this track */
  294 };
  295 
  296 /* Structure describing an ATAPI CDROM device */
  297 struct acd_softc {
  298     int                         flags;          /* device state flags */
  299 #define         F_LOCKED                0x0001  /* this unit is locked */
  300 
  301     struct toc                  toc;            /* table of disc contents */
  302     struct audiopage            au;             /* audio page info */
  303     struct audiopage            aumask;         /* audio page mask */
  304     struct cappage              cap;            /* capabilities page info */
  305     struct cd_sub_channel_info  subchan;        /* subchannel info */
  306     struct changer              *changer_info;  /* changer info */
  307     struct acd_softc            **driver;       /* softc's of changer slots */
  308     int                         slot;           /* this instance slot number */
  309     time_t                      timestamp;      /* this instance timestamp */
  310     u_int32_t                   disk_size;      /* size of current media */
  311     u_int32_t                   block_size;     /* blocksize currently used */
  312     u_int32_t                   iomax;          /* Max I/O request (bytes) */
  313     struct g_geom               *gp;            /* geom instance */
  314     struct g_provider           *pp[MAXTRK+1];  /* providers */
  315 };

Cache object: 6b6277ba354d4b812ac02ab7b066256c


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.