MCPcopy Create free account
hub / github.com/LibertyOS-Development/kernel / id_drive

Method id_drive

src/fs/ata.rs:200–233  ·  view source on GitHub ↗

IDENTIFY DRIVE

(&mut self, drive: u8)

Source from the content-addressed store, hash-verified

198
199 // IDENTIFY DRIVE
200 fn id_drive(&mut self, drive: u8) -> Result<IDResponse, ()>
201 {
202 if self.check_floating_bus().is_err()
203 {
204 return Ok(IDResponse::None);
205 }
206
207 self.drivesel(drive)?;
208 self.write_cmd_params(drive, 0)?;
209
210 if self.writecmd(Command::ID).is_err()
211 {
212 if self.status() == 0
213 {
214 return Ok(IDResponse::None);
215 }
216 else
217 {
218 return Err(());
219 }
220 }
221
222 match (self.lba1(), self.lba2())
223 {
224 (0x00, 0x00) => Ok(IDResponse::ATA([(); 256].map(|_|
225 {
226 self.data_read()
227 }))),
228
229 (0x14, 0xEB) => Ok(IDResponse::ATAPI),
230 (0x3C, 0x3C) => Ok(IDResponse::SATA),
231 (_, _) => Err(()),
232 }
233 }
234
235
236

Callers 1

openMethod · 0.80

Calls 10

check_floating_busMethod · 0.80
driveselMethod · 0.80
write_cmd_paramsMethod · 0.80
writecmdMethod · 0.80
statusMethod · 0.80
lba1Method · 0.80
lba2Method · 0.80
data_readMethod · 0.80
ErrEnum · 0.50
mapMethod · 0.45

Tested by

no test coverage detected