| 197 | } |
| 198 | |
| 199 | void Disk::StartStopUnit() |
| 200 | { |
| 201 | const bool start = GetController()->GetCmdByte(4) & 0x01; |
| 202 | const bool load = GetController()->GetCmdByte(4) & 0x02; |
| 203 | |
| 204 | if (load) { |
| 205 | LogTrace(start ? "Loading medium" : "Ejecting medium"); |
| 206 | } |
| 207 | else { |
| 208 | LogTrace(start ? "Starting unit" : "Stopping unit"); |
| 209 | |
| 210 | SetStopped(!start); |
| 211 | } |
| 212 | |
| 213 | if (!start) { |
| 214 | // Look at the eject bit and eject if necessary |
| 215 | if (load) { |
| 216 | if (IsLocked()) { |
| 217 | // Cannot be ejected because it is locked |
| 218 | throw scsi_exception(sense_key::illegal_request, asc::load_or_eject_failed); |
| 219 | } |
| 220 | |
| 221 | // Eject |
| 222 | if (!Eject(false)) { |
| 223 | throw scsi_exception(sense_key::illegal_request, asc::load_or_eject_failed); |
| 224 | } |
| 225 | } |
| 226 | else { |
| 227 | FlushCache(); |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | EnterStatusPhase(); |
| 232 | } |
| 233 | |
| 234 | |
| 235 |
nothing calls this directly
no test coverage detected