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?
HAL state machines
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: HAL state machines
Hi,
The state is checked in the low level driver in xxxStart/xxxStop functions, often also the ISR code performs checks on the state. Some drivers also export to the application an xxxGetDriverState() API when the driver state has to be accessed externally.
Giovanni
The state is checked in the low level driver in xxxStart/xxxStop functions, often also the ISR code performs checks on the state. Some drivers also export to the application an xxxGetDriverState() API when the driver state has to be accessed externally.
Giovanni
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: HAL state machines
No need to apologize, thanks also to your past noises
the project improved and evolved.
Giovanni
Giovanni