HAL state machines
Posted: Sat Jun 18, 2011 11:03 pm
A thought about the 'state' member variables in many of the HAL driver models structs.
In some cases (at least for GPT), the state variable is only used within chDbgAssert() to validate the drivers' state. If this is the case, one small optimization might be to only define and manage the appropriate state variables when chDbgAssert() is enabled in the build. In a 'release' configuration this would save a byte of RAM and a (tiny) bit of CPU, for each relevant driver model. Would this be sensible?
In some cases (at least for GPT), the state variable is only used within chDbgAssert() to validate the drivers' state. If this is the case, one small optimization might be to only define and manage the appropriate state variables when chDbgAssert() is enabled in the build. In a 'release' configuration this would save a byte of RAM and a (tiny) bit of CPU, for each relevant driver model. Would this be sensible?