spandsp 0.0.6

private/async.h
1/*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * private/async.h - Asynchronous serial bit stream encoding and decoding
5 *
6 * Written by Steve Underwood <steveu@coppice.org>
7 *
8 * Copyright (C) 2003 Steve Underwood
9 *
10 * All rights reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 2.1,
14 * as published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26#if !defined(_SPANDSP_PRIVATE_ASYNC_H_)
27#define _SPANDSP_PRIVATE_ASYNC_H_
28
29/*!
30 Asynchronous data transmit descriptor. This defines the state of a single
31 working instance of a byte to asynchronous serial converter, for use
32 in FSK modems.
33*/
34 struct async_tx_state_s
35{
36 /*! \brief The number of data bits per character. */
37 int data_bits;
38 /*! \brief The type of parity. */
39 int parity;
40 /*! \brief The number of stop bits per character. */
41 int stop_bits;
42 /*! \brief A pointer to the callback routine used to get characters to be transmitted. */
43 get_byte_func_t get_byte;
44 /*! \brief An opaque pointer passed when calling get_byte. */
45 void *user_data;
46
47 /*! \brief A current, partially transmitted, character. */
48 unsigned int byte_in_progress;
49 /*! \brief The current bit position within a partially transmitted character. */
50 int bitpos;
51 /*! \brief Parity bit. */
52 int parity_bit;
53};
54
55/*!
56 Asynchronous data receive descriptor. This defines the state of a single
57 working instance of an asynchronous serial to byte converter, for use
58 in FSK modems.
59*/
60 struct async_rx_state_s
61{
62 /*! \brief The number of data bits per character. */
63 int data_bits;
64 /*! \brief The type of parity. */
65 int parity;
66 /*! \brief The number of stop bits per character. */
67 int stop_bits;
68 /*! \brief TRUE if V.14 rate adaption processing should be performed. */
69 int use_v14;
70 /*! \brief A pointer to the callback routine used to handle received characters. */
71 put_byte_func_t put_byte;
72 /*! \brief An opaque pointer passed when calling put_byte. */
73 void *user_data;
74
75 /*! \brief A current, partially complete, character. */
76 unsigned int byte_in_progress;
77 /*! \brief The current bit position within a partially complete character. */
78 int bitpos;
79 /*! \brief Parity bit. */
80 int parity_bit;
81
82 /*! A count of the number of parity errors seen. */
83 int parity_errors;
84 /*! A count of the number of character framing errors seen. */
85 int framing_errors;
86};
87
88#endif
89/*- 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