⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdla_x25.h

📁 umon bootloader source code, support mips cpu.
💻 H
📖 第 1 页 / 共 3 页
字号:
#define X25LOG_APPLICATION 	0x01
#define X25LOG_AUTOMATIC	0x02
#define X25LOG_ERROR		0x04
#define X25LOG_TIMEOUT		0x08
#define X25LOG_RECOVERY		0x10

/*
 * Defines for the 'packet' field.
 */
#define X25LOG_CALL_RQST	0x0B
#define X25LOG_CALL_ACCEPTED	0x0F
#define X25LOG_CLEAR_RQST	0x13
#define X25LOG_CLEAR_CONFRM	0x17
#define X25LOG_RESET_RQST	0x1B
#define X25LOG_RESET_CONFRM	0x1F
#define X25LOG_RESTART_RQST	0xFB
#define X25LOG_RESTART_COMFRM	0xFF
#define X25LOG_DIAGNOSTIC	0xF1
#define X25LOG_DTE_REG_RQST	0xF3
#define X25LOG_DTE_REG_COMFRM	0xF7

/* ---------------------------------------------------------------------------
 * X25_TRACE_CONFIGURE Command.
 */
typedef struct X25TraceCfg
{
	unsigned char flags	PACKED;	/* 00h: trace configuration flags */
	unsigned char timeout	PACKED;	/* 01h: timeout for trace delay mode*/
} TX25TraceCfg;

/*
 * Defines for the 'flags' field.
 */
#define X25_TRC_ENABLE		0x01	/* bit0: '1' - trace enabled */
#define X25_TRC_TIMESTAMP	0x02	/* bit1: '1' - time stamping enabled*/
#define X25_TRC_DELAY		0x04	/* bit2: '1' - trace delay enabled */
#define X25_TRC_DATA		0x08	/* bit3: '1' - trace data packets */
#define X25_TRC_SUPERVISORY	0x10    /* bit4: '1' - trace suprvisory pkts*/
#define X25_TRC_ASYNCHRONOUS	0x20	/* bit5: '1' - trace asynch. packets*/
#define X25_TRC_HDLC		0x40	/* bit6: '1' - trace all packets */
#define X25_TRC_READ		0x80	/* bit7: '1' - get current config. */

/* ---------------------------------------------------------------------------
 * X25_READ_TRACE_DATA Command.
 */
typedef struct X25Trace			/*----- Trace data structure -------*/
{
	unsigned short length	PACKED;	/* 00h: trace data length */
	unsigned char type	PACKED;	/* 02h: trace type */
	unsigned char lost_cnt	PACKED;	/* 03h: N of traces lost */
	TX25TimeStamp tstamp	PACKED;	/* 04h: mon/date/sec/min/hour */
	unsigned short millisec	PACKED;	/* 09h: ms time stamp */
	unsigned char data[0]	PACKED;	/* 0Bh: traced frame */
} TX25Trace;

/*
 * Defines for the 'type' field.
 */
#define X25_TRC_TYPE_MASK	0x0F	/* bits 0..3: trace type */
#define X25_TRC_TYPE_RX_FRAME	0x00	/* received frame trace */
#define X25_TRC_TYPE_TX_FRAME	0x01	/* transmitted frame */
#define X25_TRC_TYPE_ERR_FRAME	0x02	/* error frame */

#define X25_TRC_ERROR_MASK	0xF0	/* bits 4..7: error code */
#define X25_TRCERR_RX_ABORT	0x10	/* receive abort error */
#define X25_TRCERR_RX_BADCRC	0x20	/* receive CRC error */
#define X25_TRCERR_RX_OVERRUN	0x30	/* receiver overrun error */
#define X25_TRCERR_RX_TOO_LONG	0x40	/* excessive frame length error */
#define X25_TRCERR_TX_ABORT	0x70	/* aborted frame transmittion error */
#define X25_TRCERR_TX_UNDERRUN	0x80	/* transmit underrun error */

/*****************************************************************************
 * Following definitions describe HDLC frame and X.25 packet formats.
 ****************************************************************************/

typedef struct HDLCFrame		/*----- DHLC Frame Format ----------*/
{
	unsigned char addr	PACKED;	/* address field */
	unsigned char cntl	PACKED;	/* control field */
	unsigned char data[0]	PACKED;
} THDLCFrame;

typedef struct X25Pkt			/*----- X.25 Paket Format ----------*/
{
	unsigned char lcn_hi	PACKED;	/* 4 MSB of Logical Channel Number */
	unsigned char lcn_lo	PACKED;	/* 8 LSB of Logical Channel Number */
	unsigned char type	PACKED;
	unsigned char data[0]	PACKED;
} TX25Pkt;

/*
 * Defines for the 'lcn_hi' field.
 */
#define	X25_Q_BIT_MASK		0x80	/* Data Qualifier Bit mask */
#define	X25_D_BIT_MASK		0x40	/* Delivery Confirmation Bit mask */
#define	X25_M_BITS_MASK		0x30	/* Modulo Bits mask */
#define	X25_LCN_MSB_MASK	0x0F	/* LCN most significant bits mask */

/*
 * Defines for the 'type' field.
 */
#define	X25PKT_DATA		0x01	/* Data packet mask */
#define	X25PKT_SUPERVISORY	0x02	/* Supervisory packet mask */
#define	X25PKT_CALL_RQST	0x0B	/* Call Request/Incoming */
#define	X25PKT_CALL_ACCEPTED	0x0F	/* Call Accepted/Connected */
#define	X25PKT_CLEAR_RQST	0x13	/* Clear Request/Indication */
#define	X25PKT_CLEAR_CONFRM	0x17	/* Clear Confirmation */
#define	X25PKT_RESET_RQST	0x1B	/* Reset Request/Indication */
#define	X25PKT_RESET_CONFRM	0x1F	/* Reset Confirmation */
#define	X25PKT_RESTART_RQST	0xFB	/* Restart Request/Indication */
#define	X25PKT_RESTART_CONFRM	0xFF	/* Restart Confirmation */
#define	X25PKT_INTERRUPT	0x23	/* Interrupt */
#define	X25PKT_INTERRUPT_CONFRM	0x27	/* Interrupt Confirmation */
#define	X25PKT_DIAGNOSTIC	0xF1	/* Diagnostic */
#define	X25PKT_REGISTR_RQST	0xF3	/* Registration Request */
#define	X25PKT_REGISTR_CONFRM	0xF7	/* Registration Confirmation */
#define	X25PKT_RR_MASKED	0x01	/* Receive Ready packet after masking */
#define	X25PKT_RNR_MASKED	0x05	/* Receive Not Ready after masking  */


typedef struct {
	TX25Cmd cmd		PACKED;
	char data[X25_MAX_DATA]	PACKED;
} mbox_cmd_t;


typedef struct {
	unsigned char  qdm	PACKED;	/* Q/D/M bits */
	unsigned char  cause	PACKED;	/* cause field */
	unsigned char  diagn	PACKED;	/* diagnostics */
	unsigned char  pktType  PACKED;
	unsigned short length   PACKED;
	unsigned char  result	PACKED;
	unsigned short lcn	PACKED;
	char reserved[7]	PACKED;
}x25api_hdr_t;


typedef struct {
	x25api_hdr_t hdr	PACKED;
	char data[X25_MAX_DATA]	PACKED;
}x25api_t;


/* 
 * XPIPEMON Definitions
 */

/* valid ip_protocol for UDP management */
#define UDPMGMT_UDP_PROTOCOL 0x11
#define UDPMGMT_XPIPE_SIGNATURE         "XLINK8ND"
#define UDPMGMT_DRVRSTATS_SIGNATURE     "DRVSTATS"

/* values for request/reply byte */
#define UDPMGMT_REQUEST	0x01
#define UDPMGMT_REPLY	0x02
#define UDP_OFFSET	12


typedef struct {
	unsigned char opp_flag  PACKED; /* the opp flag */
	unsigned char command	PACKED;	/* command code */
	unsigned short length	PACKED;	/* transfer data length */
	unsigned char result	PACKED;	/* return code */
	unsigned char pf	PACKED;	/* P/F bit */
	unsigned short lcn	PACKED;	/* logical channel */
	unsigned char qdm	PACKED;	/* Q/D/M bits */
	unsigned char cause	PACKED;	/* cause field */
	unsigned char diagn	PACKED;	/* diagnostics */
	unsigned char pktType	PACKED;	/* packet type */
	unsigned char resrv[4]	PACKED;	/* reserved */
} cblock_t;

typedef struct {
	ip_pkt_t 		ip_pkt		PACKED;
	udp_pkt_t		udp_pkt		PACKED;
	wp_mgmt_t 		wp_mgmt       	PACKED;
        cblock_t                cblock          PACKED;
        unsigned char           data[4080]      PACKED;
} x25_udp_pkt_t;


typedef struct read_hdlc_stat {
	unsigned short inf_frames_rx_ok PACKED;
        unsigned short inf_frames_rx_out_of_seq PACKED;
	unsigned short inf_frames_rx_no_data PACKED;
	unsigned short inf_frames_rx_dropped PACKED;
	unsigned short inf_frames_rx_data_too_long PACKED;
	unsigned short inf_frames_rx_invalid_addr PACKED;
	unsigned short inf_frames_tx_ok PACKED;
        unsigned short inf_frames_tx_retransmit PACKED;
       	unsigned short T1_timeouts PACKED;
	unsigned short SABM_frames_rx PACKED;
	unsigned short DISC_frames_rx PACKED;
	unsigned short DM_frames_rx PACKED;
	unsigned short FRMR_frames_rx PACKED;
	unsigned short SABM_frames_tx PACKED;
	unsigned short DISC_frames_tx PACKED;
	unsigned short DM_frames_tx PACKED;
	unsigned short FRMR_frames_tx PACKED;
} read_hdlc_stat_t;

typedef struct read_comms_err_stats{
	unsigned char overrun_err_rx PACKED;
	unsigned char CRC_err PACKED;
	unsigned char abort_frames_rx PACKED;
	unsigned char frames_dropped_buf_full PACKED;
	unsigned char abort_frames_tx PACKED;
	unsigned char transmit_underruns PACKED;
	unsigned char missed_tx_underruns_intr PACKED;
	unsigned char reserved PACKED;
	unsigned char DCD_drop PACKED;
	unsigned char CTS_drop PACKED;
} read_comms_err_stats_t;

typedef struct trace_data {
	unsigned short length PACKED;
	unsigned char  type PACKED;
	unsigned char  trace_dropped PACKED;
	unsigned char  reserved[5] PACKED;
	unsigned short timestamp PACKED;
        unsigned char  data PACKED;
} trace_data_t;

enum {UDP_XPIPE_TYPE};

#define XPIPE_ENABLE_TRACING                    0x14
#define XPIPE_DISABLE_TRACING                   0x14
#define XPIPE_GET_TRACE_INFO                    0x16
#define XPIPE_FT1_READ_STATUS                   0x74
#define XPIPE_DRIVER_STAT_IFSEND                0x75
#define XPIPE_DRIVER_STAT_INTR                  0x76
#define XPIPE_DRIVER_STAT_GEN                   0x77
#define XPIPE_FLUSH_DRIVER_STATS                0x78
#define XPIPE_ROUTER_UP_TIME                    0x79        
#define XPIPE_SET_FT1_MODE			0x81
#define XPIPE_FT1_STATUS_CTRL			0x80


/* error messages */
#define NO_BUFFS_OR_CLOSED_WIN  0x33
#define DATA_LENGTH_TOO_BIG     0x32
#define NO_DATA_AVAILABLE       0x33
#define Z80_TIMEOUT_ERROR       0x0a   
#define	NO_BUFFS		0x08


/* Trace options */
#define TRACE_DEFAULT		0x03
#define TRACE_SUPERVISOR_FRMS	0x10
#define TRACE_ASYNC_FRMS	0x20
#define TRACE_ALL_HDLC_FRMS	0x40
#define TRACE_DATA_FRMS		0x08


#endif	/* _SDLA_X25_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -