private/async.h

00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * private/async.h - Asynchronous serial bit stream encoding and decoding
00005  *
00006  * Written by Steve Underwood <steveu@coppice.org>
00007  *
00008  * Copyright (C) 2003 Steve Underwood
00009  *
00010  * All rights reserved.
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU Lesser General Public License version 2.1,
00014  * as published by the Free Software Foundation.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Lesser General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public
00022  * License along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00024  */
00025 
00026 #if !defined(_SPANDSP_PRIVATE_ASYNC_H_)
00027 #define _SPANDSP_PRIVATE_ASYNC_H_
00028 
00029 /*!
00030     Asynchronous data transmit descriptor. This defines the state of a single
00031     working instance of a byte to asynchronous serial converter, for use
00032     in FSK modems.
00033 */
00034 struct async_tx_state_s
00035 {
00036     /*! \brief The number of data bits per character. */
00037     int data_bits;
00038     /*! \brief The type of parity. */
00039     int parity;
00040     /*! \brief The number of stop bits per character. */
00041     int stop_bits;
00042     /*! \brief A pointer to the callback routine used to get characters to be transmitted. */
00043     get_byte_func_t get_byte;
00044     /*! \brief An opaque pointer passed when calling get_byte. */
00045     void *user_data;
00046 
00047     /*! \brief A current, partially transmitted, character. */
00048     int byte_in_progress;
00049     /*! \brief The current bit position within a partially transmitted character. */
00050     int bitpos;
00051     /*! \brief Parity bit. */
00052     int parity_bit;
00053 };
00054 
00055 /*!
00056     Asynchronous data receive descriptor. This defines the state of a single
00057     working instance of an asynchronous serial to byte converter, for use
00058     in FSK modems.
00059 */
00060 struct async_rx_state_s
00061 {
00062     /*! \brief The number of data bits per character. */
00063     int data_bits;
00064     /*! \brief The type of parity. */
00065     int parity;
00066     /*! \brief The number of stop bits per character. */
00067     int stop_bits;
00068     /*! \brief TRUE if V.14 rate adaption processing should be performed. */
00069     int use_v14;
00070     /*! \brief A pointer to the callback routine used to handle received characters. */
00071     put_byte_func_t put_byte;
00072     /*! \brief An opaque pointer passed when calling put_byte. */
00073     void *user_data;
00074 
00075     /*! \brief A current, partially complete, character. */
00076     int byte_in_progress;
00077     /*! \brief The current bit position within a partially complete character. */
00078     int bitpos;
00079     /*! \brief Parity bit. */
00080     int parity_bit;
00081 
00082     /*! A count of the number of parity errors seen. */
00083     int parity_errors;
00084     /*! A count of the number of character framing errors seen. */
00085     int framing_errors;
00086 };
00087 
00088 #endif
00089 /*- End of file ------------------------------------------------------------*/

Generated on Thu Oct 18 15:28:01 2012 for spandsp by  doxygen 1.4.7