root/src/dps8/h316_imp.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * h316_imp.h- BBN ARPAnet IMP/TIP Definitions
   3  *
   4  * vim: filetype=c:tabstop=4:ai:expandtab
   5  * SPDX-License-Identifier: MIT
   6  * scspell-id: 50c5a696-f62f-11ec-99dc-80ee73e9b8e7
   7  *
   8  * ---------------------------------------------------------------------------
   9  *
  10  * Copyright (c) 2013 Robert Armstrong <bob@jfcl.com>
  11  * Copyright (c) 2021-2023 The DPS8M Development Team
  12  *
  13  * Permission is hereby granted, free of charge, to any person obtaining a
  14  * copy of this software and associated documentation files (the "Software"),
  15  * to deal in the Software without restriction, including without limitation
  16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  17  * and/or sell copies of the Software, and to permit persons to whom the
  18  * Software is furnished to do so, subject to the following conditions:
  19  *
  20  * The above copyright notice and this permission notice shall be included in
  21  * all copies or substantial portions of the Software.
  22  *
  23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  24  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  26  * ROBERT ARMSTRONG BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  27  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
  28  * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  29  * SOFTWARE.
  30  *
  31  * Except as contained in this notice, the name of Robert Armstrong shall not
  32  * be used in advertising or otherwise to promote the sale, use or other
  33  * dealings in this Software without prior written authorization from Robert
  34  * Armstrong.
  35  *
  36  * ---------------------------------------------------------------------------
  37  */
  38 
  39 #ifdef WITH_ABSI_DEV
  40 
  41 // Common modem and host parameters ...
  42 # define MI_NUM            5     // number of modem interfaces
  43 # define HI_NUM            4     // number of host interfaces
  44 # define MI_MAX_MSG      256     // longest possible modem message (words!)
  45 # define HI_MAX_MSG      256     // longest possible host message (words!)
  46 # define MI_RXPOLL       100     // RX polling delay for UDP messages
  47 # define MI_TXBPS      56000UL   // default TX speed (bits per second)
  48 # define HI_POLL_DELAY  1000     // polling delay for messages
  49 
  50 // Modem interface, line #1 ...
  51 # define MI1                     071     // IO address for modem interface #1
  52 # define MI1_RX_DMC       (DMC1-1+ 1)    // DMC channel for modem 1 receive
  53 # define MI1_TX_DMC       (DMC1-1+ 6)    // DMC channel for modem 1 transmit
  54 # define INT_V_MI1RX  (INT_V_EXTD+15)    // modem 1 receive interrupt
  55 # define INT_V_MI1TX  (INT_V_EXTD+10)    // modem 1 transmit interrupt
  56 
  57 // Modem interface, line #2 ...
  58 # define MI2                     072     // IO address for modem interface #2
  59 # define MI2_RX_DMC       (DMC1-1+ 2)    // DMC channel for modem 2 receive
  60 # define MI2_TX_DMC       (DMC1-1+ 7)    // DMC channel for modem 2 transmit
  61 # define INT_V_MI2RX  (INT_V_EXTD+14)    // modem 2 receive interrupt
  62 # define INT_V_MI2TX  (INT_V_EXTD+ 9)    // modem 2 transmit interrupt
  63 
  64 // Modem interface, line #3 ...
  65 # define MI3                     073     // IO address for modem interface #3
  66 # define MI3_RX_DMC       (DMC1-1+ 3)    // DMC channel for modem 3 receive
  67 # define MI3_TX_DMC       (DMC1-1+ 8)    // DMC channel for modem 3 transmit
  68 # define INT_V_MI3RX  (INT_V_EXTD+13)    // modem 3 receive interrupt
  69 # define INT_V_MI3TX  (INT_V_EXTD+ 8)    // modem 3 transmit interrupt
  70 
  71 // Modem interface, line #4 ...
  72 # define MI4                     074     // IO address for modem interface #4
  73 # define MI4_RX_DMC       (DMC1-1+ 4)    // DMC channel for modem 4 receive
  74 # define MI4_TX_DMC       (DMC1-1+ 9)    // DMC channel for modem 4 transmit
  75 # define INT_V_MI4RX  (INT_V_EXTD+12)    // modem 4 receive interrupt
  76 # define INT_V_MI4TX  (INT_V_EXTD+ 7)    // modem 4 transmit interrupt
  77 
  78 // Modem interface, line #5 ...
  79 # define MI5                     075     // IO address for modem interface #5
  80 # define MI5_RX_DMC       (DMC1-1+ 5)    // DMC channel for modem 5 receive
  81 # define MI5_TX_DMC       (DMC1-1+10)    // DMC channel for modem 5 transmit
  82 # define INT_V_MI5RX  (INT_V_EXTD+11)    // modem 5 receive interrupt
  83 # define INT_V_MI5TX  (INT_V_EXTD+ 6)    // modem 5 transmit interrupt
  84 
  85 // Host interface, line #1 ...
  86 # define HI1                     070     // device address for host interface #1
  87 # define HI1_RX_DMC       (DMC1+13-1)    // DMC channel for host 1 receive
  88 # define HI1_TX_DMC       (DMC1+11-1)    // DMC channel for host 1 transmit
  89 # define INT_V_HI1RX  (INT_V_EXTD+ 3)    // host 1 receive interrupt
  90 # define INT_V_HI1TX  (INT_V_EXTD+ 5)    // host 1 transmit interrupt
  91 
  92 // Host interface, line #2 ...
  93 # define HI2                     060     // device address for host interface #2
  94 # define HI2_RX_DMC       (DMC1-1+14)    // DMC channel for host 2 receive
  95 # define HI2_TX_DMC       (DMC1-1+12)    // DMC channel for host 2 transmit
  96 # define INT_V_HI2RX  (INT_V_EXTD+ 2)    // host 2 receive interrupt
  97 # define INT_V_HI2TX  (INT_V_EXTD+ 4)    // host 2 transmit interrupt
  98 
  99 // Host interface, line #3 ...
 100 # define HI3                     051     // device address for host interface #3
 101 # define HI3_RX_DMC        (DMC1-1+16)   // DMC channel for host 3 receive
 102 # define HI3_TX_DMC        (DMC1-1+15)   // DMC channel for host 3 transmit
 103 # define INT_V_HI3RX   (INT_V_EXTD+ 6)   // host 3 receive interrupt
 104 # define INT_V_HI3TX   (INT_V_EXTD+11)   // host 3 transmit interrupt
 105 
 106 // Host interface, line #4 ...
 107 # define HI4                     050     // device address for host interface #4
 108 # define HI4_RX_DMC       (DMC1-1+10)    // DMC channel for host 4 receive
 109 # define HI4_TX_DMC       (DMC1-1+ 5)    // DMC channel for host 4 transmit
 110 # define INT_V_HI4RX  (INT_V_EXTD+ 7)    // host 4 receive interrupt
 111 # define INT_V_HI4TX  (INT_V_EXTD+12)    // host 4 transmit interrupt
 112 
 113 // IMP defaults ...
 114 # define IMP                     041     // IMP device IO address (41 & 42 actually!)
 115 # define INT_V_TASK   (INT_V_EXTD+ 0)    // task switch interrupt number
 116 # define IMP_STATION               1     // default station number
 117 
 118 // RTC defaults ...
 119 # define RTC                     040     // real time clock IO address
 120 # define INT_V_RTC    (INT_V_EXTD+ 1)    // RTC interrupt number
 121 # define RTC_INTERVAL            20UL    // default RTC interval (20us == 50kHz)
 122 # define RTC_QUANTUM             32UL    // default RTC quantum (32 ticks)
 123 
 124 // WDT defaults ...
 125 # define WDT                     026     // watchdog timer IO address
 126 # define WDT_VECTOR           000062     // WDT timeout vector
 127 # define WDT_DELAY                 0     // default WDT timeout (in milliseconds)
 128 
 129 // Debugging flags ...
 130 //   In general, these bits are used as arguments for sim_debug().  Bits that
 131 // begin with "IMP_DBG_xyz" are shared by more than one device (e.g. IMP_DBG_UDP)
 132 // and must have unique bit assignments.  Bits prefixed with a device name (e.g.
 133 // "MI_DBG_xyz") apply to that device only.
 134 # define IMP_DBG_WARN    0x0001  // all: print warnings
 135 # define IMP_DBG_IOT     0x0002  // all: trace all program I/O instructions
 136 # define IMP_DBG_UDP     0x0004  // all: trace UDP packets
 137 # define MI_DBG_MSG      0x8000  // modem: decode and print all messages
 138 # define WDT_DBG_LIGHTS  0x8000  // wdt: show status light changes
 139 
 140 // Synonyms for DIB and UNIT fields ...
 141 # define rxdmc   chan            // dib->rxdmc
 142 # define txdmc   chan2           // dib->txdmc
 143 # define rxint   inum            // dib->rxint
 144 # define txint   inum2           // dib->txint
 145 
 146 // Modem interface data block ....
 147 //   One of these is allocated to every modem interface to keep track of the
 148 // current state, COM port, UDP connection , etc...
 149 struct _MIDB {
 150   // Receiver data ...
 151   bool          rxpending;        // TRUE if a read is pending on this line
 152   bool          rxerror;          // TRUE if any modem error detected
 153   uint32_t      rxtotal;          // total number of H316 words received
 154   // Transmitter data ...
 155   uint32_t      txtotal;          // total number of H316 words transmitted
 156   uint32_t      txdelay;          // RTC ticks until TX done interrupt
 157   // Other data ...
 158   bool          lloop;            // line loop back enabled
 159   bool          iloop;            // interface loop back enabled
 160   int32_t       link;             // h316_udp link number
 161   uint32_t      bps;              // simulated line speed or COM port baud rate
 162 };
 163 typedef struct _MIDB MIDB;
 164 
 165 // Host interface data block ...
 166 //   One of these is allocated to every host interface ...
 167 struct _HIDB {
 168   // Receiver (HOST -> IMP) data ...
 169   uint32_t      rxtotal;          // total host messages received
 170   // Transmitter (IMP -> HOST) data ...
 171   uint32_t      txtotal;          // total host messages sent
 172   // Other data ...
 173   bool          lloop;            // local loop back enabled
 174   bool          enabled;          // TRUE if the host is enabled
 175   bool          error;            // TRUE for any host error
 176   bool          ready;            // TRUE if the host is ready
 177   bool          full;             // TRUE if the host buffer is full
 178   bool          eom;              // TRUE when end of message is reached
 179 };
 180 typedef struct _HIDB HIDB;
 181 
 182 // I can't believe Bob managed to live without these, but I can't!
 183 # ifndef LOBYTE  // these are in winsock.h too!
 184 #  define LOBYTE(x)    ((uint8_t) ( (x)        & 0xFF))
 185 #  define HIBYTE(x)    ((uint8_t) (((x) >> 8)  & 0xFF))
 186 #  define MKWORD(h,l) ((uint16_t) ( (((h)&0xFF)   << 8) | ((l)&0xFF) ))
 187 #  define LOWORD(x)   ((uint16_t) ( (x)        & 0xFFFF))
 188 #  define HIWORD(x)   ((uint16_t) (((x) >> 16) & 0xFFFF))
 189 #  define MKLONG(h,l) ((uint32_t) ( (((h)&0xFFFF) << 16) | ((l)&0xFFFF) ))
 190 # endif
 191 
 192 #endif /* ifdef WITH_ABSI_DEV */

/* [previous][next][first][last][top][bottom][index][help] */