KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches

Driver for the Dreamcast's built-in 56k Modem More...

Topics

 Modes of Operation
 Operating modes for modem
 
 Protocol Values
 Modem protocol values
 
 Speed Values
 Modem speed values
 
 V.22 Modes
 Modem V.22 Modes
 
 V.22bis Modes
 Modem V.22bis Modes
 
 V.32 Modes
 Modem V.32 Modes
 
 V.32bis Modes
 Modem V.32 Modes
 
 V.8 Modes
 Modem V.8 Modes
 

Files

file  mconst.h
 Constants used in the modem driver.
 
file  modem.h
 Definitions to use the Dreamcast modem.
 

Macros

#define MODEM_SPEED_GET_PROTOCOL(x)   ((modem_speed_t)(x) >> 4)
 Extract the protocol from a full speed/protocol value.
 
#define MODEM_SPEED_GET_SPEED(x)   ((modem_speed_t)(x) & 0xF)
 Extract the speed from a full speed/protocol value.
 
#define MODEM_MAKE_SPEED(p, s)   ((modem_speed_t)((((p) & 0xF) << 4) | ((s) & 0xF)))
 Combine a protocol and speed into a single value.
 

Typedefs

typedef unsigned char modem_speed_t
 Modem speed/protocol value type.
 
typedef void(* MODEMEVENTHANDLERPROC) (modemEvent_t event)
 Type of a modem event handling function.
 

Enumerations

enum  modemEvent_t {
  MODEM_EVENT_CONNECTION_FAILED = 0 , MODEM_EVENT_CONNECTED , MODEM_EVENT_DISCONNECTED , MODEM_EVENT_RX_NOT_EMPTY ,
  MODEM_EVENT_OVERFLOW , MODEM_EVENT_TX_EMPTY
}
 Modem Event Types. More...
 

Functions

int modem_init (void)
 Initialize the modem.
 
void modem_shutdown (void)
 Shut down the modem.
 
int modem_set_mode (int mode, modem_speed_t speed)
 Set the modem up for the specified mode.
 
int modem_wait_dialtone (int ms_timeout)
 Wait for the modem to detect a dialtone.
 
int modem_dial (const char *digits)
 Dial the specified number on the modem.
 
void modem_set_event_handler (MODEMEVENTHANDLERPROC eventHandler)
 Set the event handler for the modem.
 
void modem_disconnect (void)
 Disconnect the modem.
 
int modem_is_connecting (void)
 Check if the modem is connecting.
 
int modem_is_connected (void)
 Check if the modem is connected.
 
unsigned long modem_get_connection_rate (void)
 Get the connection rate that the modem is connected at.
 
int modem_read_data (unsigned char *data, int size)
 Read data from the modem buffers.
 
int modem_write_data (unsigned char *data, int size)
 Write data to the modem buffers.
 
int modem_has_data (void)
 Check if the modem has data waiting to be read.
 

Detailed Description

Driver for the Dreamcast's built-in 56k Modem

Macro Definition Documentation

◆ MODEM_MAKE_SPEED

#define MODEM_MAKE_SPEED ( p,
s )   ((modem_speed_t)((((p) & 0xF) << 4) | ((s) & 0xF)))

Combine a protocol and speed into a single value.

Parameters
pThe protocol to use.
sThe speed to use.
Returns
The full speed/protocol value.
See also
Protocol Values
Speed Values

◆ MODEM_SPEED_GET_PROTOCOL

#define MODEM_SPEED_GET_PROTOCOL ( x)    ((modem_speed_t)(x) >> 4)

Extract the protocol from a full speed/protocol value.

Parameters
xThe speed/protocol value to look at.
Returns
The protocol in use.
See also
Protocol Values

◆ MODEM_SPEED_GET_SPEED

#define MODEM_SPEED_GET_SPEED ( x)    ((modem_speed_t)(x) & 0xF)

Extract the speed from a full speed/protocol value.

Parameters
xThe speed/protocol value to look at.
Returns
The speed in use.
See also
Speed Values

Typedef Documentation

◆ modem_speed_t

typedef unsigned char modem_speed_t

Modem speed/protocol value type.

◆ MODEMEVENTHANDLERPROC

typedef void(* MODEMEVENTHANDLERPROC) (modemEvent_t event)

Type of a modem event handling function.

Enumeration Type Documentation

◆ modemEvent_t

Modem Event Types.

These are the events that a modem event handler should be expected to receive at any given point in time.

Enumerator
MODEM_EVENT_CONNECTION_FAILED 

The modem tried to establish a connection, but failed.

MODEM_EVENT_CONNECTED 

A connection has been established.

MODEM_EVENT_DISCONNECTED 

The remote modem dropped the connection.

MODEM_EVENT_RX_NOT_EMPTY 

New data has entered the previously empty receive buffer.

MODEM_EVENT_OVERFLOW 

The receive buffer overflowed and was cleared.

MODEM_EVENT_TX_EMPTY 

The transmit buffer has been emptied.

Function Documentation

◆ modem_dial()

int modem_dial ( const char * digits)

Dial the specified number on the modem.

Parameters
digitsThe number to dial, as a string.
Return values
0On failure.
1On success.

◆ modem_disconnect()

void modem_disconnect ( void )

Disconnect the modem.

This function instructs the modem to disconnect from the remote modem.

◆ modem_get_connection_rate()

unsigned long modem_get_connection_rate ( void )

Get the connection rate that the modem is connected at.

Returns
The connection rate in bits per second.

◆ modem_has_data()

int modem_has_data ( void )

Check if the modem has data waiting to be read.

Returns
0 if no data available, non-zero otherwise.

◆ modem_init()

int modem_init ( void )

Initialize the modem.

This function initializes the modem for use.

Return values
0On failure.
1On success.

◆ modem_is_connected()

int modem_is_connected ( void )

Check if the modem is connected.

Returns
0 if the modem is not currently connected, non-zero otherwise.

◆ modem_is_connecting()

int modem_is_connecting ( void )

Check if the modem is connecting.

Returns
0 if the modem is not currently connecting, non-zero otherwise.

◆ modem_read_data()

int modem_read_data ( unsigned char * data,
int size )

Read data from the modem buffers.

Parameters
dataThe buffer to read into.
sizeThe maximum number of bytes to read.
Returns
The actual number of bytes read.

◆ modem_set_event_handler()

void modem_set_event_handler ( MODEMEVENTHANDLERPROC eventHandler)

Set the event handler for the modem.

This function sets up an event handler for when things happen on the modem.

Parameters
eventHandlerThe function to call when an event occurs.

◆ modem_set_mode()

int modem_set_mode ( int mode,
modem_speed_t speed )

Set the modem up for the specified mode.

This function sets up the modem's registers for the specified mode and speed combination.

Parameters
modeThe mode to use.
speedThe speed to use.
See also
Modes of Operation
V.22bis Modes
V.22 Modes
V.32 Modes
V.32bis Modes
V.8 Modes

◆ modem_shutdown()

void modem_shutdown ( void )

Shut down the modem.

This function shuts down the modem after it has been initialized, resetting all of the registers to their defaults.

◆ modem_wait_dialtone()

int modem_wait_dialtone ( int ms_timeout)

Wait for the modem to detect a dialtone.

This function waits for a dialtone to be detected on the modem.

Parameters
ms_timeoutThe number of milliseconds to wait, in multiples of 100.
Return values
0If a dialtone is detected before timeout.
-1If no dialtone is detected.

◆ modem_write_data()

int modem_write_data ( unsigned char * data,
int size )

Write data to the modem buffers.

Parameters
dataThe buffer to write from.
sizeThe maximum number of bytes to write.
Returns
The actual number of bytes written.