Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 1 | /* chip_defs.h: definitions for several chips
|
| 2 |
|
| 3 | Copyright (c) 2009-2010 Holger Veit
|
| 4 |
|
| 5 | Permission is hereby granted, free of charge, to any person obtaining a
|
| 6 | copy of this software and associated documentation files (the "Software"),
|
| 7 | to deal in the Software without restriction, including without limitation
|
| 8 | the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
| 9 | and/or sell copies of the Software, and to permit persons to whom the
|
| 10 | Software is furnished to do so, subject to the following conditions:
|
| 11 |
|
| 12 | The above copyright notice and this permission notice shall be included in
|
| 13 | all copies or substantial portions of the Software.
|
| 14 |
|
| 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
| 18 | Holger Veit BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
| 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
| 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 21 |
|
| 22 | Except as contained in this notice, the name of Holger Veit et al shall not be
|
| 23 | used in advertising or otherwise to promote the sale, use or other dealings
|
| 24 | in this Software without prior written authorization from Holger Veit et al.
|
| 25 |
|
| 26 | 22-Jan-10 HV Initial version
|
| 27 | */
|
| 28 | #ifndef CHIP_DEFS_H_
|
| 29 | #define CHIP_DEFS_H_
|
| 30 |
|
| 31 | #include "sim_imd.h"
|
| 32 | #include "sim_sock.h"
|
| 33 | #include "sim_tmxr.h"
|
| 34 |
|
| 35 | /*****************************************************************************************
|
| 36 | * General implementation note:
|
| 37 | *
|
| 38 | * Each chip device is implemented through a specific data structure, e.g. struct i8251
|
| 39 | * The address of this data structure MUST be passed to the device->ctxt variable.
|
| 40 | * The data structure MUST contain a PNP_INFO attribute at the beginning.
|
| 41 | *
|
| 42 | * In case each unit of a complex device has an own chip, device->ctxt points to an array
|
| 43 | * of as much elements as there are units.
|
| 44 | * The device reset routine MUST call add_iohandler and del_iohandler depending on
|
| 45 | * enable or disable of the device. add_iohandler and del_iohandler will be passed
|
| 46 | * the corresponding address of the data structure for the chip (device->ctxt).
|
| 47 | *
|
| 48 | *****************************************************************************************/
|
| 49 |
|
| 50 | /* set this to 0 to remove debug messages */
|
| 51 | #ifndef DBG_MSG
|
| 52 | #define DBG_MSG 1
|
| 53 | #endif
|
| 54 |
|
| 55 | /* generic debug tracing support */
|
| 56 | #if DBG_MSG==1
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 57 |
|
Mark Pizzolato | 66dba79 | 2015-03-30 10:24:24 -0700 | [diff] [blame] | 58 | #define ADDRESS_FORMAT "[0x%08x]"
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 59 | #if UNIX_PLATFORM
|
| 60 | #define NLP "\r\n"
|
| 61 | #else
|
| 62 | #define NLP "\n"
|
| 63 | #endif
|
| 64 |
|
| 65 | #define TRACE_PRINT(level,args)\
|
Mark Pizzolato | 66dba79 | 2015-03-30 10:24:24 -0700 | [diff] [blame] | 66 | if(sim_deb && chip->dev->dctrl & level) { \
|
| 67 | fprintf(sim_deb,"%-4s: " ADDRESS_FORMAT " ", chip->dev->name, PCX); \
|
| 68 | fprintf args; fputs(NLP,sim_deb); }
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 69 | #define TRACE_PRINT0(level,fmt)\
|
Mark Pizzolato | 66dba79 | 2015-03-30 10:24:24 -0700 | [diff] [blame] | 70 | if(sim_deb && chip->dev->dctrl & level) { \
|
| 71 | fprintf(sim_deb,"%-4s: " ADDRESS_FORMAT " ", chip->dev->name, PCX); \
|
| 72 | fprintf(sim_deb,fmt NLP); }
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 73 | #define TRACE_PRINT1(level,fmt,arg1)\
|
Mark Pizzolato | 66dba79 | 2015-03-30 10:24:24 -0700 | [diff] [blame] | 74 | if(sim_deb && chip->dev->dctrl & level) { \
|
| 75 | fprintf(sim_deb,"%-4s: " ADDRESS_FORMAT " ", chip->dev->name, PCX); \
|
| 76 | fprintf(sim_deb,fmt NLP,arg1); }
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 77 | #define TRACE_PRINT2(level,fmt,arg1,arg2)\
|
Mark Pizzolato | 66dba79 | 2015-03-30 10:24:24 -0700 | [diff] [blame] | 78 | if(sim_deb && chip->dev->dctrl & level) { \
|
| 79 | fprintf(sim_deb,"%-4s: " ADDRESS_FORMAT " ", chip->dev->name, PCX); \
|
| 80 | fprintf(sim_deb,fmt NLP,arg1,arg2); }
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 81 | #else
|
| 82 | #define TRACE_PRINT(level,args)
|
| 83 | #define TRACE_PRINT0(level,fmt)
|
| 84 | #define TRACE_PRINT1(level,fmt,arg1)
|
| 85 | #define TRACE_PRINT2(level,fmt,arg1,arg2)
|
| 86 | #endif
|
| 87 |
|
| 88 | /*****************************************************************************************
|
| 89 | * general terminal multiplexer/socket support
|
| 90 | *****************************************************************************************/
|
| 91 |
|
| 92 | typedef struct {
|
Mark Pizzolato | 66dba79 | 2015-03-30 10:24:24 -0700 | [diff] [blame] | 93 | int pfirst;
|
| 94 | int prate;
|
| 95 | TMLN ldsc;
|
| 96 | TMXR desc;
|
| 97 | UNIT* term;
|
| 98 | UNIT* poll;
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 99 | } SERMUX;
|
Mark Pizzolato | 5531ccb | 2016-05-15 15:25:33 -0700 | [diff] [blame] | 100 | t_stat mux_attach(UNIT*,CONST char*,SERMUX*);
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 101 | t_stat mux_detach(UNIT*,SERMUX*);
|
| 102 |
|
| 103 | /*****************************************************************************************
|
| 104 | * 8259 PIC
|
| 105 | *****************************************************************************************/
|
Mark Pizzolato | 66dba79 | 2015-03-30 10:24:24 -0700 | [diff] [blame] | 106 | #define I8259_ICW1 0x10
|
| 107 | #define I8259_ICW1_A765 0xe0
|
| 108 | #define I8259_ICW1_LTIM 0x08
|
| 109 | #define I8259_ICW1_ADI 0x04
|
| 110 | #define I8259_ICW1_SNGL 0x02
|
| 111 | #define I8259_ICW1_IC4 0x01
|
| 112 | #define I8259_ICW4_SFNM 0x10
|
| 113 | #define I8259_ICW4_BUF 0x08
|
| 114 | #define I8259_ICW4_MS 0x04
|
| 115 | #define I8259_ICW4_AEOI 0x02
|
| 116 | #define I8259_ICW4_UPM 0x01
|
| 117 | #define I8259_OCW2_MODE 0xe0
|
| 118 | #define I8259_OCW2_LEVEL 0x07
|
| 119 | #define I8259_OCW3_ESMM 0x40
|
| 120 | #define I8259_OCW3_SMM 0x20
|
| 121 | #define I8259_OCW3 0x08
|
| 122 | #define I8259_OCW3_POLL 0x04
|
| 123 | #define I8259_OCW3_RR 0x02
|
| 124 | #define I8259_OCW3_RIS 0x01
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 125 |
|
| 126 | typedef struct i8259 {
|
Mark Pizzolato | 66dba79 | 2015-03-30 10:24:24 -0700 | [diff] [blame] | 127 | PNP_INFO pnp;
|
| 128 | DEVICE* dev; /* backlink to device */
|
| 129 | t_stat (*write)(struct i8259* chip,int port,uint32 value);
|
| 130 | t_stat (*read)(struct i8259* chip,int port,uint32* value);
|
| 131 | t_stat (*reset)(struct i8259* chip);
|
| 132 | int state;
|
| 133 | int rmode;
|
| 134 | int32 imr;
|
| 135 | int32 isr;
|
| 136 | int32 irr;
|
| 137 | int32 icw1;
|
| 138 | int32 icw2;
|
| 139 | int32 icw4;
|
| 140 | int32 prio; /* which IR* has prio 7? */
|
| 141 | t_bool autoint;
|
| 142 | int intlevel;
|
| 143 | int intvector;
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 144 | } I8259;
|
| 145 |
|
| 146 | extern t_stat i8259_io(IOHANDLER* ioh,uint32* value,uint32 rw,uint32 mask);
|
| 147 | extern t_stat i8259_read(I8259* pic,int addr,uint32* value);
|
| 148 | extern t_stat i8259_write(I8259* pic,int addr, uint32 value);
|
| 149 | extern t_stat i8259_reset(I8259* chip);
|
| 150 | extern t_stat i8259_raiseint(I8259* chip,int level);
|
| 151 |
|
| 152 | /* Debug flags */
|
| 153 | #define DBG_PIC_RD (1 << 0)
|
| 154 | #define DBG_PIC_WR (1 << 1)
|
| 155 | #define DBG_PIC_II (1 << 2)
|
| 156 | #define DBG_PIC_IO (1 << 3)
|
| 157 | extern DEBTAB i8259_dt[];
|
| 158 |
|
| 159 | /*****************************************************************************************
|
| 160 | * 8251 USART
|
| 161 | *****************************************************************************************/
|
Mark Pizzolato | 66dba79 | 2015-03-30 10:24:24 -0700 | [diff] [blame] | 162 | #define I8251_AMODE_STOP 0xc0
|
| 163 | #define I8251_AMODE_S1 0x40
|
| 164 | #define I8251_AMODE_S15 0x80
|
| 165 | #define I8251_AMODE_S2 0xc0
|
| 166 | #define I8251_MODE_EP 0x20
|
| 167 | #define I8251_MODE_PEN 0x10
|
| 168 | #define I8251_AMODE_BITS 0x0c
|
| 169 | #define I8251_AMODE_BITS5 0x00
|
| 170 | #define I8251_AMODE_BITS6 0x04
|
| 171 | #define I8251_AMODE_BITS7 0x08
|
| 172 | #define I8251_AMODE_BITS8 0x0c
|
| 173 | #define I8251_MODE_BAUD 0x03
|
| 174 | #define I8251_MODE_SYNC 0x00
|
| 175 | #define I8251_AMODE_BAUD1 0x01
|
| 176 | #define I8251_AMODE_BAUD16 0x02
|
| 177 | #define I8251_AMODE_BAUD64 0x03
|
| 178 | #define I8251_SMODE_ESD 0x40
|
| 179 | #define I8251_SMODE_SCS 0x80
|
| 180 | #define I8251_CMD_EH 0x80
|
| 181 | #define I8251_CMD_IR 0x40
|
| 182 | #define I8251_CMD_RTS 0x20
|
| 183 | #define I8251_CMD_ER 0x10
|
| 184 | #define I8251_CMD_SBRK 0x08
|
| 185 | #define I8251_CMD_RXE 0x04
|
| 186 | #define I8251_CMD_DTR 0x02
|
| 187 | #define I8251_CMD_TXEN 0x01
|
| 188 | #define I8251_ST_DSR 0x80
|
| 189 | #define I8251_ST_SYNBRK 0x40
|
| 190 | #define I8251_ST_FE 0x20
|
| 191 | #define I8251_ST_OE 0x10
|
| 192 | #define I8251_ST_PE 0x08
|
| 193 | #define I8251_ST_TXEMPTY 0x04
|
| 194 | #define I8251_ST_RXRDY 0x02
|
| 195 | #define I8251_ST_TXRDY 0x01
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 196 |
|
| 197 | typedef struct i8251 {
|
Mark Pizzolato | 66dba79 | 2015-03-30 10:24:24 -0700 | [diff] [blame] | 198 | PNP_INFO pnp;
|
| 199 | DEVICE* dev; /* backlink to device */
|
| 200 | t_stat (*write)(struct i8251* chip,int port,uint32 value);
|
| 201 | t_stat (*read)(struct i8251* chip,int port,uint32* value);
|
| 202 | t_stat (*reset)(struct i8251* chip);
|
| 203 | t_stat (*txint)(struct i8251* chip);
|
| 204 | t_stat (*rxint)(struct i8251* chip);
|
| 205 | UNIT* in;
|
| 206 | UNIT* out;
|
| 207 | SERMUX* mux;
|
| 208 | int init;
|
| 209 | int mode;
|
| 210 | int sync1;
|
| 211 | int sync2;
|
| 212 | int cmd;
|
| 213 | int ibuf;
|
| 214 | int obuf;
|
| 215 | int status;
|
| 216 | int bitmask;
|
| 217 | t_bool oob; /* out-of-band=1 will allow a console to receive CTRL-E even when receiver is disabled */
|
| 218 | int crlf; /* CRLF state machine to suppress NUL bytes */
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 219 | } I8251;
|
| 220 |
|
| 221 | /* default handlers */
|
| 222 | extern t_stat i8251_io(IOHANDLER* ioh,uint32* value,uint32 rw,uint32 mask);
|
| 223 | extern t_stat i8251_write(I8251* chip,int port,uint32 value);
|
| 224 | extern t_stat i8251_read(I8251* chip,int port,uint32* value);
|
| 225 | extern t_stat i8251_reset(I8251* chip);
|
| 226 |
|
| 227 | /* Debug flags */
|
| 228 | #define DBG_UART_RD (1 << 0)
|
| 229 | #define DBG_UART_WR (1 << 1)
|
| 230 | #define DBG_UART_IRQ (1 << 2)
|
| 231 | extern DEBTAB i8251_dt[];
|
| 232 |
|
| 233 |
|
| 234 | /*****************************************************************************************
|
| 235 | * 8253 TIMER
|
| 236 | *****************************************************************************************/
|
| 237 | /*forward*/ struct i8253;
|
| 238 | typedef struct {
|
Mark Pizzolato | 66dba79 | 2015-03-30 10:24:24 -0700 | [diff] [blame] | 239 | t_stat (*call)(struct i8253* chip,int rw,uint32* src);
|
| 240 | int state; /* the current output state (latching, MSB/LSB out */
|
| 241 | int mode; /* programmed mode */
|
| 242 | int32 latch; /* the latched value of count */
|
| 243 | int32 divider; /* programmed divider value */
|
| 244 | int32 count; /* the real count value as calculated by rcall callback */
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 245 | } I8253CNTR;
|
| 246 |
|
| 247 | typedef struct i8253 {
|
Mark Pizzolato | 66dba79 | 2015-03-30 10:24:24 -0700 | [diff] [blame] | 248 | PNP_INFO pnp;
|
| 249 | DEVICE* dev; /* backlink to device */
|
| 250 | UNIT* unit; /* backlink to unit */
|
| 251 | t_stat (*reset)(struct i8253* chip);
|
| 252 | t_stat (*ckmode)(struct i8253* chip, uint32 value);
|
| 253 | I8253CNTR cntr[3];
|
| 254 | int init;
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 255 | } I8253;
|
| 256 |
|
Mark Pizzolato | 66dba79 | 2015-03-30 10:24:24 -0700 | [diff] [blame] | 257 | #define I8253_SCMASK 0xc0
|
| 258 | #define I8253_SC0 0x00
|
| 259 | #define I8253_SC1 0x40
|
| 260 | #define I8253_SC2 0x80
|
| 261 | #define I8253_RLMASK 0x30
|
| 262 | #define I8253_LATCH 0x00
|
| 263 | #define I8253_LSB 0x10
|
| 264 | #define I8253_MSB 0x20
|
| 265 | #define I8253_BOTH 0x30
|
| 266 | #define I8253_MODEMASK 0xe0
|
| 267 | #define I8253_MODE0 0x00
|
| 268 | #define I8253_MODE1 0x02
|
| 269 | #define I8253_MODE2 0x04
|
| 270 | #define I8253_MODE2a 0x0c
|
| 271 | #define I8253_MODE3 0x06
|
| 272 | #define I8253_MODE3a 0x0e
|
| 273 | #define I8253_MODE4 0x08
|
| 274 | #define I8253_MODE5 0x0a
|
| 275 | #define I8253_MODEBIN 0x00
|
| 276 | #define I8253_MODEBCD 0x01
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 277 |
|
Mark Pizzolato | 66dba79 | 2015-03-30 10:24:24 -0700 | [diff] [blame] | 278 | #define I8253_ST_LSBNEXT 0x01
|
| 279 | #define I8253_ST_MSBNEXT 0x02
|
| 280 | #define I8253_ST_LATCH 0x08
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 281 |
|
| 282 | /* default handlers */
|
| 283 | extern t_stat i8253_io(IOHANDLER* ioh,uint32* value,uint32 rw,uint32 mask);
|
| 284 | extern t_stat i8253_reset(I8253* chip);
|
| 285 |
|
| 286 | /* Debug flags */
|
| 287 | #define DBG_TMR_RD (1 << 0)
|
| 288 | #define DBG_TMR_WR (1 << 1)
|
| 289 | extern DEBTAB i8253_dt[];
|
| 290 |
|
| 291 | /****************************************************************************************
|
| 292 | * upd765 FDC chip
|
| 293 | ***************************************************************************************/
|
| 294 | #define I8272_MAX_DRIVES 4
|
| 295 | #define I8272_MAX_SECTOR 26
|
| 296 | #define I8272_MAX_SECTOR_SZ 8192
|
| 297 | /* 2^(7 + I8272_MAX_N) == I8272_MAX_SECTOR_SZ */
|
| 298 | #define I8272_MAX_N 6
|
| 299 |
|
| 300 | #define I8272_FDC_MSR 0 /* R=FDC Main Status Register, W=Drive Select Register */
|
| 301 | #define I8272_FDC_DATA 1 /* R/W FDC Data Register */
|
| 302 |
|
| 303 | typedef struct {
|
| 304 | UNIT *uptr;
|
| 305 | DISK_INFO *imd;
|
| 306 | uint8 ntracks; /* number of tracks */
|
| 307 | uint8 nheads; /* number of heads */
|
| 308 | uint32 sectsize; /* sector size, not including pre/postamble */
|
| 309 | uint8 track; /* Current Track */
|
| 310 | uint8 ready; /* Is drive ready? */
|
| 311 | } I8272_DRIVE_INFO;
|
| 312 |
|
| 313 | typedef enum i8272state {
|
Mark Pizzolato | 66dba79 | 2015-03-30 10:24:24 -0700 | [diff] [blame] | 314 | S_CMD=1, S_CMDREAD, S_EXEC, S_DATAWRITE, S_SECWRITE, S_SECREAD, S_DATAREAD, S_RESULT
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 315 | } I8272_STATE;
|
| 316 |
|
| 317 | typedef struct i8272 {
|
Mark Pizzolato | 66dba79 | 2015-03-30 10:24:24 -0700 | [diff] [blame] | 318 | PNP_INFO pnp; /* Plug-n-Play Information */
|
| 319 | DEVICE* dev; /* backlink to device */
|
| 320 | t_stat (*write)(struct i8272* chip,int port,uint32 data);
|
| 321 | t_stat (*read)(struct i8272* chip,int port,uint32* data);
|
| 322 | t_stat (*reset)(struct i8272* chip);
|
| 323 | void (*seldrv)(struct i8272* chip,int seldrv);
|
| 324 | void (*irq)(struct i8272* chip,int delay);
|
| 325 |
|
| 326 | I8272_STATE fdc_state; /* internal state machine */
|
| 327 | uint32 fdc_dma_addr;/* DMA Transfer Address */
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 328 | uint8 fdc_msr; /* 8272 Main Status Register */
|
| 329 | uint8 fdc_nd; /* Non-DMA Mode 1=Non-DMA, 0=DMA */
|
| 330 | uint8 fdc_head; /* H Head Number */
|
| 331 | uint8 fdc_sector; /* R Record (Sector) */
|
| 332 | uint8 fdc_sec_len; /* N Sector Length in controller units (2^(7+fdc_sec_len)) */
|
| 333 | uint8 fdc_eot; /* EOT End of Track (Final sector number of cyl) */
|
| 334 | uint8 fdc_gap; /* GAP Length */
|
| 335 | uint8 fdc_dtl; /* DTL Data Length */
|
| 336 | uint8 fdc_mt; /* Multiple sectors */
|
| 337 | uint8 fdc_mfm; /* MFM mode */
|
| 338 | uint8 fdc_sk; /* Skip Deleted Data */
|
| 339 | uint8 fdc_hds; /* Head Select */
|
| 340 | uint8 fdc_seek_end; /* Seek was executed successfully */
|
| 341 | int fdc_secsz; /* N Sector Length in bytes: 2^(7 + fdc_sec_len), fdc_sec_len <= I8272_MAX_N */
|
| 342 | int fdc_nd_cnt; /* read/write count in non-DMA mode, -1 if start read */
|
Mark Pizzolato | 66dba79 | 2015-03-30 10:24:24 -0700 | [diff] [blame] | 343 | uint8 fdc_sdata[I8272_MAX_SECTOR_SZ]; /* sector buffer */
|
| 344 | uint8 fdc_fault; /* error code passed from some commands to sense_int */
|
| 345 |
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 346 | uint8 cmd_cnt; /* command read count */
|
| 347 | uint8 cmd[10]; /* Storage for current command */
|
| 348 | uint8 cmd_len; /* FDC Command Length */
|
| 349 |
|
| 350 | uint8 result_cnt; /* result emit count */
|
| 351 | uint8 result[10]; /* Result data */
|
| 352 | uint8 result_len; /* FDC Result Length */
|
| 353 |
|
| 354 | uint8 idcount; /* used to cycle sector numbers during ReadID */
|
| 355 | uint8 irqflag; /* set by interrupt, cleared by I8272_SENSE_INTERRUPT */
|
| 356 |
|
| 357 | uint8 fdc_curdrv; /* Currently selected drive */
|
| 358 | I8272_DRIVE_INFO drive[I8272_MAX_DRIVES];
|
| 359 | } I8272;
|
| 360 |
|
| 361 | extern t_stat i8272_io(IOHANDLER* ioh,uint32* value,uint32 rw,uint32 mask);
|
| 362 | extern t_stat i8272_write(I8272* chip, int addr, uint32 value);
|
| 363 | extern t_stat i8272_read(I8272* chip,int addr,uint32* value);
|
| 364 | extern t_stat i8272_reset(I8272* chip);
|
| 365 | extern void i8272_seldrv(I8272* chip,int drvnum);
|
| 366 | extern t_stat i8272_abortio(I8272* chip);
|
| 367 | extern t_stat i8272_finish(I8272* chip);
|
Mark Pizzolato | 5531ccb | 2016-05-15 15:25:33 -0700 | [diff] [blame] | 368 | extern t_stat i8272_attach(UNIT *uptr, CONST char *cptr);
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 369 | extern t_stat i8272_detach(UNIT *uptr);
|
| 370 | extern t_stat i8272_setDMA(I8272* chip, uint32 dma_addr);
|
| 371 |
|
| 372 | /* Debug flags */
|
| 373 | #define DBG_FD_ERROR (1 << 0)
|
| 374 | #define DBG_FD_SEEK (1 << 1)
|
| 375 | #define DBG_FD_CMD (1 << 2)
|
| 376 | #define DBG_FD_RDDATA (1 << 3)
|
| 377 | #define DBG_FD_WRDATA (1 << 4)
|
| 378 | #define DBG_FD_STATUS (1 << 5)
|
| 379 | #define DBG_FD_FMT (1 << 6)
|
| 380 | #define DBG_FD_VERBOSE (1 << 7)
|
| 381 | #define DBG_FD_IRQ (1 << 8)
|
| 382 | #define DBG_FD_STATE (1 << 9)
|
| 383 | #define DBG_FD_IMD (1 << 10)
|
| 384 | #define DBG_FD_DATA (1 << 11)
|
| 385 | extern DEBTAB i8272_dt[];
|
| 386 | extern DEVICE* i8272_dev;
|
| 387 |
|
| 388 | /* moved from i8272.c */
|
| 389 | #define UNIT_V_I8272_WLK (UNIT_V_UF + 0) /* write locked */
|
| 390 | #define UNIT_I8272_WLK (1 << UNIT_V_I8272_WLK)
|
| 391 | #define UNIT_V_I8272_VERBOSE (UNIT_V_UF + 1) /* verbose mode, i.e. show error messages */
|
| 392 | #define UNIT_I8272_VERBOSE (1 << UNIT_V_I8272_VERBOSE)
|
| 393 | #define I8272_CAPACITY (77*2*16*256) /* Default Micropolis Disk Capacity */
|
| 394 | #define I8272_CAPACITY_SSSD (77*1*26*128) /* Single-sided Single Density IBM Diskette1 */
|
| 395 |
|
| 396 | /*****************************************************************************************
|
| 397 | * 8255 PARPORT
|
| 398 | *****************************************************************************************/
|
| 399 | typedef struct i8255 {
|
Mark Pizzolato | 66dba79 | 2015-03-30 10:24:24 -0700 | [diff] [blame] | 400 | PNP_INFO pnp;
|
| 401 | DEVICE* dev; /* backlink to device */
|
| 402 | t_stat (*write)(struct i8255* chip,int port,uint32 data);
|
| 403 | t_stat (*read)(struct i8255* chip,int port,uint32* data);
|
| 404 | t_stat (*reset)(struct i8255* chip);
|
| 405 | t_stat (*calla)(struct i8255* chip,int rw);
|
| 406 | t_stat (*callb)(struct i8255* chip,int rw);
|
| 407 | t_stat (*callc)(struct i8255* chip,int rw);
|
| 408 | t_stat (*ckmode)(struct i8255* chip,uint32 data);
|
| 409 | uint32 porta;
|
| 410 | uint32 last_porta; /* for edge detection */
|
| 411 | uint32 portb;
|
| 412 | uint32 last_portb; /* for edge detection */
|
| 413 | uint32 portc;
|
| 414 | uint32 last_portc; /* for edge detection */
|
| 415 | uint32 ctrl;
|
Mark Pizzolato | e2524e7 | 2014-09-17 17:31:40 -0700 | [diff] [blame] | 416 | } I8255;
|
| 417 | extern t_stat i8255_io(IOHANDLER* ioh,uint32* value,uint32 rw,uint32 mask);
|
| 418 | extern t_stat i8255_read(I8255* chip,int port,uint32* data);
|
| 419 | extern t_stat i8255_write(I8255* chip,int port,uint32 data);
|
| 420 | #define I8255_RISEEDGE(port,bit) ((chip->last_##port & bit)==0 && (chip->port & bit))
|
| 421 | #define I8255_FALLEDGE(port,bit) ((chip->last_##port & bit) && (chip->port & bit)==0)
|
| 422 | #define I8255_ISSET(port,bit) ((chip->port & (bit))==(bit))
|
| 423 | #define I8255_ISCLR(port,bit) ((chip->port & (bit))==0)
|
| 424 |
|
| 425 | /* debug flags */
|
| 426 | #define DBG_PP_WRA (1<<0)
|
| 427 | #define DBG_PP_WRB (1<<1)
|
| 428 | #define DBG_PP_WRC (1<<2)
|
| 429 | #define DBG_PP_RDA (1<<3)
|
| 430 | #define DBG_PP_RDB (1<<4)
|
| 431 | #define DBG_PP_RDC (1<<5)
|
| 432 | #define DBG_PP_MODE (1<<6)
|
| 433 |
|
| 434 | #endif /*CHIP_DEFS_H_*/
|