Skip to content

Commit 9ca3e5e

Browse files
scsiphysinterface.h: more callbacks.
1 parent 0d25f6d commit 9ca3e5e

4 files changed

Lines changed: 12 additions & 6 deletions

File tree

devices/common/scsi/scsi.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,6 @@ constexpr auto SCSI_MAX_DEVS = 8;
236236

237237
class ScsiBus;
238238

239-
typedef std::function<void()> action_callback;
240-
241239
class ScsiPhysDevice : public ScsiPhysInterface, public HWComponent {
242240
public:
243241
ScsiPhysDevice(std::string name, int my_id) : ScsiPhysInterface(PHY_ID_SCSI) {
@@ -266,10 +264,14 @@ class ScsiPhysDevice : public ScsiPhysInterface, public HWComponent {
266264
this->buf_ptr = bptr;
267265
}
268266

269-
void set_more_data_cb(more_data_cb_t cb) override {
267+
void set_read_more_data_cb(more_data_cb_t cb) override {
270268
this->read_more_data = cb;
271269
}
272270

271+
void set_post_xfer_action(action_callback cb) override {
272+
this->post_xfer_action = cb;
273+
}
274+
273275
void set_status(uint8_t status_code) override {
274276
this->status = status_code;
275277
}

devices/common/scsi/scsicdrom.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ ScsiCdrom::ScsiCdrom(std::string name, int my_id) :
4949
}
5050
);
5151

52-
this->set_more_data_cb(
52+
this->set_read_more_data_cb(
5353
[this](int* dsize, uint8_t** dptr) {
5454
if (this->remain_size) {
5555
*dsize = this->read_more();

devices/common/scsi/scsihd.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ ScsiHardDisk::ScsiHardDisk(std::string name, int my_id) : ScsiPhysDevice(name, m
4848
this->set_buf_ptr(this->data_buf);
4949
this->set_buffer(this->data_buf);
5050

51-
phy_impl->set_more_data_cb(
51+
phy_impl->set_read_more_data_cb(
5252
[this](int* dsize, uint8_t** dptr) {
5353
return false;
5454
}

devices/common/scsi/scsiphysinterface.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ enum : int {
3535
// Prototype for callbacks that request more data from virtual devices.
3636
using more_data_cb_t = std::function<bool(int* data_size, uint8_t** data_ptr)>;
3737

38+
// Prototype for action callbacks.
39+
using action_callback = std::function<void()>;
40+
3841
/** Interface for the physical layer of a SCSI/ATAPI device. */
3942
class ScsiPhysInterface {
4043
public:
@@ -51,7 +54,8 @@ class ScsiPhysInterface {
5154
virtual void set_buffer(uint8_t *buf_ptr) = 0;
5255
virtual void set_status(uint8_t status_code) = 0;
5356
virtual void switch_phase(const int new_phase) = 0;
54-
virtual void set_more_data_cb(more_data_cb_t cb) = 0;
57+
virtual void set_read_more_data_cb(more_data_cb_t cb) = 0;
58+
virtual void set_post_xfer_action(action_callback cb) = 0;
5559

5660
protected:
5761
int phy_id = PHY_ID_UNKNOWN;

0 commit comments

Comments
 (0)