MCPcopy Create free account
hub / github.com/ading2210/linuxpdf / ide_sector_read

Function ide_sector_read

tinyemu/ide.c:370–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

368}
369
370static void ide_sector_read(IDEState *s)
371{
372 int64_t sector_num;
373 int ret, n;
374
375 sector_num = ide_get_sector(s);
376 n = s->nsector;
377 if (n == 0)
378 n = 256;
379 if (n > s->req_nb_sectors)
380 n = s->req_nb_sectors;
381#if defined(DEBUG_IDE)
382 printf("read sector=%" PRId64 " count=%d\n", sector_num, n);
383#endif
384 s->io_nb_sectors = n;
385 ret = s->bs->read_async(s->bs, sector_num, s->io_buffer, n,
386 ide_sector_read_cb, s);
387 if (ret < 0) {
388 /* error */
389 ide_abort_command(s);
390 ide_set_irq(s);
391 } else if (ret == 0) {
392 /* synchronous case (needed for performance) */
393 ide_sector_read_cb(s, 0);
394 } else {
395 /* async case */
396 s->status = READY_STAT | SEEK_STAT | BUSY_STAT;
397 s->error = 0; /* not needed by IDE spec, but needed by Windows */
398 }
399}
400
401static void ide_sector_read_cb(void *opaque, int ret)
402{

Callers 1

ide_exec_cmdFunction · 0.85

Calls 4

ide_get_sectorFunction · 0.85
ide_abort_commandFunction · 0.85
ide_set_irqFunction · 0.85
ide_sector_read_cbFunction · 0.85

Tested by

no test coverage detected