scsibus: push_data of zero bytes is ok.

It just means the data hasn't been put on the fifo yet.
This commit is contained in:
joevt 2023-11-04 22:19:39 -07:00 committed by dingusdev
parent 61576d4032
commit abe0c14301
1 changed files with 9 additions and 2 deletions

View File

@ -263,11 +263,18 @@ bool ScsiBus::pull_data(const int id, uint8_t* dst_ptr, const int size)
bool ScsiBus::push_data(const int id, const uint8_t* src_ptr, const int size)
{
if (!this->devices[id]->rcv_data(src_ptr, size)) {
LOG_F(ERROR, "ScsiBus: error while transferring I->T data!");
if (!this->devices[id]) {
LOG_F(ERROR, "%s: no device %d for push_data %d bytes", this->get_name().c_str(), id, size);
return false;
}
if (!this->devices[id]->rcv_data(src_ptr, size)) {
if (size) {
LOG_F(ERROR, "%s: error while transferring I->T data!", this->get_name().c_str());
return false;
}
}
return true;
}