📄 sdla_chdlc.h
字号:
/* the line trace status element structure */
typedef struct {
unsigned char opp_flag PACKED; /* opp flag */
unsigned short trace_length PACKED; /* trace length */
unsigned char trace_type PACKED; /* trace type */
unsigned short trace_time_stamp PACKED; /* time stamp */
unsigned short trace_reserved_1 PACKED; /* reserved for later use */
unsigned long trace_reserved_2 PACKED; /* reserved for later use */
unsigned long ptr_data_bfr PACKED; /* ptr to the trace data buffer */
} TRACE_STATUS_ELEMENT_STRUCT;
/* "trace_type" bit settings */
#define TRACE_INCOMING 0x00
#define TRACE_OUTGOINGING 0x01
#define TRACE_INCOMING_ABORTED 0x10
#define TRACE_INCOMING_CRC_ERROR 0x20
#define TRACE_INCOMING_OVERRUN_ERROR 0x40
/* the line trace statistics structure */
typedef struct {
unsigned long frames_traced_count PACKED; /* number of frames traced */
unsigned long trc_frms_not_recorded_count PACKED; /* number of trace frames discarded */
} LINE_TRACE_STATS_STRUCT;
/* ----------------------------------------------------------------------------
* Constants for the FT1_MONITOR_STATUS_CTRL command
* --------------------------------------------------------------------------*/
#define DISABLE_FT1_STATUS_STATISTICS 0x00 /* disable the FT1 status and statistics monitoring */
#define ENABLE_READ_FT1_STATUS 0x01 /* read the FT1 operational status */
#define ENABLE_READ_FT1_OP_STATS 0x02 /* read the FT1 operational statistics */
#define FLUSH_FT1_OP_STATS 0x04 /* flush the FT1 operational statistics */
/* ----------------------------------------------------------------------------
* Constants for the SET_CHDLC_CONFIGURATION command
* --------------------------------------------------------------------------*/
/* the CHDLC configuration structure */
typedef struct {
unsigned long baud_rate PACKED; /* the baud rate */
unsigned short line_config_options PACKED; /* line configuration options */
unsigned short modem_config_options PACKED; /* modem configration options */
unsigned short modem_status_timer PACKED; /* timer for monitoring modem status changes */
unsigned short CHDLC_API_options PACKED; /* CHDLC API options */
unsigned short CHDLC_protocol_options PACKED; /* CHDLC protocol options */
unsigned short percent_data_buffer_for_Tx PACKED; /* percentage data buffering used for Tx */
unsigned short CHDLC_statistics_options PACKED; /* CHDLC operational statistics options */
unsigned short max_CHDLC_data_field_length PACKED; /* the maximum length of the CHDLC Data field */
unsigned short transmit_keepalive_timer PACKED; /* the transmit keepalive timer */
unsigned short receive_keepalive_timer PACKED; /* the receive keepalive timer */
unsigned short keepalive_error_tolerance PACKED; /* the receive keepalive error tolerance */
unsigned short SLARP_request_timer PACKED; /* the SLARP request timer */
unsigned long IP_address PACKED; /* the IP address */
unsigned long IP_netmask PACKED; /* the IP netmask */
unsigned long ptr_shared_mem_info_struct PACKED; /* a pointer to the shared memory area information structure */
unsigned long ptr_CHDLC_Tx_stat_el_cfg_struct PACKED; /* a pointer to the transmit status element configuration structure */
unsigned long ptr_CHDLC_Rx_stat_el_cfg_struct PACKED; /* a pointer to the receive status element configuration structure */
} CHDLC_CONFIGURATION_STRUCT;
/* settings for the 'line_config_options' */
#define INTERFACE_LEVEL_V35 0x0000 /* V.35 interface level */
#define INTERFACE_LEVEL_RS232 0x0001 /* RS-232 interface level */
/* settings for the 'modem_config_options' */
#define DONT_RAISE_DTR_RTS_ON_EN_COMMS 0x0001
/* don't automatically raise DTR and RTS when performing an
ENABLE_CHDLC_COMMUNICATIONS command */
#define DONT_REPORT_CHG_IN_MODEM_STAT 0x0002
/* don't report changes in modem status to the application */
/* bit settings for the 'CHDLC_protocol_options' byte */
#define IGNORE_DCD_FOR_LINK_STAT 0x0001
/* ignore DCD in determining the CHDLC link status */
#define IGNORE_CTS_FOR_LINK_STAT 0x0002
/* ignore CTS in determining the CHDLC link status */
#define IGNORE_KPALV_FOR_LINK_STAT 0x0004
/* ignore keepalive frames in determining the CHDLC link status */
#define SINGLE_TX_BUFFER 0x4000
/* configure a single transmit buffer */
#define HDLC_STREAMING_MODE 0x8000
/* settings for the 'CHDLC_statistics_options' */
#define CHDLC_TX_DATA_BYTE_COUNT_STAT 0x0001
/* record the number of Data bytes transmitted */
#define CHDLC_RX_DATA_BYTE_COUNT_STAT 0x0002
/* record the number of Data bytes received */
#define CHDLC_TX_THROUGHPUT_STAT 0x0004
/* compute the Data frame transmit throughput */
#define CHDLC_RX_THROUGHPUT_STAT 0x0008
/* compute the Data frame receive throughput */
/* permitted minimum and maximum values for setting the CHDLC configuration */
#define PRI_MAX_BAUD_RATE_S508 2666666 /* PRIMARY - maximum baud rate (S508) */
#define SEC_MAX_BAUD_RATE_S508 258064 /* SECONDARY - maximum baud rate (S508) */
#define PRI_MAX_BAUD_RATE_S514 2750000 /* PRIMARY - maximum baud rate (S508) */
#define SEC_MAX_BAUD_RATE_S514 515625 /* SECONDARY - maximum baud rate (S508) */
#define MIN_MODEM_TIMER 0 /* minimum modem status timer */
#define MAX_MODEM_TIMER 5000 /* maximum modem status timer */
#define SEC_MAX_NO_DATA_BYTES_IN_FRAME 2048 /* SECONDARY - max length of the CHDLC data field */
#define MIN_Tx_KPALV_TIMER 0 /* minimum transmit keepalive timer */
#define MAX_Tx_KPALV_TIMER 60000 /* maximum transmit keepalive timer */
#define DEFAULT_Tx_KPALV_TIMER 10000 /* default transmit keepalive timer */
#define MIN_Rx_KPALV_TIMER 10 /* minimum receive keepalive timer */
#define MAX_Rx_KPALV_TIMER 60000 /* maximum receive keepalive timer */
#define DEFAULT_Rx_KPALV_TIMER 10000 /* default receive keepalive timer */
#define MIN_KPALV_ERR_TOL 1 /* min kpalv error tolerance count */
#define MAX_KPALV_ERR_TOL 20 /* max kpalv error tolerance count */
#define DEFAULT_KPALV_ERR_TOL 3 /* default value */
#define MIN_SLARP_REQ_TIMER 0 /* min transmit SLARP Request timer */
#define MAX_SLARP_REQ_TIMER 60000 /* max transmit SLARP Request timer */
#define DEFAULT_SLARP_REQ_TIMER 0 /* default value -- no SLARP */
/* ----------------------------------------------------------------------------
* Constants for the READ_CHDLC_LINK_STATUS command
* --------------------------------------------------------------------------*/
/* the CHDLC status structure */
typedef struct {
unsigned char CHDLC_link_status PACKED; /* CHDLC link status */
unsigned char no_Data_frms_for_app PACKED; /* number of Data frames available for the application */
unsigned char receiver_status PACKED; /* enabled/disabled */
unsigned char SLARP_state PACKED; /* internal SLARP state */
} CHDLC_LINK_STATUS_STRUCT;
/* settings for the 'CHDLC_link_status' variable */
#define CHDLC_LINK_INACTIVE 0x00 /* the CHDLC link is inactive */
#define CHDLC_LINK_ACTIVE 0x01 /* the CHDLC link is active */
/* ----------------------------------------------------------------------------
* Constants for the READ_CHDLC_OPERATIONAL_STATS command
* --------------------------------------------------------------------------*/
/* the CHDLC operational statistics structure */
typedef struct {
/* Data frame transmission statistics */
unsigned long Data_frames_Tx_count PACKED; /* # of frames transmitted */
unsigned long Data_bytes_Tx_count PACKED; /* # of bytes transmitted */
unsigned long Data_Tx_throughput PACKED; /* transmit throughput */
unsigned long no_ms_for_Data_Tx_thruput_comp PACKED; /* millisecond time used for the Tx throughput computation */
unsigned long Tx_Data_discard_lgth_err_count PACKED; /* number of Data frames discarded (length error) */
unsigned long reserved_Data_frm_Tx_stat1 PACKED; /* reserved for later */
unsigned long reserved_Data_frm_Tx_stat2 PACKED; /* reserved for later */
unsigned long reserved_Data_frm_Tx_stat3 PACKED; /* reserved for later */
/* Data frame reception statistics */
unsigned long Data_frames_Rx_count PACKED; /* number of frames received */
unsigned long Data_bytes_Rx_count PACKED; /* number of bytes received */
unsigned long Data_Rx_throughput PACKED; /* receive throughput */
unsigned long no_ms_for_Data_Rx_thruput_comp PACKED; /* millisecond time used for the Rx throughput computation */
unsigned long Rx_Data_discard_short_count PACKED; /* received Data frames discarded (too short) */
unsigned long Rx_Data_discard_long_count PACKED; /* received Data frames discarded (too long) */
unsigned long Rx_Data_discard_inactive_count PACKED; /* received Data frames discarded (link inactive) */
unsigned long reserved_Data_frm_Rx_stat1 PACKED; /* reserved for later */
/* SLARP frame transmission/reception statistics */
unsigned long CHDLC_SLARP_REQ_Tx_count PACKED; /* number of SLARP Request frames transmitted */
unsigned long CHDLC_SLARP_REQ_Rx_count PACKED; /* number of SLARP Request frames received */
unsigned long CHDLC_SLARP_REPLY_Tx_count PACKED; /* number of SLARP Reply frames transmitted */
unsigned long CHDLC_SLARP_REPLY_Rx_count PACKED; /* number of SLARP Reply frames received */
unsigned long CHDLC_SLARP_KPALV_Tx_count PACKED; /* number of SLARP keepalive frames transmitted */
unsigned long CHDLC_SLARP_KPALV_Rx_count PACKED; /* number of SLARP keepalive frames received */
unsigned long reserved_SLARP_stat1 PACKED; /* reserved for later */
unsigned long reserved_SLARP_stat2 PACKED; /* reserved for later */
/* CDP frame transmission/reception statistics */
unsigned long CHDLC_CDP_Tx_count PACKED; /* number of CDP frames transmitted */
unsigned long CHDLC_CDP_Rx_count PACKED; /* number of CDP frames received */
unsigned long reserved_CDP_stat1 PACKED; /* reserved for later */
unsigned long reserved_CDP_stat2 PACKED; /* reserved for later */
unsigned long reserved_CDP_stat3 PACKED; /* reserved for later */
unsigned long reserved_CDP_stat4 PACKED; /* reserved for later */
unsigned long reserved_CDP_stat5 PACKED; /* reserved for later */
unsigned long reserved_CDP_stat6 PACKED; /* reserved for later */
/* Incoming frames with a format error statistics */
unsigned short Rx_frm_incomp_CHDLC_hdr_count PACKED; /* frames received of with incomplete Cisco HDLC header */
unsigned short Rx_frms_too_long_count PACKED; /* frames received of excessive length count */
unsigned short Rx_invalid_CHDLC_addr_count PACKED; /* frames received with an invalid CHDLC address count */
unsigned short Rx_invalid_CHDLC_ctrl_count PACKED; /* frames received with an invalid CHDLC control field count */
unsigned short Rx_invalid_CHDLC_type_count PACKED; /* frames received of an invalid CHDLC frame type count */
unsigned short Rx_SLARP_invalid_code_count PACKED; /* SLARP frame received with an invalid packet code */
unsigned short Rx_SLARP_Reply_bad_IP_addr PACKED; /* SLARP Reply received - bad IP address */
unsigned short Rx_SLARP_Reply_bad_netmask PACKED; /* SLARP Reply received - bad netmask */
unsigned long reserved_frm_format_err1 PACKED; /* reserved for later */
unsigned long reserved_frm_format_err2 PACKED; /* reserved for later */
unsigned long reserved_frm_format_err3 PACKED; /* reserved for later */
unsigned long reserved_frm_format_err4 PACKED; /* reserved for later */
/* CHDLC timeout/retry statistics */
unsigned short SLARP_Rx_keepalive_TO_count PACKED; /* timeout count for incoming SLARP frames */
unsigned short SLARP_Request_TO_count PACKED; /* timeout count for SLARP Request frames */
unsigned long To_retry_reserved_stat1 PACKED; /* reserved for later */
unsigned long To_retry_reserved_stat2 PACKED; /* reserved for later */
unsigned long To_retry_reserved_stat3 PACKED; /* reserved for later */
/* CHDLC link active/inactive and loopback statistics */
unsigned short link_active_count PACKED; /* number of times that the link went active */
unsigned short link_inactive_modem_count PACKED; /* number of times that the link went inactive (modem failure) */
unsigned short link_inactive_keepalive_count PACKED; /* number of times that the link went inactive (keepalive failure) */
unsigned short link_looped_count PACKED; /* link looped count */
unsigned long link_status_reserved_stat1 PACKED; /* reserved for later use */
unsigned long link_status_reserved_stat2 PACKED; /* reserved for later use */
/* miscellaneous statistics */
unsigned long reserved_misc_stat1 PACKED; /* reserved for later */
unsigned long reserved_misc_stat2 PACKED; /* reserved for later */
unsigned long reserved_misc_stat3 PACKED; /* reserved for later */
unsigned long reserved_misc_stat4 PACKED; /* reserved for later */
} CHDLC_OPERATIONAL_STATS_STRUCT;
/* ----------------------------------------------------------------------------
* Constants for using application interrupts
* --------------------------------------------------------------------------*/
/* the structure used for the SET_CHDLC_INTERRUPT_TRIGGERS/READ_CHDLC_INTERRUPT_TRIGGERS command */
typedef struct {
unsigned char CHDLC_interrupt_triggers PACKED; /* CHDLC interrupt trigger configuration */
unsigned char IRQ PACKED; /* IRQ to be used */
unsigned short interrupt_timer PACKED; /* interrupt timer */
unsigned short misc_interrupt_bits PACKED; /* miscellaneous bits */
} CHDLC_INT_TRIGGERS_STRUCT;
/* 'CHDLC_interrupt_triggers' bit settings */
#define APP_INT_ON_RX_FRAME 0x01 /* interrupt on Data frame reception */
#define APP_INT_ON_TX_FRAME 0x02 /* interrupt when an Data frame may be transmitted */
#define APP_INT_ON_COMMAND_COMPLETE 0x04 /* interrupt when an interface command is complete */
#define APP_INT_ON_TIMER 0x08 /* interrupt on a defined millisecond timeout */
#define APP_INT_ON_GLOBAL_EXCEP_COND 0x10 /* interrupt on a global exception condition */
#define APP_INT_ON_CHDLC_EXCEP_COND 0x20 /* interrupt on an CHDLC exception condition */
#define APP_INT_ON_TRACE_DATA_AVAIL 0x80 /* interrupt when trace data is available */
/* interrupt types indicated at 'interrupt_type' byte of the INTERRUPT_INFORMATION_STRUCT */
#define NO_APP_INTS_PEND 0x00 /* no interrups are pending */
#define RX_APP_INT_PEND 0x01 /* a receive interrupt is pending */
#define TX_APP_INT_PEND 0x02 /* a transmit interrupt is pending */
#define COMMAND_COMPLETE_APP_INT_PEND 0x04 /* a 'command complete' interrupt is pending */
#define TIMER_APP_INT_PEND 0x08 /* a timer interrupt is pending */
#define GLOBAL_EXCEP_COND_APP_INT_PEND 0x10 /* a global exception condition interrupt is pending */
#define CHDLC_EXCEP_COND_APP_INT_PEND 0x20 /* an CHDLC exception condition interrupt is pending */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -