mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-11 05:29:43 +00:00
scsidevice: add get_more_data() method.
It is required for supporting large data transfers split into multiple chunks.
This commit is contained in:
parent
e1b231882e
commit
bf278af950
@ -180,6 +180,7 @@ public:
|
|||||||
// ScsiDevice methods
|
// ScsiDevice methods
|
||||||
void notify(ScsiMsg msg_type, int param);
|
void notify(ScsiMsg msg_type, int param);
|
||||||
bool prepare_data() { return false; };
|
bool prepare_data() { return false; };
|
||||||
|
bool get_more_data() { return false; };
|
||||||
bool has_data() { return this->data_fifo_pos != 0; };
|
bool has_data() { return this->data_fifo_pos != 0; };
|
||||||
int send_data(uint8_t* dst_ptr, int count);
|
int send_data(uint8_t* dst_ptr, int count);
|
||||||
void process_command() {};
|
void process_command() {};
|
||||||
|
@ -183,6 +183,7 @@ public:
|
|||||||
virtual int rcv_data(const uint8_t* src_ptr, const int count);
|
virtual int rcv_data(const uint8_t* src_ptr, const int count);
|
||||||
|
|
||||||
virtual bool prepare_data() = 0;
|
virtual bool prepare_data() = 0;
|
||||||
|
virtual bool get_more_data() = 0;
|
||||||
virtual void process_command() = 0;
|
virtual void process_command() = 0;
|
||||||
|
|
||||||
void set_bus_object_ptr(ScsiBus *bus_obj_ptr) {
|
void set_bus_object_ptr(ScsiBus *bus_obj_ptr) {
|
||||||
|
@ -113,7 +113,7 @@ void ScsiDevice::prepare_xfer(ScsiBus* bus_obj, int& bytes_in, int& bytes_out)
|
|||||||
switch (this->cur_phase) {
|
switch (this->cur_phase) {
|
||||||
case ScsiPhase::COMMAND:
|
case ScsiPhase::COMMAND:
|
||||||
this->data_ptr = this->cmd_buf;
|
this->data_ptr = this->cmd_buf;
|
||||||
this->data_size = 0; //bytes_in;
|
this->data_size = 0;
|
||||||
bytes_out = 0;
|
bytes_out = 0;
|
||||||
break;
|
break;
|
||||||
case ScsiPhase::STATUS:
|
case ScsiPhase::STATUS:
|
||||||
@ -189,6 +189,18 @@ int ScsiDevice::send_data(uint8_t* dst_ptr, const int count)
|
|||||||
this->data_ptr += actual_count;
|
this->data_ptr += actual_count;
|
||||||
this->data_size -= actual_count;
|
this->data_size -= actual_count;
|
||||||
|
|
||||||
|
// attempt to return the requested amount of data
|
||||||
|
// when data_size drops down to zero
|
||||||
|
if (!this->data_size) {
|
||||||
|
if (this->get_more_data() && count > actual_count) {
|
||||||
|
dst_ptr += actual_count;
|
||||||
|
actual_count = std::min(this->data_size, count - actual_count);
|
||||||
|
std::memcpy(dst_ptr, this->data_ptr, actual_count);
|
||||||
|
this->data_ptr += actual_count;
|
||||||
|
this->data_size -= actual_count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return actual_count;
|
return actual_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ public:
|
|||||||
void insert_image(std::string filename);
|
void insert_image(std::string filename);
|
||||||
void process_command();
|
void process_command();
|
||||||
bool prepare_data();
|
bool prepare_data();
|
||||||
|
bool get_more_data() { return false; };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int test_unit_ready();
|
int test_unit_ready();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user