Rewrote timer code.
The new code is based on timestamps, rather than delays. This eliminates the need to update every timer in timer_process(), which cost a non-trivial amount of CPU time on low-end machines. This involved changes to every user of the timer code, so this change almost certainly introduces bugs.
This commit is contained in:
parent
ab359ca9c5
commit
a7d006b637
79 changed files with 1050 additions and 1033 deletions
|
|
@ -68,7 +68,7 @@ typedef struct scsi_zip_data
|
|||
|
||||
int hd_id;
|
||||
|
||||
int callback;
|
||||
pc_timer_t callback_timer;
|
||||
|
||||
scsi_bus_t *bus;
|
||||
|
||||
|
|
@ -176,8 +176,6 @@ static void scsi_zip_callback(void *p)
|
|||
{
|
||||
scsi_zip_data *data = p;
|
||||
|
||||
data->callback = 0;
|
||||
|
||||
if (data->cmd_pos == CMD_POS_WAIT)
|
||||
{
|
||||
data->cmd_pos = data->new_cmd_pos;
|
||||
|
|
@ -194,7 +192,7 @@ static void *scsi_zip_init(scsi_bus_t *bus, int id)
|
|||
|
||||
data->hd_id = id;
|
||||
data->bus = bus;
|
||||
timer_add(scsi_zip_callback, &data->callback, &data->callback, data);
|
||||
timer_add(&data->callback_timer, scsi_zip_callback, data, 0);
|
||||
|
||||
zip_data = data;
|
||||
return data;
|
||||
|
|
@ -689,7 +687,7 @@ static int scsi_zip_command(uint8_t *cdb, void *p)
|
|||
// pclog("SCSI_READ_6: addr=%08x len=%04x\n", data->addr, data->len);
|
||||
|
||||
data->cmd_pos = CMD_POS_WAIT;
|
||||
data->callback = RW_DELAY;
|
||||
timer_set_delay_u64(&data->callback_timer, RW_DELAY);
|
||||
data->new_cmd_pos = CMD_POS_START_SECTOR;
|
||||
data->sector_pos = 0;
|
||||
|
||||
|
|
@ -750,7 +748,7 @@ static int scsi_zip_command(uint8_t *cdb, void *p)
|
|||
// pclog("SCSI_READ_10: addr=%08x len=%04x\n", data->addr, data->len);
|
||||
|
||||
data->cmd_pos = CMD_POS_WAIT;
|
||||
data->callback = RW_DELAY;
|
||||
timer_set_delay_u64(&data->callback_timer, RW_DELAY);
|
||||
data->new_cmd_pos = CMD_POS_START_SECTOR;
|
||||
data->sector_pos = 0;
|
||||
|
||||
|
|
@ -819,7 +817,7 @@ static int scsi_zip_command(uint8_t *cdb, void *p)
|
|||
data->bytes_required = data->len * 512;
|
||||
|
||||
data->cmd_pos = CMD_POS_WAIT;
|
||||
data->callback = RW_DELAY;
|
||||
timer_set_delay_u64(&data->callback_timer, RW_DELAY);
|
||||
data->new_cmd_pos = CMD_POS_TRANSFER;
|
||||
data->sector_pos = 0;
|
||||
|
||||
|
|
@ -887,7 +885,7 @@ static int scsi_zip_command(uint8_t *cdb, void *p)
|
|||
data->bytes_required = data->len * 512;
|
||||
|
||||
data->cmd_pos = CMD_POS_WAIT;
|
||||
data->callback = RW_DELAY;
|
||||
timer_set_delay_u64(&data->callback_timer, RW_DELAY);
|
||||
data->new_cmd_pos = CMD_POS_TRANSFER;
|
||||
data->sector_pos = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue