[PATCH] jbd: split checkpoint lists
[linux-2.6] / include / linux / sdla_asy.h
1 /*****************************************************************************
2 * sdla_asy.h    Header file for the Sangoma S508/S514 asynchronous code API     
3 *
4 * Author:       Gideon Hack     
5 *
6 * Copyright:    (c) 2000 Sangoma Technologies Inc.
7 *
8 *               This program is free software; you can redistribute it and/or
9 *               modify it under the terms of the GNU General Public License
10 *               as published by the Free Software Foundation; either version
11 *               2 of the License, or (at your option) any later version.
12 * ============================================================================
13 *
14 * Jan 28, 2000  Gideon Hack     Initial Version
15 *
16 *****************************************************************************/
17
18
19 #ifndef _WANPIPE_ASYNC_H
20 #define _WANPIPE_ASYNC_H
21
22 /* ----------------------------------------------------------------------------
23  *                        Interface commands
24  * --------------------------------------------------------------------------*/
25
26 #define SET_ASY_CONFIGURATION           0xE2    /* set the asychronous operational configuration */
27 #define READ_ASY_CONFIGURATION          0xE3    /* read the current asychronous operational configuration */
28 #define ENABLE_ASY_COMMUNICATIONS       0xE4    /* enable asychronous communications */
29 #define DISABLE_ASY_COMMUNICATIONS      0xE5    /* disable asychronous communications */
30 #define READ_ASY_OPERATIONAL_STATS      0xE7    /* retrieve the asychronous operational statistics */
31 #define FLUSH_ASY_OPERATIONAL_STATS     0xE8    /* flush the asychronous operational statistics */
32 #define TRANSMIT_ASY_BREAK_SIGNAL       0xEC    /* transmit an asychronous break signal */
33
34
35
36 /* ----------------------------------------------------------------------------
37  *                     Return codes from interface commands
38  * --------------------------------------------------------------------------*/
39
40 #define COMMAND_INVALID_FOR_PORT        0x50    /* the command is invalid for the selected port */
41 #define DISABLE_ASY_COMMS_BEFORE_CFG    0xE1    /* communications must be disabled before setting the configuration */
42 #define ASY_COMMS_ENABLED               0xE1    /* communications are currently enabled */
43 #define ASY_COMMS_DISABLED              0xE1    /* communications are currently disabled */
44 #define ASY_CFG_BEFORE_COMMS_ENABLED    0xE2    /* perform a SET_ASY_CONFIGURATION before enabling comms */
45 #define LGTH_ASY_CFG_DATA_INVALID       0xE2    /* the length of the passed configuration data is invalid */
46 #define INVALID_ASY_CFG_DATA            0xE3    /* the passed configuration data is invalid */
47 #define ASY_BREAK_SIGNAL_BUSY           0xEC    /* a break signal is being transmitted */
48
49
50
51 /* ----------------------------------------------------------------------------
52  *   Constants for the SET_ASY_CONFIGURATION/READ_ASY_CONFIGURATION command
53  * --------------------------------------------------------------------------*/
54
55 /* the asynchronous configuration structure */
56 typedef struct {
57         unsigned long baud_rate                 PACKED;                                                 /* the baud rate */     
58         unsigned short line_config_options      PACKED; /* line configuration options */
59         unsigned short modem_config_options     PACKED; /* modem configuration options */
60         unsigned short asy_API_options          PACKED; /* asynchronous API options */
61         unsigned short asy_protocol_options     PACKED; /* asynchronous protocol options */
62         unsigned short Tx_bits_per_char         PACKED; /* number of bits per tx character */
63         unsigned short Rx_bits_per_char         PACKED; /* number of bits per received character */
64         unsigned short stop_bits                PACKED; /* number of stop bits per character */
65         unsigned short parity                   PACKED; /* parity definition */
66         unsigned short break_timer              PACKED; /* the break signal timer */
67         unsigned short asy_Rx_inter_char_timer  PACKED; /* the receive inter-character timer */
68         unsigned short asy_Rx_complete_length   PACKED; /* the receive 'buffer complete' length */
69         unsigned short XON_char                 PACKED; /* the XON character */
70         unsigned short XOFF_char                PACKED; /* the XOFF character */
71         unsigned short asy_statistics_options   PACKED; /* async operational stat options */
72         unsigned long ptr_shared_mem_info_struct    PACKED;/* ptr to the shared memory area information structure */
73         unsigned long ptr_asy_Tx_stat_el_cfg_struct PACKED;/* ptr to the transmit status element configuration structure */
74         unsigned long ptr_asy_Rx_stat_el_cfg_struct PACKED;/* ptr to the receive status element configuration structure */
75 } ASY_CONFIGURATION_STRUCT;
76
77 /* permitted minimum and maximum values for setting the asynchronous configuration */
78 #define MIN_ASY_BAUD_RATE               50      /* maximum baud rate */
79 #define MAX_ASY_BAUD_RATE               250000  /* minimum baud rate */
80 #define MIN_ASY_BITS_PER_CHAR           5       /* minimum number of bits per character */
81 #define MAX_ASY_BITS_PER_CHAR           8       /* maximum number of bits per character */
82 #define MIN_BREAK_TMR_VAL               0       /* minimum break signal timer */
83 #define MAX_BREAK_TMR_VAL               5000    /* maximum break signal timer */
84 #define MIN_ASY_RX_INTER_CHAR_TMR       0       /* minimum receive inter-character timer */
85 #define MAX_ASY_RX_INTER_CHAR_TMR       30000   /* maximum receive inter-character timer */
86 #define MIN_ASY_RX_CPLT_LENGTH          0       /* minimum receive 'length complete' value */
87 #define MAX_ASY_RX_CPLT_LENGTH          2000    /* maximum receive 'length complete' value */
88
89 /* bit settings for the 'asy_API_options' */
90 #define ASY_RX_DATA_TRANSPARENT         0x0001  /* do not strip parity and unused bits from received characters */
91
92 /* bit settings for the 'asy_protocol_options' */
93 #define ASY_RTS_HS_FOR_RX               0x0001  /* RTS handshaking is used for reception control */
94 #define ASY_XON_XOFF_HS_FOR_RX          0x0002  /* XON/XOFF handshaking is used for reception control */
95 #define ASY_XON_XOFF_HS_FOR_TX          0x0004  /* XON/XOFF handshaking is used for transmission control */
96 #define ASY_DCD_HS_FOR_TX               0x0008  /* DCD handshaking is used for transmission control */
97 #define ASY_CTS_HS_FOR_TX               0x0020  /* CTS handshaking is used for transmission control */
98
99 /* bit settings for the 'stop_bits' definition */
100 #define ONE_STOP_BIT                    1                       /* representation for 1 stop bit */
101 #define TWO_STOP_BITS                   2                       /* representation for 2 stop bits */
102 #define ONE_AND_A_HALF_STOP_BITS        3                       /* representation for 1.5 stop bits */
103
104 /* bit settings for the 'parity' definition */
105 #define NO_PARITY                       0                       /* representation for no parity */
106 #define ODD_PARITY                      1                       /* representation for odd parity */
107 #define EVEN_PARITY                     2                       /* representation for even parity */
108
109
110
111 /* ----------------------------------------------------------------------------
112  *    Constants for the READ_COMMS_ERROR_STATS command (asynchronous mode)
113  * --------------------------------------------------------------------------*/
114
115 /* the communications error statistics structure */
116 typedef struct {
117         unsigned short Rx_overrun_err_count     PACKED; /* receiver overrun error count */
118         unsigned short Rx_parity_err_count      PACKED; /* parity errors received count */
119         unsigned short Rx_framing_err_count     PACKED; /* framing errors received count */
120         unsigned short comms_err_stat_reserved_1 PACKED;/* reserved for later use */
121         unsigned short comms_err_stat_reserved_2 PACKED;/* reserved for later use */
122         unsigned short comms_err_stat_reserved_3 PACKED;/* reserved for later use */
123         unsigned short comms_err_stat_reserved_4 PACKED;/* reserved for later use */
124         unsigned short comms_err_stat_reserved_5 PACKED;/* reserved for later use */
125         unsigned short DCD_state_change_count   PACKED; /* DCD state change count */
126         unsigned short CTS_state_change_count   PACKED; /* CTS state change count */
127 } ASY_COMMS_ERROR_STATS_STRUCT;
128
129
130
131 /* ----------------------------------------------------------------------------
132  *         Constants for the READ_ASY_OPERATIONAL_STATS command
133  * --------------------------------------------------------------------------*/
134
135 /* the asynchronous operational statistics structure */
136 typedef struct {
137
138         /* Data transmission statistics */
139         unsigned long Data_blocks_Tx_count PACKED;/* number of blocks transmitted */
140         unsigned long Data_bytes_Tx_count  PACKED;/* number of bytes transmitted */
141         unsigned long Data_Tx_throughput   PACKED;/* transmit throughput */
142         unsigned long no_ms_for_Data_Tx_thruput_comp PACKED;/* millisecond time used for the Tx throughput computation */
143         unsigned long Tx_Data_discard_lgth_err_count PACKED;/* number of Data blocks discarded (length error) */
144         unsigned long reserved_Data_frm_Tx_stat1 PACKED;/* reserved for later use */
145         unsigned long reserved_Data_frm_Tx_stat2 PACKED;/* reserved for later use */
146         unsigned long reserved_Data_frm_Tx_stat3 PACKED;/* reserved for later use */
147
148         /* Data reception statistics */
149         unsigned long Data_blocks_Rx_count PACKED;/* number of blocks received */
150         unsigned long Data_bytes_Rx_count  PACKED;/* number of bytes received */
151         unsigned long Data_Rx_throughput   PACKED;/* receive throughput */
152         unsigned long no_ms_for_Data_Rx_thruput_comp PACKED;/* millisecond time used for the Rx throughput computation */
153         unsigned long Rx_Data_bytes_discard_count    PACKED;/* received Data bytes discarded */
154         unsigned long reserved_Data_frm_Rx_stat1     PACKED;/* reserved for later use */
155
156         /* handshaking protocol statistics */
157         unsigned short XON_chars_Tx_count       PACKED; /* number of XON characters transmitted */
158         unsigned short XOFF_chars_Tx_count      PACKED; /* number of XOFF characters transmitted */
159         unsigned short XON_chars_Rx_count       PACKED; /* number of XON characters received */
160         unsigned short XOFF_chars_Rx_count      PACKED; /* number of XOFF characters received */
161         unsigned short Tx_halt_modem_low_count  PACKED; /* number of times Tx halted (modem line low) */
162         unsigned short Rx_halt_RTS_low_count    PACKED; /* number of times Rx halted by setting RTS low */
163         unsigned long reserved_handshaking_stat1 PACKED;/* reserved for later use */
164
165         /* break statistics */
166         unsigned short break_Tx_count   PACKED; /* number of break sequences transmitted */
167         unsigned short break_Rx_count   PACKED; /* number of break sequences received */
168         unsigned long reserved_break_stat1 PACKED;/* reserved for later use */
169
170         /* miscellaneous statistics */
171         unsigned long reserved_misc_stat1       PACKED; /* reserved for later use */
172         unsigned long reserved_misc_stat2       PACKED; /* reserved for later use */
173
174 } ASY_OPERATIONAL_STATS_STRUCT;
175
176
177
178 /* ----------------------------------------------------------------------------
179  *                      Constants for Data transmission
180  * --------------------------------------------------------------------------*/
181
182 /* the Data block transmit status element configuration structure */
183 typedef struct {
184         unsigned short number_Tx_status_elements PACKED;                /* number of transmit status elements */
185         unsigned long base_addr_Tx_status_elements PACKED;      /* base address of the transmit element list */
186         unsigned long next_Tx_status_element_to_use PACKED;     /* pointer to the next transmit element to be used */
187 } ASY_TX_STATUS_EL_CFG_STRUCT;
188
189
190 /* the Data block transmit status element structure */
191 typedef struct {
192         unsigned char opp_flag PACKED;                                                          /* opp flag */
193         unsigned short data_length PACKED;                                              /* length of the block to be transmitted */
194         unsigned char reserved_1 PACKED;                                                        /* reserved for internal use */
195         unsigned long reserved_2 PACKED;                                                        /* reserved for internal use */
196         unsigned long reserved_3 PACKED;                                                        /* reserved for internal use */
197         unsigned long ptr_data_bfr PACKED;                                              /* pointer to the data area */
198 } ASY_DATA_TX_STATUS_EL_STRUCT;
199
200
201
202 /* ----------------------------------------------------------------------------
203  *                      Constants for Data reception
204  * --------------------------------------------------------------------------*/
205
206 /* the Data block receive status element configuration structure */
207 typedef struct {
208         unsigned short number_Rx_status_elements    PACKED;/* number of receive status elements */
209         unsigned long base_addr_Rx_status_elements  PACKED;/* base address of the receive element list */
210         unsigned long next_Rx_status_element_to_use PACKED;/* pointer to the next receive element to be used */
211         unsigned long base_addr_Rx_buffer       PACKED;/* base address of the receive data buffer */
212         unsigned long end_addr_Rx_buffer        PACKED;/* end address of the receive data buffer */
213 } ASY_RX_STATUS_EL_CFG_STRUCT;
214
215 /* the Data block receive status element structure */
216 typedef struct {
217         unsigned char opp_flag          PACKED; /* opp flag */
218         unsigned short data_length      PACKED; /* length of the received data block */
219         unsigned char reserved_1        PACKED; /* reserved for internal use */
220         unsigned short time_stamp       PACKED; /* receive time stamp (HDLC_STREAMING_MODE) */
221         unsigned short data_buffered    PACKED; /* the number of data bytes still buffered */
222         unsigned long reserved_2        PACKED; /* reserved for internal use */
223         unsigned long ptr_data_bfr      PACKED; /* pointer to the data area */
224 } ASY_DATA_RX_STATUS_EL_STRUCT;
225
226 #endif