summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/legscsi.h
blob: cd879856a346a7d8d7e1c6eb136c1888c3f9e90f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// license:BSD-3-Clause
// copyright-holders:smf
#ifndef _LEGSCSI_H_
#define _LEGSCSI_H_

#pragma once

#include "bus/scsi/scsihle.h"

#define MCFG_LEGACY_SCSI_PORT(_tag) \
	legacy_scsi_host_adapter::set_scsi_port(*device, "^" _tag);

class legacy_scsi_host_adapter : public device_t
{
public:
	legacy_scsi_host_adapter(const machine_config &mconfig, device_type type, std::string name, std::string tag, device_t *owner, UINT32 clock, std::string shortname, std::string source);

	static void set_scsi_port(device_t &device, std::string tag) { downcast<legacy_scsi_host_adapter &>(device).m_scsi_port.set_tag(tag); }

protected:
	virtual void device_start() override;

	void reset_bus();
	bool select(int id);
	void send_command(UINT8 *data, int bytes);
	int get_length();
	int get_phase();
	void read_data(UINT8 *data, int bytes);
	void write_data(UINT8 *data, int bytes);
	UINT8 get_status();

private:
	int m_selected;
	scsihle_device *get_device(int id);

	required_device<SCSI_PORT_DEVICE> m_scsi_port;
};

#endif