📄 riowinif.h
字号:
/************************************************************************//* *//* Title : RIO Shared Memory Window Inteface *//* *//* Author : N.P.Vassallo *//* *//* Creation : 7th June 1999 *//* *//* Version : 1.0.0 *//* *//* Copyright : (c) Specialix International Ltd. 1999 * * This program is free software; you can redistribute it and/or modify * it under the terms 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. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * *//* Description : Prototypes, structures and definitions *//* describing RIO host card shared memory *//* window interface structures: *//* PARMMAP *//* RUP *//* PHB *//* LPB *//* PKT *//* *//************************************************************************//* History...1.0.0 07/06/99 NPV Creation. (based on PARMMAP.H)*/#ifndef _riowinif_h /* If RIOWINDIF.H not already defined */#define _riowinif_h 1/************************************************************************************************************* ***************************************************************** General ***************************************************************** **************************************************************************************************************/#define TPNULL ((_u16)(0x8000))/************************************************************************************************************* **************************************************************** PARM_MAP **************************************************************** *************************************************************************************************************//* The PARM_MAP structure defines global values relating to the Host Card / RTA and is the main structure from which all other structures are referenced. */typedef struct _PARM_MAP{ _u16 phb_ptr; /* 0x00 Pointer to the PHB array */ _u16 phb_num_ptr; /* 0x02 Ptr to Number of PHB's */ _u16 free_list; /* 0x04 Free List pointer */ _u16 free_list_end; /* 0x06 Free List End pointer */ _u16 q_free_list_ptr; /* 0x08 Ptr to Q_BUF variable */ _u16 unit_id_ptr; /* 0x0A Unit Id */ _u16 link_str_ptr; /* 0x0C Link Structure Array */ _u16 bootloader_1; /* 0x0E 1st Stage Boot Loader */ _u16 bootloader_2; /* 0x10 2nd Stage Boot Loader */ _u16 port_route_map_ptr; /* 0x12 Port Route Map */ _u16 route_ptr; /* 0x14 Route Map */ _u16 map_present; /* 0x16 Route Map present */ _u16 pkt_num; /* 0x18 Total number of packets */ _u16 q_num; /* 0x1A Total number of Q packets */ _u16 buffers_per_port; /* 0x1C Number of buffers per port */ _u16 heap_size; /* 0x1E Initial size of heap */ _u16 heap_left; /* 0x20 Current Heap left */ _u16 error; /* 0x22 Error code */ _u16 tx_max; /* 0x24 Max number of tx pkts per phb */ _u16 rx_max; /* 0x26 Max number of rx pkts per phb */ _u16 rx_limit; /* 0x28 For high / low watermarks */ _u16 links; /* 0x2A Links to use */ _u16 timer; /* 0x2C Interrupts per second */ _u16 rups; /* 0x2E Pointer to the RUPs */ _u16 max_phb; /* 0x30 Mostly for debugging */ _u16 living; /* 0x32 Just increments!! */ _u16 init_done; /* 0x34 Initialisation over */ _u16 booting_link; /* 0x36 */ _u16 idle_count; /* 0x38 Idle time counter */ _u16 busy_count; /* 0x3A Busy counter */ _u16 idle_control; /* 0x3C Control Idle Process */ _u16 tx_intr; /* 0x3E TX interrupt pending */ _u16 rx_intr; /* 0x40 RX interrupt pending */ _u16 rup_intr; /* 0x42 RUP interrupt pending */} PARM_MAP;/* Same thing again, but defined as offsets... */#define PM_phb_ptr 0x00 /* 0x00 Pointer to the PHB array */#define PM_phb_num_ptr 0x02 /* 0x02 Ptr to Number of PHB's */#define PM_free_list 0x04 /* 0x04 Free List pointer */#define PM_free_list_end 0x06 /* 0x06 Free List End pointer */#define PM_q_free_list_ptr 0x08 /* 0x08 Ptr to Q_BUF variable */#define PM_unit_id_ptr 0x0A /* 0x0A Unit Id */#define PM_link_str_ptr 0x0C /* 0x0C Link Structure Array */#define PM_bootloader_1 0x0E /* 0x0E 1st Stage Boot Loader */#define PM_bootloader_2 0x10 /* 0x10 2nd Stage Boot Loader */#define PM_port_route_map_ptr 0x12 /* 0x12 Port Route Map */#define PM_route_ptr 0x14 /* 0x14 Route Map */#define PM_map_present 0x16 /* 0x16 Route Map present */#define PM_pkt_num 0x18 /* 0x18 Total number of packets */#define PM_q_num 0x1A /* 0x1A Total number of Q packets */#define PM_buffers_per_port 0x1C /* 0x1C Number of buffers per port */#define PM_heap_size 0x1E /* 0x1E Initial size of heap */#define PM_heap_left 0x20 /* 0x20 Current Heap left */#define PM_error 0x22 /* 0x22 Error code */#define PM_tx_max 0x24 /* 0x24 Max number of tx pkts per phb */#define PM_rx_max 0x26 /* 0x26 Max number of rx pkts per phb */#define PM_rx_limit 0x28 /* 0x28 For high / low watermarks */#define PM_links 0x2A /* 0x2A Links to use */#define PM_timer 0x2C /* 0x2C Interrupts per second */#define PM_rups 0x2E /* 0x2E Pointer to the RUPs */#define PM_max_phb 0x30 /* 0x30 Mostly for debugging */#define PM_living 0x32 /* 0x32 Just increments!! */#define PM_init_done 0x34 /* 0x34 Initialisation over */#define PM_booting_link 0x36 /* 0x36 */#define PM_idle_count 0x38 /* 0x38 Idle time counter */#define PM_busy_count 0x3A /* 0x3A Busy counter */#define PM_idle_control 0x3C /* 0x3C Control Idle Process */#define PM_tx_intr 0x3E /* 0x4E TX interrupt pending */#define PM_rx_intr 0x40 /* 0x40 RX interrupt pending */#define PM_rup_intr 0x42 /* 0x42 RUP interrupt pending */#define sizeof_PARM_MAP 0x44 /* structure size = 0x44 *//* PARM_MAP.error definitions... */#define E_NO_ERROR 0x00#define E_PROCESS_NOT_INIT 0x01#define E_LINK_TIMEOUT 0x02#define E_NO_ROUTE 0x03#define E_CONFUSED 0x04#define E_HOME 0x05#define E_CSUM_FAIL 0x06#define E_DISCONNECTED 0x07#define E_BAD_RUP 0x08#define E_NO_VIRGIN 0x09#define E_BOOT_RUP_BUSY 0x10#define E_CHANALLOC 0x80#define E_POLL_ALLOC 0x81#define E_LTTWAKE 0x82#define E_LTT_ALLOC 0x83#define E_LRT_ALLOC 0x84#define E_CIRRUS 0x85#define E_MONITOR 0x86#define E_PHB_ALLOC 0x87#define E_ARRAY_ALLOC 0x88#define E_QBUF_ALLOC 0x89#define E_PKT_ALLOC 0x8a#define E_GET_TX_Q_BUF 0x8b#define E_GET_RX_Q_BUF 0x8c#define E_MEM_OUT 0x8d#define E_MMU_INIT 0x8e#define E_LTT_INIT 0x8f#define E_LRT_INIT 0x90#define E_LINK_RUN 0x91#define E_MONITOR_ALLOC 0x92#define E_MONITOR_INIT 0x93#define E_POLL_INIT 0x94/* PARM_MAP.links definitions... */#define RIO_LINK_ENABLE 0x80FF/*************************************************************************************************************** ********************************************************************* RUP ********************************************************************* ****************************************************************************************************************//* The RUP (Remote Unit Port) structure relates to the Remote Terminal Adapters attached to the system and there is normally an array of MAX_RUPS (=16) structures in a host card, defined by PARM_MAP->rup. */typedef struct _RUP{ _u16 txpkt; /* 0x00 Outgoing packet */ _u16 rxpkt; /* 0x02 ncoming packet */ _u16 link; /* 0x04 Which link to send packet down ? */ _u8 rup_dest_unit[2]; /* 0x06 Destination Unit */ _u16 handshake; /* 0x08 Handshaking */ _u16 timeout; /* 0x0A Timeout */ _u16 status; /* 0x0C Status */ _u16 txcontrol; /* 0x0E Transmit control */ _u16 rxcontrol; /* 0x10 Receive control */} RUP;/* Same thing again, but defined as offsets... */#define RUP_txpkt 0x00 /* 0x00 Outgoing packet */#define RUP_rxpkt 0x02 /* 0x02 Incoming packet */#define RUP_link 0x04 /* 0x04 Which link to send packet down ? */#define RUP_rup_dest_unit 0x06 /* 0x06 Destination Unit */#define RUP_handshake 0x08 /* 0x08 Handshaking */#define RUP_timeout 0x0A /* 0x0A Timeout */#define RUP_status 0x0C /* 0x0C Status */#define RUP_txcontrol 0x0E /* 0x0E Transmit control */#define RUP_rxcontrol 0x10 /* 0x10 Receive control */#define sizeof_RUP 0x12 /* structure size = 0x12 */#define MAX_RUP 16/* RUP.txcontrol definitions... */#define TX_RUP_INACTIVE 0 /* Nothing to transmit */#define TX_PACKET_READY 1 /* Transmit packet ready */#define TX_LOCK_RUP 2 /* Transmit side locked *//* RUP.txcontrol definitions... */#define RX_RUP_INACTIVE 0 /* Nothing received */#define RX_PACKET_READY 1 /* Packet received */#define RUP_NO_OWNER 0xFF /* RUP not owned by any process *//*************************************************************************************************************** ********************************************************************* PHB ********************************************************************* ****************************************************************************************************************//* The PHB (Port Header Block) structure relates to the serial ports attached to the system and there is normally an array of MAX_PHBS (=128) structures in a host card, defined by PARM_MAP->phb_ptr and PARM_MAP->phb_num_ptr. */typedef struct _PHB{ _u16 source; /* 0x00 Location of the PHB in the host card */ _u16 handshake; /* 0x02 Used to manage receive packet flow control */ _u16 status; /* 0x04 Internal port transmit/receive status */ _u16 timeout; /* 0x06 Time period to wait for an ACK */ _u16 link; /* 0x08 The host link associated with the PHB */ _u16 destination; /* 0x0A Location of the remote port on the network */ _u16 tx_start; /* 0x0C first entry in the packet array for transmit packets */ _u16 tx_end; /* 0x0E last entry in the packet array for transmit packets */ _u16 tx_add; /* 0x10 position in the packet array for new transmit packets */ _u16 tx_remove; /* 0x12 current position in the packet pointer array */ _u16 rx_start; /* 0x14 first entry in the packet array for receive packets */ _u16 rx_end; /* 0x16 last entry in the packet array for receive packets */ _u16 rx_add; /* 0x18 position in the packet array for new receive packets */ _u16 rx_remove; /* 0x1A current position in the packet pointer array */} PHB;/* Same thing again, but defined as offsets... */#define PHB_source 0x00 /* 0x00 Location of the PHB in the host card */#define PHB_handshake 0x02 /* 0x02 Used to manage receive packet flow control */#define PHB_status 0x04 /* 0x04 Internal port transmit/receive status */#define PHB_timeout 0x06 /* 0x06 Time period to wait for an ACK */#define PHB_link 0x08 /* 0x08 The host link associated with the PHB */#define PHB_destination 0x0A /* 0x0A Location of the remote port on the network */#define PHB_tx_start 0x0C /* 0x0C first entry in the packet array for transmit packets */#define PHB_tx_end 0x0E /* 0x0E last entry in the packet array for transmit packets */#define PHB_tx_add 0x10 /* 0x10 position in the packet array for new transmit packets */#define PHB_tx_remove 0x12 /* 0x12 current position in the packet pointer array */#define PHB_rx_start 0x14 /* 0x14 first entry in the packet array for receive packets */#define PHB_rx_end 0x16 /* 0x16 last entry in the packet array for receive packets */#define PHB_rx_add 0x18 /* 0x18 position in the packet array for new receive packets */#define PHB_rx_remove 0x1A /* 0x1A current position in the packet pointer array */#define sizeof_PHB 0x1C /* structure size = 0x1C *//* PHB.handshake definitions... */#define PHB_HANDSHAKE_SET 0x0001 /* Set by LRT */#define PHB_HANDSHAKE_RESET 0x0002 /* Set by ISR / driver */#define PHB_HANDSHAKE_FLAGS (PHB_HANDSHAKE_RESET|PHB_HANDSHAKE_SET) /* Reset by ltt */#define MAX_PHB 128 /* range 0-127 *//*************************************************************************************************************** ********************************************************************* LPB ********************************************************************* ****************************************************************************************************************//* The LPB (Link Parameter Block) structure relates to a RIO Network Link and there is normally an array of MAX_LINKS (=4) structures in a host card, defined by PARM_MAP->link_str_ptr. */typedef struct _LPB{ _u16 link_number; /* 0x00 Link Number */ _u16 in_ch; /* 0x02 Link In Channel */ _u16 out_ch; /* 0x04 Link Out Channel */ _u8 attached_serial[4]; /* 0x06 Attached serial number */ _u8 attached_host_serial[4];/* 0x0A Serial number of Host who booted other end */ _u16 descheduled; /* 0x0E Currently Descheduled */ _u16 state; /* 0x10 Current state */ _u16 send_poll; /* 0x12 Send a Poll Packet */ _u16 ltt_p; /* 0x14 Process Descriptor */ _u16 lrt_p; /* 0x16 Process Descriptor */ _u16 lrt_status; /* 0x18 Current lrt status */ _u16 ltt_status; /* 0x1A Current ltt status */ _u16 timeout; /* 0x1C Timeout value */ _u16 topology; /* 0x1E Topology bits */ _u16 mon_ltt; /* 0x20 */ _u16 mon_lrt; /* 0x22 */ _u16 num_pkts; /* 0x24 */ _u16 add_packet_list; /* 0x26 Add packets to here */ _u16 remove_packet_list; /* 0x28 Send packets from here */ _u16 lrt_fail_chan; /* 0x2A Lrt's failure channel */ _u16 ltt_fail_chan; /* 0x2C Ltt's failure channel */ RUP rup; /* 0x2E RUP structure for HOST to driver comms */ RUP link_rup; /* 0x40 RUP for the link (POLL, topology etc.) */ _u16 attached_link; /* 0x52 Number of attached link */ _u16 csum_errors; /* 0x54 csum errors */ _u16 num_disconnects; /* 0x56 number of disconnects */ _u16 num_sync_rcvd; /* 0x58 # sync's received */ _u16 num_sync_rqst; /* 0x5A # sync requests */ _u16 num_tx; /* 0x5C Num pkts sent */ _u16 num_rx; /* 0x5E Num pkts received */ _u16 module_attached; /* 0x60 Module tpyes of attached */ _u16 led_timeout; /* 0x62 LED timeout */ _u16 first_port; /* 0x64 First port to service */ _u16 last_port; /* 0x66 Last port to service */} LPB;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -