async.c File Reference

#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/async.h"

Functions

const char * signal_status_to_str (int status)
 Convert a signal status to a short text description.
async_rx_state_tasync_rx_init (async_rx_state_t *s, int data_bits, int parity, int stop_bits, int use_v14, put_byte_func_t put_byte, void *user_data)
 Initialise an asynchronous data receiver context.
void async_rx_put_bit (void *user_data, int bit)
 Accept a bit from a received serial bit stream.
async_tx_state_tasync_tx_init (async_tx_state_t *s, int data_bits, int parity, int stop_bits, int use_v14, get_byte_func_t get_byte, void *user_data)
 Initialise an asynchronous data transmit context.
int async_tx_get_bit (void *user_data)
 Get the next bit of a transmitted serial bit stream.

Detailed Description


Function Documentation

async_rx_state_t* async_rx_init ( async_rx_state_t s,
int  data_bits,
int  parity_bits,
int  stop_bits,
int  use_v14,
put_byte_func_t  put_byte,
void *  user_data 
)

Initialise an asynchronous data receiver context.

Initialise an asynchronous data receiver context.

Parameters:
s The receiver context.
data_bits The number of data bits.
parity_bits The type of parity.
stop_bits The number of stop bits.
use_v14 TRUE if V.14 rate adaption processing should be used.
put_byte The callback routine used to put the received data.
user_data An opaque pointer.
Returns:
A pointer to the initialised context, or NULL if there was a problem.

References async_rx_state_t::bitpos, async_rx_state_t::byte_in_progress, async_rx_state_t::data_bits, async_rx_state_t::framing_errors, async_rx_state_t::parity, async_rx_state_t::parity_bit, async_rx_state_t::parity_errors, async_rx_state_t::put_byte, async_rx_state_t::stop_bits, async_rx_state_t::use_v14, and async_rx_state_t::user_data.

Referenced by adsi_rx_init().

void async_rx_put_bit ( void *  user_data,
int  bit 
)

Accept a bit from a received serial bit stream.

Accept a bit from a received serial bit stream

Parameters:
user_data An opaque point which must point to a receiver context.
bit The new bit. Some special values are supported for this field.
  • SIG_STATUS_CARRIER_UP
  • SIG_STATUS_CARRIER_DOWN
  • SIG_STATUS_TRAINING_SUCCEEDED
  • SIG_STATUS_TRAINING_FAILED
  • SIG_STATUS_END_OF_DATA

References ASYNC_PARITY_ODD, async_rx_state_t::bitpos, async_rx_state_t::byte_in_progress, async_rx_state_t::data_bits, async_rx_state_t::framing_errors, async_rx_state_t::parity, async_rx_state_t::parity_bit, async_rx_state_t::parity_errors, async_rx_state_t::put_byte, SIG_STATUS_CARRIER_DOWN, SIG_STATUS_CARRIER_UP, SIG_STATUS_END_OF_DATA, SIG_STATUS_TRAINING_FAILED, SIG_STATUS_TRAINING_IN_PROGRESS, SIG_STATUS_TRAINING_SUCCEEDED, async_rx_state_t::use_v14, and async_rx_state_t::user_data.

Referenced by adsi_rx_init().

int async_tx_get_bit ( void *  user_data  ) 

Get the next bit of a transmitted serial bit stream.

Get the next bit of a transmitted serial bit stream.

Parameters:
user_data An opaque point which must point to a transmitter context.
Returns:
the next bit, or PUTBIT_END_OF_DATA to indicate the data stream has ended.

References ASYNC_PARITY_ODD, async_tx_state_t::bitpos, async_tx_state_t::byte_in_progress, async_tx_state_t::data_bits, async_tx_state_t::get_byte, async_tx_state_t::parity, async_tx_state_t::parity_bit, SIG_STATUS_END_OF_DATA, async_tx_state_t::stop_bits, and async_tx_state_t::user_data.

async_tx_state_t* async_tx_init ( async_tx_state_t s,
int  data_bits,
int  parity_bits,
int  stop_bits,
int  use_v14,
get_byte_func_t  get_byte,
void *  user_data 
)

Initialise an asynchronous data transmit context.

Initialise an asynchronous data transmit context.

Parameters:
s The transmitter context.
data_bits The number of data bit.
parity_bits The type of parity.
stop_bits The number of stop bits.
use_v14 TRUE if V.14 rate adaption processing should be used.
get_byte The callback routine used to get the data to be transmitted.
user_data An opaque pointer.
Returns:
A pointer to the initialised context, or NULL if there was a problem.

References ASYNC_PARITY_NONE, async_tx_state_t::bitpos, async_tx_state_t::byte_in_progress, async_tx_state_t::data_bits, async_tx_state_t::get_byte, async_tx_state_t::parity, async_tx_state_t::parity_bit, async_tx_state_t::stop_bits, and async_tx_state_t::user_data.

const char* signal_status_to_str ( int  status  ) 

Convert a signal status to a short text description.

Convert a signal status to a short text description.

Parameters:
status The modem signal status.
Returns:
A pointer to the description.

References SIG_STATUS_ABORT, SIG_STATUS_BREAK, SIG_STATUS_CARRIER_DOWN, SIG_STATUS_CARRIER_UP, SIG_STATUS_END_OF_DATA, SIG_STATUS_FRAMING_OK, SIG_STATUS_OCTET_REPORT, SIG_STATUS_SHUTDOWN_COMPLETE, SIG_STATUS_TRAINING_FAILED, SIG_STATUS_TRAINING_IN_PROGRESS, and SIG_STATUS_TRAINING_SUCCEEDED.

Referenced by lapm_receive().


Generated on Tue Oct 7 20:25:50 2008 for spandsp by  doxygen 1.5.6