private/async.h
/*
* SpanDSP - a series of DSP components for telephony
*
* private/async.h - Asynchronous serial bit stream encoding and decoding
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2003 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if !defined(_SPANDSP_PRIVATE_ASYNC_H_)
#define _SPANDSP_PRIVATE_ASYNC_H_
/*!
Asynchronous data transmit descriptor. This defines the state of a single
working instance of a byte to asynchronous serial converter, for use
in FSK modems.
*/
struct async_tx_state_s
{
/*! \brief The number of data bits per character. */
int data_bits;
/*! \brief The type of parity. */
int parity;
/*! \brief The number of stop bits per character. */
int stop_bits;
/*! \brief A pointer to the callback routine used to get characters to be transmitted. */
get_byte_func_t get_byte;
/*! \brief An opaque pointer passed when calling get_byte. */
void *user_data;
/*! \brief A current, partially transmitted, character. */
unsigned int byte_in_progress;
/*! \brief The current bit position within a partially transmitted character. */
int bitpos;
/*! \brief Parity bit. */
int parity_bit;
};
/*!
Asynchronous data receive descriptor. This defines the state of a single
working instance of an asynchronous serial to byte converter, for use
in FSK modems.
*/
struct async_rx_state_s
{
/*! \brief The number of data bits per character. */
int data_bits;
/*! \brief The type of parity. */
int parity;
/*! \brief The number of stop bits per character. */
int stop_bits;
/*! \brief TRUE if V.14 rate adaption processing should be performed. */
int use_v14;
/*! \brief A pointer to the callback routine used to handle received characters. */
put_byte_func_t put_byte;
/*! \brief An opaque pointer passed when calling put_byte. */
void *user_data;
/*! \brief A current, partially complete, character. */
unsigned int byte_in_progress;
/*! \brief The current bit position within a partially complete character. */
int bitpos;
/*! \brief Parity bit. */
int parity_bit;
/*! A count of the number of parity errors seen. */
int parity_errors;
/*! A count of the number of character framing errors seen. */
int framing_errors;
};
#endif
/*- End of file ------------------------------------------------------------*/
get_byte_func_t
int(* get_byte_func_t)(void *user_data)
Definition async.h:102
put_byte_func_t
void(* put_byte_func_t)(void *user_data, int byte)
Definition async.h:99
async_rx_state_s
Definition private/async.h:61
async_rx_state_s::parity
int parity
The type of parity.
Definition private/async.h:65
async_rx_state_s::parity_errors
int parity_errors
Definition private/async.h:83
async_rx_state_s::byte_in_progress
unsigned int byte_in_progress
A current, partially complete, character.
Definition private/async.h:76
async_rx_state_s::framing_errors
int framing_errors
Definition private/async.h:85
async_rx_state_s::data_bits
int data_bits
The number of data bits per character.
Definition private/async.h:63
async_rx_state_s::bitpos
int bitpos
The current bit position within a partially complete character.
Definition private/async.h:78
async_rx_state_s::stop_bits
int stop_bits
The number of stop bits per character.
Definition private/async.h:67
async_rx_state_s::use_v14
int use_v14
TRUE if V.14 rate adaption processing should be performed.
Definition private/async.h:69
async_rx_state_s::parity_bit
int parity_bit
Parity bit.
Definition private/async.h:80
async_rx_state_s::put_byte
put_byte_func_t put_byte
A pointer to the callback routine used to handle received characters.
Definition private/async.h:71
async_rx_state_s::user_data
void * user_data
An opaque pointer passed when calling put_byte.
Definition private/async.h:73
async_tx_state_s
Definition private/async.h:35
async_tx_state_s::parity
int parity
The type of parity.
Definition private/async.h:39
async_tx_state_s::user_data
void * user_data
An opaque pointer passed when calling get_byte.
Definition private/async.h:45
async_tx_state_s::stop_bits
int stop_bits
The number of stop bits per character.
Definition private/async.h:41
async_tx_state_s::data_bits
int data_bits
The number of data bits per character.
Definition private/async.h:37
async_tx_state_s::bitpos
int bitpos
The current bit position within a partially transmitted character.
Definition private/async.h:50
async_tx_state_s::get_byte
get_byte_func_t get_byte
A pointer to the callback routine used to get characters to be transmitted.
Definition private/async.h:43
async_tx_state_s::parity_bit
int parity_bit
Parity bit.
Definition private/async.h:52
async_tx_state_s::byte_in_progress
unsigned int byte_in_progress
A current, partially transmitted, character.
Definition private/async.h:48