📄 sdla_chdlc.h
字号:
/************************************************************************* sdla_chdlc.h Sangoma Cisco HDLC firmware API definitions Author: Gideon Hack Nenad Corbic <ncorbic@sangoma.com> Copyright: (c) 1995-2000 Sangoma Technologies Inc. This program is free software; you can redistribute it and/or modify it under the term of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.=========================================================================== Oct 04, 1999 Nenad Corbic Updated API support Jun 02, 1999 Gideon Hack Changes for S514 usage. Oct 28, 1998 Jaspreet Singh Made changes for Dual Port CHDLC. Jun 11, 1998 David Fong Initial version.=========================================================================== Organization - Compatibility notes - Constants defining the shared memory control block (mailbox) - Interface commands - Return code from interface commands - Constants for the commands (structures for casting data) - UDP Management constants and structures*************************************************************************/#ifndef _SDLA_CHDLC_H# define _SDLC_CHDLC_H/*------------------------------------------------------------------------ Notes: All structres defined in this file are byte-aligned. Compiler Platform ------------------------ GNU C Linux------------------------------------------------------------------------*/#ifndef PACKED#define PACKED __attribute__((packed))#endif /* PACKED *//* ---------------------------------------------------------------------------- * Constants defining the shared memory control block (mailbox) * --------------------------------------------------------------------------*/#define PRI_BASE_ADDR_MB_STRUCT 0xE000 /* the base address of the mailbox structure on the adapter */#define SEC_BASE_ADDR_MB_STRUCT 0xE800 /* the base address of the mailbox structure on the adapter */#define SIZEOF_MB_DATA_BFR 2032 /* the size of the actual mailbox data area */#define NUMBER_MB_RESERVED_BYTES 0x0B /* the number of reserved bytes in the mailbox header area */#define MIN_LGTH_CHDLC_DATA_CFG 300 /* min length of the CHDLC data field (for configuration purposes) */#define PRI_MAX_NO_DATA_BYTES_IN_FRAME 15354 /* PRIMARY - max length of the CHDLC data field */typedef struct { unsigned char opp_flag PACKED; /* the opp flag */ unsigned char command PACKED; /* the user command */ unsigned short buffer_length PACKED; /* the data length */ unsigned char return_code PACKED; /* the return code */ unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] PACKED; /* reserved for later */ unsigned char data[SIZEOF_MB_DATA_BFR] PACKED; /* the data area */} CHDLC_MAILBOX_STRUCT;typedef struct { pid_t pid_num PACKED; CHDLC_MAILBOX_STRUCT cmdarea PACKED;} CMDBLOCK_STRUCT;/* ---------------------------------------------------------------------------- * Interface commands * --------------------------------------------------------------------------*//* global interface commands */#define READ_GLOBAL_EXCEPTION_CONDITION 0x01#define SET_GLOBAL_CONFIGURATION 0x02#define READ_GLOBAL_CONFIGURATION 0x03#define READ_GLOBAL_STATISTICS 0x04#define FLUSH_GLOBAL_STATISTICS 0x05#define SET_MODEM_STATUS 0x06 /* set status of DTR or RTS */#define READ_MODEM_STATUS 0x07 /* read status of CTS and DCD */#define READ_COMMS_ERROR_STATS 0x08 #define FLUSH_COMMS_ERROR_STATS 0x09#define SET_TRACE_CONFIGURATION 0x0A /* set the line trace config */#define READ_TRACE_CONFIGURATION 0x0B /* read the line trace config */#define READ_TRACE_STATISTICS 0x0C /* read the trace statistics */#define FLUSH_TRACE_STATISTICS 0x0D /* flush the trace statistics */#define FT1_MONITOR_STATUS_CTRL 0x1C /* set the status of the S508/FT1 monitoring */#define SET_FT1_CONFIGURATION 0x18 /* set the FT1 configuration */#define READ_FT1_CONFIGURATION 0x19 /* read the FT1 configuration */#define TRANSMIT_ASYNC_DATA_TO_FT1 0x1A /* output asynchronous data to the FT1 */#define RECEIVE_ASYNC_DATA_FROM_FT1 0x1B /* receive asynchronous data from the FT1 */#define FT1_MONITOR_STATUS_CTRL 0x1C /* set the status of the FT1 monitoring */#define READ_FT1_OPERATIONAL_STATS 0x1D /* read the S508/FT1 operational statistics */#define SET_FT1_MODE 0x1E /* set the operational mode of the S508/FT1 module *//* CHDLC-level interface commands */#define READ_CHDLC_CODE_VERSION 0x20 #define READ_CHDLC_EXCEPTION_CONDITION 0x21 /* read exception condition from the adapter */#define SET_CHDLC_CONFIGURATION 0x22#define READ_CHDLC_CONFIGURATION 0x23#define ENABLE_CHDLC_COMMUNICATIONS 0x24#define DISABLE_CHDLC_COMMUNICATIONS 0x25#define READ_CHDLC_LINK_STATUS 0x26#define READ_CHDLC_OPERATIONAL_STATS 0x27#define FLUSH_CHDLC_OPERATIONAL_STATS 0x28#define SET_CHDLC_INTERRUPT_TRIGGERS 0x30 /* set application interrupt triggers */#define READ_CHDLC_INTERRUPT_TRIGGERS 0x31 /* read application interrupt trigger configuration *//* Special UDP drivers management commands */#define CPIPE_ENABLE_TRACING 0x50#define CPIPE_DISABLE_TRACING 0x51#define CPIPE_GET_TRACE_INFO 0x52#define CPIPE_GET_IBA_DATA 0x53#define CPIPE_FT1_READ_STATUS 0x54#define CPIPE_DRIVER_STAT_IFSEND 0x55#define CPIPE_DRIVER_STAT_INTR 0x56#define CPIPE_DRIVER_STAT_GEN 0x57#define CPIPE_FLUSH_DRIVER_STATS 0x58#define CPIPE_ROUTER_UP_TIME 0x59/* Driver specific commands for API */#define CHDLC_READ_TRACE_DATA 0xE4 /* read trace data */#define TRACE_ALL 0x00#define TRACE_PROT 0x01#define TRACE_DATA 0x02#define DISCARD_RX_ERROR_FRAMES 0x0001/* ---------------------------------------------------------------------------- * Return codes from interface commands * --------------------------------------------------------------------------*/#define COMMAND_OK 0x00/* return codes from global interface commands */#define NO_GLOBAL_EXCEP_COND_TO_REPORT 0x01 /* there is no CHDLC exception condition to report */#define LGTH_GLOBAL_CFG_DATA_INVALID 0x01 /* the length of the passed global configuration data is invalid */#define LGTH_TRACE_CFG_DATA_INVALID 0x01 /* the length of the passed trace configuration data is invalid */#define IRQ_TIMEOUT_VALUE_INVALID 0x02 /* an invalid application IRQ timeout value was selected */#define TRACE_CONFIG_INVALID 0x02 /* the passed line trace configuration is invalid */#define ADAPTER_OPERATING_FREQ_INVALID 0x03 /* an invalid adapter operating frequency was selected */#define TRC_DEAC_TMR_INVALID 0x03 /* the trace deactivation timer is invalid */#define S508_FT1_ADPTR_NOT_PRESENT 0x0C /* the S508/FT1 adapter is not present */#define INVALID_FT1_STATUS_SELECTION 0x0D /* the S508/FT1 status selection is invalid */#define FT1_OP_STATS_NOT_ENABLED 0x0D /* the FT1 operational statistics have not been enabled */#define FT1_OP_STATS_NOT_AVAILABLE 0x0E /* the FT1 operational statistics are not currently available */#define S508_FT1_MODE_SELECTION_BUSY 0x0E /* the S508/FT1 adapter is busy selecting the operational mode *//* return codes from command READ_GLOBAL_EXCEPTION_CONDITION */#define EXCEP_MODEM_STATUS_CHANGE 0x10 /* a modem status change occurred */#define EXCEP_TRC_DISABLED 0x11 /* the trace has been disabled */#define EXCEP_IRQ_TIMEOUT 0x12 /* IRQ timeout *//* return codes from CHDLC-level interface commands */#define NO_CHDLC_EXCEP_COND_TO_REPORT 0x21 /* there is no CHDLC exception condition to report */#define CHDLC_COMMS_DISABLED 0x21 /* communications are not currently enabled */#define CHDLC_COMMS_ENABLED 0x21 /* communications are currently enabled */#define DISABLE_CHDLC_COMMS_BEFORE_CFG 0x21 /* CHDLC communications must be disabled before setting the configuration */#define ENABLE_CHDLC_COMMS_BEFORE_CONN 0x21 /* communications must be enabled before using the CHDLC_CONNECT conmmand */#define CHDLC_CFG_BEFORE_COMMS_ENABLED 0x22 /* perform a SET_CHDLC_CONFIGURATION before enabling comms */#define LGTH_CHDLC_CFG_DATA_INVALID 0x22 /* the length of the passed CHDLC configuration data is invalid */#define LGTH_INT_TRIGGERS_DATA_INVALID 0x22 /* the length of the passed interrupt trigger data is invalid */#define INVALID_IRQ_SELECTED 0x23 /* in invalid IRQ was selected in the SET_CHDLC_INTERRUPT_TRIGGERS */#define INVALID_CHDLC_CFG_DATA 0x23 /* the passed CHDLC configuration data is invalid */#define IRQ_TMR_VALUE_INVALID 0x24 /* an invalid application IRQ timer value was selected */#define LARGER_PERCENT_TX_BFR_REQUIRED 0x24 /* a larger Tx buffer percentage is required */#define LARGER_PERCENT_RX_BFR_REQUIRED 0x25 /* a larger Rx buffer percentage is required */#define S514_BOTH_PORTS_SAME_CLK_MODE 0x26 /* S514 - both ports must have same clock mode */#define INVALID_CMND_HDLC_STREAM_MODE 0x4E /* the CHDLC interface command is invalid for HDLC streaming mode */#define INVALID_CHDLC_COMMAND 0x4F /* the defined CHDLC interface command is invalid *//* return codes from command READ_CHDLC_EXCEPTION_CONDITION */#define EXCEP_LINK_ACTIVE 0x30 /* the CHDLC link has become active */#define EXCEP_LINK_INACTIVE_MODEM 0x31 /* the CHDLC link has become inactive (modem status) */#define EXCEP_LINK_INACTIVE_KPALV 0x32 /* the CHDLC link has become inactive (keepalive status) */#define EXCEP_IP_ADDRESS_DISCOVERED 0x33 /* the IP address has been discovered */#define EXCEP_LOOPBACK_CONDITION 0x34 /* a loopback condition has occurred *//* return code from command CHDLC_SEND_WAIT and CHDLC_SEND_NO_WAIT */#define LINK_DISCONNECTED 0x21#define NO_TX_BFRS_AVAIL 0x24/* ---------------------------------------------------------------------------- * Constants for the SET_GLOBAL_CONFIGURATION/READ_GLOBAL_CONFIGURATION commands * --------------------------------------------------------------------------*//* the global configuration structure */typedef struct { unsigned short adapter_config_options PACKED; /* adapter config options */ unsigned short app_IRQ_timeout PACKED; /* application IRQ timeout */ unsigned long adapter_operating_frequency PACKED; /* adapter operating frequency */} GLOBAL_CONFIGURATION_STRUCT;/* settings for the 'app_IRQ_timeout' */#define MAX_APP_IRQ_TIMEOUT_VALUE 5000 /* the maximum permitted IRQ timeout *//* ---------------------------------------------------------------------------- * Constants for the READ_GLOBAL_STATISTICS command * --------------------------------------------------------------------------*//* the global statistics structure */typedef struct { unsigned short app_IRQ_timeout_count PACKED;} GLOBAL_STATS_STRUCT;/* ---------------------------------------------------------------------------- * Constants for the READ_COMMS_ERROR_STATS command * --------------------------------------------------------------------------*//* the communications error statistics structure */typedef struct { unsigned short Rx_overrun_err_count PACKED; unsigned short CRC_err_count PACKED; /* receiver CRC error count */ unsigned short Rx_abort_count PACKED; /* abort frames recvd count */ unsigned short Rx_dis_pri_bfrs_full_count PACKED;/* receiver disabled */ unsigned short comms_err_stat_reserved_1 PACKED;/* reserved for later */ unsigned short sec_Tx_abort_msd_Tx_int_count PACKED; /* secondary - abort frames transmitted count (missed Tx interrupt) */ unsigned short missed_Tx_und_int_count PACKED; /* missed tx underrun interrupt count */ unsigned short sec_Tx_abort_count PACKED; /*secondary-abort frames tx count */ unsigned short DCD_state_change_count PACKED; /* DCD state change */ unsigned short CTS_state_change_count PACKED; /* CTS state change */} COMMS_ERROR_STATS_STRUCT;/* ---------------------------------------------------------------------------- * Constants used for line tracing * --------------------------------------------------------------------------*//* the trace configuration structure (SET_TRACE_CONFIGURATION/READ_TRACE_CONFIGURATION commands) */typedef struct { unsigned char trace_config PACKED; /* trace configuration */ unsigned short trace_deactivation_timer PACKED; /* trace deactivation timer */ unsigned long ptr_trace_stat_el_cfg_struct PACKED; /* a pointer to the line trace element configuration structure */} LINE_TRACE_CONFIG_STRUCT;/* 'trace_config' bit settings */#define TRACE_INACTIVE 0x00 /* trace is inactive */#define TRACE_ACTIVE 0x01 /* trace is active */#define TRACE_DELAY_MODE 0x04 /* operate the trace in delay mode */#define TRACE_DATA_FRAMES 0x08 /* trace Data frames */#define TRACE_SLARP_FRAMES 0x10 /* trace SLARP frames */#define TRACE_CDP_FRAMES 0x20 /* trace CDP frames *//* the line trace status element configuration structure */typedef struct { unsigned short number_trace_status_elements PACKED; /* number of line trace elements */ unsigned long base_addr_trace_status_elements PACKED; /* base address of the trace element list */ unsigned long next_trace_element_to_use PACKED; /* pointer to the next trace element to be used */ unsigned long base_addr_trace_buffer PACKED; /* base address of the trace data buffer */ unsigned long end_addr_trace_buffer PACKED; /* end address of the trace data buffer */} TRACE_STATUS_EL_CFG_STRUCT;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -