1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

i2c: consolidate handling of AUTO transitions

AUTO transitions in the FSM are now handled immediately
after processing each newly injected event rather than only
at the end of the EV ISR.

This consolidation allows the upcoming addition of event
injection from both the EV and ER ISR contexts.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1624 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
stac 2010-09-15 14:20:56 +00:00 committed by stac
parent 7d5463e5e6
commit 0122394481

View File

@ -94,6 +94,7 @@ struct i2c_adapter_transition {
enum i2c_adapter_state next_state[I2C_EVENT_NUM_EVENTS];
};
static void i2c_adapter_process_auto(struct pios_i2c_adapter * i2c_adapter);
static void i2c_adapter_inject_event(struct pios_i2c_adapter * i2c_adapter, enum i2c_adapter_event event);
static void i2c_adapter_fsm_init(struct pios_i2c_adapter * i2c_adapter);
static bool i2c_adapter_wait_for_stopped(struct pios_i2c_adapter * i2c_adapter);
@ -509,6 +510,10 @@ static void i2c_adapter_inject_event(struct pios_i2c_adapter * i2c_adapter, enum
if (i2c_adapter_transitions[i2c_adapter->curr_state].entry_fn) {
i2c_adapter_transitions[i2c_adapter->curr_state].entry_fn(i2c_adapter);
}
/* Process any AUTO transitions in the FSM */
i2c_adapter_process_auto(i2c_adapter);
PIOS_IRQ_Enable();
}
@ -836,8 +841,6 @@ void PIOS_I2C_EV_IRQ_Handler(uint8_t i2c)
break;
}
i2c_adapter_process_auto(i2c_adapter);
skip_event:
;
}