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 * $Id: async.h,v 1.1 2008/11/30 10:17:31 steveu Exp $ 00026 */ 00027 00028 #if !defined(_SPANDSP_PRIVATE_ASYNC_H_) 00029 #define _SPANDSP_PRIVATE_ASYNC_H_ 00030 00031 /*! 00032 Asynchronous data transmit descriptor. This defines the state of a single 00033 working instance of a byte to asynchronous serial converter, for use 00034 in FSK modems. 00035 */ 00036 struct async_tx_state_s 00037 { 00038 /*! \brief The number of data bits per character. */ 00039 int data_bits; 00040 /*! \brief The type of parity. */ 00041 int parity; 00042 /*! \brief The number of stop bits per character. */ 00043 int stop_bits; 00044 /*! \brief A pointer to the callback routine used to get characters to be transmitted. */ 00045 get_byte_func_t get_byte; 00046 /*! \brief An opaque pointer passed when calling get_byte. */ 00047 void *user_data; 00048 00049 /*! \brief A current, partially transmitted, character. */ 00050 int byte_in_progress; 00051 /*! \brief The current bit position within a partially transmitted character. */ 00052 int bitpos; 00053 /*! \brief Parity bit. */ 00054 int parity_bit; 00055 }; 00056 00057 /*! 00058 Asynchronous data receive descriptor. This defines the state of a single 00059 working instance of an asynchronous serial to byte converter, for use 00060 in FSK modems. 00061 */ 00062 struct async_rx_state_s 00063 { 00064 /*! \brief The number of data bits per character. */ 00065 int data_bits; 00066 /*! \brief The type of parity. */ 00067 int parity; 00068 /*! \brief The number of stop bits per character. */ 00069 int stop_bits; 00070 /*! \brief TRUE if V.14 rate adaption processing should be performed. */ 00071 int use_v14; 00072 /*! \brief A pointer to the callback routine used to handle received characters. */ 00073 put_byte_func_t put_byte; 00074 /*! \brief An opaque pointer passed when calling put_byte. */ 00075 void *user_data; 00076 00077 /*! \brief A current, partially complete, character. */ 00078 int byte_in_progress; 00079 /*! \brief The current bit position within a partially complete character. */ 00080 int bitpos; 00081 /*! \brief Parity bit. */ 00082 int parity_bit; 00083 00084 /*! A count of the number of parity errors seen. */ 00085 int parity_errors; 00086 /*! A count of the number of character framing errors seen. */ 00087 int framing_errors; 00088 }; 00089 00090 #endif 00091 /*- End of file ------------------------------------------------------------*/