2017-10-08 05:04:38 +02:00
|
|
|
/*
|
2023-01-06 15:36:05 -05:00
|
|
|
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
|
|
|
|
* running old operating systems and software designed for IBM
|
|
|
|
|
* PC systems and compatibles from 1981 through fairly recent
|
|
|
|
|
* system designs based on the PCI bus.
|
2017-10-08 05:04:38 +02:00
|
|
|
*
|
2023-01-06 15:36:05 -05:00
|
|
|
* This file is part of the 86Box distribution.
|
2017-10-08 05:04:38 +02:00
|
|
|
*
|
2024-04-10 17:27:30 +02:00
|
|
|
* Implementation of the NCR 5380 chip made by NCR
|
|
|
|
|
* and used in various controllers.
|
2017-10-08 05:04:38 +02:00
|
|
|
*
|
2020-03-25 00:46:02 +02:00
|
|
|
*
|
2017-10-08 05:04:38 +02:00
|
|
|
*
|
2023-01-06 15:36:29 -05:00
|
|
|
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
2023-01-06 15:36:05 -05:00
|
|
|
* TheCollector1995, <mariogplayer@gmail.com>
|
|
|
|
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
2018-01-13 22:56:13 +01:00
|
|
|
*
|
2023-01-06 15:36:05 -05:00
|
|
|
* Copyright 2017-2018 Sarah Walker.
|
2023-01-06 15:36:29 -05:00
|
|
|
* Copyright 2017-2018 Fred N. van Kempen.
|
2024-04-10 17:27:30 +02:00
|
|
|
* Copyright 2017-2024 TheCollector1995.
|
2017-10-08 05:04:38 +02:00
|
|
|
*/
|
2022-02-18 19:42:21 -05:00
|
|
|
|
2017-10-08 05:04:38 +02:00
|
|
|
#ifndef SCSI_NCR5380_H
|
2022-09-18 17:15:38 -04:00
|
|
|
#define SCSI_NCR5380_H
|
2017-10-08 05:04:38 +02:00
|
|
|
|
2024-04-10 17:27:30 +02:00
|
|
|
#define NCR_CURDATA 0 /* current SCSI data (read only) */
|
|
|
|
|
#define NCR_OUTDATA 0 /* output data (write only) */
|
|
|
|
|
#define NCR_INITCOMMAND 1 /* initiator command (read/write) */
|
|
|
|
|
#define NCR_MODE 2 /* mode (read/write) */
|
|
|
|
|
#define NCR_TARGETCMD 3 /* target command (read/write) */
|
|
|
|
|
#define NCR_SELENABLE 4 /* select enable (write only) */
|
|
|
|
|
#define NCR_BUSSTATUS 4 /* bus status (read only) */
|
|
|
|
|
#define NCR_STARTDMA 5 /* start DMA send (write only) */
|
|
|
|
|
#define NCR_BUSANDSTAT 5 /* bus and status (read only) */
|
|
|
|
|
#define NCR_DMATARGET 6 /* DMA target (write only) */
|
|
|
|
|
#define NCR_INPUTDATA 6 /* input data (read only) */
|
|
|
|
|
#define NCR_DMAINIRECV 7 /* DMA initiator receive (write only) */
|
|
|
|
|
#define NCR_RESETPARITY 7 /* reset parity/interrupt (read only) */
|
|
|
|
|
|
|
|
|
|
#define ICR_DBP 0x01
|
|
|
|
|
#define ICR_ATN 0x02
|
|
|
|
|
#define ICR_SEL 0x04
|
|
|
|
|
#define ICR_BSY 0x08
|
|
|
|
|
#define ICR_ACK 0x10
|
|
|
|
|
#define ICR_ARB_LOST 0x20
|
|
|
|
|
#define ICR_ARB_IN_PROGRESS 0x40
|
2025-01-20 19:55:18 +01:00
|
|
|
#define ICR_RST 0x80
|
|
|
|
|
#define ICR_PHASE 0x9e
|
|
|
|
|
#define ICR_WRITE 0x9f
|
2024-04-10 17:27:30 +02:00
|
|
|
|
|
|
|
|
#define MODE_ARBITRATE 0x01
|
|
|
|
|
#define MODE_DMA 0x02
|
|
|
|
|
#define MODE_MONITOR_BUSY 0x04
|
|
|
|
|
#define MODE_ENA_EOP_INT 0x08
|
|
|
|
|
|
|
|
|
|
#define STATUS_ACK 0x01
|
|
|
|
|
#define STATUS_BUSY_ERROR 0x04
|
|
|
|
|
#define STATUS_PHASE_MATCH 0x08
|
|
|
|
|
#define STATUS_INT 0x10
|
|
|
|
|
#define STATUS_DRQ 0x40
|
|
|
|
|
#define STATUS_END_OF_DMA 0x80
|
|
|
|
|
|
|
|
|
|
#define TCR_IO 0x01
|
|
|
|
|
#define TCR_CD 0x02
|
|
|
|
|
#define TCR_MSG 0x04
|
|
|
|
|
#define TCR_REQ 0x08
|
|
|
|
|
#define TCR_LAST_BYTE_SENT 0x80
|
|
|
|
|
|
|
|
|
|
typedef struct ncr_t {
|
|
|
|
|
uint8_t icr;
|
|
|
|
|
uint8_t mode;
|
|
|
|
|
uint8_t tcr;
|
|
|
|
|
uint8_t isr;
|
|
|
|
|
uint8_t output_data;
|
|
|
|
|
uint8_t tx_data;
|
2024-05-03 17:02:13 +02:00
|
|
|
uint8_t irq_state;
|
2025-01-26 15:42:03 +01:00
|
|
|
uint8_t isr_reg;
|
2024-04-10 17:27:30 +02:00
|
|
|
|
|
|
|
|
uint8_t bus;
|
|
|
|
|
|
|
|
|
|
int irq;
|
|
|
|
|
|
|
|
|
|
double period;
|
|
|
|
|
|
|
|
|
|
void *priv;
|
2025-01-20 19:55:18 +01:00
|
|
|
void (*dma_mode_ext)(void *priv, void *ext_priv, uint8_t val);
|
2024-04-10 17:27:30 +02:00
|
|
|
int (*dma_send_ext)(void *priv, void *ext_priv);
|
|
|
|
|
int (*dma_initiator_receive_ext)(void *priv, void *ext_priv);
|
|
|
|
|
void (*timer)(void *ext_priv, double period);
|
|
|
|
|
|
2025-01-20 19:55:18 +01:00
|
|
|
scsi_bus_t scsibus;
|
|
|
|
|
} ncr_t;
|
2024-04-10 17:27:30 +02:00
|
|
|
|
|
|
|
|
extern void ncr5380_irq(ncr_t *ncr, int set_irq);
|
2025-01-20 19:55:18 +01:00
|
|
|
extern void ncr5380_set_irq(ncr_t *ncr, int irq);
|
2024-04-10 17:27:30 +02:00
|
|
|
extern uint32_t ncr5380_get_bus_host(ncr_t *ncr);
|
|
|
|
|
extern void ncr5380_write(uint16_t port, uint8_t val, ncr_t *ncr);
|
|
|
|
|
extern uint8_t ncr5380_read(uint16_t port, ncr_t *ncr);
|
|
|
|
|
|
|
|
|
|
#ifdef EMU_DEVICE_H
|
2018-03-19 01:02:04 +01:00
|
|
|
extern const device_t scsi_lcs6821n_device;
|
2024-05-06 13:09:08 +02:00
|
|
|
extern const device_t scsi_pas_device;
|
2018-03-19 01:02:04 +01:00
|
|
|
extern const device_t scsi_rt1000b_device;
|
2022-07-09 23:19:18 +02:00
|
|
|
extern const device_t scsi_rt1000mc_device;
|
2021-08-17 14:26:47 +02:00
|
|
|
extern const device_t scsi_t128_device;
|
2024-04-10 17:27:30 +02:00
|
|
|
extern const device_t scsi_t228_device;
|
2018-03-19 01:02:04 +01:00
|
|
|
extern const device_t scsi_t130b_device;
|
2022-03-01 14:20:11 +01:00
|
|
|
extern const device_t scsi_ls2000_device;
|
2024-04-10 17:27:30 +02:00
|
|
|
#endif
|
2017-10-08 05:04:38 +02:00
|
|
|
|
2022-09-18 17:15:38 -04:00
|
|
|
#endif /*SCSI_NCR5380_H*/
|