Annotation of src/usr.bin/cdio/extern.h, Revision 1.16
1.16 ! mortimer 1: /* $OpenBSD: extern.h,v 1.15 2010/03/01 02:09:44 krw Exp $ */
1.1 espie 2: /*
3: * Copyright (c) 2002 Marc Espie.
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: * 2. Redistributions in binary form must reproduce the above copyright
11: * notice, this list of conditions and the following disclaimer in the
12: * documentation and/or other materials provided with the distribution.
13: *
14: * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
15: * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBSD
18: * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20: * 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
24: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25: */
26:
1.4 mjc 27: #include <sys/queue.h>
28:
1.1 espie 29: struct cd_toc_entry;
1.4 mjc 30: struct track_info {
31: off_t sz;
1.11 av 32: off_t off;
1.4 mjc 33: u_int blklen;
1.6 mjc 34: int fd;
1.4 mjc 35: char *file;
36: SLIST_ENTRY(track_info) track_list;
37: char type;
1.12 av 38: int speed;
1.4 mjc 39: };
1.16 ! mortimer 40: SLIST_HEAD(track_head, track_info);
! 41: extern struct track_head tracks;
1.1 espie 42:
1.12 av 43: /* Read/Write speed */
44: #define DRIVE_SPEED_MAX 0xfffe
45: #define DRIVE_SPEED_OPTIMAL 0xffff /* automatically adjusted by drive */
46:
47: /* Convert writing speed into Kbytes/sec (1x - 75 frames per second) */
48: #define CD_SPEED_TO_KBPS(x, blksz) ((x) * 75 * (blksz) / 1024)
49:
50: /*
51: * It's maximum possible speed for CD (audio track).
52: * Data tracks theoretically can be written at 436x but in practice I
53: * believe, 380x will be never reached.
54: * NOTE: this value must never be changed to a bigger value, it can cause
55: * DRIVE_SPEED_MAX overrun.
56: */
57: #define CD_MAX_SPEED 380
1.10 av 58:
1.14 fgsch 59: /* MMC feature codes */
60: #define MMC_FEATURE_CDRW_CAV 0x27 /* Constant Angular Velocity */
61: #define MMC_FEATURE_CD_TAO 0x2d /* Track-At-Once writing mode */
62: #define MMC_FEATURE_CDRW_WRITE 0x37 /* media is CD-RW and can be written */
63:
64: #define MMC_FEATURE_MAX 0x0110
65:
66: /* Media types */
1.13 av 67: #define MEDIATYPE_UNKNOWN 0
68: #define MEDIATYPE_CDR 1
69: #define MEDIATYPE_CDRW 2
70:
1.1 espie 71: extern unsigned long entry2time(struct cd_toc_entry *);
72: extern unsigned long entry2frames(struct cd_toc_entry *);
1.4 mjc 73: extern int open_cd(char *, int);
1.1 espie 74: extern char ** cddb(const char *, int, struct cd_toc_entry *, char *);
1.2 espie 75: extern unsigned long cddb_discid(int, struct cd_toc_entry *);
1.1 espie 76: extern void free_names(char **);
1.13 av 77: extern int get_media_type(void);
1.15 krw 78: extern int get_media_capabilities(u_int8_t *, int);
1.3 mjc 79: extern int blank(void);
80: extern int unit_ready(void);
81: extern int synchronize_cache(void);
82: extern int close_session(void);
1.5 mjc 83: extern int get_disc_size(off_t *);
1.3 mjc 84: extern int get_nwa(int *);
1.4 mjc 85: extern int writetao(struct track_head *);
1.7 deraadt 86: extern int writetrack(struct track_info *, int);
1.3 mjc 87: extern int mode_sense_write(unsigned char []);
88: extern int mode_select_write(unsigned char []);
1.9 fgsch 89: extern int cdrip(char *);
90: extern int cdplay(char *);
1.1 espie 91:
92: #define VERSION "2.1"
1.5 mjc 93: #define WAVHDRLEN 44