KallistiOS  2.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
mconst.h
Go to the documentation of this file.
1 /* KallistiOS 2.0.0
2 
3  mconst.h
4  Copyright (C)2002, 2004 Nick Kochakian
5 
6  Distributed under the terms of the KOS license.
7 
8 */
9 
10 /** \file dc/modem/mconst.h
11  \brief Constants used in the modem driver.
12 
13  This file contains constants that are used for the modem driver. You should
14  not ever need to include this file directly, as the main modem driver header
15  file includes it automatically.
16 
17  Generally, you will not need to use the stuff in this file yourself at all,
18  as the main modem header file defines many useful combinations for you.
19 
20  \author Nick Kochakian
21 */
22 
23 /* Modem constants are defined here. Automatically included by modem.h */
24 #ifndef __MODEM_MCONST_H
25 #define __MODEM_MCONST_H
26 
27 /* Each speed constant contains information about the data rate in bps and the
28  protocol that's being used. The first 4 bits identify the the speed that's
29  being used, and the last 4 bits identify the protocol.
30 
31  And don't try to create your own custom speeds from these, you'll cause
32  something very bad to happen. Only use the MODEM_SPEED_* constants defined
33  in modem.h! */
34 
35 /** \defgroup modem_speeds Modem speed values
36 
37  This group defines the available speed values that are able to be used with
38  the Dreamcast's modem. The actual speed value consists of one of these in
39  the lower 4 bits and one of the protocols in the upper 4 bits. Don't try to
40  use any speeds not defined here, as bad things may happen.
41 
42  It should be fairly obvious from the names what the speeds are (they're all
43  expressed in bits per second).
44 
45  @{
46 */
47 #define MODEM_SPEED_AUTO 0x0
48 #define MODEM_SPEED_1200 0x0
49 #define MODEM_SPEED_2400 0x1
50 #define MODEM_SPEED_4800 0x2
51 #define MODEM_SPEED_7200 0x3
52 #define MODEM_SPEED_9600 0x4
53 #define MODEM_SPEED_12000 0x5
54 #define MODEM_SPEED_14400 0x6
55 #define MODEM_SPEED_16800 0x7
56 #define MODEM_SPEED_19200 0x8
57 #define MODEM_SPEED_21600 0x9
58 #define MODEM_SPEED_24000 0xA
59 #define MODEM_SPEED_26400 0xB
60 #define MODEM_SPEED_28000 0xC
61 #define MODEM_SPEED_31200 0xD
62 #define MODEM_SPEED_33600 0xE
63 /** @} */
64 
65 /** \defgroup modem_protocols Modem protocol values
66 
67  This group defines the available protocol values that are able to be used
68  with the Dreamcast's modem. The actual speed value consists of one of these
69  in the upper 4 bits and one of the speeds in the lower 4 bits. Don't try to
70  use any protocols not defined here, as bad things may happen.
71 
72  It should be fairly obvious from the names what the protocols that will be
73  used are.
74 
75  @{
76 */
77 #define MODEM_PROTOCOL_V17 0x0
78 #define MODEM_PROTOCOL_V22 0x1
79 #define MODEM_PROTOCOL_V22BIS 0x2
80 #define MODEM_PROTOCOL_V32 0x3
81 #define MODEM_PROTOCOL_V32BIS 0x4
82 #define MODEM_PROTOCOL_V34 0x5
83 #define MODEM_PROTOCOL_V8 0x6
84 /** @} */
85 
86 /** \brief Extract the protocol from a full speed/protocol value.
87  \param x The speed/protocol value to look at.
88  \return The protocol in use.
89  \see modem_protocols
90 */
91 #define MODEM_SPEED_GET_PROTOCOL(x) ((modem_speed_t)(x) >> 4)
92 
93 /** \brief Extract the speed from a full speed/protocol value.
94  \param x The speed/protocol value to look at.
95  \return The speed in use.
96  \see modem_speeds
97 */
98 #define MODEM_SPEED_GET_SPEED(x) ((modem_speed_t)(x) & 0xF)
99 
100 /** \brief Combine a protocol and speed into a single value.
101  \param p The protocol to use.
102  \param s The speed to use.
103  \return The full speed/protocol value.
104  \see modem_protocols
105  \see modem_speeds
106 */
107 #define MODEM_MAKE_SPEED(p, s) ((modem_speed_t)((((p) & 0xF) << 4) | ((s) & 0xF)))
108 
109 /** \brief Modem speed/protocol value type. */
110 typedef unsigned char modem_speed_t;
111 
112 #endif