aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sdla_chdlc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/sdla_chdlc.h')
-rw-r--r--include/linux/sdla_chdlc.h813
1 files changed, 813 insertions, 0 deletions
diff --git a/include/linux/sdla_chdlc.h b/include/linux/sdla_chdlc.h
new file mode 100644
index 000000000000..d2e35a299034
--- /dev/null
+++ b/include/linux/sdla_chdlc.h
@@ -0,0 +1,813 @@
1/*************************************************************************
2 sdla_chdlc.h Sangoma Cisco HDLC firmware API definitions
3
4 Author: Gideon Hack
5 Nenad Corbic <ncorbic@sangoma.com>
6
7 Copyright: (c) 1995-2000 Sangoma Technologies Inc.
8
9 This program is free software; you can redistribute it and/or
10 modify it under the term of the GNU General Public License
11 as published by the Free Software Foundation; either version
12 2 of the License, or (at your option) any later version.
13
14===========================================================================
15 Oct 04, 1999 Nenad Corbic Updated API support
16 Jun 02, 1999 Gideon Hack Changes for S514 usage.
17 Oct 28, 1998 Jaspreet Singh Made changes for Dual Port CHDLC.
18 Jun 11, 1998 David Fong Initial version.
19===========================================================================
20
21 Organization
22 - Compatibility notes
23 - Constants defining the shared memory control block (mailbox)
24 - Interface commands
25 - Return code from interface commands
26 - Constants for the commands (structures for casting data)
27 - UDP Management constants and structures
28
29*************************************************************************/
30
31#ifndef _SDLA_CHDLC_H
32# define _SDLC_CHDLC_H
33
34/*------------------------------------------------------------------------
35 Notes:
36
37 All structres defined in this file are byte-aligned.
38
39 Compiler Platform
40 ------------------------
41 GNU C Linux
42
43------------------------------------------------------------------------*/
44
45#ifndef PACKED
46#define PACKED __attribute__((packed))
47#endif /* PACKED */
48
49
50/* ----------------------------------------------------------------------------
51 * Constants defining the shared memory control block (mailbox)
52 * --------------------------------------------------------------------------*/
53
54#define PRI_BASE_ADDR_MB_STRUCT 0xE000 /* the base address of the mailbox structure on the adapter */
55#define SEC_BASE_ADDR_MB_STRUCT 0xE800 /* the base address of the mailbox structure on the adapter */
56#define SIZEOF_MB_DATA_BFR 2032 /* the size of the actual mailbox data area */
57#define NUMBER_MB_RESERVED_BYTES 0x0B /* the number of reserved bytes in the mailbox header area */
58
59
60#define MIN_LGTH_CHDLC_DATA_CFG 300 /* min length of the CHDLC data field (for configuration purposes) */
61#define PRI_MAX_NO_DATA_BYTES_IN_FRAME 15354 /* PRIMARY - max length of the CHDLC data field */
62
63typedef struct {
64 unsigned char opp_flag PACKED; /* the opp flag */
65 unsigned char command PACKED; /* the user command */
66 unsigned short buffer_length PACKED; /* the data length */
67 unsigned char return_code PACKED; /* the return code */
68 unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] PACKED; /* reserved for later */
69 unsigned char data[SIZEOF_MB_DATA_BFR] PACKED; /* the data area */
70} CHDLC_MAILBOX_STRUCT;
71
72typedef struct {
73 pid_t pid_num PACKED;
74 CHDLC_MAILBOX_STRUCT cmdarea PACKED;
75
76} CMDBLOCK_STRUCT;
77
78
79
80
81/* ----------------------------------------------------------------------------
82 * Interface commands
83 * --------------------------------------------------------------------------*/
84
85/* global interface commands */
86#define READ_GLOBAL_EXCEPTION_CONDITION 0x01
87#define SET_GLOBAL_CONFIGURATION 0x02
88#define READ_GLOBAL_CONFIGURATION 0x03
89#define READ_GLOBAL_STATISTICS 0x04
90#define FLUSH_GLOBAL_STATISTICS 0x05
91#define SET_MODEM_STATUS 0x06 /* set status of DTR or RTS */
92#define READ_MODEM_STATUS 0x07 /* read status of CTS and DCD */
93#define READ_COMMS_ERROR_STATS 0x08
94#define FLUSH_COMMS_ERROR_STATS 0x09
95#define SET_TRACE_CONFIGURATION 0x0A /* set the line trace config */
96#define READ_TRACE_CONFIGURATION 0x0B /* read the line trace config */
97#define READ_TRACE_STATISTICS 0x0C /* read the trace statistics */
98#define FLUSH_TRACE_STATISTICS 0x0D /* flush the trace statistics */
99#define FT1_MONITOR_STATUS_CTRL 0x1C /* set the status of the S508/FT1 monitoring */
100#define SET_FT1_CONFIGURATION 0x18 /* set the FT1 configuration */
101#define READ_FT1_CONFIGURATION 0x19 /* read the FT1 configuration */
102#define TRANSMIT_ASYNC_DATA_TO_FT1 0x1A /* output asynchronous data to the FT1 */
103#define RECEIVE_ASYNC_DATA_FROM_FT1 0x1B /* receive asynchronous data from the FT1 */
104#define FT1_MONITOR_STATUS_CTRL 0x1C /* set the status of the FT1 monitoring */
105
106#define READ_FT1_OPERATIONAL_STATS 0x1D /* read the S508/FT1 operational statistics */
107#define SET_FT1_MODE 0x1E /* set the operational mode of the S508/FT1 module */
108
109/* CHDLC-level interface commands */
110#define READ_CHDLC_CODE_VERSION 0x20
111#define READ_CHDLC_EXCEPTION_CONDITION 0x21 /* read exception condition from the adapter */
112#define SET_CHDLC_CONFIGURATION 0x22
113#define READ_CHDLC_CONFIGURATION 0x23
114#define ENABLE_CHDLC_COMMUNICATIONS 0x24
115#define DISABLE_CHDLC_COMMUNICATIONS 0x25
116#define READ_CHDLC_LINK_STATUS 0x26
117#define READ_CHDLC_OPERATIONAL_STATS 0x27
118#define FLUSH_CHDLC_OPERATIONAL_STATS 0x28
119#define SET_CHDLC_INTERRUPT_TRIGGERS 0x30 /* set application interrupt triggers */
120#define READ_CHDLC_INTERRUPT_TRIGGERS 0x31 /* read application interrupt trigger configuration */
121
122/* Special UDP drivers management commands */
123#define CPIPE_ENABLE_TRACING 0x50
124#define CPIPE_DISABLE_TRACING 0x51
125#define CPIPE_GET_TRACE_INFO 0x52
126#define CPIPE_GET_IBA_DATA 0x53
127#define CPIPE_FT1_READ_STATUS 0x54
128#define CPIPE_DRIVER_STAT_IFSEND 0x55
129#define CPIPE_DRIVER_STAT_INTR 0x56
130#define CPIPE_DRIVER_STAT_GEN 0x57
131#define CPIPE_FLUSH_DRIVER_STATS 0x58
132#define CPIPE_ROUTER_UP_TIME 0x59
133
134/* Driver specific commands for API */
135#define CHDLC_READ_TRACE_DATA 0xE4 /* read trace data */
136#define TRACE_ALL 0x00
137#define TRACE_PROT 0x01
138#define TRACE_DATA 0x02
139
140#define DISCARD_RX_ERROR_FRAMES 0x0001
141
142/* ----------------------------------------------------------------------------
143 * Return codes from interface commands
144 * --------------------------------------------------------------------------*/
145
146#define COMMAND_OK 0x00
147
148/* return codes from global interface commands */
149#define NO_GLOBAL_EXCEP_COND_TO_REPORT 0x01 /* there is no CHDLC exception condition to report */
150#define LGTH_GLOBAL_CFG_DATA_INVALID 0x01 /* the length of the passed global configuration data is invalid */
151#define LGTH_TRACE_CFG_DATA_INVALID 0x01 /* the length of the passed trace configuration data is invalid */
152#define IRQ_TIMEOUT_VALUE_INVALID 0x02 /* an invalid application IRQ timeout value was selected */
153#define TRACE_CONFIG_INVALID 0x02 /* the passed line trace configuration is invalid */
154#define ADAPTER_OPERATING_FREQ_INVALID 0x03 /* an invalid adapter operating frequency was selected */
155#define TRC_DEAC_TMR_INVALID 0x03 /* the trace deactivation timer is invalid */
156#define S508_FT1_ADPTR_NOT_PRESENT 0x0C /* the S508/FT1 adapter is not present */
157#define INVALID_FT1_STATUS_SELECTION 0x0D /* the S508/FT1 status selection is invalid */
158#define FT1_OP_STATS_NOT_ENABLED 0x0D /* the FT1 operational statistics have not been enabled */
159#define FT1_OP_STATS_NOT_AVAILABLE 0x0E /* the FT1 operational statistics are not currently available */
160#define S508_FT1_MODE_SELECTION_BUSY 0x0E /* the S508/FT1 adapter is busy selecting the operational mode */
161
162/* return codes from command READ_GLOBAL_EXCEPTION_CONDITION */
163#define EXCEP_MODEM_STATUS_CHANGE 0x10 /* a modem status change occurred */
164#define EXCEP_TRC_DISABLED 0x11 /* the trace has been disabled */
165#define EXCEP_IRQ_TIMEOUT 0x12 /* IRQ timeout */
166
167/* return codes from CHDLC-level interface commands */
168#define NO_CHDLC_EXCEP_COND_TO_REPORT 0x21 /* there is no CHDLC exception condition to report */
169#define CHDLC_COMMS_DISABLED 0x21 /* communications are not currently enabled */
170#define CHDLC_COMMS_ENABLED 0x21 /* communications are currently enabled */
171#define DISABLE_CHDLC_COMMS_BEFORE_CFG 0x21 /* CHDLC communications must be disabled before setting the configuration */
172#define ENABLE_CHDLC_COMMS_BEFORE_CONN 0x21 /* communications must be enabled before using the CHDLC_CONNECT conmmand */
173#define CHDLC_CFG_BEFORE_COMMS_ENABLED 0x22 /* perform a SET_CHDLC_CONFIGURATION before enabling comms */
174#define LGTH_CHDLC_CFG_DATA_INVALID 0x22 /* the length of the passed CHDLC configuration data is invalid */
175#define LGTH_INT_TRIGGERS_DATA_INVALID 0x22 /* the length of the passed interrupt trigger data is invalid */
176#define INVALID_IRQ_SELECTED 0x23 /* in invalid IRQ was selected in the SET_CHDLC_INTERRUPT_TRIGGERS */
177#define INVALID_CHDLC_CFG_DATA 0x23 /* the passed CHDLC configuration data is invalid */
178#define IRQ_TMR_VALUE_INVALID 0x24 /* an invalid application IRQ timer value was selected */
179#define LARGER_PERCENT_TX_BFR_REQUIRED 0x24 /* a larger Tx buffer percentage is required */
180#define LARGER_PERCENT_RX_BFR_REQUIRED 0x25 /* a larger Rx buffer percentage is required */
181#define S514_BOTH_PORTS_SAME_CLK_MODE 0x26 /* S514 - both ports must have same clock mode */
182#define INVALID_CMND_HDLC_STREAM_MODE 0x4E /* the CHDLC interface command is invalid for HDLC streaming mode */
183#define INVALID_CHDLC_COMMAND 0x4F /* the defined CHDLC interface command is invalid */
184
185/* return codes from command READ_CHDLC_EXCEPTION_CONDITION */
186#define EXCEP_LINK_ACTIVE 0x30 /* the CHDLC link has become active */
187#define EXCEP_LINK_INACTIVE_MODEM 0x31 /* the CHDLC link has become inactive (modem status) */
188#define EXCEP_LINK_INACTIVE_KPALV 0x32 /* the CHDLC link has become inactive (keepalive status) */
189#define EXCEP_IP_ADDRESS_DISCOVERED 0x33 /* the IP address has been discovered */
190#define EXCEP_LOOPBACK_CONDITION 0x34 /* a loopback condition has occurred */
191
192
193/* return code from command CHDLC_SEND_WAIT and CHDLC_SEND_NO_WAIT */
194#define LINK_DISCONNECTED 0x21
195#define NO_TX_BFRS_AVAIL 0x24
196
197
198/* ----------------------------------------------------------------------------
199 * Constants for the SET_GLOBAL_CONFIGURATION/READ_GLOBAL_CONFIGURATION commands
200 * --------------------------------------------------------------------------*/
201
202/* the global configuration structure */
203typedef struct {
204 unsigned short adapter_config_options PACKED; /* adapter config options */
205 unsigned short app_IRQ_timeout PACKED; /* application IRQ timeout */
206 unsigned long adapter_operating_frequency PACKED; /* adapter operating frequency */
207} GLOBAL_CONFIGURATION_STRUCT;
208
209/* settings for the 'app_IRQ_timeout' */
210#define MAX_APP_IRQ_TIMEOUT_VALUE 5000 /* the maximum permitted IRQ timeout */
211
212
213
214/* ----------------------------------------------------------------------------
215 * Constants for the READ_GLOBAL_STATISTICS command
216 * --------------------------------------------------------------------------*/
217
218/* the global statistics structure */
219typedef struct {
220 unsigned short app_IRQ_timeout_count PACKED;
221} GLOBAL_STATS_STRUCT;
222
223
224
225/* ----------------------------------------------------------------------------
226 * Constants for the READ_COMMS_ERROR_STATS command
227 * --------------------------------------------------------------------------*/
228
229/* the communications error statistics structure */
230typedef struct {
231 unsigned short Rx_overrun_err_count PACKED;
232 unsigned short CRC_err_count PACKED; /* receiver CRC error count */
233 unsigned short Rx_abort_count PACKED; /* abort frames recvd count */
234 unsigned short Rx_dis_pri_bfrs_full_count PACKED;/* receiver disabled */
235 unsigned short comms_err_stat_reserved_1 PACKED;/* reserved for later */
236 unsigned short sec_Tx_abort_msd_Tx_int_count PACKED; /* secondary - abort frames transmitted count (missed Tx interrupt) */
237 unsigned short missed_Tx_und_int_count PACKED; /* missed tx underrun interrupt count */
238 unsigned short sec_Tx_abort_count PACKED; /*secondary-abort frames tx count */
239 unsigned short DCD_state_change_count PACKED; /* DCD state change */
240 unsigned short CTS_state_change_count PACKED; /* CTS state change */
241} COMMS_ERROR_STATS_STRUCT;
242
243
244
245/* ----------------------------------------------------------------------------
246 * Constants used for line tracing
247 * --------------------------------------------------------------------------*/
248
249/* the trace configuration structure (SET_TRACE_CONFIGURATION/READ_TRACE_CONFIGURATION commands) */
250typedef struct {
251 unsigned char trace_config PACKED; /* trace configuration */
252 unsigned short trace_deactivation_timer PACKED; /* trace deactivation timer */
253 unsigned long ptr_trace_stat_el_cfg_struct PACKED; /* a pointer to the line trace element configuration structure */
254} LINE_TRACE_CONFIG_STRUCT;
255
256/* 'trace_config' bit settings */
257#define TRACE_INACTIVE 0x00 /* trace is inactive */
258#define TRACE_ACTIVE 0x01 /* trace is active */
259#define TRACE_DELAY_MODE 0x04 /* operate the trace in delay mode */
260#define TRACE_DATA_FRAMES 0x08 /* trace Data frames */
261#define TRACE_SLARP_FRAMES 0x10 /* trace SLARP frames */
262#define TRACE_CDP_FRAMES 0x20 /* trace CDP frames */
263
264/* the line trace status element configuration structure */
265typedef struct {
266 unsigned short number_trace_status_elements PACKED; /* number of line trace elements */
267 unsigned long base_addr_trace_status_elements PACKED; /* base address of the trace element list */
268 unsigned long next_trace_element_to_use PACKED; /* pointer to the next trace element to be used */
269 unsigned long base_addr_trace_buffer PACKED; /* base address of the trace data buffer */
270 unsigned long end_addr_trace_buffer PACKED; /* end address of the trace data buffer */
271} TRACE_STATUS_EL_CFG_STRUCT;
272
273/* the line trace status element structure */
274typedef struct {
275 unsigned char opp_flag PACKED; /* opp flag */
276 unsigned short trace_length PACKED; /* trace length */
277 unsigned char trace_type PACKED; /* trace type */
278 unsigned short trace_time_stamp PACKED; /* time stamp */
279 unsigned short trace_reserved_1 PACKED; /* reserved for later use */
280 unsigned long trace_reserved_2 PACKED; /* reserved for later use */
281 unsigned long ptr_data_bfr PACKED; /* ptr to the trace data buffer */
282} TRACE_STATUS_ELEMENT_STRUCT;
283
284/* "trace_type" bit settings */
285#define TRACE_INCOMING 0x00
286#define TRACE_OUTGOINGING 0x01
287#define TRACE_INCOMING_ABORTED 0x10
288#define TRACE_INCOMING_CRC_ERROR 0x20
289#define TRACE_INCOMING_OVERRUN_ERROR 0x40
290
291
292
293/* the line trace statistics structure */
294typedef struct {
295 unsigned long frames_traced_count PACKED; /* number of frames traced */
296 unsigned long trc_frms_not_recorded_count PACKED; /* number of trace frames discarded */
297} LINE_TRACE_STATS_STRUCT;
298
299
300/* ----------------------------------------------------------------------------
301 * Constants for the FT1_MONITOR_STATUS_CTRL command
302 * --------------------------------------------------------------------------*/
303
304#define DISABLE_FT1_STATUS_STATISTICS 0x00 /* disable the FT1 status and statistics monitoring */
305#define ENABLE_READ_FT1_STATUS 0x01 /* read the FT1 operational status */
306#define ENABLE_READ_FT1_OP_STATS 0x02 /* read the FT1 operational statistics */
307#define FLUSH_FT1_OP_STATS 0x04 /* flush the FT1 operational statistics */
308
309
310
311
312/* ----------------------------------------------------------------------------
313 * Constants for the SET_CHDLC_CONFIGURATION command
314 * --------------------------------------------------------------------------*/
315
316/* the CHDLC configuration structure */
317typedef struct {
318 unsigned long baud_rate PACKED; /* the baud rate */
319 unsigned short line_config_options PACKED; /* line configuration options */
320 unsigned short modem_config_options PACKED; /* modem configration options */
321 unsigned short modem_status_timer PACKED; /* timer for monitoring modem status changes */
322 unsigned short CHDLC_API_options PACKED; /* CHDLC API options */
323 unsigned short CHDLC_protocol_options PACKED; /* CHDLC protocol options */
324 unsigned short percent_data_buffer_for_Tx PACKED; /* percentage data buffering used for Tx */
325 unsigned short CHDLC_statistics_options PACKED; /* CHDLC operational statistics options */
326 unsigned short max_CHDLC_data_field_length PACKED; /* the maximum length of the CHDLC Data field */
327 unsigned short transmit_keepalive_timer PACKED; /* the transmit keepalive timer */
328 unsigned short receive_keepalive_timer PACKED; /* the receive keepalive timer */
329 unsigned short keepalive_error_tolerance PACKED; /* the receive keepalive error tolerance */
330 unsigned short SLARP_request_timer PACKED; /* the SLARP request timer */
331 unsigned long IP_address PACKED; /* the IP address */
332 unsigned long IP_netmask PACKED; /* the IP netmask */
333 unsigned long ptr_shared_mem_info_struct PACKED; /* a pointer to the shared memory area information structure */
334 unsigned long ptr_CHDLC_Tx_stat_el_cfg_struct PACKED; /* a pointer to the transmit status element configuration structure */
335 unsigned long ptr_CHDLC_Rx_stat_el_cfg_struct PACKED; /* a pointer to the receive status element configuration structure */
336} CHDLC_CONFIGURATION_STRUCT;
337
338/* settings for the 'line_config_options' */
339#define INTERFACE_LEVEL_V35 0x0000 /* V.35 interface level */
340#define INTERFACE_LEVEL_RS232 0x0001 /* RS-232 interface level */
341
342/* settings for the 'modem_config_options' */
343
344#define DONT_RAISE_DTR_RTS_ON_EN_COMMS 0x0001
345/* don't automatically raise DTR and RTS when performing an
346 ENABLE_CHDLC_COMMUNICATIONS command */
347
348#define DONT_REPORT_CHG_IN_MODEM_STAT 0x0002
349/* don't report changes in modem status to the application */
350
351
352/* bit settings for the 'CHDLC_protocol_options' byte */
353
354#define IGNORE_DCD_FOR_LINK_STAT 0x0001
355/* ignore DCD in determining the CHDLC link status */
356
357#define IGNORE_CTS_FOR_LINK_STAT 0x0002
358/* ignore CTS in determining the CHDLC link status */
359
360#define IGNORE_KPALV_FOR_LINK_STAT 0x0004
361/* ignore keepalive frames in determining the CHDLC link status */
362
363#define SINGLE_TX_BUFFER 0x4000
364/* configure a single transmit buffer */
365
366#define HDLC_STREAMING_MODE 0x8000
367
368/* settings for the 'CHDLC_statistics_options' */
369
370#define CHDLC_TX_DATA_BYTE_COUNT_STAT 0x0001
371/* record the number of Data bytes transmitted */
372
373#define CHDLC_RX_DATA_BYTE_COUNT_STAT 0x0002
374/* record the number of Data bytes received */
375
376#define CHDLC_TX_THROUGHPUT_STAT 0x0004
377/* compute the Data frame transmit throughput */
378
379#define CHDLC_RX_THROUGHPUT_STAT 0x0008
380/* compute the Data frame receive throughput */
381
382
383/* permitted minimum and maximum values for setting the CHDLC configuration */
384#define PRI_MAX_BAUD_RATE_S508 2666666 /* PRIMARY - maximum baud rate (S508) */
385#define SEC_MAX_BAUD_RATE_S508 258064 /* SECONDARY - maximum baud rate (S508) */
386#define PRI_MAX_BAUD_RATE_S514 2750000 /* PRIMARY - maximum baud rate (S508) */
387#define SEC_MAX_BAUD_RATE_S514 515625 /* SECONDARY - maximum baud rate (S508) */
388
389#define MIN_MODEM_TIMER 0 /* minimum modem status timer */
390#define MAX_MODEM_TIMER 5000 /* maximum modem status timer */
391
392#define SEC_MAX_NO_DATA_BYTES_IN_FRAME 2048 /* SECONDARY - max length of the CHDLC data field */
393
394#define MIN_Tx_KPALV_TIMER 0 /* minimum transmit keepalive timer */
395#define MAX_Tx_KPALV_TIMER 60000 /* maximum transmit keepalive timer */
396#define DEFAULT_Tx_KPALV_TIMER 10000 /* default transmit keepalive timer */
397
398#define MIN_Rx_KPALV_TIMER 10 /* minimum receive keepalive timer */
399#define MAX_Rx_KPALV_TIMER 60000 /* maximum receive keepalive timer */
400#define DEFAULT_Rx_KPALV_TIMER 10000 /* default receive keepalive timer */
401
402#define MIN_KPALV_ERR_TOL 1 /* min kpalv error tolerance count */
403#define MAX_KPALV_ERR_TOL 20 /* max kpalv error tolerance count */
404#define DEFAULT_KPALV_ERR_TOL 3 /* default value */
405
406#define MIN_SLARP_REQ_TIMER 0 /* min transmit SLARP Request timer */
407#define MAX_SLARP_REQ_TIMER 60000 /* max transmit SLARP Request timer */
408#define DEFAULT_SLARP_REQ_TIMER 0 /* default value -- no SLARP */
409
410
411
412/* ----------------------------------------------------------------------------
413 * Constants for the READ_CHDLC_LINK_STATUS command
414 * --------------------------------------------------------------------------*/
415
416/* the CHDLC status structure */
417typedef struct {
418 unsigned char CHDLC_link_status PACKED; /* CHDLC link status */
419 unsigned char no_Data_frms_for_app PACKED; /* number of Data frames available for the application */
420 unsigned char receiver_status PACKED; /* enabled/disabled */
421 unsigned char SLARP_state PACKED; /* internal SLARP state */
422} CHDLC_LINK_STATUS_STRUCT;
423
424/* settings for the 'CHDLC_link_status' variable */
425#define CHDLC_LINK_INACTIVE 0x00 /* the CHDLC link is inactive */
426#define CHDLC_LINK_ACTIVE 0x01 /* the CHDLC link is active */
427
428
429
430/* ----------------------------------------------------------------------------
431 * Constants for the READ_CHDLC_OPERATIONAL_STATS command
432 * --------------------------------------------------------------------------*/
433
434/* the CHDLC operational statistics structure */
435typedef struct {
436
437 /* Data frame transmission statistics */
438 unsigned long Data_frames_Tx_count PACKED; /* # of frames transmitted */
439 unsigned long Data_bytes_Tx_count PACKED; /* # of bytes transmitted */
440 unsigned long Data_Tx_throughput PACKED; /* transmit throughput */
441 unsigned long no_ms_for_Data_Tx_thruput_comp PACKED; /* millisecond time used for the Tx throughput computation */
442 unsigned long Tx_Data_discard_lgth_err_count PACKED; /* number of Data frames discarded (length error) */
443 unsigned long reserved_Data_frm_Tx_stat1 PACKED; /* reserved for later */
444 unsigned long reserved_Data_frm_Tx_stat2 PACKED; /* reserved for later */
445 unsigned long reserved_Data_frm_Tx_stat3 PACKED; /* reserved for later */
446
447 /* Data frame reception statistics */
448 unsigned long Data_frames_Rx_count PACKED; /* number of frames received */
449 unsigned long Data_bytes_Rx_count PACKED; /* number of bytes received */
450 unsigned long Data_Rx_throughput PACKED; /* receive throughput */
451 unsigned long no_ms_for_Data_Rx_thruput_comp PACKED; /* millisecond time used for the Rx throughput computation */
452 unsigned long Rx_Data_discard_short_count PACKED; /* received Data frames discarded (too short) */
453 unsigned long Rx_Data_discard_long_count PACKED; /* received Data frames discarded (too long) */
454 unsigned long Rx_Data_discard_inactive_count PACKED; /* received Data frames discarded (link inactive) */
455 unsigned long reserved_Data_frm_Rx_stat1 PACKED; /* reserved for later */
456
457 /* SLARP frame transmission/reception statistics */
458 unsigned long CHDLC_SLARP_REQ_Tx_count PACKED; /* number of SLARP Request frames transmitted */
459 unsigned long CHDLC_SLARP_REQ_Rx_count PACKED; /* number of SLARP Request frames received */
460 unsigned long CHDLC_SLARP_REPLY_Tx_count PACKED; /* number of SLARP Reply frames transmitted */
461 unsigned long CHDLC_SLARP_REPLY_Rx_count PACKED; /* number of SLARP Reply frames received */
462 unsigned long CHDLC_SLARP_KPALV_Tx_count PACKED; /* number of SLARP keepalive frames transmitted */
463 unsigned long CHDLC_SLARP_KPALV_Rx_count PACKED; /* number of SLARP keepalive frames received */
464 unsigned long reserved_SLARP_stat1 PACKED; /* reserved for later */
465 unsigned long reserved_SLARP_stat2 PACKED; /* reserved for later */
466
467 /* CDP frame transmission/reception statistics */
468 unsigned long CHDLC_CDP_Tx_count PACKED; /* number of CDP frames transmitted */
469 unsigned long CHDLC_CDP_Rx_count PACKED; /* number of CDP frames received */
470 unsigned long reserved_CDP_stat1 PACKED; /* reserved for later */
471 unsigned long reserved_CDP_stat2 PACKED; /* reserved for later */
472 unsigned long reserved_CDP_stat3 PACKED; /* reserved for later */
473 unsigned long reserved_CDP_stat4 PACKED; /* reserved for later */
474 unsigned long reserved_CDP_stat5 PACKED; /* reserved for later */
475 unsigned long reserved_CDP_stat6 PACKED; /* reserved for later */
476
477 /* Incoming frames with a format error statistics */
478 unsigned short Rx_frm_incomp_CHDLC_hdr_count PACKED; /* frames received of with incomplete Cisco HDLC header */
479 unsigned short Rx_frms_too_long_count PACKED; /* frames received of excessive length count */
480 unsigned short Rx_invalid_CHDLC_addr_count PACKED; /* frames received with an invalid CHDLC address count */
481 unsigned short Rx_invalid_CHDLC_ctrl_count PACKED; /* frames received with an invalid CHDLC control field count */
482 unsigned short Rx_invalid_CHDLC_type_count PACKED; /* frames received of an invalid CHDLC frame type count */
483 unsigned short Rx_SLARP_invalid_code_count PACKED; /* SLARP frame received with an invalid packet code */
484 unsigned short Rx_SLARP_Reply_bad_IP_addr PACKED; /* SLARP Reply received - bad IP address */
485 unsigned short Rx_SLARP_Reply_bad_netmask PACKED; /* SLARP Reply received - bad netmask */
486 unsigned long reserved_frm_format_err1 PACKED; /* reserved for later */
487 unsigned long reserved_frm_format_err2 PACKED; /* reserved for later */
488 unsigned long reserved_frm_format_err3 PACKED; /* reserved for later */
489 unsigned long reserved_frm_format_err4 PACKED; /* reserved for later */
490
491 /* CHDLC timeout/retry statistics */
492 unsigned short SLARP_Rx_keepalive_TO_count PACKED; /* timeout count for incoming SLARP frames */
493 unsigned short SLARP_Request_TO_count PACKED; /* timeout count for SLARP Request frames */
494 unsigned long To_retry_reserved_stat1 PACKED; /* reserved for later */
495 unsigned long To_retry_reserved_stat2 PACKED; /* reserved for later */
496 unsigned long To_retry_reserved_stat3 PACKED; /* reserved for later */
497
498 /* CHDLC link active/inactive and loopback statistics */
499 unsigned short link_active_count PACKED; /* number of times that the link went active */
500 unsigned short link_inactive_modem_count PACKED; /* number of times that the link went inactive (modem failure) */
501 unsigned short link_inactive_keepalive_count PACKED; /* number of times that the link went inactive (keepalive failure) */
502 unsigned short link_looped_count PACKED; /* link looped count */
503 unsigned long link_status_reserved_stat1 PACKED; /* reserved for later use */
504 unsigned long link_status_reserved_stat2 PACKED; /* reserved for later use */
505
506 /* miscellaneous statistics */
507 unsigned long reserved_misc_stat1 PACKED; /* reserved for later */
508 unsigned long reserved_misc_stat2 PACKED; /* reserved for later */
509 unsigned long reserved_misc_stat3 PACKED; /* reserved for later */
510 unsigned long reserved_misc_stat4 PACKED; /* reserved for later */
511
512} CHDLC_OPERATIONAL_STATS_STRUCT;
513
514
515
516/* ----------------------------------------------------------------------------
517 * Constants for using application interrupts
518 * --------------------------------------------------------------------------*/
519
520/* the structure used for the SET_CHDLC_INTERRUPT_TRIGGERS/READ_CHDLC_INTERRUPT_TRIGGERS command */
521typedef struct {
522 unsigned char CHDLC_interrupt_triggers PACKED; /* CHDLC interrupt trigger configuration */
523 unsigned char IRQ PACKED; /* IRQ to be used */
524 unsigned short interrupt_timer PACKED; /* interrupt timer */
525 unsigned short misc_interrupt_bits PACKED; /* miscellaneous bits */
526} CHDLC_INT_TRIGGERS_STRUCT;
527
528/* 'CHDLC_interrupt_triggers' bit settings */
529#define APP_INT_ON_RX_FRAME 0x01 /* interrupt on Data frame reception */
530#define APP_INT_ON_TX_FRAME 0x02 /* interrupt when an Data frame may be transmitted */
531#define APP_INT_ON_COMMAND_COMPLETE 0x04 /* interrupt when an interface command is complete */
532#define APP_INT_ON_TIMER 0x08 /* interrupt on a defined millisecond timeout */
533#define APP_INT_ON_GLOBAL_EXCEP_COND 0x10 /* interrupt on a global exception condition */
534#define APP_INT_ON_CHDLC_EXCEP_COND 0x20 /* interrupt on an CHDLC exception condition */
535#define APP_INT_ON_TRACE_DATA_AVAIL 0x80 /* interrupt when trace data is available */
536
537/* interrupt types indicated at 'interrupt_type' byte of the INTERRUPT_INFORMATION_STRUCT */
538#define NO_APP_INTS_PEND 0x00 /* no interrups are pending */
539#define RX_APP_INT_PEND 0x01 /* a receive interrupt is pending */
540#define TX_APP_INT_PEND 0x02 /* a transmit interrupt is pending */
541#define COMMAND_COMPLETE_APP_INT_PEND 0x04 /* a 'command complete' interrupt is pending */
542#define TIMER_APP_INT_PEND 0x08 /* a timer interrupt is pending */
543#define GLOBAL_EXCEP_COND_APP_INT_PEND 0x10 /* a global exception condition interrupt is pending */
544#define CHDLC_EXCEP_COND_APP_INT_PEND 0x20 /* an CHDLC exception condition interrupt is pending */
545#define TRACE_DATA_AVAIL_APP_INT_PEND 0x80 /* a trace data available interrupt is pending */
546
547
548/* modem status changes */
549#define DCD_HIGH 0x08
550#define CTS_HIGH 0x20
551
552
553/* ----------------------------------------------------------------------------
554 * Constants for Data frame transmission
555 * --------------------------------------------------------------------------*/
556
557/* the Data frame transmit status element configuration structure */
558typedef struct {
559 unsigned short number_Tx_status_elements PACKED; /* number of transmit status elements */
560 unsigned long base_addr_Tx_status_elements PACKED; /* base address of the transmit element list */
561 unsigned long next_Tx_status_element_to_use PACKED; /* pointer to the next transmit element to be used */
562} CHDLC_TX_STATUS_EL_CFG_STRUCT;
563
564/* the Data frame transmit status element structure */
565typedef struct {
566 unsigned char opp_flag PACKED; /* opp flag */
567 unsigned short frame_length PACKED; /* length of the frame to be transmitted */
568 unsigned char reserved_1 PACKED; /* reserved for internal use */
569 unsigned long reserved_2 PACKED; /* reserved for internal use */
570 unsigned long reserved_3 PACKED; /* reserved for internal use */
571 unsigned long ptr_data_bfr PACKED; /* pointer to the data area */
572} CHDLC_DATA_TX_STATUS_EL_STRUCT;
573
574
575
576/* ----------------------------------------------------------------------------
577 * Constants for Data frame reception
578 * --------------------------------------------------------------------------*/
579
580/* the Data frame receive status element configuration structure */
581typedef struct {
582 unsigned short number_Rx_status_elements PACKED; /* number of receive status elements */
583 unsigned long base_addr_Rx_status_elements PACKED; /* base address of the receive element list */
584 unsigned long next_Rx_status_element_to_use PACKED; /* pointer to the next receive element to be used */
585 unsigned long base_addr_Rx_buffer PACKED; /* base address of the receive data buffer */
586 unsigned long end_addr_Rx_buffer PACKED; /* end address of the receive data buffer */
587} CHDLC_RX_STATUS_EL_CFG_STRUCT;
588
589/* the Data frame receive status element structure */
590typedef struct {
591 unsigned char opp_flag PACKED; /* opp flag */
592 unsigned short frame_length PACKED; /* length of the received frame */
593 unsigned char error_flag PACKED; /* frame errors (HDLC_STREAMING_MODE)*/
594 unsigned short time_stamp PACKED; /* receive time stamp (HDLC_STREAMING_MODE) */
595 unsigned long reserved_1 PACKED; /* reserved for internal use */
596 unsigned short reserved_2 PACKED; /* reserved for internal use */
597 unsigned long ptr_data_bfr PACKED; /* pointer to the data area */
598} CHDLC_DATA_RX_STATUS_EL_STRUCT;
599
600
601
602/* ----------------------------------------------------------------------------
603 * Constants defining the shared memory information area
604 * --------------------------------------------------------------------------*/
605
606/* the global information structure */
607typedef struct {
608 unsigned char global_status PACKED; /* global status */
609 unsigned char modem_status PACKED; /* current modem status */
610 unsigned char global_excep_conditions PACKED; /* global exception conditions */
611 unsigned char glob_info_reserved[5] PACKED; /* reserved */
612 unsigned char codename[4] PACKED; /* Firmware name */
613 unsigned char codeversion[4] PACKED; /* Firmware version */
614} GLOBAL_INFORMATION_STRUCT;
615
616/* the CHDLC information structure */
617typedef struct {
618 unsigned char CHDLC_status PACKED; /* CHDLC status */
619 unsigned char CHDLC_excep_conditions PACKED; /* CHDLC exception conditions */
620 unsigned char CHDLC_info_reserved[14] PACKED; /* reserved */
621} CHDLC_INFORMATION_STRUCT;
622
623/* the interrupt information structure */
624typedef struct {
625 unsigned char interrupt_type PACKED; /* type of interrupt triggered */
626 unsigned char interrupt_permission PACKED; /* interrupt permission mask */
627 unsigned char int_info_reserved[14] PACKED; /* reserved */
628} INTERRUPT_INFORMATION_STRUCT;
629
630/* the S508/FT1 information structure */
631typedef struct {
632 unsigned char parallel_port_A_input PACKED; /* input - parallel port A */
633 unsigned char parallel_port_B_input PACKED; /* input - parallel port B */
634 unsigned char FT1_info_reserved[14] PACKED; /* reserved */
635} FT1_INFORMATION_STRUCT;
636
637/* the shared memory area information structure */
638typedef struct {
639 GLOBAL_INFORMATION_STRUCT global_info_struct PACKED; /* the global information structure */
640 CHDLC_INFORMATION_STRUCT CHDLC_info_struct PACKED; /* the CHDLC information structure */
641 INTERRUPT_INFORMATION_STRUCT interrupt_info_struct PACKED; /* the interrupt information structure */
642 FT1_INFORMATION_STRUCT FT1_info_struct PACKED; /* the S508/FT1 information structure */
643} SHARED_MEMORY_INFO_STRUCT;
644
645/* ----------------------------------------------------------------------------
646 * UDP Management constants and structures
647 * --------------------------------------------------------------------------*/
648
649/* The embedded control block for UDP mgmt
650 This is essentially a mailbox structure, without the large data field */
651
652typedef struct {
653 unsigned char opp_flag PACKED; /* the opp flag */
654 unsigned char command PACKED; /* the user command */
655 unsigned short buffer_length PACKED; /* the data length */
656 unsigned char return_code PACKED; /* the return code */
657 unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] PACKED; /* reserved for later */
658} cblock_t;
659
660
661/* UDP management packet layout (data area of ip packet) */
662/*
663typedef struct {
664 unsigned char signature[8] PACKED;
665 unsigned char request_reply PACKED;
666 unsigned char id PACKED;
667 unsigned char reserved[6] PACKED;
668 cblock_t cblock PACKED;
669 unsigned char num_frames PACKED;
670 unsigned char ismoredata PACKED;
671 unsigned char data[SIZEOF_MB_DATA_BFR] PACKED;
672} udp_management_packet_t;
673
674*/
675
676typedef struct {
677 unsigned char num_frames PACKED;
678 unsigned char ismoredata PACKED;
679} trace_info_t;
680
681typedef struct {
682 ip_pkt_t ip_pkt PACKED;
683 udp_pkt_t udp_pkt PACKED;
684 wp_mgmt_t wp_mgmt PACKED;
685 cblock_t cblock PACKED;
686 trace_info_t trace_info PACKED;
687 unsigned char data[SIZEOF_MB_DATA_BFR] PACKED;
688} chdlc_udp_pkt_t;
689
690typedef struct ft1_exec_cmd{
691 unsigned char command PACKED; /* the user command */
692 unsigned short buffer_length PACKED; /* the data length */
693 unsigned char return_code PACKED; /* the return code */
694 unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] PACKED;
695} ft1_exec_cmd_t;
696
697typedef struct {
698 unsigned char opp_flag PACKED;
699 ft1_exec_cmd_t cmd PACKED;
700 unsigned char data[SIZEOF_MB_DATA_BFR] PACKED;
701} ft1_exec_t;
702
703#define UDPMGMT_SIGNATURE "CTPIPEAB"
704
705
706/* UDP/IP packet (for UDP management) layout */
707/*
708typedef struct {
709 unsigned char reserved[2] PACKED;
710 unsigned short ip_length PACKED;
711 unsigned char reserved2[4] PACKED;
712 unsigned char ip_ttl PACKED;
713 unsigned char ip_protocol PACKED;
714 unsigned short ip_checksum PACKED;
715 unsigned long ip_src_address PACKED;
716 unsigned long ip_dst_address PACKED;
717 unsigned short udp_src_port PACKED;
718 unsigned short udp_dst_port PACKED;
719 unsigned short udp_length PACKED;
720 unsigned short udp_checksum PACKED;
721 udp_management_packet_t um_packet PACKED;
722} ip_packet_t;
723*/
724
725/* valid ip_protocol for UDP management */
726#define UDPMGMT_UDP_PROTOCOL 0x11
727
728
729typedef struct {
730 unsigned char status PACKED;
731 unsigned char data_avail PACKED;
732 unsigned short real_length PACKED;
733 unsigned short time_stamp PACKED;
734 unsigned char data[1] PACKED;
735} trace_pkt_t;
736
737typedef struct {
738 unsigned char error_flag PACKED;
739 unsigned short time_stamp PACKED;
740 unsigned char reserved[13] PACKED;
741} api_rx_hdr_t;
742
743typedef struct {
744 api_rx_hdr_t api_rx_hdr PACKED;
745 void * data PACKED;
746} api_rx_element_t;
747
748typedef struct {
749 unsigned char attr PACKED;
750 unsigned char reserved[15] PACKED;
751} api_tx_hdr_t;
752
753typedef struct {
754 api_tx_hdr_t api_tx_hdr PACKED;
755 void * data PACKED;
756} api_tx_element_t;
757
758/* ----------------------------------------------------------------------------
759 * Constants for the SET_FT1_CONFIGURATION/READ_FT1_CONFIGURATION command
760 * --------------------------------------------------------------------------*/
761
762/* the FT1 configuration structure */
763typedef struct {
764 unsigned short framing_mode;
765 unsigned short encoding_mode;
766 unsigned short line_build_out;
767 unsigned short channel_base;
768 unsigned short baud_rate_kbps; /* the baud rate (in kbps) */
769 unsigned short clock_mode;
770} ft1_config_t;
771
772/* settings for the 'framing_mode' */
773#define ESF_FRAMING 0x00 /* ESF framing */
774#define D4_FRAMING 0x01 /* D4 framing */
775
776/* settings for the 'encoding_mode' */
777#define B8ZS_ENCODING 0x00 /* B8ZS encoding */
778#define AMI_ENCODING 0x01 /* AMI encoding */
779
780/* settings for the 'line_build_out' */
781#define LN_BLD_CSU_0dB_DSX1_0_to_133 0x00 /* set build out to CSU (0db) or DSX-1 (0-133ft) */
782#define LN_BLD_DSX1_133_to_266 0x01 /* set build out DSX-1 (133-266ft) */
783#define LN_BLD_DSX1_266_to_399 0x02 /* set build out DSX-1 (266-399ft) */
784#define LN_BLD_DSX1_399_to_533 0x03 /* set build out DSX-1 (399-533ft) */
785#define LN_BLD_DSX1_533_to_655 0x04 /* set build out DSX-1 (533-655ft) */
786#define LN_BLD_CSU_NEG_7dB 0x05 /* set build out to CSU (-7.5db) */
787#define LN_BLD_CSU_NEG_15dB 0x06 /* set build out to CSU (-15db) */
788#define LN_BLD_CSU_NEG_22dB 0x07 /* set build out to CSU (-22.5db) */
789
790/* settings for the 'channel_base' */
791#define MIN_CHANNEL_BASE_VALUE 1 /* the minimum permitted channel base value */
792#define MAX_CHANNEL_BASE_VALUE 24 /* the maximum permitted channel base value */
793
794/* settings for the 'baud_rate_kbps' */
795#define MIN_BAUD_RATE_KBPS 0 /* the minimum permitted baud rate (kbps) */
796#define MAX_BAUD_RATE_KBPS 1536 /* the maximum permitted baud rate (kbps) */
797#define BAUD_RATE_FT1_AUTO_CONFIG 0xFFFF /* the baud rate used to trigger an automatic FT1 configuration */
798
799/* settings for the 'clock_mode' */
800#define CLOCK_MODE_NORMAL 0x00 /* clock mode set to normal (slave) */
801#define CLOCK_MODE_MASTER 0x01 /* clock mode set to master */
802
803
804#define BAUD_RATE_FT1_AUTO_CONFIG 0xFFFF
805#define AUTO_FT1_CONFIG_NOT_COMPLETE 0x08
806#define AUTO_FT1_CFG_FAIL_OP_MODE 0x0C
807#define AUTO_FT1_CFG_FAIL_INVALID_LINE 0x0D
808
809
810#ifdef _MSC_
811# pragma pack()
812#endif
813#endif /* _SDLA_CHDLC_H */