14Srgrimes/* 2346Srgrimes * 16 Feb 93 Julian Elischer (julian@dialix.oz.au) 3624Srgrimes * 450477Speter * $FreeBSD$ 54Srgrimes */ 618444Sbde 77718Sjkh/* 87718Sjkh<1> Fixed a conflict with ioctl usage. There were two different 97718Sjkh functions using code #25. Made file formatting consistent. 107718Sjkh Added two new ioctl codes: door closing and audio pitch playback. 117718Sjkh Added a STEREO union called STEREO. 127718Sjkh 5-Mar-95 Frank Durda IV bsdmail@nemesis.lonestar.org 137718Sjkh 147718Sjkh<2> Added a new ioctl that allows you to find out what capabilities 157718Sjkh a drive has and what commands it will accept. This allows a 167718Sjkh user application to only offer controls (buttons, sliders, etc) 177718Sjkh for functions that drive can actually do. Things it can't do 187718Sjkh can disappear or be greyed-out (like some other system). 197718Sjkh If the driver doesn't respond to this call, well, handle it the 207718Sjkh way you used to do it. 217718Sjkh 2-Apr-95 Frank Durda IV bsdmail@nemesis.lonestar.org 227718Sjkh*/ 237718Sjkh 244Srgrimes/* Shared between kernel & process */ 254Srgrimes 2618444Sbde#ifndef _SYS_CDIO_H_ 2718444Sbde#define _SYS_CDIO_H_ 2818444Sbde 2955205Speter#ifndef _KERNEL 3018444Sbde#include <sys/types.h> 3118444Sbde#endif 3218444Sbde#include <sys/ioccom.h> 3318444Sbde 341091Sswallaceunion msf_lba { 351091Sswallace struct { 361091Sswallace unsigned char unused; 371091Sswallace unsigned char minute; 381091Sswallace unsigned char second; 391091Sswallace unsigned char frame; 401091Sswallace } msf; 4113819Sache int lba; /* network byte order */ 421091Sswallace u_char addr[4]; 431091Sswallace}; 441091Sswallace 454Srgrimesstruct cd_toc_entry { 4693881Ssos#if BYTE_ORDER == LITTLE_ENDIAN 47114289Smarkm u_int :8; 48114289Smarkm u_int control:4; 49114289Smarkm u_int addr_type:4; 5093881Ssos#else 51114289Smarkm u_int :8; 52114289Smarkm u_int addr_type:4; 53114289Smarkm u_int control:4; 5493881Ssos#endif 554Srgrimes u_char track; 5636767Sbde u_int :8; 571091Sswallace union msf_lba addr; 584Srgrimes}; 594Srgrimes 604Srgrimesstruct cd_sub_channel_header { 6136767Sbde u_int :8; 628876Srgrimes u_char audio_status; 634Srgrimes#define CD_AS_AUDIO_INVALID 0x00 644Srgrimes#define CD_AS_PLAY_IN_PROGRESS 0x11 654Srgrimes#define CD_AS_PLAY_PAUSED 0x12 664Srgrimes#define CD_AS_PLAY_COMPLETED 0x13 674Srgrimes#define CD_AS_PLAY_ERROR 0x14 684Srgrimes#define CD_AS_NO_STATUS 0x15 694Srgrimes u_char data_len[2]; 704Srgrimes}; 714Srgrimes 724Srgrimesstruct cd_sub_channel_position_data { 734Srgrimes u_char data_format; 7436767Sbde u_int control:4; 7536767Sbde u_int addr_type:4; 764Srgrimes u_char track_number; 774Srgrimes u_char index_number; 781091Sswallace union msf_lba absaddr; 791091Sswallace union msf_lba reladdr; 804Srgrimes}; 814Srgrimes 824Srgrimesstruct cd_sub_channel_media_catalog { 834Srgrimes u_char data_format; 8436767Sbde u_int :8; 8536767Sbde u_int :8; 8636767Sbde u_int :8; 8736767Sbde u_int :7; 8836767Sbde u_int mc_valid:1; 898876Srgrimes u_char mc_number[15]; 904Srgrimes}; 914Srgrimes 924Srgrimesstruct cd_sub_channel_track_info { 934Srgrimes u_char data_format; 9436767Sbde u_int :8; 954Srgrimes u_char track_number; 9636767Sbde u_int :8; 9736767Sbde u_int :7; 9836767Sbde u_int ti_valid:1; 998876Srgrimes u_char ti_number[15]; 1004Srgrimes}; 1014Srgrimes 1024Srgrimesstruct cd_sub_channel_info { 1034Srgrimes struct cd_sub_channel_header header; 1044Srgrimes union { 1054Srgrimes struct cd_sub_channel_position_data position; 1064Srgrimes struct cd_sub_channel_media_catalog media_catalog; 1078876Srgrimes struct cd_sub_channel_track_info track_info; 1084Srgrimes } what; 1094Srgrimes}; 1104Srgrimes 1117718Sjkh 1124Srgrimes/***************************************************************\ 1134Srgrimes* Ioctls for the CD drive * 1144Srgrimes\***************************************************************/ 1157718Sjkh 11683045Sobrienstruct ioc_play_track { 1174Srgrimes u_char start_track; 1184Srgrimes u_char start_index; 1194Srgrimes u_char end_track; 1204Srgrimes u_char end_index; 1214Srgrimes}; 1227718Sjkh#define CDIOCPLAYTRACKS _IOW('c',1,struct ioc_play_track) 1234Srgrimes 1247718Sjkh 12583045Sobrienstruct ioc_play_blocks { 1264Srgrimes int blk; 1274Srgrimes int len; 1284Srgrimes}; 1294Srgrimes#define CDIOCPLAYBLOCKS _IOW('c',2,struct ioc_play_blocks) 1304Srgrimes 1317718Sjkh 1324Srgrimesstruct ioc_read_subchannel { 1334Srgrimes u_char address_format; 1344Srgrimes#define CD_LBA_FORMAT 1 1354Srgrimes#define CD_MSF_FORMAT 2 1364Srgrimes u_char data_format; 1374Srgrimes#define CD_SUBQ_DATA 0 1384Srgrimes#define CD_CURRENT_POSITION 1 1394Srgrimes#define CD_MEDIA_CATALOG 2 1404Srgrimes#define CD_TRACK_INFO 3 1414Srgrimes u_char track; 1424Srgrimes int data_len; 1434Srgrimes struct cd_sub_channel_info *data; 1444Srgrimes}; 1454Srgrimes#define CDIOCREADSUBCHANNEL _IOWR('c', 3 , struct ioc_read_subchannel ) 1464Srgrimes 1474Srgrimes 1484Srgrimesstruct ioc_toc_header { 1494Srgrimes u_short len; 1504Srgrimes u_char starting_track; 1514Srgrimes u_char ending_track; 1524Srgrimes}; 1534Srgrimes#define CDIOREADTOCHEADER _IOR('c',4,struct ioc_toc_header) 1544Srgrimes 1557718Sjkh 1564Srgrimesstruct ioc_read_toc_entry { 1574Srgrimes u_char address_format; 1584Srgrimes u_char starting_track; 1594Srgrimes u_short data_len; 1604Srgrimes struct cd_toc_entry *data; 1614Srgrimes}; 1624Srgrimes#define CDIOREADTOCENTRYS _IOWR('c',5,struct ioc_read_toc_entry) 1634Srgrimes 1647718Sjkh 16525460Sjoergstruct ioc_read_toc_single_entry { 16625460Sjoerg u_char address_format; 16725460Sjoerg u_char track; 16825460Sjoerg struct cd_toc_entry entry; 16925460Sjoerg}; 17025460Sjoerg#define CDIOREADTOCENTRY _IOWR('c',6,struct ioc_read_toc_single_entry) 17125460Sjoerg 17225460Sjoerg 17383045Sobrienstruct ioc_patch { 1744Srgrimes u_char patch[4]; /* one for each channel */ 1754Srgrimes}; 1764Srgrimes#define CDIOCSETPATCH _IOW('c',9,struct ioc_patch) 1777718Sjkh 1787718Sjkh 17983045Sobrienstruct ioc_vol { 1804Srgrimes u_char vol[4]; /* one for each channel */ 1814Srgrimes}; 1824Srgrimes#define CDIOCGETVOL _IOR('c',10,struct ioc_vol) 1837718Sjkh 1844Srgrimes#define CDIOCSETVOL _IOW('c',11,struct ioc_vol) 1857718Sjkh 1864Srgrimes#define CDIOCSETMONO _IO('c',12) 1877718Sjkh 1884Srgrimes#define CDIOCSETSTERIO _IO('c',13) 1897718Sjkh#define CDIOCSETSTEREO _IO('c',13) 1907718Sjkh 1914Srgrimes#define CDIOCSETMUTE _IO('c',14) 1927718Sjkh 1934Srgrimes#define CDIOCSETLEFT _IO('c',15) 1947718Sjkh 1954Srgrimes#define CDIOCSETRIGHT _IO('c',16) 1967718Sjkh 1974Srgrimes#define CDIOCSETDEBUG _IO('c',17) 1987718Sjkh 1994Srgrimes#define CDIOCCLRDEBUG _IO('c',18) 2007718Sjkh 2014Srgrimes#define CDIOCPAUSE _IO('c',19) 2027718Sjkh 2034Srgrimes#define CDIOCRESUME _IO('c',20) 2047718Sjkh 2054Srgrimes#define CDIOCRESET _IO('c',21) 2067718Sjkh 2074Srgrimes#define CDIOCSTART _IO('c',22) 2087718Sjkh 2094Srgrimes#define CDIOCSTOP _IO('c',23) 2107718Sjkh 2114Srgrimes#define CDIOCEJECT _IO('c',24) 2124Srgrimes 2137718Sjkh 21483045Sobrienstruct ioc_play_msf { 215346Srgrimes u_char start_m; 216346Srgrimes u_char start_s; 217346Srgrimes u_char start_f; 218346Srgrimes u_char end_m; 219346Srgrimes u_char end_s; 220346Srgrimes u_char end_f; 221346Srgrimes}; 222346Srgrimes#define CDIOCPLAYMSF _IOW('c',25,struct ioc_play_msf) 2234Srgrimes 2247718Sjkh#define CDIOCALLOW _IO('c',26) 2257718Sjkh 2267718Sjkh#define CDIOCPREVENT _IO('c',27) 2277718Sjkh 2287718Sjkh /*<1>For drives that support it, this*/ 2297718Sjkh /*<1>causes the drive to close its door*/ 2307718Sjkh /*<1>and make the media (if any) ready*/ 2317718Sjkh#define CDIOCCLOSE _IO('c',28) /*<1>*/ 2327718Sjkh 2337718Sjkh 23483045Sobrienstruct ioc_pitch { /*<1>For drives that support it, this*/ 23583045Sobrien /*<1>call instructs the drive to play the*/ 2367718Sjkh short speed; /*<1>audio at a faster or slower-than-normal*/ 2377718Sjkh}; /*<1>rate. -32767 to -1 is slower, 0==normal,*/ 2387718Sjkh /*<1>and 1 to 32767 is faster. LSB bits are*/ 2397718Sjkh /*<1>discarded first by drives with less res.*/ 2407718Sjkh#define CDIOCPITCH _IOW('c',29,struct ioc_pitch) /*<1>*/ 2417718Sjkh 2427718Sjkhstruct ioc_capability { /*<2>*/ 2437718Sjkh u_long play_function; /*<2>*/ 2447718Sjkh#define CDDOPLAYTRK 0x00000001 /*<2>Can Play tracks/index*/ 2457718Sjkh#define CDDOPLAYMSF 0x00000002 /*<2>Can Play msf to msf*/ 2467718Sjkh#define CDDOPLAYBLOCKS 0x00000004 /*<2>Can Play range of blocks*/ 2477718Sjkh#define CDDOPAUSE 0x00000100 /*<2>Output can be paused*/ 2487718Sjkh#define CDDORESUME 0x00000200 /*<2>Output can be resumed*/ 2497718Sjkh#define CDDORESET 0x00000400 /*<2>Drive can be completely reset*/ 2507718Sjkh#define CDDOSTART 0x00000800 /*<2>Audio can be started*/ 2517718Sjkh#define CDDOSTOP 0x00001000 /*<2>Audio can be stopped*/ 2527718Sjkh#define CDDOPITCH 0x00002000 /*<2>Audio pitch */ 2537718Sjkh 2547718Sjkh u_long routing_function; /*<2>*/ 2557718Sjkh#define CDREADVOLUME 0x00000001 /*<2>Volume settings can be read*/ 2567718Sjkh#define CDSETVOLUME 0x00000002 /*<2>Volume settings can be set*/ 2577718Sjkh#define CDSETMONO 0x00000100 /*<2>Output can be set to mono*/ 2587718Sjkh#define CDSETSTEREO 0x00000200 /*<2>Output can be set to stereo (def)*/ 2597718Sjkh#define CDSETLEFT 0x00000400 /*<2>Output can be set to left only*/ 2607718Sjkh#define CDSETRIGHT 0x00000800 /*<2>Output can be set to right only*/ 2617718Sjkh#define CDSETMUTE 0x00001000 /*<2>Output can be muted*/ 26213724Smpp#define CDSETPATCH 0x00008000 /*<2>Direct routing control allowed*/ 2637718Sjkh 2647718Sjkh u_long special_function; /*<2>*/ 2657718Sjkh#define CDDOEJECT 0x00000001 /*<2>The tray can be opened*/ 2667718Sjkh#define CDDOCLOSE 0x00000002 /*<2>The tray can be closed*/ 2677718Sjkh#define CDDOLOCK 0x00000004 /*<2>The tray can be locked*/ 2687718Sjkh#define CDREADHEADER 0x00000100 /*<2>Can read Table of Contents*/ 2697718Sjkh#define CDREADENTRIES 0x00000200 /*<2>Can read TOC Entries*/ 2707718Sjkh#define CDREADSUBQ 0x00000200 /*<2>Can read Subchannel info*/ 2717718Sjkh#define CDREADRW 0x00000400 /*<2>Can read subcodes R-W*/ 2727718Sjkh#define CDHASDEBUG 0x00004000 /*<2>The tray has dynamic debugging*/ 2737718Sjkh}; /*<2>*/ 2747718Sjkh 2757718Sjkh#define CDIOCCAPABILITY _IOR('c',30,struct ioc_capability) /*<2>*/ 2767718Sjkh 277141031Ssobomax/* 278141031Ssobomax * Special version of CDIOCREADSUBCHANNEL which assumes that 279141031Ssobomax * ioc_read_subchannel->data points to the kernel memory. For 280141031Ssobomax * use in compatibility layers. 281141031Ssobomax */ 282141031Ssobomax#define CDIOCREADSUBCHANNEL_SYSSPACE _IOWR('c', 31, struct ioc_read_subchannel) 283141031Ssobomax 28418444Sbde#endif /* !_SYS_CDIO_H_ */ 285