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/sys/cdio.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 /*      $NetBSD: cdio.h,v 1.31.8.1 2009/02/18 00:41:41 snj Exp $        */
    2 
    3 #ifndef _SYS_CDIO_H_
    4 #define _SYS_CDIO_H_
    5 
    6 /* Shared between kernel & process */
    7 
    8 union msf_lba {
    9         struct {
   10                 u_char unused;
   11                 u_char minute;
   12                 u_char second;
   13                 u_char frame;
   14         } msf;
   15         uint32_t lba;
   16         u_char  addr[4];
   17 };
   18 
   19 struct cd_toc_entry {
   20         u_char  nothing1;
   21 #if BYTE_ORDER == LITTLE_ENDIAN
   22         u_char  control:4;
   23         u_char  addr_type:4;
   24 #endif
   25 #if BYTE_ORDER == BIG_ENDIAN
   26         u_char  addr_type:4;
   27         u_char  control:4;
   28 #endif
   29         u_char  track;
   30         u_char  nothing2;
   31         union msf_lba   addr;
   32 };
   33 
   34 struct cd_sub_channel_header {
   35         u_char  nothing1;
   36         u_char  audio_status;
   37 #define CD_AS_AUDIO_INVALID     0x00
   38 #define CD_AS_PLAY_IN_PROGRESS  0x11
   39 #define CD_AS_PLAY_PAUSED       0x12
   40 #define CD_AS_PLAY_COMPLETED    0x13
   41 #define CD_AS_PLAY_ERROR        0x14
   42 #define CD_AS_NO_STATUS         0x15
   43         u_char  data_len[2];
   44 };
   45 
   46 struct cd_sub_channel_q_data {
   47         u_char  data_format;
   48 #if BYTE_ORDER == LITTLE_ENDIAN
   49         u_char  control:4;
   50         u_char  addr_type:4;
   51 #endif
   52 #if BYTE_ORDER == BIG_ENDIAN
   53         u_char  addr_type:4;
   54         u_char  control:4;
   55 #endif
   56         u_char  track_number;
   57         u_char  index_number;
   58         u_char  absaddr[4];
   59         u_char  reladdr[4];
   60 #if BYTE_ORDER == LITTLE_ENDIAN
   61         u_char  :7;
   62         u_char  mc_valid:1;
   63 #endif
   64 #if BYTE_ORDER == BIG_ENDIAN
   65         u_char  mc_valid:1;
   66         u_char  :7;
   67 #endif
   68         u_char  mc_number[15];
   69 #if BYTE_ORDER == LITTLE_ENDIAN
   70         u_char  :7;
   71         u_char  ti_valid:1;
   72 #endif
   73 #if BYTE_ORDER == BIG_ENDIAN
   74         u_char  ti_valid:1;
   75         u_char  :7;
   76 #endif
   77         u_char  ti_number[15];
   78 };
   79 
   80 struct cd_sub_channel_position_data {
   81         u_char  data_format;
   82 #if BYTE_ORDER == LITTLE_ENDIAN
   83         u_char  control:4;
   84         u_char  addr_type:4;
   85 #endif
   86 #if BYTE_ORDER == BIG_ENDIAN
   87         u_char  addr_type:4;
   88         u_char  control:4;
   89 #endif
   90         u_char  track_number;
   91         u_char  index_number;
   92         union msf_lba   absaddr;
   93         union msf_lba   reladdr;
   94 };
   95 
   96 struct cd_sub_channel_media_catalog {
   97         u_char  data_format;
   98         u_char  nothing1;
   99         u_char  nothing2;
  100         u_char  nothing3;
  101 #if BYTE_ORDER == LITTLE_ENDIAN
  102         u_char  :7;
  103         u_char  mc_valid:1;
  104 #endif
  105 #if BYTE_ORDER == BIG_ENDIAN
  106         u_char  mc_valid:1;
  107         u_char  :7;
  108 #endif
  109         u_char  mc_number[15];
  110 };
  111 
  112 struct cd_sub_channel_track_info {
  113         u_char  data_format;
  114         u_char  nothing1;
  115         u_char  track_number;
  116         u_char  nothing2;
  117 #if BYTE_ORDER == LITTLE_ENDIAN
  118         u_char  :7;
  119         u_char  ti_valid:1;
  120 #endif
  121 #if BYTE_ORDER == BIG_ENDIAN
  122         u_char  ti_valid:1;
  123         u_char  :7;
  124 #endif
  125         u_char  ti_number[15];
  126 };
  127 
  128 struct cd_sub_channel_info {
  129         struct cd_sub_channel_header header;
  130         union {
  131                 struct cd_sub_channel_q_data q_data;
  132                 struct cd_sub_channel_position_data position;
  133                 struct cd_sub_channel_media_catalog media_catalog;
  134                 struct cd_sub_channel_track_info track_info;
  135         } what;
  136 };
  137 
  138 /*
  139  * Ioctls for the CD drive
  140  */
  141 struct ioc_play_track {
  142         u_char  start_track;
  143         u_char  start_index;
  144         u_char  end_track;
  145         u_char  end_index;
  146 };
  147 
  148 #define CDIOCPLAYTRACKS _IOW('c', 1, struct ioc_play_track)
  149 struct ioc_play_blocks {
  150         int     blk;
  151         int     len;
  152 };
  153 #define CDIOCPLAYBLOCKS _IOW('c', 2, struct ioc_play_blocks)
  154 
  155 struct ioc_read_subchannel {
  156         u_char  address_format;
  157 #define CD_LBA_FORMAT           1
  158 #define CD_MSF_FORMAT           2
  159         u_char  data_format;
  160 #define CD_SUBQ_DATA            0
  161 #define CD_CURRENT_POSITION     1
  162 #define CD_MEDIA_CATALOG        2
  163 #define CD_TRACK_INFO           3
  164         u_char  track;
  165         int     data_len;
  166         struct  cd_sub_channel_info *data;
  167 };
  168 #define CDIOCREADSUBCHANNEL _IOWR('c', 3, struct ioc_read_subchannel )
  169 
  170 #ifdef _KERNEL
  171 /* As above, but with the buffer following the request for in-kernel users. */
  172 struct ioc_read_subchannel_buf {
  173         struct ioc_read_subchannel req;
  174         struct cd_sub_channel_info info;
  175 };
  176 #define CDIOCREADSUBCHANNEL_BUF _IOWR('c', 3, struct ioc_read_subchannel_buf)
  177 #endif
  178 
  179 struct ioc_toc_header {
  180         u_short len;
  181         u_char  starting_track;
  182         u_char  ending_track;
  183 };
  184 
  185 #define CDIOREADTOCHEADER _IOR('c', 4, struct ioc_toc_header)
  186 
  187 struct ioc_read_toc_entry {
  188         u_char  address_format;
  189         u_char  starting_track;
  190         u_short data_len;
  191         struct  cd_toc_entry *data;
  192 };
  193 #define CDIOREADTOCENTRIES _IOWR('c', 5, struct ioc_read_toc_entry)
  194 #define CDIOREADTOCENTRYS CDIOREADTOCENTRIES
  195 
  196 #ifdef _KERNEL
  197 /* As above, but with the buffer following the request for in-kernel users. */
  198 struct ioc_read_toc_entry_buf {
  199         struct ioc_read_toc_entry req;
  200         struct cd_toc_entry       entry[100];   /* NB: 8 bytes each */
  201 };
  202 #define CDIOREADTOCENTRIES_BUF _IOWR('c', 5, struct ioc_read_toc_entry_buf)
  203 #endif
  204 
  205 /* read LBA start of a given session; 0=last, others not yet supported */
  206 #define CDIOREADMSADDR _IOWR('c', 6, int)
  207 
  208 struct  ioc_patch {
  209         u_char  patch[4];       /* one for each channel */
  210 };
  211 #define CDIOCSETPATCH   _IOW('c', 9, struct ioc_patch)
  212 
  213 struct  ioc_vol {
  214         u_char  vol[4]; /* one for each channel */
  215 };
  216 #define CDIOCGETVOL     _IOR('c', 10, struct ioc_vol)
  217 #define CDIOCSETVOL     _IOW('c', 11, struct ioc_vol)
  218 #define CDIOCSETMONO    _IO('c', 12)
  219 #define CDIOCSETSTEREO  _IO('c', 13)
  220 #define CDIOCSETMUTE    _IO('c', 14)
  221 #define CDIOCSETLEFT    _IO('c', 15)
  222 #define CDIOCSETRIGHT   _IO('c', 16)
  223 #define CDIOCSETDEBUG   _IO('c', 17)
  224 #define CDIOCCLRDEBUG   _IO('c', 18)
  225 #define CDIOCPAUSE      _IO('c', 19)
  226 #define CDIOCRESUME     _IO('c', 20)
  227 #define CDIOCRESET      _IO('c', 21)
  228 #define CDIOCSTART      _IO('c', 22)
  229 #define CDIOCSTOP       _IO('c', 23)
  230 #define CDIOCEJECT      _IO('c', 24)
  231 #define CDIOCALLOW      _IO('c', 25)
  232 #define CDIOCPREVENT    _IO('c', 26)
  233 #define CDIOCCLOSE      _IO('c', 27)
  234 
  235 struct ioc_play_msf {
  236         u_char  start_m;
  237         u_char  start_s;
  238         u_char  start_f;
  239         u_char  end_m;
  240         u_char  end_s;
  241         u_char  end_f;
  242 };
  243 #define CDIOCPLAYMSF    _IOW('c', 25, struct ioc_play_msf)
  244 
  245 struct ioc_load_unload {
  246         u_char options;
  247 #define CD_LU_ABORT     0x1     /* NOTE: These are the same as the ATAPI */
  248 #define CD_LU_UNLOAD    0x2     /* op values for the LOAD_UNLOAD command */
  249 #define CD_LU_LOAD      0x3
  250         u_char slot;
  251 };
  252 #define         CDIOCLOADUNLOAD _IOW('c', 26, struct ioc_load_unload)
  253 
  254 
  255 #if defined(_KERNEL) || defined(_EXPOSE_MMC)
  256 /* not exposed to userland yet until its completely mature */
  257 /*
  258  * MMC device abstraction interface.
  259  *
  260  * It gathers information from GET_CONFIGURATION, READ_DISCINFO,
  261  * READ_TRACKINFO, READ_TOC2, READ_CD_CAPACITY and GET_CONFIGURATION
  262  * SCSI/ATAPI calls regardless if its a legacy CD-ROM/DVD-ROM device or a MMC
  263  * standard recordable device.
  264  */
  265 struct mmc_discinfo {
  266         uint16_t        mmc_profile;
  267         uint16_t        mmc_class;
  268 
  269         uint8_t         disc_state;
  270         uint8_t         last_session_state;
  271         uint8_t         bg_format_state;
  272         uint8_t         link_block_penalty;     /* in sectors              */
  273 
  274         uint64_t        mmc_cur;                /* current MMC_CAPs        */
  275         uint64_t        mmc_cap;                /* possible MMC_CAPs       */
  276 
  277         uint32_t        disc_flags;             /* misc flags              */
  278 
  279         uint32_t        disc_id;
  280         uint64_t        disc_barcode;
  281         uint8_t         application_code;       /* 8 bit really            */
  282 
  283         uint8_t         unused1[3];             /* padding                 */
  284 
  285         uint32_t        last_possible_lba;      /* last leadout start adr. */
  286         uint32_t        sector_size;
  287 
  288         uint16_t        num_sessions;
  289         uint16_t        num_tracks;             /* derived */
  290 
  291         uint16_t        first_track;
  292         uint16_t        first_track_last_session;
  293         uint16_t        last_track_last_session;
  294 
  295         uint16_t        unused2;                /* padding/misc info resv. */
  296 
  297         uint16_t        reserved1[4];           /* MMC-5 track resources   */
  298         uint32_t        reserved2[3];           /* MMC-5 POW resources     */
  299 
  300         uint32_t        reserved3[8];           /* MMC-5+ */
  301 };
  302 #define MMCGETDISCINFO  _IOR('c', 28, struct mmc_discinfo)
  303 
  304 #define MMC_CLASS_UNKN  0
  305 #define MMC_CLASS_DISC  1
  306 #define MMC_CLASS_CD    2
  307 #define MMC_CLASS_DVD   3
  308 #define MMC_CLASS_MO    4
  309 #define MMC_CLASS_BD    5
  310 #define MMC_CLASS_FILE  0xffff  /* emulation mode */
  311 
  312 #define MMC_DFLAGS_BARCODEVALID (1 <<  0)  /* barcode is present and valid   */
  313 #define MMC_DFLAGS_DISCIDVALID  (1 <<  1)  /* discid is present and valid    */
  314 #define MMC_DFLAGS_APPCODEVALID (1 <<  2)  /* application code valid         */
  315 #define MMC_DFLAGS_UNRESTRICTED (1 <<  3)  /* restricted, then set app. code */
  316 
  317 #define MMC_DFLAGS_FLAGBITS \
  318     "\1\1BARCODEVALID\2DISCIDVALID\3APPCODEVALID\4UNRESTRICTED"
  319 
  320 #define MMC_CAP_SEQUENTIAL      (1 <<  0)  /* sequential writable only       */
  321 #define MMC_CAP_RECORDABLE      (1 <<  1)  /* record-able; i.e. not static   */
  322 #define MMC_CAP_ERASABLE        (1 <<  2)  /* drive can erase sectors        */
  323 #define MMC_CAP_BLANKABLE       (1 <<  3)  /* media can be blanked           */
  324 #define MMC_CAP_FORMATTABLE     (1 <<  4)  /* media can be formatted         */
  325 #define MMC_CAP_REWRITABLE      (1 <<  5)  /* media can be rewritten         */
  326 #define MMC_CAP_MRW             (1 <<  6)  /* Mount Rainier formatted        */
  327 #define MMC_CAP_PACKET          (1 <<  7)  /* using packet recording         */
  328 #define MMC_CAP_STRICTOVERWRITE (1 <<  8)  /* only writes a packet at a time */
  329 #define MMC_CAP_PSEUDOOVERWRITE (1 <<  9)  /* overwrite through replacement  */
  330 #define MMC_CAP_ZEROLINKBLK     (1 << 10)  /* zero link block length capable */
  331 #define MMC_CAP_HW_DEFECTFREE   (1 << 11)  /* hardware defect management     */
  332 
  333 #define MMC_CAP_FLAGBITS \
  334     "\1\1SEQUENTIAL\2RECORDABLE\3ERASABLE\4BLANKABLE\5FORMATTABLE" \
  335     "\6REWRITABLE\7MRW\10PACKET\11STRICTOVERWRITE\12PSEUDOOVERWRITE" \
  336     "\13ZEROLINKBLK\14HW_DEFECTFREE"
  337 
  338 #define MMC_STATE_EMPTY         0
  339 #define MMC_STATE_INCOMPLETE    1
  340 #define MMC_STATE_FULL          2
  341 #define MMC_STATE_CLOSED        3
  342 
  343 #define MMC_BGFSTATE_UNFORM     0
  344 #define MMC_BGFSTATE_STOPPED    1
  345 #define MMC_BGFSTATE_RUNNING    2
  346 #define MMC_BGFSTATE_COMPLETED  3
  347 
  348 
  349 struct mmc_trackinfo {
  350         uint16_t        tracknr;        /* IN/OUT */
  351         uint16_t        sessionnr;
  352 
  353         uint8_t         track_mode;
  354         uint8_t         data_mode;
  355 
  356         uint16_t        flags;
  357 
  358         uint32_t        track_start;
  359         uint32_t        next_writable;
  360         uint32_t        free_blocks;
  361         uint32_t        packet_size;
  362         uint32_t        track_size;
  363         uint32_t        last_recorded;
  364 };
  365 #define MMCGETTRACKINFO _IOWR('c', 29, struct mmc_trackinfo)
  366 
  367 #define MMC_TRACKINFO_COPY              (1 <<  0)
  368 #define MMC_TRACKINFO_DAMAGED           (1 <<  1)
  369 #define MMC_TRACKINFO_FIXED_PACKET      (1 <<  2)
  370 #define MMC_TRACKINFO_INCREMENTAL       (1 <<  3)
  371 #define MMC_TRACKINFO_BLANK             (1 <<  4)
  372 #define MMC_TRACKINFO_RESERVED          (1 <<  5)
  373 #define MMC_TRACKINFO_NWA_VALID         (1 <<  6)
  374 #define MMC_TRACKINFO_LRA_VALID         (1 <<  7)
  375 #define MMC_TRACKINFO_DATA              (1 <<  8)
  376 #define MMC_TRACKINFO_AUDIO             (1 <<  9)
  377 #define MMC_TRACKINFO_AUDIO_4CHAN       (1 << 10)
  378 #define MMC_TRACKINFO_PRE_EMPH          (1 << 11)
  379 
  380 #define MMC_TRACKINFO_FLAGBITS \
  381     "\1\1COPY\2DAMAGED\3FIXEDPACKET\4INCREMENTAL\5BLANK" \
  382     "\6RESERVED\7NWA_VALID\10LRA_VALID\11DATA\12AUDIO" \
  383     "\13AUDIO_4CHAN\14PRE_EMPH"
  384 
  385 struct mmc_op {
  386         uint16_t        operation;              /* IN */
  387         uint16_t        mmc_profile;            /* IN */
  388 
  389         /* parameters to operation */
  390         uint16_t        tracknr;                /* IN */
  391         uint16_t        sessionnr;              /* IN */
  392         uint32_t        extent;                 /* IN */
  393 
  394         uint32_t        reserved[4];
  395 };
  396 #define MMCOP _IOWR('c', 30, struct mmc_op)
  397 
  398 #define MMC_OP_SYNCHRONISECACHE          1
  399 #define MMC_OP_CLOSETRACK                2
  400 #define MMC_OP_CLOSESESSION              3
  401 #define MMC_OP_FINALISEDISC              4
  402 #define MMC_OP_RESERVETRACK              5
  403 #define MMC_OP_RESERVETRACK_NWA          6
  404 #define MMC_OP_UNRESERVETRACK            7
  405 #define MMC_OP_REPAIRTRACK               8
  406 #define MMC_OP_UNCLOSELASTSESSION        9
  407 #define MMC_OP_MAX                       9
  408 
  409 struct mmc_writeparams {
  410         uint16_t        tracknr;                /* IN */
  411         uint16_t        mmc_class;              /* IN */
  412         uint32_t        mmc_cur;                /* IN */
  413         uint32_t        blockingnr;             /* IN */
  414 
  415         /* when tracknr == 0 */
  416         uint8_t         track_mode;             /* IN; normally 5 */
  417         uint8_t         data_mode;              /* IN; normally 2 */
  418 };
  419 #define MMC_TRACKMODE_DEFAULT   5               /* data, incremental recording */
  420 #define MMC_DATAMODE_DEFAULT    2               /* CDROM XA disc */
  421 #define MMCSETUPWRITEPARAMS _IOW('c', 31, struct mmc_writeparams)
  422 
  423 #endif /* _KERNEL || _EXPOSE_MMC */
  424 
  425 #endif /* !_SYS_CDIO_H_ */

Cache object: 4346c728017285371d153a64423a3a20


[ 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.