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