mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-10 13:29:38 +00:00
amic: implement SCSI DRQ callback.
This commit is contained in:
parent
9e54fb88f8
commit
ae903082d8
@ -32,6 +32,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#include <devices/common/scsi/scsi.h>
|
||||
|
||||
#include <cinttypes>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
class DmaBidirChannel;
|
||||
@ -145,6 +146,8 @@ typedef struct {
|
||||
int status;
|
||||
} SeqDesc;
|
||||
|
||||
typedef std::function<void(const uint8_t drq_state)> DrqCb;
|
||||
|
||||
class Sc53C94 : public ScsiDevice {
|
||||
public:
|
||||
Sc53C94(uint8_t chip_id=12, uint8_t my_id=7);
|
||||
@ -169,6 +172,10 @@ public:
|
||||
this->dma_ch = dma_ch;
|
||||
};
|
||||
|
||||
void set_drq_callback(DrqCb cb) {
|
||||
this->drq_cb = cb;
|
||||
}
|
||||
|
||||
// ScsiDevice methods
|
||||
void notify(ScsiMsg msg_type, int param);
|
||||
bool prepare_data() { return false; };
|
||||
@ -233,6 +240,7 @@ private:
|
||||
|
||||
// DMA related stuff
|
||||
DmaBidirChannel* dma_ch;
|
||||
DrqCb drq_cb = nullptr;
|
||||
};
|
||||
|
||||
#endif // SC_53C94_H
|
||||
|
@ -47,7 +47,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
AMIC::AMIC() : MMIODevice()
|
||||
{
|
||||
this->name = "Apple Memory-mapped I/O Controller";
|
||||
this->set_name("Apple Memory-mapped I/O Controller");
|
||||
|
||||
supports_types(HWCompType::MMIO_DEV | HWCompType::INT_CTRL);
|
||||
|
||||
@ -55,6 +55,13 @@ AMIC::AMIC() : MMIODevice()
|
||||
this->scsi = dynamic_cast<Sc53C94*>(gMachineObj->get_comp_by_name("Sc53C94"));
|
||||
this->scsi_dma = std::unique_ptr<AmicScsiDma> (new AmicScsiDma());
|
||||
this->scsi->set_dma_channel(this->scsi_dma.get());
|
||||
this->scsi->set_drq_callback([this](const uint8_t drq_state) {
|
||||
if (drq_state & 1)
|
||||
via2_ifr |= VIA2_INT_SCSI_DRQ;
|
||||
else
|
||||
via2_ifr &= ~VIA2_INT_SCSI_DRQ;
|
||||
this->update_via2_irq();
|
||||
});
|
||||
|
||||
// connect serial HW
|
||||
this->escc = dynamic_cast<EsccController*>(gMachineObj->get_comp_by_name("Escc"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user