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

📄 ub2.h

📁 ibm的tcp-ip协议栈源代码
💻 H
字号:

/*
**     This product contains:
**              "Restricted Materials of IBM"
**              (c) Copyright IBM Corp. 1987
**              All Rights Reserved
**              Licensed Materials-Property of IBM
**
**     See Copyright Instructions, G120-2083
**
*/

/*
 *
 * $Header:   W:\srclib\ub2\ub2.h_v   1.1   04 Sep 1987  1:00:06   Joseph A. Cimmino, Jr.  $
 * 
 * $Log:   W:\srclib\ub2\ub2.h_v  $
 * 
 *    Rev 1.1   04 Sep 1987  1:00:06   Joseph A. Cimmino, Jr.
 * General cleanup.  Changes types of things that weren't really long to
 *   ADDRESS or FAR_FUNC.  Removed unused UB_* vars.  Added ADDRESS and
 *   FAR_FUNC typedefs.
 * 
 *    Rev 1.0   01 Sep 1987 14:20:02   Joseph A. Cimmino, Jr.
 * Initial revision.
 *
 */

/*       
 * This is the include file for the Ungerman - Bass NIC/ps2 ethernet
 * card the NIC/ps2 adapter is passed control blocks with a command
 * field and various other fields filled in
 */ 

#ifndef NICPS2_H
#define NICPS2_H

#include <ether.h>

/* This is for reading the I/O ports */
struct ubdevice {
	char ub_csr;		/* Control/Status reg */
	char ub_ca;		/* Channel Attention port */
	char ub_tic;		/* Timer Interrupt Clear port */
	char ub_pos5;		/*
				 * A read from this port will 
				 * return the contents of POS
				 * location 5
				 */
};

typedef int (far *FAR_FUNC)();
typedef char far *ADDRESS;

/*
 * The following are the command blocks that are used with the Pegasus Card
 */

/*
 * Command Block Header -- Common to all commands
 */

typedef struct HEADER_CB {
                char    cb_command;
                char    cb_status;
                char    cb_result;
                char    cb_report_code;
                short   cb_options;
                FAR_FUNC cb_post_routine;
                struct HEADER_CB far * cb_link;
} HEADER_CB;

/*
 * Transmit Command Block
 */

typedef struct XMIT_CB {
                short   cb_xmt_data_len;
                ADDRESS	cb_xmt_data_addr;
                short   cb_xmt_hdwr_status;
                short   cb_xmt_bfr_id;
                ADDRESS	cb_xmt_bfr_addr;
} XMIT_CB;

/*
 * Receive Command Block
 */

typedef struct RCV_CB {
                char    cb_rcv_mode;
                char    cb_rcv_status;
                short   cb_bfr_size;
                ADDRESS	cb_rcv_bfr_addr;
                short   cb_rcv_data_len;
                short   cb_rcv_frame_ct;
                short   cb_rcv_hdwr_status;
                short   cb_rcv_frame_id;
                ADDRESS    cb_rcv_bfr_ptr;
                short   cb_rcv_bfr_ct;
                ADDRESS	cb_rcv_descr;
} RCV_CB;

#define RCV_MODE_INC    1

/*
 * Initialize command block
 */

typedef struct INIT_CB {
                short   cb_init_modes;
                short   cb_max_xmt_len;
                short   cb_num_xmt_bfrs;
                short   cb_max_rcv_len;
                short   cb_num_rcv_bfrs;
                char    cb_hole1[16];
                short   cb_acq_modes;
                short   cb_acq_max_xmt_len;
                short   cb_acq_num_xmt_bfrs;
                short   cb_acq_max_rcv_len;
                short   cb_acq_num_rcv_bfrs;
                char    cb_hole2[8];
} INIT_CB;

/*
 * Status command block
 */

typedef struct STAT_CB {
                short   cb_stat_status;
                short   cb_stat_modes;
                short   cb_stat_max_xmt_len;
                short   cb_stat_num_xmt_bfrs;
                short   cb_stat_max_rcv_len;
                short   cb_stat_num_rcv_bfrs;
                char    cb_stat_unique_id[6];
                long    cb_stat_total_xmts;
                long    cb_stat_total_rcvs;
                long    cb_stat_crc_err;
                long    cb_stat_aln_err;
                long    cb_stat_rsc_err;
                long    cb_stat_ovr_err;
                char    cb_hole3[24];
} STAT_CB;

typedef struct CB {
        HEADER_CB header;
        union {
                INIT_CB CB_I;
                STAT_CB CB_S;
                XMIT_CB CB_T;
                RCV_CB CB_R;
        }CB_BODY;
#define cbi CB_BODY.CB_I
#define cbs CB_BODY.CB_S
#define cbt CB_BODY.CB_T
#define cbr CB_BODY.CB_R
} CB;

/*

 * These are the command codes for the Pegasus Card
 */

#define UB_INIT         0x40    /* Initialize */
#define UB_XMT_FR       0x41    /* Transmit Frame */
#define UB_RCV          0x42    /* Receive */
#define UB_STAT         0x43    /* Status */
#define UB_CAN_RCV      0x44    /* Cancel Receives */
#define UB_GT_XMT_BFR   0x45    /* Get Transmit Buffer */
#define UB_WR_XMT_BFR   0x46    /* Write Transmit Buffer */
#define UB_SD_XMT_BFR   0x47    /* Send Transmit Buffer */
#define UB_RL_XMT_BFR   0x48    /* Release Transmit Buffer */
#define UB_RD_FR_DT     0x49    /* Read Frame Data */
#define UB_NX_RCV_BFR   0x4A    /* Next Receive Buffer */
#define UB_FL_FR        0x4B    /* Flush Frame */
#define UB_PROBE        0x4a    /* Dummy probe  */

/*
 * These are the Result Codes for the Pegasus Card
 */

#define UB_XMT_LT_ERR           0x10    /* Data length to long or short */
#define UB_XMT_ADDR_ERR         0x11    /* Data starts at odd address */
#define UB_UNKN_CMD_ERR         0x12    /* Undefined command code in ZCB */
#define UB_UNIMPL_ERR           0x13    /* Unimplemented command code */
#define UB_XMT_COMP_SUC         0x14    /* Transmit successfully complete */
#define UB_XMT_COMP_ERR         0x15    /* Transmit completed with error */
#define UB_RCV_COMP_SUC         0x16    /* Frame received successfully */
#define UB_RCV_FR_TRUN_ERR      0x17    /* Receive buffer was to small */
#define UB_INIT_COMP            0x18    /* Initialization completed */
#define UB_STAT_COMP            0x19    /* Status completed */
#define UB_NT_YT_INIT           0x1A    /* Not Yet Initialized */
#define UB_ALR_INIT             0x1B    /* Already Initialized */
#define UB_CMD_CAN              0x1C    /* Command cancelled */
#define UB_CAN_COMP             0x1D    /* Cancel complete */
#define UB_XMT_BFR_ASS          0x1E    /* Transmit buffer assigned */
#define UB_XMT_BFR_NT_ASS       0x1F    /* Transmit buffer not assigned */
#define UB_XMT_BFR_RL           0x20    /* Transmit buffer released */
#define UB_XMT_BFR_WR           0x21    /* Transmit buffer written */
#define UB_MR_DT_AVAIL          0x22    /* More Data available */
#define UB_NO_MR_RCV_BFR        0x23    /* No more receive buffers */
#define UB_FR_ID_INV            0x24    /* Frame ID invalid */
#define UB_FL_COMP              0x25    /* Flush completed */
#define UB_FR_TBL_OVRFL         0x26    /* Frame table overflow */

#define MAX_PAC_LEN     1514

#define IOIN(p)	 inp(p) 	

struct un_stat {		/*  Ethernet Datalink stats */
        unsigned rcv;		/*  # received packets  */
        unsigned rint;		/*  # interrupts Read   */
        unsigned sent;		/*  # sent packets      */
};

#ifdef  RSC
struct rsc_test {
        unsigned t_int;
        unsigned t_rint;
        unsigned t_rbytes;
        unsigned t_xint;
        unsigned t_nint;
};
#endif
/* ------------------------------------------------------------------------ */
/* Declare some stuff here so that we don't have to repeat it everywhere    */

#ifdef  GLOBAL
#define VALUE( x )              = x
#else
#define GLOBAL          extern
#define VALUE( x )
#endif

extern NET      nets[];			/* Everybody's fav net: yours truly */

GLOBAL  struct  un_stat UB_stats;       	/* Stat info */
GLOBAL  unsigned char   _etme[ 6 ];     	/* My ethernet address */

#endif NICPS2_H

⌨️ 快捷键说明

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