mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-06-09 07:29:36 +00:00
sc53c94: Set timer_id to zero.
If a timer is not in progress then set its timer_id to zero. Also, don't start a newer timer if an existing one is still in progress.
This commit is contained in:
parent
8a81cb4f9c
commit
82f4d05f4b
|
@ -280,9 +280,14 @@ void Sc53C94::exec_command()
|
||||||
// assert RST line
|
// assert RST line
|
||||||
this->bus_obj->assert_ctrl_line(this->my_bus_id, SCSI_CTRL_RST);
|
this->bus_obj->assert_ctrl_line(this->my_bus_id, SCSI_CTRL_RST);
|
||||||
// release RST line after 25 us
|
// release RST line after 25 us
|
||||||
|
if (my_timer_id) {
|
||||||
|
TimerManager::get_instance()->cancel_timer(this->my_timer_id);
|
||||||
|
my_timer_id = 0;
|
||||||
|
}
|
||||||
my_timer_id = TimerManager::get_instance()->add_oneshot_timer(
|
my_timer_id = TimerManager::get_instance()->add_oneshot_timer(
|
||||||
USECS_TO_NSECS(25),
|
USECS_TO_NSECS(25),
|
||||||
[this]() {
|
[this]() {
|
||||||
|
my_timer_id = 0;
|
||||||
this->bus_obj->release_ctrl_line(this->my_bus_id, SCSI_CTRL_RST);
|
this->bus_obj->release_ctrl_line(this->my_bus_id, SCSI_CTRL_RST);
|
||||||
});
|
});
|
||||||
if (!(config1 & 0x40)) {
|
if (!(config1 & 0x40)) {
|
||||||
|
@ -406,10 +411,16 @@ uint8_t Sc53C94::fifo_pop()
|
||||||
|
|
||||||
void Sc53C94::seq_defer_state(uint64_t delay_ns)
|
void Sc53C94::seq_defer_state(uint64_t delay_ns)
|
||||||
{
|
{
|
||||||
|
if (seq_timer_id) {
|
||||||
|
TimerManager::get_instance()->cancel_timer(this->seq_timer_id);
|
||||||
|
seq_timer_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
seq_timer_id = TimerManager::get_instance()->add_oneshot_timer(
|
seq_timer_id = TimerManager::get_instance()->add_oneshot_timer(
|
||||||
delay_ns,
|
delay_ns,
|
||||||
[this]() {
|
[this]() {
|
||||||
// re-enter the sequencer with the state specified in next_state
|
// re-enter the sequencer with the state specified in next_state
|
||||||
|
this->seq_timer_id = 0;
|
||||||
this->cur_state = this->next_state;
|
this->cur_state = this->next_state;
|
||||||
this->sequencer();
|
this->sequencer();
|
||||||
});
|
});
|
||||||
|
@ -576,6 +587,7 @@ void Sc53C94::notify(ScsiMsg msg_type, int param)
|
||||||
if (this->target_id == param) {
|
if (this->target_id == param) {
|
||||||
// cancel selection timeout timer
|
// cancel selection timeout timer
|
||||||
TimerManager::get_instance()->cancel_timer(this->seq_timer_id);
|
TimerManager::get_instance()->cancel_timer(this->seq_timer_id);
|
||||||
|
seq_timer_id = 0;
|
||||||
this->cur_state = SeqState::SEL_END;
|
this->cur_state = SeqState::SEL_END;
|
||||||
this->sequencer();
|
this->sequencer();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user