Search
lxdream.org :: lxdream/src/gdrom/packet.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/gdrom/packet.h
changeset 736:a02d1475ccfd
prev644:ccae4bfa5f82
next858:368fc0dcd57c
author nkeynes
date Mon Jul 14 07:44:42 2008 +0000 (11 years ago)
permissions -rw-r--r--
last change Re-indent everything consistently
Fix include guards for consistency as well
file annotate diff log raw
nkeynes@142
     1
/**
nkeynes@561
     2
 * $Id$
nkeynes@142
     3
 *
nkeynes@142
     4
 * This file defines the command codes and any other flags used by the 
nkeynes@142
     5
 * GD-Rom ATAPI packet commands.
nkeynes@142
     6
 *
nkeynes@142
     7
 * Copyright (c) 2005 Nathan Keynes.
nkeynes@142
     8
 *
nkeynes@142
     9
 * This program is free software; you can redistribute it and/or modify
nkeynes@142
    10
 * it under the terms of the GNU General Public License as published by
nkeynes@142
    11
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@142
    12
 * (at your option) any later version.
nkeynes@142
    13
 *
nkeynes@142
    14
 * This program is distributed in the hope that it will be useful,
nkeynes@142
    15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@142
    16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@142
    17
 * GNU General Public License for more details.
nkeynes@142
    18
 */
nkeynes@142
    19
nkeynes@736
    20
#ifndef lxdream_packet_H
nkeynes@736
    21
#define lxdream_packet_H 1
nkeynes@736
    22
nkeynes@142
    23
/**
nkeynes@142
    24
 * Valid command codes (hex):
nkeynes@142
    25
 * 00  Test 
nkeynes@142
    26
 * 10
nkeynes@142
    27
 * 11  Inquiry
nkeynes@142
    28
 * 12
nkeynes@142
    29
 * 13  Request Sense
nkeynes@142
    30
 * 14  Read TOC
nkeynes@245
    31
 * 15  Read session info
nkeynes@142
    32
 * 16
nkeynes@142
    33
 * 20
nkeynes@142
    34
 * 21
nkeynes@142
    35
 * 22
nkeynes@142
    36
 * 30  Read CD
nkeynes@142
    37
 * 31
nkeynes@245
    38
 * 40  Read Status ?
nkeynes@142
    39
 * 50
nkeynes@142
    40
 * 51
nkeynes@142
    41
 * 52
nkeynes@142
    42
 * 53
nkeynes@142
    43
 * 54
nkeynes@142
    44
 * 55
nkeynes@158
    45
 * 70  
nkeynes@142
    46
 * 71
nkeynes@142
    47
 * 72
nkeynes@142
    48
 * 73
nkeynes@142
    49
 * FE
nkeynes@142
    50
 */
nkeynes@142
    51
nkeynes@142
    52
#define PKT_CMD_TEST_READY 0x00
nkeynes@493
    53
#define PKT_CMD_MODE_SENSE 0x11
nkeynes@493
    54
#define PKT_CMD_MODE_SELECT 0x12
nkeynes@142
    55
#define PKT_CMD_SENSE    0x13
nkeynes@142
    56
#define PKT_CMD_READ_TOC 0x14
nkeynes@158
    57
#define PKT_CMD_SESSION_INFO 0x15
nkeynes@142
    58
#define PKT_CMD_READ_SECTOR 0x30
nkeynes@342
    59
#define PKT_CMD_PLAY_AUDIO  0x20 /* ? */
nkeynes@245
    60
#define PKT_CMD_STATUS  0x40
nkeynes@149
    61
#define PKT_CMD_SPIN_UP 0x70 /* ??? */
nkeynes@158
    62
#define PKT_CMD_71      0x71 /* ??? seems to return garbage */
nkeynes@142
    63
nkeynes@142
    64
#define PKT_ERR_OK        0x0000
nkeynes@142
    65
#define PKT_ERR_NODISC    0x3A02
nkeynes@142
    66
#define PKT_ERR_BADCMD    0x2005
nkeynes@142
    67
#define PKT_ERR_BADFIELD  0x2405
nkeynes@253
    68
#define PKT_ERR_BADREAD   0x3002
nkeynes@143
    69
#define PKT_ERR_BADREADMODE 0x6405  /* Illegal mode for this track */
nkeynes@253
    70
#define PKT_ERR_RESET     0x2906
nkeynes@142
    71
nkeynes@644
    72
/* Parse CD read */
nkeynes@644
    73
#define READ_CD_MODE(x)    ((x)&0x0E)
nkeynes@644
    74
#define READ_CD_MODE_ANY   0x00
nkeynes@644
    75
#define READ_CD_MODE_CDDA  0x02 
nkeynes@644
    76
#define READ_CD_MODE_1     0x04
nkeynes@644
    77
#define READ_CD_MODE_2     0x06
nkeynes@644
    78
#define READ_CD_MODE_2_FORM_1 0x08
nkeynes@644
    79
#define READ_CD_MODE_2_FORM_2 0x0A
nkeynes@644
    80
nkeynes@644
    81
#define READ_CD_CHANNELS(x) ((x)&0xF0)
nkeynes@644
    82
#define READ_CD_HEADER(x)  ((x)&0x80)
nkeynes@644
    83
#define READ_CD_SUBHEAD(x) ((x)&0x40)
nkeynes@644
    84
#define READ_CD_DATA(x)    ((x)&0x20)
nkeynes@644
    85
#define READ_CD_RAW(x)     ((x)&0x10)
nkeynes@736
    86
nkeynes@736
    87
#endif /* !lxdream_packet_H */
.