📄 sbpcd.h
字号:
#define READ_SC 0x04 /* "subchannel info": 96 bytes per frame */
#define READ_AU 0x08 /* "audio frame": 2352 bytes per frame */
/*
* sense_byte:
*
* values: 00
* 01
* 81
* 82 "raw audio" mode
* xx from infobuf[0] after 85 00 00 00 00 00 00
*/
/* audio status (bin) */
#define aud_00 0x00 /* Audio status byte not supported or not valid */
#define audx11 0x0b /* Audio play operation in progress */
#define audx12 0x0c /* Audio play operation paused */
#define audx13 0x0d /* Audio play operation successfully completed */
#define audx14 0x0e /* Audio play operation stopped due to error */
#define audx15 0x0f /* No current audio status to return */
/* audio status (bcd) */
#define aud_11 0x11 /* Audio play operation in progress */
#define aud_12 0x12 /* Audio play operation paused */
#define aud_13 0x13 /* Audio play operation successfully completed */
#define aud_14 0x14 /* Audio play operation stopped due to error */
#define aud_15 0x15 /* No current audio status to return */
/*
* highest allowed drive number (MINOR+1)
*/
#define NR_SBPCD 4
/*
* we try to never disable interrupts - seems to work
*/
#define SBPCD_DIS_IRQ 0
/*
* "write byte to port"
*/
#define OUT(x,y) outb(y,x)
/*==========================================================================*/
#define MIXER_addr SOUND_BASE+4 /* sound card's address register */
#define MIXER_data SOUND_BASE+5 /* sound card's data register */
#define MIXER_CD_Volume 0x28 /* internal SB Pro register address */
/*==========================================================================*/
#define MAX_TRACKS 99
#define ERR_DISKCHANGE 615
/*==========================================================================*/
/*
* To make conversions easier (machine dependent!)
*/
typedef union _msf
{
u_int n;
u_char c[4];
} MSF;
typedef union _blk
{
u_int n;
u_char c[4];
} BLK;
/*==========================================================================*/
/*============================================================================
==============================================================================
COMMAND SET of "old" drives like CR-521, CR-522
(the CR-562 family is different):
No. Command Code
--------------------------------------------
Drive Commands:
1 Seek 01
2 Read Data 02
3 Read XA-Data 03
4 Read Header 04
5 Spin Up 05
6 Spin Down 06
7 Diagnostic 07
8 Read UPC 08
9 Read ISRC 09
10 Play Audio 0A
11 Play Audio MSF 0B
12 Play Audio Track/Index 0C
Status Commands:
13 Read Status 81
14 Read Error 82
15 Read Drive Version 83
16 Mode Select 84
17 Mode Sense 85
18 Set XA Parameter 86
19 Read XA Parameter 87
20 Read Capacity 88
21 Read SUB_Q 89
22 Read Disc Code 8A
23 Read Disc Information 8B
24 Read TOC 8C
25 Pause/Resume 8D
26 Read Packet 8E
27 Read Path Check 00
all numbers (lba, msf-bin, msf-bcd, counts) to transfer high byte first
mnemo 7-byte command #bytes response (r0...rn)
________ ____________________ ____
Read Status:
status: 81. (1) one-byte command, gives the main
status byte
Read Error:
check1: 82 00 00 00 00 00 00. (6) r1: audio status
Read Packet:
check2: 8e xx 00 00 00 00 00. (xx) gets xx bytes response, relating
to commands 01 04 05 07 08 09
Play Audio:
play: 0a ll-bb-aa nn-nn-nn. (0) play audio, ll-bb-aa: starting block (lba),
nn-nn-nn: #blocks
Play Audio MSF:
0b mm-ss-ff mm-ss-ff (0) play audio from/to
Play Audio Track/Index:
0c ...
Pause/Resume:
pause: 8d pr 00 00 00 00 00. (0) pause (pr=00)
resume (pr=80) audio playing
Mode Select:
84 00 nn-nn ??-?? 00 (0) nn-nn: 2048 or 2340
possibly defines transfer size
set_vol: 84 83 00 00 sw le 00. (0) sw(itch): lrxxxxxx (off=1)
le(vel): min=0, max=FF, else half
(firmware 2.11)
Mode Sense:
get_vol: 85 03 00 00 00 00 00. (2) tell current audio volume setting
Read Disc Information:
tocdesc: 8b 00 00 00 00 00 00. (6) read the toc descriptor ("msf-bin"-format)
Read TOC:
tocent: 8c fl nn 00 00 00 00. (8) read toc entry #nn
(fl=0:"lba"-, =2:"msf-bin"-format)
Read Capacity:
capacit: 88 00 00 00 00 00 00. (5) "read CD-ROM capacity"
Read Path Check:
ping: 00 00 00 00 00 00 00. (2) r0=AA, r1=55
("ping" if the drive is connected)
Read Drive Version:
ident: 83 00 00 00 00 00 00. (12) gives "MATSHITAn.nn"
(n.nn = 2.01, 2.11., 3.00, ...)
Seek:
seek: 01 00 ll-bb-aa 00 00. (0)
seek: 01 02 mm-ss-ff 00 00. (0)
Read Data:
read: 02 xx-xx-xx nn-nn fl. (??) read nn-nn blocks of 2048 bytes,
starting at block xx-xx-xx
fl=0: "lba"-, =2:"msf-bcd"-coded xx-xx-xx
Read XA-Data:
read: 03 xx-xx-xx nn-nn fl. (??) read nn-nn blocks of 2340 bytes,
starting at block xx-xx-xx
fl=0: "lba"-, =2:"msf-bcd"-coded xx-xx-xx
Read SUB_Q:
89 fl 00 00 00 00 00. (13) r0: audio status, r4-r7: lba/msf,
fl=0: "lba", fl=2: "msf"
Read Disc Code:
8a 00 00 00 00 00 00. (14) possibly extended "check condition"-info
Read Header:
04 00 ll-bb-aa 00 00. (0) 4 bytes response with "check2"
04 02 mm-ss-ff 00 00. (0) 4 bytes response with "check2"
Spin Up:
05 00 ll-bb-aa 00 00. (0) possibly implies a "seek"
Spin Down:
06 ...
Diagnostic:
07 00 ll-bb-aa 00 00. (2) 2 bytes response with "check2"
07 02 mm-ss-ff 00 00. (2) 2 bytes response with "check2"
Read UPC:
08 00 ll-bb-aa 00 00. (16)
08 02 mm-ss-ff 00 00. (16)
Read ISRC:
09 00 ll-bb-aa 00 00. (15) 15 bytes response with "check2"
09 02 mm-ss-ff 00 00. (15) 15 bytes response with "check2"
Set XA Parameter:
86 ...
Read XA Parameter:
87 ...
==============================================================================
============================================================================*/
/*
* commands
*
* CR-52x: CMD0_
* CR-56x: CMD1_
* CD200: CMD2_
* LCS-7260: CMDL_
* TEAC CD-55A: CMDT_
* ECS-AT: CMDV_
*/
#define CMD1_RESET 0x0a
#define CMD2_RESET 0x01
#define CMDT_RESET 0xc0
#define CMD1_LOCK_CTL 0x0c
#define CMD2_LOCK_CTL 0x1e
#define CMDT_LOCK_CTL CMD2_LOCK_CTL
#define CMDL_LOCK_CTL 0x0e
#define CMDV_LOCK_CTL CMDL_LOCK_CTL
#define CMD1_TRAY_CTL 0x07
#define CMD2_TRAY_CTL 0x1b
#define CMDT_TRAY_CTL CMD2_TRAY_CTL
#define CMDL_TRAY_CTL 0x0d
#define CMDV_TRAY_CTL CMDL_TRAY_CTL
#define CMD1_MULTISESS 0x8d
#define CMDL_MULTISESS 0x8c
#define CMDV_MULTISESS CMDL_MULTISESS
#define CMD1_SUBCHANINF 0x11
#define CMD2_SUBCHANINF 0x??
#define CMD1_ABORT 0x08
#define CMD2_ABORT 0x08
#define CMDT_ABORT 0x08
#define CMD2_x02 0x02
#define CMD2_SETSPEED 0xda
#define CMD0_PATH_CHECK 0x00
#define CMD1_PATH_CHECK 0x???
#define CMD2_PATH_CHECK 0x???
#define CMDT_PATH_CHECK 0x???
#define CMDL_PATH_CHECK CMD0_PATH_CHECK
#define CMDV_PATH_CHECK CMD0_PATH_CHECK
#define CMD0_SEEK 0x01
#define CMD1_SEEK CMD0_SEEK
#define CMD2_SEEK 0x2b
#define CMDT_SEEK CMD2_SEEK
#define CMDL_SEEK CMD0_SEEK
#define CMDV_SEEK CMD0_SEEK
#define CMD0_READ 0x02
#define CMD1_READ 0x10
#define CMD2_READ 0x28
#define CMDT_READ CMD2_READ
#define CMDL_READ CMD0_READ
#define CMDV_READ CMD0_READ
#define CMD0_READ_XA 0x03
#define CMD2_READ_XA 0xd4
#define CMD2_READ_XA2 0xd5
#define CMDL_READ_XA CMD0_READ_XA /* really ?? */
#define CMDV_READ_XA CMD0_READ_XA
#define CMD0_READ_HEAD 0x04
#define CMD0_SPINUP 0x05
#define CMD1_SPINUP 0x02
#define CMD2_SPINUP CMD2_TRAY_CTL
#define CMDL_SPINUP CMD0_SPINUP
#define CMDV_SPINUP CMD0_SPINUP
#define CMD0_SPINDOWN 0x06 /* really??? */
#define CMD1_SPINDOWN 0x06
#define CMD2_SPINDOWN CMD2_TRAY_CTL
#define CMDL_SPINDOWN 0x0d
#define CMDV_SPINDOWN CMD0_SPINDOWN
#define CMD0_DIAG 0x07
#define CMD0_READ_UPC 0x08
#define CMD1_READ_UPC 0x88
#define CMD2_READ_UPC 0x???
#define CMDL_READ_UPC CMD0_READ_UPC
#define CMDV_READ_UPC 0x8f
#define CMD0_READ_ISRC 0x09
#define CMD0_PLAY 0x0a
#define CMD1_PLAY 0x???
#define CMD2_PLAY 0x???
#define CMDL_PLAY CMD0_PLAY
#define CMDV_PLAY CMD0_PLAY
#define CMD0_PLAY_MSF 0x0b
#define CMD1_PLAY_MSF 0x0e
#define CMD2_PLAY_MSF 0x47
#define CMDT_PLAY_MSF CMD2_PLAY_MSF
#define CMDL_PLAY_MSF 0x???
#define CMD0_PLAY_TI 0x0c
#define CMD1_PLAY_TI 0x0f
#define CMD0_STATUS 0x81
#define CMD1_STATUS 0x05
#define CMD2_STATUS 0x00
#define CMDT_STATUS CMD2_STATUS
#define CMDL_STATUS CMD0_STATUS
#define CMDV_STATUS CMD0_STATUS
#define CMD2_SEEK_LEADIN 0x00
#define CMD0_READ_ERR 0x82
#define CMD1_READ_ERR CMD0_READ_ERR
#define CMD2_READ_ERR 0x03
#define CMDT_READ_ERR CMD2_READ_ERR /* get audio status */
#define CMDL_READ_ERR CMD0_READ_ERR
#define CMDV_READ_ERR CMD0_READ_ERR
#define CMD0_READ_VER 0x83
#define CMD1_READ_VER CMD0_READ_VER
#define CMD2_READ_VER 0x12
#define CMDT_READ_VER CMD2_READ_VER /* really ?? */
#define CMDL_READ_VER CMD0_READ_VER
#define CMDV_READ_VER CMD0_READ_VER
#define CMD0_SETMODE 0x84
#define CMD1_SETMODE 0x09
#define CMD2_SETMODE 0x55
#define CMDT_SETMODE CMD2_SETMODE
#define CMDL_SETMODE CMD0_SETMODE
#define CMD0_GETMODE 0x85
#define CMD1_GETMODE 0x84
#define CMD2_GETMODE 0x5a
#define CMDT_GETMODE CMD2_GETMODE
#define CMDL_GETMODE CMD0_GETMODE
#define CMD0_SET_XA 0x86
#define CMD0_GET_XA 0x87
#define CMD0_CAPACITY 0x88
#define CMD1_CAPACITY 0x85
#define CMD2_CAPACITY 0x25
#define CMDL_CAPACITY CMD0_CAPACITY /* missing in some firmware versions */
#define CMD0_READSUBQ 0x89
#define CMD1_READSUBQ 0x87
#define CMD2_READSUBQ 0x42
#define CMDT_READSUBQ CMD2_READSUBQ
#define CMDL_READSUBQ CMD0_READSUBQ
#define CMDV_READSUBQ CMD0_READSUBQ
#define CMD0_DISKCODE 0x8a
#define CMD0_DISKINFO 0x8b
#define CMD1_DISKINFO CMD0_DISKINFO
#define CMD2_DISKINFO 0x43
#define CMDT_DISKINFO CMD2_DISKINFO
#define CMDL_DISKINFO CMD0_DISKINFO
#define CMDV_DISKINFO CMD0_DISKINFO
#define CMD0_READTOC 0x8c
#define CMD1_READTOC CMD0_READTOC
#define CMD2_READTOC 0x???
#define CMDL_READTOC CMD0_READTOC
#define CMDV_READTOC CMD0_READTOC
#define CMD0_PAU_RES 0x8d
#define CMD1_PAU_RES 0x0d
#define CMD2_PAU_RES 0x4b
#define CMDT_PAUSE CMD2_PAU_RES
#define CMDL_PAU_RES CMD0_PAU_RES
#define CMDV_PAUSE CMD0_PAU_RES
#define CMD0_PACKET 0x8e
#define CMD1_PACKET CMD0_PACKET
#define CMD2_PACKET 0x???
#define CMDL_PACKET CMD0_PACKET
#define CMDV_PACKET 0x???
/*==========================================================================*/
/*==========================================================================*/
#endif _LINUX_SBPCD_H
/*==========================================================================*/
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
* adjust the settings for this buffer only. This must remain at the end
* of the file.
* ---------------------------------------------------------------------------
* Local variables:
* c-indent-level: 8
* c-brace-imaginary-offset: 0
* c-brace-offset: -8
* c-argdecl-indent: 8
* c-label-offset: -8
* c-continued-statement-offset: 8
* c-continued-brace-offset: 0
* End:
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -